Merge tag 'upstream/1.5.0.1+git20150316' into debian-experimental

Upstream version 1.5.0.1+git20150316
diff --git a/ChangeLog b/ChangeLog
index 7cfdf4a..2b61b99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,2313 +1,9 @@
-=== release 1.4.5 ===
-
-2014-12-18  Sebastian Dröge <slomo@coaxion.net>
-
-	* configure.ac:
-	  releasing 1.4.5
-
-2014-11-09 10:25:25 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/avfvideosrc.m:
-	  avfvideosrc: Don't pretend to support reconfiguration
-	  We will run into an assertion in set_caps() if we try to change
-	  caps while the source is already running. Don't try to find new
-	  caps in GstBaseSrc::negotiate() to prevent caps changes.
-
-2014-12-17 12:20:54 +1100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/avfvideosrc.m:
-	  avfvideosrc: improve timestamping and latency reporting
-	  Use AVF provided timings to timestamp output buffers. Use the running time at
-	  the time the first buffer is produced to base timestamps on. Report 1-frame
-	  latency based on the negotiated framerate instead of hardcoding 4ms latency.
-
-2014-12-10 22:36:53 +1100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: negotiate profile and level with downstream
-
-2014-12-10 19:44:01 +1100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: report latency
-
-2014-12-05 16:33:20 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: Add properties to specify the maximum keyframe interval in frames and seconds
-
-2014-11-27 13:40:56 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: add quality property
-
-2014-11-27 13:33:07 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/Makefile.am:
-	* sys/applemedia/vtenc.c:
-	  vtenc: set profile and level in caps
-
-2014-12-05 16:15:23 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Fix conversion of the bitrate property and our internal bitrate storage
-	  The property is in kbit/s and we store it in bit/s, so just multiply and
-	  divide by 1000. No need to put a factor of 8 in there.
-	  kVTCompressionPropertyKey_AverageBitRate is also in bit/s according to
-	  its documentation.
-
-2014-12-16 13:35:14 +0100  Wim Taymans <wtaymans@redhat.com>
-
-	* ext/directfb/dfbvideosink.c:
-	* ext/sdl/sdlvideosink.c:
-	* ext/wayland/wlwindow.c:
-	* sys/directdraw/gstdirectdrawsink.c:
-	* sys/pvr2d/gstpvrvideosink.c:
-	* sys/vdpau/gstvdpvideopostprocess.c:
-	  rectangle: clear rectangle struct before use
-
-2014-12-15 15:21:50 +0000  Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
-
-	* ext/opus/gstopusparse.c:
-	  opusparse: fix frame size determination
-	  https://bugzilla.gnome.org/show_bug.cgi?id=741321
-
-2014-05-08 10:41:03 +0530  Sudip Jain <sudip.jain@linaro.org>
-
-	* gst/mpegtsdemux/mpegtsbase.c:
-	  mpegtsbase: scan more bytes to find initial PCRs
-	  Fixes playback of Samsung-Colorful-Variety-1080i.ts.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=729768
-
-2014-12-09 05:03:11 +0100  Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
-
-	* gst/geometrictransform/gstmirror.c:
-	  mirror: Needs remap when the mode changes.
-	  This caused the user to think the mode wasn't taken into account.
-
-2014-12-01 09:48:41 +0100  Thomas Klausner <wiz@danbala.tuwien.ac.at>
-
-	* configure.ac:
-	  configure: Do comparisons in a portable way with = instead of ==
-	  https://bugzilla.gnome.org/show_bug.cgi?id=740953
-
-2014-11-27 16:43:39 +0100  Thibault Saunier <tsaunier@gnome.org>
-
-	* gst/audiomixer/gstaudiomixer.c:
-	  audiomixer: Do not try to resize a buffer to a negative size on EOS
-
-2014-11-24 13:56:56 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/decklink/gstdecklink.cpp:
-	  decklink: HD1080i50 is 50 frames per second
-
-2014-11-14 10:55:14 +0900  Wonchul Lee <wonchul86.lee@lge.com>
-
-	* gst/rawparse/gstrawparse.c:
-	  rawparse: send SEEKING query upstream first
-	  Sometimes rawparse does not handle the seeking query
-	  properly, the rawparse should send the query upstream
-	  first. For example, upstream could support seeking in
-	  TIME format (but not in BYTE format), so the BYTE format
-	  seeking query that rawparse sends in push mode would
-	  fail.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=722764
-
-2014-11-21 15:46:49 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: let VT pick the bitrate by default
-
-2014-11-06 13:22:17 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: add realtime and allow-frame-reordering properties
-
-2014-11-20 10:23:30 -0800  Aleix Conchillo Flaqué <aleix@oblong.com>
-
-	* ext/srtp/gstsrtpdec.c:
-	  srtpdec: fix rtp/rtcp sink event memory leak
-	  https://bugzilla.gnome.org/show_bug.cgi?id=740451
-
-2014-11-20 16:04:34 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: set H264_Baseline_AutoLevel on OSX as well
-
-2014-11-20 15:50:18 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: disable the reorder queue for baseline streams
-
-2014-11-20 09:41:43 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: Fix divide by zero in the picture buffer length calculation
-
-2014-11-16 10:57:55 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	* gst-libs/gst/gl/gstglapi.h:
-	  gl: Use numeric OSX version instead of the macro
-	  The macro is not defined on older OSX versions and evaluates to 0.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=740201
-
-2014-11-13 12:01:25 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Don't override the application delegate
-	  Otherwise interesting things will happen in Cocoa applications, like
-	  infinite event loops that block the NSApplication loop forever.
-	  This was only needed for GNUStep and thus can safely be removed now.
-
-2014-11-16 11:00:14 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Only use convertRectToBacking on OSX >= 10.7
-	  It does not exist before and older versions also don't have
-	  support for HiDPI displays anyway.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=740201
-
-2014-11-13 11:58:07 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	* gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m:
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	* tests/examples/gl/cocoa/cocoa-videooverlay.m:
-	  gl/cocoa: Remove GNUStep support
-	  Until gcc and GNUStep properly support Objective-C blocks and other
-	  "new" features of Objective-C we can't properly support them without
-	  making the code much more ugly.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=739152
-
-2014-11-12 16:45:12 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: fix build on iOS
-
-2014-11-12 15:35:36 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/coremediabuffer.c:
-	  coremediabuffer: set ->pixel_buf for CVPixelBuffer buffers
-	  Fix a bug for which we never actually set ->pixel_buf to non-NULL for
-	  CVPixelBuffer buffers.
-
-2014-11-12 09:59:53 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: fix compilation on < 10.9
-
-2014-11-11 18:01:54 +0100  Alessandro Decina <alessandro.d@gmail.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: enable the hw encoder on OSX
-
-2014-11-15 21:59:48 +0000  Tim-Philipp Müller <tim@centricular.com>
-
-	* sys/dvb/dvbbasebin.c:
-	  dvbbasebin: fix possible crash by passing 64 bits for 64-bit queue property
-	  https://bugzilla.gnome.org/show_bug.cgi?id=740191
-
-2014-11-10 10:01:24 +0100  Gwenole Beauchesne <gb.devel@gmail.com>
-
-	* gst-libs/gst/codecparsers/gsth264parser.c:
-	  codecparsers: h264: fix derivation of MaxPicNum variable.
-	  The logic to compute the MaxPicNum variable was reversed. In paricular,
-	  MaxPicNum is double MaxFrameNum only if field_pic_flag is set to 1.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=739291
-
-2014-11-11 12:00:30 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/decklink/gstdecklinksink.cpp:
-	  decklinksink: Check the correct variable for failure
-	  If we can't get an output, we would otherwise just use it later and crash.
-
-2014-11-07 10:01:59 +1100  Matthew Waters <matthew@centricular.com>
-
-	* ext/gl/gstglimagesink.c:
-	  glimagesink: clamp the resize width/height to >= 1 to avoid a GL error
-
-=== release 1.4.4 ===
-
-2014-11-06 13:14:09 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* ChangeLog:
-	* NEWS:
-	* RELEASE:
-	* configure.ac:
-	* docs/plugins/gst-plugins-bad-plugins.hierarchy:
-	* docs/plugins/inspect/plugin-accurip.xml:
-	* docs/plugins/inspect/plugin-adpcmdec.xml:
-	* docs/plugins/inspect/plugin-adpcmenc.xml:
-	* docs/plugins/inspect/plugin-asfmux.xml:
-	* docs/plugins/inspect/plugin-assrender.xml:
-	* docs/plugins/inspect/plugin-audiovisualizers.xml:
-	* docs/plugins/inspect/plugin-autoconvert.xml:
-	* docs/plugins/inspect/plugin-bayer.xml:
-	* docs/plugins/inspect/plugin-bz2.xml:
-	* docs/plugins/inspect/plugin-camerabin.xml:
-	* docs/plugins/inspect/plugin-chromaprint.xml:
-	* docs/plugins/inspect/plugin-coloreffects.xml:
-	* docs/plugins/inspect/plugin-curl.xml:
-	* docs/plugins/inspect/plugin-dataurisrc.xml:
-	* docs/plugins/inspect/plugin-debugutilsbad.xml:
-	* docs/plugins/inspect/plugin-dtsdec.xml:
-	* docs/plugins/inspect/plugin-dvb.xml:
-	* docs/plugins/inspect/plugin-dvbsuboverlay.xml:
-	* docs/plugins/inspect/plugin-dvdspu.xml:
-	* docs/plugins/inspect/plugin-faad.xml:
-	* docs/plugins/inspect/plugin-festival.xml:
-	* docs/plugins/inspect/plugin-fieldanalysis.xml:
-	* docs/plugins/inspect/plugin-flite.xml:
-	* docs/plugins/inspect/plugin-fragmented.xml:
-	* docs/plugins/inspect/plugin-frei0r.xml:
-	* docs/plugins/inspect/plugin-gaudieffects.xml:
-	* docs/plugins/inspect/plugin-gdp.xml:
-	* docs/plugins/inspect/plugin-geometrictransform.xml:
-	* docs/plugins/inspect/plugin-gmedec.xml:
-	* docs/plugins/inspect/plugin-gsm.xml:
-	* docs/plugins/inspect/plugin-gstsiren.xml:
-	* docs/plugins/inspect/plugin-id3tag.xml:
-	* docs/plugins/inspect/plugin-inter.xml:
-	* docs/plugins/inspect/plugin-interlace.xml:
-	* docs/plugins/inspect/plugin-jpegformat.xml:
-	* docs/plugins/inspect/plugin-liveadder.xml:
-	* docs/plugins/inspect/plugin-mimic.xml:
-	* docs/plugins/inspect/plugin-mms.xml:
-	* docs/plugins/inspect/plugin-modplug.xml:
-	* docs/plugins/inspect/plugin-mpeg2enc.xml:
-	* docs/plugins/inspect/plugin-mpegpsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsmux.xml:
-	* docs/plugins/inspect/plugin-mpg123.xml:
-	* docs/plugins/inspect/plugin-mplex.xml:
-	* docs/plugins/inspect/plugin-ofa.xml:
-	* docs/plugins/inspect/plugin-openal.xml:
-	* docs/plugins/inspect/plugin-opencv.xml:
-	* docs/plugins/inspect/plugin-opus.xml:
-	* docs/plugins/inspect/plugin-pcapparse.xml:
-	* docs/plugins/inspect/plugin-pnm.xml:
-	* docs/plugins/inspect/plugin-rawparse.xml:
-	* docs/plugins/inspect/plugin-removesilence.xml:
-	* docs/plugins/inspect/plugin-resindvd.xml:
-	* docs/plugins/inspect/plugin-rfbsrc.xml:
-	* docs/plugins/inspect/plugin-rtmp.xml:
-	* docs/plugins/inspect/plugin-schro.xml:
-	* docs/plugins/inspect/plugin-sdp.xml:
-	* docs/plugins/inspect/plugin-segmentclip.xml:
-	* docs/plugins/inspect/plugin-shm.xml:
-	* docs/plugins/inspect/plugin-smooth.xml:
-	* docs/plugins/inspect/plugin-soundtouch.xml:
-	* docs/plugins/inspect/plugin-spandsp.xml:
-	* docs/plugins/inspect/plugin-speed.xml:
-	* docs/plugins/inspect/plugin-subenc.xml:
-	* docs/plugins/inspect/plugin-videoparsersbad.xml:
-	* docs/plugins/inspect/plugin-voaacenc.xml:
-	* docs/plugins/inspect/plugin-voamrwbenc.xml:
-	* docs/plugins/inspect/plugin-waylandsink.xml:
-	* docs/plugins/inspect/plugin-y4mdec.xml:
-	* docs/plugins/inspect/plugin-zbar.xml:
-	* gst-plugins-bad.doap:
-	* win32/common/config.h:
-	  Release 1.4.4
-
-2014-11-06 12:55:42 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* 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/hr.po:
-	* po/hu.po:
-	* po/id.po:
-	* po/it.po:
-	* po/ja.po:
-	* po/ky.po:
-	* po/lt.po:
-	* po/lv.po:
-	* po/mt.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 files
-
-2014-11-06 11:53:04 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst/videoparsers/gsth265parse.c:
-	  h265parse: don't unnecesarily set src_caps
-	  https://bugzilla.gnome.org/show_bug.cgi?id=739374
-
-2014-10-29 22:55:47 +0100  Matej Knopp <matej.knopp@gmail.com>
-
-	* gst/videoparsers/gsth264parse.c:
-	  h264parse: don't unnecesarily set src_caps
-	  https://bugzilla.gnome.org/show_bug.cgi?id=739374
-
-2014-10-31 12:52:50 +1100  Matthew Waters <matthew@centricular.com>
-
-	* ext/gl/gstglimagesink.c:
-	* ext/gl/gstglimagesink.h:
-	  glimagesink: resize the viewport correctly on a caps change
-	  with force-aspect-ratio=true, if the width or height changed, the
-	  viewport wasn't being updated to respect the new video width and height
-	  until a resize occured.
-
-2014-11-04 09:52:11 +0100  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	  gl/cocoa: include gl3.h in configure too for consistency with gstglapi.h
-
-2014-11-03 23:24:33 +0000  Julien Isorce <julien.isorce@gmail.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: use NSAutoreleasePool to free resize data
-	  Otherwise when resizing the window you will also get messages like:
-	  class NSConcreteMapTable autoreleased with no pool in place - just leaking
-	  class NSConcreteValue autoreleased with no pool in place - just leaking
-	  class NSConcreteValue autoreleased with no pool in place - just leaking
-	  class __NSCFDictionary autoreleased with no pool in place - just leaking
-
-2014-11-03 23:08:09 +0000  Julien Isorce <julien.isorce@gmail.com>
-
-	* gst-libs/gst/gl/gstglapi.h:
-	  gl/cocoa: include gl3.h to have GL_CONTEXT_PROFILE_MASK
-
-2014-11-03 23:07:34 +0000  Julien Isorce <julien.isorce@gmail.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: make sure to turn on frame rectangle changes notifications
-	  Default value of property postsFrameChangedNotifications is YES
-	  but it is worth to explicitly enable it.
-
-2014-11-03 23:02:17 +0000  Julien Isorce <julien.isorce@gmail.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: fix uncaught exception 'unrecognized selector sent to instance'
-	  Need to set the ':' as the reshape method now takes one parameter.
-	  For the story, the GstGLNSView was previously inheriting from
-	  NSOpenGLView which has a reshape function without any parameter.
-	  Now the GstGLNSView inherits from NSView and we re-use the reshape
-	  function manually.
-
-2014-11-03 22:59:41 +0000  Julien Isorce <julien.isorce@gmail.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: fix compiler warning
-	  Use the reshape function after being defined. The other way
-	  would have been to declare the reshape function in the header.
-	  gstglwindow_cocoa.m: In function '-[GstGLNSView drawRect:]':
-	  gstglwindow_cocoa.m:555: warning: 'GstGLNSView' may not respond to '-reshape'
-	  gstglwindow_cocoa.m:555: warning: (Messages without a matching method signature
-	  gstglwindow_cocoa.m:555: warning: will be assumed to return 'id' and accept
-	  gstglwindow_cocoa.m:555: warning: '...' as arguments.)
-
-2014-10-21 16:21:08 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Fix compiler warning
-	  gstglwindow_cocoa.m: In function '-[GstGLNSView drawRect:]':
-	  gstglwindow_cocoa.m:555: warning: 'GstGLNSView' may not respond to '-reshape'
-	  gstglwindow_cocoa.m:555: warning: (Messages without a matching method signature
-	  gstglwindow_cocoa.m:555: warning: will be assumed to return 'id' and accept
-	  gstglwindow_cocoa.m:555: warning: '...' as arguments.)
-
-2014-10-29 18:18:07 +0000  Luis de Bethencourt <luis.bg@samsung.com>
-
-	* gst-libs/gst/gl/gstglshadervariables.c:
-	  glshader: Fix memory leak
-	  Memory is only freed in the TRUE clause of the if conditional. Free in the else
-	  clause as well.
-	  Also, consolidate g_malloc + sprintf into a g_strdup_printf().
-	  CID #1212171
-	  https://bugzilla.gnome.org/show_bug.cgi?id=739368
-
-2014-10-31 12:30:53 +1100  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcontext.c:
-	* gst-libs/gst/gl/gstgldisplay.c:
-	* gst-libs/gst/gl/gstglwindow.c:
-	  gl: sprinkle some Since markers
-
-2014-10-24 16:52:42 +0200  Matthieu Bouron <matthieu.bouron@collabora.com>
-
-	* gst/mpegtsdemux/mpegtsbase.c:
-	  mpegtsbase: do not remove programs on EOS
-	  As a consequence, tsdemux won't remove its pads anymore on EOS.
-	  Fixes the case when mpegtsbase is not able to process new packets
-	  after EOS as the corresponding pids aren't known anymore because
-	  the programs were removed and the pes/psi were kept, preventing the
-	  PAT to be parsed again.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738695
-	  Conflicts:
-	  gst/mpegtsdemux/mpegtsbase.c
-
-2014-10-30 19:01:20 +1100  Matthew Waters <matthew@centricular.com>
-
-	* tests/examples/gl/sdl/sdlshare.c:
-	  gl/examples: use the current X Display from SDL
-	  allows GL context sharing to occur.
-
-2014-10-29 10:09:35 +0100  Vincent Abriou <vincent.abriou@st.com>
-
-	* configure.ac:
-	  configure.ac: auto decision to include GL library fails
-	  The part of the configure.ac that consist to check if we
-	  can include both GL and GLES2 at the same time is failing.
-	  Indeed, in the case NEED_GLES2=yes and NEED_OPENGL=auto,
-	  HAVE_OPENGL variable is updated whereas it should be HAVE_GL
-	  variable that has to be updated (HAVE_OPENGL variable is not
-	  used in the rest of the configure.ac).
-	  https://bugzilla.gnome.org/show_bug.cgi?id=739348
-	  Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
-	  Reviewed-by: Benjamin GAIGNARD <benjamin.gaignard@linaro.org>
-
-2014-10-28 17:44:47 +0000  Tim-Philipp Müller <tim@centricular.com>
-
-	* ext/faad/gstfaad.c:
-	  faad: fix wrong unrefs in set_format error code path
-
-2014-10-28 18:01:27 +1100  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglfilter.c:
-	  glfilter: avoid uninitialized variable size when chaining multiple glfilters
-	  https://bugzilla.gnome.org/show_bug.cgi?id=739277
-
-2014-10-23 17:42:27 +0300  Vootele Vesterblom <vov@bang-olufsen.dk>
-
-	* gst/rawparse/gstrawparse.c:
-	  rawparse: fix handling of segment event in sink event handler
-
-2014-10-22 15:07:04 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst/rawparse/gstrawparse.c:
-	  rawparse: Check for 0-size after adjusting the size for the frame size
-	  If we don't have a complete raw audio frame we would otherwise still
-	  ask for a 0 sized buffer from the adapter.
-
-2014-10-22 14:43:50 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst/rawparse/gstrawparse.c:
-	  rawparse: Don't try to retrieve 0 byte buffers from the adapter in multi-frame mode
-
-2014-10-21 12:39:14 +0200  Matthieu Bouron <matthieu.bouron@collabora.com>
-
-	* ext/hls/gsthlsdemux.c:
-	  hlsdemux: reset end_of_playlist attribute when we receive a seek
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738696
-
-2014-10-09 15:12:01 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* tests/check/libs/vc1parser.c:
-	  vc1parser: fix expected level in sequence-layer parsing unit test
-	  Sequence-layer used for unit test have a level set to 2 which should
-	  match the medium level, not the high.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738230
-
-2014-10-09 15:05:55 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst-libs/gst/codecparsers/gstvc1parser.h:
-	  vc1parser: fix level values for simple/main profile
-	  In simple profile, level set to 0 or 2 indicate low and medium level
-	  respectively. In main profile, level set to 0, 2 or 4 indicate low,
-	  medium and high level respectively.
-	  Level values are defined in Annex J.1.2 of the SMPTE 421M.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738230
-
-2014-10-01 16:17:46 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	* gst/videoparsers/gstvc1parse.h:
-	  vc1parse: select caps according to wmv format at negotiation
-	  Some VC1 decoder can have different caps according to wmv format, ie
-	  WMV3 or WVC1.
-	  So instead of keeping the first available caps, we interserct with
-	  current WMV format.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738532
-
-2014-10-20 09:47:27 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/rtmp/gstrtmpsink.c:
-	  rtmpsink: Declare sink variable that was forgotten in last commit
-
-2014-10-19 20:35:41 +0200  Havard Graff <havard.graff@gmail.com>
-
-	* ext/rtmp/gstrtmpsink.c:
-	  rtmpsink: Free URI string in finalize()
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738674
-
-2014-09-22 09:44:14 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	  vc1parse: parse frame header when stream format is ASF/raw for simple/main profile
-	  When stream-format is ASF or sequence-layer-raw-frame, we basically have
-	  a raw frame so we can parse it to extract some information such the
-	  keyframe flag. The only requirement is to have a valid sequence-header.
-	  This commit parse the frame header and set the DELTA_UNIT buffer flag in
-	  case the frame is not a keyframe.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738519
-
-2014-10-13 14:05:24 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	  vc1parse: just assume none header-format when no codec_data is present
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738449
-
-2014-10-09 18:18:02 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	  vc1parse: fix framesize when input is frame-layer
-	  frame-layer header is represented as a sequence of 32 bit unsigned
-	  integer serialized in little-endian byte order, so framesize is on the
-	  first 3 bytes.
-	  SMPTE 421M Annex L.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738243
-
-2014-10-10 13:05:49 +0100  Tim-Philipp Müller <tim@centricular.com>
-
-	* ext/fluidsynth/gstfluiddec.c:
-	  fluiddec: don't leak incoming caps event
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738291
-
-2014-10-09 11:51:16 +0200  Antonio Ospite <ao2@ao2.it>
-
-	* ext/fluidsynth/gstfluiddec.c:
-	  fluiddec: fix some memory leaks
-	  https://bugzilla.gnome.org/show_bug.cgi?id=738223
-
-2014-10-21 15:42:32 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Fix locking
-	  The object lock only protects the session, as we modify
-	  the session from other threads when the bitrate property
-	  is changed. Don't hold it much longer than for session
-	  related things.
-	  And we need to release the video decoder stream lock before
-	  enqueueing a frames. It might wait for our callback to dequeue
-	  a frame from another thread, which will then take the stream
-	  lock too and deadlock.
-
-2014-10-19 14:57:43 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Use kVTProfileLevel_H264_Baseline_AutoLevel only on iOS
-	  It is not required on OSX apparently and was only added in 10.9.6 there.
-	  Calculating the correct level from the configuration is not trivial, so let's
-	  just not set a level at all here.
-
-2014-10-19 14:51:40 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	* sys/applemedia/vtenc.c:
-	  vtenc: VTCompressionSessionPrepareToEncodeFrames only exists since 10.9.6
-	  Check with configure for it instead of using one of the availability macros
-	  as those wouldn't work as expected with minor versions.
-
-2014-10-19 14:32:31 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Remove unused #define
-
-2014-10-13 13:28:57 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/gl/gstglimagesink.c:
-	  glimagesink: Only finalize the other context in finalize()
-	  Otherwise we change a value of a property when going to READY state,
-	  which is unexpected behaviour.
-
-2014-10-13 11:56:03 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/gl/gstglimagesink.c:
-	  glimagesink: Don't leak other-context
-
-2014-10-13 13:27:55 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/gl/gstglmixer.c:
-	  glmixer: Call the pad's parent class finalize method
-
-2014-10-09 10:54:35 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Add support for HiDPI displays
-	  Without this our GL surface would be upscaled after rendering
-	  by Cocoa, which would reduce image quality.
-
-2014-10-01 16:04:36 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Always update our viewport if Cocoa tells us something has changed
-	  The visible rect and bounds might be the same as before, but Cocoa
-	  might've changed our viewport without us nothing. This happens if
-	  you hide the view and show it again.
-
-2014-10-01 11:55:13 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Handle NSView::renewGState() properly
-	  Don't update the screen until we redraw, this prevents flickering during
-	  scrolling, clipping, resizing, etc
-
-2014-09-29 09:33:42 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Update viewport according to the current clipping
-	  We have to update the GL viewport if the NSView is only partially
-	  visible. Otherwise the content of the frame will be visibly offset.
-
-2014-09-29 10:49:46 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m:
-	  gl/cocoa: Improve the NSApplication initialization
-	  This is only for non-Cocoa apps but previously caused a 2 second
-	  waiting during startup for Cocoa apps. This is unacceptable.
-	  Instead we now check a bit more extensive if something actually
-	  runs on the GLib default main context, and if not don't even
-	  bother waiting for something to happen from there.
-
-2014-09-29 09:24:49 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: NSView::drawRect() should call into reshape too
-	  We a) need to render again because part of the window was
-	  obscured and b) might need to reshape because of clipping
-	  changes.
-
-2014-09-26 14:21:46 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m:
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Call UI related API from the application main thread
-
-2014-09-26 13:05:27 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h:
-	* gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m:
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Switch to a plain NSView subclass instead of NSOpenGLView
-	  We don't and can't use NSOpenGLView as it's supposed to be used and
-	  it gets into our way by being to clever in various situations.
-
-2014-09-25 16:13:19 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h:
-	* gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m:
-	  gl/cocoa: Switch from our custom main loop to a GMainLoop
-	  Simplifies code a lot and makes it more similar to the other backends.
-
-2014-09-25 16:12:24 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m:
-	  gl/cocoa: Clear the current GL context when it should happen
-
-2014-10-14 09:58:47 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	  applemedia: VideoToolbox works properly on iOS now
-
-2014-10-14 09:19:59 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: Set reorder length to 0 if we can't calculate it
-	  Instead of leaving it at whatever value it had before.
-
-2014-09-19 14:36:39 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Fix encoder to work on iOS
-	  iOS has special stride requirements that we don't know yet, so copy
-	  input buffers into buffers allocated by iOS for now.
-	  Later we should check the stride and probably provide a buffer pool for these
-	  buffers so upstream can directly write in there.
-
-2014-09-19 14:32:46 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/coremediabuffer.c:
-	* sys/applemedia/corevideobuffer.c:
-	  applemedia: We need to map the coremedia buffers in non-readonly mode
-	  Our buffers claim to be writable so other elements expect to be able
-	  to write there without losing their changes.
-
-2014-09-18 17:49:46 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Let the encoder automatically choose a h264 level
-	  We should negotiate these things via caps...
-
-2014-09-18 13:45:33 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Use 0 instead of G_MAXDOUBLE as the max keyframe interval
-	  0 means no limit, which was meant here with G_MAXDOUBLE probably.
-
-2014-09-18 13:42:24 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Expected duration is supposed to be the duration of the stream, not a frame
-	  Just don't set it for now, it isn't really needed.
-
-2014-09-18 13:11:05 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: Properly handle keyframes
-	  Especially set the SYNC_POINT flag on keyframes.
-
-2014-09-18 10:30:04 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: Fix compilation
-
-2014-09-18 09:47:06 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: Handle 0/1 framerates correctly by not calculating their frame duration
-
-2014-09-17 17:37:12 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/atdec.c:
-	  atdec: Fix some compiler warnings with newer clang
-
-2014-09-17 17:10:58 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Prepare encoder after setup
-	  This will allow encoding to happen faster on the first frame.
-
-2014-09-17 17:08:57 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: Only drain the encoder in ::finish(), not on every frame
-	  Otherwise quality and bitrate will be bad.
-
-2014-09-17 15:39:26 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Error out if encoding returned an error
-	  Otherwise we will just continue consuming frames until all memory is filled
-	  up and the app crashes.
-
-2014-09-17 14:56:05 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Check for errors from VTCompressionSessionCompleteFrames()
-
-2014-09-17 14:55:24 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Properly scale timestamps for the API and set invalid values
-
-2014-09-17 14:54:39 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: Properly scale timestamps for the API and set invalid values
-
-2014-09-17 13:19:04 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/Makefile.am:
-	* sys/applemedia/plugin.m:
-	* sys/applemedia/vth264decbin.c:
-	* sys/applemedia/vth264decbin.h:
-	* sys/applemedia/vth264encbin.c:
-	* sys/applemedia/vth264encbin.h:
-	  applemedia: Remove old code that is of no use anymore
-
-2014-09-17 10:38:20 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/Makefile.am:
-	* sys/applemedia/plugin.m:
-	  applemedia: Do weak linking with the VideoToolbox framework
-	  It does not exist on older OSX and iOS but we still want to
-	  be able to use it when it's available.
-
-2014-09-16 16:51:28 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: Port to GstVideoEncoder base class
-
-2014-09-16 16:13:16 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Use correct instance struct size
-
-2014-09-16 15:48:11 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: Fix compiler warnings
-	  values of type 'OSStatus' should not be used as format arguments; add an explicit cast to 'int' instead [-Wformat]
-
-2014-09-16 15:02:46 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/Makefile.am:
-	* sys/applemedia/coremediactx.c:
-	* sys/applemedia/coremediactx.h:
-	* sys/applemedia/dynapi-internal.h:
-	* sys/applemedia/dynapi.c:
-	* sys/applemedia/dynapi.h:
-	* sys/applemedia/mtapi.c:
-	* sys/applemedia/mtapi.h:
-	* sys/applemedia/vtapi.c:
-	* sys/applemedia/vtapi.h:
-	* sys/applemedia/vtenc.c:
-	* sys/applemedia/vtenc.h:
-	  vtenc: Port to the real VideoToolbox API instead of using our dlopen() wrapper
-	  It's a public framework since a long time.
-
-2014-10-09 01:18:16 +0300  Sreerenj Balachandran <sreerenj.balachandran@intel.com>
-
-	* gst/videoparsers/gsth264parse.c:
-	  h264parse: expose parsed profile and level to downstream
-	  Set parsed profile and level in src caps.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=732239
-
-2014-10-09 11:46:23 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst/videoparsers/gsth265parse.c:
-	  h265parse: expose parsed profile, tier and level to downstream
-	  https://bugzilla.gnome.org/show_bug.cgi?id=732239
-
-2014-10-06 21:25:30 +0300  Vivia Nikolaidou <n.vivia@gmail.com>
-
-	* ext/curl/gstcurlsmtpsink.c:
-	  curlsmtpsink: Set CURLOPT_UPLOAD to 1 to not use VRFY and other unneeded commands
-	  Fixes the sink with SMTP servers that disable VRFY for spam protection.
-	  http://sourceforge.net/p/curl/bugs/1389/
-
-2014-10-06 10:11:47 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/video/gstvideoaggregator.c:
-	  videoaggregator: Unmap and free GstVideoFrames as needed after conversion and errors
-
-2014-10-06 10:11:23 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/base/gstaggregator.c:
-	  aggregator: Unref the taglist in GstAggregator::stop()
-
-2014-10-01 16:19:02 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	  vc1parse: unref caps when it is empty in renegotiate()
-	  https://bugzilla.gnome.org/show_bug.cgi?id=737724
-
-2014-10-02 10:26:43 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/androidmedia/gstamc.c:
-	  androidmedia: Fix calculation of the frame size for COLOR_FormatYUV420Planar
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734156
-
-2014-10-01 00:53:59 +0100  Tim-Philipp Müller <tim@centricular.com>
-
-	* ext/fluidsynth/gstfluiddec.c:
-	  fluiddec: don't crash on 0-sized input buffers
-	  https://bugzilla.gnome.org/show_bug.cgi?id=737658
-
-2014-09-30 14:58:06 +0200  Lubosz Sarnecki <lubosz@gmail.com>
-
-	* configure.ac:
-	  gltransformation: requires graphene 1.0.0
-
-2014-09-29 10:01:27 +0200  Jesper Larsen <knorr.jesper@gmail.com>
-
-	* gst/mpegtsdemux/tsdemux.c:
-	  tsdemux: do not discard on discont if PES start
-	  If a discontinuity in the stream is detected, data is discarded until
-	  a new PES starts. If the first packet after the discontinuity is also
-	  the start of a PES, there is no reason to discard the packets.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=737569
-
-2014-09-09 13:12:31 +0200  Matthieu Bouron <matthieu.bouron@collabora.com>
-
-	* ext/dash/gstdashdemux.c:
-	* ext/dash/gstdashdemux.h:
-	  dashdemux: mark first buffer as discont after restarting a download task
-	  Mark first buffer as discont after restarting a download task, so
-	  downstream can reset its state to properly handle the new fragment.
-	  Related issue: https://bugzilla.gnome.org/show_bug.cgi?id=736318
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736319
-
-2014-09-19 22:32:39 -0300  Thiago Santos <thiagoss@osg.samsung.com>
-
-	* ext/dash/gstdashdemux.c:
-	  dashdemux: push a time segment when restarting streaming
-	  This should inform demuxers/decoders downstream that the stream is
-	  about to start from a new position and they should flush accordingly
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736319
-
-2014-10-09 12:28:11 +1100  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcolorconvert.c:
-	  glcolorconvert: output why we cannot convert a buffer
-
-2014-10-09 12:25:55 +1100  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcolorconvert.c:
-	  glcolorconvert: fix planar YUV download
-	  - sample the u and v planes properly
-	  - output the correctly scaled u and v planes for different chroma block sizes
-
-2014-10-07 23:04:30 +1100  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcolorconvert.c:
-	  glcolorconvert: fix UYVY download green screen
-
-2014-10-07 22:50:22 +1100  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcolorconvert.c:
-	  glcolrconvert: fix YUY2 download
-	  - The shader was outputing the wrong values compared with raw
-	  videotestsrc.
-	  - deal with the texture edge properly.
-	  - properly sample the 2x1 rectangle for the u and v values
-	  - don't double sample the y value
-
-2014-09-25 17:01:31 +0200  Lubosz Sarnecki <lubosz@gmail.com>
-
-	* ext/gl/gstgltransformation.c:
-	  gltransformation: graphene multiplication order has changed
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733510
-
-2014-09-22 10:08:17 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst-libs/gst/gl/gstglcontext.c:
-	  gl: Let gst_gl_context_get_thread() return a new reference to the GThread
-	  Otherwise it might go away in the meantime and the caller has some random pointer.
-	  Conflicts:
-	  gst-libs/gst/gl/gstglcontext.c
-
-2014-09-30 14:46:14 +1000  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcolorconvert.c:
-	  glcolorconvert: convert xRGB into ARGB properly
-	  The alpha channel might not be the last component so check which one
-	  it is in and clobber that one instead.
-
-2014-09-30 01:38:05 +1000  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglmemory.c:
-	  glmemory: unset the opposite corresponding transfer flags when mapped with write
-	  fixes consistency with consecutive gst_memory_map()'s with
-	  flags & GST_MAP_WRITE
-
-2014-09-29 08:54:29 +0200  Edward Hervey <bilboed@bilboed.com>
-
-	* gst-libs/gst/gl/gstglcontext.c:
-	  glcontext: Initialize variable
-	  Avoids the following warning:
-	  gstglcontext.c:647:58: error: 'prev' may be used uninitialized in
-	  this function [-Werror=maybe-uninitialized]
-
-2014-09-29 00:32:05 +1000  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcontext.c:
-	  glcontext: fixup error in sharegroup comment
-
-2014-09-29 00:24:28 +1000  Matthew Waters <matthew@centricular.com>
-
-	* gst-libs/gst/gl/gstglcontext.c:
-	  glcontext: detect the sharegroup case where the context are in different chains
-	  In the end they will lead to the same root context in the tree so check that
-	  for equality.
-
-2014-09-23 12:02:18 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* gst-libs/gst/gl/gstglupload.c:
-	  glupload: fallback to upload if contexts cannot share GL resources
-	  Fixes pipelines of the form
-	  gleffects ! tee ! glimagesink
-	  as tee does not pass on the allocation query.
-
-2014-09-23 12:01:04 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* docs/libs/gst-plugins-bad-libs-sections.txt:
-	* gst-libs/gst/gl/gstglcontext.c:
-	* gst-libs/gst/gl/gstglcontext.h:
-	  glcontext: add gst_gl_context_can_share
-	  Which determines whether two GstGLContext's can share sharable
-	  OpenGL resources.
-	  Conflicts:
-	  gst-libs/gst/gl/gstglcontext.c
-
-2014-09-21 21:30:58 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* docs/libs/gst-plugins-bad-libs-sections.txt:
-	* gst-libs/gst/gl/gstglcontext.c:
-	* gst-libs/gst/gl/gstglcontext.h:
-	  glcontext: add API to retreive the thread that context is active in
-
-2014-09-24 14:29:37 +1000  Matthew Waters <matthew@centricular.com>
-
-	* ext/gl/gstglvideomixer.c:
-	  glvideomixer: skip input frames with an alpha of 0
-
-2014-09-24 13:13:19 +1000  Matthew Waters <matthew@centricular.com>
-
-	* ext/gl/gstglmixer.c:
-	* ext/gl/gstglmixer.h:
-	* ext/gl/gstgltestsrc.c:
-	* ext/gl/gstgltestsrc.h:
-	* gst-libs/gst/gl/gstglfilter.c:
-	* gst-libs/gst/gl/gstglfilter.h:
-	  gl: download whenever we have sysmem capsfeatures
-	  Otherwise we could pass on a RGBA formatted buffer and downstream would
-	  misinterpret that as some other video format.
-	  Fixes pipelines of the form
-	  gleffects ! tee ! xvimagesink
-
-2014-09-29 11:44:54 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	  configure: Don't build VideoToolbox elements on iOS for now
-	  They're only ported properly in master.
-
-2014-09-26 01:34:54 +1000  Matthew Waters <matthew@centricular.com>
-
-	* ext/gl/gstglvideomixer.c:
-	  glvideomixer: fix blending with low-alpha sources
-	  We also need to apply the blend paramaters to the alpha channel otherwise
-	  the output of the blend will appear black at low alpha values (< 0.2).
-
-2014-07-29 16:12:26 +0200  Thibault Saunier <tsaunier@gnome.org>
-
-	* gst/videoparsers/gsth264parse.c:
-	  h264parse: Return flushing if we get chained while being set to READY
-	  Or not negotiated in the case we would be actually not negotiated
-	  Currently we are getting assertions from
-	  gst_pb_utils_add_codec_description_to_tag_list because of NULL
-	  caps.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=737186
-
-=== release 1.4.3 ===
-
-2014-09-24 12:43:28 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* ChangeLog:
-	* NEWS:
-	* RELEASE:
-	* configure.ac:
-	* docs/plugins/inspect/plugin-accurip.xml:
-	* docs/plugins/inspect/plugin-adpcmdec.xml:
-	* docs/plugins/inspect/plugin-adpcmenc.xml:
-	* docs/plugins/inspect/plugin-asfmux.xml:
-	* docs/plugins/inspect/plugin-assrender.xml:
-	* docs/plugins/inspect/plugin-audiovisualizers.xml:
-	* docs/plugins/inspect/plugin-autoconvert.xml:
-	* docs/plugins/inspect/plugin-bayer.xml:
-	* docs/plugins/inspect/plugin-bz2.xml:
-	* docs/plugins/inspect/plugin-camerabin.xml:
-	* docs/plugins/inspect/plugin-chromaprint.xml:
-	* docs/plugins/inspect/plugin-coloreffects.xml:
-	* docs/plugins/inspect/plugin-curl.xml:
-	* docs/plugins/inspect/plugin-dataurisrc.xml:
-	* docs/plugins/inspect/plugin-debugutilsbad.xml:
-	* docs/plugins/inspect/plugin-dtsdec.xml:
-	* docs/plugins/inspect/plugin-dvb.xml:
-	* docs/plugins/inspect/plugin-dvbsuboverlay.xml:
-	* docs/plugins/inspect/plugin-dvdspu.xml:
-	* docs/plugins/inspect/plugin-faac.xml:
-	* docs/plugins/inspect/plugin-faad.xml:
-	* docs/plugins/inspect/plugin-festival.xml:
-	* docs/plugins/inspect/plugin-fieldanalysis.xml:
-	* docs/plugins/inspect/plugin-flite.xml:
-	* docs/plugins/inspect/plugin-fragmented.xml:
-	* docs/plugins/inspect/plugin-frei0r.xml:
-	* docs/plugins/inspect/plugin-gaudieffects.xml:
-	* docs/plugins/inspect/plugin-gdp.xml:
-	* docs/plugins/inspect/plugin-geometrictransform.xml:
-	* docs/plugins/inspect/plugin-gmedec.xml:
-	* docs/plugins/inspect/plugin-gsm.xml:
-	* docs/plugins/inspect/plugin-gstsiren.xml:
-	* docs/plugins/inspect/plugin-id3tag.xml:
-	* docs/plugins/inspect/plugin-inter.xml:
-	* docs/plugins/inspect/plugin-interlace.xml:
-	* docs/plugins/inspect/plugin-jpegformat.xml:
-	* docs/plugins/inspect/plugin-liveadder.xml:
-	* docs/plugins/inspect/plugin-mimic.xml:
-	* docs/plugins/inspect/plugin-mms.xml:
-	* docs/plugins/inspect/plugin-modplug.xml:
-	* docs/plugins/inspect/plugin-mpeg2enc.xml:
-	* docs/plugins/inspect/plugin-mpegpsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsmux.xml:
-	* docs/plugins/inspect/plugin-mpg123.xml:
-	* docs/plugins/inspect/plugin-mplex.xml:
-	* docs/plugins/inspect/plugin-ofa.xml:
-	* docs/plugins/inspect/plugin-openal.xml:
-	* docs/plugins/inspect/plugin-opencv.xml:
-	* docs/plugins/inspect/plugin-opus.xml:
-	* docs/plugins/inspect/plugin-pcapparse.xml:
-	* docs/plugins/inspect/plugin-pnm.xml:
-	* docs/plugins/inspect/plugin-rawparse.xml:
-	* docs/plugins/inspect/plugin-removesilence.xml:
-	* docs/plugins/inspect/plugin-resindvd.xml:
-	* docs/plugins/inspect/plugin-rfbsrc.xml:
-	* docs/plugins/inspect/plugin-schro.xml:
-	* docs/plugins/inspect/plugin-sdp.xml:
-	* docs/plugins/inspect/plugin-segmentclip.xml:
-	* docs/plugins/inspect/plugin-shm.xml:
-	* docs/plugins/inspect/plugin-smooth.xml:
-	* docs/plugins/inspect/plugin-soundtouch.xml:
-	* docs/plugins/inspect/plugin-spandsp.xml:
-	* docs/plugins/inspect/plugin-speed.xml:
-	* docs/plugins/inspect/plugin-subenc.xml:
-	* docs/plugins/inspect/plugin-videoparsersbad.xml:
-	* docs/plugins/inspect/plugin-voaacenc.xml:
-	* docs/plugins/inspect/plugin-voamrwbenc.xml:
-	* docs/plugins/inspect/plugin-waylandsink.xml:
-	* docs/plugins/inspect/plugin-y4mdec.xml:
-	* docs/plugins/inspect/plugin-zbar.xml:
-	* gst-plugins-bad.doap:
-	* win32/common/config.h:
-	  Release 1.4.3
-
-2014-09-24 11:44:54 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* 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/hr.po:
-	* po/hu.po:
-	* po/id.po:
-	* po/it.po:
-	* po/ja.po:
-	* po/ky.po:
-	* po/lt.po:
-	* po/lv.po:
-	* po/mt.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 files
-
-2014-09-19 09:54:11 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	  vc1parse: initialize sent_codec_tag before using it
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736951
-
-=== release 1.4.2 ===
-
-2014-09-19 14:48:05 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* ChangeLog:
-	* NEWS:
-	* RELEASE:
-	* configure.ac:
-	* docs/plugins/inspect/plugin-accurip.xml:
-	* docs/plugins/inspect/plugin-adpcmdec.xml:
-	* docs/plugins/inspect/plugin-adpcmenc.xml:
-	* docs/plugins/inspect/plugin-asfmux.xml:
-	* docs/plugins/inspect/plugin-assrender.xml:
-	* docs/plugins/inspect/plugin-audiovisualizers.xml:
-	* docs/plugins/inspect/plugin-autoconvert.xml:
-	* docs/plugins/inspect/plugin-bayer.xml:
-	* docs/plugins/inspect/plugin-bz2.xml:
-	* docs/plugins/inspect/plugin-camerabin.xml:
-	* docs/plugins/inspect/plugin-chromaprint.xml:
-	* docs/plugins/inspect/plugin-coloreffects.xml:
-	* docs/plugins/inspect/plugin-curl.xml:
-	* docs/plugins/inspect/plugin-dataurisrc.xml:
-	* docs/plugins/inspect/plugin-debugutilsbad.xml:
-	* docs/plugins/inspect/plugin-dtsdec.xml:
-	* docs/plugins/inspect/plugin-dvb.xml:
-	* docs/plugins/inspect/plugin-dvbsuboverlay.xml:
-	* docs/plugins/inspect/plugin-dvdspu.xml:
-	* docs/plugins/inspect/plugin-faac.xml:
-	* docs/plugins/inspect/plugin-faad.xml:
-	* docs/plugins/inspect/plugin-festival.xml:
-	* docs/plugins/inspect/plugin-fieldanalysis.xml:
-	* docs/plugins/inspect/plugin-flite.xml:
-	* docs/plugins/inspect/plugin-fragmented.xml:
-	* docs/plugins/inspect/plugin-frei0r.xml:
-	* docs/plugins/inspect/plugin-gaudieffects.xml:
-	* docs/plugins/inspect/plugin-gdp.xml:
-	* docs/plugins/inspect/plugin-geometrictransform.xml:
-	* docs/plugins/inspect/plugin-gmedec.xml:
-	* docs/plugins/inspect/plugin-gsm.xml:
-	* docs/plugins/inspect/plugin-gstsiren.xml:
-	* docs/plugins/inspect/plugin-id3tag.xml:
-	* docs/plugins/inspect/plugin-inter.xml:
-	* docs/plugins/inspect/plugin-interlace.xml:
-	* docs/plugins/inspect/plugin-jpegformat.xml:
-	* docs/plugins/inspect/plugin-liveadder.xml:
-	* docs/plugins/inspect/plugin-mimic.xml:
-	* docs/plugins/inspect/plugin-mms.xml:
-	* docs/plugins/inspect/plugin-modplug.xml:
-	* docs/plugins/inspect/plugin-mpeg2enc.xml:
-	* docs/plugins/inspect/plugin-mpegpsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsmux.xml:
-	* docs/plugins/inspect/plugin-mpg123.xml:
-	* docs/plugins/inspect/plugin-mplex.xml:
-	* docs/plugins/inspect/plugin-ofa.xml:
-	* docs/plugins/inspect/plugin-openal.xml:
-	* docs/plugins/inspect/plugin-opencv.xml:
-	* docs/plugins/inspect/plugin-opus.xml:
-	* docs/plugins/inspect/plugin-pcapparse.xml:
-	* docs/plugins/inspect/plugin-pnm.xml:
-	* docs/plugins/inspect/plugin-rawparse.xml:
-	* docs/plugins/inspect/plugin-removesilence.xml:
-	* docs/plugins/inspect/plugin-resindvd.xml:
-	* docs/plugins/inspect/plugin-rfbsrc.xml:
-	* docs/plugins/inspect/plugin-schro.xml:
-	* docs/plugins/inspect/plugin-sdp.xml:
-	* docs/plugins/inspect/plugin-segmentclip.xml:
-	* docs/plugins/inspect/plugin-shm.xml:
-	* docs/plugins/inspect/plugin-smooth.xml:
-	* docs/plugins/inspect/plugin-soundtouch.xml:
-	* docs/plugins/inspect/plugin-spandsp.xml:
-	* docs/plugins/inspect/plugin-speed.xml:
-	* docs/plugins/inspect/plugin-subenc.xml:
-	* docs/plugins/inspect/plugin-videoparsersbad.xml:
-	* docs/plugins/inspect/plugin-voaacenc.xml:
-	* docs/plugins/inspect/plugin-voamrwbenc.xml:
-	* docs/plugins/inspect/plugin-waylandsink.xml:
-	* docs/plugins/inspect/plugin-y4mdec.xml:
-	* docs/plugins/inspect/plugin-zbar.xml:
-	* gst-plugins-bad.doap:
-	* win32/common/config.h:
-	  Release 1.4.2
-
-2014-09-16 15:59:58 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	  vc1parse: fix sequence-layer/frame-layer endianness
-	  Sequence-layer and frame-layer are serialized in little-endian byte
-	  order except for STRUCT_C and framedata fields as described in SMPTE 421M Annex
-	  L.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736750
-
-2014-09-19 11:24:35 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* 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/hr.po:
-	* po/hu.po:
-	* po/id.po:
-	* po/it.po:
-	* po/ja.po:
-	* po/ky.po:
-	* po/lt.po:
-	* po/lv.po:
-	* po/mt.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 files
-
-2014-09-19 10:01:23 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* 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/hr.po:
-	* po/hu.po:
-	* po/id.po:
-	* po/it.po:
-	* po/ja.po:
-	* po/ky.po:
-	* po/lt.po:
-	* po/lv.po:
-	* po/mt.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 translations
-
-2014-09-18 18:16:59 +0200  Philippe Normand <philn@igalia.com>
-
-	* ext/hls/gsthlsdemux.c:
-	  hlsdemux: lock client mutex before entering the retry_failover block
-	  This is consistent with the case where the block execution is
-	  triggered by the goto invoked after the current_variant update.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736919
-
-2014-09-18 11:39:53 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* tests/check/libs/vc1parser.c:
-	  vc1parser: add unit test for sequence-layer parsing
-	  Check that a sequence-layer header is successfully parsed.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736871
-
-2014-09-18 11:49:13 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst-libs/gst/codecparsers/gstvc1parser.c:
-	  vc1parser: take care of endianness when parsing sequence-layer
-	  sequence-layer is serialized in little-endian byte order except for
-	  STRUCT_C which is serialized in big-endian byte order.
-	  But since STRUCT_A and STRUCT_B fields are defined as unsigned int msb
-	  first, we have to pass them as big-endian to their parsing function. So
-	  we basically use temporary buffers to convert them in big-endian.
-	  See SMPTE 421M Annex J and L.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736871
-
-2014-09-16 12:06:35 +0200  Ognyan Tonchev <ognyan@axis.com>
-
-	* ext/wayland/gstwaylandsink.c:
-	  waylandsink: do not leak buffer pool in error case
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736735
-
-2014-09-16 11:42:34 +0200  Ognyan Tonchev <ognyan@axis.com>
-
-	* gst-libs/gst/gl/gstglfilter.c:
-	  glfilter: do not leak pool in error cases
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736732
-
-2014-09-16 11:43:02 +0200  Ognyan Tonchev <ognyan@axis.com>
-
-	* sys/vdpau/gstvdpdecoder.c:
-	  vdpdecoder: do not leak pool
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736733
-
-2014-09-16 11:41:43 +0200  Ognyan Tonchev <ognyan@axis.com>
-
-	* ext/gl/gstgltestsrc.c:
-	  gltestsrc: do not leak pool in error cases
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736730
-
-2014-09-16 11:42:13 +0200  Ognyan Tonchev <ognyan@axis.com>
-
-	* ext/openni2/gstopenni2src.cpp:
-	  openni2src: do not leak pool
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736731
-
-2014-09-16 11:41:16 +0200  Ognyan Tonchev <ognyan@axis.com>
-
-	* ext/gl/gstglmixer.c:
-	  glmixer: do not leak pool in error cases
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736729
-
-2014-09-15 15:42:41 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: No need to set kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder on iOS
-
-2014-09-15 15:36:44 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	  configure: And make the preprocessor check work properly
-
-2014-09-15 15:25:46 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	  configure: Do the AM_CONDITIONAL() after finally setting the variable
-
-2014-09-15 15:12:31 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	* sys/applemedia/vtdec.c:
-	  applemedia: Don't include VideoToolbox on iOS < 8.0
-	  It's private API and does not work without a jailbroken device.
-
-2014-09-13 20:49:16 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/applemedia/vtdec.c:
-	  vtdec: Fix compilation on iOS 8.0
-
-2014-09-15 13:33:45 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/hls/gsthlsdemux.c:
-	  hlsdemux: Also refetch the playlist after the first fragment failure
-	  Previously we only refetched the playlist if downloading a fragment
-	  has failed once. We should also do that if it failed a second or third time,
-	  chances are that the playlist was updated now and contains new URIs.
-
-2014-09-15 11:59:19 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/hls/gsthlsdemux.c:
-	  hls: Actually retry 3 times as advertised instead of 2
-
-2014-09-15 11:59:32 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/dash/gstdashdemux.c:
-	  dash: Actually retry 3 times as advertised instead of 2
-
-2014-09-11 14:36:31 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/videoparsers/gstvc1parse.c:
-	  vc1parse: fix malformed sequence layer header and STRUCT_C
-	  This commit fix several issues with sequence layer header forging on
-	  update_caps():
-	  - 0x00000004 unsigned integer is before STRUCT_C.
-	  - Set reserved bits of STRUCT_C to their values for simple/main
-	  profiles in sequence layer header format and ASF header format.
-	  - Sequence layer shall be represented as a sequence of 32 bits unsigned
-	  integers and shall be serialized in little-endian byte order except
-	  for STRUCT_C which shall be serialized in big-endian byte-order.
-	  See SMPTE 421M Annex L for more details about sequence layer format.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736474
-
-2014-09-11 18:33:20 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst/mpegtsdemux/pesparse.h:
-	  tsdemux: fix overflow of packet_length field of PESHeader
-	  packet_length is defined as a guint16 in the PESHeader structure. This
-	  definition match the specification. But since we add 6 bytes to the
-	  packet_length value (length of start_code + stream_id + packet_length),
-	  we can overflow the guint16 when the value in the PES header is greater
-	  than 65529.
-	  So use a guint32 instead of a guint16 to avoid overflow.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736490
-
-2014-09-11 16:21:30 +0400  Belozorov Semen <skiminokD@gmail.com>
-
-	* gst/mpegpsmux/mpegpsmux_h264.c:
-	  mpegpsmux: fix memory leak when converting H.264 avc to byte-stream format
-	  Fix memory leak for input stream with caps "video/x-h264,stream-format=avc".
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736426
-
-2014-09-10 10:58:03 +0200  Jesper Larsen <knorr.jesper@gmail.com>
-
-	* gst/mpegtsdemux/mpegtspacketizer.c:
-	  tsdemux: clear mutex resources in dispose
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736390
-
-2014-09-10 16:38:52 +0100  Tim-Philipp Müller <tim@centricular.com>
-
-	* sys/applemedia/avfvideosrc.m:
-	  avfvideosrc: fix bogus BGRA caps
-	  Remove 0.10-style endianness/*_mask/bpp/depth fields.
-
-2014-09-05 09:53:15 +0530  Vineeth T M <vineeth.tm@samsung.com>
-
-	* gst/aiff/aiffparse.c:
-	  aiffparse: Fix handling of 64 bit floating point data
-	  In gst_aiff_parse_create_caps if and else-if conditions
-	  are duplicated.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=736090
-
-2014-09-04 17:49:23 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/hls/m3u8.c:
-	  hlsdemux: Properly assign offsets to the files if we accumulate them instead of reading from the playlist
-
-2014-09-02 12:11:44 +0530  Vineeth T M <vineeth.tm@samsung.com>
-
-	* gst/dataurisrc/gstdataurisrc.c:
-	  dataurisrc: Make get_uri() threadsafe
-	  https://bugzilla.gnome.org/show_bug.cgi?id=735861
-
-2014-09-01 17:41:50 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/androidmedia/gstamcaudiodec.c:
-	* sys/androidmedia/gstamcaudiodec.h:
-	  amcaudiodec: Remove hack for Google MP3 decoder
-	  The first buffer does not contain more garbage than any other MP3 decoder
-	  outputs and we don't really know how much we have to drop or not.
-	  After this change the output has the same duration as with mad.
-
-2014-08-28 11:37:56 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst/rawparse/gstrawparse.c:
-	  rawparse: Reset negotiation state when going back to READY
-	  After going back to READY we can accept new format settings again.
-
-2014-08-01 13:14:03 +0200  Edward Hervey <edward@collabora.com>
-
-	* po/POTFILES.in:
-	  po: Remove files no longer present
-	  They were removed when sndfile was ported to 1.x
-
-=== release 1.4.1 ===
-
-2014-08-27 15:04:48 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* ChangeLog:
-	* NEWS:
-	* RELEASE:
-	* configure.ac:
-	* docs/plugins/inspect/plugin-accurip.xml:
-	* docs/plugins/inspect/plugin-adpcmdec.xml:
-	* docs/plugins/inspect/plugin-adpcmenc.xml:
-	* docs/plugins/inspect/plugin-asfmux.xml:
-	* docs/plugins/inspect/plugin-assrender.xml:
-	* docs/plugins/inspect/plugin-audiovisualizers.xml:
-	* docs/plugins/inspect/plugin-autoconvert.xml:
-	* docs/plugins/inspect/plugin-bayer.xml:
-	* docs/plugins/inspect/plugin-bz2.xml:
-	* docs/plugins/inspect/plugin-camerabin.xml:
-	* docs/plugins/inspect/plugin-chromaprint.xml:
-	* docs/plugins/inspect/plugin-coloreffects.xml:
-	* docs/plugins/inspect/plugin-curl.xml:
-	* docs/plugins/inspect/plugin-dataurisrc.xml:
-	* docs/plugins/inspect/plugin-debugutilsbad.xml:
-	* docs/plugins/inspect/plugin-dtsdec.xml:
-	* docs/plugins/inspect/plugin-dvb.xml:
-	* docs/plugins/inspect/plugin-dvbsuboverlay.xml:
-	* docs/plugins/inspect/plugin-dvdspu.xml:
-	* docs/plugins/inspect/plugin-faac.xml:
-	* docs/plugins/inspect/plugin-faad.xml:
-	* docs/plugins/inspect/plugin-festival.xml:
-	* docs/plugins/inspect/plugin-fieldanalysis.xml:
-	* docs/plugins/inspect/plugin-flite.xml:
-	* docs/plugins/inspect/plugin-fragmented.xml:
-	* docs/plugins/inspect/plugin-frei0r.xml:
-	* docs/plugins/inspect/plugin-gaudieffects.xml:
-	* docs/plugins/inspect/plugin-gdp.xml:
-	* docs/plugins/inspect/plugin-geometrictransform.xml:
-	* docs/plugins/inspect/plugin-gmedec.xml:
-	* docs/plugins/inspect/plugin-gsm.xml:
-	* docs/plugins/inspect/plugin-gstsiren.xml:
-	* docs/plugins/inspect/plugin-id3tag.xml:
-	* docs/plugins/inspect/plugin-inter.xml:
-	* docs/plugins/inspect/plugin-interlace.xml:
-	* docs/plugins/inspect/plugin-jpegformat.xml:
-	* docs/plugins/inspect/plugin-liveadder.xml:
-	* docs/plugins/inspect/plugin-mimic.xml:
-	* docs/plugins/inspect/plugin-mms.xml:
-	* docs/plugins/inspect/plugin-modplug.xml:
-	* docs/plugins/inspect/plugin-mpeg2enc.xml:
-	* docs/plugins/inspect/plugin-mpegpsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsmux.xml:
-	* docs/plugins/inspect/plugin-mpg123.xml:
-	* docs/plugins/inspect/plugin-mplex.xml:
-	* docs/plugins/inspect/plugin-ofa.xml:
-	* docs/plugins/inspect/plugin-openal.xml:
-	* docs/plugins/inspect/plugin-opencv.xml:
-	* docs/plugins/inspect/plugin-opus.xml:
-	* docs/plugins/inspect/plugin-pcapparse.xml:
-	* docs/plugins/inspect/plugin-pnm.xml:
-	* docs/plugins/inspect/plugin-rawparse.xml:
-	* docs/plugins/inspect/plugin-removesilence.xml:
-	* docs/plugins/inspect/plugin-resindvd.xml:
-	* docs/plugins/inspect/plugin-rfbsrc.xml:
-	* docs/plugins/inspect/plugin-schro.xml:
-	* docs/plugins/inspect/plugin-sdp.xml:
-	* docs/plugins/inspect/plugin-segmentclip.xml:
-	* docs/plugins/inspect/plugin-shm.xml:
-	* docs/plugins/inspect/plugin-smooth.xml:
-	* docs/plugins/inspect/plugin-soundtouch.xml:
-	* docs/plugins/inspect/plugin-spandsp.xml:
-	* docs/plugins/inspect/plugin-speed.xml:
-	* docs/plugins/inspect/plugin-subenc.xml:
-	* docs/plugins/inspect/plugin-videoparsersbad.xml:
-	* docs/plugins/inspect/plugin-voaacenc.xml:
-	* docs/plugins/inspect/plugin-voamrwbenc.xml:
-	* docs/plugins/inspect/plugin-waylandsink.xml:
-	* docs/plugins/inspect/plugin-y4mdec.xml:
-	* docs/plugins/inspect/plugin-zbar.xml:
-	* gst-plugins-bad.doap:
-	* win32/common/config.h:
-	  Release 1.4.1
-
-2014-08-27 14:45:07 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* 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/hr.po:
-	* po/hu.po:
-	* po/id.po:
-	* po/it.po:
-	* po/ja.po:
-	* po/ky.po:
-	* po/lt.po:
-	* po/lv.po:
-	* po/mt.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 files
-
-2014-08-27 12:36:07 +0300  Sebastian Dröge <sebastian@centricular.com>
-
-	* 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/hr.po:
-	* po/hu.po:
-	* po/id.po:
-	* po/it.po:
-	* po/ja.po:
-	* po/ky.po:
-	* po/lt.po:
-	* po/lv.po:
-	* po/mt.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 translations
-
-2014-08-20 09:37:01 +0800  Wang Xin-yu (王昕宇) <comicfans44@gmail.com>
-
-	* gst-libs/gst/gl/gstglutils.c:
-	  gl: check null before unref GstGLDisplay
-
-2014-08-19 20:14:22 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* gst-libs/gst/gl/gstglutils.c:
-	  gl: don't take an extra ref on the display on set_context
-	  gst_context_get_gl_display() returns a ref.  Don't take another in
-	  gst_object_replace().
-
-2014-08-19 17:01:36 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* ext/gl/gstglmixer.c:
-	  glmixer: unref the GstGLUpload in the pad if freed while running
-	  Dynamic pipelines that get and release the sink pads will finalize
-	  the pad without going through gst_gl_mixer_stop() which is where the
-	  upload object is usually freed.  Don't leak objects in such case.
-
-2014-08-19 14:44:29 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* ext/gl/gstglvideomixer.c:
-	  glvideomixer: don't clobber unnecessary GstVideoInfo fields
-	  otherwise we might clobber other important fields such as the frame rate.
-
-2014-08-14 23:51:21 -0400  Wang Xin-yu (王昕宇) <comicfans44@gmail.com>
-
-	* ext/gl/gstglmixer.c:
-	  glvideomixer: avoid gl resource race condition between different thread
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734830
-
-2014-08-19 00:01:28 -0300  Thiago Santos <thiagoss@osg.samsung.com>
-
-	* gst/mpegtsdemux/tsdemux.c:
-	  tsdemux: remove pads when resetting the element
-	  Otherwise the pads will be there if it is restarted and the stream
-	  can be a completely different one.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734394
-
-2014-08-14 10:19:13 +0530  Vineeth T M <vineeth.tm@samsung.com>
-
-	* gst/videofilters/gstscenechange.c:
-	  scenechange: fix crash on startup
-	  gst_video_frame_map() was using the oldinfo GstVideoInfo
-	  before it's been populated, resulting in a crash right
-	  at the start.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734763
-
-2014-08-09 01:29:30 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* ext/sbc/gstsbcenc.c:
-	  sbcenc: Unref output caps in error cases
-	  gst_caps_intersect() returns a reference to a caps object which in
-	  the normal case is consumed, but in error cases must be unreferenced.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734521
-
-2014-08-08 14:08:19 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* ext/opus/gstopusenc.c:
-	  opusenc: Unref pad template caps after usage
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734517
-
-2014-08-11 12:22:44 -0300  Thiago Santos <thiagoss@osg.samsung.com>
-
-	* ext/assrender/gstassrender.c:
-	  assrender: improve negotiation
-	  Check if downstream supports overlay meta, if possible use it and
-	  if not fallback to no-overlay caps
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733916
-
-2014-08-11 12:21:28 -0300  Thiago Santos <thiagoss@osg.samsung.com>
-
-	* ext/assrender/gstassrender.c:
-	  assrender: always intersect with the filter caps
-	  Avoids returning values that peers can't use
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733916
-
-2014-08-11 11:35:01 -0300  Thiago Santos <thiagoss@osg.samsung.com>
-
-	* gst/dvbsuboverlay/gstdvbsuboverlay.c:
-	  dvbsuboverlay: improve negotiation
-	  Check if downstream supports overlay meta, if possible use it and
-	  if not fallback to no-overlay caps
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733916
-
-2014-08-11 11:33:28 -0300  Thiago Santos <thiagoss@osg.samsung.com>
-
-	* gst/dvbsuboverlay/gstdvbsuboverlay.c:
-	  dvbsuboverlay: always intersect with the filter in getcaps
-	  Avoids returning unsupported caps to peers
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733916
-
-2014-08-09 11:36:38 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* gst/camerabin2/gstwrappercamerabinsrc.c:
-	  wrappercamerabinsrc: Unref elements after usage
-	  gst_bin_get_by_name() and gst_bin_get_by_interface() both return
-	  references to elements that need to be unreferenced after usage.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734524
-
-2014-08-09 01:27:53 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* ext/openal/gstopenalsink.c:
-	* ext/openal/gstopenalsrc.c:
-	  openal: Unref pad template caps after usage
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734520
-
-2014-08-09 13:22:42 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* sys/directsound/gstdirectsoundsrc.c:
-	  directsoundsrc: Avoid leaking copy of caps object
-	  gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
-	  so creating a copy using gst_caps_copy() results in a reference leak.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734536
-
-2014-08-09 13:24:00 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* sys/pvr2d/gstpvrvideosink.c:
-	  pvrvideosink: Avoid leaking bufferpool configuration
-	  gst_buffer_pool_get_config() returns a copy to the bufferpool's
-	  configuration, which must be passed to gst_structure_free() after
-	  use if not given away to gst_buffer_pool_set_config().
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734537
-
-2014-08-09 13:17:17 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* sys/androidmedia/gstamcvideoenc.c:
-	  amcvideoenc: Avoid leaking copy of caps object
-	  gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
-	  so creating a copy using gst_caps_copy() results in a reference leak.
-	  Also remove the incorrect comment to avoid confusion in the future.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734533
-
-2014-08-09 14:27:34 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* ext/gsm/gstgsmenc.c:
-	  gstgsmenc: Unref caps object after usage
-	  gst_audio_encoder_set_output_format() does not consume caps, so
-	  unreference that object instead.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734544
-
-2014-08-09 13:12:14 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* gst/interlace/gstinterlace.c:
-	  interlace: fix caps refcounting
-	  tcaps was unrefed when it shouldn't have been unrefed
-	  in some cases.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734531
-
-2014-08-09 13:09:52 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* gst/dvbsuboverlay/gstdvbsuboverlay.c:
-	  dvbsuboverlay: Avoid leaking copy of caps object
-	  gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
-	  so creating a copy using gst_caps_copy() results in a reference leak.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734528
-
-2014-08-09 13:20:41 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* sys/applemedia/vtenc.c:
-	  vtenc: Avoid leaking caps object and its copy
-	  gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
-	  so creating a copy using gst_caps_copy() results in a reference leak. Also
-	  the caps are pushed as an event downstream, but this doesn't consume the
-	  caps so it must still be unreferenced.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734534
-
-2014-08-09 13:27:00 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* tools/element-templates/srcpad:
-	  element-maker: Avoid leaking copy of caps object
-	  gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
-	  so creating a copy using gst_caps_copy() results in a reference leak.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734539
-
-2014-08-09 11:17:44 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* gst-libs/gst/video/gstvideoaggregator.c:
-	  videoaggregator: Unref allowed caps after usage
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734522
-
-2014-08-09 01:25:21 +0200  Sebastian Rasmussen <sebras@hotmail.com>
-
-	* ext/ladspa/gstladspafilter.c:
-	  ladspa: Unref pad template caps after usage
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734519
-
-2014-08-01 12:38:44 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/decklink/gstdecklink.cpp:
-	  decklink: 59.94fps is 60000/1001, not 30000/1001
-	  And also change 30/1 to 60/1 for one 60fps mode.
-
-2014-08-01 16:40:49 +0200  Aurélien Zanelli <aurelien.zanelli@parrot.com>
-
-	* gst-libs/gst/codecparsers/gsth264parser.c:
-	  codecparsers_h264: initialize some fields of pic_timing structure
-	  Otherwise pic timing structure can have invalid cpb_removal_delay,
-	  dpb_output_delay or pic_struct_present_flag which are blindly retrieved
-	  in h264parse.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734124
-
-2014-08-01 18:02:10 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/decklink/gstdecklinksink.cpp:
-	  decklinksink: Initialize pixel format to bmdFormat8BitYUV
-	  https://bugzilla.gnome.org/show_bug.cgi?id=725871
-
-2014-08-01 16:58:23 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* sys/decklink/gstdecklinksink.cpp:
-	  decklinksink: Catch errors during data flow and error out properly
-	  Otherwise we will just deadlock the thread if e.g. scheduling a video
-	  frame fails for whatever reason.
-
-2014-08-05 11:45:55 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* gst/mpegtsdemux/mpegtspacketizer.c:
-	* gst/mpegtsdemux/mpegtspacketizer.h:
-	  mpegtspacketizer: Store PCR time/byte offsets in 64 bit integers
-	  32 bit integers are going to overflow, especially the PCR offset to
-	  the first PCR will overflow after about 159 seconds. This makes playback
-	  of streams stop at 159 seconds as suddenly the timestamps are starting
-	  again from 0. Now we have a few more years time until it happens again
-	  and 64 bits are too small.
-
-2014-08-06 18:11:20 +0300  George Kiagiadakis <george.kiagiadakis@collabora.com>
-
-	* ext/dash/gstdashdemux.c:
-	* ext/dash/gstmpdparser.c:
-	* ext/dash/gstmpdparser.h:
-	  dashdemux: support downloading segments in reverse order
-	  When a seek with a negative rate is requested, find the target
-	  segment where gstsegment.stop belongs in and then download from
-	  this segment backwards until the first segment.
-	  This allows proper reverse playback.
-
-2014-08-01 17:51:08 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* gst-libs/gst/gl/gstgldisplay.c:
-	  gl/docs: remove superflous 'the'
-
-2014-08-06 08:15:38 -0400  Wang Xin-yu (王昕宇) <comicfans44@gmail.com>
-
-	* gst-libs/gst/gl/gstglupload.c:
-	  glupload: don't determine if frame needs upload by pointer compare
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734269
-
-2014-07-31 20:52:39 -0300  Thiago Santos <thiagoss@osg.samsung.com>
-
-	* ext/dash/gstdashdemux.c:
-	  dashdemux: return the error to the source immediately to stop faster
-	  When flushing, this will prevent dashdemux from trying to download more
-	  fragments or more chunks of the same fragment before stopping.
-	  Also improves the error handling to not transform everything non-ok into
-	  an error.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=734014
-
-2014-07-29 02:11:54 -0300  Thiago Santos <ts.santos@osg.sisa.samsung.com>
-
-	* gst/mpegtsdemux/mpegtspacketizer.c:
-	  mpegtspacketizer: avoid timestamp overflows
-	  Cause timing to break in the pipeline that can lead to a stall
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733837
-
-2014-08-01 16:41:13 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* ext/gl/gstglimagesink.c:
-	* gst-libs/gst/gl/gstgldisplay.c:
-	  gl: document GST_GL_* environment variables
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733245
-
-2014-07-29 13:25:22 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* ext/gl/gstglimagesink.c:
-	  glimagesink: keep the uploaded buffer around on successful redisplay
-	  We might need it later to perform a redisplay.  GstGLUpload will take
-	  of releasing the previous buffer when it receives a new buffer.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733726
-
-2014-07-29 11:47:55 +1000  Matthew Waters <ystreet00@gmail.com>
-
-	* gst-libs/gst/gl/gstglcolorconvert.c:
-	* gst-libs/gst/gl/gstglmemory.c:
-	  glmemory: reenable the texture_rg support for !eagl
-	  The GST_GL_HAVE_PLATFORM_EAGL is always defined we need to compare
-	  against the value instead.
-
-2012-06-15 13:19:06 +0100  David Rothlisberger <david.rothlisberger@youview.com>
-
-	* ext/opencv/gsttemplatematch.c:
-	  opencv templatematch: Set caps to BGR order
-	  templatematch operates on BGR data. In fact, OpenCV's IplImage always
-	  stores color image data in BGR order -- this isn't documented at all in
-	  the OpenCV source code, but there are hints around the web (see for
-	  example
-	  http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html#SECTION00041000000000000000
-	  and http://www.comp.leeds.ac.uk/vision/opencv/iplimage.html ).
-	  gst_templatematch_load_template loads the template (the image to find)
-	  from disk using OpenCV's cvLoadImage, so it is stored in an IplImage in
-	  BGR order. But in gst_templatematch_chain, no OpenCV conversion
-	  functions are used: the imageData pointer of the IplImage for the video
-	  frame (the image to search in) is just set to point to the raw buffer
-	  data. Without this fix, that raw data is in RGB order, so the call to
-	  cvMatchTemplate ends up comparing the template's Blue channel against
-	  the frame's Red channel, producing very poor results.
-
-2014-07-28 13:10:35 -0300  Thiago Santos <ts.santos@osg.sisa.samsung.com>
-
-	* ext/opencv/gsttemplatematch.c:
-	  templatematch: mark pads as proxy caps
-	  Allows negotiation to happen properly
-
-2014-07-23 10:25:31 +0800  Wang Xin-yu (王昕宇) <comicfans44@gmail.com>
-
-	* ext/gl/gstgleffects.c:
-	* ext/gl/gstglmixer.c:
-	* gst-libs/gst/gl/gstglcolorconvert.c:
-	* gst-libs/gst/gl/gstglfilter.c:
-	* gst-libs/gst/gl/gstglframebuffer.c:
-	  gl: fix multi gl object leaks
-	  1. fix FBO leaks in decide_allocation
-	  2. fix texture leaks in decide_allocation and reset
-	  3. fix texture leaks in FBO incomplete error path
-
-2014-07-21 18:22:18 +0200  Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
-
-	* gst/mpegtsdemux/tsdemux.c:
-	  tsdemux: Do not scan for keyframe when in push mode.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733490
-
-2014-07-21 18:21:41 +0200  Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
-
-	* gst/mpegtsdemux/tsdemux.c:
-	  tsdemux: Do not scan for a keyframe in non-accurate mode.
-	  Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733490
-
-2014-07-21 17:34:52 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* configure.ac:
-	  openjpeg: Don't remember -lopenjp2 as libs when falling back to openjpeg1
-
-2014-07-21 11:07:28 +0000  Руслан Ижбулатов <lrn1986@gmail.com>
-
-	* tests/examples/gl/sdl/Makefile.am:
-	  gl: Reorder CFLAGS to include in-source dirs first in examples
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733426
-
-2014-05-06 09:28:14 +0000  Руслан Ижбулатов <lrn1986@gmail.com>
-
-	* configure.ac:
-	  openjpeg: Win32-compatible OpenJPEG-2.0 detection
-	  OpenJPEG 2.0 API uses stdcall on W32 by default. This prevents normal
-	  autoconf library macros from finding its functions.
-	  A more compatible check is to acutally link a program that includes a
-	  real header.
-	  https://bugzilla.gnome.org/show_bug.cgi?id=733487
-
-2014-07-21 10:14:17 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* ext/openni2/gstopenni2src.cpp:
-	  openni2src: Fix unitialized variable compiler warning
-	  gstopenni2src.cpp:721:14: error: variable 'oni_ts' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
-	  } else if (src->color->isValid () && src->sourcetype == SOURCETYPE_COLOR) {
-	  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	  gstopenni2src.cpp:752:26: note: uninitialized use occurs here
-	  GST_BUFFER_PTS (buf) = oni_ts - src->oni_start_ts;
-	  ^~~~~~
-	  gstopenni2src.cpp:721:10: note: remove the 'if' if its condition is always true
-	  } else if (src->color->isValid () && src->sourcetype == SOURCETYPE_COLOR) {
-	  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	  gstopenni2src.cpp:721:14: error: variable 'oni_ts' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
-	  } else if (src->color->isValid () && src->sourcetype == SOURCETYPE_COLOR) {
-	  ^~~~~~~~~~~~~~~~~~~~~~
-	  gstopenni2src.cpp:752:26: note: uninitialized use occurs here
-	  GST_BUFFER_PTS (buf) = oni_ts - src->oni_start_ts;
-	  ^~~~~~
-	  gstopenni2src.cpp:721:14: note: remove the '&&' if its condition is always true
-	  } else if (src->color->isValid () && src->sourcetype == SOURCETYPE_COLOR) {
-	  ^~~~~~~~~~~~~~~~~~~~~~~~~
-	  gstopenni2src.cpp:642:18: note: initialize the variable 'oni_ts' to silence this warning
-	  uint64_t oni_ts;
-	  ^
-	  = 0
-
-2014-07-21 21:03:26 +0200  Nicola Murino <nicola.murino@gmail.com>
-
-	* ext/opencv/gstfacedetect.c:
-	  facedetect: improve enum GstFaceDetectUpdates descriptions
-	  https://bugzilla.gnome.org/show_bug.cgi?id=730509
-
-2014-05-21 12:59:57 +0200  Nicola Murino <nicola.murino@gmail.com>
-
-	* ext/opencv/gstfacedetect.c:
-	  facedetect: make updates on_change works as expected
-	  https://bugzilla.gnome.org/show_bug.cgi?id=730509
-
 === release 1.4.0 ===
 
-2014-07-19 17:27:11 +0200  Sebastian Dröge <sebastian@centricular.com>
+2014-07-19  Sebastian Dröge <slomo@coaxion.net>
 
-	* ChangeLog:
-	* NEWS:
-	* RELEASE:
 	* configure.ac:
-	* docs/plugins/inspect/plugin-accurip.xml:
-	* docs/plugins/inspect/plugin-adpcmdec.xml:
-	* docs/plugins/inspect/plugin-adpcmenc.xml:
-	* docs/plugins/inspect/plugin-asfmux.xml:
-	* docs/plugins/inspect/plugin-assrender.xml:
-	* docs/plugins/inspect/plugin-audiovisualizers.xml:
-	* docs/plugins/inspect/plugin-autoconvert.xml:
-	* docs/plugins/inspect/plugin-bayer.xml:
-	* docs/plugins/inspect/plugin-bz2.xml:
-	* docs/plugins/inspect/plugin-camerabin.xml:
-	* docs/plugins/inspect/plugin-chromaprint.xml:
-	* docs/plugins/inspect/plugin-coloreffects.xml:
-	* docs/plugins/inspect/plugin-curl.xml:
-	* docs/plugins/inspect/plugin-dataurisrc.xml:
-	* docs/plugins/inspect/plugin-debugutilsbad.xml:
-	* docs/plugins/inspect/plugin-dtsdec.xml:
-	* docs/plugins/inspect/plugin-dvb.xml:
-	* docs/plugins/inspect/plugin-dvbsuboverlay.xml:
-	* docs/plugins/inspect/plugin-dvdspu.xml:
-	* docs/plugins/inspect/plugin-faac.xml:
-	* docs/plugins/inspect/plugin-faad.xml:
-	* docs/plugins/inspect/plugin-festival.xml:
-	* docs/plugins/inspect/plugin-fieldanalysis.xml:
-	* docs/plugins/inspect/plugin-flite.xml:
-	* docs/plugins/inspect/plugin-fragmented.xml:
-	* docs/plugins/inspect/plugin-frei0r.xml:
-	* docs/plugins/inspect/plugin-gaudieffects.xml:
-	* docs/plugins/inspect/plugin-gdp.xml:
-	* docs/plugins/inspect/plugin-geometrictransform.xml:
-	* docs/plugins/inspect/plugin-gmedec.xml:
-	* docs/plugins/inspect/plugin-gsm.xml:
-	* docs/plugins/inspect/plugin-gstsiren.xml:
-	* docs/plugins/inspect/plugin-id3tag.xml:
-	* docs/plugins/inspect/plugin-inter.xml:
-	* docs/plugins/inspect/plugin-interlace.xml:
-	* docs/plugins/inspect/plugin-jpegformat.xml:
-	* docs/plugins/inspect/plugin-liveadder.xml:
-	* docs/plugins/inspect/plugin-mimic.xml:
-	* docs/plugins/inspect/plugin-mms.xml:
-	* docs/plugins/inspect/plugin-modplug.xml:
-	* docs/plugins/inspect/plugin-mpeg2enc.xml:
-	* docs/plugins/inspect/plugin-mpegpsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsdemux.xml:
-	* docs/plugins/inspect/plugin-mpegtsmux.xml:
-	* docs/plugins/inspect/plugin-mpg123.xml:
-	* docs/plugins/inspect/plugin-mplex.xml:
-	* docs/plugins/inspect/plugin-ofa.xml:
-	* docs/plugins/inspect/plugin-openal.xml:
-	* docs/plugins/inspect/plugin-opencv.xml:
-	* docs/plugins/inspect/plugin-opus.xml:
-	* docs/plugins/inspect/plugin-pcapparse.xml:
-	* docs/plugins/inspect/plugin-pnm.xml:
-	* docs/plugins/inspect/plugin-rawparse.xml:
-	* docs/plugins/inspect/plugin-removesilence.xml:
-	* docs/plugins/inspect/plugin-resindvd.xml:
-	* docs/plugins/inspect/plugin-rfbsrc.xml:
-	* docs/plugins/inspect/plugin-schro.xml:
-	* docs/plugins/inspect/plugin-sdp.xml:
-	* docs/plugins/inspect/plugin-segmentclip.xml:
-	* docs/plugins/inspect/plugin-shm.xml:
-	* docs/plugins/inspect/plugin-smooth.xml:
-	* docs/plugins/inspect/plugin-soundtouch.xml:
-	* docs/plugins/inspect/plugin-spandsp.xml:
-	* docs/plugins/inspect/plugin-speed.xml:
-	* docs/plugins/inspect/plugin-subenc.xml:
-	* docs/plugins/inspect/plugin-videoparsersbad.xml:
-	* docs/plugins/inspect/plugin-voaacenc.xml:
-	* docs/plugins/inspect/plugin-voamrwbenc.xml:
-	* docs/plugins/inspect/plugin-waylandsink.xml:
-	* docs/plugins/inspect/plugin-y4mdec.xml:
-	* docs/plugins/inspect/plugin-zbar.xml:
-	* gst-plugins-bad.doap:
-	* win32/common/config.h:
-	  Release 1.4.0
-
-2014-07-19 16:45:25 +0200  Sebastian Dröge <sebastian@centricular.com>
-
-	* 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/hr.po:
-	* po/hu.po:
-	* po/id.po:
-	* po/it.po:
-	* po/ja.po:
-	* po/ky.po:
-	* po/lt.po:
-	* po/lv.po:
-	* po/mt.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 files
+	  releasing 1.4.0
 
 2014-07-19 12:47:43 +0200  Sebastian Dröge <sebastian@centricular.com>
 
diff --git a/Makefile.am b/Makefile.am
index 3eb1bca..432684c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,14 +25,18 @@
 include $(top_srcdir)/common/po.mak
 
 check-valgrind:
-	cd tests/check && make check-valgrind
+	$(MAKE) -C tests/check check-valgrind
 
 if HAVE_GST_CHECK
 check-torture:
-	cd tests/check && make torture
+	$(MAKE) -C tests/check torture
+build-checks:
+	$(MAKE) -C tests/check build-checks
 else
 check-torture:
 	true
+build-checks:
+	true
 endif
 
 win32-update:
diff --git a/Makefile.in b/Makefile.in
index cb327aa..84a30e2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -106,6 +106,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -119,7 +120,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -256,8 +256,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -296,7 +300,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -304,6 +307,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -353,8 +358,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -433,7 +436,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -442,7 +444,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -455,7 +456,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -480,6 +480,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -553,10 +555,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -582,6 +588,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -618,6 +627,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -658,17 +668,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -685,6 +694,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -1431,12 +1441,16 @@
 	$(top_srcdir)/common/download-translations $(PACKAGE)
 
 check-valgrind:
-	cd tests/check && make check-valgrind
+	$(MAKE) -C tests/check check-valgrind
 
 @HAVE_GST_CHECK_TRUE@check-torture:
-@HAVE_GST_CHECK_TRUE@	cd tests/check && make torture
+@HAVE_GST_CHECK_TRUE@	$(MAKE) -C tests/check torture
+@HAVE_GST_CHECK_TRUE@build-checks:
+@HAVE_GST_CHECK_TRUE@	$(MAKE) -C tests/check build-checks
 @HAVE_GST_CHECK_FALSE@check-torture:
 @HAVE_GST_CHECK_FALSE@	true
+@HAVE_GST_CHECK_FALSE@build-checks:
+@HAVE_GST_CHECK_FALSE@	true
 
 win32-update:
 	cp $(top_builddir)/win32/common/config.h-new \
diff --git a/NEWS b/NEWS
index a27c206..0edcf34 100644
--- a/NEWS
+++ b/NEWS
@@ -1,2 +1,145 @@
-This is GStreamer Bad Plugins 1.4.5
+This is GStreamer Bad Plugins 1.4.0
 
+Changes since 1.2:
+
+New API:
+ • GstMessageType has GST_MESSAGE_EXTENDED added. All types before
+   that can be used together as a flags type as before, but from
+   that message onwards the types are just counted incrementally.
+   This was necessary to be able to add more message types.
+   In 2.0 GstMessageType will just become an enum and not a flags
+   type anymore.
+ • GstDeviceMonitor for device probing, e.g. to list all available
+   audio or video capture devices. This is the replacement for
+   GstPropertyProbe from 0.10.
+ • Events accumulate the running-time offset now when travelling
+   through pads, as set by the gst_pad_set_offset() function. This
+   allows to compensate for this in the QOS event for example.
+ • GstBuffer has a new flag "tag-memory" that is set automatically
+   when memory is added or removed to a buffer. This allows buffer
+   pools to detect if they can recycle a buffer or need to reset
+   it first.
+ • GstToc has new API to mark GstTocEntries as loops.
+ • A not-authorized resource error has been defined to notify
+   applications that accessing the resource has failed because
+   of missing authorization and to distinguish this case from others.
+   This change is actually already in 1.2.4.
+ • GstPad has a new flag "accept-intersect", that will let the default
+   ACCEPT_CAPS query handler do an intersection instead of subset check.
+   This is interesting for parser elements that can handle incomplete
+   caps.
+ • GstCollectPads has support for flushing and a default handler for
+   SEEK events now.
+ • New GstFlowAggregator helper object that simplifies handling of
+   flow returns in elements with multiple source pads. Additionally
+   GstPad now always stores the last flow return and provides an
+   API to retrieve it.
+ • GstSegment has new API to offset the running time by a specific
+   value and this is used in GstPad to allow positive and negative
+   offsets in gst_pad_set_offset() in all situations.
+ • Support for h265/HEVC and VP8 has been added to the codec utils and codec
+   parsers library, and was integrated into various elements.
+ • API for adjusting the TLS validation of RTSP connection has been added.
+ • The RTSP and SDP library has MIKEY (RFC 3830) support now, and
+   there is API to distinguish between the different RTSP profiles.
+ • API to access RTP time information and statistics.
+ • Support for auxiliary streams was added to rtpbin.
+ • Support for tiled, raw video formats has been added.
+ • GstVideoDecoder and GstAudioDecoder have API to help aggregating tag
+   events and merge custom tags into them consistently.
+ • GstBufferPool has support for flushing now.
+ • playbin/playsink has support for application provided audio and video
+   filters.
+ • GstDiscoverer has new and simplified API to get details about missing
+   plugins and information to pass to the plugin installer.
+ • The GL library was merged from gst-plugins-gl to gst-plugins-bad,
+   providing a generic infrastructure for handling GL inside GStreamer
+   pipelines and a plugin with some elements using these, especially
+   a video sink. Supported platforms currently are Android, Cocoa (OS X),
+   DispManX (Raspberry Pi), EAGL (iOS), WGL (Windows) and generic X11,
+   Wayland and EGL platforms.
+   This replaces eglglessink and also is supposed to replace osxvideosink.
+ • New GstAggregator base class in gst-plugins-bad. This is supposed to
+   replace GstCollectPads in the future and fix long-known shortcomings
+   in its API. Together with the base class some elements are provided
+   already, like a videomixer (compositor).
+
+
+Major changes:
+ • New plugins and elements:
+   ∘ v4l2videodec element for accessing hardware codecs on
+     platforms that make them accessible via V4L2, e.g.
+     Samsung Exynos. This comes together with major refactoring
+     of the existing V4L2 elements and the corresponding
+     infrastructure.
+     The v4l2videodec element replaces the mfcdec element.
+   ∘ New downloadbuffer element that replaces the download
+     buffering feature of queue2. Compared to queue2's code
+     it is much simpler and only for this single use case.
+     A noteworthy new feature is that it's downloading gaps
+     in the already downloaded stream parts when nothing else
+     is to be downloaded.
+     This is now used by playbin when download buffering is
+     enabled.
+   ∘ rtpstreampay and rtpstreamdepay elements for transmitting
+     RTP packets over a stream API (e.g. TCP) according to
+     RFC 4571.
+   ∘ rtprtx elements for standard compliant implementation of
+     retransmissions, integrated into the rtpmanager plugin.
+   ∘ audiomixer element that mixes multiple audio streams together
+     into a single one while keeping synchronization. This is
+     planned to become the replacement of the adder element.
+   ∘ OpenNI2 plugin for 3D cameras like the Kinect camera.
+   ∘ OpenEXR plugin for decoding high-dynamic-range EXR images.
+   ∘ curlsshsink and curlsftpsink to write files via SSH/SFTP.
+   ∘ videosignal, ivfparse and sndfile plugins ported from 0.10.
+   ∘ avfvideosrc, vtdec and other elements were ported from 0.10 and
+     are available on OS X and iOS now.
+
+ • Other changes:
+   ∘ gst-libav now uses libav 10.2, and gained support for H265/HEVC.
+   ∘ Support for hardware codecs and special memory types has been
+     improved with bugfixes and feature additions in various plugins
+     and base classes.
+   ∘ Various bugfixes and improvements to buffering in queue2 and
+     multiqueue elements.
+   ∘ dvbsrc supports more delivery mechanisms and other features
+     now, including DVB S2 and T2 support.
+   ∘ The MPEGTS library has support for many more descriptors.
+   ∘ Major improvements to tsdemux and tsparse, especially time and
+     seeking related.
+   ∘ souphttpsrc now has support for keep-alive connections,
+     compression, configurable number of retries and configuration
+     for SSL certificate validation.
+   ∘ hlsdemux has undergone major refactoring and works more
+     reliable now and supports more HLS features like trick modes.
+     Also fragments are pushed downstream while they're downloaded
+     now instead of waiting for each fragment to finish.
+   ∘ dashdemux and mssdemux are now also pushing fragments downstream
+     while they're downloaded instead of waiting for each fragment to
+     finish.
+   ∘ videoflip can automatically flip based on the orientation tag.
+   ∘ openjpeg supports the OpenJPEG2 API.
+   ∘ waylandsink was refactored and should be more useful now. It also
+     includes a small library which most likely is going to be removed
+     in the future and will result in extensions to the GstVideoOverlay
+     interface.
+   ∘ gst-rtsp-server supports SRTP and MIKEY now.
+   ∘ gst-libav encoders are now negotiating any profile/level settings
+     with downstream via caps.
+   ∘ Lots of fixes for coverity warnings all over the place.
+   ∘ Negotiation related performance improvements.
+   ∘ 800+ fixed bug reports, and many other bug fixes and other
+     improvements everywhere that had no bug report.
+
+Things to look out for:
+ • The eglglessink element was removed and replaced by the glimagesink
+   element.
+ • The mfcdec element was removed and replaced by v4l2videodec.
+ • osxvideosink is only available in OS X 10.6 or newer.
+ • On Android the namespace of the automatically generated Java class
+   for initialization of GStreamer has changed from com.gstreamer to
+   org.freedesktop.gstreamer to prevent namespace pollution.
+ • On iOS you have to update your gst_ios_init.h and gst_ios_init.m in
+   your projects from the one included in the binaries if you used the
+   GnuTLS GIO module before. The loading mechanism has slightly changed.
diff --git a/README b/README
index da0cab4..f175b1b 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-GStreamer 1.3.x development series
+GStreamer 1.5.x development series
 
 WHAT IT IS
 ----------
diff --git a/RELEASE b/RELEASE
index df1ee5b..4893735 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,27 +1,23 @@
 
-Release notes for GStreamer Bad Plugins 1.4.5
-
-The GStreamer team is pleased to announce a bugfix release of the stable
-1.4 release series. The 1.4 release series is adding new features on top
-of the 1.2 series and is part of the API and ABI-stable 1.x release
-series of the GStreamer multimedia framework that contains new features.
-The 1.4.x bugfix releases only contain important bugfixes compared to 1.4.0.
+Release notes for GStreamer Bad Plugins 1.4.0
 
 
-Binaries for Android, iOS, Mac OS X and Windows are provided by the
-GStreamer project for this release.
+The GStreamer team is pleased to announce the first release of
+the stable 1.4 release series. The 1.4 release series is adding new
+features on top of the 1.0 and 1.2 series and is part of the API and
+ABI-stable 1.x release series of the GStreamer multimedia framework.
 
 
-The 1.x series is a stable series targeted at end users. It is not API
-or ABI compatible with the 0.10.x series. It can, however, be installed
-in parallel with the 0.10.x series and will not affect an existing
-0.10.x installation.
+
+Binaries for Android, iOS, Mac OS X and Windows are provided together
+with this release.
 
 
-The stable 1.4.x release series is API and ABI compatible with 1.0.x and
-any other 1.x release series in the future. Compared to 1.0.x it contains
-some new features and more intrusive changes that were considered too
-risky as a bugfix.
+
+The stable 1.4 release series is API and ABI compatible with 1.0.x,
+1.2.x and any other 1.x release series in the future. Compared to 1.2.x
+it contains some new features and more intrusive changes that were
+considered too risky as a bugfix.
 
 
 
@@ -73,14 +69,12 @@
 
 Bugs fixed in this release
      
-      * 722764 : rawparse: fix SEEKING query handling
-      * 729768 : mpegtsbase: Raise limit to read more bytes initially to find PCR
-      * 739152 : gl/cocoa: build with GNUStep fails
-      * 740191 : dvbbasesink: segfaults on 32-bit (rpi)
-      * 740201 : gl/cocoa: Does not compile on OSX < 10.7 anymore
-      * 740451 : srtpdec: leaks rtp/rtcp sink events
-      * 740953 : configure.ac: unportable test(1) comparison operator
-      * 741321 : opusparse: fix header parsing esp. of encoded output of libopus
+      * 726555 : POTFILES.in is out of date
+      * 733052 : Include windsock header for Windows targets
+      * 733063 : examples: gl fxtest example fails to build on win32 with gtk+ 3.0
+      * 733072 : camerabin: Taking a picture in cheese leads to all sort of race
+      * 733123 : mxfmux: Avoid taking unnecessary ref
+      * 733248 : gl: GLintptr/GLsizeiptr/etc typechecks ignore GL_CFLAGS, potentially causing typedef redefinition errors from gst-libs/gst/gl/glprototypes/gstgl_compat.h at buildtime
 
 ==== Download ====
 
@@ -117,17 +111,28 @@
         
 Contributors to this release
     
-      * Aleix Conchillo Flaqué
       * Alessandro Decina
+      * Alexey Pavlov
+      * Arun Raghavan
+      * Edward Hervey
       * Gwenole Beauchesne
+      * Göran Jönsson
+      * Jan Alexander Steffens (heftig)
+      * Jan Schmidt
+      * Julien Isorce
+      * Mart Raudsepp
       * Mathieu Duponchelle
       * Matthew Waters
+      * Matthieu Bouron
+      * Nicolas Dufresne
+      * Philip Withnall
+      * Piotr Drąg
       * Sebastian Dröge
-      * Sudip Jain
+      * Sebastian Rasmussen
+      * Stefan Ringel
+      * Thiago Santos
       * Thibault Saunier
-      * Thomas Klausner
       * Tim-Philipp Müller
       * Vincent Penquerc'h
-      * Wim Taymans
-      * Wonchul Lee
+      * Wang Xin-yu (王昕宇)
  
\ No newline at end of file
diff --git a/aclocal.m4 b/aclocal.m4
index cc915e4..ff63a81 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1456,6 +1456,7 @@
 m4_include([common/m4/as-libtool.m4])
 m4_include([common/m4/as-version.m4])
 m4_include([common/m4/ax_create_stdint_h.m4])
+m4_include([common/m4/ax_pthread.m4])
 m4_include([common/m4/gst-arch.m4])
 m4_include([common/m4/gst-args.m4])
 m4_include([common/m4/gst-check.m4])
@@ -1469,7 +1470,6 @@
 m4_include([common/m4/gst-platform.m4])
 m4_include([common/m4/gst-plugin-docs.m4])
 m4_include([common/m4/gst-plugindir.m4])
-m4_include([common/m4/gst-x11.m4])
 m4_include([common/m4/gst.m4])
 m4_include([common/m4/gtk-doc.m4])
 m4_include([common/m4/introspection.m4])
diff --git a/common/Makefile.in b/common/Makefile.in
index c5076b2..5f667f2 100644
--- a/common/Makefile.in
+++ b/common/Makefile.in
@@ -88,6 +88,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -101,7 +102,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -219,8 +219,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -259,7 +263,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -267,6 +270,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -316,8 +321,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -396,7 +399,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -405,7 +407,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -418,7 +419,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -443,6 +443,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -516,10 +518,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -545,6 +551,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -581,6 +590,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -621,17 +631,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -648,6 +657,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/common/check.mak b/common/check.mak
index 611546a..efd5458 100644
--- a/common/check.mak
+++ b/common/check.mak
@@ -46,7 +46,8 @@
 
 # valgrind any given test by running make test.valgrind
 %.valgrind: %
-	@$(TESTS_ENVIRONMENT)					\
+	@valgrind_log=$(subst /,-,$*-valgrind.log);		\
+	$(TESTS_ENVIRONMENT)					\
 	CK_DEFAULT_TIMEOUT=360					\
 	G_SLICE=always-malloc					\
 	$(LIBTOOL) --mode=execute				\
@@ -55,12 +56,12 @@
 	--tool=memcheck --leak-check=full --trace-children=yes	\
 	--show-possibly-lost=no                                 \
 	--leak-resolution=high --num-callers=20			\
-	./$* 2>&1 | tee valgrind.log
-	@if grep "==" valgrind.log > /dev/null 2>&1; then	\
-	    rm valgrind.log;					\
+	./$* 2>&1 | tee $$valgrind_log ;			\
+	if grep "==" $$valgrind_log > /dev/null 2>&1; then	\
+	    rm $$valgrind_log;					\
 	    exit 1;						\
-	fi
-	@rm valgrind.log
+	fi ;							\
+	rm $$valgrind_log
 
 # valgrind any given test and generate suppressions for it
 %.valgrind.gen-suppressions: %
@@ -150,19 +151,13 @@
 # valgrind all tests
 valgrind: $(TESTS)
 	@echo "Valgrinding tests ..."
-	@failed=0;							\
+	@failed=0; valgrind_targets="";					\
 	for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do	\
-		$(MAKE) $$t.valgrind;					\
-		if test "$$?" -ne 0; then                               \
-			echo "Valgrind error for test $$t";		\
-			failed=`expr $$failed + 1`;			\
-			whicht="$$whicht $$t";				\
-		fi;							\
+	  valgrind_targets="$$valgrind_targets $$t.valgrind";		\
 	done;								\
-	if test "$$failed" -ne 0; then					\
-		echo "$$failed tests had leaks or errors under valgrind:";	\
-		echo "$$whicht";					\
-		false;							\
+	if ! $(MAKE) $$valgrind_targets ; then				\
+	  echo "Some tests had leaks or errors under valgrind";		\
+	  false;							\
 	fi
 
 # valgrind all tests until failure
@@ -215,6 +210,9 @@
 	  do echo Inspecting $$e;					\
 	     $(GST_INSPECT) $$e > /dev/null 2>&1; done
 
+# build all tests
+build-checks: $(TESTS)
+
 help:
 	@echo
 	@echo "make check                         -- run all checks"
@@ -237,6 +235,7 @@
 	@echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
 	@echo "                                               and save to suppressions.log"
 	@echo "make inspect                       -- inspect all plugin features"
+	@echo "make build-checks                  -- build all checks (but don't run them)"
 	@echo
 	@echo
 	@echo "Additionally, you can use the GST_CHECKS environment variable to"
diff --git a/common/gst-indent b/common/gst-indent
index 732b2ba..b5e808f 100755
--- a/common/gst-indent
+++ b/common/gst-indent
@@ -9,13 +9,19 @@
 
 version=`gnuindent --version 2>/dev/null`
 if test "x$version" = "x"; then
-  version=`indent --version 2>/dev/null`
+  version=`gindent --version 2>/dev/null`
   if test "x$version" = "x"; then
-    echo "GStreamer git pre-commit hook:"
-    echo "Did not find GNU indent, please install it before continuing."
-    exit 1
+    version=`indent --version 2>/dev/null`
+    if test "x$version" = "x"; then
+      echo "GStreamer git pre-commit hook:"
+      echo "Did not find GNU indent, please install it before continuing."
+      exit 1
+    else
+      INDENT=indent
+    fi
+  else
+    INDENT=gindent
   fi
-  INDENT=indent
 else
   INDENT=gnuindent
 fi
diff --git a/common/gst.supp b/common/gst.supp
index 2c60392..c08f660 100644
--- a/common/gst.supp
+++ b/common/gst.supp
@@ -3965,3 +3965,10 @@
    ...
    fun:g_quark_from*_string
 }
+
+{
+  <timer_create suppressions for earlier valgrind versions that complain>
+  Memcheck:Param
+  timer_create(evp)
+  fun:timer_create@@GLIBC_2.3.3
+}
diff --git a/common/m4/Makefile.am b/common/m4/Makefile.am
index 3d387ee..cdcec8c 100644
--- a/common/m4/Makefile.am
+++ b/common/m4/Makefile.am
@@ -11,6 +11,7 @@
 	as-python.m4 \
 	as-version.m4 \
 	ax_create_stdint_h.m4 \
+	ax_pthread.m4 \
 	glib-gettext.m4 \
 	gst-arch.m4 \
 	gst-args.m4 \
diff --git a/common/m4/Makefile.in b/common/m4/Makefile.in
index 4e34244..ed7ff1f 100644
--- a/common/m4/Makefile.in
+++ b/common/m4/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -158,8 +158,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -198,7 +202,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -206,6 +209,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -255,8 +260,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -335,7 +338,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -344,7 +346,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -357,7 +358,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -382,6 +382,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -455,10 +457,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -484,6 +490,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -520,6 +529,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -560,17 +570,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -587,6 +596,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -651,6 +661,7 @@
 	as-python.m4 \
 	as-version.m4 \
 	ax_create_stdint_h.m4 \
+	ax_pthread.m4 \
 	glib-gettext.m4 \
 	gst-arch.m4 \
 	gst-args.m4 \
diff --git a/common/m4/ax_pthread.m4 b/common/m4/ax_pthread.m4
new file mode 100644
index 0000000..d383ad5
--- /dev/null
+++ b/common/m4/ax_pthread.m4
@@ -0,0 +1,332 @@
+# ===========================================================================
+#        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+#   This macro figures out how to build C programs using POSIX threads. It
+#   sets the PTHREAD_LIBS output variable to the threads library and linker
+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+#   flags that are needed. (The user can also force certain compiler
+#   flags/libs to be tested by setting these environment variables.)
+#
+#   Also sets PTHREAD_CC to any special C compiler that is needed for
+#   multi-threaded programs (defaults to the value of CC otherwise). (This
+#   is necessary on AIX to use the special cc_r compiler alias.)
+#
+#   NOTE: You are assumed to not only compile your program with these flags,
+#   but also link it with them as well. e.g. you should link with
+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+#   If you are only building threads programs, you may wish to use these
+#   variables in your default LIBS, CFLAGS, and CC:
+#
+#     LIBS="$PTHREAD_LIBS $LIBS"
+#     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+#     CC="$PTHREAD_CC"
+#
+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+#   Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
+#   PTHREAD_PRIO_INHERIT symbol is defined when compiling with
+#   PTHREAD_CFLAGS.
+#
+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+#   is not found. If ACTION-IF-FOUND is not specified, the default action
+#   will define HAVE_PTHREAD.
+#
+#   Please let the authors know if this macro fails on any platform, or if
+#   you have any other suggestions or comments. This macro was based on work
+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
+#   grateful for the helpful feedback of numerous users.
+#
+#   Updated for Autoconf 2.68 by Daniel Richard G.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+#   Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
+#
+#   This program 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 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 21
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PUSH([C])
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
+        AC_MSG_RESULT([$ax_pthread_ok])
+        if test x"$ax_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case ${host_os} in
+        solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+        ;;
+
+        darwin*)
+        ax_pthread_flags="-pthread $ax_pthread_flags"
+        ;;
+esac
+
+# Clang doesn't consider unrecognized options an error unless we specify
+# -Werror. We throw in some extra Clang-specific options to ensure that
+# this doesn't happen for GCC, which also accepts -Werror.
+
+AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
+save_CFLAGS="$CFLAGS"
+ax_pthread_extra_flags="-Werror"
+CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
+                  [AC_MSG_RESULT([yes])],
+                  [ax_pthread_extra_flags=
+                   AC_MSG_RESULT([no])])
+CFLAGS="$save_CFLAGS"
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+                pthread-config)
+                AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
+                if test x"$ax_pthread_config" = xno; then continue; fi
+                PTHREAD_CFLAGS="`pthread-config --cflags`"
+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+                        static void routine(void *a) { a = 0; }
+                        static void *start_routine(void *a) { return a; }],
+                       [pthread_t th; pthread_attr_t attr;
+                        pthread_create(&th, 0, start_routine, 0);
+                        pthread_join(th, 0);
+                        pthread_attr_init(&attr);
+                        pthread_cleanup_push(routine, 0);
+                        pthread_cleanup_pop(0) /* ; */])],
+                [ax_pthread_ok=yes],
+                [])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT([$ax_pthread_ok])
+        if test "x$ax_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+        AC_MSG_CHECKING([for joinable pthread attribute])
+        attr_name=unknown
+        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+            AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
+                           [int attr = $attr; return attr /* ; */])],
+                [attr_name=$attr; break],
+                [])
+        done
+        AC_MSG_RESULT([$attr_name])
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case ${host_os} in
+            aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
+            osf* | hpux*) flag="-D_REENTRANT";;
+            solaris*)
+            if test "$GCC" = "yes"; then
+                flag="-D_REENTRANT"
+            else
+                # TODO: What about Clang on Solaris?
+                flag="-mt -D_REENTRANT"
+            fi
+            ;;
+        esac
+        AC_MSG_RESULT([$flag])
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
+            [ax_cv_PTHREAD_PRIO_INHERIT], [
+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
+                                                [[int i = PTHREAD_PRIO_INHERIT;]])],
+                    [ax_cv_PTHREAD_PRIO_INHERIT=yes],
+                    [ax_cv_PTHREAD_PRIO_INHERIT=no])
+            ])
+        AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
+            [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: compile with *_r variant
+        if test "x$GCC" != xyes; then
+            case $host_os in
+                aix*)
+                AS_CASE(["x/$CC"],
+                  [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
+                  [#handle absolute path differently from PATH based program lookup
+                   AS_CASE(["x$CC"],
+                     [x/*],
+                     [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
+                     [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
+                ;;
+            esac
+        fi
+fi
+
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
+AC_SUBST([PTHREAD_LIBS])
+AC_SUBST([PTHREAD_CFLAGS])
+AC_SUBST([PTHREAD_CC])
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+        ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
+        :
+else
+        ax_pthread_ok=no
+        $2
+fi
+AC_LANG_POP
+])dnl AX_PTHREAD
diff --git a/common/m4/gst-arch.m4 b/common/m4/gst-arch.m4
index 077a20b..4ad7680 100644
--- a/common/m4/gst-arch.m4
+++ b/common/m4/gst-arch.m4
@@ -45,9 +45,15 @@
     xalpha*)
       HAVE_CPU_ALPHA=yes
       AC_DEFINE(HAVE_CPU_ALPHA, 1, [Define if the target CPU is an Alpha]) ;;
+    xarc*)
+      HAVE_CPU_ARC=yes
+      AC_DEFINE(HAVE_CPU_ARC, 1, [Define if the target CPU is an ARC]) ;;
     xarm*)
       HAVE_CPU_ARM=yes
       AC_DEFINE(HAVE_CPU_ARM, 1, [Define if the target CPU is an ARM]) ;;
+    xaarch64*)
+      HAVE_CPU_AARCH64=yes
+      AC_DEFINE(HAVE_CPU_AARCH64, 1, [Define if the target CPU is AARCH64]) ;;
     xsparc*)
       HAVE_CPU_SPARC=yes
       AC_DEFINE(HAVE_CPU_SPARC, 1, [Define if the target CPU is a SPARC]) ;;
@@ -84,6 +90,7 @@
   AM_CONDITIONAL(HAVE_CPU_PPC,        test "x$HAVE_CPU_PPC" = "xyes")
   AM_CONDITIONAL(HAVE_CPU_PPC64,      test "x$HAVE_CPU_PPC64" = "xyes")
   AM_CONDITIONAL(HAVE_CPU_ALPHA,      test "x$HAVE_CPU_ALPHA" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_ARC,        test "x$HAVE_CPU_ARC" = "xyes")
   AM_CONDITIONAL(HAVE_CPU_ARM,        test "x$HAVE_CPU_ARM" = "xyes")
   AM_CONDITIONAL(HAVE_CPU_SPARC,      test "x$HAVE_CPU_SPARC" = "xyes")
   AM_CONDITIONAL(HAVE_CPU_HPPA,       test "x$HAVE_CPU_HPPA" = "xyes")
@@ -104,7 +111,7 @@
   AC_MSG_CHECKING([if unaligned memory access works correctly])
   if test x"$as_cv_unaligned_access" = x ; then
     case $host in
-      alpha*|arm*|hp*|mips*|sh*|sparc*|ia64*)
+      alpha*|arc*|arm*|aarch64*|hp*|mips*|sh*|sparc*|ia64*)
         _AS_ECHO_N([(blacklisted) ])
         as_cv_unaligned_access=no
 	;;
diff --git a/common/m4/gst-error.m4 b/common/m4/gst-error.m4
index bce80d2..d6487cc 100644
--- a/common/m4/gst-error.m4
+++ b/common/m4/gst-error.m4
@@ -76,14 +76,6 @@
             ])
           done
       ])
-    else
-      dnl Add -fno-strict-aliasing for GLib versions before 2.19.8
-      dnl as before G_LOCK and friends caused strict aliasing compiler
-      dnl warnings.
-      PKG_CHECK_EXISTS([glib-2.0 < 2.19.8], [
-        AS_COMPILER_FLAG(-fno-strict-aliasing,
-            ERROR_CFLAGS="$ERROR_CFLAGS -fno-strict-aliasing")
-	])
     fi
   fi
 
diff --git a/common/m4/gst-parser.m4 b/common/m4/gst-parser.m4
index b002047..382ef72 100644
--- a/common/m4/gst-parser.m4
+++ b/common/m4/gst-parser.m4
@@ -15,7 +15,7 @@
   bison_version=`$BISON_PATH --version | head -n 1 |  sed 's/^[[^0-9]]*//' | sed 's/[[^0-9]]*$//' | cut -d' ' -f1`
   AC_MSG_CHECKING([bison version $bison_version >= $bison_min_version])
 
-  if perl -we "exit ((v$bison_version ge v$bison_min_version) ? 0 : 1)"; then
+  if perl -we "exit (('v$bison_version' ge 'v$bison_min_version') ? 0 : 1)"; then
     AC_MSG_RESULT([yes])
   else
     AC_MSG_ERROR([no])
diff --git a/common/m4/gst-x11.m4 b/common/m4/gst-x11.m4
index d3baf2d..c41ddff 100644
--- a/common/m4/gst-x11.m4
+++ b/common/m4/gst-x11.m4
@@ -9,7 +9,11 @@
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
   dnl now try to find the HEADER
-  AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
+  HAVE_X="no"
+  AC_CHECK_HEADER([X11/Xlib.h], [
+    dnl and then the library with the most uniquitous function
+    AC_CHECK_LIB(X11, [XSync], [HAVE_X="yes"], [], [$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS])
+  ], [], [AC_INCLUDES_DEFAULT])
 
   if test "x$HAVE_X" = "xno"
   then
diff --git a/common/scangobj-merge.py b/common/scangobj-merge.py
index 4a9f1fc..46736b4 100755
--- a/common/scangobj-merge.py
+++ b/common/scangobj-merge.py
@@ -8,8 +8,9 @@
 
 from __future__ import print_function, unicode_literals
 
-import sys
+import codecs
 import os
+import sys
 
 def debug(*args):
     pass
@@ -105,10 +106,12 @@
 class GDoc:
     def load_file(self, filename):
         try:
-            lines = open(filename).readlines()
+            lines = codecs.open(filename, encoding='utf-8').readlines()
             self.load_data("".join(lines))
         except IOError:
             print ("WARNING - could not read from %s" % filename)
+        except UnicodeDecodeError as e:
+            print ("WARNING - could not parse %s: %s" % (filename, e))
 
     def save_file(self, filename, backup=False):
         """
@@ -116,7 +119,7 @@
         """
         olddata = None
         try:
-            lines = open(filename).readlines()
+            lines = codecs.open(filename, encoding='utf-8').readlines()
             olddata = "".join(lines)
         except IOError:
             print ("WARNING - could not read from %s" % filename)
@@ -128,7 +131,7 @@
             if backup:
                 os.rename(filename, filename + '.bak')
 
-        handle = open(filename, "w")
+        handle = codecs.open(filename, "w", encoding='utf-8')
         handle.write(newdata)
         handle.close()
 
diff --git a/config.h.in b/config.h.in
index 47931d7..87312f8 100644
--- a/config.h.in
+++ b/config.h.in
@@ -112,6 +112,15 @@
 /* Define to enable Bluez (used by bluez). */
 #undef HAVE_BLUEZ
 
+/* Old bluez detected */
+#undef HAVE_BLUEZ4
+
+/* Current bluez detected */
+#undef HAVE_BLUEZ5
+
+/* Define to enable bs2b (used by bs2b). */
+#undef HAVE_BS2B
+
 /* Define to enable bz2 library (used by bz2). */
 #undef HAVE_BZ2
 
@@ -126,9 +135,15 @@
 /* Define to enable chromaprint (used by chromaprint). */
 #undef HAVE_CHROMAPRINT
 
+/* Define if the target CPU is AARCH64 */
+#undef HAVE_CPU_AARCH64
+
 /* Define if the target CPU is an Alpha */
 #undef HAVE_CPU_ALPHA
 
+/* Define if the target CPU is an ARC */
+#undef HAVE_CPU_ARC
+
 /* Define if the target CPU is an ARM */
 #undef HAVE_CPU_ARM
 
@@ -190,9 +205,6 @@
 /* Define to enable Direct3D plug-in (used by direct3dsink). */
 #undef HAVE_DIRECT3D
 
-/* Define to enable DirectDraw plug-in (used by directdrawsink). */
-#undef HAVE_DIRECTDRAW
-
 /* Define to enable directfb (used by dfbvideosink ). */
 #undef HAVE_DIRECTFB
 
@@ -205,6 +217,9 @@
 /* define for working do while(0) macros */
 #undef HAVE_DOWHILE_MACROS
 
+/* Define to enable DTLS plugin (used by dtls). */
+#undef HAVE_DTLS
+
 /* Define to enable dts library (used by dtsdec). */
 #undef HAVE_DTS
 
@@ -262,6 +277,12 @@
 /* Define to 1 if the system has the type `GLsizeiptr'. */
 #undef HAVE_GLSIZEIPTR
 
+/* Define to 1 if the system has the type `GLsync'. */
+#undef HAVE_GLSYNC
+
+/* Define to 1 if the system has the type `GLuint64'. */
+#undef HAVE_GLUINT64
+
 /* Define to enable gme decoder (used by gme). */
 #undef HAVE_GME
 
@@ -304,6 +325,9 @@
 /* Define to enable ladspa (used by ladspa). */
 #undef HAVE_LADSPA
 
+/* Define to enable libde265 HEVC/H.265 decoder (used by libde265). */
+#undef HAVE_LIBDE265
+
 /* Define if libgcrypt is available */
 #undef HAVE_LIBGCRYPT
 
@@ -361,9 +385,6 @@
 /* Define to enable musepackdec (used by musepack). */
 #undef HAVE_MUSEPACK
 
-/* Define to enable MythTV client plugins (used by mythtvsrc). */
-#undef HAVE_MYTHTV
-
 /* Define to enable nas plug-in (used by nassink). */
 #undef HAVE_NAS
 
@@ -397,6 +418,9 @@
 /* Define to enable openexr library (used by openexr). */
 #undef HAVE_OPENEXR
 
+/* Define to enable openh264 library (used by openh264). */
+#undef HAVE_OPENH264
+
 /* Define to enable openjpeg library (used by openjpeg). */
 #undef HAVE_OPENJPEG
 
@@ -409,6 +433,9 @@
 /* Define to enable OpenSL ES (used by opensl). */
 #undef HAVE_OPENSLES
 
+/* Define if openssl is available */
+#undef HAVE_OPENSSL
+
 /* Define to enable opus (used by opus). */
 #undef HAVE_OPUS
 
@@ -418,21 +445,21 @@
 /* Apple Mac OS X operating system detected */
 #undef HAVE_OSX
 
-/* Define to enable OSX video (used by osxvideosrc). */
-#undef HAVE_OSX_VIDEO
-
 /* Use libpng */
 #undef HAVE_PNG
 
+/* Define if you have POSIX threads libraries and header files. */
+#undef HAVE_PTHREAD
+
 /* Define to 1 if you have the <pthread.h> header file. */
 #undef HAVE_PTHREAD_H
 
+/* Have PTHREAD_PRIO_INHERIT. */
+#undef HAVE_PTHREAD_PRIO_INHERIT
+
 /* Define to enable pvrvideosink (used by pvr). */
 #undef HAVE_PVR
 
-/* Define to enable QuickTime wrapper (used by qtwrapper). */
-#undef HAVE_QUICKTIME
-
 /* Define if RDTSC is available */
 #undef HAVE_RDTSC
 
@@ -595,6 +622,9 @@
 /* Define if you have X11 library */
 #undef HAVE_X11
 
+/* Define to enable x265 plug-in (used by x265). */
+#undef HAVE_X265
+
 /* Define to enable xvid plugins (used by xvid). */
 #undef HAVE_XVID
 
@@ -647,6 +677,10 @@
 /* directory where plugins are located */
 #undef PLUGINDIR
 
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+#undef PTHREAD_CREATE_JOINABLE
+
 /* The size of `char', as computed by sizeof. */
 #undef SIZEOF_CHAR
 
@@ -692,8 +726,5 @@
 # endif
 #endif
 
-/* Define to 1 if the X Window System is missing or not being used. */
-#undef X_DISPLAY_MISSING
-
 /* We need at least WinXP SP2 for __stat64 */
 #undef __MSVCRT_VERSION__
diff --git a/configure b/configure
index 5b688c6..4e6402f 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GStreamer Bad Plug-ins 1.4.5.
+# Generated by GNU Autoconf 2.69 for GStreamer Bad Plug-ins 1.5.0.1.
 #
 # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer>.
 #
@@ -591,8 +591,8 @@
 # Identity of this package.
 PACKAGE_NAME='GStreamer Bad Plug-ins'
 PACKAGE_TARNAME='gst-plugins-bad'
-PACKAGE_VERSION='1.4.5'
-PACKAGE_STRING='GStreamer Bad Plug-ins 1.4.5'
+PACKAGE_VERSION='1.5.0.1'
+PACKAGE_STRING='GStreamer Bad Plug-ins 1.5.0.1'
 PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer'
 PACKAGE_URL=''
 
@@ -652,10 +652,16 @@
 GST_OPTION_CFLAGS
 DEPRECATED_CFLAGS
 PROFILE_CFLAGS
+USE_X265_FALSE
+USE_X265_TRUE
+X265_LIBS
+X265_CFLAGS
 USE_HLS_FALSE
 USE_HLS_TRUE
 LIBGCRYPT_LIBS
 LIBGCRYPT_CFLAGS
+OPENSSL_LIBS
+OPENSSL_CFLAGS
 LIBGCRYPT_CONFIG
 NETTLE_LIBS
 NETTLE_CFLAGS
@@ -766,6 +772,10 @@
 OPENJPEG_LIBS
 OPENJPEG_CFLAGS
 HAVE_OPENJPEG
+USE_OPENH264_FALSE
+USE_OPENH264_TRUE
+OPENH264_LIBS
+OPENH264_CFLAGS
 USE_OPENEXR_FALSE
 USE_OPENEXR_TRUE
 OPENEXR_LIBS
@@ -792,10 +802,6 @@
 NAS_LIBS
 NAS_CFLAGS
 HAVE_NAS
-USE_MYTHTV_FALSE
-USE_MYTHTV_TRUE
-GMYTH_LIBS
-GMYTH_CFLAGS
 USE_MUSEPACK_FALSE
 USE_MUSEPACK_TRUE
 MUSEPACK_LIBS
@@ -824,14 +830,23 @@
 MODPLUG_CFLAGS
 USE_LINSYS_FALSE
 USE_LINSYS_TRUE
+USE_DTLS_FALSE
+USE_DTLS_TRUE
+DTLS_LIBS
+DTLS_CFLAGS
 USE_SRTP_FALSE
 USE_SRTP_TRUE
 SRTP_LIBS
+SRTP_CFLAGS
 HAVE_SRTP
 USE_LIBMMS_FALSE
 USE_LIBMMS_TRUE
 LIBMMS_LIBS
 LIBMMS_CFLAGS
+USE_LIBDE265_FALSE
+USE_LIBDE265_TRUE
+LIBDE265_LIBS
+LIBDE265_CFLAGS
 USE_LV2_FALSE
 USE_LV2_TRUE
 SLV2_LIBS
@@ -926,6 +941,10 @@
 USE_BZ2_FALSE
 USE_BZ2_TRUE
 BZ2_LIBS
+USE_BS2B_FALSE
+USE_BS2B_TRUE
+BS2B_LIBS
+BS2B_CFLAGS
 USE_APEXSINK_FALSE
 USE_APEXSINK_TRUE
 APEXSINK_LIBS
@@ -959,18 +978,16 @@
 USE_SHM_FALSE
 USE_SHM_TRUE
 SHM_LIBS
-USE_QUICKTIME_FALSE
-USE_QUICKTIME_TRUE
 USE_AVC_FALSE
 USE_AVC_TRUE
-USE_OSX_VIDEO_FALSE
-USE_OSX_VIDEO_TRUE
 USE_BLUEZ_FALSE
 USE_BLUEZ_TRUE
 DBUS_LIBS
 DBUS_CFLAGS
-BLUEZ_LIBS
-BLUEZ_CFLAGS
+BLUEZ5_LIBS
+BLUEZ5_CFLAGS
+BLUEZ4_LIBS
+BLUEZ4_CFLAGS
 USE_APPLE_MEDIA_FALSE
 USE_APPLE_MEDIA_TRUE
 USE_ANDROID_MEDIA_FALSE
@@ -983,10 +1000,6 @@
 USE_WINSCREENCAP_TRUE
 HAVE_WINSCREENCAP
 WINSCREENCAP_LIBS
-USE_DIRECTDRAW_FALSE
-USE_DIRECTDRAW_TRUE
-HAVE_DIRECTDRAW
-DIRECTDRAW_LIBS
 USE_DIRECT3D_FALSE
 USE_DIRECT3D_TRUE
 HAVE_DIRECT3D
@@ -1053,14 +1066,9 @@
 WAYLAND_EGL_CFLAGS
 HAVE_EGL
 HAVE_GLES2
-HAVE_GLU
 HAVE_GL
-HAVE_X
-X_EXTRA_LIBS
 X_LIBS
-X_PRE_LIBS
 X_CFLAGS
-XMKMF
 DCCP_LIBS
 WINSOCK2_LIBS
 HAVE_VIDEOTOOLBOX_FALSE
@@ -1101,10 +1109,10 @@
 USE_PLUGIN_SDP_TRUE
 USE_PLUGIN_SDI_FALSE
 USE_PLUGIN_SDI_TRUE
+USE_PLUGIN_RTP_FALSE
+USE_PLUGIN_RTP_TRUE
 USE_PLUGIN_REMOVESILENCE_FALSE
 USE_PLUGIN_REMOVESILENCE_TRUE
-USE_PLUGIN_REAL_FALSE
-USE_PLUGIN_REAL_TRUE
 USE_PLUGIN_RAWPARSE_FALSE
 USE_PLUGIN_RAWPARSE_TRUE
 USE_PLUGIN_PNM_FALSE
@@ -1113,6 +1121,8 @@
 USE_PLUGIN_PCAPPARSE_TRUE
 USE_PLUGIN_PATCHDETECT_FALSE
 USE_PLUGIN_PATCHDETECT_TRUE
+USE_PLUGIN_ONVIF_FALSE
+USE_PLUGIN_ONVIF_TRUE
 USE_PLUGIN_NUVDEMUX_FALSE
 USE_PLUGIN_NUVDEMUX_TRUE
 USE_PLUGIN_MXF_FALSE
@@ -1324,6 +1334,10 @@
 HAVE_PTHREAD_H_TRUE
 HAVE_UNISTD_H_FALSE
 HAVE_UNISTD_H_TRUE
+PTHREAD_CFLAGS
+PTHREAD_LIBS
+PTHREAD_CC
+ax_pthread_config
 LIBM
 ENABLE_PLUGIN_DOCS_FALSE
 ENABLE_PLUGIN_DOCS_TRUE
@@ -1396,6 +1410,8 @@
 HAVE_CPU_SPARC_TRUE
 HAVE_CPU_ARM_FALSE
 HAVE_CPU_ARM_TRUE
+HAVE_CPU_ARC_FALSE
+HAVE_CPU_ARC_TRUE
 HAVE_CPU_ALPHA_FALSE
 HAVE_CPU_ALPHA_TRUE
 HAVE_CPU_PPC64_FALSE
@@ -1675,12 +1691,13 @@
 enable_mve
 enable_mxf
 enable_nuvdemux
+enable_onvif
 enable_patchdetect
 enable_pcapparse
 enable_pnm
 enable_rawparse
-enable_real
 enable_removesilence
+enable_rtp
 enable_sdi
 enable_sdp
 enable_segmentclip
@@ -1709,20 +1726,16 @@
 enable_x11
 enable_wayland
 enable_dispmanx
-with_x
 with_jpeg_mmx
 enable_directsound
 enable_wasapi
 enable_direct3d
-enable_directdraw
 enable_winscreencap
 enable_winks
 enable_android_media
 enable_apple_media
 enable_bluez
-enable_osx_video
 enable_avc
-enable_quicktime
 enable_shm
 enable_vcd
 enable_opensles
@@ -1731,6 +1744,7 @@
 enable_voamrwbenc
 enable_voaacenc
 enable_apexsink
+enable_bs2b
 enable_bz2
 enable_chromaprint
 enable_curl
@@ -1751,8 +1765,10 @@
 enable_kate
 enable_ladspa
 enable_lv2
+enable_libde265
 enable_libmms
 enable_srtp
+enable_dtls
 enable_linsys
 enable_modplug
 enable_mimic
@@ -1760,13 +1776,13 @@
 enable_mpg123
 enable_mplex
 enable_musepack
-enable_mythtv
 enable_nas
 enable_neon
 enable_ofa
 enable_openal
 enable_opencv
 enable_openexr
+enable_openh264
 enable_openjpeg
 enable_openni2
 enable_opus
@@ -1802,6 +1818,7 @@
 enable_sndio
 enable_hls
 with_libgcrypt_prefix
+enable_x265
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1870,13 +1887,16 @@
 EXIF_LIBS
 ORC_CFLAGS
 ORC_LIBS
-XMKMF
+X_CFLAGS
+X_LIBS
 WAYLAND_EGL_CFLAGS
 WAYLAND_EGL_LIBS
 LIBPNG_CFLAGS
 LIBPNG_LIBS
-BLUEZ_CFLAGS
-BLUEZ_LIBS
+BLUEZ4_CFLAGS
+BLUEZ4_LIBS
+BLUEZ5_CFLAGS
+BLUEZ5_LIBS
 DBUS_CFLAGS
 DBUS_LIBS
 GST_VIDEO_CFLAGS
@@ -1893,6 +1913,8 @@
 VOAACENC_LIBS
 APEXSINK_CFLAGS
 APEXSINK_LIBS
+BS2B_CFLAGS
+BS2B_LIBS
 CHROMAPRINT_CFLAGS
 CHROMAPRINT_LIBS
 CURL_CFLAGS
@@ -1923,8 +1945,14 @@
 LRDF_LIBS
 SLV2_CFLAGS
 SLV2_LIBS
+LIBDE265_CFLAGS
+LIBDE265_LIBS
 LIBMMS_CFLAGS
 LIBMMS_LIBS
+SRTP_CFLAGS
+SRTP_LIBS
+DTLS_CFLAGS
+DTLS_LIBS
 MODPLUG_CFLAGS
 MODPLUG_LIBS
 MIMIC_CFLAGS
@@ -1937,8 +1965,6 @@
 MPG123_LIBS
 MPLEX_CFLAGS
 MPLEX_LIBS
-GMYTH_CFLAGS
-GMYTH_LIBS
 NEON_CFLAGS
 NEON_LIBS
 OFA_CFLAGS
@@ -1949,6 +1975,8 @@
 OPENCV_LIBS
 OPENEXR_CFLAGS
 OPENEXR_LIBS
+OPENH264_CFLAGS
+OPENH264_LIBS
 OPENJPEG_CFLAGS
 OPENJPEG_LIBS
 OPENNI2_CFLAGS
@@ -1986,7 +2014,11 @@
 GSETTINGS_CFLAGS
 GSETTINGS_LIBS
 NETTLE_CFLAGS
-NETTLE_LIBS'
+NETTLE_LIBS
+OPENSSL_CFLAGS
+OPENSSL_LIBS
+X265_CFLAGS
+X265_LIBS'
 
 
 # Initialize some variables set by options.
@@ -2527,7 +2559,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures GStreamer Bad Plug-ins 1.4.5 to adapt to many kinds of systems.
+\`configure' configures GStreamer Bad Plug-ins 1.5.0.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -2589,10 +2621,6 @@
   --program-suffix=SUFFIX            append SUFFIX to installed program names
   --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
 
-X features:
-  --x-includes=DIR    X include files are in DIR
-  --x-libraries=DIR   X library files are in DIR
-
 System types:
   --build=BUILD     configure for building on BUILD [guessed]
   --host=HOST       cross-compile to build programs to run on HOST [BUILD]
@@ -2602,7 +2630,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GStreamer Bad Plug-ins 1.4.5:";;
+     short | recursive ) echo "Configuration of GStreamer Bad Plug-ins 1.5.0.1:";;
    esac
   cat <<\_ACEOF
 
@@ -2694,12 +2722,13 @@
   --disable-mve           disable dependency-less mve plugin
   --disable-mxf           disable dependency-less mxf plugin
   --disable-nuvdemux      disable dependency-less nuvdemux plugin
+  --disable-onvif         disable dependency-less onvif plugin
   --disable-patchdetect   disable dependency-less patchdetect plugin
   --disable-pcapparse     disable dependency-less pcapparse plugin
   --disable-pnm           disable dependency-less pnm plugin
   --disable-rawparse      disable dependency-less rawparse plugin
-  --disable-real          disable dependency-less real plugin
   --disable-removesilence disable dependency-less removesilence plugin
+  --disable-rtp           disable dependency-less rtp plugin
   --disable-sdi           disable dependency-less sdi plugin
   --disable-sdp           disable dependency-less sdp plugin
   --disable-segmentclip   disable dependency-less segmentclip plugin
@@ -2728,15 +2757,12 @@
   --disable-directsound        disable DirectSound: directsoundsrc
   --disable-wasapi             disable WASAPI plug-in: wasapi
   --disable-direct3d           disable Direct3D plug-in: direct3dsink
-  --disable-directdraw         disable DirectDraw plug-in: directdrawsink
   --disable-winscreencap       disable winscreencap plug-in: winscreencap
   --disable-winks              disable Winks plug-in: winks
   --disable-android_media      disable Android Media: androidmedia
   --disable-apple_media        disable Apple video: applemedia
   --disable-bluez              disable Bluez: bluez
-  --disable-osx_video          disable OSX video: osxvideosrc
   --disable-avc                disable AVC Video Services: avcsrc
-  --disable-quicktime          disable QuickTime wrapper: qtwrapper
   --disable-shm                disable POSIX shared memory source and sink: shm
   --disable-vcd                disable Video CD: vcdsrc
   --disable-opensles           disable OpenSL ES: opensl
@@ -2745,6 +2771,7 @@
   --disable-voamrwbenc         disable vo-amrwbenc library: vo-amrwbenc
   --disable-voaacenc           disable vo-aacenc library: vo-aacenc
   --disable-apexsink           disable AirPort Express Wireless sink: apexsink
+  --disable-bs2b               disable bs2b: bs2b
   --disable-bz2                disable bz2 library: bz2
   --disable-chromaprint        disable chromaprint: chromaprint
   --disable-curl               disable Curl plugin: curl
@@ -2766,8 +2793,10 @@
   --disable-kate               disable Kate: kate
   --disable-ladspa             disable ladspa: ladspa
   --disable-lv2                disable lv2: lv2
+  --disable-libde265           disable libde265 HEVC/H.265 decoder: libde265
   --disable-libmms             disable mms protocol library: libmms
   --disable-srtp               disable srtp library: srtp
+  --disable-dtls               disable DTLS plugin: dtls
   --disable-linsys             disable Linear Systems SDI plugin: linsys
   --disable-modplug            disable modplug: modplug
   --disable-mimic              disable libmimic library: mimic
@@ -2775,13 +2804,13 @@
   --disable-mpg123             disable mpg123 audio decoder: mpg123
   --disable-mplex              disable mplex: mplex
   --disable-musepack           disable musepackdec: musepack
-  --disable-mythtv             disable MythTV client plugins: mythtvsrc
   --disable-nas                disable nas plug-in: nassink
   --disable-neon               disable neon http client plugins: neonhttpsrc
   --disable-ofa                disable ofa plugins: ofa
   --disable-openal             disable OpenAL plugin: openal
   --disable-opencv             disable opencv plugins: opencv
   --disable-openexr            disable openexr library: openexr
+  --disable-openh264           disable openh264 library: openh264
   --disable-openjpeg           disable openjpeg library: openjpeg
   --disable-openni2            disable openni2 library: openni2
   --disable-opus               disable opus: opus
@@ -2814,6 +2843,7 @@
                           Disable regeneration of gschemas.compiled on install
   --disable-sndio              disable sndio audio: sndio
   --disable-hls                disable http live streaming plugin: hls
+  --disable-x265               disable x265 plug-in: x265
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -2856,7 +2886,6 @@
   --with-gles2-module-name
                           library module name for GLES2 (default: libGLESv2)
   --with-egl-module-name  library module name for EGL (default: libEGL)
-  --with-x                use the X Window System
   --with-jpeg-mmx, path to MMX'ified JPEG library
   --with-pvr-external-headers
                           Use system installed PVR2D headers
@@ -2964,7 +2993,8 @@
   EXIF_LIBS   linker flags for EXIF, overriding pkg-config
   ORC_CFLAGS  C compiler flags for ORC, overriding pkg-config
   ORC_LIBS    linker flags for ORC, overriding pkg-config
-  XMKMF       Path to xmkmf, Makefile generator for X Window System
+  X_CFLAGS    C compiler flags for X, overriding pkg-config
+  X_LIBS      linker flags for X, overriding pkg-config
   WAYLAND_EGL_CFLAGS
               C compiler flags for WAYLAND_EGL, overriding pkg-config
   WAYLAND_EGL_LIBS
@@ -2972,9 +3002,12 @@
   LIBPNG_CFLAGS
               C compiler flags for LIBPNG, overriding pkg-config
   LIBPNG_LIBS linker flags for LIBPNG, overriding pkg-config
-  BLUEZ_CFLAGS
-              C compiler flags for BLUEZ, overriding pkg-config
-  BLUEZ_LIBS  linker flags for BLUEZ, overriding pkg-config
+  BLUEZ4_CFLAGS
+              C compiler flags for BLUEZ4, overriding pkg-config
+  BLUEZ4_LIBS linker flags for BLUEZ4, overriding pkg-config
+  BLUEZ5_CFLAGS
+              C compiler flags for BLUEZ5, overriding pkg-config
+  BLUEZ5_LIBS linker flags for BLUEZ5, overriding pkg-config
   DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config
   DBUS_LIBS   linker flags for DBUS, overriding pkg-config
   GST_VIDEO_CFLAGS
@@ -3003,6 +3036,8 @@
               C compiler flags for APEXSINK, overriding pkg-config
   APEXSINK_LIBS
               linker flags for APEXSINK, overriding pkg-config
+  BS2B_CFLAGS C compiler flags for BS2B, overriding pkg-config
+  BS2B_LIBS   linker flags for BS2B, overriding pkg-config
   CHROMAPRINT_CFLAGS
               C compiler flags for CHROMAPRINT, overriding pkg-config
   CHROMAPRINT_LIBS
@@ -3048,9 +3083,17 @@
   LRDF_LIBS   linker flags for LRDF, overriding pkg-config
   SLV2_CFLAGS C compiler flags for SLV2, overriding pkg-config
   SLV2_LIBS   linker flags for SLV2, overriding pkg-config
+  LIBDE265_CFLAGS
+              C compiler flags for LIBDE265, overriding pkg-config
+  LIBDE265_LIBS
+              linker flags for LIBDE265, overriding pkg-config
   LIBMMS_CFLAGS
               C compiler flags for LIBMMS, overriding pkg-config
   LIBMMS_LIBS linker flags for LIBMMS, overriding pkg-config
+  SRTP_CFLAGS C compiler flags for SRTP, overriding pkg-config
+  SRTP_LIBS   linker flags for SRTP, overriding pkg-config
+  DTLS_CFLAGS C compiler flags for DTLS, overriding pkg-config
+  DTLS_LIBS   linker flags for DTLS, overriding pkg-config
   MODPLUG_CFLAGS
               C compiler flags for MODPLUG, overriding pkg-config
   MODPLUG_LIBS
@@ -3071,9 +3114,6 @@
   MPLEX_CFLAGS
               C compiler flags for MPLEX, overriding pkg-config
   MPLEX_LIBS  linker flags for MPLEX, overriding pkg-config
-  GMYTH_CFLAGS
-              C compiler flags for GMYTH, overriding pkg-config
-  GMYTH_LIBS  linker flags for GMYTH, overriding pkg-config
   NEON_CFLAGS C compiler flags for NEON, overriding pkg-config
   NEON_LIBS   linker flags for NEON, overriding pkg-config
   OFA_CFLAGS  C compiler flags for OFA, overriding pkg-config
@@ -3088,6 +3128,10 @@
               C compiler flags for OPENEXR, overriding pkg-config
   OPENEXR_LIBS
               linker flags for OPENEXR, overriding pkg-config
+  OPENH264_CFLAGS
+              C compiler flags for OPENH264, overriding pkg-config
+  OPENH264_LIBS
+              linker flags for OPENH264, overriding pkg-config
   OPENJPEG_CFLAGS
               C compiler flags for OPENJPEG, overriding pkg-config
   OPENJPEG_LIBS
@@ -3149,6 +3193,12 @@
   NETTLE_CFLAGS
               C compiler flags for NETTLE, overriding pkg-config
   NETTLE_LIBS linker flags for NETTLE, overriding pkg-config
+  OPENSSL_CFLAGS
+              C compiler flags for OPENSSL, overriding pkg-config
+  OPENSSL_LIBS
+              linker flags for OPENSSL, overriding pkg-config
+  X265_CFLAGS C compiler flags for X265, overriding pkg-config
+  X265_LIBS   linker flags for X265, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -3216,7 +3266,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GStreamer Bad Plug-ins configure 1.4.5
+GStreamer Bad Plug-ins configure 1.5.0.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -4189,7 +4239,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by GStreamer Bad Plug-ins $as_me 1.4.5, which was
+It was created by GStreamer Bad Plug-ins $as_me 1.5.0.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -5171,7 +5221,7 @@
 
 # Define the identity of the package.
  PACKAGE='gst-plugins-bad'
- VERSION='1.4.5'
+ VERSION='1.5.0.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5382,9 +5432,9 @@
 
 
 
-  PACKAGE_VERSION_MAJOR=$(echo 1.4.5 | cut -d'.' -f1)
-  PACKAGE_VERSION_MINOR=$(echo 1.4.5 | cut -d'.' -f2)
-  PACKAGE_VERSION_MICRO=$(echo 1.4.5 | cut -d'.' -f3)
+  PACKAGE_VERSION_MAJOR=$(echo 1.5.0.1 | cut -d'.' -f1)
+  PACKAGE_VERSION_MINOR=$(echo 1.5.0.1 | cut -d'.' -f2)
+  PACKAGE_VERSION_MICRO=$(echo 1.5.0.1 | cut -d'.' -f3)
 
 
 
@@ -5395,7 +5445,7 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking nano version" >&5
 $as_echo_n "checking nano version... " >&6; }
 
-  NANO=$(echo 1.4.5 | cut -d'.' -f4)
+  NANO=$(echo 1.5.0.1 | cut -d'.' -f4)
 
   if test x"$NANO" = x || test "x$NANO" = "x0" ; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: 0 (release)" >&5
@@ -10052,10 +10102,10 @@
 done
 
 
-  GST_CURRENT=405
+  GST_CURRENT=501
   GST_REVISION=0
-  GST_AGE=405
-  GST_LIBVERSION=405:0:405
+  GST_AGE=501
+  GST_LIBVERSION=501:0:501
 
 
 
@@ -14380,8 +14430,8 @@
 
 
 
-GST_REQ=1.4.0
-GSTPB_REQ=1.4.0
+GST_REQ=1.5.0.1
+GSTPB_REQ=1.5.0.1
 
 
 
@@ -17295,11 +17345,21 @@
 
 $as_echo "#define HAVE_CPU_ALPHA 1" >>confdefs.h
  ;;
+    xarc*)
+      HAVE_CPU_ARC=yes
+
+$as_echo "#define HAVE_CPU_ARC 1" >>confdefs.h
+ ;;
     xarm*)
       HAVE_CPU_ARM=yes
 
 $as_echo "#define HAVE_CPU_ARM 1" >>confdefs.h
  ;;
+    xaarch64*)
+      HAVE_CPU_AARCH64=yes
+
+$as_echo "#define HAVE_CPU_AARCH64 1" >>confdefs.h
+ ;;
     xsparc*)
       HAVE_CPU_SPARC=yes
 
@@ -17604,6 +17664,14 @@
   HAVE_CPU_ALPHA_FALSE=
 fi
 
+   if test "x$HAVE_CPU_ARC" = "xyes"; then
+  HAVE_CPU_ARC_TRUE=
+  HAVE_CPU_ARC_FALSE='#'
+else
+  HAVE_CPU_ARC_TRUE='#'
+  HAVE_CPU_ARC_FALSE=
+fi
+
    if test "x$HAVE_CPU_ARM" = "xyes"; then
   HAVE_CPU_ARM_TRUE=
   HAVE_CPU_ARM_FALSE='#'
@@ -24087,6 +24155,449 @@
 
 
 
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
+$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; }
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_join ();
+int
+main ()
+{
+return pthread_join ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_pthread_ok=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+$as_echo "$ax_pthread_ok" >&6; }
+        if test x"$ax_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case ${host_os} in
+        solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+        ;;
+
+        darwin*)
+        ax_pthread_flags="-pthread $ax_pthread_flags"
+        ;;
+esac
+
+# Clang doesn't consider unrecognized options an error unless we specify
+# -Werror. We throw in some extra Clang-specific options to ensure that
+# this doesn't happen for GCC, which also accepts -Werror.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler needs -Werror to reject unknown flags" >&5
+$as_echo_n "checking if compiler needs -Werror to reject unknown flags... " >&6; }
+save_CFLAGS="$CFLAGS"
+ax_pthread_extra_flags="-Werror"
+CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo(void);
+int
+main ()
+{
+foo()
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  ax_pthread_extra_flags=
+                   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+        case $flag in
+                none)
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
+$as_echo_n "checking whether pthreads work without any flags... " >&6; }
+                ;;
+
+                -*)
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5
+$as_echo_n "checking whether pthreads work with $flag... " >&6; }
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+                pthread-config)
+                # Extract the first word of "pthread-config", so it can be a program name with args.
+set dummy pthread-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ax_pthread_config+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ax_pthread_config"; then
+  ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ax_pthread_config="yes"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no"
+fi
+fi
+ax_pthread_config=$ac_cv_prog_ax_pthread_config
+if test -n "$ax_pthread_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5
+$as_echo "$ax_pthread_config" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+                if test x"$ax_pthread_config" = xno; then continue; fi
+                PTHREAD_CFLAGS="`pthread-config --cflags`"
+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
+
+                *)
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5
+$as_echo_n "checking for the pthreads library -l$flag... " >&6; }
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+                        static void routine(void *a) { a = 0; }
+                        static void *start_routine(void *a) { return a; }
+int
+main ()
+{
+pthread_t th; pthread_attr_t attr;
+                        pthread_create(&th, 0, start_routine, 0);
+                        pthread_join(th, 0);
+                        pthread_attr_init(&attr);
+                        pthread_cleanup_push(routine, 0);
+                        pthread_cleanup_pop(0) /* ; */
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_pthread_ok=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+$as_echo "$ax_pthread_ok" >&6; }
+        if test "x$ax_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
+$as_echo_n "checking for joinable pthread attribute... " >&6; }
+        attr_name=unknown
+        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+int attr = $attr; return attr /* ; */
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  attr_name=$attr; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        done
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5
+$as_echo "$attr_name" >&6; }
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+
+cat >>confdefs.h <<_ACEOF
+#define PTHREAD_CREATE_JOINABLE $attr_name
+_ACEOF
+
+        fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
+$as_echo_n "checking if more special flags are required for pthreads... " >&6; }
+        flag=no
+        case ${host_os} in
+            aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
+            osf* | hpux*) flag="-D_REENTRANT";;
+            solaris*)
+            if test "$GCC" = "yes"; then
+                flag="-D_REENTRANT"
+            else
+                # TODO: What about Clang on Solaris?
+                flag="-mt -D_REENTRANT"
+            fi
+            ;;
+        esac
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag" >&5
+$as_echo "$flag" >&6; }
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5
+$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; }
+if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+int i = PTHREAD_PRIO_INHERIT;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_cv_PTHREAD_PRIO_INHERIT=yes
+else
+  ax_cv_PTHREAD_PRIO_INHERIT=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5
+$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; }
+        if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then :
+
+$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h
+
+fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: compile with *_r variant
+        if test "x$GCC" != xyes; then
+            case $host_os in
+                aix*)
+                case "x/$CC" in #(
+  x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) :
+    #handle absolute path differently from PATH based program lookup
+                   case "x$CC" in #(
+  x/*) :
+    if as_fn_executable_p ${CC}_r; then :
+  PTHREAD_CC="${CC}_r"
+fi ;; #(
+  *) :
+    for ac_prog in ${CC}_r
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PTHREAD_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PTHREAD_CC"; then
+  ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_PTHREAD_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
+if test -n "$PTHREAD_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5
+$as_echo "$PTHREAD_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$PTHREAD_CC" && break
+done
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+ ;;
+esac ;; #(
+  *) :
+     ;;
+esac
+                ;;
+            esac
+        fi
+fi
+
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
+
+
+
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+
+$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
+
+        :
+else
+        ax_pthread_ok=no
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
 for ac_header in unistd.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
@@ -27856,52 +28367,6 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5
 $as_echo "$flag_ok" >&6; }
 
-    else
-                        if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 < 2.19.8\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "glib-2.0 < 2.19.8") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -fno-strict-aliasing" >&5
-$as_echo_n "checking to see if compiler understands -fno-strict-aliasing... " >&6; }
-
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -fno-strict-aliasing"
-
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  flag_ok=yes
-else
-  flag_ok=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CFLAGS="$save_CFLAGS"
-
-  if test "X$flag_ok" = Xyes ; then
-    ERROR_CFLAGS="$ERROR_CFLAGS -fno-strict-aliasing"
-    true
-  else
-
-    true
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5
-$as_echo "$flag_ok" >&6; }
-
-
-fi
     fi
   fi
 
@@ -29049,16 +29514,16 @@
 GST_PLUGINS_NONPORTED=" cdxaparse \
  dccp faceoverlay \
  hdvparse \
- mve mythtv nuvdemux \
- patchdetect real \
+ mve nuvdemux \
+ patchdetect \
  sdi tta \
  videomeasure \
- linsys vcd \
+ linsys \
  apexsink dc1394 \
  gsettings \
  musepack nas sdl timidity \
- directdraw acm wininet \
- xvid lv2 teletextdec sndio osx_video quicktime libvisual"
+ acm wininet \
+ xvid lv2 teletextdec sndio libvisual"
 
 
 
@@ -30997,6 +31462,49 @@
 
 
 
+  GST_PLUGINS_ALL="$GST_PLUGINS_ALL onvif"
+
+
+
+  # Check whether --enable-onvif was given.
+if test "${enable_onvif+set}" = set; then :
+  enableval=$enable_onvif;
+      case "${enableval}" in
+        yes) gst_use_onvif=yes ;;
+        no) gst_use_onvif=no ;;
+        *) as_fn_error $? "bad value ${enableval} for --enable-onvif" "$LINENO" 5 ;;
+       esac
+
+else
+  gst_use_onvif=yes
+fi
+
+  if test x$gst_use_onvif = xno; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: disabling dependency-less plugin onvif" >&5
+$as_echo "$as_me: disabling dependency-less plugin onvif" >&6;}
+    WITHOUT_PLUGINS="$WITHOUT_PLUGINS onvif"
+  fi
+
+
+    if [ -z "$WITH_PLUGINS" ] || echo " $WITH_PLUGINS " | tr , ' ' | grep -i " onvif " > /dev/null; then
+    GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED onvif"
+  fi
+    if echo " $WITHOUT_PLUGINS " | tr , ' ' | grep -i " onvif " > /dev/null; then
+    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ onvif / /'`
+  fi
+    if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " onvif " > /dev/null; then
+    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ onvif / /'`
+  fi
+   if echo " $GST_PLUGINS_SELECTED " | grep -i " onvif " > /dev/null; then
+  USE_PLUGIN_ONVIF_TRUE=
+  USE_PLUGIN_ONVIF_FALSE='#'
+else
+  USE_PLUGIN_ONVIF_TRUE='#'
+  USE_PLUGIN_ONVIF_FALSE=
+fi
+
+
+
   GST_PLUGINS_ALL="$GST_PLUGINS_ALL patchdetect"
 
 
@@ -31169,49 +31677,6 @@
 
 
 
-  GST_PLUGINS_ALL="$GST_PLUGINS_ALL real"
-
-
-
-  # Check whether --enable-real was given.
-if test "${enable_real+set}" = set; then :
-  enableval=$enable_real;
-      case "${enableval}" in
-        yes) gst_use_real=yes ;;
-        no) gst_use_real=no ;;
-        *) as_fn_error $? "bad value ${enableval} for --enable-real" "$LINENO" 5 ;;
-       esac
-
-else
-  gst_use_real=yes
-fi
-
-  if test x$gst_use_real = xno; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: disabling dependency-less plugin real" >&5
-$as_echo "$as_me: disabling dependency-less plugin real" >&6;}
-    WITHOUT_PLUGINS="$WITHOUT_PLUGINS real"
-  fi
-
-
-    if [ -z "$WITH_PLUGINS" ] || echo " $WITH_PLUGINS " | tr , ' ' | grep -i " real " > /dev/null; then
-    GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED real"
-  fi
-    if echo " $WITHOUT_PLUGINS " | tr , ' ' | grep -i " real " > /dev/null; then
-    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ real / /'`
-  fi
-    if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " real " > /dev/null; then
-    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ real / /'`
-  fi
-   if echo " $GST_PLUGINS_SELECTED " | grep -i " real " > /dev/null; then
-  USE_PLUGIN_REAL_TRUE=
-  USE_PLUGIN_REAL_FALSE='#'
-else
-  USE_PLUGIN_REAL_TRUE='#'
-  USE_PLUGIN_REAL_FALSE=
-fi
-
-
-
   GST_PLUGINS_ALL="$GST_PLUGINS_ALL removesilence"
 
 
@@ -31255,6 +31720,49 @@
 
 
 
+  GST_PLUGINS_ALL="$GST_PLUGINS_ALL rtp"
+
+
+
+  # Check whether --enable-rtp was given.
+if test "${enable_rtp+set}" = set; then :
+  enableval=$enable_rtp;
+      case "${enableval}" in
+        yes) gst_use_rtp=yes ;;
+        no) gst_use_rtp=no ;;
+        *) as_fn_error $? "bad value ${enableval} for --enable-rtp" "$LINENO" 5 ;;
+       esac
+
+else
+  gst_use_rtp=yes
+fi
+
+  if test x$gst_use_rtp = xno; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: disabling dependency-less plugin rtp" >&5
+$as_echo "$as_me: disabling dependency-less plugin rtp" >&6;}
+    WITHOUT_PLUGINS="$WITHOUT_PLUGINS rtp"
+  fi
+
+
+    if [ -z "$WITH_PLUGINS" ] || echo " $WITH_PLUGINS " | tr , ' ' | grep -i " rtp " > /dev/null; then
+    GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED rtp"
+  fi
+    if echo " $WITHOUT_PLUGINS " | tr , ' ' | grep -i " rtp " > /dev/null; then
+    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ rtp / /'`
+  fi
+    if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " rtp " > /dev/null; then
+    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ rtp / /'`
+  fi
+   if echo " $GST_PLUGINS_SELECTED " | grep -i " rtp " > /dev/null; then
+  USE_PLUGIN_RTP_TRUE=
+  USE_PLUGIN_RTP_FALSE='#'
+else
+  USE_PLUGIN_RTP_TRUE='#'
+  USE_PLUGIN_RTP_FALSE=
+fi
+
+
+
   GST_PLUGINS_ALL="$GST_PLUGINS_ALL sdi"
 
 
@@ -31944,22 +32452,6 @@
 
 
 
-if test "x$HAVE_CPU_I386" != "xyes" && test "x$HAVE_CPU_X86_64" != "xyes"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not building real plugin, only works on 32bit and 64bit x86 platforms" >&5
-$as_echo "$as_me: WARNING: Not building real plugin, only works on 32bit and 64bit x86 platforms" >&2;}
-
-  GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ real / /'`
-   if false; then
-  USE_PLUGIN_REAL_TRUE=
-  USE_PLUGIN_REAL_FALSE='#'
-else
-  USE_PLUGIN_REAL_TRUE='#'
-  USE_PLUGIN_REAL_FALSE=
-fi
-
-
-fi
-
 ac_fn_c_check_header_preproc "$LINENO" "AVFoundation/AVFoundation.h" "ac_cv_header_AVFoundation_AVFoundation_h"
 if test "x$ac_cv_header_AVFoundation_AVFoundation_h" = xyes; then :
   HAVE_AVFOUNDATION="yes"
@@ -32073,7 +32565,7 @@
 fi
 
 if test "x$HAVE_PTHREAD_H" = "xyes"; then
-  DCCP_LIBS="$DCCP_LIBS -lpthread"
+  DCCP_LIBS="$DCCP_LIBS $PTHREAD_LIBS"
 
 else
 
@@ -32248,725 +32740,106 @@
 fi
 
 
+
+  which="x11"
+    required="no"
+
+
+pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
 $as_echo_n "checking for X... " >&6; }
 
-
-# Check whether --with-x was given.
-if test "${with_x+set}" = set; then :
-  withval=$with_x;
+if test -n "$PKG_CONFIG"; then
+    if test -n "$X_CFLAGS"; then
+        pkg_cv_X_CFLAGS="$X_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$which\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "$which") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_X_CFLAGS=`$PKG_CONFIG --cflags "$which" 2>/dev/null`
+else
+  pkg_failed=yes
 fi
-
-# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
-if test "x$with_x" = xno; then
-  # The user explicitly disabled X.
-  have_x=disabled
-else
-  case $x_includes,$x_libraries in #(
-    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
-    *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  # One or both of the vars are not set, and there is no cached value.
-ac_x_includes=no ac_x_libraries=no
-rm -f -r conftest.dir
-if mkdir conftest.dir; then
-  cd conftest.dir
-  cat >Imakefile <<'_ACEOF'
-incroot:
-	@echo incroot='${INCROOT}'
-usrlibdir:
-	@echo usrlibdir='${USRLIBDIR}'
-libdir:
-	@echo libdir='${LIBDIR}'
-_ACEOF
-  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
-    # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
-    for ac_var in incroot usrlibdir libdir; do
-      eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
-    done
-    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
-    for ac_extension in a so sl dylib la dll; do
-      if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
-	 test -f "$ac_im_libdir/libX11.$ac_extension"; then
-	ac_im_usrlibdir=$ac_im_libdir; break
-      fi
-    done
-    # Screen out bogus values from the imake configuration.  They are
-    # bogus both because they are the default anyway, and because
-    # using them would break gcc on systems where it needs fixed includes.
-    case $ac_im_incroot in
-	/usr/include) ac_x_includes= ;;
-	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
-    esac
-    case $ac_im_usrlibdir in
-	/usr/lib | /usr/lib64 | /lib | /lib64) ;;
-	*) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
-    esac
-  fi
-  cd ..
-  rm -f -r conftest.dir
-fi
-
-# Standard set of common directories for X headers.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-ac_x_header_dirs='
-/usr/X11/include
-/usr/X11R7/include
-/usr/X11R6/include
-/usr/X11R5/include
-/usr/X11R4/include
-
-/usr/include/X11
-/usr/include/X11R7
-/usr/include/X11R6
-/usr/include/X11R5
-/usr/include/X11R4
-
-/usr/local/X11/include
-/usr/local/X11R7/include
-/usr/local/X11R6/include
-/usr/local/X11R5/include
-/usr/local/X11R4/include
-
-/usr/local/include/X11
-/usr/local/include/X11R7
-/usr/local/include/X11R6
-/usr/local/include/X11R5
-/usr/local/include/X11R4
-
-/usr/X386/include
-/usr/x386/include
-/usr/XFree86/include/X11
-
-/usr/include
-/usr/local/include
-/usr/unsupported/include
-/usr/athena/include
-/usr/local/x11r5/include
-/usr/lpp/Xamples/include
-
-/usr/openwin/include
-/usr/openwin/share/include'
-
-if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for Xlib.h.
-  # First, try using that file with no special directory specified.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # We can compile using X headers with no special include directory.
-ac_x_includes=
-else
-  for ac_dir in $ac_x_header_dirs; do
-  if test -r "$ac_dir/X11/Xlib.h"; then
-    ac_x_includes=$ac_dir
-    break
-  fi
-done
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-fi # $ac_x_includes = no
-
-if test "$ac_x_libraries" = no; then
-  # Check for the libraries.
-  # See if we find them without any special options.
-  # Don't add to $LIBS permanently.
-  ac_save_LIBS=$LIBS
-  LIBS="-lX11 $LIBS"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-int
-main ()
-{
-XrmInitialize ()
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  LIBS=$ac_save_LIBS
-# We can link X programs with no special library path.
-ac_x_libraries=
-else
-  LIBS=$ac_save_LIBS
-for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
-do
-  # Don't even attempt the hair of trying to link an X program!
-  for ac_extension in a so sl dylib la dll; do
-    if test -r "$ac_dir/libX11.$ac_extension"; then
-      ac_x_libraries=$ac_dir
-      break 2
     fi
-  done
-done
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi # $ac_x_libraries = no
-
-case $ac_x_includes,$ac_x_libraries in #(
-  no,* | *,no | *\'*)
-    # Didn't find X, or a directory has "'" in its name.
-    ac_cv_have_x="have_x=no";; #(
-  *)
-    # Record where we found X for the cache.
-    ac_cv_have_x="have_x=yes\
-	ac_x_includes='$ac_x_includes'\
-	ac_x_libraries='$ac_x_libraries'"
-esac
-fi
-;; #(
-    *) have_x=yes;;
-  esac
-  eval "$ac_cv_have_x"
-fi # $with_x != no
-
-if test "$have_x" != yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5
-$as_echo "$have_x" >&6; }
-  no_x=yes
 else
-  # If each of the values was on the command line, it overrides each guess.
-  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
-  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
-  # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes\
-	ac_x_includes='$x_includes'\
-	ac_x_libraries='$x_libraries'"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5
-$as_echo "libraries $x_libraries, headers $x_includes" >&6; }
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$X_LIBS"; then
+        pkg_cv_X_LIBS="$X_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$which\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "$which") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_X_LIBS=`$PKG_CONFIG --libs "$which" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
 fi
 
 
-  if test "$no_x" = yes; then
-  # Not all programs may use this symbol, but it does not hurt to define it.
 
-$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h
+if test $pkg_failed = yes; then
 
-  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
 else
-  if test -n "$x_includes"; then
-    X_CFLAGS="$X_CFLAGS -I$x_includes"
-  fi
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        X_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$which"`
+        else
+	        X_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$which"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$X_PKG_ERRORS" >&5
 
-  # It would also be nice to do this for all -L options, not just this one.
-  if test -n "$x_libraries"; then
-    X_LIBS="$X_LIBS -L$x_libraries"
-    # For Solaris; some versions of Sun CC require a space after -R and
-    # others require no space.  Words are not sufficient . . . .
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5
-$as_echo_n "checking whether -R must be followed by a space... " >&6; }
-    ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
-    ac_xsave_c_werror_flag=$ac_c_werror_flag
-    ac_c_werror_flag=yes
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-       X_LIBS="$X_LIBS -R$x_libraries"
-else
-  LIBS="$ac_xsave_LIBS -R $x_libraries"
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	  X_LIBS="$X_LIBS -R $x_libraries"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5
-$as_echo "neither works" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    ac_c_werror_flag=$ac_xsave_c_werror_flag
-    LIBS=$ac_xsave_LIBS
-  fi
-
-  # Check for system-dependent libraries X programs must link with.
-  # Do this before checking for the system-independent R6 libraries
-  # (-lICE), since we may need -lsocket or whatever for X linking.
-
-  if test "$ISC" = yes; then
-    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
-  else
-    # Martyn Johnson says this is needed for Ultrix, if the X
-    # libraries were built with DECnet support.  And Karl Berry says
-    # the Alpha needs dnet_stub (dnet does not exist).
-    ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char XOpenDisplay ();
-int
-main ()
-{
-return XOpenDisplay ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
-$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
-if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldnet  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dnet_ntoa ();
-int
-main ()
-{
-return dnet_ntoa ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dnet_dnet_ntoa=yes
-else
-  ac_cv_lib_dnet_dnet_ntoa=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
-$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
-fi
-
-    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5
-$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; }
-if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldnet_stub  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dnet_ntoa ();
-int
-main ()
-{
-return dnet_ntoa ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dnet_stub_dnet_ntoa=yes
-else
-  ac_cv_lib_dnet_stub_dnet_ntoa=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
-$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
-fi
-
-    fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    LIBS="$ac_xsave_LIBS"
-
-    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
-    # to get the SysV transport functions.
-    # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
-    # needs -lnsl.
-    # The nsl library prevents programs from opening the X display
-    # on Irix 5.2, according to T.E. Dickey.
-    # The functions gethostbyname, getservbyname, and inet_addr are
-    # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
-    ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
-if test "x$ac_cv_func_gethostbyname" = xyes; then :
-
-fi
-
-    if test $ac_cv_func_gethostbyname = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
-$as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
-if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_nsl_gethostbyname=yes
-else
-  ac_cv_lib_nsl_gethostbyname=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
-$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
-if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
-fi
-
-      if test $ac_cv_lib_nsl_gethostbyname = no; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5
-$as_echo_n "checking for gethostbyname in -lbsd... " >&6; }
-if ${ac_cv_lib_bsd_gethostbyname+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbsd  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_bsd_gethostbyname=yes
-else
-  ac_cv_lib_bsd_gethostbyname=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5
-$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; }
-if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
-fi
-
+      HAVE_X="no"
+      if test "x$required" = "xyes"; then
+        as_fn_error $? "$X_PKG_ERRORS" "$LINENO" 5
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: $X_PKG_ERRORS" >&5
+$as_echo "$as_me: $X_PKG_ERRORS" >&6;}
       fi
-    fi
 
-    # lieder@skyler.mavd.honeywell.com says without -lsocket,
-    # socket/setsockopt and other routines are undefined under SCO ODT
-    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
-    # on later versions), says Simon Leinen: it contains gethostby*
-    # variants that don't use the name server (or something).  -lsocket
-    # must be given before -lnsl if both are needed.  We assume that
-    # if connect needs -lnsl, so does gethostbyname.
-    ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
-if test "x$ac_cv_func_connect" = xyes; then :
+elif test $pkg_failed = untried; then
 
-fi
+      HAVE_X="no"
+      if test "x$required" = "xyes"; then
+        as_fn_error $? "$X_PKG_ERRORS" "$LINENO" 5
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: $X_PKG_ERRORS" >&5
+$as_echo "$as_me: $X_PKG_ERRORS" >&6;}
+      fi
 
-    if test $ac_cv_func_connect = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
-$as_echo_n "checking for connect in -lsocket... " >&6; }
-if ${ac_cv_lib_socket_connect+:} false; then :
-  $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+	X_CFLAGS=$pkg_cv_X_CFLAGS
+	X_LIBS=$pkg_cv_X_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char connect ();
-int
-main ()
-{
-return connect ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_socket_connect=yes
-else
-  ac_cv_lib_socket_connect=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
-$as_echo "$ac_cv_lib_socket_connect" >&6; }
-if test "x$ac_cv_lib_socket_connect" = xyes; then :
-  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
-fi
-
-    fi
-
-    # Guillermo Gomez says -lposix is necessary on A/UX.
-    ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove"
-if test "x$ac_cv_func_remove" = xyes; then :
+      HAVE_X="yes"
 
 fi
 
-    if test $ac_cv_func_remove = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5
-$as_echo_n "checking for remove in -lposix... " >&6; }
-if ${ac_cv_lib_posix_remove+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lposix  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char remove ();
-int
-main ()
-{
-return remove ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_posix_remove=yes
-else
-  ac_cv_lib_posix_remove=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5
-$as_echo "$ac_cv_lib_posix_remove" >&6; }
-if test "x$ac_cv_lib_posix_remove" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
-fi
-
-    fi
-
-    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-    ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
-if test "x$ac_cv_func_shmat" = xyes; then :
-
-fi
-
-    if test $ac_cv_func_shmat = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5
-$as_echo_n "checking for shmat in -lipc... " >&6; }
-if ${ac_cv_lib_ipc_shmat+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lipc  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shmat ();
-int
-main ()
-{
-return shmat ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ipc_shmat=yes
-else
-  ac_cv_lib_ipc_shmat=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5
-$as_echo "$ac_cv_lib_ipc_shmat" >&6; }
-if test "x$ac_cv_lib_ipc_shmat" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
-fi
-
-    fi
-  fi
-
-  # Check for libraries that X11R6 Xt/Xaw programs need.
-  ac_save_LDFLAGS=$LDFLAGS
-  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
-  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
-  # check for ICE first), but we must link in the order -lSM -lICE or
-  # we get undefined symbols.  So assume we have SM if we have ICE.
-  # These have to be linked with before -lX11, unlike the other
-  # libraries we check for below, so use a different variable.
-  # John Interrante, Karl Berry
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5
-$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; }
-if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lICE $X_EXTRA_LIBS $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char IceConnectionNumber ();
-int
-main ()
-{
-return IceConnectionNumber ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ICE_IceConnectionNumber=yes
-else
-  ac_cv_lib_ICE_IceConnectionNumber=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
-$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
-if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then :
-  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
-fi
-
-  LDFLAGS=$ac_save_LDFLAGS
-
-fi
-
-  ac_cflags_save="$CFLAGS"
-  ac_cppflags_save="$CPPFLAGS"
-  CFLAGS="$CFLAGS $X_CFLAGS"
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-    ac_fn_c_check_header_mongrel "$LINENO" "X11/Xlib.h" "ac_cv_header_X11_Xlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_X11_Xlib_h" = xyes; then :
-  HAVE_X="yes"
-else
-  HAVE_X="no"
-fi
-
-
-
-  if test "x$HAVE_X" = "xno"
-  then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: cannot find X11 development files" >&5
-$as_echo "$as_me: cannot find X11 development files" >&6;}
-  else
-        X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
-            X_LIBS="$X_LIBS -lX11"
-
-
-  fi
-
-
-  CFLAGS="$ac_cflags_save"
-  CPPFLAGS="$ac_cppflags_save"
 
 save_CPPFLAGS="$CPPFLAGS"
 save_LIBS="$LIBS"
 
 HAVE_GL=no
 HAVE_GLES2=no
-HAVE_GLU=no
 HAVE_WAYLAND_EGL=no
 
 HAVE_EGL_RPI=no
@@ -33037,69 +32910,6 @@
 
 
 
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluSphere in -lglu32" >&5
-$as_echo_n "checking for gluSphere in -lglu32... " >&6; }
-if ${ac_cv_lib_glu32_gluSphere+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lglu32  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gluSphere ();
-int
-main ()
-{
-return gluSphere ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_glu32_gluSphere=yes
-else
-  ac_cv_lib_glu32_gluSphere=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_glu32_gluSphere" >&5
-$as_echo "$ac_cv_lib_glu32_gluSphere" >&6; }
-if test "x$ac_cv_lib_glu32_gluSphere" = xyes; then :
-  HAVE_GLU=yes
-else
-  HAVE_GLU=no
-fi
-
-  if test "x$HAVE_GLU" = "xyes"; then
-    ac_fn_c_check_header_mongrel "$LINENO" "GL/glu.h" "ac_cv_header_GL_glu_h" "$ac_includes_default"
-if test "x$ac_cv_header_GL_glu_h" = xyes; then :
-  :
-else
-  HAVE_GLU=no
-fi
-
-
-    if test "x$HAVE_GLU" = "xyes"; then
-            :
-    else
-      :
-    fi
-  else
-    :
-  fi
-
-
-
     ac_fn_c_check_header_compile "$LINENO" "GL/wglext.h" "ac_cv_header_GL_wglext_h" "#include <GL/gl.h>
 "
 if test "x$ac_cv_header_GL_wglext_h" = xyes; then :
@@ -33112,10 +32922,10 @@
     if test "x$HAVE_WGLEXT" = "xyes"; then
       HAVE_WGL=yes
       HAVE_GL=yes
-      HAVE_GLU=yes
     fi
   ;;
   *)
+    if test "x$NEED_GL" != "xno"; then
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glTexImage2D in -lGL" >&5
 $as_echo_n "checking for glTexImage2D in -lGL... " >&6; }
@@ -33179,69 +32989,8 @@
 
 
 
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluSphere in -lGLU" >&5
-$as_echo_n "checking for gluSphere in -lGLU... " >&6; }
-if ${ac_cv_lib_GLU_gluSphere+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lGLU  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gluSphere ();
-int
-main ()
-{
-return gluSphere ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_GLU_gluSphere=yes
-else
-  ac_cv_lib_GLU_gluSphere=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLU_gluSphere" >&5
-$as_echo "$ac_cv_lib_GLU_gluSphere" >&6; }
-if test "x$ac_cv_lib_GLU_gluSphere" = xyes; then :
-  HAVE_GLU=yes
-else
-  HAVE_GLU=no
-fi
-
-  if test "x$HAVE_GLU" = "xyes"; then
-    ac_fn_c_check_header_mongrel "$LINENO" "GL/glu.h" "ac_cv_header_GL_glu_h" "$ac_includes_default"
-if test "x$ac_cv_header_GL_glu_h" = xyes; then :
-  :
-else
-  HAVE_GLU=no
-fi
-
-
-    if test "x$HAVE_GLU" = "xyes"; then
-            :
-    else
-      :
     fi
-  else
-    :
-  fi
-
-
-
+    if test "x$NEED_GLES2" != "xno"; then
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glTexImage2D in -lGLESv2" >&5
 $as_echo_n "checking for glTexImage2D in -lGLESv2... " >&6; }
@@ -33305,6 +33054,8 @@
 
 
 
+    fi
+    if test "x$NEED_EGL" != "xno"; then
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for eglGetError in -lEGL" >&5
 $as_echo_n "checking for eglGetError in -lEGL... " >&6; }
@@ -33368,6 +33119,7 @@
 
 
 
+    fi
 
     old_LIBS=$LIBS
     old_CFLAGS=$CFLAGS
@@ -33763,10 +33515,6 @@
 CPPFLAGS="$save_CPPFLAGS"
 LIBS="$save_LIBS"
 
-
-
-
-
 USE_OPENGL=no
 USE_GLES2=no
 USE_GLX=no
@@ -33809,17 +33557,9 @@
       if test "x$NEED_GLX" = "xyes"; then
         as_fn_error $? "Building the GLX backend without the OpenGL backend is unsupported" "$LINENO" 5
       fi
-    else       if test "x$HAVE_GLU" = "xno"; then
-        if test "x$NEED_GL" = "xyes"; then
-          as_fn_error $? "GLU is required with OpenGL support" "$LINENO" 5
-        else
-          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GLU is required with OpenGL support" >&5
-$as_echo "$as_me: WARNING: GLU is required with OpenGL support" >&2;}
-        fi
-      else         USE_OPENGL=yes
-        if test "x$NEED_GLX" != "xno"; then
-          USE_GLX=yes
-        fi
+    else       USE_OPENGL=yes
+      if test "x$NEED_GLX" != "xno"; then
+        USE_GLX=yes
       fi
     fi
   fi
@@ -33844,10 +33584,8 @@
 #   define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
 #   include <OpenGL/gl3.h>
 #  endif
-#  include <OpenGL/glu.h>
 # else
 #  include <GL/gl.h>
-#  include <GL/glu.h>
 #  if __WIN32__ || _WIN32
 #   include <GL/glext.h>
 #  endif
@@ -33880,12 +33618,13 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
     if test "x$NEED_GLES2" = "xyes"; then
-      if test "x$NEED_OPENGL" = "xyes"; then
+      if test "x$NEED_GL" = "xyes"; then
         as_fn_error $? "Cannot seem to include both GL and GLES2 headers. Try disabling one API" "$LINENO" 5
       fi
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling Desktop GL support" >&5
 $as_echo "$as_me: WARNING: Disabling Desktop GL support" >&2;}
       HAVE_GL=no
+      USE_OPENGL=no
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling GL|ES 2.0 support" >&5
 $as_echo "$as_me: WARNING: Disabling GL|ES 2.0 support" >&2;}
@@ -33897,7 +33636,7 @@
   CPPFLAGS="$save_CPPFLAGS"
 fi
 
-#dnl Check for OpenGL, GLU
+#dnl Check for OpenGL
 echo host is $host
 case $host in
   *-android*)
@@ -33957,9 +33696,6 @@
       if test "x$NEED_GL" != "xno"; then
         GL_LIBS="$GL_LIBS -lGL"
       fi
-      if test "x$HAVE_GLU" = "xyes"; then
-        GL_LIBS="$GL_LIBS -lGLU"
-      fi
     fi
 
         if test "x$HAVE_GLES2" = "xyes"; then
@@ -34054,7 +33790,7 @@
       fi
 
       if test "x$NEED_COCOA" != "xno"; then
-        GL_LIBS="$LIBS -framework OpenGL -framework Cocoa"
+        GL_LIBS="$LIBS -framework OpenGL -framework Cocoa -framework QuartzCore -framework CoreFoundation"
         GL_CFLAGS="$GL_CFLAGS"
         USE_COCOA=yes
         HAVE_WINDOW_COCOA=yes
@@ -34074,9 +33810,6 @@
           if test "x$NEED_GL" != "xno"; then
             GL_LIBS="$GL_LIBS -lGL"
           fi
-          if test "x$HAVE_GLU" = "xyes"; then
-            GL_LIBS="$GL_LIBS -lGLU"
-          fi
           USE_OPENGL=yes
         fi
       fi
@@ -34091,10 +33824,10 @@
     fi
 
     if test "x$HAVE_GL" = "xyes"; then
-      if test "$NEED_GL" != "xno"; then
+      if test "x$NEED_GL" != "xno"; then
         if test "x$HAVE_WGL" = "xyes"; then
           if test "$NEED_WGL" != "xno"; then
-            GL_LIBS="$GL_LIBS -lgdi32 -lopengl32 -lglu32"
+            GL_LIBS="$GL_LIBS -lgdi32 -lopengl32"
             HAVE_WINDOW_WIN32=yes
             USE_OPENGL=yes
             USE_WGL=yes
@@ -34420,10 +34153,8 @@
 # if __APPLE__
 #  include <OpenGL/OpenGL.h>
 #  include <OpenGL/gl.h>
-#  include <OpenGL/glu.h>
 # else
 #  include <GL/gl.h>
-#  include <GL/glu.h>
 #  if __WIN32__ || _WIN32
 #   include <GL/glext.h>
 #  endif
@@ -34435,6 +34166,8 @@
 GST_GL_HAVE_GLCHAR=0
 GST_GL_HAVE_GLSIZEIPTR=0
 GST_GL_HAVE_GLINTPTR=0
+GST_GL_HAVE_GLSYNC=0
+GST_GL_HAVE_GLUINT64=0
 
 old_CFLAGS=$CFLAGS
 CFLAGS="$GL_CFLAGS $CFLAGS"
@@ -34499,6 +34232,36 @@
   GST_GL_HAVE_GLINTPTR=1
 fi
 
+ac_fn_c_check_type "$LINENO" "GLsync" "ac_cv_type_GLsync" "$GL_INCLUDES
+"
+if test "x$ac_cv_type_GLsync" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GLSYNC 1
+_ACEOF
+
+
+fi
+
+if test "x$ac_cv_type_GLsync" = "xyes"; then
+  GST_GL_HAVE_GLSYNC=1
+fi
+
+ac_fn_c_check_type "$LINENO" "GLuint64" "ac_cv_type_GLuint64" "$GL_INCLUDES
+"
+if test "x$ac_cv_type_GLuint64" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GLUINT64 1
+_ACEOF
+
+
+fi
+
+if test "x$ac_cv_type_GLuint64" = "xyes"; then
+  GST_GL_HAVE_GLUINT64=1
+fi
+
 CFLAGS=$old_CFLAGS
 
 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
@@ -34506,6 +34269,8 @@
 #define GST_GL_HAVE_GLCHAR $GST_GL_HAVE_GLCHAR
 #define GST_GL_HAVE_GLSIZEIPTR $GST_GL_HAVE_GLSIZEIPTR
 #define GST_GL_HAVE_GLINTPTR $GST_GL_HAVE_GLINTPTR
+#define GST_GL_HAVE_GLSYNC $GST_GL_HAVE_GLSYNC
+#define GST_GL_HAVE_GLUINT64 $GST_GL_HAVE_GLUINT64
 "
 
 ac_config_commands="$ac_config_commands gst-libs/gst/gl/gstglconfig.h"
@@ -35137,140 +34902,6 @@
 
 
 echo
-{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: DirectDraw plug-in ***" >&5
-$as_echo "$as_me: *** checking feature: DirectDraw plug-in ***" >&6;}
-if test "xdirectdrawsink" != "x"
-then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: directdrawsink ***" >&5
-$as_echo "$as_me: *** for plug-ins: directdrawsink ***" >&6;}
-fi
-NOUSE=
-if test "x$USE_DIRECTDRAW" = "xno"; then
-  NOUSE="yes"
-fi
-# Check whether --enable-directdraw was given.
-if test "${enable_directdraw+set}" = set; then :
-  enableval=$enable_directdraw;  case "${enableval}" in
-      yes) USE_DIRECTDRAW=yes;;
-      no) USE_DIRECTDRAW=no;;
-      *) as_fn_error $? "bad value ${enableval} for --enable-directdraw" "$LINENO" 5 ;;
-    esac
-else
-   USE_DIRECTDRAW=yes
-fi
-
-if test "x$NOUSE" = "xyes"; then
-  USE_DIRECTDRAW="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** directdrawsink pre-configured not to be built" >&5
-$as_echo "$as_me: WARNING: *** directdrawsink pre-configured not to be built" >&2;}
-fi
-NOUSE=
-
-if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " DIRECTDRAW " > /dev/null; then
-  USE_DIRECTDRAW="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** directdrawsink not ported" >&5
-$as_echo "$as_me: WARNING: *** directdrawsink not ported" >&2;}
-fi
-
-
-if test x$USE_DIRECTDRAW = xyes; then
-
-  gst_check_save_LIBS=$LIBS
-  gst_check_save_LDFLAGS=$LDFLAGS
-  gst_check_save_CFLAGS=$CFLAGS
-  gst_check_save_CPPFLAGS=$CPPFLAGS
-  gst_check_save_CXXFLAGS=$CXXFLAGS
-
-  HAVE_DIRECTDRAW=no
-
-  HAVE_DIRECTDRAW="no"
-  save_CFLAGS="$CFLAGS"
-  save_LDFLAGS="$LDFLAGS"
-  save_LIBS="$LIBS"
-  CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
-  LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
-  LIBS="$LIBS -lddraw -lgdi32"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DirectDraw LDFLAGS" >&5
-$as_echo_n "checking for DirectDraw LDFLAGS... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <windows.h>
-#include <ddraw.h>
-
-int
-main ()
-{
-
-  GetStockObject(0);
-  DirectDrawCreate(NULL, NULL, NULL);
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  HAVE_DIRECTDRAW="yes"
-else
-  HAVE_DIRECTDRAW="no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_DIRECTDRAW" >&5
-$as_echo "$HAVE_DIRECTDRAW" >&6; }
-  CFLAGS=$save_CFLAGS
-  LDFLAGS=$save_LDFLAGS
-  LIBS=$save_LIBS
-
-  if test "x$HAVE_DIRECTDRAW" = "xyes";  then
-        DIRECTDRAW_LIBS="-lddraw -ldxguid -lgdi32"
-
-
-
-  fi
-
-
-
-  LIBS=$gst_check_save_LIBS
-  LDFLAGS=$gst_check_save_LDFLAGS
-  CFLAGS=$gst_check_save_CFLAGS
-  CPPFLAGS=$gst_check_save_CPPFLAGS
-  CXXFLAGS=$gst_check_save_CXXFLAGS
-
-    if test x$HAVE_DIRECTDRAW = xno; then
-    USE_DIRECTDRAW=no
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: directdrawsink" >&5
-$as_echo "$as_me: *** These plugins will be built: directdrawsink" >&6;}
-  fi
-fi
-if test x$USE_DIRECTDRAW = xyes; then
-  :
-  if test "xdirectdrawsink" != "x"; then
-    GST_PLUGINS_YES="\tdirectdrawsink\n$GST_PLUGINS_YES"
-  fi
-
-$as_echo "#define HAVE_DIRECTDRAW /**/" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: directdrawsink" >&5
-$as_echo "$as_me: *** These plugins will not be built: directdrawsink" >&6;}
-  if test "xdirectdrawsink" != "x"; then
-    GST_PLUGINS_NO="\tdirectdrawsink\n$GST_PLUGINS_NO"
-  fi
-  :
-fi
- if test x$USE_DIRECTDRAW = xyes; then
-  USE_DIRECTDRAW_TRUE=
-  USE_DIRECTDRAW_FALSE='#'
-else
-  USE_DIRECTDRAW_TRUE='#'
-  USE_DIRECTDRAW_FALSE=
-fi
-
-
-
-echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: winscreencap plug-in ***" >&5
 $as_echo "$as_me: *** checking feature: winscreencap plug-in ***" >&6;}
 if test "xwinscreencap" != "x"
@@ -35810,12 +35441,12 @@
 
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BLUEZ" >&5
-$as_echo_n "checking for BLUEZ... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BLUEZ4" >&5
+$as_echo_n "checking for BLUEZ4... " >&6; }
 
 if test -n "$PKG_CONFIG"; then
-    if test -n "$BLUEZ_CFLAGS"; then
-        pkg_cv_BLUEZ_CFLAGS="$BLUEZ_CFLAGS"
+    if test -n "$BLUEZ4_CFLAGS"; then
+        pkg_cv_BLUEZ4_CFLAGS="$BLUEZ4_CFLAGS"
     else
         if test -n "$PKG_CONFIG" && \
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez < 5.0\""; } >&5
@@ -35823,7 +35454,7 @@
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_BLUEZ_CFLAGS=`$PKG_CONFIG --cflags "bluez < 5.0" 2>/dev/null`
+  pkg_cv_BLUEZ4_CFLAGS=`$PKG_CONFIG --cflags "bluez < 5.0" 2>/dev/null`
 else
   pkg_failed=yes
 fi
@@ -35832,8 +35463,8 @@
 	pkg_failed=untried
 fi
 if test -n "$PKG_CONFIG"; then
-    if test -n "$BLUEZ_LIBS"; then
-        pkg_cv_BLUEZ_LIBS="$BLUEZ_LIBS"
+    if test -n "$BLUEZ4_LIBS"; then
+        pkg_cv_BLUEZ4_LIBS="$BLUEZ4_LIBS"
     else
         if test -n "$PKG_CONFIG" && \
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez < 5.0\""; } >&5
@@ -35841,7 +35472,7 @@
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_BLUEZ_LIBS=`$PKG_CONFIG --libs "bluez < 5.0" 2>/dev/null`
+  pkg_cv_BLUEZ4_LIBS=`$PKG_CONFIG --libs "bluez < 5.0" 2>/dev/null`
 else
   pkg_failed=yes
 fi
@@ -35860,28 +35491,194 @@
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        BLUEZ_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "bluez < 5.0"`
+	        BLUEZ4_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "bluez < 5.0"`
         else
-	        BLUEZ_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "bluez < 5.0"`
+	        BLUEZ4_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "bluez < 5.0"`
         fi
 	# Put the nasty error message in config.log where it belongs
-	echo "$BLUEZ_PKG_ERRORS" >&5
+	echo "$BLUEZ4_PKG_ERRORS" >&5
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
-    HAVE_BLUEZ=no
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BLUEZ5" >&5
+$as_echo_n "checking for BLUEZ5... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$BLUEZ5_CFLAGS"; then
+        pkg_cv_BLUEZ5_CFLAGS="$BLUEZ5_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez >= 5.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "bluez >= 5.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BLUEZ5_CFLAGS=`$PKG_CONFIG --cflags "bluez >= 5.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$BLUEZ5_LIBS"; then
+        pkg_cv_BLUEZ5_LIBS="$BLUEZ5_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez >= 5.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "bluez >= 5.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BLUEZ5_LIBS=`$PKG_CONFIG --libs "bluez >= 5.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        BLUEZ5_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "bluez >= 5.0"`
+        else
+	        BLUEZ5_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "bluez >= 5.0"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$BLUEZ5_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+      HAVE_BLUEZ=no
 
 elif test $pkg_failed = untried; then
 
-    HAVE_BLUEZ=no
+      HAVE_BLUEZ=no
 
 else
-	BLUEZ_CFLAGS=$pkg_cv_BLUEZ_CFLAGS
-	BLUEZ_LIBS=$pkg_cv_BLUEZ_LIBS
+	BLUEZ5_CFLAGS=$pkg_cv_BLUEZ5_CFLAGS
+	BLUEZ5_LIBS=$pkg_cv_BLUEZ5_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+      HAVE_BLUEZ=yes
+
+$as_echo "#define HAVE_BLUEZ5 1" >>confdefs.h
+
+
+fi
+
+elif test $pkg_failed = untried; then
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BLUEZ5" >&5
+$as_echo_n "checking for BLUEZ5... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$BLUEZ5_CFLAGS"; then
+        pkg_cv_BLUEZ5_CFLAGS="$BLUEZ5_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez >= 5.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "bluez >= 5.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BLUEZ5_CFLAGS=`$PKG_CONFIG --cflags "bluez >= 5.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$BLUEZ5_LIBS"; then
+        pkg_cv_BLUEZ5_LIBS="$BLUEZ5_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez >= 5.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "bluez >= 5.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BLUEZ5_LIBS=`$PKG_CONFIG --libs "bluez >= 5.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        BLUEZ5_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "bluez >= 5.0"`
+        else
+	        BLUEZ5_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "bluez >= 5.0"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$BLUEZ5_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+      HAVE_BLUEZ=no
+
+elif test $pkg_failed = untried; then
+
+      HAVE_BLUEZ=no
+
+else
+	BLUEZ5_CFLAGS=$pkg_cv_BLUEZ5_CFLAGS
+	BLUEZ5_LIBS=$pkg_cv_BLUEZ5_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+      HAVE_BLUEZ=yes
+
+$as_echo "#define HAVE_BLUEZ5 1" >>confdefs.h
+
+
+fi
+
+else
+	BLUEZ4_CFLAGS=$pkg_cv_BLUEZ4_CFLAGS
+	BLUEZ4_LIBS=$pkg_cv_BLUEZ4_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+    HAVE_BLUEZ=yes
+
+$as_echo "#define HAVE_BLUEZ4 1" >>confdefs.h
+
+
+fi
+  if  test x$HAVE_BLUEZ = xyes ; then :
+
 
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBUS" >&5
@@ -35996,110 +35793,6 @@
 
 
 
-HAVE_OSX_VIDEO="no"
-echo
-{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: OSX video ***" >&5
-$as_echo "$as_me: *** checking feature: OSX video ***" >&6;}
-if test "xosxvideosrc" != "x"
-then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: osxvideosrc ***" >&5
-$as_echo "$as_me: *** for plug-ins: osxvideosrc ***" >&6;}
-fi
-NOUSE=
-if test "x$USE_OSX_VIDEO" = "xno"; then
-  NOUSE="yes"
-fi
-# Check whether --enable-osx_video was given.
-if test "${enable_osx_video+set}" = set; then :
-  enableval=$enable_osx_video;  case "${enableval}" in
-      yes) USE_OSX_VIDEO=yes;;
-      no) USE_OSX_VIDEO=no;;
-      *) as_fn_error $? "bad value ${enableval} for --enable-osx_video" "$LINENO" 5 ;;
-    esac
-else
-   USE_OSX_VIDEO=yes
-fi
-
-if test "x$NOUSE" = "xyes"; then
-  USE_OSX_VIDEO="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** osxvideosrc pre-configured not to be built" >&5
-$as_echo "$as_me: WARNING: *** osxvideosrc pre-configured not to be built" >&2;}
-fi
-NOUSE=
-
-if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " OSX_VIDEO " > /dev/null; then
-  USE_OSX_VIDEO="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** osxvideosrc not ported" >&5
-$as_echo "$as_me: WARNING: *** osxvideosrc not ported" >&2;}
-fi
-
-
-if test x$USE_OSX_VIDEO = xyes; then
-
-  gst_check_save_LIBS=$LIBS
-  gst_check_save_LDFLAGS=$LDFLAGS
-  gst_check_save_CFLAGS=$CFLAGS
-  gst_check_save_CPPFLAGS=$CPPFLAGS
-  gst_check_save_CXXFLAGS=$CXXFLAGS
-
-  HAVE_OSX_VIDEO=no
-
-  ac_fn_c_check_type "$LINENO" "SeqGrabComponent" "ac_cv_type_SeqGrabComponent" "#include <Quicktime/Quicktime.h>
-"
-if test "x$ac_cv_type_SeqGrabComponent" = xyes; then :
-  HAVE_OSX_VIDEO="yes"
-else
-  HAVE_OSX_VIDEO="no"
-fi
-
-
-
-  LIBS=$gst_check_save_LIBS
-  LDFLAGS=$gst_check_save_LDFLAGS
-  CFLAGS=$gst_check_save_CFLAGS
-  CPPFLAGS=$gst_check_save_CPPFLAGS
-  CXXFLAGS=$gst_check_save_CXXFLAGS
-
-    if test x$HAVE_OSX_VIDEO = xno; then
-    USE_OSX_VIDEO=no
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: osxvideosrc" >&5
-$as_echo "$as_me: *** These plugins will be built: osxvideosrc" >&6;}
-  fi
-fi
-if test x$USE_OSX_VIDEO = xyes; then
-  :
-  if test "xosxvideosrc" != "x"; then
-    GST_PLUGINS_YES="\tosxvideosrc\n$GST_PLUGINS_YES"
-  fi
-
-$as_echo "#define HAVE_OSX_VIDEO /**/" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: osxvideosrc" >&5
-$as_echo "$as_me: *** These plugins will not be built: osxvideosrc" >&6;}
-  if test "xosxvideosrc" != "x"; then
-    GST_PLUGINS_NO="\tosxvideosrc\n$GST_PLUGINS_NO"
-  fi
-  :
-fi
- if test x$USE_OSX_VIDEO = xyes; then
-  USE_OSX_VIDEO_TRUE=
-  USE_OSX_VIDEO_FALSE='#'
-else
-  USE_OSX_VIDEO_TRUE='#'
-  USE_OSX_VIDEO_FALSE=
-fi
-
-
-case "$host" in
-  *-*darwin*)
-    ;;
-  *)
-    HAVE_OSX_VIDEO="no"
-    ;;
-esac
-
 HAVE_AVC="no"
 echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: AVC Video Services ***" >&5
@@ -36233,102 +35926,6 @@
 esac
 
 echo
-{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: QuickTime wrapper ***" >&5
-$as_echo "$as_me: *** checking feature: QuickTime wrapper ***" >&6;}
-if test "xqtwrapper" != "x"
-then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: qtwrapper ***" >&5
-$as_echo "$as_me: *** for plug-ins: qtwrapper ***" >&6;}
-fi
-NOUSE=
-if test "x$USE_QUICKTIME" = "xno"; then
-  NOUSE="yes"
-fi
-# Check whether --enable-quicktime was given.
-if test "${enable_quicktime+set}" = set; then :
-  enableval=$enable_quicktime;  case "${enableval}" in
-      yes) USE_QUICKTIME=yes;;
-      no) USE_QUICKTIME=no;;
-      *) as_fn_error $? "bad value ${enableval} for --enable-quicktime" "$LINENO" 5 ;;
-    esac
-else
-   USE_QUICKTIME=yes
-fi
-
-if test "x$NOUSE" = "xyes"; then
-  USE_QUICKTIME="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** qtwrapper pre-configured not to be built" >&5
-$as_echo "$as_me: WARNING: *** qtwrapper pre-configured not to be built" >&2;}
-fi
-NOUSE=
-
-if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " QUICKTIME " > /dev/null; then
-  USE_QUICKTIME="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** qtwrapper not ported" >&5
-$as_echo "$as_me: WARNING: *** qtwrapper not ported" >&2;}
-fi
-
-
-if test x$USE_QUICKTIME = xyes; then
-
-  gst_check_save_LIBS=$LIBS
-  gst_check_save_LDFLAGS=$LDFLAGS
-  gst_check_save_CFLAGS=$CFLAGS
-  gst_check_save_CPPFLAGS=$CPPFLAGS
-  gst_check_save_CXXFLAGS=$CXXFLAGS
-
-  HAVE_QUICKTIME=no
-
-  ac_fn_c_check_type "$LINENO" "SampleReferenceRecord" "ac_cv_type_SampleReferenceRecord" "#include <Quicktime/Quicktime.h>
-"
-if test "x$ac_cv_type_SampleReferenceRecord" = xyes; then :
-  HAVE_QUICKTIME="yes"
-else
-  HAVE_QUICKTIME="no"
-fi
-
-
-
-  LIBS=$gst_check_save_LIBS
-  LDFLAGS=$gst_check_save_LDFLAGS
-  CFLAGS=$gst_check_save_CFLAGS
-  CPPFLAGS=$gst_check_save_CPPFLAGS
-  CXXFLAGS=$gst_check_save_CXXFLAGS
-
-    if test x$HAVE_QUICKTIME = xno; then
-    USE_QUICKTIME=no
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: qtwrapper" >&5
-$as_echo "$as_me: *** These plugins will be built: qtwrapper" >&6;}
-  fi
-fi
-if test x$USE_QUICKTIME = xyes; then
-  :
-  if test "xqtwrapper" != "x"; then
-    GST_PLUGINS_YES="\tqtwrapper\n$GST_PLUGINS_YES"
-  fi
-
-$as_echo "#define HAVE_QUICKTIME /**/" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: qtwrapper" >&5
-$as_echo "$as_me: *** These plugins will not be built: qtwrapper" >&6;}
-  if test "xqtwrapper" != "x"; then
-    GST_PLUGINS_NO="\tqtwrapper\n$GST_PLUGINS_NO"
-  fi
-  :
-fi
- if test x$USE_QUICKTIME = xyes; then
-  USE_QUICKTIME_TRUE=
-  USE_QUICKTIME_FALSE='#'
-else
-  USE_QUICKTIME_TRUE='#'
-  USE_QUICKTIME_FALSE=
-fi
-
-
-
-echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: POSIX shared memory source and sink ***" >&5
 $as_echo "$as_me: *** checking feature: POSIX shared memory source and sink ***" >&6;}
 if test "xshm" != "x"
@@ -37851,6 +37448,171 @@
 
 
 echo
+{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: bs2b ***" >&5
+$as_echo "$as_me: *** checking feature: bs2b ***" >&6;}
+if test "xbs2b" != "x"
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: bs2b ***" >&5
+$as_echo "$as_me: *** for plug-ins: bs2b ***" >&6;}
+fi
+NOUSE=
+if test "x$USE_BS2B" = "xno"; then
+  NOUSE="yes"
+fi
+# Check whether --enable-bs2b was given.
+if test "${enable_bs2b+set}" = set; then :
+  enableval=$enable_bs2b;  case "${enableval}" in
+      yes) USE_BS2B=yes;;
+      no) USE_BS2B=no;;
+      *) as_fn_error $? "bad value ${enableval} for --enable-bs2b" "$LINENO" 5 ;;
+    esac
+else
+   USE_BS2B=yes
+fi
+
+if test "x$NOUSE" = "xyes"; then
+  USE_BS2B="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** bs2b pre-configured not to be built" >&5
+$as_echo "$as_me: WARNING: *** bs2b pre-configured not to be built" >&2;}
+fi
+NOUSE=
+
+if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " BS2B " > /dev/null; then
+  USE_BS2B="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** bs2b not ported" >&5
+$as_echo "$as_me: WARNING: *** bs2b not ported" >&2;}
+fi
+
+
+if test x$USE_BS2B = xyes; then
+
+  gst_check_save_LIBS=$LIBS
+  gst_check_save_LDFLAGS=$LDFLAGS
+  gst_check_save_CFLAGS=$CFLAGS
+  gst_check_save_CPPFLAGS=$CPPFLAGS
+  gst_check_save_CXXFLAGS=$CXXFLAGS
+
+  HAVE_BS2B=no
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BS2B" >&5
+$as_echo_n "checking for BS2B... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$BS2B_CFLAGS"; then
+        pkg_cv_BS2B_CFLAGS="$BS2B_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbs2b >= 3.1.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libbs2b >= 3.1.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BS2B_CFLAGS=`$PKG_CONFIG --cflags "libbs2b >= 3.1.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$BS2B_LIBS"; then
+        pkg_cv_BS2B_LIBS="$BS2B_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbs2b >= 3.1.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libbs2b >= 3.1.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_BS2B_LIBS=`$PKG_CONFIG --libs "libbs2b >= 3.1.0" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        BS2B_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libbs2b >= 3.1.0"`
+        else
+	        BS2B_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libbs2b >= 3.1.0"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$BS2B_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+    HAVE_BS2B="no"
+
+elif test $pkg_failed = untried; then
+
+    HAVE_BS2B="no"
+
+else
+	BS2B_CFLAGS=$pkg_cv_BS2B_CFLAGS
+	BS2B_LIBS=$pkg_cv_BS2B_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	HAVE_BS2B="yes"
+fi
+
+
+
+
+  LIBS=$gst_check_save_LIBS
+  LDFLAGS=$gst_check_save_LDFLAGS
+  CFLAGS=$gst_check_save_CFLAGS
+  CPPFLAGS=$gst_check_save_CPPFLAGS
+  CXXFLAGS=$gst_check_save_CXXFLAGS
+
+    if test x$HAVE_BS2B = xno; then
+    USE_BS2B=no
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: bs2b" >&5
+$as_echo "$as_me: *** These plugins will be built: bs2b" >&6;}
+  fi
+fi
+if test x$USE_BS2B = xyes; then
+  :
+  if test "xbs2b" != "x"; then
+    GST_PLUGINS_YES="\tbs2b\n$GST_PLUGINS_YES"
+  fi
+
+$as_echo "#define HAVE_BS2B /**/" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: bs2b" >&5
+$as_echo "$as_me: *** These plugins will not be built: bs2b" >&6;}
+  if test "xbs2b" != "x"; then
+    GST_PLUGINS_NO="\tbs2b\n$GST_PLUGINS_NO"
+  fi
+  :
+fi
+ if test x$USE_BS2B = xyes; then
+  USE_BS2B_TRUE=
+  USE_BS2B_FALSE='#'
+else
+  USE_BS2B_TRUE='#'
+  USE_BS2B_FALSE=
+fi
+
+
+
+echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: bz2 library ***" >&5
 $as_echo "$as_me: *** checking feature: bz2 library ***" >&6;}
 if test "xbz2" != "x"
@@ -41755,6 +41517,167 @@
 
 
 echo
+{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: libde265 HEVC/H.265 decoder ***" >&5
+$as_echo "$as_me: *** checking feature: libde265 HEVC/H.265 decoder ***" >&6;}
+if test "xlibde265" != "x"
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: libde265 ***" >&5
+$as_echo "$as_me: *** for plug-ins: libde265 ***" >&6;}
+fi
+NOUSE=
+if test "x$USE_LIBDE265" = "xno"; then
+  NOUSE="yes"
+fi
+# Check whether --enable-libde265 was given.
+if test "${enable_libde265+set}" = set; then :
+  enableval=$enable_libde265;  case "${enableval}" in
+      yes) USE_LIBDE265=yes;;
+      no) USE_LIBDE265=no;;
+      *) as_fn_error $? "bad value ${enableval} for --enable-libde265" "$LINENO" 5 ;;
+    esac
+else
+   USE_LIBDE265=yes
+fi
+
+if test "x$NOUSE" = "xyes"; then
+  USE_LIBDE265="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** libde265 pre-configured not to be built" >&5
+$as_echo "$as_me: WARNING: *** libde265 pre-configured not to be built" >&2;}
+fi
+NOUSE=
+
+if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " LIBDE265 " > /dev/null; then
+  USE_LIBDE265="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** libde265 not ported" >&5
+$as_echo "$as_me: WARNING: *** libde265 not ported" >&2;}
+fi
+
+
+if test x$USE_LIBDE265 = xyes; then
+
+  gst_check_save_LIBS=$LIBS
+  gst_check_save_LDFLAGS=$LDFLAGS
+  gst_check_save_CFLAGS=$CFLAGS
+  gst_check_save_CPPFLAGS=$CPPFLAGS
+  gst_check_save_CXXFLAGS=$CXXFLAGS
+
+  HAVE_LIBDE265=no
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDE265" >&5
+$as_echo_n "checking for LIBDE265... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBDE265_CFLAGS"; then
+        pkg_cv_LIBDE265_CFLAGS="$LIBDE265_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libde265 >= 0.9\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libde265 >= 0.9") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBDE265_CFLAGS=`$PKG_CONFIG --cflags "libde265 >= 0.9" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$LIBDE265_LIBS"; then
+        pkg_cv_LIBDE265_LIBS="$LIBDE265_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libde265 >= 0.9\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libde265 >= 0.9") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBDE265_LIBS=`$PKG_CONFIG --libs "libde265 >= 0.9" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        LIBDE265_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libde265 >= 0.9"`
+        else
+	        LIBDE265_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libde265 >= 0.9"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$LIBDE265_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                HAVE_LIBDE265="no"
+elif test $pkg_failed = untried; then
+	HAVE_LIBDE265="no"
+else
+	LIBDE265_CFLAGS=$pkg_cv_LIBDE265_CFLAGS
+	LIBDE265_LIBS=$pkg_cv_LIBDE265_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	HAVE_LIBDE265="yes"
+fi
+
+
+
+
+  LIBS=$gst_check_save_LIBS
+  LDFLAGS=$gst_check_save_LDFLAGS
+  CFLAGS=$gst_check_save_CFLAGS
+  CPPFLAGS=$gst_check_save_CPPFLAGS
+  CXXFLAGS=$gst_check_save_CXXFLAGS
+
+    if test x$HAVE_LIBDE265 = xno; then
+    USE_LIBDE265=no
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: libde265" >&5
+$as_echo "$as_me: *** These plugins will be built: libde265" >&6;}
+  fi
+fi
+if test x$USE_LIBDE265 = xyes; then
+  :
+  if test "xlibde265" != "x"; then
+    GST_PLUGINS_YES="\tlibde265\n$GST_PLUGINS_YES"
+  fi
+
+$as_echo "#define HAVE_LIBDE265 /**/" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: libde265" >&5
+$as_echo "$as_me: *** These plugins will not be built: libde265" >&6;}
+  if test "xlibde265" != "x"; then
+    GST_PLUGINS_NO="\tlibde265\n$GST_PLUGINS_NO"
+  fi
+  :
+fi
+ if test x$USE_LIBDE265 = xyes; then
+  USE_LIBDE265_TRUE=
+  USE_LIBDE265_FALSE='#'
+else
+  USE_LIBDE265_TRUE='#'
+  USE_LIBDE265_FALSE=
+fi
+
+
+
+echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: mms protocol library ***" >&5
 $as_echo "$as_me: *** checking feature: mms protocol library ***" >&6;}
 if test "xlibmms" != "x"
@@ -41966,7 +41889,67 @@
 
   HAVE_SRTP=no
 
-  HAVE_SRTP="yes"
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SRTP" >&5
+$as_echo_n "checking for SRTP... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$SRTP_CFLAGS"; then
+        pkg_cv_SRTP_CFLAGS="$SRTP_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsrtp\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libsrtp") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_SRTP_CFLAGS=`$PKG_CONFIG --cflags "libsrtp" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$SRTP_LIBS"; then
+        pkg_cv_SRTP_LIBS="$SRTP_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsrtp\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libsrtp") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_SRTP_LIBS=`$PKG_CONFIG --libs "libsrtp" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        SRTP_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libsrtp"`
+        else
+	        SRTP_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libsrtp"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$SRTP_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for srtp_init in -lsrtp" >&5
 $as_echo_n "checking for srtp_init in -lsrtp... " >&6; }
@@ -42022,15 +42005,89 @@
     if test "x$HAVE_SRTP" = "xyes"; then
             SRTP_LIBS="-lsrtp"
     else
-      HAVE_SRTP="no"
+      :
     fi
   else
-    HAVE_SRTP="no"
+    :
   fi
 
 
 
 
+elif test $pkg_failed = untried; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for srtp_init in -lsrtp" >&5
+$as_echo_n "checking for srtp_init in -lsrtp... " >&6; }
+if ${ac_cv_lib_srtp_srtp_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsrtp  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char srtp_init ();
+int
+main ()
+{
+return srtp_init ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_srtp_srtp_init=yes
+else
+  ac_cv_lib_srtp_srtp_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_srtp_srtp_init" >&5
+$as_echo "$ac_cv_lib_srtp_srtp_init" >&6; }
+if test "x$ac_cv_lib_srtp_srtp_init" = xyes; then :
+  HAVE_SRTP=yes
+else
+  HAVE_SRTP=no
+fi
+
+  if test "x$HAVE_SRTP" = "xyes"; then
+    ac_fn_c_check_header_mongrel "$LINENO" "srtp/srtp.h" "ac_cv_header_srtp_srtp_h" "$ac_includes_default"
+if test "x$ac_cv_header_srtp_srtp_h" = xyes; then :
+  :
+else
+  HAVE_SRTP=no
+fi
+
+
+    if test "x$HAVE_SRTP" = "xyes"; then
+            SRTP_LIBS="-lsrtp"
+    else
+      :
+    fi
+  else
+    :
+  fi
+
+
+
+
+else
+	SRTP_CFLAGS=$pkg_cv_SRTP_CFLAGS
+	SRTP_LIBS=$pkg_cv_SRTP_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	HAVE_SRTP="yes"
+fi
+
+
 
 
   LIBS=$gst_check_save_LIBS
@@ -42073,6 +42130,173 @@
 
 
 echo
+{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: DTLS plugin ***" >&5
+$as_echo "$as_me: *** checking feature: DTLS plugin ***" >&6;}
+if test "xdtls" != "x"
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: dtls ***" >&5
+$as_echo "$as_me: *** for plug-ins: dtls ***" >&6;}
+fi
+NOUSE=
+if test "x$USE_DTLS" = "xno"; then
+  NOUSE="yes"
+fi
+# Check whether --enable-dtls was given.
+if test "${enable_dtls+set}" = set; then :
+  enableval=$enable_dtls;  case "${enableval}" in
+      yes) USE_DTLS=yes;;
+      no) USE_DTLS=no;;
+      *) as_fn_error $? "bad value ${enableval} for --enable-dtls" "$LINENO" 5 ;;
+    esac
+else
+   USE_DTLS=yes
+fi
+
+if test "x$NOUSE" = "xyes"; then
+  USE_DTLS="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** dtls pre-configured not to be built" >&5
+$as_echo "$as_me: WARNING: *** dtls pre-configured not to be built" >&2;}
+fi
+NOUSE=
+
+if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " DTLS " > /dev/null; then
+  USE_DTLS="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** dtls not ported" >&5
+$as_echo "$as_me: WARNING: *** dtls not ported" >&2;}
+fi
+
+
+if test x$USE_DTLS = xyes; then
+
+  gst_check_save_LIBS=$LIBS
+  gst_check_save_LDFLAGS=$LDFLAGS
+  gst_check_save_CFLAGS=$CFLAGS
+  gst_check_save_CPPFLAGS=$CPPFLAGS
+  gst_check_save_CXXFLAGS=$CXXFLAGS
+
+  HAVE_DTLS=no
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DTLS" >&5
+$as_echo_n "checking for DTLS... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$DTLS_CFLAGS"; then
+        pkg_cv_DTLS_CFLAGS="$DTLS_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" openssl >= 0.9.5  libcrypto \""; } >&5
+  ($PKG_CONFIG --exists --print-errors " openssl >= 0.9.5  libcrypto ") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DTLS_CFLAGS=`$PKG_CONFIG --cflags " openssl >= 0.9.5  libcrypto " 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$DTLS_LIBS"; then
+        pkg_cv_DTLS_LIBS="$DTLS_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" openssl >= 0.9.5  libcrypto \""; } >&5
+  ($PKG_CONFIG --exists --print-errors " openssl >= 0.9.5  libcrypto ") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DTLS_LIBS=`$PKG_CONFIG --libs " openssl >= 0.9.5  libcrypto " 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        DTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors " openssl >= 0.9.5  libcrypto "`
+        else
+	        DTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors " openssl >= 0.9.5  libcrypto "`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$DTLS_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+    HAVE_DTLS="no"
+
+elif test $pkg_failed = untried; then
+
+    HAVE_DTLS="no"
+
+else
+	DTLS_CFLAGS=$pkg_cv_DTLS_CFLAGS
+	DTLS_LIBS=$pkg_cv_DTLS_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+    HAVE_DTLS="yes"
+
+
+
+fi
+
+
+  LIBS=$gst_check_save_LIBS
+  LDFLAGS=$gst_check_save_LDFLAGS
+  CFLAGS=$gst_check_save_CFLAGS
+  CPPFLAGS=$gst_check_save_CPPFLAGS
+  CXXFLAGS=$gst_check_save_CXXFLAGS
+
+    if test x$HAVE_DTLS = xno; then
+    USE_DTLS=no
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: dtls" >&5
+$as_echo "$as_me: *** These plugins will be built: dtls" >&6;}
+  fi
+fi
+if test x$USE_DTLS = xyes; then
+  :
+  if test "xdtls" != "x"; then
+    GST_PLUGINS_YES="\tdtls\n$GST_PLUGINS_YES"
+  fi
+
+$as_echo "#define HAVE_DTLS /**/" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: dtls" >&5
+$as_echo "$as_me: *** These plugins will not be built: dtls" >&6;}
+  if test "xdtls" != "x"; then
+    GST_PLUGINS_NO="\tdtls\n$GST_PLUGINS_NO"
+  fi
+  :
+fi
+ if test x$USE_DTLS = xyes; then
+  USE_DTLS_TRUE=
+  USE_DTLS_FALSE='#'
+else
+  USE_DTLS_TRUE='#'
+  USE_DTLS_FALSE=
+fi
+
+
+
+echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: Linear Systems SDI plugin ***" >&5
 $as_echo "$as_me: *** checking feature: Linear Systems SDI plugin ***" >&6;}
 if test "xlinsys" != "x"
@@ -42608,7 +42832,7 @@
                 OLD_CFLAGS="$CFLAGS"
         OLD_LIBS="$LIBS"
         CFLAGS="$MJPEG_CFLAGS"
-        LIBS="$LIBS $MJPEG_LIBS -lmjpegutils $LIBM -lpthread"
+        LIBS="$LIBS $MJPEG_LIBS -lmjpegutils $LIBM $PTHREAD_LIBS"
         ac_fn_c_check_func "$LINENO" "mjpeg_loglev_t" "ac_cv_func_mjpeg_loglev_t"
 if test "x$ac_cv_func_mjpeg_loglev_t" = xyes; then :
 
@@ -42774,7 +42998,7 @@
       ac_fn_cxx_check_header_mongrel "$LINENO" "mpeg2encoder.hh" "ac_cv_header_mpeg2encoder_hh" "$ac_includes_default"
 if test "x$ac_cv_header_mpeg2encoder_hh" = xyes; then :
 
-        MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp $LIBM -lpthread"
+        MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp $LIBM $PTHREAD_LIBS"
         OLD_LIBS="$LIBS"
         LIBS="$LIBS $MPEG2ENC_LIBS"
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for valid mpeg2enc objects" >&5
@@ -43420,171 +43644,6 @@
 
 
 echo
-{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: MythTV client plugins ***" >&5
-$as_echo "$as_me: *** checking feature: MythTV client plugins ***" >&6;}
-if test "xmythtvsrc" != "x"
-then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: mythtvsrc ***" >&5
-$as_echo "$as_me: *** for plug-ins: mythtvsrc ***" >&6;}
-fi
-NOUSE=
-if test "x$USE_MYTHTV" = "xno"; then
-  NOUSE="yes"
-fi
-# Check whether --enable-mythtv was given.
-if test "${enable_mythtv+set}" = set; then :
-  enableval=$enable_mythtv;  case "${enableval}" in
-      yes) USE_MYTHTV=yes;;
-      no) USE_MYTHTV=no;;
-      *) as_fn_error $? "bad value ${enableval} for --enable-mythtv" "$LINENO" 5 ;;
-    esac
-else
-   USE_MYTHTV=yes
-fi
-
-if test "x$NOUSE" = "xyes"; then
-  USE_MYTHTV="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** mythtvsrc pre-configured not to be built" >&5
-$as_echo "$as_me: WARNING: *** mythtvsrc pre-configured not to be built" >&2;}
-fi
-NOUSE=
-
-if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " MYTHTV " > /dev/null; then
-  USE_MYTHTV="no"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** mythtvsrc not ported" >&5
-$as_echo "$as_me: WARNING: *** mythtvsrc not ported" >&2;}
-fi
-
-
-if test x$USE_MYTHTV = xyes; then
-
-  gst_check_save_LIBS=$LIBS
-  gst_check_save_LDFLAGS=$LDFLAGS
-  gst_check_save_CFLAGS=$CFLAGS
-  gst_check_save_CPPFLAGS=$CPPFLAGS
-  gst_check_save_CXXFLAGS=$CXXFLAGS
-
-  HAVE_MYTHTV=no
-
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GMYTH" >&5
-$as_echo_n "checking for GMYTH... " >&6; }
-
-if test -n "$PKG_CONFIG"; then
-    if test -n "$GMYTH_CFLAGS"; then
-        pkg_cv_GMYTH_CFLAGS="$GMYTH_CFLAGS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gmyth >= 0.4 gmyth <= 0.7.99\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gmyth >= 0.4 gmyth <= 0.7.99") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_GMYTH_CFLAGS=`$PKG_CONFIG --cflags "gmyth >= 0.4 gmyth <= 0.7.99" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
-    fi
-else
-	pkg_failed=untried
-fi
-if test -n "$PKG_CONFIG"; then
-    if test -n "$GMYTH_LIBS"; then
-        pkg_cv_GMYTH_LIBS="$GMYTH_LIBS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gmyth >= 0.4 gmyth <= 0.7.99\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gmyth >= 0.4 gmyth <= 0.7.99") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_GMYTH_LIBS=`$PKG_CONFIG --libs "gmyth >= 0.4 gmyth <= 0.7.99" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
-    fi
-else
-	pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        GMYTH_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gmyth >= 0.4 gmyth <= 0.7.99"`
-        else
-	        GMYTH_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gmyth >= 0.4 gmyth <= 0.7.99"`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$GMYTH_PKG_ERRORS" >&5
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-    HAVE_MYTHTV="no"
-
-elif test $pkg_failed = untried; then
-
-    HAVE_MYTHTV="no"
-
-else
-	GMYTH_CFLAGS=$pkg_cv_GMYTH_CFLAGS
-	GMYTH_LIBS=$pkg_cv_GMYTH_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	HAVE_MYTHTV="yes"
-fi
-
-
-
-
-  LIBS=$gst_check_save_LIBS
-  LDFLAGS=$gst_check_save_LDFLAGS
-  CFLAGS=$gst_check_save_CFLAGS
-  CPPFLAGS=$gst_check_save_CPPFLAGS
-  CXXFLAGS=$gst_check_save_CXXFLAGS
-
-    if test x$HAVE_MYTHTV = xno; then
-    USE_MYTHTV=no
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: mythtvsrc" >&5
-$as_echo "$as_me: *** These plugins will be built: mythtvsrc" >&6;}
-  fi
-fi
-if test x$USE_MYTHTV = xyes; then
-  :
-  if test "xmythtvsrc" != "x"; then
-    GST_PLUGINS_YES="\tmythtvsrc\n$GST_PLUGINS_YES"
-  fi
-
-$as_echo "#define HAVE_MYTHTV /**/" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: mythtvsrc" >&5
-$as_echo "$as_me: *** These plugins will not be built: mythtvsrc" >&6;}
-  if test "xmythtvsrc" != "x"; then
-    GST_PLUGINS_NO="\tmythtvsrc\n$GST_PLUGINS_NO"
-  fi
-  :
-fi
- if test x$USE_MYTHTV = xyes; then
-  USE_MYTHTV_TRUE=
-  USE_MYTHTV_FALSE='#'
-else
-  USE_MYTHTV_TRUE='#'
-  USE_MYTHTV_FALSE=
-fi
-
-
-
-echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: nas plug-in ***" >&5
 $as_echo "$as_me: *** checking feature: nas plug-in ***" >&6;}
 if test "xnassink" != "x"
@@ -43632,526 +43691,6 @@
   HAVE_NAS=no
 
   HAVE_NAS="no"
-
-  if test "$no_x" = yes; then
-  # Not all programs may use this symbol, but it does not hurt to define it.
-
-$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h
-
-  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
-else
-  if test -n "$x_includes"; then
-    X_CFLAGS="$X_CFLAGS -I$x_includes"
-  fi
-
-  # It would also be nice to do this for all -L options, not just this one.
-  if test -n "$x_libraries"; then
-    X_LIBS="$X_LIBS -L$x_libraries"
-    # For Solaris; some versions of Sun CC require a space after -R and
-    # others require no space.  Words are not sufficient . . . .
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5
-$as_echo_n "checking whether -R must be followed by a space... " >&6; }
-    ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
-    ac_xsave_c_werror_flag=$ac_c_werror_flag
-    ac_c_werror_flag=yes
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-       X_LIBS="$X_LIBS -R$x_libraries"
-else
-  LIBS="$ac_xsave_LIBS -R $x_libraries"
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	  X_LIBS="$X_LIBS -R $x_libraries"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5
-$as_echo "neither works" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    ac_c_werror_flag=$ac_xsave_c_werror_flag
-    LIBS=$ac_xsave_LIBS
-  fi
-
-  # Check for system-dependent libraries X programs must link with.
-  # Do this before checking for the system-independent R6 libraries
-  # (-lICE), since we may need -lsocket or whatever for X linking.
-
-  if test "$ISC" = yes; then
-    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
-  else
-    # Martyn Johnson says this is needed for Ultrix, if the X
-    # libraries were built with DECnet support.  And Karl Berry says
-    # the Alpha needs dnet_stub (dnet does not exist).
-    ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char XOpenDisplay ();
-int
-main ()
-{
-return XOpenDisplay ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
-$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
-if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldnet  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dnet_ntoa ();
-int
-main ()
-{
-return dnet_ntoa ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dnet_dnet_ntoa=yes
-else
-  ac_cv_lib_dnet_dnet_ntoa=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
-$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
-fi
-
-    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5
-$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; }
-if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldnet_stub  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dnet_ntoa ();
-int
-main ()
-{
-return dnet_ntoa ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dnet_stub_dnet_ntoa=yes
-else
-  ac_cv_lib_dnet_stub_dnet_ntoa=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
-$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
-fi
-
-    fi
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    LIBS="$ac_xsave_LIBS"
-
-    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
-    # to get the SysV transport functions.
-    # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
-    # needs -lnsl.
-    # The nsl library prevents programs from opening the X display
-    # on Irix 5.2, according to T.E. Dickey.
-    # The functions gethostbyname, getservbyname, and inet_addr are
-    # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
-    ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
-if test "x$ac_cv_func_gethostbyname" = xyes; then :
-
-fi
-
-    if test $ac_cv_func_gethostbyname = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
-$as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
-if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_nsl_gethostbyname=yes
-else
-  ac_cv_lib_nsl_gethostbyname=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
-$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
-if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
-fi
-
-      if test $ac_cv_lib_nsl_gethostbyname = no; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5
-$as_echo_n "checking for gethostbyname in -lbsd... " >&6; }
-if ${ac_cv_lib_bsd_gethostbyname+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbsd  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_bsd_gethostbyname=yes
-else
-  ac_cv_lib_bsd_gethostbyname=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5
-$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; }
-if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
-fi
-
-      fi
-    fi
-
-    # lieder@skyler.mavd.honeywell.com says without -lsocket,
-    # socket/setsockopt and other routines are undefined under SCO ODT
-    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
-    # on later versions), says Simon Leinen: it contains gethostby*
-    # variants that don't use the name server (or something).  -lsocket
-    # must be given before -lnsl if both are needed.  We assume that
-    # if connect needs -lnsl, so does gethostbyname.
-    ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
-if test "x$ac_cv_func_connect" = xyes; then :
-
-fi
-
-    if test $ac_cv_func_connect = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
-$as_echo_n "checking for connect in -lsocket... " >&6; }
-if ${ac_cv_lib_socket_connect+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char connect ();
-int
-main ()
-{
-return connect ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_socket_connect=yes
-else
-  ac_cv_lib_socket_connect=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
-$as_echo "$ac_cv_lib_socket_connect" >&6; }
-if test "x$ac_cv_lib_socket_connect" = xyes; then :
-  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
-fi
-
-    fi
-
-    # Guillermo Gomez says -lposix is necessary on A/UX.
-    ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove"
-if test "x$ac_cv_func_remove" = xyes; then :
-
-fi
-
-    if test $ac_cv_func_remove = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5
-$as_echo_n "checking for remove in -lposix... " >&6; }
-if ${ac_cv_lib_posix_remove+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lposix  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char remove ();
-int
-main ()
-{
-return remove ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_posix_remove=yes
-else
-  ac_cv_lib_posix_remove=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5
-$as_echo "$ac_cv_lib_posix_remove" >&6; }
-if test "x$ac_cv_lib_posix_remove" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
-fi
-
-    fi
-
-    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-    ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
-if test "x$ac_cv_func_shmat" = xyes; then :
-
-fi
-
-    if test $ac_cv_func_shmat = no; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5
-$as_echo_n "checking for shmat in -lipc... " >&6; }
-if ${ac_cv_lib_ipc_shmat+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lipc  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shmat ();
-int
-main ()
-{
-return shmat ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ipc_shmat=yes
-else
-  ac_cv_lib_ipc_shmat=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5
-$as_echo "$ac_cv_lib_ipc_shmat" >&6; }
-if test "x$ac_cv_lib_ipc_shmat" = xyes; then :
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
-fi
-
-    fi
-  fi
-
-  # Check for libraries that X11R6 Xt/Xaw programs need.
-  ac_save_LDFLAGS=$LDFLAGS
-  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
-  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
-  # check for ICE first), but we must link in the order -lSM -lICE or
-  # we get undefined symbols.  So assume we have SM if we have ICE.
-  # These have to be linked with before -lX11, unlike the other
-  # libraries we check for below, so use a different variable.
-  # John Interrante, Karl Berry
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5
-$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; }
-if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lICE $X_EXTRA_LIBS $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char IceConnectionNumber ();
-int
-main ()
-{
-return IceConnectionNumber ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ICE_IceConnectionNumber=yes
-else
-  ac_cv_lib_ICE_IceConnectionNumber=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
-$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
-if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then :
-  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
-fi
-
-  LDFLAGS=$ac_save_LDFLAGS
-
-fi
-
-  ac_cflags_save="$CFLAGS"
-  ac_cppflags_save="$CPPFLAGS"
-  CFLAGS="$CFLAGS $X_CFLAGS"
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-    ac_fn_c_check_header_mongrel "$LINENO" "X11/Xlib.h" "ac_cv_header_X11_Xlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_X11_Xlib_h" = xyes; then :
-  HAVE_X="yes"
-else
-  HAVE_X="no"
-fi
-
-
-
-  if test "x$HAVE_X" = "xno"
-  then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: cannot find X11 development files" >&5
-$as_echo "$as_me: cannot find X11 development files" >&6;}
-  else
-        X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
-            X_LIBS="$X_LIBS -lX11"
-
-
-  fi
-
-
-  CFLAGS="$ac_cflags_save"
-  CPPFLAGS="$ac_cppflags_save"
-
   if test "x$HAVE_X" = "xyes"; then
     save_cppflags=$CFLAGS
     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
@@ -45536,6 +45075,189 @@
 
 
 echo
+{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: openh264 library ***" >&5
+$as_echo "$as_me: *** checking feature: openh264 library ***" >&6;}
+if test "xopenh264" != "x"
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: openh264 ***" >&5
+$as_echo "$as_me: *** for plug-ins: openh264 ***" >&6;}
+fi
+NOUSE=
+if test "x$USE_OPENH264" = "xno"; then
+  NOUSE="yes"
+fi
+# Check whether --enable-openh264 was given.
+if test "${enable_openh264+set}" = set; then :
+  enableval=$enable_openh264;  case "${enableval}" in
+      yes) USE_OPENH264=yes;;
+      no) USE_OPENH264=no;;
+      *) as_fn_error $? "bad value ${enableval} for --enable-openh264" "$LINENO" 5 ;;
+    esac
+else
+   USE_OPENH264=yes
+fi
+
+if test "x$NOUSE" = "xyes"; then
+  USE_OPENH264="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** openh264 pre-configured not to be built" >&5
+$as_echo "$as_me: WARNING: *** openh264 pre-configured not to be built" >&2;}
+fi
+NOUSE=
+
+if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " OPENH264 " > /dev/null; then
+  USE_OPENH264="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** openh264 not ported" >&5
+$as_echo "$as_me: WARNING: *** openh264 not ported" >&2;}
+fi
+
+
+if test x$USE_OPENH264 = xyes; then
+
+  gst_check_save_LIBS=$LIBS
+  gst_check_save_LDFLAGS=$LDFLAGS
+  gst_check_save_CFLAGS=$CFLAGS
+  gst_check_save_CPPFLAGS=$CPPFLAGS
+  gst_check_save_CXXFLAGS=$CXXFLAGS
+
+  HAVE_OPENH264=no
+
+
+  which="openh264"
+    required="no"
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENH264" >&5
+$as_echo_n "checking for OPENH264... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$OPENH264_CFLAGS"; then
+        pkg_cv_OPENH264_CFLAGS="$OPENH264_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$which\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "$which") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENH264_CFLAGS=`$PKG_CONFIG --cflags "$which" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$OPENH264_LIBS"; then
+        pkg_cv_OPENH264_LIBS="$OPENH264_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$which\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "$which") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENH264_LIBS=`$PKG_CONFIG --libs "$which" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        OPENH264_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$which"`
+        else
+	        OPENH264_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$which"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$OPENH264_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+      HAVE_OPENH264="no"
+      if test "x$required" = "xyes"; then
+        as_fn_error $? "$OPENH264_PKG_ERRORS" "$LINENO" 5
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: $OPENH264_PKG_ERRORS" >&5
+$as_echo "$as_me: $OPENH264_PKG_ERRORS" >&6;}
+      fi
+
+elif test $pkg_failed = untried; then
+
+      HAVE_OPENH264="no"
+      if test "x$required" = "xyes"; then
+        as_fn_error $? "$OPENH264_PKG_ERRORS" "$LINENO" 5
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: $OPENH264_PKG_ERRORS" >&5
+$as_echo "$as_me: $OPENH264_PKG_ERRORS" >&6;}
+      fi
+
+else
+	OPENH264_CFLAGS=$pkg_cv_OPENH264_CFLAGS
+	OPENH264_LIBS=$pkg_cv_OPENH264_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+      HAVE_OPENH264="yes"
+
+fi
+
+
+
+
+  LIBS=$gst_check_save_LIBS
+  LDFLAGS=$gst_check_save_LDFLAGS
+  CFLAGS=$gst_check_save_CFLAGS
+  CPPFLAGS=$gst_check_save_CPPFLAGS
+  CXXFLAGS=$gst_check_save_CXXFLAGS
+
+    if test x$HAVE_OPENH264 = xno; then
+    USE_OPENH264=no
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: openh264" >&5
+$as_echo "$as_me: *** These plugins will be built: openh264" >&6;}
+  fi
+fi
+if test x$USE_OPENH264 = xyes; then
+  :
+  if test "xopenh264" != "x"; then
+    GST_PLUGINS_YES="\topenh264\n$GST_PLUGINS_YES"
+  fi
+
+$as_echo "#define HAVE_OPENH264 /**/" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: openh264" >&5
+$as_echo "$as_me: *** These plugins will not be built: openh264" >&6;}
+  if test "xopenh264" != "x"; then
+    GST_PLUGINS_NO="\topenh264\n$GST_PLUGINS_NO"
+  fi
+  :
+fi
+ if test x$USE_OPENH264 = xyes; then
+  USE_OPENH264_TRUE=
+  USE_OPENH264_FALSE='#'
+else
+  USE_OPENH264_TRUE='#'
+  USE_OPENH264_FALSE=
+fi
+
+
+
+echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: openjpeg library ***" >&5
 $as_echo "$as_me: *** checking feature: openjpeg library ***" >&6;}
 if test "xopenjpeg" != "x"
@@ -50842,7 +50564,7 @@
 if test "x$ac_cv_header_xvid_h" = xyes; then :
 
     OLD_LIBS="$LIBS"
-    LIBS="-lpthread $LIBM"
+    LIBS="$PTHREAD_LIBS $LIBM"
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xvid_encore in -lxvidcore" >&5
 $as_echo_n "checking for xvid_encore in -lxvidcore... " >&6; }
 if ${ac_cv_lib_xvidcore_xvid_encore+:} false; then :
@@ -53500,7 +53222,86 @@
     LIBGCRYPT_CFLAGS=""
     LIBGCRYPT_LIBS=""
 
-      HAVE_HLS="no"
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL" >&5
+$as_echo_n "checking for OPENSSL... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$OPENSSL_CFLAGS"; then
+        pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$OPENSSL_LIBS"; then
+        pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "openssl"`
+        else
+	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "openssl"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$OPENSSL_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+        HAVE_HLS="no"
+
+elif test $pkg_failed = untried; then
+
+        HAVE_HLS="no"
+
+else
+	OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
+	OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+$as_echo "#define HAVE_OPENSSL 1" >>confdefs.h
+
+        HAVE_HLS="yes"
+
+fi
 
   fi
 
@@ -53724,7 +53525,86 @@
     LIBGCRYPT_CFLAGS=""
     LIBGCRYPT_LIBS=""
 
-      HAVE_HLS="no"
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL" >&5
+$as_echo_n "checking for OPENSSL... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$OPENSSL_CFLAGS"; then
+        pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$OPENSSL_LIBS"; then
+        pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "openssl"`
+        else
+	        OPENSSL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "openssl"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$OPENSSL_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+        HAVE_HLS="no"
+
+elif test $pkg_failed = untried; then
+
+        HAVE_HLS="no"
+
+else
+	OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
+	OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+$as_echo "#define HAVE_OPENSSL 1" >>confdefs.h
+
+        HAVE_HLS="yes"
+
+fi
 
   fi
 
@@ -53784,6 +53664,189 @@
 
 
 
+echo
+{ $as_echo "$as_me:${as_lineno-$LINENO}: *** checking feature: x265 plug-in ***" >&5
+$as_echo "$as_me: *** checking feature: x265 plug-in ***" >&6;}
+if test "xx265" != "x"
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** for plug-ins: x265 ***" >&5
+$as_echo "$as_me: *** for plug-ins: x265 ***" >&6;}
+fi
+NOUSE=
+if test "x$USE_X265" = "xno"; then
+  NOUSE="yes"
+fi
+# Check whether --enable-x265 was given.
+if test "${enable_x265+set}" = set; then :
+  enableval=$enable_x265;  case "${enableval}" in
+      yes) USE_X265=yes;;
+      no) USE_X265=no;;
+      *) as_fn_error $? "bad value ${enableval} for --enable-x265" "$LINENO" 5 ;;
+    esac
+else
+   USE_X265=yes
+fi
+
+if test "x$NOUSE" = "xyes"; then
+  USE_X265="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** x265 pre-configured not to be built" >&5
+$as_echo "$as_me: WARNING: *** x265 pre-configured not to be built" >&2;}
+fi
+NOUSE=
+
+if echo " $GST_PLUGINS_NONPORTED " | tr , ' ' | grep -i " X265 " > /dev/null; then
+  USE_X265="no"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** x265 not ported" >&5
+$as_echo "$as_me: WARNING: *** x265 not ported" >&2;}
+fi
+
+
+if test x$USE_X265 = xyes; then
+
+  gst_check_save_LIBS=$LIBS
+  gst_check_save_LDFLAGS=$LDFLAGS
+  gst_check_save_CFLAGS=$CFLAGS
+  gst_check_save_CPPFLAGS=$CPPFLAGS
+  gst_check_save_CXXFLAGS=$CXXFLAGS
+
+  HAVE_X265=no
+
+
+  which="x265"
+    required="no"
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X265" >&5
+$as_echo_n "checking for X265... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$X265_CFLAGS"; then
+        pkg_cv_X265_CFLAGS="$X265_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$which\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "$which") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_X265_CFLAGS=`$PKG_CONFIG --cflags "$which" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$X265_LIBS"; then
+        pkg_cv_X265_LIBS="$X265_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$which\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "$which") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_X265_LIBS=`$PKG_CONFIG --libs "$which" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        X265_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$which"`
+        else
+	        X265_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$which"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$X265_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+      HAVE_X265="no"
+      if test "x$required" = "xyes"; then
+        as_fn_error $? "$X265_PKG_ERRORS" "$LINENO" 5
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: $X265_PKG_ERRORS" >&5
+$as_echo "$as_me: $X265_PKG_ERRORS" >&6;}
+      fi
+
+elif test $pkg_failed = untried; then
+
+      HAVE_X265="no"
+      if test "x$required" = "xyes"; then
+        as_fn_error $? "$X265_PKG_ERRORS" "$LINENO" 5
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: $X265_PKG_ERRORS" >&5
+$as_echo "$as_me: $X265_PKG_ERRORS" >&6;}
+      fi
+
+else
+	X265_CFLAGS=$pkg_cv_X265_CFLAGS
+	X265_LIBS=$pkg_cv_X265_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+      HAVE_X265="yes"
+
+fi
+
+
+
+
+  LIBS=$gst_check_save_LIBS
+  LDFLAGS=$gst_check_save_LDFLAGS
+  CFLAGS=$gst_check_save_CFLAGS
+  CPPFLAGS=$gst_check_save_CPPFLAGS
+  CXXFLAGS=$gst_check_save_CXXFLAGS
+
+    if test x$HAVE_X265 = xno; then
+    USE_X265=no
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will be built: x265" >&5
+$as_echo "$as_me: *** These plugins will be built: x265" >&6;}
+  fi
+fi
+if test x$USE_X265 = xyes; then
+  :
+  if test "xx265" != "x"; then
+    GST_PLUGINS_YES="\tx265\n$GST_PLUGINS_YES"
+  fi
+
+$as_echo "#define HAVE_X265 /**/" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: *** These plugins will not be built: x265" >&5
+$as_echo "$as_me: *** These plugins will not be built: x265" >&6;}
+  if test "xx265" != "x"; then
+    GST_PLUGINS_NO="\tx265\n$GST_PLUGINS_NO"
+  fi
+  :
+fi
+ if test x$USE_X265 = xyes; then
+  USE_X265_TRUE=
+  USE_X265_FALSE='#'
+else
+  USE_X265_TRUE='#'
+  USE_X265_FALSE=
+fi
+
+
+
 else
 
 
@@ -53820,6 +53883,14 @@
 fi
 
  if false; then
+  USE_BS2B_TRUE=
+  USE_BS2B_FALSE='#'
+else
+  USE_BS2B_TRUE='#'
+  USE_BS2B_FALSE=
+fi
+
+ if false; then
   USE_BZ2_TRUE=
   USE_BZ2_FALSE='#'
 else
@@ -54028,6 +54099,14 @@
 fi
 
  if false; then
+  USE_LIBDE265_TRUE=
+  USE_LIBDE265_FALSE='#'
+else
+  USE_LIBDE265_TRUE='#'
+  USE_LIBDE265_FALSE=
+fi
+
+ if false; then
   USE_LIBMMS_TRUE=
   USE_LIBMMS_FALSE='#'
 else
@@ -54092,14 +54171,6 @@
 fi
 
  if false; then
-  USE_MYTHTV_TRUE=
-  USE_MYTHTV_FALSE='#'
-else
-  USE_MYTHTV_TRUE='#'
-  USE_MYTHTV_FALSE=
-fi
-
- if false; then
   USE_NAS_TRUE=
   USE_NAS_FALSE='#'
 else
@@ -54387,6 +54458,30 @@
   USE_WEBP_FALSE=
 fi
 
+ if false; then
+  USE_OPENH264_TRUE=
+  USE_OPENH264_FALSE='#'
+else
+  USE_OPENH264_TRUE='#'
+  USE_OPENH264_FALSE=
+fi
+
+ if false; then
+  USE_X265_TRUE=
+  USE_X265_FALSE='#'
+else
+  USE_X265_TRUE='#'
+  USE_X265_FALSE=
+fi
+
+ if false; then
+  USE_DTLS_TRUE=
+  USE_DTLS_FALSE='#'
+else
+  USE_DTLS_TRUE='#'
+  USE_DTLS_FALSE=
+fi
+
 
 fi
 
@@ -54438,7 +54533,7 @@
 $MKDIR_P tests/check/orc
 
 
-ac_config_files="$ac_config_files Makefile common/Makefile common/m4/Makefile gst-plugins-bad.spec gst/Makefile gst/accurip/Makefile gst/adpcmdec/Makefile gst/adpcmenc/Makefile gst/aiff/Makefile gst/asfmux/Makefile gst/audiofxbad/Makefile gst/audiomixer/Makefile gst/audiovisualizers/Makefile gst/autoconvert/Makefile gst/bayer/Makefile gst/camerabin2/Makefile gst/cdxaparse/Makefile gst/coloreffects/Makefile gst/dataurisrc/Makefile gst/dccp/Makefile gst/debugutils/Makefile gst/dvbsuboverlay/Makefile gst/dvdspu/Makefile gst/faceoverlay/Makefile gst/festival/Makefile gst/fieldanalysis/Makefile gst/freeverb/Makefile gst/frei0r/Makefile gst/gaudieffects/Makefile gst/geometrictransform/Makefile gst/gdp/Makefile gst/hdvparse/Makefile gst/id3tag/Makefile gst/inter/Makefile gst/interlace/Makefile gst/ivfparse/Makefile gst/ivtc/Makefile gst/jp2kdecimator/Makefile gst/jpegformat/Makefile gst/librfb/Makefile gst/liveadder/Makefile gst/midi/Makefile gst/mpegdemux/Makefile gst/mpegtsdemux/Makefile gst/mpegtsmux/Makefile gst/mpegtsmux/tsmux/Makefile gst/mpegpsmux/Makefile gst/mve/Makefile gst/mxf/Makefile gst/nuvdemux/Makefile gst/patchdetect/Makefile gst/pcapparse/Makefile gst/pnm/Makefile gst/rawparse/Makefile gst/real/Makefile gst/removesilence/Makefile gst/sdi/Makefile gst/sdp/Makefile gst/segmentclip/Makefile gst/siren/Makefile gst/smooth/Makefile gst/speed/Makefile gst/subenc/Makefile gst/stereo/Makefile gst/tta/Makefile gst/videofilters/Makefile gst/videomeasure/Makefile gst/videoparsers/Makefile gst/videosignal/Makefile gst/vmnc/Makefile gst/y4m/Makefile gst/yadif/Makefile gst/compositor/Makefile gst-libs/Makefile gst-libs/gst/Makefile gst-libs/gst/basecamerabinsrc/Makefile gst-libs/gst/gl/Makefile gst-libs/gst/gl/android/Makefile gst-libs/gst/gl/cocoa/Makefile gst-libs/gst/gl/dispmanx/Makefile gst-libs/gst/gl/glprototypes/Makefile gst-libs/gst/gl/eagl/Makefile gst-libs/gst/gl/egl/Makefile gst-libs/gst/gl/wayland/Makefile gst-libs/gst/gl/win32/Makefile gst-libs/gst/gl/x11/Makefile gst-libs/gst/insertbin/Makefile gst-libs/gst/interfaces/Makefile gst-libs/gst/codecparsers/Makefile gst-libs/gst/mpegts/Makefile gst-libs/gst/uridownloader/Makefile gst-libs/gst/wayland/Makefile gst-libs/gst/base/Makefile gst-libs/gst/video/Makefile sys/Makefile sys/dshowdecwrapper/Makefile sys/acmenc/Makefile sys/acmmp3dec/Makefile sys/androidmedia/Makefile sys/applemedia/Makefile sys/applemedia-nonpublic/Makefile sys/avc/Makefile sys/bluez/Makefile sys/d3dvideosink/Makefile sys/decklink/Makefile sys/directdraw/Makefile sys/directsound/Makefile sys/dshowsrcwrapper/Makefile sys/dshowvideosink/Makefile sys/dvb/Makefile sys/fbdev/Makefile sys/linsys/Makefile sys/opensles/Makefile sys/osxvideo/Makefile sys/qtwrapper/Makefile sys/shm/Makefile sys/uvch264/Makefile sys/vcd/Makefile sys/vdpau/Makefile sys/pvr2d/Makefile sys/wasapi/Makefile sys/wininet/Makefile sys/winks/Makefile sys/winscreencap/Makefile tests/Makefile tests/check/Makefile tests/files/Makefile tests/examples/Makefile tests/examples/camerabin2/Makefile tests/examples/directfb/Makefile tests/examples/gl/Makefile tests/examples/gl/cocoa/Makefile tests/examples/gl/clutter/Makefile tests/examples/gl/generic/Makefile tests/examples/gl/generic/cube/Makefile tests/examples/gl/generic/cubeyuv/Makefile tests/examples/gl/generic/doublecube/Makefile tests/examples/gl/generic/recordgraphic/Makefile tests/examples/gl/gtk/Makefile tests/examples/gl/gtk/gtkvideooverlay/Makefile tests/examples/gl/gtk/filternovideooverlay/Makefile tests/examples/gl/gtk/filtervideooverlay/Makefile tests/examples/gl/gtk/fxtest/Makefile tests/examples/gl/gtk/switchvideooverlay/Makefile tests/examples/gl/qt/Makefile tests/examples/gl/sdl/Makefile tests/examples/mpegts/Makefile tests/examples/mxf/Makefile tests/examples/opencv/Makefile tests/examples/uvch264/Makefile tests/icles/Makefile ext/voamrwbenc/Makefile ext/voaacenc/Makefile ext/assrender/Makefile ext/apexsink/Makefile ext/bz2/Makefile ext/chromaprint/Makefile ext/curl/Makefile ext/dash/Makefile ext/dc1394/Makefile ext/directfb/Makefile ext/wayland/Makefile ext/daala/Makefile ext/dts/Makefile ext/gl/Makefile ext/faac/Makefile ext/faad/Makefile ext/flite/Makefile ext/fluidsynth/Makefile ext/gsm/Makefile ext/hls/Makefile ext/kate/Makefile ext/ladspa/Makefile ext/lv2/Makefile ext/libmms/Makefile ext/libvisual/Makefile ext/Makefile ext/modplug/Makefile ext/mpeg2enc/Makefile ext/mpg123/Makefile ext/mimic/Makefile ext/mplex/Makefile ext/musepack/Makefile ext/mythtv/Makefile ext/nas/Makefile ext/neon/Makefile ext/ofa/Makefile ext/openal/Makefile ext/opencv/Makefile ext/openexr/Makefile ext/openjpeg/Makefile ext/openni2/Makefile ext/opus/Makefile ext/rsvg/Makefile ext/resindvd/Makefile ext/rtmp/Makefile ext/sbc/Makefile ext/schroedinger/Makefile ext/sdl/Makefile ext/smoothstreaming/Makefile ext/sndfile/Makefile ext/soundtouch/Makefile ext/spandsp/Makefile ext/sndio/Makefile ext/srtp/Makefile ext/teletextdec/Makefile ext/gme/Makefile ext/gsettings/Makefile ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml ext/spc/Makefile ext/timidity/Makefile ext/webp/Makefile ext/xvid/Makefile ext/zbar/Makefile po/Makefile.in docs/Makefile docs/plugins/Makefile docs/libs/Makefile docs/version.entities pkgconfig/Makefile pkgconfig/gstreamer-plugins-bad.pc pkgconfig/gstreamer-plugins-bad-uninstalled.pc pkgconfig/gstreamer-codecparsers.pc pkgconfig/gstreamer-codecparsers-uninstalled.pc pkgconfig/gstreamer-insertbin.pc pkgconfig/gstreamer-insertbin-uninstalled.pc pkgconfig/gstreamer-gl.pc pkgconfig/gstreamer-gl-uninstalled.pc pkgconfig/gstreamer-mpegts.pc pkgconfig/gstreamer-mpegts-uninstalled.pc pkgconfig/gstreamer-wayland.pc pkgconfig/gstreamer-wayland-uninstalled.pc pkgconfig/gstreamer-bad-base.pc pkgconfig/gstreamer-bad-base-uninstalled.pc pkgconfig/gstreamer-bad-video.pc pkgconfig/gstreamer-bad-video-uninstalled.pc tools/Makefile m4/Makefile"
+ac_config_files="$ac_config_files Makefile common/Makefile common/m4/Makefile gst-plugins-bad.spec gst/Makefile gst/accurip/Makefile gst/adpcmdec/Makefile gst/adpcmenc/Makefile gst/aiff/Makefile gst/asfmux/Makefile gst/audiofxbad/Makefile gst/audiomixer/Makefile gst/audiovisualizers/Makefile gst/autoconvert/Makefile gst/bayer/Makefile gst/camerabin2/Makefile gst/cdxaparse/Makefile gst/coloreffects/Makefile gst/dataurisrc/Makefile gst/dccp/Makefile gst/debugutils/Makefile gst/dvbsuboverlay/Makefile gst/dvdspu/Makefile gst/faceoverlay/Makefile gst/festival/Makefile gst/fieldanalysis/Makefile gst/freeverb/Makefile gst/frei0r/Makefile gst/gaudieffects/Makefile gst/geometrictransform/Makefile gst/gdp/Makefile gst/hdvparse/Makefile gst/id3tag/Makefile gst/inter/Makefile gst/interlace/Makefile gst/ivfparse/Makefile gst/ivtc/Makefile gst/jp2kdecimator/Makefile gst/jpegformat/Makefile gst/librfb/Makefile gst/liveadder/Makefile gst/midi/Makefile gst/mpegdemux/Makefile gst/mpegtsdemux/Makefile gst/mpegtsmux/Makefile gst/mpegtsmux/tsmux/Makefile gst/mpegpsmux/Makefile gst/mve/Makefile gst/mxf/Makefile gst/nuvdemux/Makefile gst/onvif/Makefile gst/patchdetect/Makefile gst/pcapparse/Makefile gst/pnm/Makefile gst/rawparse/Makefile gst/removesilence/Makefile gst/rtp/Makefile gst/sdi/Makefile gst/sdp/Makefile gst/segmentclip/Makefile gst/siren/Makefile gst/smooth/Makefile gst/speed/Makefile gst/subenc/Makefile gst/stereo/Makefile gst/tta/Makefile gst/videofilters/Makefile gst/videomeasure/Makefile gst/videoparsers/Makefile gst/videosignal/Makefile gst/vmnc/Makefile gst/y4m/Makefile gst/yadif/Makefile gst/compositor/Makefile gst-libs/Makefile gst-libs/gst/Makefile gst-libs/gst/adaptivedemux/Makefile gst-libs/gst/basecamerabinsrc/Makefile gst-libs/gst/gl/Makefile gst-libs/gst/gl/android/Makefile gst-libs/gst/gl/cocoa/Makefile gst-libs/gst/gl/dispmanx/Makefile gst-libs/gst/gl/glprototypes/Makefile gst-libs/gst/gl/eagl/Makefile gst-libs/gst/gl/egl/Makefile gst-libs/gst/gl/wayland/Makefile gst-libs/gst/gl/win32/Makefile gst-libs/gst/gl/x11/Makefile gst-libs/gst/insertbin/Makefile gst-libs/gst/interfaces/Makefile gst-libs/gst/codecparsers/Makefile gst-libs/gst/mpegts/Makefile gst-libs/gst/uridownloader/Makefile gst-libs/gst/wayland/Makefile gst-libs/gst/base/Makefile gst-libs/gst/video/Makefile sys/Makefile sys/dshowdecwrapper/Makefile sys/acmenc/Makefile sys/acmmp3dec/Makefile sys/androidmedia/Makefile sys/applemedia/Makefile sys/applemedia-nonpublic/Makefile sys/avc/Makefile sys/bluez/Makefile sys/d3dvideosink/Makefile sys/decklink/Makefile sys/directsound/Makefile sys/dshowsrcwrapper/Makefile sys/dshowvideosink/Makefile sys/dvb/Makefile sys/fbdev/Makefile sys/linsys/Makefile sys/opensles/Makefile sys/shm/Makefile sys/uvch264/Makefile sys/vcd/Makefile sys/vdpau/Makefile sys/pvr2d/Makefile sys/wasapi/Makefile sys/wininet/Makefile sys/winks/Makefile sys/winscreencap/Makefile tests/Makefile tests/check/Makefile tests/files/Makefile tests/examples/Makefile tests/examples/avsamplesink/Makefile tests/examples/camerabin2/Makefile tests/examples/directfb/Makefile tests/examples/gl/Makefile tests/examples/gl/cocoa/Makefile tests/examples/gl/clutter/Makefile tests/examples/gl/generic/Makefile tests/examples/gl/generic/cube/Makefile tests/examples/gl/generic/cubeyuv/Makefile tests/examples/gl/generic/doublecube/Makefile tests/examples/gl/generic/recordgraphic/Makefile tests/examples/gl/gtk/Makefile tests/examples/gl/gtk/gtkvideooverlay/Makefile tests/examples/gl/gtk/filternovideooverlay/Makefile tests/examples/gl/gtk/filtervideooverlay/Makefile tests/examples/gl/gtk/fxtest/Makefile tests/examples/gl/gtk/switchvideooverlay/Makefile tests/examples/gl/qt/Makefile tests/examples/gl/sdl/Makefile tests/examples/mpegts/Makefile tests/examples/mxf/Makefile tests/examples/opencv/Makefile tests/examples/uvch264/Makefile tests/icles/Makefile ext/voamrwbenc/Makefile ext/voaacenc/Makefile ext/assrender/Makefile ext/apexsink/Makefile ext/bs2b/Makefile ext/bz2/Makefile ext/chromaprint/Makefile ext/curl/Makefile ext/dash/Makefile ext/dc1394/Makefile ext/directfb/Makefile ext/wayland/Makefile ext/daala/Makefile ext/dts/Makefile ext/gl/Makefile ext/faac/Makefile ext/faad/Makefile ext/flite/Makefile ext/fluidsynth/Makefile ext/gsm/Makefile ext/hls/Makefile ext/kate/Makefile ext/ladspa/Makefile ext/lv2/Makefile ext/libde265/Makefile ext/libmms/Makefile ext/libvisual/Makefile ext/Makefile ext/modplug/Makefile ext/mpeg2enc/Makefile ext/mpg123/Makefile ext/mimic/Makefile ext/mplex/Makefile ext/musepack/Makefile ext/nas/Makefile ext/neon/Makefile ext/ofa/Makefile ext/openal/Makefile ext/opencv/Makefile ext/openexr/Makefile ext/openh264/Makefile ext/openjpeg/Makefile ext/openni2/Makefile ext/opus/Makefile ext/rsvg/Makefile ext/resindvd/Makefile ext/rtmp/Makefile ext/sbc/Makefile ext/schroedinger/Makefile ext/sdl/Makefile ext/smoothstreaming/Makefile ext/sndfile/Makefile ext/soundtouch/Makefile ext/spandsp/Makefile ext/sndio/Makefile ext/srtp/Makefile ext/teletextdec/Makefile ext/gme/Makefile ext/gsettings/Makefile ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml ext/spc/Makefile ext/timidity/Makefile ext/webp/Makefile ext/x265/Makefile ext/xvid/Makefile ext/zbar/Makefile ext/dtls/Makefile po/Makefile.in docs/Makefile docs/plugins/Makefile docs/libs/Makefile docs/version.entities pkgconfig/Makefile pkgconfig/gstreamer-plugins-bad.pc pkgconfig/gstreamer-plugins-bad-uninstalled.pc pkgconfig/gstreamer-codecparsers.pc pkgconfig/gstreamer-codecparsers-uninstalled.pc pkgconfig/gstreamer-insertbin.pc pkgconfig/gstreamer-insertbin-uninstalled.pc pkgconfig/gstreamer-gl.pc pkgconfig/gstreamer-gl-uninstalled.pc pkgconfig/gstreamer-mpegts.pc pkgconfig/gstreamer-mpegts-uninstalled.pc pkgconfig/gstreamer-wayland.pc pkgconfig/gstreamer-wayland-uninstalled.pc pkgconfig/gstreamer-bad-base.pc pkgconfig/gstreamer-bad-base-uninstalled.pc pkgconfig/gstreamer-bad-video.pc pkgconfig/gstreamer-bad-video-uninstalled.pc tools/Makefile m4/Makefile"
 
 
 sed \
@@ -54656,6 +54751,10 @@
   as_fn_error $? "conditional \"HAVE_CPU_ALPHA\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${HAVE_CPU_ARC_TRUE}" && test -z "${HAVE_CPU_ARC_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_CPU_ARC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${HAVE_CPU_ARM_TRUE}" && test -z "${HAVE_CPU_ARM_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_CPU_ARM\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -54981,6 +55080,10 @@
   as_fn_error $? "conditional \"USE_PLUGIN_NUVDEMUX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_PLUGIN_ONVIF_TRUE}" && test -z "${USE_PLUGIN_ONVIF_FALSE}"; then
+  as_fn_error $? "conditional \"USE_PLUGIN_ONVIF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_PLUGIN_PATCHDETECT_TRUE}" && test -z "${USE_PLUGIN_PATCHDETECT_FALSE}"; then
   as_fn_error $? "conditional \"USE_PLUGIN_PATCHDETECT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -54997,14 +55100,14 @@
   as_fn_error $? "conditional \"USE_PLUGIN_RAWPARSE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_PLUGIN_REAL_TRUE}" && test -z "${USE_PLUGIN_REAL_FALSE}"; then
-  as_fn_error $? "conditional \"USE_PLUGIN_REAL\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_PLUGIN_REMOVESILENCE_TRUE}" && test -z "${USE_PLUGIN_REMOVESILENCE_FALSE}"; then
   as_fn_error $? "conditional \"USE_PLUGIN_REMOVESILENCE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_PLUGIN_RTP_TRUE}" && test -z "${USE_PLUGIN_RTP_FALSE}"; then
+  as_fn_error $? "conditional \"USE_PLUGIN_RTP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_PLUGIN_SDI_TRUE}" && test -z "${USE_PLUGIN_SDI_FALSE}"; then
   as_fn_error $? "conditional \"USE_PLUGIN_SDI\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55069,10 +55172,6 @@
   as_fn_error $? "conditional \"USE_PLUGIN_YADIF\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_PLUGIN_REAL_TRUE}" && test -z "${USE_PLUGIN_REAL_FALSE}"; then
-  as_fn_error $? "conditional \"USE_PLUGIN_REAL\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${HAVE_AVFOUNDATION_TRUE}" && test -z "${HAVE_AVFOUNDATION_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_AVFOUNDATION\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55177,10 +55276,6 @@
   as_fn_error $? "conditional \"USE_DIRECT3D\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_DIRECTDRAW_TRUE}" && test -z "${USE_DIRECTDRAW_FALSE}"; then
-  as_fn_error $? "conditional \"USE_DIRECTDRAW\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_WINSCREENCAP_TRUE}" && test -z "${USE_WINSCREENCAP_FALSE}"; then
   as_fn_error $? "conditional \"USE_WINSCREENCAP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55201,18 +55296,10 @@
   as_fn_error $? "conditional \"USE_BLUEZ\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_OSX_VIDEO_TRUE}" && test -z "${USE_OSX_VIDEO_FALSE}"; then
-  as_fn_error $? "conditional \"USE_OSX_VIDEO\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_AVC_TRUE}" && test -z "${USE_AVC_FALSE}"; then
   as_fn_error $? "conditional \"USE_AVC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_QUICKTIME_TRUE}" && test -z "${USE_QUICKTIME_FALSE}"; then
-  as_fn_error $? "conditional \"USE_QUICKTIME\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_SHM_TRUE}" && test -z "${USE_SHM_FALSE}"; then
   as_fn_error $? "conditional \"USE_SHM\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55245,6 +55332,10 @@
   as_fn_error $? "conditional \"USE_APEXSINK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_BS2B_TRUE}" && test -z "${USE_BS2B_FALSE}"; then
+  as_fn_error $? "conditional \"USE_BS2B\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_BZ2_TRUE}" && test -z "${USE_BZ2_FALSE}"; then
   as_fn_error $? "conditional \"USE_BZ2\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55349,6 +55440,10 @@
   as_fn_error $? "conditional \"USE_LV2\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_LIBDE265_TRUE}" && test -z "${USE_LIBDE265_FALSE}"; then
+  as_fn_error $? "conditional \"USE_LIBDE265\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_LIBMMS_TRUE}" && test -z "${USE_LIBMMS_FALSE}"; then
   as_fn_error $? "conditional \"USE_LIBMMS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55357,6 +55452,10 @@
   as_fn_error $? "conditional \"USE_SRTP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_DTLS_TRUE}" && test -z "${USE_DTLS_FALSE}"; then
+  as_fn_error $? "conditional \"USE_DTLS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_LINSYS_TRUE}" && test -z "${USE_LINSYS_FALSE}"; then
   as_fn_error $? "conditional \"USE_LINSYS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55385,10 +55484,6 @@
   as_fn_error $? "conditional \"USE_MUSEPACK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_MYTHTV_TRUE}" && test -z "${USE_MYTHTV_FALSE}"; then
-  as_fn_error $? "conditional \"USE_MYTHTV\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_NAS_TRUE}" && test -z "${USE_NAS_FALSE}"; then
   as_fn_error $? "conditional \"USE_NAS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55417,6 +55512,10 @@
   as_fn_error $? "conditional \"USE_OPENEXR\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_OPENH264_TRUE}" && test -z "${USE_OPENH264_FALSE}"; then
+  as_fn_error $? "conditional \"USE_OPENH264\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_OPENJPEG_TRUE}" && test -z "${USE_OPENJPEG_FALSE}"; then
   as_fn_error $? "conditional \"USE_OPENJPEG\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55533,6 +55632,10 @@
   as_fn_error $? "conditional \"USE_HLS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_X265_TRUE}" && test -z "${USE_X265_FALSE}"; then
+  as_fn_error $? "conditional \"USE_X265\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_ASSRENDER_TRUE}" && test -z "${USE_ASSRENDER_FALSE}"; then
   as_fn_error $? "conditional \"USE_ASSRENDER\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55549,6 +55652,10 @@
   as_fn_error $? "conditional \"USE_APEXSINK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_BS2B_TRUE}" && test -z "${USE_BS2B_FALSE}"; then
+  as_fn_error $? "conditional \"USE_BS2B\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_BZ2_TRUE}" && test -z "${USE_BZ2_FALSE}"; then
   as_fn_error $? "conditional \"USE_BZ2\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55653,6 +55760,10 @@
   as_fn_error $? "conditional \"USE_LV2\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_LIBDE265_TRUE}" && test -z "${USE_LIBDE265_FALSE}"; then
+  as_fn_error $? "conditional \"USE_LIBDE265\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_LIBMMS_TRUE}" && test -z "${USE_LIBMMS_FALSE}"; then
   as_fn_error $? "conditional \"USE_LIBMMS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55685,10 +55796,6 @@
   as_fn_error $? "conditional \"USE_MUSEPACK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_MYTHTV_TRUE}" && test -z "${USE_MYTHTV_FALSE}"; then
-  as_fn_error $? "conditional \"USE_MYTHTV\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_NAS_TRUE}" && test -z "${USE_NAS_FALSE}"; then
   as_fn_error $? "conditional \"USE_NAS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -55833,6 +55940,18 @@
   as_fn_error $? "conditional \"USE_WEBP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_OPENH264_TRUE}" && test -z "${USE_OPENH264_FALSE}"; then
+  as_fn_error $? "conditional \"USE_OPENH264\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${USE_X265_TRUE}" && test -z "${USE_X265_FALSE}"; then
+  as_fn_error $? "conditional \"USE_X265\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${USE_DTLS_TRUE}" && test -z "${USE_DTLS_FALSE}"; then
+  as_fn_error $? "conditional \"USE_DTLS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
@@ -56230,7 +56349,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by GStreamer Bad Plug-ins $as_me 1.4.5, which was
+This file was extended by GStreamer Bad Plug-ins $as_me 1.5.0.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -56296,7 +56415,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-GStreamer Bad Plug-ins config.status 1.4.5
+GStreamer Bad Plug-ins config.status 1.5.0.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -56886,12 +57005,13 @@
     "gst/mve/Makefile") CONFIG_FILES="$CONFIG_FILES gst/mve/Makefile" ;;
     "gst/mxf/Makefile") CONFIG_FILES="$CONFIG_FILES gst/mxf/Makefile" ;;
     "gst/nuvdemux/Makefile") CONFIG_FILES="$CONFIG_FILES gst/nuvdemux/Makefile" ;;
+    "gst/onvif/Makefile") CONFIG_FILES="$CONFIG_FILES gst/onvif/Makefile" ;;
     "gst/patchdetect/Makefile") CONFIG_FILES="$CONFIG_FILES gst/patchdetect/Makefile" ;;
     "gst/pcapparse/Makefile") CONFIG_FILES="$CONFIG_FILES gst/pcapparse/Makefile" ;;
     "gst/pnm/Makefile") CONFIG_FILES="$CONFIG_FILES gst/pnm/Makefile" ;;
     "gst/rawparse/Makefile") CONFIG_FILES="$CONFIG_FILES gst/rawparse/Makefile" ;;
-    "gst/real/Makefile") CONFIG_FILES="$CONFIG_FILES gst/real/Makefile" ;;
     "gst/removesilence/Makefile") CONFIG_FILES="$CONFIG_FILES gst/removesilence/Makefile" ;;
+    "gst/rtp/Makefile") CONFIG_FILES="$CONFIG_FILES gst/rtp/Makefile" ;;
     "gst/sdi/Makefile") CONFIG_FILES="$CONFIG_FILES gst/sdi/Makefile" ;;
     "gst/sdp/Makefile") CONFIG_FILES="$CONFIG_FILES gst/sdp/Makefile" ;;
     "gst/segmentclip/Makefile") CONFIG_FILES="$CONFIG_FILES gst/segmentclip/Makefile" ;;
@@ -56911,6 +57031,7 @@
     "gst/compositor/Makefile") CONFIG_FILES="$CONFIG_FILES gst/compositor/Makefile" ;;
     "gst-libs/Makefile") CONFIG_FILES="$CONFIG_FILES gst-libs/Makefile" ;;
     "gst-libs/gst/Makefile") CONFIG_FILES="$CONFIG_FILES gst-libs/gst/Makefile" ;;
+    "gst-libs/gst/adaptivedemux/Makefile") CONFIG_FILES="$CONFIG_FILES gst-libs/gst/adaptivedemux/Makefile" ;;
     "gst-libs/gst/basecamerabinsrc/Makefile") CONFIG_FILES="$CONFIG_FILES gst-libs/gst/basecamerabinsrc/Makefile" ;;
     "gst-libs/gst/gl/Makefile") CONFIG_FILES="$CONFIG_FILES gst-libs/gst/gl/Makefile" ;;
     "gst-libs/gst/gl/android/Makefile") CONFIG_FILES="$CONFIG_FILES gst-libs/gst/gl/android/Makefile" ;;
@@ -56941,7 +57062,6 @@
     "sys/bluez/Makefile") CONFIG_FILES="$CONFIG_FILES sys/bluez/Makefile" ;;
     "sys/d3dvideosink/Makefile") CONFIG_FILES="$CONFIG_FILES sys/d3dvideosink/Makefile" ;;
     "sys/decklink/Makefile") CONFIG_FILES="$CONFIG_FILES sys/decklink/Makefile" ;;
-    "sys/directdraw/Makefile") CONFIG_FILES="$CONFIG_FILES sys/directdraw/Makefile" ;;
     "sys/directsound/Makefile") CONFIG_FILES="$CONFIG_FILES sys/directsound/Makefile" ;;
     "sys/dshowsrcwrapper/Makefile") CONFIG_FILES="$CONFIG_FILES sys/dshowsrcwrapper/Makefile" ;;
     "sys/dshowvideosink/Makefile") CONFIG_FILES="$CONFIG_FILES sys/dshowvideosink/Makefile" ;;
@@ -56949,8 +57069,6 @@
     "sys/fbdev/Makefile") CONFIG_FILES="$CONFIG_FILES sys/fbdev/Makefile" ;;
     "sys/linsys/Makefile") CONFIG_FILES="$CONFIG_FILES sys/linsys/Makefile" ;;
     "sys/opensles/Makefile") CONFIG_FILES="$CONFIG_FILES sys/opensles/Makefile" ;;
-    "sys/osxvideo/Makefile") CONFIG_FILES="$CONFIG_FILES sys/osxvideo/Makefile" ;;
-    "sys/qtwrapper/Makefile") CONFIG_FILES="$CONFIG_FILES sys/qtwrapper/Makefile" ;;
     "sys/shm/Makefile") CONFIG_FILES="$CONFIG_FILES sys/shm/Makefile" ;;
     "sys/uvch264/Makefile") CONFIG_FILES="$CONFIG_FILES sys/uvch264/Makefile" ;;
     "sys/vcd/Makefile") CONFIG_FILES="$CONFIG_FILES sys/vcd/Makefile" ;;
@@ -56964,6 +57082,7 @@
     "tests/check/Makefile") CONFIG_FILES="$CONFIG_FILES tests/check/Makefile" ;;
     "tests/files/Makefile") CONFIG_FILES="$CONFIG_FILES tests/files/Makefile" ;;
     "tests/examples/Makefile") CONFIG_FILES="$CONFIG_FILES tests/examples/Makefile" ;;
+    "tests/examples/avsamplesink/Makefile") CONFIG_FILES="$CONFIG_FILES tests/examples/avsamplesink/Makefile" ;;
     "tests/examples/camerabin2/Makefile") CONFIG_FILES="$CONFIG_FILES tests/examples/camerabin2/Makefile" ;;
     "tests/examples/directfb/Makefile") CONFIG_FILES="$CONFIG_FILES tests/examples/directfb/Makefile" ;;
     "tests/examples/gl/Makefile") CONFIG_FILES="$CONFIG_FILES tests/examples/gl/Makefile" ;;
@@ -56991,6 +57110,7 @@
     "ext/voaacenc/Makefile") CONFIG_FILES="$CONFIG_FILES ext/voaacenc/Makefile" ;;
     "ext/assrender/Makefile") CONFIG_FILES="$CONFIG_FILES ext/assrender/Makefile" ;;
     "ext/apexsink/Makefile") CONFIG_FILES="$CONFIG_FILES ext/apexsink/Makefile" ;;
+    "ext/bs2b/Makefile") CONFIG_FILES="$CONFIG_FILES ext/bs2b/Makefile" ;;
     "ext/bz2/Makefile") CONFIG_FILES="$CONFIG_FILES ext/bz2/Makefile" ;;
     "ext/chromaprint/Makefile") CONFIG_FILES="$CONFIG_FILES ext/chromaprint/Makefile" ;;
     "ext/curl/Makefile") CONFIG_FILES="$CONFIG_FILES ext/curl/Makefile" ;;
@@ -57010,6 +57130,7 @@
     "ext/kate/Makefile") CONFIG_FILES="$CONFIG_FILES ext/kate/Makefile" ;;
     "ext/ladspa/Makefile") CONFIG_FILES="$CONFIG_FILES ext/ladspa/Makefile" ;;
     "ext/lv2/Makefile") CONFIG_FILES="$CONFIG_FILES ext/lv2/Makefile" ;;
+    "ext/libde265/Makefile") CONFIG_FILES="$CONFIG_FILES ext/libde265/Makefile" ;;
     "ext/libmms/Makefile") CONFIG_FILES="$CONFIG_FILES ext/libmms/Makefile" ;;
     "ext/libvisual/Makefile") CONFIG_FILES="$CONFIG_FILES ext/libvisual/Makefile" ;;
     "ext/Makefile") CONFIG_FILES="$CONFIG_FILES ext/Makefile" ;;
@@ -57019,13 +57140,13 @@
     "ext/mimic/Makefile") CONFIG_FILES="$CONFIG_FILES ext/mimic/Makefile" ;;
     "ext/mplex/Makefile") CONFIG_FILES="$CONFIG_FILES ext/mplex/Makefile" ;;
     "ext/musepack/Makefile") CONFIG_FILES="$CONFIG_FILES ext/musepack/Makefile" ;;
-    "ext/mythtv/Makefile") CONFIG_FILES="$CONFIG_FILES ext/mythtv/Makefile" ;;
     "ext/nas/Makefile") CONFIG_FILES="$CONFIG_FILES ext/nas/Makefile" ;;
     "ext/neon/Makefile") CONFIG_FILES="$CONFIG_FILES ext/neon/Makefile" ;;
     "ext/ofa/Makefile") CONFIG_FILES="$CONFIG_FILES ext/ofa/Makefile" ;;
     "ext/openal/Makefile") CONFIG_FILES="$CONFIG_FILES ext/openal/Makefile" ;;
     "ext/opencv/Makefile") CONFIG_FILES="$CONFIG_FILES ext/opencv/Makefile" ;;
     "ext/openexr/Makefile") CONFIG_FILES="$CONFIG_FILES ext/openexr/Makefile" ;;
+    "ext/openh264/Makefile") CONFIG_FILES="$CONFIG_FILES ext/openh264/Makefile" ;;
     "ext/openjpeg/Makefile") CONFIG_FILES="$CONFIG_FILES ext/openjpeg/Makefile" ;;
     "ext/openni2/Makefile") CONFIG_FILES="$CONFIG_FILES ext/openni2/Makefile" ;;
     "ext/opus/Makefile") CONFIG_FILES="$CONFIG_FILES ext/opus/Makefile" ;;
@@ -57048,8 +57169,10 @@
     "ext/spc/Makefile") CONFIG_FILES="$CONFIG_FILES ext/spc/Makefile" ;;
     "ext/timidity/Makefile") CONFIG_FILES="$CONFIG_FILES ext/timidity/Makefile" ;;
     "ext/webp/Makefile") CONFIG_FILES="$CONFIG_FILES ext/webp/Makefile" ;;
+    "ext/x265/Makefile") CONFIG_FILES="$CONFIG_FILES ext/x265/Makefile" ;;
     "ext/xvid/Makefile") CONFIG_FILES="$CONFIG_FILES ext/xvid/Makefile" ;;
     "ext/zbar/Makefile") CONFIG_FILES="$CONFIG_FILES ext/zbar/Makefile" ;;
+    "ext/dtls/Makefile") CONFIG_FILES="$CONFIG_FILES ext/dtls/Makefile" ;;
     "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
     "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;;
     "docs/plugins/Makefile") CONFIG_FILES="$CONFIG_FILES docs/plugins/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 4e2823e..f466a3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
 dnl initialize autoconf
 dnl when going to/from release please set the nano (fourth number) right !
 dnl releases only do Wall, cvs and prerelease does Werror too
-AC_INIT([GStreamer Bad Plug-ins],[1.4.5],[http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],[gst-plugins-bad])
+AC_INIT([GStreamer Bad Plug-ins],[1.5.0.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],[gst-plugins-bad])
 
 AG_GST_INIT
 
@@ -48,11 +48,11 @@
 dnl - interfaces added -> increment AGE
 dnl - interfaces removed -> AGE = 0
 dnl sets GST_LT_LDFLAGS
-AS_LIBTOOL(GST, 405, 0, 405)
+AS_LIBTOOL(GST, 501, 0, 501)
 
 dnl *** required versions of GStreamer stuff ***
-GST_REQ=1.4.0
-GSTPB_REQ=1.4.0
+GST_REQ=1.5.0.1
+GSTPB_REQ=1.5.0.1
 
 dnl *** autotools stuff ****
 
@@ -140,6 +140,9 @@
 
 AC_FUNC_MMAP
 
+dnl check for pthreads
+AX_PTHREAD
+
 dnl *** checks for header files ***
 
 AC_CHECK_HEADERS([unistd.h], HAVE_UNISTD_H=yes)
@@ -410,16 +413,16 @@
 GST_PLUGINS_NONPORTED=" cdxaparse \
  dccp faceoverlay \
  hdvparse \
- mve mythtv nuvdemux \
- patchdetect real \
+ mve nuvdemux \
+ patchdetect \
  sdi tta \
  videomeasure \
- linsys vcd \
+ linsys \
  apexsink dc1394 \
  gsettings \
  musepack nas sdl timidity \
- directdraw acm wininet \
- xvid lv2 teletextdec sndio osx_video quicktime libvisual"
+ acm wininet \
+ xvid lv2 teletextdec sndio libvisual"
 AC_SUBST(GST_PLUGINS_NONPORTED)
 
 dnl these are all the gst plug-ins, compilable without additional libs
@@ -468,12 +471,13 @@
 AG_GST_CHECK_PLUGIN(mve)
 AG_GST_CHECK_PLUGIN(mxf)
 AG_GST_CHECK_PLUGIN(nuvdemux)
+AG_GST_CHECK_PLUGIN(onvif)
 AG_GST_CHECK_PLUGIN(patchdetect)
 AG_GST_CHECK_PLUGIN(pcapparse)
 AG_GST_CHECK_PLUGIN(pnm)
 AG_GST_CHECK_PLUGIN(rawparse)
-AG_GST_CHECK_PLUGIN(real)
 AG_GST_CHECK_PLUGIN(removesilence)
+AG_GST_CHECK_PLUGIN(rtp)
 AG_GST_CHECK_PLUGIN(sdi)
 AG_GST_CHECK_PLUGIN(sdp)
 AG_GST_CHECK_PLUGIN(segmentclip)
@@ -493,12 +497,6 @@
 
 dnl *** plug-ins to exclude ***
 
-dnl real plugin only works on i386 and x86_64 for the time being.
-if test "x$HAVE_CPU_I386" != "xyes" && test "x$HAVE_CPU_X86_64" != "xyes"; then
-  AC_MSG_WARN([Not building real plugin, only works on 32bit and 64bit x86 platforms])
-  AG_GST_DISABLE_PLUGIN(real)
-fi
-
 AC_CHECK_HEADER(AVFoundation/AVFoundation.h, HAVE_AVFOUNDATION="yes", HAVE_AVFOUNDATION="no", [-])
 AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-])
 AC_CHECK_HEADER(VideoToolbox/VideoToolbox.h, HAVE_VIDEOTOOLBOX="yes", HAVE_VIDEOTOOLBOX="no", [-])
@@ -540,7 +538,7 @@
 fi
 
 if test "x$HAVE_PTHREAD_H" = "xyes"; then
-  DCCP_LIBS="$DCCP_LIBS -lpthread"
+  DCCP_LIBS="$DCCP_LIBS $PTHREAD_LIBS"
   AC_SUBST(DCCP_LIBS)
 else
   AG_GST_DISABLE_PLUGIN(dccp)
@@ -646,13 +644,12 @@
        *) AC_MSG_ERROR([bad value ${enableval} for --enable-dispmanx]) ;;
      esac],[NEED_DISPMANX=auto])
 
-AG_GST_CHECK_X
+AG_GST_PKG_CHECK_MODULES(X, x11)
 save_CPPFLAGS="$CPPFLAGS"
 save_LIBS="$LIBS"
 
 HAVE_GL=no
 HAVE_GLES2=no
-HAVE_GLU=no
 HAVE_WAYLAND_EGL=no
 
 HAVE_EGL_RPI=no
@@ -661,19 +658,22 @@
   *-mingw32* )
     LIBS="$LIBS -lgdi32"
     AG_GST_CHECK_LIBHEADER(GL, opengl32, glTexImage2D,, GL/gl.h)
-    AG_GST_CHECK_LIBHEADER(GLU, glu32, gluSphere,, GL/glu.h)
     AC_CHECK_HEADER(GL/wglext.h, HAVE_WGLEXT="yes", HAVE_WGLEXT="no", [#include <GL/gl.h>])
     if test "x$HAVE_WGLEXT" = "xyes"; then
       HAVE_WGL=yes
       HAVE_GL=yes
-      HAVE_GLU=yes
     fi
   ;;
   *)
-    AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,, GL/gl.h)
-    AG_GST_CHECK_LIBHEADER(GLU, GLU, gluSphere,, GL/glu.h)
-    AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h)
-    AG_GST_CHECK_LIBHEADER(EGL, EGL, eglGetError,, EGL/egl.h)
+    if test "x$NEED_GL" != "xno"; then
+      AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,, GL/gl.h)
+    fi
+    if test "x$NEED_GLES2" != "xno"; then
+      AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h)
+    fi
+    if test "x$NEED_EGL" != "xno"; then
+      AG_GST_CHECK_LIBHEADER(EGL, EGL, eglGetError,, EGL/egl.h)
+    fi
 
     old_LIBS=$LIBS
     old_CFLAGS=$CFLAGS
@@ -746,10 +746,6 @@
 CPPFLAGS="$save_CPPFLAGS"
 LIBS="$save_LIBS"
 
-AC_SUBST(HAVE_GL)
-AC_SUBST(HAVE_GLU)
-AC_SUBST(HAVE_GLES2)
-
 USE_OPENGL=no
 USE_GLES2=no
 USE_GLX=no
@@ -795,17 +791,9 @@
         AC_MSG_ERROR([Building the GLX backend without the OpenGL backend is unsupported])
       fi
     else dnl HAVE_GL=yes
-      if test "x$HAVE_GLU" = "xno"; then
-        if test "x$NEED_GL" = "xyes"; then
-          AC_MSG_ERROR([GLU is required with OpenGL support])
-        else
-          AC_MSG_WARN([GLU is required with OpenGL support])
-        fi
-      else dnl HAVE_GLU=yes
-        USE_OPENGL=yes
-        if test "x$NEED_GLX" != "xno"; then
-          USE_GLX=yes
-        fi
+      USE_OPENGL=yes
+      if test "x$NEED_GLX" != "xno"; then
+        USE_GLX=yes
       fi
     fi
   fi
@@ -831,10 +819,8 @@
 #   define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
 #   include <OpenGL/gl3.h>
 #  endif
-#  include <OpenGL/glu.h>
 # else
 #  include <GL/gl.h>
-#  include <GL/glu.h>
 #  if __WIN32__ || _WIN32
 #   include <GL/glext.h>
 #  endif
@@ -850,11 +836,12 @@
     ]])],[ AC_MSG_RESULT(yes)
     ],[AC_MSG_RESULT(no)
     if test "x$NEED_GLES2" = "xyes"; then
-      if test "x$NEED_OPENGL" = "xyes"; then
+      if test "x$NEED_GL" = "xyes"; then
         AC_MSG_ERROR([Cannot seem to include both GL and GLES2 headers. Try disabling one API])
       fi
       AC_MSG_WARN([Disabling Desktop GL support])
       HAVE_GL=no
+      USE_OPENGL=no
     else
       AC_MSG_WARN([Disabling GL|ES 2.0 support])
       HAVE_GLES2=no
@@ -863,7 +850,7 @@
   CPPFLAGS="$save_CPPFLAGS"
 fi
 
-#dnl Check for OpenGL, GLU
+#dnl Check for OpenGL
 echo host is $host
 case $host in
   *-android*)
@@ -925,9 +912,6 @@
       if test "x$NEED_GL" != "xno"; then
         GL_LIBS="$GL_LIBS -lGL"
       fi
-      if test "x$HAVE_GLU" = "xyes"; then
-        GL_LIBS="$GL_LIBS -lGLU"
-      fi
     fi
 
     dnl OpenGL|ES 2.0
@@ -1023,7 +1007,7 @@
       fi
 
       if test "x$NEED_COCOA" != "xno"; then
-        GL_LIBS="$LIBS -framework OpenGL -framework Cocoa"
+        GL_LIBS="$LIBS -framework OpenGL -framework Cocoa -framework QuartzCore -framework CoreFoundation"
         GL_CFLAGS="$GL_CFLAGS"
         USE_COCOA=yes
         HAVE_WINDOW_COCOA=yes
@@ -1043,9 +1027,6 @@
           if test "x$NEED_GL" != "xno"; then
             GL_LIBS="$GL_LIBS -lGL"
           fi
-          if test "x$HAVE_GLU" = "xyes"; then
-            GL_LIBS="$GL_LIBS -lGLU"
-          fi
           USE_OPENGL=yes
         fi
       fi
@@ -1060,10 +1041,10 @@
     fi
 
     if test "x$HAVE_GL" = "xyes"; then
-      if test "$NEED_GL" != "xno"; then
+      if test "x$NEED_GL" != "xno"; then
         if test "x$HAVE_WGL" = "xyes"; then
           if test "$NEED_WGL" != "xno"; then
-            GL_LIBS="$GL_LIBS -lgdi32 -lopengl32 -lglu32"
+            GL_LIBS="$GL_LIBS -lgdi32 -lopengl32"
             HAVE_WINDOW_WIN32=yes
             USE_OPENGL=yes
             USE_WGL=yes
@@ -1271,10 +1252,8 @@
 # if __APPLE__
 #  include <OpenGL/OpenGL.h>
 #  include <OpenGL/gl.h>
-#  include <OpenGL/glu.h>
 # else
 #  include <GL/gl.h>
-#  include <GL/glu.h>
 #  if __WIN32__ || _WIN32
 #   include <GL/glext.h>
 #  endif
@@ -1286,6 +1265,8 @@
 GST_GL_HAVE_GLCHAR=0
 GST_GL_HAVE_GLSIZEIPTR=0
 GST_GL_HAVE_GLINTPTR=0
+GST_GL_HAVE_GLSYNC=0
+GST_GL_HAVE_GLUINT64=0
 
 old_CFLAGS=$CFLAGS
 CFLAGS="$GL_CFLAGS $CFLAGS"
@@ -1310,6 +1291,16 @@
   GST_GL_HAVE_GLINTPTR=1
 fi
 
+AC_CHECK_TYPES(GLsync, [], [], [[$GL_INCLUDES]])
+if test "x$ac_cv_type_GLsync" = "xyes"; then
+  GST_GL_HAVE_GLSYNC=1
+fi
+
+AC_CHECK_TYPES(GLuint64, [], [], [[$GL_INCLUDES]])
+if test "x$ac_cv_type_GLuint64" = "xyes"; then
+  GST_GL_HAVE_GLUINT64=1
+fi
+
 CFLAGS=$old_CFLAGS
 
 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
@@ -1317,6 +1308,8 @@
 #define GST_GL_HAVE_GLCHAR $GST_GL_HAVE_GLCHAR
 #define GST_GL_HAVE_GLSIZEIPTR $GST_GL_HAVE_GLSIZEIPTR
 #define GST_GL_HAVE_GLINTPTR $GST_GL_HAVE_GLINTPTR
+#define GST_GL_HAVE_GLSYNC $GST_GL_HAVE_GLSYNC
+#define GST_GL_HAVE_GLUINT64 $GST_GL_HAVE_GLUINT64
 "
 
 AC_CONFIG_COMMANDS([gst-libs/gst/gl/gstglconfig.h], [
@@ -1510,41 +1503,6 @@
   AC_SUBST(HAVE_DIRECT3D)
 ])
 
-dnl DirectDraw
-translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTDRAW, true)
-AG_GST_CHECK_FEATURE(DIRECTDRAW, [DirectDraw plug-in], directdrawsink, [
-  HAVE_DIRECTDRAW="no"
-  save_CFLAGS="$CFLAGS"
-  save_LDFLAGS="$LDFLAGS"
-  save_LIBS="$LIBS"
-  CFLAGS="$CFLAGS $DIRECTX_CFLAGS"
-  LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS"
-  LIBS="$LIBS -lddraw -lgdi32"
-  AC_MSG_CHECKING(for DirectDraw LDFLAGS)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include <windows.h>
-#include <ddraw.h>
-]], [[
-  GetStockObject(0);
-  DirectDrawCreate(NULL, NULL, NULL);
-]])],
-    [HAVE_DIRECTDRAW="yes"],
-    [HAVE_DIRECTDRAW="no"])
-  AC_MSG_RESULT($HAVE_DIRECTDRAW)
-  CFLAGS=$save_CFLAGS
-  LDFLAGS=$save_LDFLAGS
-  LIBS=$save_LIBS
-
-  if test "x$HAVE_DIRECTDRAW" = "xyes";  then
-    dnl this is much more than we want
-    DIRECTDRAW_LIBS="-lddraw -ldxguid -lgdi32"
-    AC_SUBST(DIRECTX_CFLAGS)
-    AC_SUBST(DIRECTX_LDFLAGS)
-    AC_SUBST(DIRECTDRAW_LIBS)
-  fi
-  AC_SUBST(HAVE_DIRECTDRAW)
-])
-
 dnl winscreencap
 translit(dnm, m, l) AM_CONDITIONAL(USE_WINSCREENCAP, true)
 AG_GST_CHECK_FEATURE(WINSCREENCAP, [winscreencap plug-in], winscreencap, [
@@ -1656,30 +1614,23 @@
 dnl *** bluez ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_BLUEZ, true)
 AG_GST_CHECK_FEATURE(BLUEZ, [Bluez], bluez, [
-  PKG_CHECK_MODULES([BLUEZ], [bluez < 5.0], [
+  PKG_CHECK_MODULES([BLUEZ4], [bluez < 5.0], [
+    HAVE_BLUEZ=yes
+    AC_DEFINE(HAVE_BLUEZ4,[1],[Old bluez detected])
+  ], [
+    PKG_CHECK_MODULES([BLUEZ5], [bluez >= 5.0], [
+      HAVE_BLUEZ=yes
+      AC_DEFINE(HAVE_BLUEZ5,[1],[Current bluez detected])
+    ], [
+      HAVE_BLUEZ=no
+    ])
+  ])
+  AS_IF([ test x$HAVE_BLUEZ = xyes ],[
     dnl FIXME: we should be able to replace this with the GLib DBus stuff
     PKG_CHECK_MODULES([DBUS], [dbus-1], [HAVE_BLUEZ=yes], [HAVE_BLUEZ=no])
-  ], [
-    HAVE_BLUEZ=no
   ])
 ])
 
-dnl *** OS X videosrc ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_OSX_VIDEO, true)
-HAVE_OSX_VIDEO="no"
-AG_GST_CHECK_FEATURE(OSX_VIDEO, [OSX video], osxvideosrc, [
-  AC_CHECK_TYPE([SeqGrabComponent], HAVE_OSX_VIDEO="yes", HAVE_OSX_VIDEO="no",
-      [#include <Quicktime/Quicktime.h>])
-])
-dnl in case header Quicktime/Quicktime.h is found on other platforms
-case "$host" in
-  *-*darwin*)
-    ;;
-  *)
-    HAVE_OSX_VIDEO="no"
-    ;;
-esac
-
 dnl *** OS/X AVCVideoServices ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_AVC, true)
 HAVE_AVC="no"
@@ -1703,13 +1654,6 @@
     ;;
 esac
 
-dnl check for QuickTime
-translit(dnm, m, l) AM_CONDITIONAL(USE_QUICKTIME, true)
-AG_GST_CHECK_FEATURE(QUICKTIME, [QuickTime wrapper], qtwrapper, [
-  AC_CHECK_TYPE([SampleReferenceRecord], HAVE_QUICKTIME="yes", HAVE_QUICKTIME="no",
-      [#include <Quicktime/Quicktime.h>])
-])
-
 dnl check for shm_open (for shm plugin)
 translit(dnm, m, l) AM_CONDITIONAL(USE_SHM, true)
 AG_GST_CHECK_FEATURE(SHM, [POSIX shared memory source and sink], shm, [
@@ -1818,6 +1762,16 @@
   ])
 ])
 
+dnl *** bs2b ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_BS2B, true)
+AG_GST_CHECK_FEATURE(BS2B, [bs2b], bs2b, [
+  PKG_CHECK_MODULES(BS2B, libbs2b >= 3.1.0, HAVE_BS2B="yes", [
+    HAVE_BS2B="no"
+  ])
+  AC_SUBST(BS2B_CFLAGS)
+  AC_SUBST(BS2B_LIBS)
+])
+
 dnl *** BZ2 ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_BZ2, true)
 AG_GST_CHECK_FEATURE(BZ2, [bz2 library], bz2, [
@@ -2154,6 +2108,14 @@
   AC_SUBST(SLV2_LIBS)
 ])
 
+dnl *** libde265 ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_LIBDE265, true)
+AG_GST_CHECK_FEATURE(LIBDE265, [libde265 HEVC/H.265 decoder], libde265, [
+  PKG_CHECK_MODULES(LIBDE265, libde265 >= 0.9, HAVE_LIBDE265="yes", HAVE_LIBDE265="no")
+  AC_SUBST(LIBDE265_CFLAGS)
+  AC_SUBST(LIBDE265_LIBS)
+])
+
 dnl *** libmms ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBMMS, true)
 AG_GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [
@@ -2168,10 +2130,23 @@
 dnl *** libsrtp ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_SRTP, true)
 AG_GST_CHECK_FEATURE(SRTP, [srtp library], srtp, [
-  HAVE_SRTP="yes"
-  AG_GST_CHECK_LIBHEADER(SRTP, srtp, srtp_init, , srtp/srtp.h,
-    SRTP_LIBS="-lsrtp", HAVE_SRTP="no")
+  PKG_CHECK_MODULES(SRTP, libsrtp, HAVE_SRTP="yes", 
+    AG_GST_CHECK_LIBHEADER(SRTP, srtp, srtp_init, , srtp/srtp.h, SRTP_LIBS="-lsrtp")
+  )
   AC_SUBST(SRTP_LIBS)
+  AC_SUBST(SRTP_CFLAGS)
+])
+
+dnl *** dtls ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_DTLS, true)
+AG_GST_CHECK_FEATURE(DTLS, [DTLS plugin], dtls, [
+  PKG_CHECK_MODULES(DTLS, [ openssl >= 0.9.5  libcrypto ], [
+    HAVE_DTLS="yes"
+    AC_SUBST(DTLS_CFLAGS)
+    AC_SUBST(DTLS_LIBS)
+  ], [
+    HAVE_DTLS="no"
+  ])
 ])
 
 dnl *** linsys ***
@@ -2229,7 +2204,7 @@
         OLD_CFLAGS="$CFLAGS"
         OLD_LIBS="$LIBS"
         CFLAGS="$MJPEG_CFLAGS"
-        LIBS="$LIBS $MJPEG_LIBS -lmjpegutils $LIBM -lpthread"
+        LIBS="$LIBS $MJPEG_LIBS -lmjpegutils $LIBM $PTHREAD_LIBS"
         AC_CHECK_FUNC(mjpeg_loglev_t, [
           mjpegtools_api=10903
           ], [
@@ -2267,7 +2242,7 @@
       dnl check headers
       mpeg2enc_headers_ok=no
       AC_CHECK_HEADER([mpeg2encoder.hh], [
-        MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp $LIBM -lpthread"
+        MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp $LIBM $PTHREAD_LIBS"
         OLD_LIBS="$LIBS"
         LIBS="$LIBS $MPEG2ENC_LIBS"
         AC_MSG_CHECKING([for valid mpeg2enc objects])
@@ -2412,21 +2387,10 @@
     ], [HAVE_MUSEPACK="no"])])
 ])
 
-dnl *** MythTV ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_MYTHTV, true)
-AG_GST_CHECK_FEATURE(MYTHTV, [MythTV client plugins], mythtvsrc, [
-  PKG_CHECK_MODULES(GMYTH, gmyth >= 0.4 gmyth <= 0.7.99, HAVE_MYTHTV="yes", [
-    HAVE_MYTHTV="no"
-  ])
-  AC_SUBST(GMYTH_CFLAGS)
-  AC_SUBST(GMYTH_LIBS)
-])
-
 dnl *** nas ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_NAS, true)
 AG_GST_CHECK_FEATURE(NAS, [nas plug-in], nassink, [
   HAVE_NAS="no"
-  AG_GST_CHECK_X
   if test "x$HAVE_X" = "xyes"; then
     save_cppflags=$CFLAGS
     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
@@ -2508,6 +2472,12 @@
   AG_GST_PKG_CHECK_MODULES(OPENEXR, OpenEXR)
 ])
 
+dnl *** openh264 ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_OPENH264, true)
+AG_GST_CHECK_FEATURE(OPENH264, [openh264 library], openh264, [
+  AG_GST_PKG_CHECK_MODULES(OPENH264, openh264)
+])
+
 dnl *** OpenJPEG ***
 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENJPEG, true)
 AG_GST_CHECK_FEATURE(OPENJPEG, [openjpeg library], openjpeg, [
@@ -2776,7 +2746,7 @@
   HAVE_XVID=no
   AC_CHECK_HEADER(xvid.h, [
     OLD_LIBS="$LIBS"
-    LIBS="-lpthread $LIBM"
+    LIBS="$PTHREAD_LIBS $LIBM"
     AC_CHECK_LIB(xvidcore, xvid_encore, [
       AC_CHECK_LIB(xvidcore, xvid_decore, [
         AC_CHECK_LIB(xvidcore, xvid_global, [
@@ -2956,11 +2926,23 @@
       AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define if libgcrypt is available])
       HAVE_HLS="yes"
     ], [
-      HAVE_HLS="no"
+      PKG_CHECK_MODULES(OPENSSL, openssl,
+      [
+        AC_DEFINE(HAVE_OPENSSL, 1, [Define if openssl is available])
+        HAVE_HLS="yes"
+      ], [
+        HAVE_HLS="no"
+      ])
     ])
   ])
 ])
 
+dnl *** x265 (H.265/HEVC encoder) ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_X265, true)
+AG_GST_CHECK_FEATURE(X265, [x265 plug-in], x265, [
+  AG_GST_PKG_CHECK_MODULES(X265, x265)
+])
+
 else
 
 dnl not building plugins with external dependencies,
@@ -2970,6 +2952,7 @@
 AM_CONDITIONAL(USE_VOAMRWBENC, false)
 AM_CONDITIONAL(USE_VOAACENC, false)
 AM_CONDITIONAL(USE_APEXSINK, false)
+AM_CONDITIONAL(USE_BS2B, false)
 AM_CONDITIONAL(USE_BZ2, false)
 AM_CONDITIONAL(USE_CHROMAPRINT, false)
 AM_CONDITIONAL(USE_CURL, false)
@@ -2996,6 +2979,7 @@
 AM_CONDITIONAL(USE_TIGER, false)
 AM_CONDITIONAL(USE_LADSPA, false)
 AM_CONDITIONAL(USE_LV2, false)
+AM_CONDITIONAL(USE_LIBDE265, false)
 AM_CONDITIONAL(USE_LIBMMS, false)
 AM_CONDITIONAL(USE_LINSYS, false)
 AM_CONDITIONAL(USE_MODPLUG, false)
@@ -3004,7 +2988,6 @@
 AM_CONDITIONAL(USE_MPG123, false)
 AM_CONDITIONAL(USE_MPLEX, false)
 AM_CONDITIONAL(USE_MUSEPACK, false)
-AM_CONDITIONAL(USE_MYTHTV, false)
 AM_CONDITIONAL(USE_NAS, false)
 AM_CONDITIONAL(USE_NEON, false)
 AM_CONDITIONAL(USE_OFA, false)
@@ -3041,6 +3024,9 @@
 AM_CONDITIONAL(USE_SNDIO, false)
 AM_CONDITIONAL(USE_UVCH264, false)
 AM_CONDITIONAL(USE_WEBP, false)
+AM_CONDITIONAL(USE_OPENH264, false)
+AM_CONDITIONAL(USE_X265, false)
+AM_CONDITIONAL(USE_DTLS, false)
 
 fi dnl of EXT plugins
 
@@ -3170,12 +3156,13 @@
 gst/mve/Makefile
 gst/mxf/Makefile
 gst/nuvdemux/Makefile
+gst/onvif/Makefile
 gst/patchdetect/Makefile
 gst/pcapparse/Makefile
 gst/pnm/Makefile
 gst/rawparse/Makefile
-gst/real/Makefile
 gst/removesilence/Makefile
+gst/rtp/Makefile
 gst/sdi/Makefile
 gst/sdp/Makefile
 gst/segmentclip/Makefile
@@ -3195,6 +3182,7 @@
 gst/compositor/Makefile
 gst-libs/Makefile
 gst-libs/gst/Makefile
+gst-libs/gst/adaptivedemux/Makefile
 gst-libs/gst/basecamerabinsrc/Makefile
 gst-libs/gst/gl/Makefile
 gst-libs/gst/gl/android/Makefile
@@ -3225,7 +3213,6 @@
 sys/bluez/Makefile
 sys/d3dvideosink/Makefile
 sys/decklink/Makefile
-sys/directdraw/Makefile
 sys/directsound/Makefile
 sys/dshowsrcwrapper/Makefile
 sys/dshowvideosink/Makefile
@@ -3233,8 +3220,6 @@
 sys/fbdev/Makefile
 sys/linsys/Makefile
 sys/opensles/Makefile
-sys/osxvideo/Makefile
-sys/qtwrapper/Makefile
 sys/shm/Makefile
 sys/uvch264/Makefile
 sys/vcd/Makefile
@@ -3248,6 +3233,7 @@
 tests/check/Makefile
 tests/files/Makefile
 tests/examples/Makefile
+tests/examples/avsamplesink/Makefile
 tests/examples/camerabin2/Makefile
 tests/examples/directfb/Makefile
 tests/examples/gl/Makefile
@@ -3275,6 +3261,7 @@
 ext/voaacenc/Makefile
 ext/assrender/Makefile
 ext/apexsink/Makefile
+ext/bs2b/Makefile
 ext/bz2/Makefile
 ext/chromaprint/Makefile
 ext/curl/Makefile
@@ -3294,6 +3281,7 @@
 ext/kate/Makefile
 ext/ladspa/Makefile
 ext/lv2/Makefile
+ext/libde265/Makefile
 ext/libmms/Makefile
 ext/libvisual/Makefile
 ext/Makefile
@@ -3303,13 +3291,13 @@
 ext/mimic/Makefile
 ext/mplex/Makefile
 ext/musepack/Makefile
-ext/mythtv/Makefile
 ext/nas/Makefile
 ext/neon/Makefile
 ext/ofa/Makefile
 ext/openal/Makefile
 ext/opencv/Makefile
 ext/openexr/Makefile
+ext/openh264/Makefile
 ext/openjpeg/Makefile
 ext/openni2/Makefile
 ext/opus/Makefile
@@ -3332,8 +3320,10 @@
 ext/spc/Makefile
 ext/timidity/Makefile
 ext/webp/Makefile
+ext/x265/Makefile
 ext/xvid/Makefile
 ext/zbar/Makefile
+ext/dtls/Makefile
 po/Makefile.in
 docs/Makefile
 docs/plugins/Makefile
diff --git a/docs/Makefile.in b/docs/Makefile.in
index ba6c2a6..c49f592 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -88,6 +88,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -101,7 +102,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -218,8 +218,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -258,7 +262,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -266,6 +269,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -315,8 +320,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -395,7 +398,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -404,7 +406,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -417,7 +418,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -442,6 +442,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -515,10 +517,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -544,6 +550,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -580,6 +589,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -620,17 +630,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -647,6 +656,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/docs/libs/Makefile.in b/docs/libs/Makefile.in
index 7b8cb8d..8e0f369 100644
--- a/docs/libs/Makefile.in
+++ b/docs/libs/Makefile.in
@@ -108,6 +108,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -121,7 +122,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -179,8 +179,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -219,7 +223,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -227,6 +230,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -276,8 +281,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -356,7 +359,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -365,7 +367,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -378,7 +379,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -403,6 +403,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -476,10 +478,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -505,6 +511,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -541,6 +550,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -581,17 +591,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -608,6 +617,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/docs/libs/gst-plugins-bad-libs-docs.sgml b/docs/libs/gst-plugins-bad-libs-docs.sgml
index 8c11026..0adc54e 100644
--- a/docs/libs/gst-plugins-bad-libs-docs.sgml
+++ b/docs/libs/gst-plugins-bad-libs-docs.sgml
@@ -77,15 +77,18 @@
       <xi:include href="xml/gstglcontext.xml"/>
       <xi:include href="xml/gstglcontextcocoa.xml"/>
       <xi:include href="xml/gstglcontextegl.xml"/>
+      <xi:include href="xml/gstglcontexteagl.xml"/>
       <xi:include href="xml/gstglcontextglx.xml"/>
       <xi:include href="xml/gstglcontextwgl.xml"/>
       <xi:include href="xml/gstgldisplay.xml"/>
       <xi:include href="xml/gstgldownload.xml"/>
       <xi:include href="xml/gsteglimagememory.xml"/>
+      <xi:include href="xml/gstglbasefilter.xml"/>
       <xi:include href="xml/gstglfilter.xml"/>
       <xi:include href="xml/gstglframebuffer.xml"/>
       <xi:include href="xml/gstglmemory.xml"/>
       <xi:include href="xml/gstglshader.xml"/>
+      <xi:include href="xml/gstglsyncmeta.xml"/>
       <xi:include href="xml/gstglupload.xml"/>
       <xi:include href="xml/gstgluploadmeta.xml"/>
       <xi:include href="xml/gstglutils.xml"/>
@@ -97,6 +100,11 @@
       <xi:include href="xml/gstglwindowwin32.xml"/>
       <xi:include href="xml/gstglwindowx11.xml"/>
     </chapter>
+
+    <chapter>
+      <title>Interfaces</title>
+      <xi:include href="xml/gstphotography.xml" />
+    </chapter>
   </part>
 
   <part id="gstreamer-libs-hierarchy">
diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt
index 632d9d6..4d45c8b 100644
--- a/docs/libs/gst-plugins-bad-libs-sections.txt
+++ b/docs/libs/gst-plugins-bad-libs-sections.txt
@@ -529,6 +529,20 @@
 
 <SECTION>
 <FILE>gstphotography</FILE>
+<TITLE>GstPhotography</TITLE>
+GstPhotography
+GstPhotographyNoiseReduction
+GstPhotographyWhiteBalanceMode
+GstPhotographyColorToneMode
+GstPhotographySceneMode
+GstPhotographyFlashMode
+GstPhotographyFlickerReductionMode
+GstPhotographyFocusMode
+GstPhotographyFocusStatus
+GstPhotographyCaps
+GstPhotographyShakeRisk
+GstPhotographySettings
+GstPhotographyCapturePrepared
 GST_PHOTOGRAPHY_AUTOFOCUS_DONE
 GST_PHOTOGRAPHY_SHAKE_RISK
 GST_PHOTOGRAPHY_PROP_WB_MODE
@@ -548,76 +562,35 @@
 GST_PHOTOGRAPHY_PROP_FLICKER_MODE
 GST_PHOTOGRAPHY_PROP_FOCUS_MODE
 GST_PHOTOGRAPHY_PROP_ZOOM
-GstPhotographyNoiseReduction
-GstWhiteBalanceMode
-GstColourToneMode
-GstSceneMode
-GstFlashMode
-GstFocusStatus
-GstPhotoCaps
-GstPhotoShakeRisk
-GstFlickerReductionMode
-GstFocusMode
-GstPhotoCapturePrepared
-get_ev_compensation
-get_iso_speed
-get_aperture
-get_exposure
-get_white_balance_mode
-get_colour_tone_mode
-get_scene_mode
-get_flash_mode
-get_zoom
-get_flicker_mode
-get_focus_mode
-set_ev_compensation
-set_iso_speed
-set_aperture
-set_exposure
-set_white_balance_mode
-set_colour_tone_mode
-set_scene_mode
-set_flash_mode
-set_zoom
-set_flicker_mode
-set_focus_mode
-get_capabilities
-prepare_for_capture
-set_autofocus
-set_config
-get_config
-get_noise_reduction
-set_noise_reduction
 gst_photography_get_ev_compensation
 gst_photography_get_iso_speed
 gst_photography_get_aperture
 gst_photography_get_exposure
 gst_photography_get_white_balance_mode
-gst_photography_get_colour_tone_mode
+gst_photography_get_color_tone_mode
 gst_photography_get_scene_mode
 gst_photography_get_flash_mode
-gst_photography_get_noise_reduction
-gst_photography_get_zoom
 gst_photography_get_flicker_mode
 gst_photography_get_focus_mode
+gst_photography_get_noise_reduction
+gst_photography_get_zoom
 gst_photography_set_ev_compensation
 gst_photography_set_iso_speed
 gst_photography_set_aperture
 gst_photography_set_exposure
 gst_photography_set_white_balance_mode
-gst_photography_set_colour_tone_mode
+gst_photography_set_color_tone_mode
 gst_photography_set_scene_mode
 gst_photography_set_flash_mode
-gst_photography_set_noise_reduction
-gst_photography_set_zoom
 gst_photography_set_flicker_mode
 gst_photography_set_focus_mode
+gst_photography_set_noise_reduction
+gst_photography_set_zoom
 gst_photography_get_capabilities
 gst_photography_prepare_for_capture
 gst_photography_set_autofocus
 gst_photography_set_config
 gst_photography_get_config
-GstPhotography
 <SUBSECTION Standard>
 GST_PHOTOGRAPHY
 GST_IS_PHOTOGRAPHY
@@ -798,11 +771,13 @@
 GstGLColorConvert
 GstGLColorConvertClass
 gst_gl_color_convert_new
-gst_gl_color_convert_set_format
+gst_gl_color_convert_set_caps
+gst_gl_color_convert_transform_caps
 gst_gl_color_convert_perform
 <SUBSECTION Standard>
 GstGLColorConvertPrivate
 GST_GL_COLOR_CONVERT
+GST_GL_COLOR_CONVERT_CAST
 GST_GL_COLOR_CONVERT_CLASS
 gst_gl_color_convert_get_type
 GST_IS_GL_COLOR_CONVERT
@@ -821,6 +796,7 @@
 gst_gl_context_new
 gst_gl_context_new_wrapped
 gst_gl_context_create
+gst_gl_context_destroy
 gst_gl_context_activate
 gst_gl_context_default_get_proc_address
 gst_gl_context_get_proc_address
@@ -831,11 +807,15 @@
 gst_gl_context_get_gl_api
 gst_gl_context_get_gl_context
 gst_gl_context_get_gl_platform
+gst_gl_context_get_current_gl_context
+gst_gl_context_get_current_gl_api
 gst_gl_context_get_thread
 gst_gl_context_can_share
 gst_gl_context_check_feature
 gst_gl_context_check_gl_version
 gst_gl_context_get_gl_version
+gst_gl_context_fill_info
+gst_gl_context_get_current
 <SUBSECTION Standard>
 GST_GL_CONTEXT
 GST_GL_IS_CONTEXT
@@ -853,6 +833,8 @@
 <TITLE>GstGLContextCocoa</TITLE>
 GstGLContextCocoa
 gst_gl_context_cocoa_new
+gst_gl_context_cocoa_get_current_context
+gst_gl_context_cocoa_get_pixel_format
 <SUBSECTION Standard>
 GST_GL_CONTEXT_COCOA
 GST_GL_IS_CONTEXT_COCOA
@@ -863,6 +845,8 @@
 GST_GL_CONTEXT_COCOA_CAST
 GstGLContextCocoaPrivate
 gst_gl_context_cocoa_get_type
+<SUBSECTION Private>
+gst_gl_context_cocoa_dump_pixel_format
 </SECTION>
 
 <SECTION>
@@ -870,6 +854,8 @@
 <TITLE>GstGLContextEGL</TITLE>
 GstGLContextEGL
 gst_gl_context_egl_new
+gst_gl_context_egl_get_current_context
+gst_gl_context_egl_get_proc_address
 <SUBSECTION Standard>
 GST_GL_CONTEXT_EGL
 GST_GL_IS_CONTEXT_EGL
@@ -887,6 +873,8 @@
 <TITLE>GstGLContextGLX</TITLE>
 GstGLContextGLX
 gst_gl_context_glx_new
+gst_gl_context_glx_get_current_context
+gst_gl_context_glx_get_proc_address
 <SUBSECTION Standard>
 GST_GL_CONTEXT_GLX
 GST_GL_IS_CONTEXT_GLX
@@ -904,6 +892,8 @@
 <TITLE>GstGLContextWGL</TITLE>
 GstGLContextWGL
 gst_gl_context_wgl_new
+gst_gl_context_wgl_get_current_context
+gst_gl_context_wgl_get_proc_address
 <SUBSECTION Standard>
 GST_GL_CONTEXT_WGL
 GST_GL_IS_CONTEXT_WGL
@@ -917,6 +907,29 @@
 </SECTION>
 
 <SECTION>
+<FILE>gstglcontexteagl</FILE>
+<TITLE>GstGLContextEagl</TITLE>
+GstGLContextEagl
+gst_gl_context_eagl_new
+gst_gl_context_eagl_get_current_context
+<SUBSECTION Standard>
+GST_GL_CONTEXT_EAGL
+GST_GL_IS_CONTEXT_EAGL
+GST_GL_TYPE_CONTEXT_EAGL
+GST_GL_CONTEXT_EAGL_CLASS
+GST_GL_CONTEXT_EAGL_GET_CLASS
+GST_GL_IS_CONTEXT_EAGL_CLASS
+GST_GL_CONTEXT_EAGL_CAST
+GstGLContextEaglPrivate
+
+<SUBSECTION Private>
+gst_gl_context_eagl_get_type
+gst_gl_context_eagl_prepare_draw
+gst_gl_context_eagl_finish_draw
+gst_gl_context_eagl_resize
+</SECTION>
+
+<SECTION>
 <FILE>gstgldisplay</FILE>
 <TITLE>GstGLDisplay</TITLE>
 GST_GL_DISPLAY_CONTEXT_TYPE
@@ -924,6 +937,11 @@
 GstGLDisplay
 gst_gl_display_new
 gst_gl_display_get_handle_type
+gst_gl_display_filter_gl_api
+gst_gl_display_get_gl_api
+gst_gl_display_add_context
+gst_gl_display_get_gl_context_for_thread
+gst_gl_display_get_handle
 gst_context_get_gl_display
 gst_context_set_gl_display
 <SUBSECTION Standard>
@@ -943,6 +961,7 @@
 GstGLDownload
 gst_gl_download_new
 gst_gl_download_set_format
+gst_gl_download_transform_caps
 gst_gl_download_perform_with_data
 <SUBSECTION Standard>
 GST_GL_DOWNLOAD
@@ -957,6 +976,22 @@
 </SECTION>
 
 <SECTION>
+<FILE>gstglbasefilter</FILE>
+<TITLE>GstGLBaseFilter</TITLE>
+GstGLBaseFilter
+GstGLBaseFilterClass
+<SUBSECTION Standard>
+GST_GL_BASE_FILTER
+GST_IS_GL_BASE_FILTER
+GST_TYPE_GL_BASE_FILTER
+gst_gl_base_filter_get_type
+GST_GL_BASE_FILTER_CLASS
+GST_IS_GL_FILTER_CLASS
+GST_GL_BASE_FILTER_GET_CLASS
+GstGLBaseFilterPrivate
+</SECTION>
+
+<SECTION>
 <FILE>gstglfilter</FILE>
 <TITLE>GstGLFilter</TITLE>
 GstGLFilter
@@ -983,10 +1018,10 @@
 gst_gl_framebuffer_new
 gst_gl_framebuffer_generate
 gst_gl_framebuffer_delete
-gst_gl_framebuffer_use
 gst_gl_framebuffer_use_v2
 <SUBSECTION Standard>
 GST_GL_FRAMEBUFFER
+GST_GL_FRAMEBUFFER_CAST
 GST_IS_GL_FRAMEBUFFER
 GST_TYPE_GL_FRAMEBUFFER
 gst_gl_framebuffer_get_type
@@ -1059,6 +1094,7 @@
 gst_gl_shader_set_fragment_source
 gst_gl_shader_get_vertex_source
 gst_gl_shader_get_fragment_source
+gst_gl_shader_get_program_handle
 gst_gl_shader_set_active
 gst_gl_shader_is_compiled
 gst_gl_shader_compile
@@ -1108,14 +1144,30 @@
 </SECTION>
 
 <SECTION>
+<FILE>gstglsyncmeta</FILE>
+<TITLE>GstGLSyncMeta</TITLE>
+GstGLSyncMeta
+gst_buffer_add_gl_sync_meta
+gst_buffer_get_gl_sync_meta
+gst_gl_sync_meta_api_get_type
+gst_gl_sync_meta_get_info
+gst_gl_sync_meta_set_sync_point
+gst_gl_sync_meta_wait
+GST_BUFFER_POOL_OPTION_GL_SYNC_META
+<SUBSECTION Standard>
+GST_GL_SYNC_META_API_TYPE
+GST_GL_SYNC_META_INFO
+</SECTION>
+
+<SECTION>
 <FILE>gstglupload</FILE>
 <TITLE>GstGLUpload</TITLE>
 GstGLUpload
 gst_gl_upload_new
-gst_gl_upload_set_format
-gst_gl_upload_get_format
-gst_gl_upload_perform_with_data
-gst_gl_upload_perform_with_gl_texture_upload_meta
+gst_gl_upload_get_caps
+gst_gl_upload_set_caps
+gst_gl_upload_propose_allocation
+gst_gl_upload_transform_caps
 gst_gl_upload_perform_with_buffer
 gst_gl_upload_release_buffer
 <SUBSECTION Standard>
@@ -1158,14 +1210,12 @@
 CRCB
 CDCB
 GstGLDisplayProjection
-gst_gl_ensure_display
 gst_gl_handle_set_context
 gst_gl_handle_context_query
 gst_gl_context_gen_texture
 gst_gl_context_del_texture
 gst_gl_context_gen_fbo
 gst_gl_context_del_fbo
-gst_gl_context_use_fbo
 gst_gl_context_use_fbo_v2
 gst_gl_context_gen_shader
 gst_gl_context_del_shader
@@ -1174,6 +1224,10 @@
 gst_gl_context_get_error
 gst_gl_context_clear_shader
 gst_gl_generate_texture_full
+gst_gl_caps_replace_all_caps_features
+gst_gl_ensure_element_data
+gst_gl_get_plane_data_size
+gst_gl_run_query
 </SECTION>
 
 <SECTION>
@@ -1203,6 +1257,10 @@
 gst_gl_window_set_resize_callback
 gst_gl_window_set_window_handle
 gst_gl_window_get_window_handle
+gst_gl_window_set_preferred_size
+gst_gl_window_show
+gst_gl_window_get_surface_dimensions
+gst_gl_window_handle_events
 <SUBSECTION Standard>
 GST_GL_IS_WINDOW
 GST_GL_IS_WINDOW_CLASS
@@ -1212,6 +1270,11 @@
 GST_GL_WINDOW_GET_CLASS
 gst_gl_window_get_type
 GstGLWindowPrivate
+<SUBSECTION Private>
+gst_gl_window_key_event_cb
+gst_gl_window_mouse_event_cb
+gst_gl_window_send_key_event
+gst_gl_window_send_mouse_event
 </SECTION>
 
 <SECTION>
@@ -1328,6 +1391,7 @@
 gst_aggregator_finish_buffer
 gst_aggregator_set_src_caps
 gst_aggregator_iterate_sinkpads
+gst_aggregator_get_latency
 <SUBSECTION Standard>
 GST_IS_AGGREGATOR
 GST_IS_AGGREGATOR_CLASS
@@ -1345,6 +1409,8 @@
 GstAggregatorPadClass
 gst_aggregator_pad_steal_buffer
 gst_aggregator_pad_get_buffer
+gst_aggregator_pad_drop_buffer
+gst_aggregator_pad_is_eos
 <SUBSECTION Standard>
 GST_IS_AGGREGATOR_PAD
 GST_IS_AGGREGATOR_PAD_CLASS
diff --git a/docs/libs/gst-plugins-bad-libs.types b/docs/libs/gst-plugins-bad-libs.types
index 67ce098..cd2be7b 100644
--- a/docs/libs/gst-plugins-bad-libs.types
+++ b/docs/libs/gst-plugins-bad-libs.types
@@ -26,13 +26,17 @@
 gst_insert_bin_get_type
 
 
-gst_gl_upload_get_type
-gst_gl_download_get_type
-gst_gl_color_convert_get_type
-gst_gl_display_get_type
-gst_gl_context_get_type
-gst_gl_filter_get_type
-gst_gl_shader_get_type
-gst_gl_buffer_pool_get_type
 gst_gl_allocator_get_type
+gst_gl_base_filter_get_type
+gst_gl_buffer_pool_get_type
+gst_gl_color_convert_get_type
+gst_gl_context_get_type
+gst_gl_display_get_type
+gst_gl_download_get_type
+gst_gl_filter_get_type
+gst_gl_framebuffer_get_type
+gst_gl_shader_get_type
+gst_gl_upload_get_type
+gst_gl_upload_meta_get_type
+gst_gl_window_get_type
 gst_gl_window_get_type
diff --git a/docs/libs/html/GstGLBaseFilter.html b/docs/libs/html/GstGLBaseFilter.html
new file mode 100644
index 0000000..a807ba4
--- /dev/null
+++ b/docs/libs/html/GstGLBaseFilter.html
@@ -0,0 +1,173 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Library Reference Manual: GstGLBaseFilter</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
+<link rel="up" href="gl.html" title="OpenGL Helper Library">
+<link rel="prev" href="gst-plugins-bad-libs-GstEGLImageMemory.html" title="GstEGLImageMemory">
+<link rel="next" href="GstGLFilter.html" title="GstGLFilter">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#GstGLBaseFilter.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#GstGLBaseFilter.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#GstGLBaseFilter.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-libs-GstEGLImageMemory.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="GstGLFilter.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="GstGLBaseFilter"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="GstGLBaseFilter.top_of_page"></a>GstGLBaseFilter</span></h2>
+<p>GstGLBaseFilter</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="GstGLBaseFilter.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody><tr>
+<td class="property_type">
+<a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *</td>
+<td class="property_name"><a class="link" href="GstGLBaseFilter.html#GstGLBaseFilter--context" title="The “context” property">context</a></td>
+<td class="property_flags">Read</td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="GstGLBaseFilter.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="datatype_keyword"> </td>
+<td class="function_name"><a class="link" href="GstGLBaseFilter.html#GstGLBaseFilter-struct" title="GstGLBaseFilter">GstGLBaseFilter</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword"> </td>
+<td class="function_name"><a class="link" href="GstGLBaseFilter.html#GstGLBaseFilterClass" title="GstGLBaseFilterClass">GstGLBaseFilterClass</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="GstGLBaseFilter.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html">GstBaseTransform</a>
+                    <span class="lineart">╰──</span> GstGLBaseFilter
+                        <span class="lineart">╰──</span> <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
+</pre>
+</div>
+<div class="refsect1">
+<a name="GstGLBaseFilter.description"></a><h2>Description</h2>
+</div>
+<div class="refsect1">
+<a name="GstGLBaseFilter.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="GstGLBaseFilter.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstGLBaseFilter-struct"></a><h3>GstGLBaseFilter</h3>
+<pre class="programlisting">typedef struct _GstGLBaseFilter GstGLBaseFilter;</pre>
+<p><a class="link" href="GstGLBaseFilter.html" title="GstGLBaseFilter"><span class="type">GstGLBaseFilter</span></a> is a base class that provides the logic of getting the
+GL context from the pipeline.</p>
+<div class="refsect3">
+<a name="id-1.2.9.14.8.2.5"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="struct_members_name">
+<col class="struct_members_description">
+<col width="200px" class="struct_members_annotations">
+</colgroup>
+<tbody></tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstGLBaseFilterClass"></a><h3>GstGLBaseFilterClass</h3>
+<pre class="programlisting">typedef struct {
+  GstBaseTransformClass parent_class;
+  GstGLAPI supported_gl_api;
+
+  gboolean (*gl_start)          (GstGLBaseFilter *filter);
+  void     (*gl_stop)           (GstGLBaseFilter *filter);
+
+  gpointer _padding[GST_PADDING];
+} GstGLBaseFilterClass;
+</pre>
+<div class="refsect3">
+<a name="id-1.2.9.14.8.3.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="struct_members_name">
+<col class="struct_members_description">
+<col width="200px" class="struct_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html#GstBaseTransformClass"><span class="type">GstBaseTransformClass</span></a> <em class="structfield"><code><a name="GstGLBaseFilterClass.parent-class"></a>parent_class</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="type">GstGLAPI</span></a> <em class="structfield"><code><a name="GstGLBaseFilterClass.supported-gl-api"></a>supported_gl_api</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstGLBaseFilterClass.gl-start"></a>gl_start</code></em> ()</p></td>
+<td class="struct_member_description"><p>called in the GL thread to setup the element GL state.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstGLBaseFilterClass.gl-stop"></a>gl_stop</code></em> ()</p></td>
+<td class="struct_member_description"><p>called in the GL thread to setup the element GL state.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> <em class="structfield"><code><a name="GstGLBaseFilterClass.-padding"></a>_padding</code></em>[GST_PADDING];</p></td>
+<td> </td>
+<td> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="GstGLBaseFilter.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="GstGLBaseFilter--context"></a><h3>The <code class="literal">“context”</code> property</h3>
+<pre class="programlisting">  “context”                  <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *</pre>
+<p>Get OpenGL context.</p>
+<p>Flags: Read</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/libs/html/GstGLColorConvert.html b/docs/libs/html/GstGLColorConvert.html
index 7249954..cb7261c 100644
--- a/docs/libs/html/GstGLColorConvert.html
+++ b/docs/libs/html/GstGLColorConvert.html
@@ -50,10 +50,18 @@
 </tr>
 <tr>
 <td class="function_type">
-<span class="returnvalue">void</span>
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
-<a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-set-format" title="gst_gl_color_convert_set_format ()">gst_gl_color_convert_set_format</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-set-caps" title="gst_gl_color_convert_set_caps ()">gst_gl_color_convert_set_caps</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-transform-caps" title="gst_gl_color_convert_transform_caps ()">gst_gl_color_convert_transform_caps</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 <tr>
@@ -139,11 +147,11 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="gst-gl-color-convert-set-format"></a><h3>gst_gl_color_convert_set_format ()</h3>
-<pre class="programlisting"><span class="returnvalue">void</span>
-gst_gl_color_convert_set_format (<em class="parameter"><code><a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert"><span class="type">GstGLColorConvert</span></a> *convert</code></em>,
-                                 <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *in_info</code></em>,
-                                 <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *out_info</code></em>);</pre>
+<a name="gst-gl-color-convert-set-caps"></a><h3>gst_gl_color_convert_set_caps ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_color_convert_set_caps (<em class="parameter"><code><a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert"><span class="type">GstGLColorConvert</span></a> *convert</code></em>,
+                               <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *in_caps</code></em>,
+                               <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *out_caps</code></em>);</pre>
 <p>Initializes <em class="parameter"><code>convert</code></em>
  with the information required for conversion.</p>
 <div class="refsect3">
@@ -176,15 +184,24 @@
 </div>
 <hr>
 <div class="refsect2">
+<a name="gst-gl-color-convert-transform-caps"></a><h3>gst_gl_color_convert_transform_caps ()</h3>
+<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+gst_gl_color_convert_transform_caps (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *convert</code></em>,
+                                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#GstPadDirection"><span class="type">GstPadDirection</span></a> direction</code></em>,
+                                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *caps</code></em>,
+                                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *filter</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
 <a name="gst-gl-color-convert-perform"></a><h3>gst_gl_color_convert_perform ()</h3>
 <pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
 gst_gl_color_convert_perform (<em class="parameter"><code><a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert"><span class="type">GstGLColorConvert</span></a> *convert</code></em>,
                               <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *inbuf</code></em>);</pre>
 <p>Converts the data contained by <em class="parameter"><code>inbuf</code></em>
  using the formats specified by the
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a>s passed to <a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-set-format" title="gst_gl_color_convert_set_format ()"><code class="function">gst_gl_color_convert_set_format()</code></a></p>
+<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a>s passed to <a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-set-caps" title="gst_gl_color_convert_set_caps ()"><code class="function">gst_gl_color_convert_set_caps()</code></a></p>
 <div class="refsect3">
-<a name="id-1.2.9.4.7.4.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.4.7.5.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -206,7 +223,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.4.7.4.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.4.7.5.6"></a><h4>Returns</h4>
 <p> a converted <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>%</p>
 <p></p>
 </div>
@@ -222,8 +239,7 @@
 <hr>
 <div class="refsect2">
 <a name="GST-GL-COLOR-CONVERT-VIDEO-CAPS"></a><h3>GST_GL_COLOR_CONVERT_VIDEO_CAPS</h3>
-<pre class="programlisting">#define GST_GL_COLOR_CONVERT_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS)
-</pre>
+<pre class="programlisting">#define             GST_GL_COLOR_CONVERT_VIDEO_CAPS</pre>
 <p>The currently supported <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> that can be converted</p>
 </div>
 <hr>
diff --git a/docs/libs/html/GstGLContext.html b/docs/libs/html/GstGLContext.html
index ba85f88..3045885 100644
--- a/docs/libs/html/GstGLContext.html
+++ b/docs/libs/html/GstGLContext.html
@@ -86,6 +86,14 @@
 </tr>
 <tr>
 <td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLContext.html#gst-gl-context-destroy" title="gst_gl_context_destroy ()">gst_gl_context_destroy</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
@@ -166,6 +174,22 @@
 </tr>
 <tr>
 <td class="function_type">
+<span class="returnvalue">guintptr</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLContext.html#gst-gl-context-get-current-gl-context" title="gst_gl_context_get_current_gl_context ()">gst_gl_context_get_current_gl_context</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="returnvalue">GstGLAPI</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLContext.html#gst-gl-context-get-current-gl-api" title="gst_gl_context_get_current_gl_api ()">gst_gl_context_get_current_gl_api</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
 <a href="https://developer.gnome.org/glib/unstable/glib-Threads.html#GThread"><span class="returnvalue">GThread</span></a> *
 </td>
 <td class="function_name">
@@ -204,6 +228,22 @@
 <a class="link" href="GstGLContext.html#gst-gl-context-get-gl-version" title="gst_gl_context_get_gl_version ()">gst_gl_context_get_gl_version</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLContext.html#gst-gl-context-fill-info" title="gst_gl_context_fill_info ()">gst_gl_context_fill_info</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="GstGLContext.html" title="GstGLContext"><span class="returnvalue">GstGLContext</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="GstGLContext.html#gst-gl-context-get-current" title="gst_gl_context_get_current ()">gst_gl_context_get_current</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -416,6 +456,31 @@
 </div>
 <hr>
 <div class="refsect2">
+<a name="gst-gl-context-destroy"></a><h3>gst_gl_context_destroy ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_context_destroy (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
+<p>Destroys an OpenGL context.</p>
+<p>Should only be called after <a class="link" href="GstGLContext.html#gst-gl-context-create" title="gst_gl_context_create ()"><code class="function">gst_gl_context_create()</code></a> has been successfully
+called for this context.</p>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.8.6"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>context</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>:</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
 <a name="gst-gl-context-activate"></a><h3>gst_gl_context_activate ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_gl_context_activate (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
@@ -425,7 +490,7 @@
 <p>In OpenGL terms, calls eglMakeCurrent or similar with this context and the
 currently set window.  See <a class="link" href="GstGLContext.html#gst-gl-context-set-window" title="gst_gl_context_set_window ()"><code class="function">gst_gl_context_set_window()</code></a> for details.</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.8.6"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.9.6"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -447,7 +512,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.8.7"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.9.7"></a><h4>Returns</h4>
 <p> Whether the activation succeeded</p>
 <p></p>
 </div>
@@ -458,7 +523,7 @@
 <a name="gst-gl-context-default-get-proc-address"></a><h3>gst_gl_context_default_get_proc_address ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
 gst_gl_context_default_get_proc_address
-                               (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                               (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="type">GstGLAPI</span></a> gl_api</code></em>,
                                 <em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
 </div>
 <hr>
@@ -473,7 +538,7 @@
 <p>Platform specfic functions (names starting 'egl', 'glX', 'wgl', etc) can also
 be retreived using this method.</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.10.6"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.11.6"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -495,7 +560,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.10.7"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.11.7"></a><h4>Returns</h4>
 <p> a function pointer or NULL</p>
 <p></p>
 </div>
@@ -507,7 +572,7 @@
 <pre class="programlisting"><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="returnvalue">GstGLWindow</span></a> *
 gst_gl_context_get_window (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.11.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.12.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -522,7 +587,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.11.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.12.5"></a><h4>Returns</h4>
 <p> the currently set window</p>
 <p></p>
 </div>
@@ -541,7 +606,7 @@
  is not
 already running.</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.12.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.13.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -563,7 +628,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.12.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.13.6"></a><h4>Returns</h4>
 <p> Whether the window was successfully updated</p>
 <p></p>
 </div>
@@ -582,7 +647,7 @@
 </p>
 <p>MT-safe</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.13.6"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.14.6"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -617,7 +682,7 @@
 <pre class="programlisting"><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="returnvalue">GstGLDisplay</span></a> *
 gst_gl_context_get_display (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.14.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.15.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -632,7 +697,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.14.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.15.5"></a><h4>Returns</h4>
 <p> the <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> associated with this <em class="parameter"><code>context</code></em>
 </p>
 <p></p>
@@ -648,7 +713,7 @@
 <p>The currently available API may be limited by the <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> in use and/or
 the <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> chosen.</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.15.6"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.16.6"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -663,7 +728,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.15.7"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.16.7"></a><h4>Returns</h4>
 <p> the available OpenGL api</p>
 <p></p>
 </div>
@@ -677,35 +742,6 @@
 <p>Gets the backing OpenGL context used by <em class="parameter"><code>context</code></em>
 .</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.16.5"></a><h4>Parameters</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="parameters_name">
-<col class="parameters_description">
-<col width="200px" class="parameters_annotations">
-</colgroup>
-<tbody><tr>
-<td class="parameter_name"><p>context</p></td>
-<td class="parameter_description"><p>a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>:</p></td>
-<td class="parameter_annotations"> </td>
-</tr></tbody>
-</table></div>
-</div>
-<div class="refsect3">
-<a name="id-1.2.9.5.7.16.6"></a><h4>Returns</h4>
-<p> The platform specific backing OpenGL context</p>
-<p></p>
-</div>
-<p class="since">Since 1.4</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-gl-context-get-gl-platform"></a><h3>gst_gl_context_get_gl_platform ()</h3>
-<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="returnvalue">GstGLPlatform</span></a>
-gst_gl_context_get_gl_platform (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
-<p>Gets the OpenGL platform that used by <em class="parameter"><code>context</code></em>
-.</p>
-<div class="refsect3">
 <a name="id-1.2.9.5.7.17.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
@@ -729,11 +765,112 @@
 </div>
 <hr>
 <div class="refsect2">
+<a name="gst-gl-context-get-gl-platform"></a><h3>gst_gl_context_get_gl_platform ()</h3>
+<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="returnvalue">GstGLPlatform</span></a>
+gst_gl_context_get_gl_platform (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
+<p>Gets the OpenGL platform that used by <em class="parameter"><code>context</code></em>
+.</p>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.18.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>context</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>:</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.18.6"></a><h4>Returns</h4>
+<p> The platform specific backing OpenGL context</p>
+<p></p>
+</div>
+<p class="since">Since 1.4</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-get-current-gl-context"></a><h3>gst_gl_context_get_current_gl_context ()</h3>
+<pre class="programlisting"><span class="returnvalue">guintptr</span>
+gst_gl_context_get_current_gl_context (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="type">GstGLPlatform</span></a> platform</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.19.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>context_type</p></td>
+<td class="parameter_description"><p>a <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="type">GstGLPlatform</span></a> specifying the type of context to retreive</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.19.5"></a><h4>Returns</h4>
+<p> The OpenGL context handle current in the calling thread or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p>
+<p></p>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-get-current-gl-api"></a><h3>gst_gl_context_get_current_gl_api ()</h3>
+<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="returnvalue">GstGLAPI</span></a>
+gst_gl_context_get_current_gl_api (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *major</code></em>,
+                                   <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *minor</code></em>);</pre>
+<p>If an error occurs, <em class="parameter"><code>major</code></em>
+ and <em class="parameter"><code>minor</code></em>
+ aren't modified and <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GST-GL-API-NONE:CAPS"><code class="literal">GST_GL_API_NONE</code></a> is
+returned.</p>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.20.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>context_type</p></td>
+<td class="parameter_description"><p>a <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="type">GstGLPlatform</span></a> specifying the type of context to retreive</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>major</p></td>
+<td class="parameter_description"><p> (allow-none): the major version. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>minor</p></td>
+<td class="parameter_description"><p> (allow-none): the minor version. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.20.6"></a><h4>Returns</h4>
+<p> The version supported by the OpenGL context current in the calling
+thread or <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GST-GL-API-NONE:CAPS"><code class="literal">GST_GL_API_NONE</code></a></p>
+<p></p>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
 <a name="gst-gl-context-get-thread"></a><h3>gst_gl_context_get_thread ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Threads.html#GThread"><span class="returnvalue">GThread</span></a> *
 gst_gl_context_get_thread (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.18.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.21.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -748,12 +885,12 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.18.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.21.5"></a><h4>Returns</h4>
 <p> The <a href="https://developer.gnome.org/glib/unstable/glib-Threads.html#GThread"><span class="type">GThread</span></a>, <em class="parameter"><code>context</code></em>
 is current in or NULL. </p>
 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
 </div>
-<p class="since">Since 1.4.5</p>
+<p class="since">Since 1.6</p>
 </div>
 <hr>
 <div class="refsect2">
@@ -762,7 +899,7 @@
 gst_gl_context_can_share (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
                           <em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *other_context</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.19.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.22.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -784,7 +921,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.19.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.22.5"></a><h4>Returns</h4>
 <p> whether <em class="parameter"><code>context</code></em>
 and <em class="parameter"><code>other_context</code></em>
 are able to share OpenGL
@@ -802,7 +939,7 @@
 <p>Some features require that the context be created before it is possible to
 determine their existence and so will fail if that is not the case.</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.20.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.23.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -824,7 +961,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.20.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.23.6"></a><h4>Returns</h4>
 <p> Whether <em class="parameter"><code>feature</code></em>
 is supported by <em class="parameter"><code>context</code></em>
 </p>
@@ -841,7 +978,7 @@
                                  <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> maj</code></em>,
                                  <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> min</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.21.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.24.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -873,7 +1010,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.21.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.5.7.24.5"></a><h4>Returns</h4>
 <p> whether OpenGL context implements the required api and specified
 version.</p>
 <p></p>
@@ -893,7 +1030,7 @@
 <em class="parameter"><code>context</code></em>
 .</p>
 <div class="refsect3">
-<a name="id-1.2.9.5.7.22.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.5.7.25.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -921,6 +1058,46 @@
 </div>
 <p class="since">Since 1.4</p>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-fill-info"></a><h3>gst_gl_context_fill_info ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_context_fill_info (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
+<p>Fills <em class="parameter"><code>context</code></em>
+'s info (version, extensions, vtable, etc) from the GL
+context in the current thread.  Typically used with wrapped contexts to
+allow wrapped contexts to be used as regular <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>'s.</p>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.26.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>context</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>:</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-get-current"></a><h3>gst_gl_context_get_current ()</h3>
+<pre class="programlisting"><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="returnvalue">GstGLContext</span></a> *
+gst_gl_context_get_current (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+<p>See also <a class="link" href="GstGLContext.html#gst-gl-context-activate" title="gst_gl_context_activate ()"><code class="function">gst_gl_context_activate()</code></a>.</p>
+<div class="refsect3">
+<a name="id-1.2.9.5.7.27.5"></a><h4>Returns</h4>
+<p> the <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> active in the current thread or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p>
+<p></p>
+</div>
+<p class="since">Since 1.6</p>
+</div>
 </div>
 <div class="refsect1">
 <a name="GstGLContext.other_details"></a><h2>Types and Values</h2>
diff --git a/docs/libs/html/GstGLDisplay.html b/docs/libs/html/GstGLDisplay.html
index 2793f0d..c9f7367 100644
--- a/docs/libs/html/GstGLDisplay.html
+++ b/docs/libs/html/GstGLDisplay.html
@@ -58,6 +58,46 @@
 </tr>
 <tr>
 <td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLDisplay.html#gst-gl-display-filter-gl-api" title="gst_gl_display_filter_gl_api ()">gst_gl_display_filter_gl_api</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="returnvalue">GstGLAPI</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLDisplay.html#gst-gl-display-get-gl-api" title="gst_gl_display_get_gl_api ()">gst_gl_display_get_gl_api</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLDisplay.html#gst-gl-display-add-context" title="gst_gl_display_add_context ()">gst_gl_display_add_context</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="GstGLContext.html" title="GstGLContext"><span class="returnvalue">GstGLContext</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="GstGLDisplay.html#gst-gl-display-get-gl-context-for-thread" title="gst_gl_display_get_gl_context_for_thread ()">gst_gl_display_get_gl_context_for_thread</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guintptr</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLDisplay.html#gst-gl-display-get-handle" title="gst_gl_display_get_handle ()">gst_gl_display_get_handle</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
@@ -136,7 +176,7 @@
 <pre class="programlisting"><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="returnvalue">GstGLDisplay</span></a> *
 gst_gl_display_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.10.7.2.4"></a><h4>Returns</h4>
+<a name="id-1.2.9.11.7.2.4"></a><h4>Returns</h4>
 <p> a new <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a>. </p>
 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
 </div>
@@ -148,7 +188,7 @@
 <pre class="programlisting"><a class="link" href="GstGLDisplay.html#GstGLDisplayType" title="enum GstGLDisplayType"><span class="returnvalue">GstGLDisplayType</span></a>
 gst_gl_display_get_handle_type (<em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> *display</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.10.7.3.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.11.7.3.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -163,7 +203,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.10.7.3.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.11.7.3.5"></a><h4>Returns</h4>
 <p> the <a class="link" href="GstGLDisplay.html#GstGLDisplayType" title="enum GstGLDisplayType"><span class="type">GstGLDisplayType</span></a> of <em class="parameter"><code>display</code></em>
 </p>
 <p></p>
@@ -172,12 +212,148 @@
 </div>
 <hr>
 <div class="refsect2">
+<a name="gst-gl-display-filter-gl-api"></a><h3>gst_gl_display_filter_gl_api ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_display_filter_gl_api (<em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> *display</code></em>,
+                              <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="type">GstGLAPI</span></a> api</code></em>);</pre>
+<p>limit the use of OpenGL to the requested <em class="parameter"><code>gl_api</code></em>
+.  This is intended to allow
+application and elements to request a specific set of OpenGL API's based on
+what they support.  See <a class="link" href="GstGLContext.html#gst-gl-context-get-gl-api" title="gst_gl_context_get_gl_api ()"><code class="function">gst_gl_context_get_gl_api()</code></a> for the retreiving the
+API supported by a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>.</p>
+<div class="refsect3">
+<a name="id-1.2.9.11.7.4.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>display</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-display-get-gl-api"></a><h3>gst_gl_display_get_gl_api ()</h3>
+<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="returnvalue">GstGLAPI</span></a>
+gst_gl_display_get_gl_api (<em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> *display</code></em>);</pre>
+<p>see <a class="link" href="GstGLDisplay.html#gst-gl-display-filter-gl-api" title="gst_gl_display_filter_gl_api ()"><code class="function">gst_gl_display_filter_gl_api()</code></a> for what the returned value represents</p>
+<div class="refsect3">
+<a name="id-1.2.9.11.7.5.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>display</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.11.7.5.6"></a><h4>Returns</h4>
+<p> the <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="type">GstGLAPI</span></a> configured for <em class="parameter"><code>display</code></em>
+</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-display-add-context"></a><h3>gst_gl_display_add_context ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_display_add_context (<em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> *display</code></em>,
+                            <em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.11.7.6.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>display</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>context</p></td>
+<td class="parameter_description"><p> a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.11.7.6.5"></a><h4>Returns</h4>
+<p> whether <em class="parameter"><code>context</code></em>
+was successfully added. <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> may be returned
+if there already exists another context for <em class="parameter"><code>context</code></em>
+'s active thread.</p>
+<p></p>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-display-get-gl-context-for-thread"></a><h3>gst_gl_display_get_gl_context_for_thread ()</h3>
+<pre class="programlisting"><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="returnvalue">GstGLContext</span></a> *
+gst_gl_display_get_gl_context_for_thread
+                               (<em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> *display</code></em>,
+                                <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Threads.html#GThread"><span class="type">GThread</span></a> *thread</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.11.7.7.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>display</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>thread</p></td>
+<td class="parameter_description"><p>a <a href="https://developer.gnome.org/glib/unstable/glib-Threads.html#GThread"><span class="type">GThread</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.11.7.7.5"></a><h4>Returns</h4>
+<p> the <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> current on <em class="parameter"><code>thread</code></em>
+or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p>
+<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-display-get-handle"></a><h3>gst_gl_display_get_handle ()</h3>
+<pre class="programlisting"><span class="returnvalue">guintptr</span>
+gst_gl_display_get_handle (<em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> *display</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
 <a name="gst-context-get-gl-display"></a><h3>gst_context_get_gl_display ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_context_get_gl_display (<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstContext.html"><span class="type">GstContext</span></a> *context</code></em>,
                             <em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> **display</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.10.7.4.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.11.7.9.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -199,7 +375,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.10.7.4.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.11.7.9.5"></a><h4>Returns</h4>
 <p> Whether <em class="parameter"><code>display</code></em>
 was in <em class="parameter"><code>context</code></em>
 </p>
@@ -217,7 +393,7 @@
  on <em class="parameter"><code>context</code></em>
 </p>
 <div class="refsect3">
-<a name="id-1.2.9.10.7.5.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.11.7.10.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -252,7 +428,7 @@
 <div class="refsect2">
 <a name="GstGLDisplayType"></a><h3>enum GstGLDisplayType</h3>
 <div class="refsect3">
-<a name="id-1.2.9.10.8.3.3"></a><h4>Members</h4>
+<a name="id-1.2.9.11.8.3.3"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="enum_members_name">
diff --git a/docs/libs/html/GstGLDownload.html b/docs/libs/html/GstGLDownload.html
index df756a7..9a19fcb 100644
--- a/docs/libs/html/GstGLDownload.html
+++ b/docs/libs/html/GstGLDownload.html
@@ -58,6 +58,14 @@
 </tr>
 <tr>
 <td class="function_type">
+<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="GstGLDownload.html#gst-gl-download-transform-caps" title="gst_gl_download_transform_caps ()">gst_gl_download_transform_caps</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
@@ -100,7 +108,7 @@
 <pre class="programlisting"><a class="link" href="GstGLDownload.html" title="GstGLDownload"><span class="returnvalue">GstGLDownload</span></a> *
 gst_gl_download_new (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.11.7.2.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.12.7.2.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -115,7 +123,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.11.7.2.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.12.7.2.5"></a><h4>Returns</h4>
 <p> a new <a class="link" href="GstGLDownload.html" title="GstGLDownload"><span class="type">GstGLDownload</span></a> object</p>
 <p></p>
 </div>
@@ -129,7 +137,7 @@
 <p>Initializes <em class="parameter"><code>download</code></em>
  with the information required for download.</p>
 <div class="refsect3">
-<a name="id-1.2.9.11.7.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.12.7.3.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -163,10 +171,20 @@
 </div>
 <hr>
 <div class="refsect2">
+<a name="gst-gl-download-transform-caps"></a><h3>gst_gl_download_transform_caps ()</h3>
+<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+gst_gl_download_transform_caps (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *convert</code></em>,
+                                <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#GstPadDirection"><span class="type">GstPadDirection</span></a> direction</code></em>,
+                                <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *caps</code></em>,
+                                <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *filter</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
 <a name="gst-gl-download-perform-with-data"></a><h3>gst_gl_download_perform_with_data ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_gl_download_perform_with_data (<em class="parameter"><code><a class="link" href="GstGLDownload.html" title="GstGLDownload"><span class="type">GstGLDownload</span></a> *download</code></em>,
                                    <em class="parameter"><code><span class="type">GLuint</span> texture_id</code></em>,
+                                   <em class="parameter"><code><span class="type">GLuint</span> texture_target</code></em>,
                                    <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data[GST_VIDEO_MAX_PLANES]</code></em>);</pre>
 <p>Downloads <em class="parameter"><code>texture_id</code></em>
  into <em class="parameter"><code>data</code></em>
@@ -174,7 +192,7 @@
  size and format is specified by
 the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoFormat"><span class="type">GstVideoFormat</span></a> passed to <a class="link" href="GstGLDownload.html#gst-gl-download-set-format" title="gst_gl_download_set_format ()"><code class="function">gst_gl_download_set_format()</code></a></p>
 <div class="refsect3">
-<a name="id-1.2.9.11.7.4.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.12.7.5.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -193,6 +211,11 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
+<td class="parameter_name"><p>texture_target</p></td>
+<td class="parameter_description"><p>the GL texture target</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
 <td class="parameter_name"><p>data</p></td>
 <td class="parameter_description"><p> where the downloaded data should go. </p></td>
 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
@@ -201,7 +224,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.11.7.4.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.12.7.5.6"></a><h4>Returns</h4>
 <p> whether the download was successful</p>
 <p></p>
 </div>
diff --git a/docs/libs/html/GstGLFilter.html b/docs/libs/html/GstGLFilter.html
index b8f240b..2a64b24 100644
--- a/docs/libs/html/GstGLFilter.html
+++ b/docs/libs/html/GstGLFilter.html
@@ -6,8 +6,8 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
-<link rel="prev" href="gst-plugins-bad-libs-GstEGLImageMemory.html" title="GstEGLImageMemory">
-<link rel="next" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">
+<link rel="prev" href="GstGLBaseFilter.html" title="GstGLBaseFilter">
+<link rel="next" href="GstGLFramebuffer.html" title="GstGLFramebuffer">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -16,13 +16,12 @@
 <td width="100%" align="left" class="shortcuts">
 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                   <a href="#GstGLFilter.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
-                  <a href="#GstGLFilter.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
-                  <a href="#GstGLFilter.properties" class="shortcut">Properties</a></span>
+                  <a href="#GstGLFilter.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-libs-GstEGLImageMemory.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-libs-GstGLFramebuffer.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="GstGLBaseFilter.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="GstGLFramebuffer.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="GstGLFilter"></a><div class="titlepage"></div>
@@ -77,22 +76,6 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="GstGLFilter.properties"></a><h2>Properties</h2>
-<div class="informaltable"><table border="0">
-<colgroup>
-<col width="150px" class="properties_type">
-<col width="300px" class="properties_name">
-<col width="200px" class="properties_flags">
-</colgroup>
-<tbody><tr>
-<td class="property_type">
-<a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *</td>
-<td class="property_name"><a class="link" href="GstGLFilter.html#GstGLFilter--other-context" title="The “other-context” property">other-context</a></td>
-<td class="property_flags">Read / Write</td>
-</tr></tbody>
-</table></div>
-</div>
-<div class="refsect1">
 <a name="GstGLFilter.other"></a><h2>Types and Values</h2>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
@@ -101,12 +84,12 @@
 </colgroup>
 <tbody>
 <tr>
-<td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="GstGLFilter.html#GstGLFilter-struct" title="struct GstGLFilter">GstGLFilter</a></td>
+<td class="datatype_keyword"> </td>
+<td class="function_name"><a class="link" href="GstGLFilter.html#GstGLFilter-struct" title="GstGLFilter">GstGLFilter</a></td>
 </tr>
 <tr>
-<td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="GstGLFilter.html#GstGLFilterClass" title="struct GstGLFilterClass">GstGLFilterClass</a></td>
+<td class="datatype_keyword"> </td>
+<td class="function_name"><a class="link" href="GstGLFilter.html#GstGLFilterClass" title="GstGLFilterClass">GstGLFilterClass</a></td>
 </tr>
 </tbody>
 </table></div>
@@ -118,7 +101,8 @@
         <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
             <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
                 <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html">GstBaseTransform</a>
-                    <span class="lineart">╰──</span> GstGLFilter
+                    <span class="lineart">╰──</span> <a class="link" href="GstGLBaseFilter.html" title="GstGLBaseFilter">GstGLBaseFilter</a>
+                        <span class="lineart">╰──</span> GstGLFilter
 </pre>
 </div>
 <div class="refsect1">
@@ -138,7 +122,7 @@
  and <em class="parameter"><code>height</code></em>
 .</p>
 <div class="refsect3">
-<a name="id-1.2.9.13.8.2.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.15.7.2.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -190,7 +174,7 @@
  is the input texture of <em class="parameter"><code>filter</code></em>
 .</p>
 <div class="refsect3">
-<a name="id-1.2.9.13.8.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.15.7.3.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -257,7 +241,7 @@
 .</p>
 <p>See also: <a class="link" href="GstGLFilter.html#gst-gl-filter-render-to-target" title="gst_gl_filter_render_to_target ()"><code class="function">gst_gl_filter_render_to_target()</code></a></p>
 <div class="refsect3">
-<a name="id-1.2.9.13.8.4.6"></a><h4>Parameters</h4>
+<a name="id-1.2.9.15.7.4.6"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -305,7 +289,7 @@
 <p>Perform automatic upload if needed, call filter_texture vfunc and then an
 automatic download if needed.</p>
 <div class="refsect3">
-<a name="id-1.2.9.13.8.5.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.15.7.5.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -332,7 +316,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.13.8.5.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.15.7.5.6"></a><h4>Returns</h4>
 <p> whether the transformation succeeded</p>
 <p></p>
 </div>
@@ -341,13 +325,13 @@
 <div class="refsect1">
 <a name="GstGLFilter.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
-<a name="GstGLFilter-struct"></a><h3>struct GstGLFilter</h3>
-<pre class="programlisting">struct GstGLFilter;</pre>
+<a name="GstGLFilter-struct"></a><h3>GstGLFilter</h3>
+<pre class="programlisting">typedef struct _GstGLFilter GstGLFilter;</pre>
 <p><a class="link" href="GstGLFilter.html" title="GstGLFilter"><span class="type">GstGLFilter</span></a> is a base class that provides the logic of getting the GL context
 from downstream and automatic upload/download for non-<a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a>
 <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a>s.</p>
 <div class="refsect3">
-<a name="id-1.2.9.13.9.2.5"></a><h4>Members</h4>
+<a name="id-1.2.9.15.8.2.5"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="struct_members_name">
@@ -360,9 +344,9 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="GstGLFilterClass"></a><h3>struct GstGLFilterClass</h3>
-<pre class="programlisting">struct GstGLFilterClass {
-  GstBaseTransformClass base_transform_class;
+<a name="GstGLFilterClass"></a><h3>GstGLFilterClass</h3>
+<pre class="programlisting">typedef struct {
+  GstGLBaseFilterClass parent_class;
 
   gboolean (*set_caps)          (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
   gboolean (*filter)            (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
@@ -376,10 +360,10 @@
   /* useful to init and cleanup custom gl resources */
   void (*display_init_cb)       (GstGLFilter *filter);
   void (*display_reset_cb)      (GstGLFilter *filter);
-};
+} GstGLFilterClass;
 </pre>
 <div class="refsect3">
-<a name="id-1.2.9.13.9.3.4"></a><h4>Members</h4>
+<a name="id-1.2.9.15.8.3.4"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="struct_members_name">
@@ -388,9 +372,9 @@
 </colgroup>
 <tbody>
 <tr>
-<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html#GstBaseTransformClass"><span class="type">GstBaseTransformClass</span></a> <em class="structfield"><code><a name="GstGLFilterClass.base-transform-class"></a>base_transform_class</code></em>;</p></td>
-<td class="struct_member_description"><p>parent class</p></td>
-<td class="struct_member_annotations"> </td>
+<td class="struct_member_name"><p><a class="link" href="GstGLBaseFilter.html#GstGLBaseFilterClass" title="GstGLBaseFilterClass"><span class="type">GstGLBaseFilterClass</span></a> <em class="structfield"><code><a name="GstGLFilterClass.parent-class"></a>parent_class</code></em>;</p></td>
+<td> </td>
+<td> </td>
 </tr>
 <tr>
 <td class="struct_member_name"><p><em class="structfield"><code><a name="GstGLFilterClass.set-caps"></a>set_caps</code></em> ()</p></td>
@@ -452,15 +436,6 @@
 </div>
 </div>
 </div>
-<div class="refsect1">
-<a name="GstGLFilter.property-details"></a><h2>Property Details</h2>
-<div class="refsect2">
-<a name="GstGLFilter--other-context"></a><h3>The <code class="literal">“other-context”</code> property</h3>
-<pre class="programlisting">  “other-context”            <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *</pre>
-<p>Give an external OpenGL context with which to share textures.</p>
-<p>Flags: Read / Write</p>
-</div>
-</div>
 </div>
 <div class="footer">
 <hr>
diff --git a/docs/libs/html/GstGLFramebuffer.html b/docs/libs/html/GstGLFramebuffer.html
new file mode 100644
index 0000000..708abd4
--- /dev/null
+++ b/docs/libs/html/GstGLFramebuffer.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Library Reference Manual: GstGLFramebuffer</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
+<link rel="up" href="gl.html" title="OpenGL Helper Library">
+<link rel="prev" href="GstGLFilter.html" title="GstGLFilter">
+<link rel="next" href="gst-plugins-bad-libs-gstglmemory.html" title="GstGLMemory">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#GstGLFramebuffer.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#GstGLFramebuffer.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="GstGLFilter.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-libs-gstglmemory.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="GstGLFramebuffer"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="GstGLFramebuffer.top_of_page"></a>GstGLFramebuffer</span></h2>
+<p>GstGLFramebuffer</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="GstGLFramebuffer.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer"><span class="returnvalue">GstGLFramebuffer</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-new" title="gst_gl_framebuffer_new ()">gst_gl_framebuffer_new</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-generate" title="gst_gl_framebuffer_generate ()">gst_gl_framebuffer_generate</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-delete" title="gst_gl_framebuffer_delete ()">gst_gl_framebuffer_delete</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-use-v2" title="gst_gl_framebuffer_use_v2 ()">gst_gl_framebuffer_use_v2</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="GstGLFramebuffer.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="GstGLFramebuffer.html#GstGLFramebuffer-struct" title="struct GstGLFramebuffer">GstGLFramebuffer</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="GstGLFramebuffer.html#GstGLFramebufferClass" title="struct GstGLFramebufferClass">GstGLFramebufferClass</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="GstGLFramebuffer.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> GstGLFramebuffer
+</pre>
+</div>
+<div class="refsect1">
+<a name="GstGLFramebuffer.description"></a><h2>Description</h2>
+</div>
+<div class="refsect1">
+<a name="GstGLFramebuffer.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="gst-gl-framebuffer-new"></a><h3>gst_gl_framebuffer_new ()</h3>
+<pre class="programlisting"><a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer"><span class="returnvalue">GstGLFramebuffer</span></a> *
+gst_gl_framebuffer_new (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-framebuffer-generate"></a><h3>gst_gl_framebuffer_generate ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_framebuffer_generate (<em class="parameter"><code><a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer"><span class="type">GstGLFramebuffer</span></a> *frame</code></em>,
+                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
+                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
+                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *fbo</code></em>,
+                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *depthbuffer</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-framebuffer-delete"></a><h3>gst_gl_framebuffer_delete ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_framebuffer_delete (<em class="parameter"><code><a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer"><span class="type">GstGLFramebuffer</span></a> *frame</code></em>,
+                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> fbo</code></em>,
+                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> depth</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-framebuffer-use-v2"></a><h3>gst_gl_framebuffer_use_v2 ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_framebuffer_use_v2 (<em class="parameter"><code><a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer"><span class="type">GstGLFramebuffer</span></a> *frame</code></em>,
+                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_width</code></em>,
+                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_height</code></em>,
+                           <em class="parameter"><code><span class="type">GLuint</span> fbo</code></em>,
+                           <em class="parameter"><code><span class="type">GLuint</span> depth_buffer</code></em>,
+                           <em class="parameter"><code><span class="type">GLuint</span> texture_fbo</code></em>,
+                           <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Utilities.html#GLCB-V2:CAPS" title="GLCB_V2 ()"><span class="type">GLCB_V2</span></a> cb</code></em>,
+                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> stuff</code></em>);</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="GstGLFramebuffer.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstGLFramebuffer-struct"></a><h3>struct GstGLFramebuffer</h3>
+<pre class="programlisting">struct GstGLFramebuffer;</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstGLFramebufferClass"></a><h3>struct GstGLFramebufferClass</h3>
+<pre class="programlisting">struct GstGLFramebufferClass {
+  GObjectClass object_class;
+};
+</pre>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/libs/html/GstGLUpload.html b/docs/libs/html/GstGLUpload.html
index 05e6e63..8e4c7db 100644
--- a/docs/libs/html/GstGLUpload.html
+++ b/docs/libs/html/GstGLUpload.html
@@ -6,8 +6,8 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
-<link rel="prev" href="gst-plugins-bad-libs-gstglshader.html" title="GstGLShader">
-<link rel="next" href="gst-plugins-bad-libs-GstGLUploadMeta.html" title="GstGLUploadMeta">
+<link rel="prev" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">
+<link rel="next" href="GstGLUploadMeta.html" title="GstGLUploadMeta">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -20,8 +20,8 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-libs-gstglshader.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-libs-GstGLUploadMeta.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLSyncMeta.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="GstGLUploadMeta.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="GstGLUpload"></a><div class="titlepage"></div>
@@ -53,15 +53,7 @@
 <span class="returnvalue">void</span>
 </td>
 <td class="function_name">
-<a class="link" href="GstGLUpload.html#gst-gl-upload-set-format" title="gst_gl_upload_set_format ()">gst_gl_upload_set_format</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="returnvalue">GstVideoInfo</span></a> *
-</td>
-<td class="function_name">
-<a class="link" href="GstGLUpload.html#gst-gl-upload-get-format" title="gst_gl_upload_get_format ()">gst_gl_upload_get_format</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLUpload.html#gst-gl-upload-get-caps" title="gst_gl_upload_get_caps ()">gst_gl_upload_get_caps</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 <tr>
@@ -69,20 +61,28 @@
 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
-<a class="link" href="GstGLUpload.html#gst-gl-upload-perform-with-data" title="gst_gl_upload_perform_with_data ()">gst_gl_upload_perform_with_data</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLUpload.html#gst-gl-upload-set-caps" title="gst_gl_upload_set_caps ()">gst_gl_upload_set_caps</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 <tr>
 <td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+<span class="returnvalue">void</span>
 </td>
 <td class="function_name">
-<a class="link" href="GstGLUpload.html#gst-gl-upload-perform-with-gl-texture-upload-meta" title="gst_gl_upload_perform_with_gl_texture_upload_meta ()">gst_gl_upload_perform_with_gl_texture_upload_meta</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLUpload.html#gst-gl-upload-propose-allocation" title="gst_gl_upload_propose_allocation ()">gst_gl_upload_propose_allocation</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 <tr>
 <td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="GstGLUpload.html#gst-gl-upload-transform-caps" title="gst_gl_upload_transform_caps ()">gst_gl_upload_transform_caps</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">GstGLUploadReturn</span>
 </td>
 <td class="function_name">
 <a class="link" href="GstGLUpload.html#gst-gl-upload-perform-with-buffer" title="gst_gl_upload_perform_with_buffer ()">gst_gl_upload_perform_with_buffer</a> <span class="c_punctuation">()</span>
@@ -132,7 +132,7 @@
 <pre class="programlisting"><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="returnvalue">GstGLUpload</span></a> *
 gst_gl_upload_new (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.2.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.20.7.2.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -147,21 +147,20 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.2.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.20.7.2.5"></a><h4>Returns</h4>
 <p> a new <a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> object</p>
 <p></p>
 </div>
 </div>
 <hr>
 <div class="refsect2">
-<a name="gst-gl-upload-set-format"></a><h3>gst_gl_upload_set_format ()</h3>
+<a name="gst-gl-upload-get-caps"></a><h3>gst_gl_upload_get_caps ()</h3>
 <pre class="programlisting"><span class="returnvalue">void</span>
-gst_gl_upload_set_format (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>,
-                          <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *in_info</code></em>);</pre>
-<p>Initializes <em class="parameter"><code>upload</code></em>
- with the information required for upload.</p>
+gst_gl_upload_get_caps (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>,
+                        <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> **in_caps</code></em>,
+                        <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> **out_caps</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.20.7.3.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -175,53 +174,35 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>in_info</p></td>
-<td class="parameter_description"><p>input <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a></p></td>
-<td class="parameter_annotations"> </td>
+<td class="parameter_name"><p>in_caps</p></td>
+<td class="parameter_description"><p> (allow-none): (out): the input <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ou_caps</p></td>
+<td class="parameter_description"><p> (allow-none): (out): the output <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a>. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
 </tr>
 </tbody>
 </table></div>
 </div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-gl-upload-get-format"></a><h3>gst_gl_upload_get_format ()</h3>
-<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="returnvalue">GstVideoInfo</span></a> *
-gst_gl_upload_get_format (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.4.4"></a><h4>Parameters</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="parameters_name">
-<col class="parameters_description">
-<col width="200px" class="parameters_annotations">
-</colgroup>
-<tbody><tr>
-<td class="parameter_name"><p>upload</p></td>
-<td class="parameter_description"><p>a <a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a></p></td>
-<td class="parameter_annotations"> </td>
-</tr></tbody>
-</table></div>
-</div>
-<div class="refsect3">
-<a name="id-1.2.9.17.7.4.5"></a><h4>Returns</h4>
-<p> The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> set by <a class="link" href="GstGLUpload.html#gst-gl-upload-set-format" title="gst_gl_upload_set_format ()"><code class="function">gst_gl_upload_set_format()</code></a>. </p>
+<a name="id-1.2.9.20.7.3.5"></a><h4>Returns</h4>
+<p> The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> set by <a class="link" href="GstGLUpload.html#gst-gl-upload-set-caps" title="gst_gl_upload_set_caps ()"><code class="function">gst_gl_upload_set_caps()</code></a>. </p>
 <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
 </div>
 </div>
 <hr>
 <div class="refsect2">
-<a name="gst-gl-upload-perform-with-data"></a><h3>gst_gl_upload_perform_with_data ()</h3>
+<a name="gst-gl-upload-set-caps"></a><h3>gst_gl_upload_set_caps ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_upload_perform_with_data (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>,
-                                 <em class="parameter"><code><span class="type">GLuint</span> *texture_id</code></em>,
-                                 <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data[GST_VIDEO_MAX_PLANES]</code></em>);</pre>
-<p>Uploads <em class="parameter"><code>data</code></em>
- into <em class="parameter"><code>texture_id</code></em>
-. data size and format is specified by
-the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a>s passed to <a class="link" href="GstGLUpload.html#gst-gl-upload-set-format" title="gst_gl_upload_set_format ()"><code class="function">gst_gl_upload_set_format()</code></a></p>
+gst_gl_upload_set_caps (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>,
+                        <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *in_caps</code></em>,
+                        <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *out_caps</code></em>);</pre>
+<p>Initializes <em class="parameter"><code>upload</code></em>
+ with the information required for upload.</p>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.5.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.20.7.4.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -235,37 +216,37 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>texture_id</p></td>
-<td class="parameter_description"><p> the texture id to upload into. </p></td>
-<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
+<td class="parameter_name"><p>in_caps</p></td>
+<td class="parameter_description"><p>input <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a></p></td>
+<td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>data</p></td>
-<td class="parameter_description"><p>where the downloaded data should go</p></td>
+<td class="parameter_name"><p>out_caps</p></td>
+<td class="parameter_description"><p>output <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a></p></td>
 <td class="parameter_annotations"> </td>
 </tr>
 </tbody>
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.5.6"></a><h4>Returns</h4>
-<p> whether the upload was successful</p>
+<a name="id-1.2.9.20.7.4.6"></a><h4>Returns</h4>
+<p> whether <em class="parameter"><code>in_caps</code></em>
+and <em class="parameter"><code>out_caps</code></em>
+could be set on <em class="parameter"><code>upload</code></em>
+</p>
 <p></p>
 </div>
 </div>
 <hr>
 <div class="refsect2">
-<a name="gst-gl-upload-perform-with-gl-texture-upload-meta"></a><h3>gst_gl_upload_perform_with_gl_texture_upload_meta ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_upload_perform_with_gl_texture_upload_meta
-                               (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>,
-                                <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideometa.html#GstVideoGLTextureUploadMeta"><span class="type">GstVideoGLTextureUploadMeta</span></a> *meta</code></em>,
-                                <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> texture_id[4]</code></em>);</pre>
-<p>Uploads <em class="parameter"><code>meta</code></em>
- into <em class="parameter"><code>texture_id</code></em>
-.</p>
+<a name="gst-gl-upload-propose-allocation"></a><h3>gst_gl_upload_propose_allocation ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_upload_propose_allocation (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>,
+                                  <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html"><span class="type">GstQuery</span></a> *decide_query</code></em>,
+                                  <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html"><span class="type">GstQuery</span></a> *query</code></em>);</pre>
+<p>Adds the required allocation parameters to support uploading.</p>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.6.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.20.7.5.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -279,38 +260,42 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>meta</p></td>
-<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideometa.html#GstVideoGLTextureUploadMeta"><span class="type">GstVideoGLTextureUploadMeta</span></a></p></td>
-<td class="parameter_annotations"> </td>
+<td class="parameter_name"><p>decide_query</p></td>
+<td class="parameter_description"><p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html"><span class="type">GstQuery</span></a> from a decide allocation. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
 </tr>
 <tr>
-<td class="parameter_name"><p>texture_id</p></td>
-<td class="parameter_description"><p>resulting GL textures to place the data into.</p></td>
+<td class="parameter_name"><p>query</p></td>
+<td class="parameter_description"><p>the proposed allocation query</p></td>
 <td class="parameter_annotations"> </td>
 </tr>
 </tbody>
 </table></div>
 </div>
-<div class="refsect3">
-<a name="id-1.2.9.17.7.6.6"></a><h4>Returns</h4>
-<p> whether the upload was successful</p>
-<p></p>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-upload-transform-caps"></a><h3>gst_gl_upload_transform_caps ()</h3>
+<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+gst_gl_upload_transform_caps (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                              <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#GstPadDirection"><span class="type">GstPadDirection</span></a> direction</code></em>,
+                              <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *caps</code></em>,
+                              <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *filter</code></em>);</pre>
 </div>
 <hr>
 <div class="refsect2">
 <a name="gst-gl-upload-perform-with-buffer"></a><h3>gst_gl_upload_perform_with_buffer ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+<pre class="programlisting"><span class="returnvalue">GstGLUploadReturn</span>
 gst_gl_upload_perform_with_buffer (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>,
                                    <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *buffer</code></em>,
-                                   <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *tex_id</code></em>);</pre>
+                                   <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> **outbuf</code></em>);</pre>
 <p>Uploads <em class="parameter"><code>buffer</code></em>
  to the texture given by <em class="parameter"><code>tex_id</code></em>
 .  <em class="parameter"><code>tex_id</code></em>
  is valid
 until <a class="link" href="GstGLUpload.html#gst-gl-upload-release-buffer" title="gst_gl_upload_release_buffer ()"><code class="function">gst_gl_upload_release_buffer()</code></a> is called.</p>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.7.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.20.7.7.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -329,15 +314,15 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>tex_id</p></td>
-<td class="parameter_description"><p>resulting texture</p></td>
-<td class="parameter_annotations"> </td>
+<td class="parameter_name"><p>outbuf_ptr</p></td>
+<td class="parameter_description"><p> resulting buffer. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
 </tr>
 </tbody>
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.17.7.7.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.20.7.7.6"></a><h4>Returns</h4>
 <p> whether the upload was successful</p>
 <p></p>
 </div>
@@ -347,6 +332,23 @@
 <a name="gst-gl-upload-release-buffer"></a><h3>gst_gl_upload_release_buffer ()</h3>
 <pre class="programlisting"><span class="returnvalue">void</span>
 gst_gl_upload_release_buffer (<em class="parameter"><code><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> *upload</code></em>);</pre>
+<p>Releases any buffers currently referenced by <em class="parameter"><code>upload</code></em>
+</p>
+<div class="refsect3">
+<a name="id-1.2.9.20.7.8.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>upload</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
 </div>
 </div>
 <div class="refsect1">
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLUploadMeta.html b/docs/libs/html/GstGLUploadMeta.html
similarity index 68%
rename from docs/libs/html/gst-plugins-bad-libs-GstGLUploadMeta.html
rename to docs/libs/html/GstGLUploadMeta.html
index 7497ad8..470765f 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLUploadMeta.html
+++ b/docs/libs/html/GstGLUploadMeta.html
@@ -15,7 +15,8 @@
 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
 <td width="100%" align="left" class="shortcuts">
 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-libs-GstGLUploadMeta.description" class="shortcut">Description</a></span>
+                  <a href="#GstGLUploadMeta.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#GstGLUploadMeta.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
@@ -23,16 +24,16 @@
 <td><a accesskey="n" href="gst-plugins-bad-libs-Utilities.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
-<a name="gst-plugins-bad-libs-GstGLUploadMeta"></a><div class="titlepage"></div>
+<a name="GstGLUploadMeta"></a><div class="titlepage"></div>
 <div class="refnamediv"><table width="100%"><tr>
 <td valign="top">
-<h2><span class="refentrytitle"><a name="gst-plugins-bad-libs-GstGLUploadMeta.top_of_page"></a>GstGLUploadMeta</span></h2>
+<h2><span class="refentrytitle"><a name="GstGLUploadMeta.top_of_page"></a>GstGLUploadMeta</span></h2>
 <p>GstGLUploadMeta — an object that provides <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideometa.html#GstVideoGLTextureUploadMeta"><span class="type">GstVideoGLTextureUploadMeta</span></a></p>
 </td>
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLUploadMeta.functions"></a><h2>Functions</h2>
+<a name="GstGLUploadMeta.functions"></a><h2>Functions</h2>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="functions_return">
@@ -41,10 +42,10 @@
 <tbody>
 <tr>
 <td class="function_type">
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="returnvalue">GstGLUploadMeta</span></a> *
+<a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="returnvalue">GstGLUploadMeta</span></a> *
 </td>
 <td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-new" title="gst_gl_upload_meta_new ()">gst_gl_upload_meta_new</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-new" title="gst_gl_upload_meta_new ()">gst_gl_upload_meta_new</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 <tr>
@@ -52,7 +53,7 @@
 <span class="returnvalue">void</span>
 </td>
 <td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-set-format" title="gst_gl_upload_meta_set_format ()">gst_gl_upload_meta_set_format</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-set-format" title="gst_gl_upload_meta_set_format ()">gst_gl_upload_meta_set_format</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 <tr>
@@ -60,7 +61,7 @@
 <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="returnvalue">GstVideoInfo</span></a> *
 </td>
 <td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-get-format" title="gst_gl_upload_meta_get_format ()">gst_gl_upload_meta_get_format</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-get-format" title="gst_gl_upload_meta_get_format ()">gst_gl_upload_meta_get_format</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 <tr>
@@ -68,14 +69,14 @@
 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer" title="gst_gl_upload_meta_add_to_buffer ()">gst_gl_upload_meta_add_to_buffer</a> <span class="c_punctuation">()</span>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer" title="gst_gl_upload_meta_add_to_buffer ()">gst_gl_upload_meta_add_to_buffer</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
 </tbody>
 </table></div>
 </div>
 <div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLUploadMeta.other"></a><h2>Types and Values</h2>
+<a name="GstGLUploadMeta.other"></a><h2>Types and Values</h2>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="name">
@@ -83,23 +84,31 @@
 </colgroup>
 <tbody><tr>
 <td class="datatype_keyword"> </td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta">GstGLUploadMeta</a></td>
+<td class="function_name"><a class="link" href="GstGLUploadMeta.html#GstGLUploadMeta-struct" title="GstGLUploadMeta">GstGLUploadMeta</a></td>
 </tr></tbody>
 </table></div>
 </div>
 <div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLUploadMeta.description"></a><h2>Description</h2>
-<p><a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> is an object that uploads data from system memory into GL textures.</p>
+<a name="GstGLUploadMeta.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> GstGLUploadMeta
+</pre>
+</div>
+<div class="refsect1">
+<a name="GstGLUploadMeta.description"></a><h2>Description</h2>
+<p><a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> is an object that uploads data from system memory into GL textures.</p>
 <p>A <a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a> can be created with <a class="link" href="GstGLUpload.html#gst-gl-upload-new" title="gst_gl_upload_new ()"><code class="function">gst_gl_upload_new()</code></a></p>
 </div>
 <div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLUploadMeta.functions_details"></a><h2>Functions</h2>
+<a name="GstGLUploadMeta.functions_details"></a><h2>Functions</h2>
 <div class="refsect2">
 <a name="gst-gl-upload-meta-new"></a><h3>gst_gl_upload_meta_new ()</h3>
-<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="returnvalue">GstGLUploadMeta</span></a> *
+<pre class="programlisting"><a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="returnvalue">GstGLUploadMeta</span></a> *
 gst_gl_upload_meta_new (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.18.6.2.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.21.7.2.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -114,8 +123,8 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.18.6.2.5"></a><h4>Returns</h4>
-<p> a new <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> object</p>
+<a name="id-1.2.9.21.7.2.5"></a><h4>Returns</h4>
+<p> a new <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> object</p>
 <p></p>
 </div>
 </div>
@@ -123,12 +132,12 @@
 <div class="refsect2">
 <a name="gst-gl-upload-meta-set-format"></a><h3>gst_gl_upload_meta_set_format ()</h3>
 <pre class="programlisting"><span class="returnvalue">void</span>
-gst_gl_upload_meta_set_format (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> *upload</code></em>,
+gst_gl_upload_meta_set_format (<em class="parameter"><code><a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> *upload</code></em>,
                                <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>);</pre>
 <p>Initializes <em class="parameter"><code>upload</code></em>
  with the information required for upload.</p>
 <div class="refsect3">
-<a name="id-1.2.9.18.6.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.21.7.3.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -154,9 +163,9 @@
 <div class="refsect2">
 <a name="gst-gl-upload-meta-get-format"></a><h3>gst_gl_upload_meta_get_format ()</h3>
 <pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="returnvalue">GstVideoInfo</span></a> *
-gst_gl_upload_meta_get_format (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> *upload</code></em>);</pre>
+gst_gl_upload_meta_get_format (<em class="parameter"><code><a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> *upload</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.18.6.4.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.21.7.4.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -171,9 +180,9 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.18.6.4.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.21.7.4.5"></a><h4>Returns</h4>
 <p> The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> set by
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-set-format" title="gst_gl_upload_meta_set_format ()"><code class="function">gst_gl_upload_meta_set_format()</code></a>. </p>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-set-format" title="gst_gl_upload_meta_set_format ()"><code class="function">gst_gl_upload_meta_set_format()</code></a>. </p>
 <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
 </div>
 </div>
@@ -181,13 +190,13 @@
 <div class="refsect2">
 <a name="gst-gl-upload-meta-add-to-buffer"></a><h3>gst_gl_upload_meta_add_to_buffer ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_upload_meta_add_to_buffer (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> *upload</code></em>,
+gst_gl_upload_meta_add_to_buffer (<em class="parameter"><code><a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> *upload</code></em>,
                                   <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *buffer</code></em>);</pre>
 <p>Adds a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideometa.html#GstVideoGLTextureUploadMeta"><span class="type">GstVideoGLTextureUploadMeta</span></a> on <em class="parameter"><code>buffer</code></em>
  using <em class="parameter"><code>upload</code></em>
 </p>
 <div class="refsect3">
-<a name="id-1.2.9.18.6.5.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.21.7.5.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -197,7 +206,7 @@
 <tbody>
 <tr>
 <td class="parameter_name"><p>upload</p></td>
-<td class="parameter_description"><p>a <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a></p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a></p></td>
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
@@ -209,24 +218,22 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.18.6.5.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.21.7.5.6"></a><h4>Returns</h4>
 <p> whether it was successful</p>
 <p></p>
 </div>
 </div>
 </div>
 <div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLUploadMeta.other_details"></a><h2>Types and Values</h2>
+<a name="GstGLUploadMeta.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
-<a name="GstGLUploadMeta"></a><h3>GstGLUploadMeta</h3>
-<pre class="programlisting">typedef struct {
-} GstGLUploadMeta;
-</pre>
-<p>Opaque <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> object</p>
+<a name="GstGLUploadMeta-struct"></a><h3>GstGLUploadMeta</h3>
+<pre class="programlisting">typedef struct _GstGLUploadMeta GstGLUploadMeta;</pre>
+<p>Opaque <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta"><span class="type">GstGLUploadMeta</span></a> object</p>
 </div>
 </div>
 <div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLUploadMeta.see-also"></a><h2>See Also</h2>
+<a name="GstGLUploadMeta.see-also"></a><h2>See Also</h2>
 <p><a class="link" href="GstGLUpload.html" title="GstGLUpload"><span class="type">GstGLUpload</span></a>, <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a></p>
 </div>
 </div>
diff --git a/docs/libs/html/GstGLWindow.html b/docs/libs/html/GstGLWindow.html
index f7d5fa0..8e91a14 100644
--- a/docs/libs/html/GstGLWindow.html
+++ b/docs/libs/html/GstGLWindow.html
@@ -16,7 +16,8 @@
 <td width="100%" align="left" class="shortcuts">
 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                   <a href="#GstGLWindow.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
-                  <a href="#GstGLWindow.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+                  <a href="#GstGLWindow.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_signals">  <span class="dim">|</span> 
+                  <a href="#GstGLWindow.signals" class="shortcut">Signals</a></span>
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
@@ -200,6 +201,70 @@
 <a class="link" href="GstGLWindow.html#gst-gl-window-get-window-handle" title="gst_gl_window_get_window_handle ()">gst_gl_window_get_window_handle</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLWindow.html#gst-gl-window-set-preferred-size" title="gst_gl_window_set_preferred_size ()">gst_gl_window_set_preferred_size</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLWindow.html#gst-gl-window-show" title="gst_gl_window_show ()">gst_gl_window_show</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLWindow.html#gst-gl-window-get-surface-dimensions" title="gst_gl_window_get_surface_dimensions ()">gst_gl_window_get_surface_dimensions</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="GstGLWindow.html#gst-gl-window-handle-events" title="gst_gl_window_handle_events ()">gst_gl_window_handle_events</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="GstGLWindow.signals"></a><h2>Signals</h2>
+<div class="informaltable"><table border="0">
+<colgroup>
+<col width="150px" class="signals_return">
+<col width="300px" class="signals_name">
+<col width="200px" class="signals_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="signal_type"><span class="returnvalue">void</span></td>
+<td class="signal_name"><a class="link" href="GstGLWindow.html#GstGLWindow-key-event" title="The “key-event” signal">key-event</a></td>
+<td class="signal_flags">Run Last</td>
+</tr>
+<tr>
+<td class="signal_type"><span class="returnvalue">void</span></td>
+<td class="signal_name"><a class="link" href="GstGLWindow.html#GstGLWindow-mouse-event" title="The “mouse-event” signal">mouse-event</a></td>
+<td class="signal_flags">Run Last</td>
+</tr>
+<tr>
+<td class="signal_type"><span class="returnvalue">void</span></td>
+<td class="signal_name"><a class="link" href="GstGLWindow.html#GstGLWindow-key-event" title="The “key-event” signal">key-event</a></td>
+<td class="signal_flags">Run Last</td>
+</tr>
+<tr>
+<td class="signal_type"><span class="returnvalue">void</span></td>
+<td class="signal_name"><a class="link" href="GstGLWindow.html#GstGLWindow-mouse-event" title="The “mouse-event” signal">mouse-event</a></td>
+<td class="signal_flags">Run Last</td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -284,7 +349,7 @@
 <pre class="programlisting"><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="returnvalue">GstGLWindow</span></a> *
 gst_gl_window_new (<em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> *display</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.8.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.8.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -299,7 +364,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.8.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.23.8.8.5"></a><h4>Returns</h4>
 <p> a new <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> using <em class="parameter"><code>display</code></em>
 's connection. </p>
 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
@@ -310,35 +375,21 @@
 <div class="refsect2">
 <a name="gst-gl-window-draw"></a><h3>gst_gl_window_draw ()</h3>
 <pre class="programlisting"><span class="returnvalue">void</span>
-gst_gl_window_draw (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>,
-                    <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> width</code></em>,
-                    <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> height</code></em>);</pre>
+gst_gl_window_draw (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <p>Redraw the window contents.  Implementations should invoke the draw callback.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.9.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.9.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
 <col class="parameters_description">
 <col width="200px" class="parameters_annotations">
 </colgroup>
-<tbody>
-<tr>
+<tbody><tr>
 <td class="parameter_name"><p>window</p></td>
 <td class="parameter_description"><p>a <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
 <td class="parameter_annotations"> </td>
-</tr>
-<tr>
-<td class="parameter_name"><p>width</p></td>
-<td class="parameter_description"><p>requested width of the window</p></td>
-<td class="parameter_annotations"> </td>
-</tr>
-<tr>
-<td class="parameter_name"><p>height</p></td>
-<td class="parameter_description"><p>requested height of the window</p></td>
-<td class="parameter_annotations"> </td>
-</tr>
-</tbody>
+</tr></tbody>
 </table></div>
 </div>
 <p class="since">Since 1.4</p>
@@ -347,35 +398,21 @@
 <div class="refsect2">
 <a name="gst-gl-window-draw-unlocked"></a><h3>gst_gl_window_draw_unlocked ()</h3>
 <pre class="programlisting"><span class="returnvalue">void</span>
-gst_gl_window_draw_unlocked (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>,
-                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> width</code></em>,
-                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> height</code></em>);</pre>
+gst_gl_window_draw_unlocked (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <p>Redraw the window contents.  Implementations should invoke the draw callback.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.10.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.10.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
 <col class="parameters_description">
 <col width="200px" class="parameters_annotations">
 </colgroup>
-<tbody>
-<tr>
+<tbody><tr>
 <td class="parameter_name"><p>window</p></td>
 <td class="parameter_description"><p>a <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
 <td class="parameter_annotations"> </td>
-</tr>
-<tr>
-<td class="parameter_name"><p>width</p></td>
-<td class="parameter_description"><p>requested width of the window</p></td>
-<td class="parameter_annotations"> </td>
-</tr>
-<tr>
-<td class="parameter_name"><p>height</p></td>
-<td class="parameter_description"><p>requested height of the window</p></td>
-<td class="parameter_annotations"> </td>
-</tr>
-</tbody>
+</tr></tbody>
 </table></div>
 </div>
 <p class="since">Since 1.4</p>
@@ -387,7 +424,7 @@
 gst_gl_window_is_running (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <p>Whether the runloop is running</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.11.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.11.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -410,7 +447,7 @@
 gst_gl_window_quit (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <p>Quit the runloop's execution.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.12.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.12.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -433,7 +470,7 @@
 gst_gl_window_run (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <p>Start the execution of the runloop.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.13.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.13.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -455,7 +492,7 @@
 <pre class="programlisting"><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="returnvalue">GstGLContext</span></a> *
 gst_gl_window_get_context (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.14.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.14.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -470,7 +507,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.14.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.23.8.14.5"></a><h4>Returns</h4>
 <p> the <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> associated with this <em class="parameter"><code>window</code></em>
 . </p>
 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
@@ -483,7 +520,7 @@
 <pre class="programlisting"><span class="returnvalue">guintptr</span>
 gst_gl_window_get_display (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.15.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.15.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -498,7 +535,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.15.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.23.8.15.5"></a><h4>Returns</h4>
 <p> the windowing system display handle for this <em class="parameter"><code>window</code></em>
 </p>
 <p></p>
@@ -517,7 +554,7 @@
  is guarenteed to
 have executed when this function returns.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.16.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.16.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -559,7 +596,7 @@
  on the window thread.  The callback may not
 have been executed when this function returns.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.17.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.17.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -604,7 +641,7 @@
                                   <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy_notify</code></em>);</pre>
 <p>Sets the callback called when the window is about to close.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.18.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.18.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -649,7 +686,7 @@
                                  <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy_notify</code></em>);</pre>
 <p>Sets the draw callback called everytime <a class="link" href="GstGLWindow.html#gst-gl-window-draw" title="gst_gl_window_draw ()"><code class="function">gst_gl_window_draw()</code></a> is called</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.19.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.19.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -694,7 +731,7 @@
                                    <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy_notify</code></em>);</pre>
 <p>Sets the resize callback called everytime a resize of the window occurs.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.20.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.20.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -739,7 +776,7 @@
  should render into.  Some implementations
 require this to be called with a valid handle before drawing can commence.</p>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.21.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.21.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -768,7 +805,7 @@
 <pre class="programlisting"><span class="returnvalue">guintptr</span>
 gst_gl_window_get_window_handle (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.22.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.23.8.22.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -783,19 +820,152 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.20.7.22.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.23.8.22.5"></a><h4>Returns</h4>
 <p> the window handle we are currently rendering into</p>
 <p></p>
 </div>
 <p class="since">Since 1.4</p>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-window-set-preferred-size"></a><h3>gst_gl_window_set_preferred_size ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_window_set_preferred_size (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>,
+                                  <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
+                                  <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>);</pre>
+<p>Set the preferred width and height of the window.  Implementations are free
+to ignore this information.</p>
+<div class="refsect3">
+<a name="id-1.2.9.23.8.23.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>window</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>width</p></td>
+<td class="parameter_description"><p>new preferred width</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>height</p></td>
+<td class="parameter_description"><p>new preferred height</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-window-show"></a><h3>gst_gl_window_show ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_window_show (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>);</pre>
+<p>Present the window to the screen.</p>
+<div class="refsect3">
+<a name="id-1.2.9.23.8.24.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>window</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-window-get-surface-dimensions"></a><h3>gst_gl_window_get_surface_dimensions ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_window_get_surface_dimensions (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>,
+                                      <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *width</code></em>,
+                                      <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *height</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.23.8.25.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>window</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>width</p></td>
+<td class="parameter_description"><p> resulting surface width. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>height</p></td>
+<td class="parameter_description"><p> resulting surface height. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-window-handle-events"></a><h3>gst_gl_window_handle_events ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_window_handle_events (<em class="parameter"><code><a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *window</code></em>,
+                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> handle_events</code></em>);</pre>
+<p>Tell a <em class="parameter"><code>window</code></em>
+ that it should handle events from the window system. These
+events are forwarded upstream as navigation events. In some window systems
+events are not propagated in the window hierarchy if a client is listening
+for them. This method allows you to disable events handling completely
+from the <em class="parameter"><code>window</code></em>
+.</p>
+<div class="refsect3">
+<a name="id-1.2.9.23.8.26.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>window</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>handle_events</p></td>
+<td class="parameter_description"><p>a <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> indicating if events should be handled or not.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
 </div>
 <div class="refsect1">
 <a name="GstGLWindow.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
 <a name="GstGLWindowError"></a><h3>enum GstGLWindowError</h3>
 <div class="refsect3">
-<a name="id-1.2.9.20.8.2.3"></a><h4>Members</h4>
+<a name="id-1.2.9.23.9.2.3"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="enum_members_name">
@@ -838,8 +1008,8 @@
   guintptr (*get_display)        (GstGLWindow *window);
   void     (*set_window_handle)  (GstGLWindow *window, guintptr id);
   guintptr (*get_window_handle)  (GstGLWindow *window);
-  void     (*draw_unlocked)      (GstGLWindow *window, guint width, guint height);
-  void     (*draw)               (GstGLWindow *window, guint width, guint height);
+  void     (*draw_unlocked)      (GstGLWindow *window);
+  void     (*draw)               (GstGLWindow *window);
   void     (*run)                (GstGLWindow *window);
   void     (*quit)               (GstGLWindow *window);
   void     (*send_message)       (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
@@ -847,10 +1017,14 @@
 
   gboolean (*open)               (GstGLWindow *window, GError **error);
   void     (*close)              (GstGLWindow *window);
+  void     (*get_surface_dimensions)  (GstGLWindow *window, guint *width, guint *height);
+  void     (*handle_events)      (GstGLWindow *window, gboolean handle_events);
+  void     (*set_preferred_size) (GstGLWindow *window, gint width, gint height);
+  void     (*show)               (GstGLWindow *window);
 } GstGLWindowClass;
 </pre>
 <div class="refsect3">
-<a name="id-1.2.9.20.8.4.4"></a><h4>Members</h4>
+<a name="id-1.2.9.23.9.4.4"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="struct_members_name">
@@ -921,12 +1095,238 @@
 <td class="struct_member_description"><p>close the connection to the display</p></td>
 <td class="struct_member_annotations"> </td>
 </tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstGLWindowClass.get-surface-dimensions"></a>get_surface_dimensions</code></em> ()</p></td>
+<td class="struct_member_description"><p>get the width and height of the surface we are
+rendering into.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstGLWindowClass.handle-events"></a>handle_events</code></em> ()</p></td>
+<td class="struct_member_description"><p>whether to handle 'extra' events from the windowing system.
+Basic events like surface moves and resizes are still valid
+things to listen for.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstGLWindowClass.set-preferred-size"></a>set_preferred_size</code></em> ()</p></td>
+<td class="struct_member_description"><p>request that the window change surface size.  The
+implementation is free to ignore this information.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstGLWindowClass.show"></a>show</code></em> ()</p></td>
+<td> </td>
+<td> </td>
+</tr>
 </tbody>
 </table></div>
 </div>
 </div>
 </div>
 <div class="refsect1">
+<a name="GstGLWindow.signal-details"></a><h2>Signal Details</h2>
+<div class="refsect2">
+<a name="GstGLWindow-key-event"></a><h3>The <code class="literal">“key-event”</code> signal</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+user_function (<a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *object,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>       *id,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>       *key,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>     user_data)</pre>
+<p>Will be emitted when a key event is received by the GstGLwindow.</p>
+<div class="refsect3">
+<a name="id-1.2.9.23.10.2.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>object</p></td>
+<td class="parameter_description"><p>the <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>id</p></td>
+<td class="parameter_description"><p>the name of the event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>key</p></td>
+<td class="parameter_description"><p>the id of the key pressed</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p>Flags: Run Last</p>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstGLWindow-mouse-event"></a><h3>The <code class="literal">“mouse-event”</code> signal</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+user_function (<a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *object,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>       *id,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>         button,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>      x,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>      y,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>     user_data)</pre>
+<p>Will be emitted when a mouse event is received by the GstGLwindow.</p>
+<div class="refsect3">
+<a name="id-1.2.9.23.10.3.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>object</p></td>
+<td class="parameter_description"><p>the <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>id</p></td>
+<td class="parameter_description"><p>the name of the event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>button</p></td>
+<td class="parameter_description"><p>the id of the button</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>x</p></td>
+<td class="parameter_description"><p>the x coordinate of the mouse event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>y</p></td>
+<td class="parameter_description"><p>the y coordinate of the mouse event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p>Flags: Run Last</p>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstGLWindow-key-event"></a><h3>The <code class="literal">“key-event”</code> signal</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+user_function (<a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *object,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>       *id,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>       *key,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>     user_data)</pre>
+<p>Will be emitted when a key event is received by the GstGLwindow.</p>
+<div class="refsect3">
+<a name="id-1.2.9.23.10.4.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>object</p></td>
+<td class="parameter_description"><p>the <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>id</p></td>
+<td class="parameter_description"><p>the name of the event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>key</p></td>
+<td class="parameter_description"><p>the id of the key pressed</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p>Flags: Run Last</p>
+<p class="since">Since 1.6</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstGLWindow-mouse-event"></a><h3>The <code class="literal">“mouse-event”</code> signal</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+user_function (<a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a> *object,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>       *id,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>         button,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>      x,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>      y,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>     user_data)</pre>
+<p>Will be emitted when a mouse event is received by the GstGLwindow.</p>
+<div class="refsect3">
+<a name="id-1.2.9.23.10.5.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>object</p></td>
+<td class="parameter_description"><p>the <a class="link" href="GstGLWindow.html" title="GstGLWindow"><span class="type">GstGLWindow</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>id</p></td>
+<td class="parameter_description"><p>the name of the event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>button</p></td>
+<td class="parameter_description"><p>the id of the button</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>x</p></td>
+<td class="parameter_description"><p>the x coordinate of the mouse event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>y</p></td>
+<td class="parameter_description"><p>the y coordinate of the mouse event</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p>Flags: Run Last</p>
+<p class="since">Since 1.6</p>
+</div>
+</div>
+<div class="refsect1">
 <a name="GstGLWindow.see-also"></a><h2>See Also</h2>
 <p><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a>, <a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a></p>
 </div>
diff --git a/docs/libs/html/annotation-glossary.html b/docs/libs/html/annotation-glossary.html
index f220208..754d76c 100644
--- a/docs/libs/html/annotation-glossary.html
+++ b/docs/libs/html/annotation-glossary.html
@@ -53,6 +53,8 @@
 <a name="glsS"></a><h3 class="title">S</h3>
 <dt><span class="glossterm"><a name="annotation-glossterm-scope%20async"></a>scope async</span></dt>
 <dd class="glossdef"><p>The callback is valid until first called.</p></dd>
+<dt><span class="glossterm"><a name="annotation-glossterm-scope%20call"></a>scope call</span></dt>
+<dd class="glossdef"><p>The callback is valid only during the call to the method.</p></dd>
 <dt><span class="glossterm"><a name="annotation-glossterm-scope%20notified"></a>scope notified</span></dt>
 <dd class="glossdef"><p>The callback is valid until the GDestroyNotify argument is called.</p></dd>
 <a name="glsT"></a><h3 class="title">T</h3>
diff --git a/docs/libs/html/api-index-full.html b/docs/libs/html/api-index-full.html
index 032f36b..ea51afe 100644
--- a/docs/libs/html/api-index-full.html
+++ b/docs/libs/html/api-index-full.html
@@ -33,8 +33,6 @@
                      <span class="dim">|</span> 
                   <a class="shortcut" href="#idxP">P</a>
                      <span class="dim">|</span> 
-                  <a class="shortcut" href="#idxS">S</a>
-                     <span class="dim">|</span> 
                   <a class="shortcut" href="#idxT">T</a>
                      <span class="dim">|</span> 
                   <a class="shortcut" href="#idxV">V</a>
@@ -74,10 +72,18 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-drop-buffer" title="gst_aggregator_pad_drop_buffer ()">gst_aggregator_pad_drop_buffer</a>, function in <a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html" title="GstAggregatorPad">GstAggregatorPad</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-get-buffer" title="gst_aggregator_pad_get_buffer ()">gst_aggregator_pad_get_buffer</a>, function in <a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html" title="GstAggregatorPad">GstAggregatorPad</a>
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-is-eos" title="gst_aggregator_pad_is_eos ()">gst_aggregator_pad_is_eos</a>, function in <a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html" title="GstAggregatorPad">GstAggregatorPad</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-steal-buffer" title="gst_aggregator_pad_steal_buffer ()">gst_aggregator_pad_steal_buffer</a>, function in <a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html" title="GstAggregatorPad">GstAggregatorPad</a>
 </dt>
 <dd></dd>
@@ -135,13 +141,25 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-add-gl-sync-meta" title="gst_buffer_add_gl_sync_meta ()">gst_buffer_add_gl_sync_meta</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-gstmpegvideometa.html#gst-buffer-add-mpeg-video-meta" title="gst_buffer_add_mpeg_video_meta ()">gst_buffer_add_mpeg_video_meta</a>, function in <a class="link" href="gst-plugins-bad-libs-gstmpegvideometa.html" title="gstmpegvideometa">gstmpegvideometa</a>
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-get-gl-sync-meta" title="gst_buffer_get_gl_sync_meta()">gst_buffer_get_gl_sync_meta</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-gstmpegvideometa.html#gst-buffer-get-mpeg-video-meta" title="gst_buffer_get_mpeg_video_meta()">gst_buffer_get_mpeg_video_meta</a>, macro in <a class="link" href="gst-plugins-bad-libs-gstmpegvideometa.html" title="gstmpegvideometa">gstmpegvideometa</a>
 </dt>
 <dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GST-BUFFER-POOL-OPTION-GL-SYNC-META:CAPS" title="GST_BUFFER_POOL_OPTION_GL_SYNC_META">GST_BUFFER_POOL_OPTION_GL_SYNC_META</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
 <a name="idxC"></a><h3 class="title">C</h3>
 <dt>
 GstCameraBinMode, enum in gstcamerabin-enum
@@ -247,58 +265,6 @@
 <dd></dd>
 <a name="idxG"></a><h3 class="title">G</h3>
 <dt>
-get_aperture, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_capabilities, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_config, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_ev_compensation, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_exposure, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_flash_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_flicker_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_focus_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_iso_speed, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_noise_reduction, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_scene_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_white_balance_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-get_zoom, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
 <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLAllocator-struct" title="GstGLAllocator">GstGLAllocator</a>, struct in <a class="link" href="gst-plugins-bad-libs-gstglmemory.html" title="GstGLMemory">gstglmemory</a>
 </dt>
 <dd></dd>
@@ -311,6 +277,18 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLBaseFilter.html#GstGLBaseFilter-struct" title="GstGLBaseFilter">GstGLBaseFilter</a>, struct in <a class="link" href="GstGLBaseFilter.html" title="GstGLBaseFilter">GstGLBaseFilter</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLBaseFilter.html#GstGLBaseFilter--context" title="The “context” property">GstGLBaseFilter:context</a>, object property in <a class="link" href="GstGLBaseFilter.html" title="GstGLBaseFilter">GstGLBaseFilter</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLBaseFilter.html#GstGLBaseFilterClass" title="GstGLBaseFilterClass">GstGLBaseFilterClass</a>, struct in <a class="link" href="GstGLBaseFilter.html" title="GstGLBaseFilter">GstGLBaseFilter</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLBufferPool.html#GstGLBufferPool-struct" title="struct GstGLBufferPool">GstGLBufferPool</a>, struct in <a class="link" href="GstGLBufferPool.html" title="GstGLBufferPool">GstGLBufferPool</a>
 </dt>
 <dd></dd>
@@ -343,6 +321,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#GstGLContextEagl" title="struct GstGLContextEagl">GstGLContextEagl</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html" title="GstGLContextEagl">GstGLContextEagl</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#GstGLContextEGL" title="struct GstGLContextEGL">GstGLContextEGL</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html" title="GstGLContextEGL">GstGLContextEGL</a>
 </dt>
 <dd></dd>
@@ -379,23 +361,19 @@
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="GstGLFilter.html#GstGLFilter-struct" title="struct GstGLFilter">GstGLFilter</a>, struct in <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
+<a class="link" href="GstGLFilter.html#GstGLFilter-struct" title="GstGLFilter">GstGLFilter</a>, struct in <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="GstGLFilter.html#GstGLFilter--other-context" title="The “other-context” property">GstGLFilter:other-context</a>, object property in <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
+<a class="link" href="GstGLFilter.html#GstGLFilterClass" title="GstGLFilterClass">GstGLFilterClass</a>, struct in <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="GstGLFilter.html#GstGLFilterClass" title="struct GstGLFilterClass">GstGLFilterClass</a>, struct in <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
+<a class="link" href="GstGLFramebuffer.html#GstGLFramebuffer-struct" title="struct GstGLFramebuffer">GstGLFramebuffer</a>, struct in <a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer">GstGLFramebuffer</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
-</dt>
-<dd></dd>
-<dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebufferClass" title="struct GstGLFramebufferClass">GstGLFramebufferClass</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
+<a class="link" href="GstGLFramebuffer.html#GstGLFramebufferClass" title="struct GstGLFramebufferClass">GstGLFramebufferClass</a>, struct in <a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
 </dt>
 <dd></dd>
 <dt>
@@ -439,11 +417,15 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta" title="struct GstGLSyncMeta">GstGLSyncMeta</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLUpload.html#GstGLUpload-struct" title="GstGLUpload">GstGLUpload</a>, struct in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta" title="GstGLUploadMeta">GstGLUploadMeta</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
+<a class="link" href="GstGLUploadMeta.html#GstGLUploadMeta-struct" title="GstGLUploadMeta">GstGLUploadMeta</a>, struct in <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
 </dt>
 <dd></dd>
 <dt>
@@ -451,6 +433,14 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLWindow.html#GstGLWindow-key-event" title="The “key-event” signal">GstGLWindow::key-event</a>, object signal in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLWindow.html#GstGLWindow-mouse-event" title="The “mouse-event” signal">GstGLWindow::mouse-event</a>, object signal in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstGLWindowAndroid.html#GstGLWindowAndroidEGL" title="struct GstGLWindowAndroidEGL">GstGLWindowAndroidEGL</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstGLWindowAndroid.html" title="GstGLWindowAndroid">GstGLWindowAndroid</a>
 </dt>
 <dd></dd>
@@ -543,6 +533,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-caps-replace-all-caps-features" title="gst_gl_caps_replace_all_caps_features ()">gst_gl_caps_replace_all_caps_features</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#gst-gl-check-extension" title="gst_gl_check_extension ()">gst_gl_check_extension</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html" title="GstGLAPI">GstGLAPI</a>
 </dt>
 <dd></dd>
@@ -559,7 +553,11 @@
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-set-format" title="gst_gl_color_convert_set_format ()">gst_gl_color_convert_set_format</a>, function in <a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert">GstGLColorConvert</a>
+<a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-set-caps" title="gst_gl_color_convert_set_caps ()">gst_gl_color_convert_set_caps</a>, function in <a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert">GstGLColorConvert</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLColorConvert.html#gst-gl-color-convert-transform-caps" title="gst_gl_color_convert_transform_caps ()">gst_gl_color_convert_transform_caps</a>, function in <a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert">GstGLColorConvert</a>
 </dt>
 <dd></dd>
 <dt>
@@ -591,6 +589,14 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-current-context" title="gst_gl_context_cocoa_get_current_context ()">gst_gl_context_cocoa_get_current_context</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html" title="GstGLContextCocoa">GstGLContextCocoa</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-pixel-format" title="gst_gl_context_cocoa_get_pixel_format ()">gst_gl_context_cocoa_get_pixel_format</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html" title="GstGLContextCocoa">GstGLContextCocoa</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-new" title="gst_gl_context_cocoa_new ()">gst_gl_context_cocoa_new</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html" title="GstGLContextCocoa">GstGLContextCocoa</a>
 </dt>
 <dd></dd>
@@ -615,6 +621,26 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLContext.html#gst-gl-context-destroy" title="gst_gl_context_destroy ()">gst_gl_context_destroy</a>, function in <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-get-current-context" title="gst_gl_context_eagl_get_current_context ()">gst_gl_context_eagl_get_current_context</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html" title="GstGLContextEagl">GstGLContextEagl</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-new" title="gst_gl_context_eagl_new ()">gst_gl_context_eagl_new</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html" title="GstGLContextEagl">GstGLContextEagl</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-current-context" title="gst_gl_context_egl_get_current_context ()">gst_gl_context_egl_get_current_context</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html" title="GstGLContextEGL">GstGLContextEGL</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-proc-address" title="gst_gl_context_egl_get_proc_address ()">gst_gl_context_egl_get_proc_address</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html" title="GstGLContextEGL">GstGLContextEGL</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-new" title="gst_gl_context_egl_new ()">gst_gl_context_egl_new</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html" title="GstGLContextEGL">GstGLContextEGL</a>
 </dt>
 <dd></dd>
@@ -627,6 +653,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLContext.html#gst-gl-context-fill-info" title="gst_gl_context_fill_info ()">gst_gl_context_fill_info</a>, function in <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-context-gen-fbo" title="gst_gl_context_gen_fbo ()">gst_gl_context_gen_fbo</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
 </dt>
 <dd></dd>
@@ -639,6 +669,18 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLContext.html#gst-gl-context-get-current" title="gst_gl_context_get_current ()">gst_gl_context_get_current</a>, function in <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLContext.html#gst-gl-context-get-current-gl-api" title="gst_gl_context_get_current_gl_api ()">gst_gl_context_get_current_gl_api</a>, function in <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLContext.html#gst-gl-context-get-current-gl-context" title="gst_gl_context_get_current_gl_context ()">gst_gl_context_get_current_gl_context</a>, function in <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLContext.html#gst-gl-context-get-display" title="gst_gl_context_get_display ()">gst_gl_context_get_display</a>, function in <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
 </dt>
 <dd></dd>
@@ -675,6 +717,14 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-current-context" title="gst_gl_context_glx_get_current_context ()">gst_gl_context_glx_get_current_context</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html" title="GstGLContextGLX">GstGLContextGLX</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-proc-address" title="gst_gl_context_glx_get_proc_address ()">gst_gl_context_glx_get_proc_address</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html" title="GstGLContextGLX">GstGLContextGLX</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-new" title="gst_gl_context_glx_new ()">gst_gl_context_glx_new</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html" title="GstGLContextGLX">GstGLContextGLX</a>
 </dt>
 <dd></dd>
@@ -699,11 +749,15 @@
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo" title="gst_gl_context_use_fbo ()">gst_gl_context_use_fbo</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo-v2" title="gst_gl_context_use_fbo_v2 ()">gst_gl_context_use_fbo_v2</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo-v2" title="gst_gl_context_use_fbo_v2 ()">gst_gl_context_use_fbo_v2</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-current-context" title="gst_gl_context_wgl_get_current_context ()">gst_gl_context_wgl_get_current_context</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html" title="GstGLContextWGL">GstGLContextWGL</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-proc-address" title="gst_gl_context_wgl_get_proc_address ()">gst_gl_context_wgl_get_proc_address</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html" title="GstGLContextWGL">GstGLContextWGL</a>
 </dt>
 <dd></dd>
 <dt>
@@ -711,10 +765,30 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLDisplay.html#gst-gl-display-add-context" title="gst_gl_display_add_context ()">gst_gl_display_add_context</a>, function in <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLDisplay.html#GST-GL-DISPLAY-CONTEXT-TYPE:CAPS" title="GST_GL_DISPLAY_CONTEXT_TYPE">GST_GL_DISPLAY_CONTEXT_TYPE</a>, macro in <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLDisplay.html#gst-gl-display-filter-gl-api" title="gst_gl_display_filter_gl_api ()">gst_gl_display_filter_gl_api</a>, function in <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLDisplay.html#gst-gl-display-get-gl-api" title="gst_gl_display_get_gl_api ()">gst_gl_display_get_gl_api</a>, function in <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLDisplay.html#gst-gl-display-get-gl-context-for-thread" title="gst_gl_display_get_gl_context_for_thread ()">gst_gl_display_get_gl_context_for_thread</a>, function in <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLDisplay.html#gst-gl-display-get-handle" title="gst_gl_display_get_handle ()">gst_gl_display_get_handle</a>, function in <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLDisplay.html#gst-gl-display-get-handle-type" title="gst_gl_display_get_handle_type ()">gst_gl_display_get_handle_type</a>, function in <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
 </dt>
 <dd></dd>
@@ -735,7 +809,11 @@
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-display" title="gst_gl_ensure_display ()">gst_gl_ensure_display</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
+<a class="link" href="GstGLDownload.html#gst-gl-download-transform-caps" title="gst_gl_download_transform_caps ()">gst_gl_download_transform_caps</a>, function in <a class="link" href="GstGLDownload.html" title="GstGLDownload">GstGLDownload</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-element-data" title="gst_gl_ensure_element_data ()">gst_gl_ensure_element_data</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
 </dt>
 <dd></dd>
 <dt>
@@ -755,23 +833,19 @@
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-delete" title="gst_gl_framebuffer_delete ()">gst_gl_framebuffer_delete</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-delete" title="gst_gl_framebuffer_delete ()">gst_gl_framebuffer_delete</a>, function in <a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-generate" title="gst_gl_framebuffer_generate ()">gst_gl_framebuffer_generate</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-generate" title="gst_gl_framebuffer_generate ()">gst_gl_framebuffer_generate</a>, function in <a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-new" title="gst_gl_framebuffer_new ()">gst_gl_framebuffer_new</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-new" title="gst_gl_framebuffer_new ()">gst_gl_framebuffer_new</a>, function in <a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use" title="gst_gl_framebuffer_use ()">gst_gl_framebuffer_use</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
-</dt>
-<dd></dd>
-<dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use-v2" title="gst_gl_framebuffer_use_v2 ()">gst_gl_framebuffer_use_v2</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
+<a class="link" href="GstGLFramebuffer.html#gst-gl-framebuffer-use-v2" title="gst_gl_framebuffer_use_v2 ()">gst_gl_framebuffer_use_v2</a>, function in <a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
 </dt>
 <dd></dd>
 <dt>
@@ -779,6 +853,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-get-plane-data-size" title="gst_gl_get_plane_data_size ()">gst_gl_get_plane_data_size</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-handle-context-query" title="gst_gl_handle_context_query ()">gst_gl_handle_context_query</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
 </dt>
 <dd></dd>
@@ -843,6 +921,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-run-query" title="gst_gl_run_query ()">gst_gl_run_query</a>, function in <a class="link" href="gst-plugins-bad-libs-Utilities.html" title="Utilities">Utilities</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-gstglshader.html#gst-gl-shadervariables-parse" title="gst_gl_shadervariables_parse ()">gst_gl_shadervariables_parse</a>, function in <a class="link" href="gst-plugins-bad-libs-gstglshader.html" title="GstGLShader">gstglshader</a>
 </dt>
 <dd></dd>
@@ -899,6 +981,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-program-handle" title="gst_gl_shader_get_program_handle ()">gst_gl_shader_get_program_handle</a>, function in <a class="link" href="gst-plugins-bad-libs-gstglshader.html" title="GstGLShader">GstGLShader</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-vertex-source" title="gst_gl_shader_get_vertex_source ()">gst_gl_shader_get_vertex_source</a>, function in <a class="link" href="gst-plugins-bad-libs-gstglshader.html" title="GstGLShader">GstGLShader</a>
 </dt>
 <dd></dd>
@@ -1031,27 +1117,43 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-api-get-type" title="gst_gl_sync_meta_api_get_type ()">gst_gl_sync_meta_api_get_type</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-get-info" title="gst_gl_sync_meta_get_info ()">gst_gl_sync_meta_get_info</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-set-sync-point" title="gst_gl_sync_meta_set_sync_point ()">gst_gl_sync_meta_set_sync_point</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-wait" title="gst_gl_sync_meta_wait ()">gst_gl_sync_meta_wait</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">GstGLSyncMeta</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#gst-gl-texture-type-from-format" title="gst_gl_texture_type_from_format ()">gst_gl_texture_type_from_format</a>, function in <a class="link" href="gst-plugins-bad-libs-gstglmemory.html" title="GstGLMemory">GstGLMemory</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="GstGLUpload.html#gst-gl-upload-get-format" title="gst_gl_upload_get_format ()">gst_gl_upload_get_format</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
+<a class="link" href="GstGLUpload.html#gst-gl-upload-get-caps" title="gst_gl_upload_get_caps ()">gst_gl_upload_get_caps</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer" title="gst_gl_upload_meta_add_to_buffer ()">gst_gl_upload_meta_add_to_buffer</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer" title="gst_gl_upload_meta_add_to_buffer ()">gst_gl_upload_meta_add_to_buffer</a>, function in <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-get-format" title="gst_gl_upload_meta_get_format ()">gst_gl_upload_meta_get_format</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-get-format" title="gst_gl_upload_meta_get_format ()">gst_gl_upload_meta_get_format</a>, function in <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-new" title="gst_gl_upload_meta_new ()">gst_gl_upload_meta_new</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-new" title="gst_gl_upload_meta_new ()">gst_gl_upload_meta_new</a>, function in <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-set-format" title="gst_gl_upload_meta_set_format ()">gst_gl_upload_meta_set_format</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
+<a class="link" href="GstGLUploadMeta.html#gst-gl-upload-meta-set-format" title="gst_gl_upload_meta_set_format ()">gst_gl_upload_meta_set_format</a>, function in <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
 </dt>
 <dd></dd>
 <dt>
@@ -1063,11 +1165,7 @@
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="GstGLUpload.html#gst-gl-upload-perform-with-data" title="gst_gl_upload_perform_with_data ()">gst_gl_upload_perform_with_data</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
-</dt>
-<dd></dd>
-<dt>
-<a class="link" href="GstGLUpload.html#gst-gl-upload-perform-with-gl-texture-upload-meta" title="gst_gl_upload_perform_with_gl_texture_upload_meta ()">gst_gl_upload_perform_with_gl_texture_upload_meta</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
+<a class="link" href="GstGLUpload.html#gst-gl-upload-propose-allocation" title="gst_gl_upload_propose_allocation ()">gst_gl_upload_propose_allocation</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
 </dt>
 <dd></dd>
 <dt>
@@ -1075,7 +1173,11 @@
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="GstGLUpload.html#gst-gl-upload-set-format" title="gst_gl_upload_set_format ()">gst_gl_upload_set_format</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
+<a class="link" href="GstGLUpload.html#gst-gl-upload-set-caps" title="gst_gl_upload_set_caps ()">gst_gl_upload_set_caps</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="GstGLUpload.html#gst-gl-upload-transform-caps" title="gst_gl_upload_transform_caps ()">gst_gl_upload_transform_caps</a>, function in <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
 </dt>
 <dd></dd>
 <dt>
@@ -1123,10 +1225,18 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLWindow.html#gst-gl-window-get-surface-dimensions" title="gst_gl_window_get_surface_dimensions ()">gst_gl_window_get_surface_dimensions</a>, function in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLWindow.html#gst-gl-window-get-window-handle" title="gst_gl_window_get_window_handle ()">gst_gl_window_get_window_handle</a>, function in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLWindow.html#gst-gl-window-handle-events" title="gst_gl_window_handle_events ()">gst_gl_window_handle_events</a>, function in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLWindow.html#gst-gl-window-is-running" title="gst_gl_window_is_running ()">gst_gl_window_is_running</a>, function in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
 </dt>
 <dd></dd>
@@ -1163,6 +1273,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLWindow.html#gst-gl-window-set-preferred-size" title="gst_gl_window_set_preferred_size ()">gst_gl_window_set_preferred_size</a>, function in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="GstGLWindow.html#gst-gl-window-set-resize-callback" title="gst_gl_window_set_resize_callback ()">gst_gl_window_set_resize_callback</a>, function in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
 </dt>
 <dd></dd>
@@ -1171,6 +1285,10 @@
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="GstGLWindow.html#gst-gl-window-show" title="gst_gl_window_show ()">gst_gl_window_show</a>, function in <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="gst-plugins-bad-libs-GstGLWindowWayland.html#gst-gl-window-wayland-egl-new" title="gst_gl_window_wayland_egl_new ()">gst_gl_window_wayland_egl_new</a>, function in <a class="link" href="gst-plugins-bad-libs-GstGLWindowWayland.html" title="GstGLWindowWayland">GstGLWindowWayland</a>
 </dt>
 <dd></dd>
@@ -2323,67 +2441,111 @@
 <dd></dd>
 <a name="idxP"></a><h3 class="title">P</h3>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html">GstPhotography</a>, struct in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography">GstPhotography</a>, struct in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#GstPhotographyNoiseReduction">GstPhotographyNoiseReduction</a>, enum in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps">GstPhotographyCaps</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS">GST_PHOTOGRAPHY_AUTOFOCUS_DONE</a>, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCapturePrepared" title="GstPhotographyCapturePrepared ()">GstPhotographyCapturePrepared</a>, user_function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-aperture">gst_photography_get_aperture</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode">GstPhotographyColorToneMode</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-capabilities">gst_photography_get_capabilities</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode">GstPhotographyFlashMode</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-config">gst_photography_get_config</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlickerReductionMode" title="enum GstPhotographyFlickerReductionMode">GstPhotographyFlickerReductionMode</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-ev-compensation">gst_photography_get_ev_compensation</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusMode" title="enum GstPhotographyFocusMode">GstPhotographyFocusMode</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-exposure">gst_photography_get_exposure</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusStatus" title="enum GstPhotographyFocusStatus">GstPhotographyFocusStatus</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-flash-mode">gst_photography_get_flash_mode</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction">GstPhotographyNoiseReduction</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-gst_photography_get_flicker_mode, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode">GstPhotographySceneMode</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-gst_photography_get_focus_mode, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyShakeRisk" title="enum GstPhotographyShakeRisk">GstPhotographyShakeRisk</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-iso-speed">gst_photography_get_iso_speed</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode">GstPhotographyWhiteBalanceMode</a>, enum in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-noise-reduction">gst_photography_get_noise_reduction</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS" title="GST_PHOTOGRAPHY_AUTOFOCUS_DONE">GST_PHOTOGRAPHY_AUTOFOCUS_DONE</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-scene-mode">gst_photography_get_scene_mode</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-aperture" title="gst_photography_get_aperture ()">gst_photography_get_aperture</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-white-balance-mode">gst_photography_get_white_balance_mode</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-capabilities" title="gst_photography_get_capabilities ()">gst_photography_get_capabilities</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-get-zoom">gst_photography_get_zoom</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-color-tone-mode" title="gst_photography_get_color_tone_mode ()">gst_photography_get_color_tone_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-config" title="gst_photography_get_config ()">gst_photography_get_config</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-ev-compensation" title="gst_photography_get_ev_compensation ()">gst_photography_get_ev_compensation</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-exposure" title="gst_photography_get_exposure ()">gst_photography_get_exposure</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flash-mode" title="gst_photography_get_flash_mode ()">gst_photography_get_flash_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flicker-mode" title="gst_photography_get_flicker_mode ()">gst_photography_get_flicker_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-focus-mode" title="gst_photography_get_focus_mode ()">gst_photography_get_focus_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-iso-speed" title="gst_photography_get_iso_speed ()">gst_photography_get_iso_speed</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-noise-reduction" title="gst_photography_get_noise_reduction ()">gst_photography_get_noise_reduction</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-scene-mode" title="gst_photography_get_scene_mode ()">gst_photography_get_scene_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-white-balance-mode" title="gst_photography_get_white_balance_mode ()">gst_photography_get_white_balance_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
+</dt>
+<dd></dd>
+<dt>
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-zoom" title="gst_photography_get_zoom ()">gst_photography_get_zoom</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
@@ -2391,180 +2553,127 @@
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-prepare-for-capture">gst_photography_prepare_for_capture</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-prepare-for-capture" title="gst_photography_prepare_for_capture ()">gst_photography_prepare_for_capture</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_APERTURE, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-APERTURE:CAPS" title="GST_PHOTOGRAPHY_PROP_APERTURE">GST_PHOTOGRAPHY_PROP_APERTURE</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_CAPABILITIES, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-CAPABILITIES:CAPS" title="GST_PHOTOGRAPHY_PROP_CAPABILITIES">GST_PHOTOGRAPHY_PROP_CAPABILITIES</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_EV_COMP, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-EV-COMP:CAPS" title="GST_PHOTOGRAPHY_PROP_EV_COMP">GST_PHOTOGRAPHY_PROP_EV_COMP</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_FLASH_MODE, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLASH-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_FLASH_MODE">GST_PHOTOGRAPHY_PROP_FLASH_MODE</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_FLICKER_MODE, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLICKER-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_FLICKER_MODE">GST_PHOTOGRAPHY_PROP_FLICKER_MODE</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_FOCUS_MODE, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_FOCUS_MODE">GST_PHOTOGRAPHY_PROP_FOCUS_MODE</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_FOCUS_STATUS, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-STATUS:CAPS" title="GST_PHOTOGRAPHY_PROP_FOCUS_STATUS">GST_PHOTOGRAPHY_PROP_FOCUS_STATUS</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-CAPTURE-SUPPORTED-CAPS" title="GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS">GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-PREVIEW-SUPPORTED-CAPS" title="GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS">GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_ISO_SPEED, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ISO-SPEED:CAPS" title="GST_PHOTOGRAPHY_PROP_ISO_SPEED">GST_PHOTOGRAPHY_PROP_ISO_SPEED</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-NOISE-REDUCTION:CAPS" title="GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION">GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_SCENE_MODE, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SCENE-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_SCENE_MODE">GST_PHOTOGRAPHY_PROP_SCENE_MODE</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_SHAKE_RISK, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SHAKE-RISK:CAPS" title="GST_PHOTOGRAPHY_PROP_SHAKE_RISK">GST_PHOTOGRAPHY_PROP_SHAKE_RISK</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_WB_MODE, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-WB-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_WB_MODE">GST_PHOTOGRAPHY_PROP_WB_MODE</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-GST_PHOTOGRAPHY_PROP_ZOOM, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ZOOM:CAPS" title="GST_PHOTOGRAPHY_PROP_ZOOM">GST_PHOTOGRAPHY_PROP_ZOOM</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-aperture">gst_photography_set_aperture</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-aperture" title="gst_photography_set_aperture ()">gst_photography_set_aperture</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-autofocus">gst_photography_set_autofocus</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-autofocus" title="gst_photography_set_autofocus ()">gst_photography_set_autofocus</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-config">gst_photography_set_config</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-color-tone-mode" title="gst_photography_set_color_tone_mode ()">gst_photography_set_color_tone_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-ev-compensation">gst_photography_set_ev_compensation</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-config" title="gst_photography_set_config ()">gst_photography_set_config</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-exposure">gst_photography_set_exposure</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-ev-compensation" title="gst_photography_set_ev_compensation ()">gst_photography_set_ev_compensation</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-flash-mode">gst_photography_set_flash_mode</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-exposure" title="gst_photography_set_exposure ()">gst_photography_set_exposure</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-gst_photography_set_flicker_mode, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flash-mode" title="gst_photography_set_flash_mode ()">gst_photography_set_flash_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-gst_photography_set_focus_mode, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flicker-mode" title="gst_photography_set_flicker_mode ()">gst_photography_set_flicker_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-iso-speed">gst_photography_set_iso_speed</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-focus-mode" title="gst_photography_set_focus_mode ()">gst_photography_set_focus_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-noise-reduction">gst_photography_set_noise_reduction</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-iso-speed" title="gst_photography_set_iso_speed ()">gst_photography_set_iso_speed</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-scene-mode">gst_photography_set_scene_mode</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-noise-reduction" title="gst_photography_set_noise_reduction ()">gst_photography_set_noise_reduction</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-white-balance-mode">gst_photography_set_white_balance_mode</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-scene-mode" title="gst_photography_set_scene_mode ()">gst_photography_set_scene_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#gst-photography-set-zoom">gst_photography_set_zoom</a>, function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-white-balance-mode" title="gst_photography_set_white_balance_mode ()">gst_photography_set_white_balance_mode</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS">GST_PHOTOGRAPHY_SHAKE_RISK</a>, macro in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-zoom" title="gst_photography_set_zoom ()">gst_photography_set_zoom</a>, function in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <dt>
-prepare_for_capture, user_function in gstphotography
-</dt>
-<dd></dd>
-<a name="idxS"></a><h3 class="title">S</h3>
-<dt>
-set_aperture, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_autofocus, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_config, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_ev_compensation, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_exposure, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_flash_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_flicker_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_focus_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_iso_speed, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_noise_reduction, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_scene_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_white_balance_mode, user_function in gstphotography
-</dt>
-<dd></dd>
-<dt>
-set_zoom, user_function in gstphotography
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS" title="GST_PHOTOGRAPHY_SHAKE_RISK">GST_PHOTOGRAPHY_SHAKE_RISK</a>, macro in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">GstPhotography</a>
 </dt>
 <dd></dd>
 <a name="idxT"></a><h3 class="title">T</h3>
diff --git a/docs/libs/html/ch07.html b/docs/libs/html/ch07.html
new file mode 100644
index 0000000..d0e4f95
--- /dev/null
+++ b/docs/libs/html/ch07.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Library Reference Manual: Interfaces</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
+<link rel="up" href="gstreamer-plugins-bad.html" title="Part I. GStreamer Bad Plugins Libraries">
+<link rel="prev" href="gst-plugins-bad-libs-GstGLWindowX11.html" title="GstGLWindowX11">
+<link rel="next" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts"></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="gstreamer-plugins-bad.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLWindowX11.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-libs-GstPhotography.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="chapter">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="id-1.2.10"></a>Interfaces</h2></div></div></div>
+<div class="toc"><dl class="toc"><dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstPhotography.html">GstPhotography</a></span><span class="refpurpose"> — Interface for digital image capture elements</span>
+</dt></dl></div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/libs/html/gl.html b/docs/libs/html/gl.html
index d164584..2e1e7b7 100644
--- a/docs/libs/html/gl.html
+++ b/docs/libs/html/gl.html
@@ -42,6 +42,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextEGL.html">GstGLContextEGL</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextEagl.html">GstGLContextEagl</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextGLX.html">GstGLContextGLX</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
@@ -57,10 +60,13 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstEGLImageMemory.html">GstEGLImageMemory</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="GstGLBaseFilter.html">GstGLBaseFilter</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="GstGLFilter.html">GstGLFilter</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLFramebuffer.html">GstGLFramebuffer</a></span><span class="refpurpose"></span>
+<span class="refentrytitle"><a href="GstGLFramebuffer.html">GstGLFramebuffer</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-gstglmemory.html">GstGLMemory</a></span><span class="refpurpose"> — memory subclass for GL textures</span>
@@ -69,10 +75,13 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-gstglshader.html">GstGLShader</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLSyncMeta.html">GstGLSyncMeta</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="GstGLUpload.html">GstGLUpload</a></span><span class="refpurpose"> — an object that uploads to GL textures</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLUploadMeta.html">GstGLUploadMeta</a></span><span class="refpurpose">an object that provides <span class="type">GstVideoGLTextureUploadMeta</span></span>
+<span class="refentrytitle"><a href="GstGLUploadMeta.html">GstGLUploadMeta</a></span><span class="refpurpose">an object that provides <span class="type">GstVideoGLTextureUploadMeta</span></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-Utilities.html">Utilities</a></span><span class="refpurpose"></span>
diff --git a/docs/libs/html/gst-plugins-bad-libs-1.0.devhelp2 b/docs/libs/html/gst-plugins-bad-libs-1.0.devhelp2
index 628a54c..65c43c3 100644
--- a/docs/libs/html/gst-plugins-bad-libs-1.0.devhelp2
+++ b/docs/libs/html/gst-plugins-bad-libs-1.0.devhelp2
@@ -39,17 +39,20 @@
         <sub name="GstGLContext" link="GstGLContext.html"/>
         <sub name="GstGLContextCocoa" link="gst-plugins-bad-libs-GstGLContextCocoa.html"/>
         <sub name="GstGLContextEGL" link="gst-plugins-bad-libs-GstGLContextEGL.html"/>
+        <sub name="GstGLContextEagl" link="gst-plugins-bad-libs-GstGLContextEagl.html"/>
         <sub name="GstGLContextGLX" link="gst-plugins-bad-libs-GstGLContextGLX.html"/>
         <sub name="GstGLContextWGL" link="gst-plugins-bad-libs-GstGLContextWGL.html"/>
         <sub name="GstGLDisplay" link="GstGLDisplay.html"/>
         <sub name="GstGLDownload" link="GstGLDownload.html"/>
         <sub name="GstEGLImageMemory" link="gst-plugins-bad-libs-GstEGLImageMemory.html"/>
+        <sub name="GstGLBaseFilter" link="GstGLBaseFilter.html"/>
         <sub name="GstGLFilter" link="GstGLFilter.html"/>
-        <sub name="GstGLFramebuffer" link="gst-plugins-bad-libs-GstGLFramebuffer.html"/>
+        <sub name="GstGLFramebuffer" link="GstGLFramebuffer.html"/>
         <sub name="GstGLMemory" link="gst-plugins-bad-libs-gstglmemory.html"/>
         <sub name="GstGLShader" link="gst-plugins-bad-libs-gstglshader.html"/>
+        <sub name="GstGLSyncMeta" link="gst-plugins-bad-libs-GstGLSyncMeta.html"/>
         <sub name="GstGLUpload" link="GstGLUpload.html"/>
-        <sub name="GstGLUploadMeta" link="gst-plugins-bad-libs-GstGLUploadMeta.html"/>
+        <sub name="GstGLUploadMeta" link="GstGLUploadMeta.html"/>
         <sub name="Utilities" link="gst-plugins-bad-libs-Utilities.html"/>
         <sub name="GstGLWindow" link="GstGLWindow.html"/>
         <sub name="GstGLWindowAndroid" link="gst-plugins-bad-libs-GstGLWindowAndroid.html"/>
@@ -59,6 +62,9 @@
         <sub name="GstGLWindowWin32" link="gst-plugins-bad-libs-GstGLWindowWin32.html"/>
         <sub name="GstGLWindowX11" link="gst-plugins-bad-libs-GstGLWindowX11.html"/>
       </sub>
+      <sub name="Interfaces" link="ch07.html">
+        <sub name="GstPhotography" link="gst-plugins-bad-libs-GstPhotography.html"/>
+      </sub>
     </sub>
     <sub name="Object Hierarchy" link="gstreamer-libs-hierarchy.html"/>
     <sub name="Index" link="api-index-full.html"/>
@@ -388,6 +394,8 @@
     <keyword type="struct" name="struct GstAggregatorClass" link="gst-plugins-bad-libs-GstAggregator.html#GstAggregatorClass"/>
     <keyword type="function" name="gst_aggregator_pad_steal_buffer ()" link="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-steal-buffer"/>
     <keyword type="function" name="gst_aggregator_pad_get_buffer ()" link="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-get-buffer"/>
+    <keyword type="function" name="gst_aggregator_pad_drop_buffer ()" link="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-drop-buffer"/>
+    <keyword type="function" name="gst_aggregator_pad_is_eos ()" link="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-is-eos"/>
     <keyword type="struct" name="struct GstAggregatorPad" link="gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad"/>
     <keyword type="struct" name="struct GstAggregatorPadClass" link="gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPadClass"/>
     <keyword type="struct" name="struct GstVideoAggregator" link="gst-plugins-bad-libs-GstVideoAggregator.html#GstVideoAggregator"/>
@@ -409,7 +417,8 @@
     <keyword type="struct" name="struct GstGLBufferPool" link="GstGLBufferPool.html#GstGLBufferPool-struct"/>
     <keyword type="struct" name="struct GstGLBufferPoolClass" link="GstGLBufferPool.html#GstGLBufferPoolClass"/>
     <keyword type="function" name="gst_gl_color_convert_new ()" link="GstGLColorConvert.html#gst-gl-color-convert-new"/>
-    <keyword type="function" name="gst_gl_color_convert_set_format ()" link="GstGLColorConvert.html#gst-gl-color-convert-set-format"/>
+    <keyword type="function" name="gst_gl_color_convert_set_caps ()" link="GstGLColorConvert.html#gst-gl-color-convert-set-caps"/>
+    <keyword type="function" name="gst_gl_color_convert_transform_caps ()" link="GstGLColorConvert.html#gst-gl-color-convert-transform-caps"/>
     <keyword type="function" name="gst_gl_color_convert_perform ()" link="GstGLColorConvert.html#gst-gl-color-convert-perform"/>
     <keyword type="macro" name="GST_GL_COLOR_CONVERT_FORMATS" link="GstGLColorConvert.html#GST-GL-COLOR-CONVERT-FORMATS:CAPS"/>
     <keyword type="macro" name="GST_GL_COLOR_CONVERT_VIDEO_CAPS" link="GstGLColorConvert.html#GST-GL-COLOR-CONVERT-VIDEO-CAPS"/>
@@ -421,6 +430,7 @@
     <keyword type="function" name="gst_gl_context_new ()" link="GstGLContext.html#gst-gl-context-new" since="1.4"/>
     <keyword type="function" name="gst_gl_context_new_wrapped ()" link="GstGLContext.html#gst-gl-context-new-wrapped" since="1.4"/>
     <keyword type="function" name="gst_gl_context_create ()" link="GstGLContext.html#gst-gl-context-create" since="1.4"/>
+    <keyword type="function" name="gst_gl_context_destroy ()" link="GstGLContext.html#gst-gl-context-destroy" since="1.6"/>
     <keyword type="function" name="gst_gl_context_activate ()" link="GstGLContext.html#gst-gl-context-activate" since="1.4"/>
     <keyword type="function" name="gst_gl_context_default_get_proc_address ()" link="GstGLContext.html#gst-gl-context-default-get-proc-address"/>
     <keyword type="function" name="gst_gl_context_get_proc_address ()" link="GstGLContext.html#gst-gl-context-get-proc-address" since="1.4"/>
@@ -431,23 +441,43 @@
     <keyword type="function" name="gst_gl_context_get_gl_api ()" link="GstGLContext.html#gst-gl-context-get-gl-api" since="1.4"/>
     <keyword type="function" name="gst_gl_context_get_gl_context ()" link="GstGLContext.html#gst-gl-context-get-gl-context" since="1.4"/>
     <keyword type="function" name="gst_gl_context_get_gl_platform ()" link="GstGLContext.html#gst-gl-context-get-gl-platform" since="1.4"/>
-    <keyword type="function" name="gst_gl_context_get_thread ()" link="GstGLContext.html#gst-gl-context-get-thread" since="1.4.5"/>
+    <keyword type="function" name="gst_gl_context_get_current_gl_context ()" link="GstGLContext.html#gst-gl-context-get-current-gl-context" since="1.6"/>
+    <keyword type="function" name="gst_gl_context_get_current_gl_api ()" link="GstGLContext.html#gst-gl-context-get-current-gl-api" since="1.6"/>
+    <keyword type="function" name="gst_gl_context_get_thread ()" link="GstGLContext.html#gst-gl-context-get-thread" since="1.6"/>
     <keyword type="function" name="gst_gl_context_can_share ()" link="GstGLContext.html#gst-gl-context-can-share" since="1.6"/>
     <keyword type="function" name="gst_gl_context_check_feature ()" link="GstGLContext.html#gst-gl-context-check-feature" since="1.4"/>
     <keyword type="function" name="gst_gl_context_check_gl_version ()" link="GstGLContext.html#gst-gl-context-check-gl-version" since="1.4"/>
     <keyword type="function" name="gst_gl_context_get_gl_version ()" link="GstGLContext.html#gst-gl-context-get-gl-version" since="1.4"/>
+    <keyword type="function" name="gst_gl_context_fill_info ()" link="GstGLContext.html#gst-gl-context-fill-info" since="1.6"/>
+    <keyword type="function" name="gst_gl_context_get_current ()" link="GstGLContext.html#gst-gl-context-get-current" since="1.6"/>
     <keyword type="enum" name="enum GstGLContextError" link="GstGLContext.html#GstGLContextError"/>
     <keyword type="struct" name="GstGLContext" link="GstGLContext.html#GstGLContext-struct"/>
     <keyword type="function" name="gst_gl_context_cocoa_new ()" link="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-new"/>
+    <keyword type="function" name="gst_gl_context_cocoa_get_current_context ()" link="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-current-context"/>
+    <keyword type="function" name="gst_gl_context_cocoa_get_pixel_format ()" link="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-pixel-format"/>
     <keyword type="struct" name="struct GstGLContextCocoa" link="gst-plugins-bad-libs-GstGLContextCocoa.html#GstGLContextCocoa"/>
     <keyword type="function" name="gst_gl_context_egl_new ()" link="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-new"/>
+    <keyword type="function" name="gst_gl_context_egl_get_current_context ()" link="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-current-context"/>
+    <keyword type="function" name="gst_gl_context_egl_get_proc_address ()" link="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-proc-address"/>
     <keyword type="struct" name="struct GstGLContextEGL" link="gst-plugins-bad-libs-GstGLContextEGL.html#GstGLContextEGL"/>
+    <keyword type="function" name="gst_gl_context_eagl_new ()" link="gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-new"/>
+    <keyword type="function" name="gst_gl_context_eagl_get_current_context ()" link="gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-get-current-context"/>
+    <keyword type="struct" name="struct GstGLContextEagl" link="gst-plugins-bad-libs-GstGLContextEagl.html#GstGLContextEagl"/>
     <keyword type="function" name="gst_gl_context_glx_new ()" link="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-new"/>
+    <keyword type="function" name="gst_gl_context_glx_get_current_context ()" link="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-current-context"/>
+    <keyword type="function" name="gst_gl_context_glx_get_proc_address ()" link="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-proc-address"/>
     <keyword type="struct" name="struct GstGLContextGLX" link="gst-plugins-bad-libs-GstGLContextGLX.html#GstGLContextGLX"/>
     <keyword type="function" name="gst_gl_context_wgl_new ()" link="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-new"/>
+    <keyword type="function" name="gst_gl_context_wgl_get_current_context ()" link="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-current-context"/>
+    <keyword type="function" name="gst_gl_context_wgl_get_proc_address ()" link="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-proc-address"/>
     <keyword type="struct" name="struct GstGLContextWGL" link="gst-plugins-bad-libs-GstGLContextWGL.html#GstGLContextWGL"/>
     <keyword type="function" name="gst_gl_display_new ()" link="GstGLDisplay.html#gst-gl-display-new" since="1.4"/>
     <keyword type="function" name="gst_gl_display_get_handle_type ()" link="GstGLDisplay.html#gst-gl-display-get-handle-type" since="1.4"/>
+    <keyword type="function" name="gst_gl_display_filter_gl_api ()" link="GstGLDisplay.html#gst-gl-display-filter-gl-api"/>
+    <keyword type="function" name="gst_gl_display_get_gl_api ()" link="GstGLDisplay.html#gst-gl-display-get-gl-api"/>
+    <keyword type="function" name="gst_gl_display_add_context ()" link="GstGLDisplay.html#gst-gl-display-add-context" since="1.6"/>
+    <keyword type="function" name="gst_gl_display_get_gl_context_for_thread ()" link="GstGLDisplay.html#gst-gl-display-get-gl-context-for-thread" since="1.6"/>
+    <keyword type="function" name="gst_gl_display_get_handle ()" link="GstGLDisplay.html#gst-gl-display-get-handle"/>
     <keyword type="function" name="gst_context_get_gl_display ()" link="GstGLDisplay.html#gst-context-get-gl-display" since="1.4"/>
     <keyword type="function" name="gst_context_set_gl_display ()" link="GstGLDisplay.html#gst-context-set-gl-display" since="1.4"/>
     <keyword type="macro" name="GST_GL_DISPLAY_CONTEXT_TYPE" link="GstGLDisplay.html#GST-GL-DISPLAY-CONTEXT-TYPE:CAPS"/>
@@ -455,6 +485,7 @@
     <keyword type="struct" name="GstGLDisplay" link="GstGLDisplay.html#GstGLDisplay-struct"/>
     <keyword type="function" name="gst_gl_download_new ()" link="GstGLDownload.html#gst-gl-download-new"/>
     <keyword type="function" name="gst_gl_download_set_format ()" link="GstGLDownload.html#gst-gl-download-set-format"/>
+    <keyword type="function" name="gst_gl_download_transform_caps ()" link="GstGLDownload.html#gst-gl-download-transform-caps"/>
     <keyword type="function" name="gst_gl_download_perform_with_data ()" link="GstGLDownload.html#gst-gl-download-perform-with-data"/>
     <keyword type="struct" name="GstGLDownload" link="GstGLDownload.html#GstGLDownload-struct"/>
     <keyword type="function" name="gst_egl_image_memory_init ()" link="gst-plugins-bad-libs-GstEGLImageMemory.html#gst-egl-image-memory-init"/>
@@ -466,20 +497,21 @@
     <keyword type="function" name="gst_is_egl_image_memory ()" link="gst-plugins-bad-libs-GstEGLImageMemory.html#gst-is-egl-image-memory"/>
     <keyword type="macro" name="GST_EGL_IMAGE_MEMORY_TYPE" link="gst-plugins-bad-libs-GstEGLImageMemory.html#GST-EGL-IMAGE-MEMORY-TYPE:CAPS"/>
     <keyword type="macro" name="GST_CAPS_FEATURE_MEMORY_EGL_IMAGE" link="gst-plugins-bad-libs-GstEGLImageMemory.html#GST-CAPS-FEATURE-MEMORY-EGL-IMAGE:CAPS"/>
+    <keyword type="struct" name="GstGLBaseFilter" link="GstGLBaseFilter.html#GstGLBaseFilter-struct"/>
+    <keyword type="struct" name="GstGLBaseFilterClass" link="GstGLBaseFilter.html#GstGLBaseFilterClass"/>
+    <keyword type="property" name="The “context” property" link="GstGLBaseFilter.html#GstGLBaseFilter--context"/>
     <keyword type="function" name="gst_gl_filter_draw_texture ()" link="GstGLFilter.html#gst-gl-filter-draw-texture"/>
     <keyword type="function" name="gst_gl_filter_render_to_target ()" link="GstGLFilter.html#gst-gl-filter-render-to-target"/>
     <keyword type="function" name="gst_gl_filter_render_to_target_with_shader ()" link="GstGLFilter.html#gst-gl-filter-render-to-target-with-shader"/>
     <keyword type="function" name="gst_gl_filter_filter_texture ()" link="GstGLFilter.html#gst-gl-filter-filter-texture"/>
-    <keyword type="struct" name="struct GstGLFilter" link="GstGLFilter.html#GstGLFilter-struct"/>
-    <keyword type="struct" name="struct GstGLFilterClass" link="GstGLFilter.html#GstGLFilterClass"/>
-    <keyword type="property" name="The “other-context” property" link="GstGLFilter.html#GstGLFilter--other-context"/>
-    <keyword type="function" name="gst_gl_framebuffer_new ()" link="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-new"/>
-    <keyword type="function" name="gst_gl_framebuffer_generate ()" link="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-generate"/>
-    <keyword type="function" name="gst_gl_framebuffer_delete ()" link="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-delete"/>
-    <keyword type="function" name="gst_gl_framebuffer_use ()" link="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use"/>
-    <keyword type="function" name="gst_gl_framebuffer_use_v2 ()" link="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use-v2"/>
-    <keyword type="struct" name="struct GstGLFramebuffer" link="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer"/>
-    <keyword type="struct" name="struct GstGLFramebufferClass" link="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebufferClass"/>
+    <keyword type="struct" name="GstGLFilter" link="GstGLFilter.html#GstGLFilter-struct"/>
+    <keyword type="struct" name="GstGLFilterClass" link="GstGLFilter.html#GstGLFilterClass"/>
+    <keyword type="function" name="gst_gl_framebuffer_new ()" link="GstGLFramebuffer.html#gst-gl-framebuffer-new"/>
+    <keyword type="function" name="gst_gl_framebuffer_generate ()" link="GstGLFramebuffer.html#gst-gl-framebuffer-generate"/>
+    <keyword type="function" name="gst_gl_framebuffer_delete ()" link="GstGLFramebuffer.html#gst-gl-framebuffer-delete"/>
+    <keyword type="function" name="gst_gl_framebuffer_use_v2 ()" link="GstGLFramebuffer.html#gst-gl-framebuffer-use-v2"/>
+    <keyword type="struct" name="struct GstGLFramebuffer" link="GstGLFramebuffer.html#GstGLFramebuffer-struct"/>
+    <keyword type="struct" name="struct GstGLFramebufferClass" link="GstGLFramebuffer.html#GstGLFramebufferClass"/>
     <keyword type="macro" name="GST_GL_MEMORY_FLAGS()" link="gst-plugins-bad-libs-gstglmemory.html#GST-GL-MEMORY-FLAGS:CAPS"/>
     <keyword type="macro" name="GST_GL_MEMORY_FLAG_IS_SET()" link="gst-plugins-bad-libs-gstglmemory.html#GST-GL-MEMORY-FLAG-IS-SET:CAPS"/>
     <keyword type="macro" name="GST_GL_MEMORY_FLAG_SET()" link="gst-plugins-bad-libs-gstglmemory.html#GST-GL-MEMORY-FLAG-SET:CAPS"/>
@@ -508,6 +540,7 @@
     <keyword type="function" name="gst_gl_shader_set_fragment_source ()" link="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-set-fragment-source"/>
     <keyword type="function" name="gst_gl_shader_get_vertex_source ()" link="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-vertex-source"/>
     <keyword type="function" name="gst_gl_shader_get_fragment_source ()" link="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-fragment-source"/>
+    <keyword type="function" name="gst_gl_shader_get_program_handle ()" link="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-program-handle"/>
     <keyword type="function" name="gst_gl_shader_set_active ()" link="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-set-active"/>
     <keyword type="function" name="gst_gl_shader_is_compiled ()" link="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-is-compiled"/>
     <keyword type="function" name="gst_gl_shader_compile ()" link="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-compile"/>
@@ -553,30 +586,36 @@
     <keyword type="property" name="The “compiled” property" link="gst-plugins-bad-libs-gstglshader.html#GstGLShader--compiled"/>
     <keyword type="property" name="The “fragment-src” property" link="gst-plugins-bad-libs-gstglshader.html#GstGLShader--fragment-src"/>
     <keyword type="property" name="The “vertex-src” property" link="gst-plugins-bad-libs-gstglshader.html#GstGLShader--vertex-src"/>
+    <keyword type="function" name="gst_buffer_add_gl_sync_meta ()" link="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-add-gl-sync-meta"/>
+    <keyword type="macro" name="gst_buffer_get_gl_sync_meta()" link="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-get-gl-sync-meta"/>
+    <keyword type="function" name="gst_gl_sync_meta_api_get_type ()" link="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-api-get-type"/>
+    <keyword type="function" name="gst_gl_sync_meta_get_info ()" link="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-get-info"/>
+    <keyword type="function" name="gst_gl_sync_meta_set_sync_point ()" link="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-set-sync-point"/>
+    <keyword type="function" name="gst_gl_sync_meta_wait ()" link="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-wait"/>
+    <keyword type="struct" name="struct GstGLSyncMeta" link="gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta"/>
+    <keyword type="macro" name="GST_BUFFER_POOL_OPTION_GL_SYNC_META" link="gst-plugins-bad-libs-GstGLSyncMeta.html#GST-BUFFER-POOL-OPTION-GL-SYNC-META:CAPS"/>
     <keyword type="function" name="gst_gl_upload_new ()" link="GstGLUpload.html#gst-gl-upload-new"/>
-    <keyword type="function" name="gst_gl_upload_set_format ()" link="GstGLUpload.html#gst-gl-upload-set-format"/>
-    <keyword type="function" name="gst_gl_upload_get_format ()" link="GstGLUpload.html#gst-gl-upload-get-format"/>
-    <keyword type="function" name="gst_gl_upload_perform_with_data ()" link="GstGLUpload.html#gst-gl-upload-perform-with-data"/>
-    <keyword type="function" name="gst_gl_upload_perform_with_gl_texture_upload_meta ()" link="GstGLUpload.html#gst-gl-upload-perform-with-gl-texture-upload-meta"/>
+    <keyword type="function" name="gst_gl_upload_get_caps ()" link="GstGLUpload.html#gst-gl-upload-get-caps"/>
+    <keyword type="function" name="gst_gl_upload_set_caps ()" link="GstGLUpload.html#gst-gl-upload-set-caps"/>
+    <keyword type="function" name="gst_gl_upload_propose_allocation ()" link="GstGLUpload.html#gst-gl-upload-propose-allocation"/>
+    <keyword type="function" name="gst_gl_upload_transform_caps ()" link="GstGLUpload.html#gst-gl-upload-transform-caps"/>
     <keyword type="function" name="gst_gl_upload_perform_with_buffer ()" link="GstGLUpload.html#gst-gl-upload-perform-with-buffer"/>
     <keyword type="function" name="gst_gl_upload_release_buffer ()" link="GstGLUpload.html#gst-gl-upload-release-buffer"/>
     <keyword type="struct" name="GstGLUpload" link="GstGLUpload.html#GstGLUpload-struct"/>
-    <keyword type="function" name="gst_gl_upload_meta_new ()" link="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-new"/>
-    <keyword type="function" name="gst_gl_upload_meta_set_format ()" link="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-set-format"/>
-    <keyword type="function" name="gst_gl_upload_meta_get_format ()" link="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-get-format"/>
-    <keyword type="function" name="gst_gl_upload_meta_add_to_buffer ()" link="gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer"/>
-    <keyword type="struct" name="GstGLUploadMeta" link="gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta"/>
+    <keyword type="function" name="gst_gl_upload_meta_new ()" link="GstGLUploadMeta.html#gst-gl-upload-meta-new"/>
+    <keyword type="function" name="gst_gl_upload_meta_set_format ()" link="GstGLUploadMeta.html#gst-gl-upload-meta-set-format"/>
+    <keyword type="function" name="gst_gl_upload_meta_get_format ()" link="GstGLUploadMeta.html#gst-gl-upload-meta-get-format"/>
+    <keyword type="function" name="gst_gl_upload_meta_add_to_buffer ()" link="GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer"/>
+    <keyword type="struct" name="GstGLUploadMeta" link="GstGLUploadMeta.html#GstGLUploadMeta-struct"/>
     <keyword type="function" name="GLCB ()" link="gst-plugins-bad-libs-Utilities.html#GLCB:CAPS"/>
     <keyword type="function" name="GLCB_V2 ()" link="gst-plugins-bad-libs-Utilities.html#GLCB-V2:CAPS"/>
     <keyword type="function" name="CDCB ()" link="gst-plugins-bad-libs-Utilities.html#CDCB:CAPS"/>
-    <keyword type="function" name="gst_gl_ensure_display ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-display"/>
     <keyword type="function" name="gst_gl_handle_set_context ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-handle-set-context"/>
     <keyword type="function" name="gst_gl_handle_context_query ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-handle-context-query"/>
     <keyword type="function" name="gst_gl_context_gen_texture ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-gen-texture"/>
     <keyword type="function" name="gst_gl_context_del_texture ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-del-texture"/>
     <keyword type="function" name="gst_gl_context_gen_fbo ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-gen-fbo"/>
     <keyword type="function" name="gst_gl_context_del_fbo ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-del-fbo"/>
-    <keyword type="function" name="gst_gl_context_use_fbo ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo"/>
     <keyword type="function" name="gst_gl_context_use_fbo_v2 ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo-v2"/>
     <keyword type="function" name="gst_gl_context_gen_shader ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-gen-shader"/>
     <keyword type="function" name="gst_gl_context_del_shader ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-del-shader"/>
@@ -585,6 +624,10 @@
     <keyword type="function" name="gst_gl_context_get_error ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-get-error"/>
     <keyword type="function" name="gst_gl_context_clear_shader ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-context-clear-shader"/>
     <keyword type="function" name="gst_gl_generate_texture_full ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-generate-texture-full"/>
+    <keyword type="function" name="gst_gl_caps_replace_all_caps_features ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-caps-replace-all-caps-features"/>
+    <keyword type="function" name="gst_gl_ensure_element_data ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-element-data"/>
+    <keyword type="function" name="gst_gl_get_plane_data_size ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-get-plane-data-size"/>
+    <keyword type="function" name="gst_gl_run_query ()" link="gst-plugins-bad-libs-Utilities.html#gst-gl-run-query"/>
     <keyword type="enum" name="enum GstGLDisplayProjection" link="gst-plugins-bad-libs-Utilities.html#GstGLDisplayProjection"/>
     <keyword type="function" name="gst_gl_window_error_quark ()" link="GstGLWindow.html#gst-gl-window-error-quark"/>
     <keyword type="macro" name="GST_GL_WINDOW_ERROR" link="GstGLWindow.html#GST-GL-WINDOW-ERROR:CAPS"/>
@@ -607,9 +650,17 @@
     <keyword type="function" name="gst_gl_window_set_resize_callback ()" link="GstGLWindow.html#gst-gl-window-set-resize-callback" since="1.4"/>
     <keyword type="function" name="gst_gl_window_set_window_handle ()" link="GstGLWindow.html#gst-gl-window-set-window-handle" since="1.4"/>
     <keyword type="function" name="gst_gl_window_get_window_handle ()" link="GstGLWindow.html#gst-gl-window-get-window-handle" since="1.4"/>
+    <keyword type="function" name="gst_gl_window_set_preferred_size ()" link="GstGLWindow.html#gst-gl-window-set-preferred-size" since="1.6"/>
+    <keyword type="function" name="gst_gl_window_show ()" link="GstGLWindow.html#gst-gl-window-show" since="1.6"/>
+    <keyword type="function" name="gst_gl_window_get_surface_dimensions ()" link="GstGLWindow.html#gst-gl-window-get-surface-dimensions" since="1.6"/>
+    <keyword type="function" name="gst_gl_window_handle_events ()" link="GstGLWindow.html#gst-gl-window-handle-events"/>
     <keyword type="enum" name="enum GstGLWindowError" link="GstGLWindow.html#GstGLWindowError"/>
     <keyword type="struct" name="GstGLWindow" link="GstGLWindow.html#GstGLWindow-struct"/>
     <keyword type="struct" name="GstGLWindowClass" link="GstGLWindow.html#GstGLWindowClass"/>
+    <keyword type="signal" name="The “key-event” signal" link="GstGLWindow.html#GstGLWindow-key-event"/>
+    <keyword type="signal" name="The “mouse-event” signal" link="GstGLWindow.html#GstGLWindow-mouse-event"/>
+    <keyword type="signal" name="The “key-event” signal" link="GstGLWindow.html#GstGLWindow-key-event"/>
+    <keyword type="signal" name="The “mouse-event” signal" link="GstGLWindow.html#GstGLWindow-mouse-event"/>
     <keyword type="function" name="gst_gl_window_android_egl_new ()" link="gst-plugins-bad-libs-GstGLWindowAndroid.html#gst-gl-window-android-egl-new"/>
     <keyword type="struct" name="struct GstGLWindowAndroidEGL" link="gst-plugins-bad-libs-GstGLWindowAndroid.html#GstGLWindowAndroidEGL"/>
     <keyword type="struct" name="struct GstGLWindowAndroidEGLClass" link="gst-plugins-bad-libs-GstGLWindowAndroid.html#GstGLWindowAndroidEGLClass"/>
@@ -633,5 +684,63 @@
     <keyword type="function" name="gst_gl_window_x11_untrap_x_errors ()" link="gst-plugins-bad-libs-GstGLWindowX11.html#gst-gl-window-x11-untrap-x-errors"/>
     <keyword type="struct" name="struct GstGLWindowX11" link="gst-plugins-bad-libs-GstGLWindowX11.html#GstGLWindowX11"/>
     <keyword type="struct" name="struct GstGLWindowX11Class" link="gst-plugins-bad-libs-GstGLWindowX11.html#GstGLWindowX11Class"/>
+    <keyword type="function" name="GstPhotographyCapturePrepared ()" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCapturePrepared"/>
+    <keyword type="function" name="gst_photography_get_ev_compensation ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-ev-compensation"/>
+    <keyword type="function" name="gst_photography_get_iso_speed ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-iso-speed"/>
+    <keyword type="function" name="gst_photography_get_aperture ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-aperture"/>
+    <keyword type="function" name="gst_photography_get_exposure ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-exposure"/>
+    <keyword type="function" name="gst_photography_get_white_balance_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-white-balance-mode"/>
+    <keyword type="function" name="gst_photography_get_color_tone_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-color-tone-mode"/>
+    <keyword type="function" name="gst_photography_get_scene_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-scene-mode"/>
+    <keyword type="function" name="gst_photography_get_flash_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flash-mode"/>
+    <keyword type="function" name="gst_photography_get_flicker_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flicker-mode"/>
+    <keyword type="function" name="gst_photography_get_focus_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-focus-mode"/>
+    <keyword type="function" name="gst_photography_get_noise_reduction ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-noise-reduction" since="0.10.21"/>
+    <keyword type="function" name="gst_photography_get_zoom ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-zoom"/>
+    <keyword type="function" name="gst_photography_set_ev_compensation ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-ev-compensation"/>
+    <keyword type="function" name="gst_photography_set_iso_speed ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-iso-speed"/>
+    <keyword type="function" name="gst_photography_set_aperture ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-aperture"/>
+    <keyword type="function" name="gst_photography_set_exposure ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-exposure"/>
+    <keyword type="function" name="gst_photography_set_white_balance_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-white-balance-mode"/>
+    <keyword type="function" name="gst_photography_set_color_tone_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-color-tone-mode"/>
+    <keyword type="function" name="gst_photography_set_scene_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-scene-mode"/>
+    <keyword type="function" name="gst_photography_set_flash_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flash-mode"/>
+    <keyword type="function" name="gst_photography_set_flicker_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flicker-mode"/>
+    <keyword type="function" name="gst_photography_set_focus_mode ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-focus-mode"/>
+    <keyword type="function" name="gst_photography_set_noise_reduction ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-noise-reduction" since="0.10.21"/>
+    <keyword type="function" name="gst_photography_set_zoom ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-zoom"/>
+    <keyword type="function" name="gst_photography_get_capabilities ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-capabilities"/>
+    <keyword type="function" name="gst_photography_prepare_for_capture ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-prepare-for-capture"/>
+    <keyword type="function" name="gst_photography_set_autofocus ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-autofocus"/>
+    <keyword type="function" name="gst_photography_set_config ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-config"/>
+    <keyword type="function" name="gst_photography_get_config ()" link="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-config"/>
+    <keyword type="struct" name="GstPhotography" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotography"/>
+    <keyword type="enum" name="enum GstPhotographyNoiseReduction" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyNoiseReduction" since="0.10.21"/>
+    <keyword type="enum" name="enum GstPhotographyWhiteBalanceMode" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode"/>
+    <keyword type="enum" name="enum GstPhotographyColorToneMode" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode"/>
+    <keyword type="enum" name="enum GstPhotographySceneMode" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode"/>
+    <keyword type="enum" name="enum GstPhotographyFlashMode" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode"/>
+    <keyword type="enum" name="enum GstPhotographyFlickerReductionMode" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlickerReductionMode"/>
+    <keyword type="enum" name="enum GstPhotographyFocusMode" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusMode"/>
+    <keyword type="enum" name="enum GstPhotographyFocusStatus" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusStatus"/>
+    <keyword type="enum" name="enum GstPhotographyCaps" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps"/>
+    <keyword type="enum" name="enum GstPhotographyShakeRisk" link="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyShakeRisk"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_AUTOFOCUS_DONE" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_SHAKE_RISK" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_WB_MODE" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-WB-MODE:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_SCENE_MODE" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SCENE-MODE:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_FLASH_MODE" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLASH-MODE:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-NOISE-REDUCTION:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_FOCUS_STATUS" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-STATUS:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_CAPABILITIES" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-CAPABILITIES:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_SHAKE_RISK" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SHAKE-RISK:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_EV_COMP" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-EV-COMP:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_ISO_SPEED" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ISO-SPEED:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_APERTURE" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-APERTURE:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-CAPTURE-SUPPORTED-CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-PREVIEW-SUPPORTED-CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_FLICKER_MODE" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLICKER-MODE:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_FOCUS_MODE" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-MODE:CAPS"/>
+    <keyword type="macro" name="GST_PHOTOGRAPHY_PROP_ZOOM" link="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ZOOM:CAPS"/>
   </functions>
 </book>
diff --git a/docs/libs/html/gst-plugins-bad-libs-Base-MPEG-TS-sections.html b/docs/libs/html/gst-plugins-bad-libs-Base-MPEG-TS-sections.html
index 1589564..b6fbd67 100644
--- a/docs/libs/html/gst-plugins-bad-libs-Base-MPEG-TS-sections.html
+++ b/docs/libs/html/gst-plugins-bad-libs-Base-MPEG-TS-sections.html
@@ -245,7 +245,7 @@
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-Base-MPEG-TS-sections.description"></a><h2>Description</h2>
 <p>For more details, refer to the ITU H.222.0 or ISO/IEC 13818-1 specifications
-and other specifications mentionned in the documentation.</p>
+and other specifications mentioned in the documentation.</p>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-Base-MPEG-TS-sections.functions_details"></a><h2>Functions</h2>
@@ -391,7 +391,7 @@
 gst_mpegts_section_packetize (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Base-MPEG-TS-sections.html#GstMpegtsSection"><span class="type">GstMpegtsSection</span></a> *section</code></em>,
                               <em class="parameter"><code><span class="type">gsize</span> *output_size</code></em>);</pre>
 <p>If the data in <em class="parameter"><code>section</code></em>
- has aldready been packetized, the data pointer is returned
+ has already been packetized, the data pointer is returned
 immediately. Otherwise, the data field is allocated and populated.</p>
 <div class="refsect3">
 <a name="id-1.2.5.4.9.7.5"></a><h4>Parameters</h4>
@@ -549,7 +549,7 @@
 gst_mpegts_section_from_pat (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Pointer-Arrays.html#GPtrArray"><span class="type">GPtrArray</span></a> *programs</code></em>,
                              <em class="parameter"><code><span class="type">guint16</span> ts_id</code></em>);</pre>
 <p>Creates a PAT <a class="link" href="gst-plugins-bad-libs-Base-MPEG-TS-sections.html#GstMpegtsSection"><span class="type">GstMpegtsSection</span></a> from the <em class="parameter"><code>programs</code></em>
- array of <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/gst-plugins-bad-libs-Base-MPEG-TS-sections.html#GstMpegtsPatProgram"><span class="type">GstMpegtsPatPrograms</span></a></p>
+ array of <a href="../gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Base-MPEG-TS-sections.html#GstMpegtsPatProgram"><span class="type">GstMpegtsPatPrograms</span></a></p>
 <div class="refsect3">
 <a name="id-1.2.5.4.9.14.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
@@ -702,7 +702,7 @@
 <a name="gst-mpegts-section-get-cat"></a><h3>gst_mpegts_section_get_cat ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Pointer-Arrays.html#GPtrArray"><span class="returnvalue">GPtrArray</span></a> *
 gst_mpegts_section_get_cat (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Base-MPEG-TS-sections.html#GstMpegtsSection"><span class="type">GstMpegtsSection</span></a> *section</code></em>);</pre>
-<p>Returns the array of <a class="link" href="gst-plugins-bad-libs-Base-MPEG-TS-descriptors.html#GstMpegtsDescriptor"><span class="type">GstMpegtsDescriptor</span></a> contained in the Condtional
+<p>Returns the array of <a class="link" href="gst-plugins-bad-libs-Base-MPEG-TS-descriptors.html#GstMpegtsDescriptor"><span class="type">GstMpegtsDescriptor</span></a> contained in the Conditional
 Access Table.</p>
 <div class="refsect3">
 <a name="id-1.2.5.4.9.20.5"></a><h4>Parameters</h4>
diff --git a/docs/libs/html/gst-plugins-bad-libs-DVB-variants-of-MPEG-TS-descriptors.html b/docs/libs/html/gst-plugins-bad-libs-DVB-variants-of-MPEG-TS-descriptors.html
index 77dafd3..2eb335c 100644
--- a/docs/libs/html/gst-plugins-bad-libs-DVB-variants-of-MPEG-TS-descriptors.html
+++ b/docs/libs/html/gst-plugins-bad-libs-DVB-variants-of-MPEG-TS-descriptors.html
@@ -2496,8 +2496,8 @@
 <tbody>
 <tr>
 <td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstMpegtsExtendedEventDescriptor.descriptor-number"></a>descriptor_number</code></em>;</p></td>
-<td> </td>
-<td> </td>
+<td class="struct_member_description"> </td>
+<td class="struct_member_annotations"> </td>
 </tr>
 <tr>
 <td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstMpegtsExtendedEventDescriptor.last-descriptor-number"></a>last_descriptor_number</code></em>;</p></td>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstAggregator.html b/docs/libs/html/gst-plugins-bad-libs-GstAggregator.html
index 81ff32e..b54fb8d 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstAggregator.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstAggregator.html
@@ -92,8 +92,8 @@
 Control is given to the subclass when all pads have data.</p>
 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 <li class="listitem"><p>
-   Base class for mixers and muxers. Implementers should at least implement
-   the <code class="function">aggregate()</code> vmethod.
+   Base class for mixers and muxers. Subclasses should at least implement
+   the <a class="link" href="gst-plugins-bad-libs-GstAggregator.html#GstAggregatorClass.aggregate"><code class="function">GstAggregatorClass.aggregate()</code></a> virtual method.
  </p></li>
 <li class="listitem"><p>
    When data is queued on all pads, tha aggregate vmethod is called.
@@ -126,8 +126,9 @@
 <pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#GstFlowReturn"><span class="returnvalue">GstFlowReturn</span></a>
 gst_aggregator_finish_buffer (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstAggregator.html#GstAggregator" title="struct GstAggregator"><span class="type">GstAggregator</span></a> *agg</code></em>,
                               <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *buffer</code></em>);</pre>
-<p>This method will take care of sending mandatory events before pushing
-the provided buffer.</p>
+<p>This method will push the provided output buffer downstream. If needed,
+mandatory events such as stream-start, caps, and segment events will be
+sent before pushing the buffer.</p>
 <div class="refsect3">
 <a name="id-1.2.7.2.6.2.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
@@ -144,8 +145,8 @@
 </tr>
 <tr>
 <td class="parameter_name"><p>buffer</p></td>
-<td class="parameter_description"><p>the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> to push.</p></td>
-<td class="parameter_annotations"> </td>
+<td class="parameter_description"><p> the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> to push. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
 </tr>
 </tbody>
 </table></div>
@@ -174,7 +175,7 @@
 </tr>
 <tr>
 <td class="parameter_name"><p>caps</p></td>
-<td class="parameter_description"><p>The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> to set later on the src pad.</p></td>
+<td class="parameter_description"><p>The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> to set on the src pad.</p></td>
 <td class="parameter_annotations"> </td>
 </tr>
 </tbody>
@@ -208,14 +209,14 @@
 </tr>
 <tr>
 <td class="parameter_name"><p>func</p></td>
-<td class="parameter_description"><p>The function to call.</p></td>
-<td class="parameter_annotations"> </td>
+<td class="parameter_description"><p> The function to call. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>]</span></td>
 </tr>
 <tr>
 <td class="parameter_name"><p>user_data</p></td>
-<td class="parameter_description"><p>The data to pass to <em class="parameter"><code>func</code></em>
-.</p></td>
-<td class="parameter_annotations"> </td>
+<td class="parameter_description"><p> The data to pass to <em class="parameter"><code>func</code></em>
+. </p></td>
+<td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
 </tr>
 </tbody>
 </table></div>
@@ -231,10 +232,11 @@
 
   GstPad                *  srcpad;
 
+  /* Only access with the object lock held */
   GstSegment               segment;
 };
 </pre>
-<p>Collectpads object.</p>
+<p>Aggregator base class object structure.</p>
 <div class="refsect3">
 <a name="id-1.2.7.2.7.2.5"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
@@ -251,13 +253,13 @@
 </tr>
 <tr>
 <td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html"><span class="type">GstPad</span></a> *<em class="structfield"><code><a name="GstAggregator.srcpad"></a>srcpad</code></em>;</p></td>
-<td> </td>
-<td> </td>
+<td class="struct_member_description"><p>the aggregator's source pad</p></td>
+<td class="struct_member_annotations"> </td>
 </tr>
 <tr>
 <td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstSegment.html"><span class="type">GstSegment</span></a> <em class="structfield"><code><a name="GstAggregator.segment"></a>segment</code></em>;</p></td>
-<td> </td>
-<td> </td>
+<td class="struct_member_description"><p>the output segment</p></td>
+<td class="struct_member_annotations"> </td>
 </tr>
 </tbody>
 </table></div>
@@ -273,36 +275,39 @@
 
   GstFlowReturn     (*flush)          (GstAggregator    *  aggregator);
 
-  GstFlowReturn     (*clip)           (GstAggregator    *  agg,
-                                       GstAggregatorPad *  bpad,
+  GstFlowReturn     (*clip)           (GstAggregator    *  aggregator,
+                                       GstAggregatorPad *  aggregator_pad,
                                        GstBuffer        *  buf,
                                        GstBuffer        ** outbuf);
 
   /* sinkpads virtual methods */
-  gboolean          (*sink_event)     (GstAggregator    *  aggregate,
-                                       GstAggregatorPad *  bpad,
+  gboolean          (*sink_event)     (GstAggregator    *  aggregator,
+                                       GstAggregatorPad *  aggregator_pad,
                                        GstEvent         *  event);
 
-  gboolean          (*sink_query)     (GstAggregator    *  aggregate,
-                                       GstAggregatorPad *  bpad,
+  gboolean          (*sink_query)     (GstAggregator    *  aggregator,
+                                       GstAggregatorPad *  aggregator_pad,
                                        GstQuery         *  query);
 
   /* srcpad virtual methods */
-  gboolean          (*src_event)      (GstAggregator    *  aggregate,
+  gboolean          (*src_event)      (GstAggregator    *  aggregator,
                                        GstEvent         *  event);
 
-  gboolean          (*src_query)      (GstAggregator    *  aggregate,
+  gboolean          (*src_query)      (GstAggregator    *  aggregator,
                                        GstQuery         *  query);
 
   gboolean          (*src_activate)   (GstAggregator    *  aggregator,
                                        GstPadMode          mode,
                                        gboolean            active);
 
-  GstFlowReturn     (*aggregate)      (GstAggregator    *  aggregator);
+  GstFlowReturn     (*aggregate)      (GstAggregator    *  aggregator,
+                                       gboolean            timeout);
 
   gboolean          (*stop)           (GstAggregator    *  aggregator);
 
   gboolean          (*start)          (GstAggregator    *  aggregator);
+
+  GstClockTime      (*get_next_time)  (GstAggregator    *  aggregator);
 };
 </pre>
 <p>The aggregator base class will handle in a thread-safe way all manners of
@@ -390,7 +395,7 @@
 <td class="struct_member_description"><p>Mandatory.
 Called when buffers are queued on all sinkpads. Classes
 should iterate the GstElement-&gt;sinkpads and peek or steal
-buffers from the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad"><span class="type">GstAggregatorPads</span></a>. If the subclass returns
+buffers from the <a href="../gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad"><span class="type">GstAggregatorPads</span></a>. If the subclass returns
 GST_FLOW_EOS, sending of the eos event will be taken care
 of. Once / if a buffer has been constructed from the
 aggregated buffers, the subclass should call _finish_buffer.</p></td>
@@ -399,19 +404,28 @@
 <tr>
 <td class="struct_member_name"><p><em class="structfield"><code><a name="GstAggregatorClass.stop"></a>stop</code></em> ()</p></td>
 <td class="struct_member_description"><p>Optional.
-Should be linked up first. Called when the
-element goes from PAUSED to READY. The subclass should free
-all resources and reset its state.</p></td>
+Called when the element goes from PAUSED to READY.
+The subclass should free all resources and reset its state.</p></td>
 <td class="struct_member_annotations"> </td>
 </tr>
 <tr>
 <td class="struct_member_name"><p><em class="structfield"><code><a name="GstAggregatorClass.start"></a>start</code></em> ()</p></td>
 <td class="struct_member_description"><p>Optional.
-Should be linked up first. Called when the element goes from
-READY to PAUSED. The subclass should get ready to process
+Called when the element goes from READY to PAUSED.
+The subclass should get ready to process
 aggregated buffers.</p></td>
 <td class="struct_member_annotations"> </td>
 </tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAggregatorClass.get-next-time"></a>get_next_time</code></em> ()</p></td>
+<td class="struct_member_description"><p>Optional.
+Called when the element needs to know the time of the next
+rendered buffer for live pipelines. This causes deadline
+based aggregation to occur. Defaults to returning
+GST_CLOCK_TIME_NONE causing the element to wait for buffers
+on all sink pads before aggregating.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
 </tbody>
 </table></div>
 </div>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstAggregatorPad.html b/docs/libs/html/gst-plugins-bad-libs-GstAggregatorPad.html
index 0dc87ec..9c7335d 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstAggregatorPad.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstAggregatorPad.html
@@ -55,6 +55,22 @@
 <a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-get-buffer" title="gst_aggregator_pad_get_buffer ()">gst_aggregator_pad_get_buffer</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-drop-buffer" title="gst_aggregator_pad_drop_buffer ()">gst_aggregator_pad_drop_buffer</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-is-eos" title="gst_aggregator_pad_is_eos ()">gst_aggregator_pad_is_eos</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -140,6 +156,41 @@
 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
 </div>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-aggregator-pad-drop-buffer"></a><h3>gst_aggregator_pad_drop_buffer ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_aggregator_pad_drop_buffer (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad" title="struct GstAggregatorPad"><span class="type">GstAggregatorPad</span></a> *pad</code></em>);</pre>
+<p>Drop the buffer currently queued in <em class="parameter"><code>pad</code></em>
+.</p>
+<div class="refsect3">
+<a name="id-1.2.7.3.6.4.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>pad</p></td>
+<td class="parameter_description"><p>the pad where to drop any pending buffer</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.7.3.6.4.6"></a><h4>Returns</h4>
+<p> TRUE if there was a buffer queued in <em class="parameter"><code>pad</code></em>
+, or FALSE if not.</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-aggregator-pad-is-eos"></a><h3>gst_aggregator_pad_is_eos ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_aggregator_pad_is_eos (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad" title="struct GstAggregatorPad"><span class="type">GstAggregatorPad</span></a> *pad</code></em>);</pre>
+</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-GstAggregatorPad.other_details"></a><h2>Types and Values</h2>
@@ -148,9 +199,8 @@
 <pre class="programlisting">struct GstAggregatorPad {
   GstPad                       parent;
 
-  GstBuffer                 *  buffer;
-  GstSegment                   segment;
-  gboolean                     eos;
+  /* Protected by the OBJECT_LOCK */
+  GstSegment segment;
 
   /* &lt; Private &gt; */
   GstAggregatorPadPrivate   *  priv;
@@ -174,21 +224,11 @@
 <td> </td>
 </tr>
 <tr>
-<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *<em class="structfield"><code><a name="GstAggregatorPad.buffer"></a>buffer</code></em>;</p></td>
-<td class="struct_member_description"><p>currently queued buffer.</p></td>
-<td class="struct_member_annotations"> </td>
-</tr>
-<tr>
 <td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstSegment.html"><span class="type">GstSegment</span></a> <em class="structfield"><code><a name="GstAggregatorPad.segment"></a>segment</code></em>;</p></td>
 <td class="struct_member_description"><p>last segment received.</p></td>
 <td class="struct_member_annotations"> </td>
 </tr>
 <tr>
-<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> <em class="structfield"><code><a name="GstAggregatorPad.eos"></a>eos</code></em>;</p></td>
-<td> </td>
-<td> </td>
-</tr>
-<tr>
 <td class="struct_member_name"><p><span class="type">GstAggregatorPadPrivate</span> *<em class="structfield"><code><a name="GstAggregatorPad.priv"></a>priv</code></em>;</p></td>
 <td> </td>
 <td> </td>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstEGLImageMemory.html b/docs/libs/html/gst-plugins-bad-libs-GstEGLImageMemory.html
index ada45c1..0e7507b 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstEGLImageMemory.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstEGLImageMemory.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
 <link rel="prev" href="GstGLDownload.html" title="GstGLDownload">
-<link rel="next" href="GstGLFilter.html" title="GstGLFilter">
+<link rel="next" href="GstGLBaseFilter.html" title="GstGLBaseFilter">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -20,7 +20,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="GstGLDownload.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="GstGLFilter.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="GstGLBaseFilter.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-libs-GstEGLImageMemory"></a><div class="titlepage"></div>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLAPI.html b/docs/libs/html/gst-plugins-bad-libs-GstGLAPI.html
index 387923f..8fc8a98 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLAPI.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLAPI.html
@@ -126,24 +126,108 @@
 <a name="gst-gl-api-to-string"></a><h3>gst_gl_api_to_string ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
 gst_gl_api_to_string (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="type">GstGLAPI</span></a> api</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.2.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>api</p></td>
+<td class="parameter_description"><p>a <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="type">GstGLAPI</span></a> to stringify</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.2.5"></a><h4>Returns</h4>
+<p> A space seperated string of the OpenGL api's enabled in <em class="parameter"><code>api</code></em>
+</p>
+<p></p>
+</div>
 </div>
 <hr>
 <div class="refsect2">
 <a name="gst-gl-api-from-string"></a><h3>gst_gl_api_from_string ()</h3>
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="returnvalue">GstGLAPI</span></a>
 gst_gl_api_from_string (<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *api_s</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.3.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>api_s</p></td>
+<td class="parameter_description"><p>a space seperated string of OpenGL apis</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.3.5"></a><h4>Returns</h4>
+<p> The <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLAPI" title="enum GstGLAPI"><span class="type">GstGLAPI</span></a> represented by <em class="parameter"><code>api_s</code></em>
+</p>
+<p></p>
+</div>
 </div>
 <hr>
 <div class="refsect2">
 <a name="gst-gl-platform-to-string"></a><h3>gst_gl_platform_to_string ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
 gst_gl_platform_to_string (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="type">GstGLPlatform</span></a> api</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.4.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>api</p></td>
+<td class="parameter_description"><p>a <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="type">GstGLPlatform</span></a> to stringify</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.4.5"></a><h4>Returns</h4>
+<p> A space seperated string of the OpenGL platforms enabled in <em class="parameter"><code>api</code></em>
+</p>
+<p></p>
+</div>
 </div>
 <hr>
 <div class="refsect2">
 <a name="gst-gl-platform-from-string"></a><h3>gst_gl_platform_from_string ()</h3>
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="returnvalue">GstGLPlatform</span></a>
 gst_gl_platform_from_string (<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *platform_s</code></em>);</pre>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.5.4"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>platform_s</p></td>
+<td class="parameter_description"><p>a space seperated string of OpenGL platformss</p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.2.6.5.5"></a><h4>Returns</h4>
+<p> The <a class="link" href="gst-plugins-bad-libs-GstGLAPI.html#GstGLPlatform" title="enum GstGLPlatform"><span class="type">GstGLPlatform</span></a> represented by <em class="parameter"><code>platform_s</code></em>
+</p>
+<p></p>
+</div>
 </div>
 <hr>
 <div class="refsect2">
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLContextCocoa.html b/docs/libs/html/gst-plugins-bad-libs-GstGLContextCocoa.html
index 7151bad..47a8ca4 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLContextCocoa.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLContextCocoa.html
@@ -38,14 +38,32 @@
 <col width="150px" class="functions_return">
 <col class="functions_name">
 </colgroup>
-<tbody><tr>
+<tbody>
+<tr>
 <td class="function_type">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#GstGLContextCocoa" title="struct GstGLContextCocoa"><span class="returnvalue">GstGLContextCocoa</span></a> *
 </td>
 <td class="function_name">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-new" title="gst_gl_context_cocoa_new ()">gst_gl_context_cocoa_new</a> <span class="c_punctuation">()</span>
 </td>
-</tr></tbody>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guintptr</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-current-context" title="gst_gl_context_cocoa_get_current_context ()">gst_gl_context_cocoa_get_current_context</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">CGLPixelFormatObj</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-pixel-format" title="gst_gl_context_cocoa_get_pixel_format ()">gst_gl_context_cocoa_get_pixel_format</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
 </table></div>
 </div>
 <div class="refsect1">
@@ -71,6 +89,19 @@
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#GstGLContextCocoa" title="struct GstGLContextCocoa"><span class="returnvalue">GstGLContextCocoa</span></a> *
 gst_gl_context_cocoa_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-cocoa-get-current-context"></a><h3>gst_gl_context_cocoa_get_current_context ()</h3>
+<pre class="programlisting"><span class="returnvalue">guintptr</span>
+gst_gl_context_cocoa_get_current_context
+                               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-cocoa-get-pixel-format"></a><h3>gst_gl_context_cocoa_get_pixel_format ()</h3>
+<pre class="programlisting"><span class="returnvalue">CGLPixelFormatObj</span>
+gst_gl_context_cocoa_get_pixel_format (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLContextCocoa.html#GstGLContextCocoa" title="struct GstGLContextCocoa"><span class="type">GstGLContextCocoa</span></a> *context</code></em>);</pre>
+</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-GstGLContextCocoa.other_details"></a><h2>Types and Values</h2>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLContextEGL.html b/docs/libs/html/gst-plugins-bad-libs-GstGLContextEGL.html
index 4d5a3a8..88694b7 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLContextEGL.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLContextEGL.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
 <link rel="prev" href="gst-plugins-bad-libs-GstGLContextCocoa.html" title="GstGLContextCocoa">
-<link rel="next" href="gst-plugins-bad-libs-GstGLContextGLX.html" title="GstGLContextGLX">
+<link rel="next" href="gst-plugins-bad-libs-GstGLContextEagl.html" title="GstGLContextEagl">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -20,7 +20,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-libs-GstGLContextCocoa.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-libs-GstGLContextGLX.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-libs-GstGLContextEagl.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-libs-GstGLContextEGL"></a><div class="titlepage"></div>
@@ -38,14 +38,32 @@
 <col width="150px" class="functions_return">
 <col class="functions_name">
 </colgroup>
-<tbody><tr>
+<tbody>
+<tr>
 <td class="function_type">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#GstGLContextEGL" title="struct GstGLContextEGL"><span class="returnvalue">GstGLContextEGL</span></a> *
 </td>
 <td class="function_name">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-new" title="gst_gl_context_egl_new ()">gst_gl_context_egl_new</a> <span class="c_punctuation">()</span>
 </td>
-</tr></tbody>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guintptr</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-current-context" title="gst_gl_context_egl_get_current_context ()">gst_gl_context_egl_get_current_context</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-proc-address" title="gst_gl_context_egl_get_proc_address ()">gst_gl_context_egl_get_proc_address</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
 </table></div>
 </div>
 <div class="refsect1">
@@ -71,6 +89,20 @@
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLContextEGL.html#GstGLContextEGL" title="struct GstGLContextEGL"><span class="returnvalue">GstGLContextEGL</span></a> *
 gst_gl_context_egl_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-egl-get-current-context"></a><h3>gst_gl_context_egl_get_current_context ()</h3>
+<pre class="programlisting"><span class="returnvalue">guintptr</span>
+gst_gl_context_egl_get_current_context
+                               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-egl-get-proc-address"></a><h3>gst_gl_context_egl_get_proc_address ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
+gst_gl_context_egl_get_proc_address (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                                     <em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
+</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-GstGLContextEGL.other_details"></a><h2>Types and Values</h2>
@@ -89,6 +121,9 @@
   EGLImageKHR (*eglCreateImage) (EGLDisplay dpy, EGLContext ctx, EGLenum target,
       EGLClientBuffer buffer, const EGLint *attrib_list);
   EGLBoolean (*eglDestroyImage) (EGLDisplay dpy, EGLImageKHR image);
+
+  /* Cached handle */
+  EGLNativeWindowType window_handle;
 };
 </pre>
 </div>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLContextEagl.html b/docs/libs/html/gst-plugins-bad-libs-GstGLContextEagl.html
new file mode 100644
index 0000000..e137dce
--- /dev/null
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLContextEagl.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Library Reference Manual: GstGLContextEagl</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
+<link rel="up" href="gl.html" title="OpenGL Helper Library">
+<link rel="prev" href="gst-plugins-bad-libs-GstGLContextEGL.html" title="GstGLContextEGL">
+<link rel="next" href="gst-plugins-bad-libs-GstGLContextGLX.html" title="GstGLContextGLX">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-libs-GstGLContextEagl.description" class="shortcut">Description</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLContextEGL.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-libs-GstGLContextGLX.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-libs-GstGLContextEagl"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-libs-GstGLContextEagl.top_of_page"></a>GstGLContextEagl</span></h2>
+<p>GstGLContextEagl</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLContextEagl.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#GstGLContextEagl" title="struct GstGLContextEagl"><span class="returnvalue">GstGLContextEagl</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-new" title="gst_gl_context_eagl_new ()">gst_gl_context_eagl_new</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guintptr</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-get-current-context" title="gst_gl_context_eagl_get_current_context ()">gst_gl_context_eagl_get_current_context</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLContextEagl.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#GstGLContextEagl" title="struct GstGLContextEagl">GstGLContextEagl</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLContextEagl.description"></a><h2>Description</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLContextEagl.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="gst-gl-context-eagl-new"></a><h3>gst_gl_context_eagl_new ()</h3>
+<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLContextEagl.html#GstGLContextEagl" title="struct GstGLContextEagl"><span class="returnvalue">GstGLContextEagl</span></a> *
+gst_gl_context_eagl_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-eagl-get-current-context"></a><h3>gst_gl_context_eagl_get_current_context ()</h3>
+<pre class="programlisting"><span class="returnvalue">guintptr</span>
+gst_gl_context_eagl_get_current_context
+                               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLContextEagl.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstGLContextEagl"></a><h3>struct GstGLContextEagl</h3>
+<pre class="programlisting">struct GstGLContextEagl {
+};
+</pre>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLContextGLX.html b/docs/libs/html/gst-plugins-bad-libs-GstGLContextGLX.html
index c8cc0c6..6cf6f22 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLContextGLX.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLContextGLX.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
-<link rel="prev" href="gst-plugins-bad-libs-GstGLContextEGL.html" title="GstGLContextEGL">
+<link rel="prev" href="gst-plugins-bad-libs-GstGLContextEagl.html" title="GstGLContextEagl">
 <link rel="next" href="gst-plugins-bad-libs-GstGLContextWGL.html" title="GstGLContextWGL">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -19,7 +19,7 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLContextEGL.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLContextEagl.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-libs-GstGLContextWGL.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -38,14 +38,32 @@
 <col width="150px" class="functions_return">
 <col class="functions_name">
 </colgroup>
-<tbody><tr>
+<tbody>
+<tr>
 <td class="function_type">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#GstGLContextGLX" title="struct GstGLContextGLX"><span class="returnvalue">GstGLContextGLX</span></a> *
 </td>
 <td class="function_name">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-new" title="gst_gl_context_glx_new ()">gst_gl_context_glx_new</a> <span class="c_punctuation">()</span>
 </td>
-</tr></tbody>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guintptr</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-current-context" title="gst_gl_context_glx_get_current_context ()">gst_gl_context_glx_get_current_context</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-proc-address" title="gst_gl_context_glx_get_proc_address ()">gst_gl_context_glx_get_proc_address</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
 </table></div>
 </div>
 <div class="refsect1">
@@ -71,6 +89,20 @@
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLContextGLX.html#GstGLContextGLX" title="struct GstGLContextGLX"><span class="returnvalue">GstGLContextGLX</span></a> *
 gst_gl_context_glx_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-glx-get-current-context"></a><h3>gst_gl_context_glx_get_current_context ()</h3>
+<pre class="programlisting"><span class="returnvalue">guintptr</span>
+gst_gl_context_glx_get_current_context
+                               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-glx-get-proc-address"></a><h3>gst_gl_context_glx_get_proc_address ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
+gst_gl_context_glx_get_proc_address (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                                     <em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
+</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-GstGLContextGLX.other_details"></a><h2>Types and Values</h2>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLContextWGL.html b/docs/libs/html/gst-plugins-bad-libs-GstGLContextWGL.html
index 6f9283f..5613681 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLContextWGL.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLContextWGL.html
@@ -38,14 +38,32 @@
 <col width="150px" class="functions_return">
 <col class="functions_name">
 </colgroup>
-<tbody><tr>
+<tbody>
+<tr>
 <td class="function_type">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html#GstGLContextWGL" title="struct GstGLContextWGL"><span class="returnvalue">GstGLContextWGL</span></a> *
 </td>
 <td class="function_name">
 <a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-new" title="gst_gl_context_wgl_new ()">gst_gl_context_wgl_new</a> <span class="c_punctuation">()</span>
 </td>
-</tr></tbody>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">guintptr</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-current-context" title="gst_gl_context_wgl_get_current_context ()">gst_gl_context_wgl_get_current_context</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-proc-address" title="gst_gl_context_wgl_get_proc_address ()">gst_gl_context_wgl_get_proc_address</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
 </table></div>
 </div>
 <div class="refsect1">
@@ -71,6 +89,20 @@
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLContextWGL.html#GstGLContextWGL" title="struct GstGLContextWGL"><span class="returnvalue">GstGLContextWGL</span></a> *
 gst_gl_context_wgl_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-wgl-get-current-context"></a><h3>gst_gl_context_wgl_get_current_context ()</h3>
+<pre class="programlisting"><span class="returnvalue">guintptr</span>
+gst_gl_context_wgl_get_current_context
+                               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-context-wgl-get-proc-address"></a><h3>gst_gl_context_wgl_get_proc_address ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
+gst_gl_context_wgl_get_proc_address (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                                     <em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
+</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-GstGLContextWGL.other_details"></a><h2>Types and Values</h2>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLFramebuffer.html b/docs/libs/html/gst-plugins-bad-libs-GstGLFramebuffer.html
deleted file mode 100644
index 4a3cee3..0000000
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLFramebuffer.html
+++ /dev/null
@@ -1,190 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Library Reference Manual: GstGLFramebuffer</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
-<link rel="up" href="gl.html" title="OpenGL Helper Library">
-<link rel="prev" href="GstGLFilter.html" title="GstGLFilter">
-<link rel="next" href="gst-plugins-bad-libs-gstglmemory.html" title="GstGLMemory">
-<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
-<link rel="stylesheet" href="style.css" type="text/css">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
-<td width="100%" align="left" class="shortcuts">
-<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-libs-GstGLFramebuffer.description" class="shortcut">Description</a></span>
-</td>
-<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
-<td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="GstGLFilter.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-libs-gstglmemory.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
-</tr></table>
-<div class="refentry">
-<a name="gst-plugins-bad-libs-GstGLFramebuffer"></a><div class="titlepage"></div>
-<div class="refnamediv"><table width="100%"><tr>
-<td valign="top">
-<h2><span class="refentrytitle"><a name="gst-plugins-bad-libs-GstGLFramebuffer.top_of_page"></a>GstGLFramebuffer</span></h2>
-<p>GstGLFramebuffer</p>
-</td>
-<td class="gallery_image" valign="top" align="right"></td>
-</tr></table></div>
-<div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLFramebuffer.functions"></a><h2>Functions</h2>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="functions_return">
-<col class="functions_name">
-</colgroup>
-<tbody>
-<tr>
-<td class="function_type">
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer"><span class="returnvalue">GstGLFramebuffer</span></a> *
-</td>
-<td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-new" title="gst_gl_framebuffer_new ()">gst_gl_framebuffer_new</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-generate" title="gst_gl_framebuffer_generate ()">gst_gl_framebuffer_generate</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<span class="returnvalue">void</span>
-</td>
-<td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-delete" title="gst_gl_framebuffer_delete ()">gst_gl_framebuffer_delete</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use" title="gst_gl_framebuffer_use ()">gst_gl_framebuffer_use</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use-v2" title="gst_gl_framebuffer_use_v2 ()">gst_gl_framebuffer_use_v2</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLFramebuffer.other"></a><h2>Types and Values</h2>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="name">
-<col class="description">
-</colgroup>
-<tbody>
-<tr>
-<td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer">GstGLFramebuffer</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebufferClass" title="struct GstGLFramebufferClass">GstGLFramebufferClass</a></td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLFramebuffer.description"></a><h2>Description</h2>
-</div>
-<div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLFramebuffer.functions_details"></a><h2>Functions</h2>
-<div class="refsect2">
-<a name="gst-gl-framebuffer-new"></a><h3>gst_gl_framebuffer_new ()</h3>
-<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer"><span class="returnvalue">GstGLFramebuffer</span></a> *
-gst_gl_framebuffer_new (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-gl-framebuffer-generate"></a><h3>gst_gl_framebuffer_generate ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_framebuffer_generate (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer"><span class="type">GstGLFramebuffer</span></a> *frame</code></em>,
-                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
-                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
-                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *fbo</code></em>,
-                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *depthbuffer</code></em>);</pre>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-gl-framebuffer-delete"></a><h3>gst_gl_framebuffer_delete ()</h3>
-<pre class="programlisting"><span class="returnvalue">void</span>
-gst_gl_framebuffer_delete (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer"><span class="type">GstGLFramebuffer</span></a> *frame</code></em>,
-                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> fbo</code></em>,
-                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> depth</code></em>);</pre>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-gl-framebuffer-use"></a><h3>gst_gl_framebuffer_use ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_framebuffer_use (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer"><span class="type">GstGLFramebuffer</span></a> *frame</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_width</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_height</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> fbo</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> depth_buffer</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> texture_fbo</code></em>,
-                        <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Utilities.html#GLCB:CAPS" title="GLCB ()"><span class="type">GLCB</span></a> cb</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> input_tex_width</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> input_tex_height</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> input_tex</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param1</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param2</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param3</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param4</code></em>,
-                        <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Utilities.html#GstGLDisplayProjection" title="enum GstGLDisplayProjection"><span class="type">GstGLDisplayProjection</span></a> projection</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> stuff</code></em>);</pre>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-gl-framebuffer-use-v2"></a><h3>gst_gl_framebuffer_use_v2 ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_framebuffer_use_v2 (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer" title="struct GstGLFramebuffer"><span class="type">GstGLFramebuffer</span></a> *frame</code></em>,
-                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_width</code></em>,
-                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_height</code></em>,
-                           <em class="parameter"><code><span class="type">GLuint</span> fbo</code></em>,
-                           <em class="parameter"><code><span class="type">GLuint</span> depth_buffer</code></em>,
-                           <em class="parameter"><code><span class="type">GLuint</span> texture_fbo</code></em>,
-                           <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Utilities.html#GLCB-V2:CAPS" title="GLCB_V2 ()"><span class="type">GLCB_V2</span></a> cb</code></em>,
-                           <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> stuff</code></em>);</pre>
-</div>
-</div>
-<div class="refsect1">
-<a name="gst-plugins-bad-libs-GstGLFramebuffer.other_details"></a><h2>Types and Values</h2>
-<div class="refsect2">
-<a name="GstGLFramebuffer"></a><h3>struct GstGLFramebuffer</h3>
-<pre class="programlisting">struct GstGLFramebuffer {
-  GObject             object;
-};
-</pre>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstGLFramebufferClass"></a><h3>struct GstGLFramebufferClass</h3>
-<pre class="programlisting">struct GstGLFramebufferClass {
-  GObjectClass object_class;
-};
-</pre>
-</div>
-</div>
-</div>
-<div class="footer">
-<hr>
-          Generated by GTK-Doc V1.21</div>
-</body>
-</html>
\ No newline at end of file
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLSyncMeta.html b/docs/libs/html/gst-plugins-bad-libs-GstGLSyncMeta.html
new file mode 100644
index 0000000..0ab2d43
--- /dev/null
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLSyncMeta.html
@@ -0,0 +1,173 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Library Reference Manual: GstGLSyncMeta</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
+<link rel="up" href="gl.html" title="OpenGL Helper Library">
+<link rel="prev" href="gst-plugins-bad-libs-gstglshader.html" title="GstGLShader">
+<link rel="next" href="GstGLUpload.html" title="GstGLUpload">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-libs-GstGLSyncMeta.description" class="shortcut">Description</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-libs-gstglshader.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="GstGLUpload.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-libs-GstGLSyncMeta"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-libs-GstGLSyncMeta.top_of_page"></a>GstGLSyncMeta</span></h2>
+<p>GstGLSyncMeta</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLSyncMeta.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta" title="struct GstGLSyncMeta"><span class="returnvalue">GstGLSyncMeta</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-add-gl-sync-meta" title="gst_buffer_add_gl_sync_meta ()">gst_buffer_add_gl_sync_meta</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-get-gl-sync-meta" title="gst_buffer_get_gl_sync_meta()">gst_buffer_get_gl_sync_meta</a><span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#GType"><span class="returnvalue">GType</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-api-get-type" title="gst_gl_sync_meta_api_get_type ()">gst_gl_sync_meta_api_get_type</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">const <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMeta.html#GstMetaInfo"><span class="returnvalue">GstMetaInfo</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-get-info" title="gst_gl_sync_meta_get_info ()">gst_gl_sync_meta_get_info</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-set-sync-point" title="gst_gl_sync_meta_set_sync_point ()">gst_gl_sync_meta_set_sync_point</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-wait" title="gst_gl_sync_meta_wait ()">gst_gl_sync_meta_wait</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLSyncMeta.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta" title="struct GstGLSyncMeta">GstGLSyncMeta</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GST-BUFFER-POOL-OPTION-GL-SYNC-META:CAPS" title="GST_BUFFER_POOL_OPTION_GL_SYNC_META">GST_BUFFER_POOL_OPTION_GL_SYNC_META</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLSyncMeta.description"></a><h2>Description</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLSyncMeta.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="gst-buffer-add-gl-sync-meta"></a><h3>gst_buffer_add_gl_sync_meta ()</h3>
+<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta" title="struct GstGLSyncMeta"><span class="returnvalue">GstGLSyncMeta</span></a> *
+gst_buffer_add_gl_sync_meta (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                             <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *buffer</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-buffer-get-gl-sync-meta"></a><h3>gst_buffer_get_gl_sync_meta()</h3>
+<pre class="programlisting">#define gst_buffer_get_gl_sync_meta(b) ((GstGLSyncMeta*)gst_buffer_get_meta((b),GST_GL_SYNC_META_API_TYPE))
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-sync-meta-api-get-type"></a><h3>gst_gl_sync_meta_api_get_type ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#GType"><span class="returnvalue">GType</span></a>
+gst_gl_sync_meta_api_get_type (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-sync-meta-get-info"></a><h3>gst_gl_sync_meta_get_info ()</h3>
+<pre class="programlisting">const <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMeta.html#GstMetaInfo"><span class="returnvalue">GstMetaInfo</span></a> *
+gst_gl_sync_meta_get_info (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-sync-meta-set-sync-point"></a><h3>gst_gl_sync_meta_set_sync_point ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_sync_meta_set_sync_point (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta" title="struct GstGLSyncMeta"><span class="type">GstGLSyncMeta</span></a> *sync</code></em>,
+                                 <em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-sync-meta-wait"></a><h3>gst_gl_sync_meta_wait ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_gl_sync_meta_wait (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta" title="struct GstGLSyncMeta"><span class="type">GstGLSyncMeta</span></a> *sync</code></em>,
+                       <em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>);</pre>
+</div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstGLSyncMeta.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstGLSyncMeta"></a><h3>struct GstGLSyncMeta</h3>
+<pre class="programlisting">struct GstGLSyncMeta {
+};
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-BUFFER-POOL-OPTION-GL-SYNC-META:CAPS"></a><h3>GST_BUFFER_POOL_OPTION_GL_SYNC_META</h3>
+<pre class="programlisting">#define GST_BUFFER_POOL_OPTION_GL_SYNC_META "GstBufferPoolOptionGLSyncMeta"
+</pre>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLWindowCocoa.html b/docs/libs/html/gst-plugins-bad-libs-GstGLWindowCocoa.html
index dea1162..62ff5ef 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLWindowCocoa.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLWindowCocoa.html
@@ -91,8 +91,7 @@
 <div class="refsect2">
 <a name="gst-gl-window-cocoa-create-window"></a><h3>gst_gl_window_cocoa_create_window ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_window_cocoa_create_window (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLWindowCocoa.html#GstGLWindowCocoa" title="struct GstGLWindowCocoa"><span class="type">GstGLWindowCocoa</span></a> *window_cocoa</code></em>,
-                                   <em class="parameter"><code><span class="type">NSRect</span> rect</code></em>);</pre>
+gst_gl_window_cocoa_create_window (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstGLWindowCocoa.html#GstGLWindowCocoa" title="struct GstGLWindowCocoa"><span class="type">GstGLWindowCocoa</span></a> *window_cocoa</code></em>);</pre>
 </div>
 </div>
 <div class="refsect1">
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstGLWindowX11.html b/docs/libs/html/gst-plugins-bad-libs-GstGLWindowX11.html
index 900be0b..970ea70 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstGLWindowX11.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstGLWindowX11.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
 <link rel="prev" href="gst-plugins-bad-libs-GstGLWindowWin32.html" title="GstGLWindowWin32">
-<link rel="next" href="gstreamer-libs-hierarchy.html" title="Part II. Object Hierarchy">
+<link rel="next" href="ch07.html" title="Interfaces">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -20,7 +20,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-libs-GstGLWindowWin32.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gstreamer-libs-hierarchy.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="ch07.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-libs-GstGLWindowX11"></a><div class="titlepage"></div>
@@ -123,7 +123,7 @@
 gst_gl_window_x11_untrap_x_errors (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
 <p>Removes the X error trap and returns the current status.</p>
 <div class="refsect3">
-<a name="id-1.2.9.26.6.5.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.29.6.5.5"></a><h4>Returns</h4>
 <p> the trapped error code, or 0 for success</p>
 <p></p>
 </div>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstInsertbin.html b/docs/libs/html/gst-plugins-bad-libs-GstInsertbin.html
index 0a58f20..cf2c31a 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstInsertbin.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstInsertbin.html
@@ -505,7 +505,7 @@
 user_function (<a class="link" href="gst-plugins-bad-libs-GstInsertbin.html#GstInsertBin"><span class="type">GstInsertBin</span></a> *element,
                <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>   *callback,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data,
-               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      arg3,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data2,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)</pre>
 <p>This action signal adds the filter like element after any other element
 in the bin.</p>
@@ -536,6 +536,11 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
+<td class="parameter_name"><p>user_data2</p></td>
+<td class="parameter_description"><p>The user data of the signal (ignored)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
 <td class="parameter_name"><p>user_data</p></td>
 <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
 <td class="parameter_annotations"> </td>
@@ -553,7 +558,7 @@
                <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>   *sibling,
                <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>   *callback,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data,
-               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      arg4,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data2,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)</pre>
 <p>This action signal adds the filter like element after the <em class="parameter"><code>sibling</code></em>
 
@@ -592,6 +597,11 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
+<td class="parameter_name"><p>user_data2</p></td>
+<td class="parameter_description"><p>The user data of the signal (ignored)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
 <td class="parameter_name"><p>user_data</p></td>
 <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
 <td class="parameter_annotations"> </td>
@@ -609,7 +619,7 @@
                <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>   *sibling,
                <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>   *callback,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data,
-               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      arg4,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data2,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)</pre>
 <p>This action signal adds the filter like element before the <em class="parameter"><code>sibling</code></em>
 
@@ -647,6 +657,11 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
+<td class="parameter_name"><p>user_data2</p></td>
+<td class="parameter_description"><p>The user data of the signal (ignored)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
 <td class="parameter_name"><p>user_data</p></td>
 <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
 <td class="parameter_annotations"> </td>
@@ -663,7 +678,7 @@
 user_function (<a class="link" href="gst-plugins-bad-libs-GstInsertbin.html#GstInsertBin"><span class="type">GstInsertBin</span></a> *element,
                <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>   *callback,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data,
-               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      arg3,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data2,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)</pre>
 <p>This action signal adds the filter like element before any other element
 in the bin.</p>
@@ -694,6 +709,11 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
+<td class="parameter_name"><p>user_data2</p></td>
+<td class="parameter_description"><p>The user data of the signal (ignored)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
 <td class="parameter_name"><p>user_data</p></td>
 <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
 <td class="parameter_annotations"> </td>
@@ -710,7 +730,7 @@
 user_function (<a class="link" href="gst-plugins-bad-libs-GstInsertbin.html#GstInsertBin"><span class="type">GstInsertBin</span></a> *element,
                <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>   *callback,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data,
-               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      arg3,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data2,
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>      user_data)</pre>
 <p>This action signal removed the filter like element from the bin.</p>
 <p>Same as <a class="link" href="gst-plugins-bad-libs-GstInsertbin.html#gst-insert-bin-remove" title="gst_insert_bin_remove ()"><code class="function">gst_insert_bin_remove()</code></a></p>
@@ -740,6 +760,11 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
+<td class="parameter_name"><p>user_data2</p></td>
+<td class="parameter_description"><p>The user data of the signal (ignored)</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
 <td class="parameter_name"><p>user_data</p></td>
 <td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
 <td class="parameter_annotations"> </td>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstPhotography.html b/docs/libs/html/gst-plugins-bad-libs-GstPhotography.html
new file mode 100644
index 0000000..5dab020
--- /dev/null
+++ b/docs/libs/html/gst-plugins-bad-libs-GstPhotography.html
@@ -0,0 +1,2430 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Library Reference Manual: GstPhotography</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
+<link rel="up" href="ch07.html" title="Interfaces">
+<link rel="prev" href="ch07.html" title="Interfaces">
+<link rel="next" href="gstreamer-libs-hierarchy.html" title="Part II. Object Hierarchy">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-libs-GstPhotography.description" class="shortcut">Description</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch07.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="ch07.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gstreamer-libs-hierarchy.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-libs-GstPhotography"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-libs-GstPhotography.top_of_page"></a>GstPhotography</span></h2>
+<p>GstPhotography — Interface for digital image capture elements</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstPhotography.stability-level"></a><h2>Stability Level</h2>
+<acronym title="Unstable interfaces are experimental or transitional. They are typically used to
+give outside developers early access to new or rapidly changing technology, or
+to provide an interim solution to a problem where a more general solution is
+anticipated. No claims are made about either source or binary compatibility from
+one minor release to the next.
+
+The Unstable interface level is a warning that these interfaces are  subject to
+change without warning and should not be used in unbundled products.
+
+Given such caveats, customer impact need not be a factor when considering
+incompatible changes to an Unstable interface in a major or minor release.
+Nonetheless, when such changes are introduced, the changes should still be
+mentioned in the release notes for the affected release.
+"><span class="acronym">Unstable</span></acronym>, unless otherwise indicated
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstPhotography.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<span class="c_punctuation">(</span><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCapturePrepared" title="GstPhotographyCapturePrepared ()">*GstPhotographyCapturePrepared</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-ev-compensation" title="gst_photography_get_ev_compensation ()">gst_photography_get_ev_compensation</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-iso-speed" title="gst_photography_get_iso_speed ()">gst_photography_get_iso_speed</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-aperture" title="gst_photography_get_aperture ()">gst_photography_get_aperture</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-exposure" title="gst_photography_get_exposure ()">gst_photography_get_exposure</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-white-balance-mode" title="gst_photography_get_white_balance_mode ()">gst_photography_get_white_balance_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-color-tone-mode" title="gst_photography_get_color_tone_mode ()">gst_photography_get_color_tone_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-scene-mode" title="gst_photography_get_scene_mode ()">gst_photography_get_scene_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flash-mode" title="gst_photography_get_flash_mode ()">gst_photography_get_flash_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flicker-mode" title="gst_photography_get_flicker_mode ()">gst_photography_get_flicker_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-focus-mode" title="gst_photography_get_focus_mode ()">gst_photography_get_focus_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-noise-reduction" title="gst_photography_get_noise_reduction ()">gst_photography_get_noise_reduction</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-zoom" title="gst_photography_get_zoom ()">gst_photography_get_zoom</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-ev-compensation" title="gst_photography_set_ev_compensation ()">gst_photography_set_ev_compensation</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-iso-speed" title="gst_photography_set_iso_speed ()">gst_photography_set_iso_speed</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-aperture" title="gst_photography_set_aperture ()">gst_photography_set_aperture</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-exposure" title="gst_photography_set_exposure ()">gst_photography_set_exposure</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-white-balance-mode" title="gst_photography_set_white_balance_mode ()">gst_photography_set_white_balance_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-color-tone-mode" title="gst_photography_set_color_tone_mode ()">gst_photography_set_color_tone_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-scene-mode" title="gst_photography_set_scene_mode ()">gst_photography_set_scene_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flash-mode" title="gst_photography_set_flash_mode ()">gst_photography_set_flash_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flicker-mode" title="gst_photography_set_flicker_mode ()">gst_photography_set_flicker_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-focus-mode" title="gst_photography_set_focus_mode ()">gst_photography_set_focus_mode</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-noise-reduction" title="gst_photography_set_noise_reduction ()">gst_photography_set_noise_reduction</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-zoom" title="gst_photography_set_zoom ()">gst_photography_set_zoom</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps"><span class="returnvalue">GstPhotographyCaps</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-capabilities" title="gst_photography_get_capabilities ()">gst_photography_get_capabilities</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-prepare-for-capture" title="gst_photography_prepare_for_capture ()">gst_photography_prepare_for_capture</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-autofocus" title="gst_photography_set_autofocus ()">gst_photography_set_autofocus</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-config" title="gst_photography_set_config ()">gst_photography_set_config</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-config" title="gst_photography_get_config ()">gst_photography_get_config</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstPhotography.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody>
+<tr>
+<td class="datatype_keyword"> </td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography">GstPhotography</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction">GstPhotographyNoiseReduction</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode">GstPhotographyWhiteBalanceMode</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode">GstPhotographyColorToneMode</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode">GstPhotographySceneMode</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode">GstPhotographyFlashMode</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlickerReductionMode" title="enum GstPhotographyFlickerReductionMode">GstPhotographyFlickerReductionMode</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusMode" title="enum GstPhotographyFocusMode">GstPhotographyFocusMode</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusStatus" title="enum GstPhotographyFocusStatus">GstPhotographyFocusStatus</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps">GstPhotographyCaps</a></td>
+</tr>
+<tr>
+<td class="datatype_keyword">enum</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyShakeRisk" title="enum GstPhotographyShakeRisk">GstPhotographyShakeRisk</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS" title="GST_PHOTOGRAPHY_AUTOFOCUS_DONE">GST_PHOTOGRAPHY_AUTOFOCUS_DONE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS" title="GST_PHOTOGRAPHY_SHAKE_RISK">GST_PHOTOGRAPHY_SHAKE_RISK</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-WB-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_WB_MODE">GST_PHOTOGRAPHY_PROP_WB_MODE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SCENE-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_SCENE_MODE">GST_PHOTOGRAPHY_PROP_SCENE_MODE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLASH-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_FLASH_MODE">GST_PHOTOGRAPHY_PROP_FLASH_MODE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-NOISE-REDUCTION:CAPS" title="GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION">GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-STATUS:CAPS" title="GST_PHOTOGRAPHY_PROP_FOCUS_STATUS">GST_PHOTOGRAPHY_PROP_FOCUS_STATUS</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-CAPABILITIES:CAPS" title="GST_PHOTOGRAPHY_PROP_CAPABILITIES">GST_PHOTOGRAPHY_PROP_CAPABILITIES</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SHAKE-RISK:CAPS" title="GST_PHOTOGRAPHY_PROP_SHAKE_RISK">GST_PHOTOGRAPHY_PROP_SHAKE_RISK</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-EV-COMP:CAPS" title="GST_PHOTOGRAPHY_PROP_EV_COMP">GST_PHOTOGRAPHY_PROP_EV_COMP</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ISO-SPEED:CAPS" title="GST_PHOTOGRAPHY_PROP_ISO_SPEED">GST_PHOTOGRAPHY_PROP_ISO_SPEED</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-APERTURE:CAPS" title="GST_PHOTOGRAPHY_PROP_APERTURE">GST_PHOTOGRAPHY_PROP_APERTURE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-CAPTURE-SUPPORTED-CAPS" title="GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS">GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-PREVIEW-SUPPORTED-CAPS" title="GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS">GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLICKER-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_FLICKER_MODE">GST_PHOTOGRAPHY_PROP_FLICKER_MODE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-MODE:CAPS" title="GST_PHOTOGRAPHY_PROP_FOCUS_MODE">GST_PHOTOGRAPHY_PROP_FOCUS_MODE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ZOOM:CAPS" title="GST_PHOTOGRAPHY_PROP_ZOOM">GST_PHOTOGRAPHY_PROP_ZOOM</a></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstPhotography.description"></a><h2>Description</h2>
+<p>The interface allows access to some common digital image capture parameters.</p>
+<div class="note">
+  The GstPhotography interface is unstable API and may change in future.
+  One can define GST_USE_UNSTABLE_API to acknowledge and avoid this warning.
+</div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstPhotography.functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="GstPhotographyCapturePrepared"></a><h3>GstPhotographyCapturePrepared ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+<span class="c_punctuation">(</span>*GstPhotographyCapturePrepared<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>,
+                                  <em class="parameter"><code>const <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *configured_caps</code></em>);</pre>
+<p>This callback will be called when the element has finished preparations
+and is ready for image capture. The next buffer that element produces
+will be of <em class="parameter"><code>configured_caps</code></em>
+ format, so this callback allows the application
+to e.g. reconfigure capsfilters in pipeline if any.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.2.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>data</p></td>
+<td class="parameter_description"><p>user data that has been given, when registering the callback</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>configured_caps</p></td>
+<td class="parameter_description"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> defining the configured capture format.
+Ownership of these caps stays in the element.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-ev-compensation"></a><h3>gst_photography_get_ev_compensation ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_ev_compensation (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> *ev_comp</code></em>);</pre>
+<p>Get the ev compensation value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.3.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ev_comp</p></td>
+<td class="parameter_description"><p>ev compensation value to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.3.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-iso-speed"></a><h3>gst_photography_get_iso_speed ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_iso_speed (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *iso_speed</code></em>);</pre>
+<p>Get the ISO value (light sensivity) for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.4.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>iso_speed</p></td>
+<td class="parameter_description"><p>ISO speed value to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.4.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-aperture"></a><h3>gst_photography_get_aperture ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_aperture (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                              <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *aperture</code></em>);</pre>
+<p>Get the aperture value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.5.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>aperture</p></td>
+<td class="parameter_description"><p>aperture value to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.5.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-exposure"></a><h3>gst_photography_get_exposure ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_exposure (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                              <em class="parameter"><code><span class="type">guint32</span> *exposure</code></em>);</pre>
+<p>Get the fixed exposure time (in us) for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.6.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>exposure</p></td>
+<td class="parameter_description"><p>exposure time to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.6.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-white-balance-mode"></a><h3>gst_photography_get_white_balance_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_white_balance_mode
+                               (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a> *wb_mode</code></em>);</pre>
+<p>Get the white balance mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.7.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>wb_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a> to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.7.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-color-tone-mode"></a><h3>gst_photography_get_color_tone_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_color_tone_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                     <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a> *tone_mode</code></em>);</pre>
+<p>Get the color tone mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.8.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>tone_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a> to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.8.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-scene-mode"></a><h3>gst_photography_get_scene_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_scene_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a> *scene_mode</code></em>);</pre>
+<p>Get the scene mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.9.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>scene_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a> to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.9.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-flash-mode"></a><h3>gst_photography_get_flash_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_flash_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a> *flash_mode</code></em>);</pre>
+<p>Get the flash mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.10.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>flash_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a> to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.10.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-flicker-mode"></a><h3>gst_photography_get_flicker_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_flicker_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                  <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlickerReductionMode" title="enum GstPhotographyFlickerReductionMode"><span class="type">GstPhotographyFlickerReductionMode</span></a> *mode</code></em>);</pre>
+<p>Get the flicker mode value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.11.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>flicker_mode</p></td>
+<td class="parameter_description"><p>flicker mode value to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.11.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-focus-mode"></a><h3>gst_photography_get_focus_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_focus_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusMode" title="enum GstPhotographyFocusMode"><span class="type">GstPhotographyFocusMode</span></a> *mode</code></em>);</pre>
+<p>Get the focus mode value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.12.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>focus_mode</p></td>
+<td class="parameter_description"><p>focus_mode value to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.12.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-noise-reduction"></a><h3>gst_photography_get_noise_reduction ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_noise_reduction (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                     <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction"><span class="type">GstPhotographyNoiseReduction</span></a> *noise_reduction</code></em>);</pre>
+<p>Get the noise reduction mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.13.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>noise_reduction</p></td>
+<td class="parameter_description"><p><span class="type">GstPhotographyNoiseReductionMode</span> to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.13.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+<p class="since">Since 0.10.21</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-zoom"></a><h3>gst_photography_get_zoom ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_zoom (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> *zoom</code></em>);</pre>
+<p>Get the zoom value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.14.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>zoom</p></td>
+<td class="parameter_description"><p>zoom value to get</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.14.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if getting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-ev-compensation"></a><h3>gst_photography_set_ev_compensation ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_ev_compensation (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> ev_comp</code></em>);</pre>
+<p>Set the ev compensation value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.15.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>ev_comp</p></td>
+<td class="parameter_description"><p>ev compensation value to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.15.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-iso-speed"></a><h3>gst_photography_set_iso_speed ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_iso_speed (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> iso_speed</code></em>);</pre>
+<p>Set the ISO value (light sensivity) for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.16.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>iso_speed</p></td>
+<td class="parameter_description"><p>ISO speed value to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.16.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-aperture"></a><h3>gst_photography_set_aperture ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_aperture (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                              <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> aperture</code></em>);</pre>
+<p>Set the aperture value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.17.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>aperture</p></td>
+<td class="parameter_description"><p>aperture value to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.17.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-exposure"></a><h3>gst_photography_set_exposure ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_exposure (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                              <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> exposure</code></em>);</pre>
+<p>Set the fixed exposure time (in us) for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.18.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>exposure</p></td>
+<td class="parameter_description"><p>exposure time to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.18.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-white-balance-mode"></a><h3>gst_photography_set_white_balance_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_white_balance_mode
+                               (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a> wb_mode</code></em>);</pre>
+<p>Set the white balance mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.19.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>wb_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a> to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.19.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-color-tone-mode"></a><h3>gst_photography_set_color_tone_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_color_tone_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                     <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a> tone_mode</code></em>);</pre>
+<p>Set the color tone mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.20.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>tone_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a> to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.20.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-scene-mode"></a><h3>gst_photography_set_scene_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_scene_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a> scene_mode</code></em>);</pre>
+<p>Set the scene mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.21.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>scene_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a> to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.21.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-flash-mode"></a><h3>gst_photography_set_flash_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_flash_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a> flash_mode</code></em>);</pre>
+<p>Set the flash mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.22.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>flash_mode</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a> to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.22.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-flicker-mode"></a><h3>gst_photography_set_flicker_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_flicker_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                  <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlickerReductionMode" title="enum GstPhotographyFlickerReductionMode"><span class="type">GstPhotographyFlickerReductionMode</span></a> mode</code></em>);</pre>
+<p>Set the flicker mode value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.23.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>flicker_mode</p></td>
+<td class="parameter_description"><p>flicker mode value to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.23.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-focus-mode"></a><h3>gst_photography_set_focus_mode ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_focus_mode (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusMode" title="enum GstPhotographyFocusMode"><span class="type">GstPhotographyFocusMode</span></a> mode</code></em>);</pre>
+<p>Set the focus mode value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.24.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>focus_mode</p></td>
+<td class="parameter_description"><p>focus mode value to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.24.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-noise-reduction"></a><h3>gst_photography_set_noise_reduction ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_noise_reduction (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                     <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction"><span class="type">GstPhotographyNoiseReduction</span></a> noise_reduction</code></em>);</pre>
+<p>Set the noise reduction mode for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.25.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>noise_reduction</p></td>
+<td class="parameter_description"><p><span class="type">GstPhotographyNoiseReductionMode</span> to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.25.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+<p class="since">Since 0.10.21</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-zoom"></a><h3>gst_photography_set_zoom ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_zoom (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> zoom</code></em>);</pre>
+<p>Set the zoom value for the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a>.
+E.g. 1.0 to get original image and 3.0 for 3x zoom and so on.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.26.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>zoom</p></td>
+<td class="parameter_description"><p>zoom value to set</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.26.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if setting the value succeeded, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-capabilities"></a><h3>gst_photography_get_capabilities ()</h3>
+<pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps"><span class="returnvalue">GstPhotographyCaps</span></a>
+gst_photography_get_capabilities (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>);</pre>
+<p>Get <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps"><span class="type">GstPhotographyCaps</span></a> bitmask value that indicates what photography
+interface features the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a> supports</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.27.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody><tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.27.6"></a><h4>Returns</h4>
+<p> <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps"><span class="type">GstPhotographyCaps</span></a> value</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-prepare-for-capture"></a><h3>gst_photography_prepare_for_capture ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_prepare_for_capture (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                                     <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCapturePrepared" title="GstPhotographyCapturePrepared ()"><span class="type">GstPhotographyCapturePrepared</span></a> func</code></em>,
+                                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *capture_caps</code></em>,
+                                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
+<p>Start preparations for capture. Preparations can take indeterminate
+amount of time and <em class="parameter"><code>func</code></em>
+ callback is called after preparations are
+done. Image capture will begin after callback returns.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.28.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>func</p></td>
+<td class="parameter_description"><p>callback that is called after capturing has been prepared</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>capture_caps</p></td>
+<td class="parameter_description"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> defining the desired format of the captured image</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>user data that will be passed to the callback <em class="parameter"><code>func</code></em>
+</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.28.6"></a><h4>Returns</h4>
+<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if preparations were started (caps were OK), otherwise <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-autofocus"></a><h3>gst_photography_set_autofocus ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+gst_photography_set_autofocus (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> on</code></em>);</pre>
+<p>Start or stop autofocusing. <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS" title="GST_PHOTOGRAPHY_AUTOFOCUS_DONE"><code class="literal">GST_PHOTOGRAPHY_AUTOFOCUS_DONE</code></a>
+message is posted to bus when autofocusing has finished.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.29.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>on</p></td>
+<td class="parameter_description"><p><a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to start autofocusing, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> to stop autofocusing</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-set-config"></a><h3>gst_photography_set_config ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_set_config (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                            <em class="parameter"><code><span class="type">GstPhotographySettings</span> *config</code></em>);</pre>
+<p>Set all configuration settings at once.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.30.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>config</p></td>
+<td class="parameter_description"><p><span class="type">GstPhotographySettings</span> containg the configuration</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.30.6"></a><h4>Returns</h4>
+<p> TRUE if configuration was set successfully, otherwise FALSE.</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-photography-get-config"></a><h3>gst_photography_get_config ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_photography_get_config (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
+                            <em class="parameter"><code><span class="type">GstPhotographySettings</span> *config</code></em>);</pre>
+<p>Get all configuration settings at once.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.31.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>photo</p></td>
+<td class="parameter_description"><p><a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>config</p></td>
+<td class="parameter_description"><p><span class="type">GstPhotographySettings</span> containg the configuration</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.10.2.7.31.6"></a><h4>Returns</h4>
+<p> TRUE if configuration was got successfully, otherwise FALSE.</p>
+<p></p>
+</div>
+</div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-libs-GstPhotography.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstPhotography"></a><h3>GstPhotography</h3>
+<pre class="programlisting">typedef struct _GstPhotography GstPhotography;</pre>
+<p>Opaque <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> data structure.</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyNoiseReduction"></a><h3>enum GstPhotographyNoiseReduction</h3>
+<p>Noise Reduction features of a photography capture or filter element.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.3.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-BAYER:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_BAYER</p></td>
+<td class="enum_member_description">
+<p>Adaptive noise reduction on Bayer
+format</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-YCC:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_YCC</p></td>
+<td class="enum_member_description">
+<p>reduces the noise on Y and 2-chroma
+images.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-TEMPORAL:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_TEMPORAL</p></td>
+<td class="enum_member_description">
+<p>Multi-frame adaptive NR,
+provided for the video mode</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-FIXED:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_FIXED</p></td>
+<td class="enum_member_description">
+<p>Fixed Pattern Noise refers to noise
+that does not change between frames. The noise is removed from the sensor
+image, by subtracting a previously-captured black image in memory.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-EXTRA:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_EXTRA</p></td>
+<td class="enum_member_description">
+<p>Extra Noise Reduction. In the case
+of high-ISO capturing, some noise remains after YCC NR. XNR reduces this
+remaining noise.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p class="since">Since 0.10.21</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyWhiteBalanceMode"></a><h3>enum GstPhotographyWhiteBalanceMode</h3>
+<p>Modes for white balance control.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.4.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_AUTO</p></td>
+<td class="enum_member_description">
+<p>Choose white balance mode automatically</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-DAYLIGHT:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT</p></td>
+<td class="enum_member_description">
+<p>Mode for daylight conditions</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-CLOUDY:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_CLOUDY</p></td>
+<td class="enum_member_description">
+<p>Mode for cloudy conditions</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-SUNSET:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_SUNSET</p></td>
+<td class="enum_member_description">
+<p>Mode for sunset conditions</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-TUNGSTEN:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN</p></td>
+<td class="enum_member_description">
+<p>Mode for tungsten lighting</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-FLUORESCENT:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT</p></td>
+<td class="enum_member_description">
+<p>Mode for fluorescent lighting</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-MANUAL:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_MANUAL</p></td>
+<td class="enum_member_description">
+<p>Disable automatic white balance adjustment
+and keep current values.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-WARM-FLUORESCENT:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_WARM_FLUORESCENT</p></td>
+<td class="enum_member_description">
+<p>Mode for warm fluorescent lighting (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-SHADE:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_SHADE</p></td>
+<td class="enum_member_description">
+<p>Mode for shade lighting (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyColorToneMode"></a><h3>enum GstPhotographyColorToneMode</h3>
+<p>Modes for special color effects.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.5.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-NORMAL:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL</p></td>
+<td class="enum_member_description">
+<p>No effects</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SEPIA:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA</p></td>
+<td class="enum_member_description">
+<p>Sepia</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-NEGATIVE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE</p></td>
+<td class="enum_member_description">
+<p>Negative</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-GRAYSCALE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE</p></td>
+<td class="enum_member_description">
+<p>Grayscale</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-NATURAL:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_NATURAL</p></td>
+<td class="enum_member_description">
+<p>Natural</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-VIVID:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_VIVID</p></td>
+<td class="enum_member_description">
+<p>Vivid</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-COLORSWAP:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_COLORSWAP</p></td>
+<td class="enum_member_description">
+<p>Colorswap</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SOLARIZE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE</p></td>
+<td class="enum_member_description">
+<p>Solarize</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-OUT-OF-FOCUS:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_OUT_OF_FOCUS</p></td>
+<td class="enum_member_description">
+<p>Out of focus</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SKY-BLUE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKY_BLUE</p></td>
+<td class="enum_member_description">
+<p>Sky blue</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-GRASS-GREEN:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRASS_GREEN</p></td>
+<td class="enum_member_description">
+<p>Grass green</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SKIN-WHITEN:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKIN_WHITEN</p></td>
+<td class="enum_member_description">
+<p>Skin whiten</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-POSTERIZE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE</p></td>
+<td class="enum_member_description">
+<p>Posterize (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-WHITEBOARD:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD</p></td>
+<td class="enum_member_description">
+<p>Whiteboard (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-BLACKBOARD:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD</p></td>
+<td class="enum_member_description">
+<p>Blackboard (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-AQUA:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA</p></td>
+<td class="enum_member_description">
+<p>Aqua (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographySceneMode"></a><h3>enum GstPhotographySceneMode</h3>
+<p>Each mode contains preset <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> options in order to produce
+good capturing result in certain scene.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.6.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-MANUAL:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_MANUAL</p></td>
+<td class="enum_member_description">
+<p>Set individual options manually</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-CLOSEUP:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP</p></td>
+<td class="enum_member_description">
+<p>Mode for close objects</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-PORTRAIT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT</p></td>
+<td class="enum_member_description">
+<p>Mode for portraits</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-LANDSCAPE:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE</p></td>
+<td class="enum_member_description">
+<p>Mode for landscapes</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-SPORT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_SPORT</p></td>
+<td class="enum_member_description">
+<p>Mode for scene with fast motion</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-NIGHT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_NIGHT</p></td>
+<td class="enum_member_description">
+<p>Mode for night conditions</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_AUTO</p></td>
+<td class="enum_member_description">
+<p>Choose scene mode automatically</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-ACTION:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_ACTION</p></td>
+<td class="enum_member_description">
+<p>Take photos of fast moving
+    objects (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-NIGHT-PORTRAIT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT</p></td>
+<td class="enum_member_description">
+<p>Take people pictures
+    at night (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-THEATRE:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_THEATRE</p></td>
+<td class="enum_member_description">
+<p>Take photos in a theater (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-BEACH:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_BEACH</p></td>
+<td class="enum_member_description">
+<p>Take pictures on the beach (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-SNOW:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_SNOW</p></td>
+<td class="enum_member_description">
+<p>Take pictures on the snow (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-SUNSET:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_SUNSET</p></td>
+<td class="enum_member_description">
+<p>Take sunset photos (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-STEADY-PHOTO:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO</p></td>
+<td class="enum_member_description">
+<p>Avoid blurry pictures
+    (for example, due to hand shake) (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-FIREWORKS:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS</p></td>
+<td class="enum_member_description">
+<p>For shooting firework
+    displays (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-PARTY:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_PARTY</p></td>
+<td class="enum_member_description">
+<p>Take indoor low-light shot (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-CANDLELIGHT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT</p></td>
+<td class="enum_member_description">
+<p>Capture the naturally warm color
+    of scenes lit by candles (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-BARCODE:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_BARCODE</p></td>
+<td class="enum_member_description">
+<p>Applications are looking for
+    a barcode (Since 1.2)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyFlashMode"></a><h3>enum GstPhotographyFlashMode</h3>
+<p>Modes for flash control.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.7.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_AUTO</p></td>
+<td class="enum_member_description">
+<p>Fire flash automatically according to
+lighting conditions.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-OFF:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_OFF</p></td>
+<td class="enum_member_description">
+<p>Never fire flash</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-ON:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_ON</p></td>
+<td class="enum_member_description">
+<p>Always fire flash</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-FILL-IN:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN</p></td>
+<td class="enum_member_description">
+<p>Fill in flash</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-RED-EYE:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE</p></td>
+<td class="enum_member_description">
+<p>Flash mode for reducing chance of
+capturing red eyes</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyFlickerReductionMode"></a><h3>enum GstPhotographyFlickerReductionMode</h3>
+<p>Reduce flicker in video caused by light source fluctuation.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.8.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-OFF:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF</p></td>
+<td class="enum_member_description">
+<p>Disable flicker reduction</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-50HZ:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_50HZ</p></td>
+<td class="enum_member_description">
+<p>50Hz flicker reduction</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-60HZ:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_60HZ</p></td>
+<td class="enum_member_description">
+<p>60Hz flicker reduction</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-AUTO:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_AUTO</p></td>
+<td class="enum_member_description">
+<p>Choose mode automatically</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyFocusMode"></a><h3>enum GstPhotographyFocusMode</h3>
+<p>Choose mode for focusing algorithm.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.9.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_AUTO</p></td>
+<td class="enum_member_description">
+<p>Choose focus mode automatically</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-MACRO:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_MACRO</p></td>
+<td class="enum_member_description">
+<p>Mode for focusing objects close to lens</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-PORTRAIT:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_PORTRAIT</p></td>
+<td class="enum_member_description">
+<p>Mode for portraits</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-INFINITY:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY</p></td>
+<td class="enum_member_description">
+<p>Mode for landscapes and far away objects</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-HYPERFOCAL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL</p></td>
+<td class="enum_member_description">
+<p>Mode for maximum depth of field, keeping
+focus acceptable both in infinify and as close objects as possible</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-EXTENDED:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED</p></td>
+<td class="enum_member_description">
+<p>Extended focus mode</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-CONTINUOUS-NORMAL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL</p></td>
+<td class="enum_member_description">
+<p>Continuous autofocus mode</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-CONTINUOUS-EXTENDED:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED</p></td>
+<td class="enum_member_description">
+<p>Extended continuous
+autofocus mode</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-MANUAL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL</p></td>
+<td class="enum_member_description">
+<p>Disable automatic focusing
+and keep current value. <span class="type">“lens-focus”</span> property can
+be used to change focus manually.</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyFocusStatus"></a><h3>enum GstPhotographyFocusStatus</h3>
+<p>Status of the focusing operation, used in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS" title="GST_PHOTOGRAPHY_AUTOFOCUS_DONE"><span class="type">GST_PHOTOGRAPHY_AUTOFOCUS_DONE</span></a>
+message.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.10.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-NONE:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_NONE</p></td>
+<td class="enum_member_description">
+<p>No status available</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-RUNNING:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING</p></td>
+<td class="enum_member_description">
+<p>Focusing is ongoing</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-FAIL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL</p></td>
+<td class="enum_member_description">
+<p>Focusing failed</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-SUCCESS:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS</p></td>
+<td class="enum_member_description">
+<p>Focusing succeeded</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyCaps"></a><h3>enum GstPhotographyCaps</h3>
+<p>Bitmask that indicates which <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotography" title="GstPhotography"><span class="type">GstPhotography</span></a> interface features an instance
+supports.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.11.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-NONE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_NONE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-EV-COMP:CAPS"></a>GST_PHOTOGRAPHY_CAPS_EV_COMP</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-ISO-SPEED:CAPS"></a>GST_PHOTOGRAPHY_CAPS_ISO_SPEED</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-WB-MODE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_WB_MODE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-TONE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_TONE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-SCENE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_SCENE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-FLASH:CAPS"></a>GST_PHOTOGRAPHY_CAPS_FLASH</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-ZOOM:CAPS"></a>GST_PHOTOGRAPHY_CAPS_ZOOM</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-FOCUS:CAPS"></a>GST_PHOTOGRAPHY_CAPS_FOCUS</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-APERTURE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_APERTURE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-EXPOSURE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_EXPOSURE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-SHAKE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_SHAKE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-WHITE-BALANCE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_WHITE_BALANCE</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-NOISE-REDUCTION:CAPS"></a>GST_PHOTOGRAPHY_CAPS_NOISE_REDUCTION</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-FLICKER-REDUCTION:CAPS"></a>GST_PHOTOGRAPHY_CAPS_FLICKER_REDUCTION</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-ALL:CAPS"></a>GST_PHOTOGRAPHY_CAPS_ALL</p></td>
+<td> </td>
+<td> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstPhotographyShakeRisk"></a><h3>enum GstPhotographyShakeRisk</h3>
+<p>Risk level of captured image becoming "shaken" due to camera movement and
+too long exposure time. Used in <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS" title="GST_PHOTOGRAPHY_SHAKE_RISK"><span class="type">GST_PHOTOGRAPHY_SHAKE_RISK</span></a> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstMessage.html"><span class="type">GstMessage</span></a>.</p>
+<div class="refsect3">
+<a name="id-1.2.10.2.8.12.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+<col width="200px" class="enum_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SHAKE-RISK-LOW:CAPS"></a>GST_PHOTOGRAPHY_SHAKE_RISK_LOW</p></td>
+<td class="enum_member_description">
+<p>Low risk</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SHAKE-RISK-MEDIUM:CAPS"></a>GST_PHOTOGRAPHY_SHAKE_RISK_MEDIUM</p></td>
+<td class="enum_member_description">
+<p>Medium risk</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SHAKE-RISK-HIGH:CAPS"></a>GST_PHOTOGRAPHY_SHAKE_RISK_HIGH</p></td>
+<td class="enum_member_description">
+<p>High risk</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS"></a><h3>GST_PHOTOGRAPHY_AUTOFOCUS_DONE</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_AUTOFOCUS_DONE "autofocus-done"
+</pre>
+<p>Name of custom GstMessage that will be posted to <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html"><span class="type">GstBus</span></a> when autofocusing
+is complete.
+This message contains following fields:</p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem"><p>
+  <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusStatus" title="enum GstPhotographyFocusStatus"><span class="type">GstPhotographyFocusStatus</span></a>
+  <code class="classname">"status"</code>:
+  Tells if focusing succeeded or failed.
+  </p></li>
+<li class="listitem"><p>
+  <a href="https://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#G-TYPE-INT:CAPS"><span class="type">G_TYPE_INT</span></a>
+  <code class="classname">"focus-window-rows"</code>:
+  Tells number of focus matrix rows.
+  </p></li>
+<li class="listitem"><p>
+  <a href="https://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#G-TYPE-INT:CAPS"><span class="type">G_TYPE_INT</span></a>
+  <code class="classname">"focus-window-columns"</code>:
+  Tells number of focus matrix columns.
+  </p></li>
+<li class="listitem"><p>
+  <a href="https://developer.gnome.org/gobject/unstable/gobject-Type-Information.html#G-TYPE-INT:CAPS"><span class="type">G_TYPE_INT</span></a>
+  <code class="classname">"focus-window-mask"</code>:
+  Bitmask containing rows x columns bits which mark the focus points in the
+  focus matrix. Lowest bit (LSB) always represents the top-left corner of the
+  focus matrix. This field is only valid when focusing status is SUCCESS.
+  </p></li>
+</ul></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-SHAKE-RISK:CAPS"></a><h3>GST_PHOTOGRAPHY_SHAKE_RISK</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_SHAKE_RISK "shake-risk"
+</pre>
+<p>Name of custom GstMessage that is posted to <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html"><span class="type">GstBus</span></a> during autofocusing
+process. It is posted if there is change in the risk of captured image
+becoming "shaken" due to camera movement and too long exposure time.</p>
+<p>This message contains following fields:</p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
+  <a class="link" href="gst-plugins-bad-libs-GstPhotography.html#GstPhotographyShakeRisk" title="enum GstPhotographyShakeRisk"><span class="type">GstPhotographyShakeRisk</span></a>
+  <code class="classname">"status"</code>:
+  Tells risk level of capturing shaken image.
+  </p></li></ul></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-WB-MODE:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_WB_MODE</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_WB_MODE      "white-balance-mode"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-SCENE-MODE:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_SCENE_MODE</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_SCENE_MODE   "scene-mode"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-FLASH-MODE:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_FLASH_MODE</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_FLASH_MODE   "flash-mode"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-NOISE-REDUCTION:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_NOISE_REDUCTION   "noise-reduction"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-FOCUS-STATUS:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_FOCUS_STATUS</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_FOCUS_STATUS "focus-status"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-CAPABILITIES:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_CAPABILITIES</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_CAPABILITIES "capabilities"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-SHAKE-RISK:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_SHAKE_RISK</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_SHAKE_RISK   "shake-risk"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-EV-COMP:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_EV_COMP</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_EV_COMP      "ev-compensation"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-ISO-SPEED:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_ISO_SPEED</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_ISO_SPEED    "iso-speed"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-APERTURE:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_APERTURE</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_APERTURE     "aperture"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-IMAGE-CAPTURE-SUPPORTED-CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS</h3>
+<pre class="programlisting">#define             GST_PHOTOGRAPHY_PROP_IMAGE_CAPTURE_SUPPORTED_CAPS</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-IMAGE-PREVIEW-SUPPORTED-CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS</h3>
+<pre class="programlisting">#define             GST_PHOTOGRAPHY_PROP_IMAGE_PREVIEW_SUPPORTED_CAPS</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-FLICKER-MODE:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_FLICKER_MODE</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_FLICKER_MODE "flicker-mode"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-FOCUS-MODE:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_FOCUS_MODE</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_FOCUS_MODE   "focus-mode"
+</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GST-PHOTOGRAPHY-PROP-ZOOM:CAPS"></a><h3>GST_PHOTOGRAPHY_PROP_ZOOM</h3>
+<pre class="programlisting">#define GST_PHOTOGRAPHY_PROP_ZOOM   "zoom"
+</pre>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregator.html b/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregator.html
index 66bea5b..e5b8610 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregator.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregator.html
@@ -102,16 +102,18 @@
 <div class="refsect2">
 <a name="GstVideoAggregatorClass"></a><h3>struct GstVideoAggregatorClass</h3>
 <pre class="programlisting">struct GstVideoAggregatorClass {
-  gboolean           disable_frame_conversion;
-
-  gboolean           (*update_info)               (GstVideoAggregator *  videoaggregator,
-                                                   GstVideoInfo       *  info);
+  GstCaps *          (*update_caps)               (GstVideoAggregator *  videoaggregator,
+                                                   GstCaps            *  caps);
   GstFlowReturn      (*aggregate_frames)          (GstVideoAggregator *  videoaggregator,
                                                    GstBuffer          *  outbuffer);
   GstFlowReturn      (*get_output_buffer)         (GstVideoAggregator *  videoaggregator,
                                                    GstBuffer          ** outbuffer);
   gboolean           (*negotiated_caps)           (GstVideoAggregator *  videoaggregator,
                                                    GstCaps            *  caps);
+  void               (*find_best_format)          (GstVideoAggregator *  vagg,
+                                                   GstCaps            *  downstream_caps,
+                                                   GstVideoInfo       *  best_info,
+                                                   gboolean           *  at_least_one_alpha);
 };
 </pre>
 <div class="refsect3">
@@ -124,17 +126,10 @@
 </colgroup>
 <tbody>
 <tr>
-<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> <em class="structfield"><code><a name="GstVideoAggregatorClass.disable-frame-conversion"></a>disable_frame_conversion</code></em>;</p></td>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstVideoAggregatorClass.update-caps"></a>update_caps</code></em> ()</p></td>
 <td class="struct_member_description"><p>Optional.
-Allows subclasses to disable the frame colorspace
-conversion feature</p></td>
-<td class="struct_member_annotations"> </td>
-</tr>
-<tr>
-<td class="struct_member_name"><p><em class="structfield"><code><a name="GstVideoAggregatorClass.update-info"></a>update_info</code></em> ()</p></td>
-<td class="struct_member_description"><p>Optional.
-Lets subclasses update the src <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> representing
-the src pad caps before usage.</p></td>
+Lets subclasses update the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> representing
+the src pad caps before usage.  Return <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to indicate failure.</p></td>
 <td class="struct_member_annotations"> </td>
 </tr>
 <tr>
@@ -162,6 +157,12 @@
 Notifies subclasses what caps format has been negotiated</p></td>
 <td class="struct_member_annotations"> </td>
 </tr>
+<tr>
+<td class="struct_member_name"><p><em class="structfield"><code><a name="GstVideoAggregatorClass.find-best-format"></a>find_best_format</code></em> ()</p></td>
+<td class="struct_member_description"><p>Optional.
+Lets subclasses decide of the best common format to use.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
 </tbody>
 </table></div>
 </div>
diff --git a/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregatorPad.html b/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregatorPad.html
index 1eb5718..a6c3729 100644
--- a/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregatorPad.html
+++ b/docs/libs/html/gst-plugins-bad-libs-GstVideoAggregatorPad.html
@@ -62,19 +62,92 @@
 <a name="GstVideoAggregatorPad"></a><h3>struct GstVideoAggregatorPad</h3>
 <pre class="programlisting">struct GstVideoAggregatorPad {
   GstAggregatorPad parent;
+
+  GstVideoInfo info;
+
+  GstBuffer *buffer;
+  GstVideoInfo buffer_vinfo;
+
+  GstVideoFrame *aggregated_frame;
+
+  /* properties */
+  guint zorder;
 };
 </pre>
-<p>The opaque <a class="link" href="gst-plugins-bad-libs-GstVideoAggregatorPad.html#GstVideoAggregatorPad" title="struct GstVideoAggregatorPad"><span class="type">GstVideoAggregatorPad</span></a> structure.</p>
+<div class="refsect3">
+<a name="id-1.2.8.3.6.2.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="struct_members_name">
+<col class="struct_members_description">
+<col width="200px" class="struct_members_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="struct_member_name"><p><a class="link" href="gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad" title="struct GstAggregatorPad"><span class="type">GstAggregatorPad</span></a> <em class="structfield"><code><a name="GstVideoAggregatorPad.parent"></a>parent</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> <em class="structfield"><code><a name="GstVideoAggregatorPad.info"></a>info</code></em>;</p></td>
+<td class="struct_member_description"><p>The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> currently set on the pad</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *<em class="structfield"><code><a name="GstVideoAggregatorPad.buffer"></a>buffer</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> <em class="structfield"><code><a name="GstVideoAggregatorPad.buffer-vinfo"></a>buffer_vinfo</code></em>;</p></td>
+<td class="struct_member_description"><p>The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> representing the type contained
+in <em class="parameter"><code>buffer</code></em>
+</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoFrame"><span class="type">GstVideoFrame</span></a> *<em class="structfield"><code><a name="GstVideoAggregatorPad.aggregated-frame"></a>aggregated_frame</code></em>;</p></td>
+<td class="struct_member_description"><p>The <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoFrame"><span class="type">GstVideoFrame</span></a> ready to be used for aggregation
+inside the aggregate_frames vmethod.</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GstVideoAggregatorPad.zorder"></a>zorder</code></em>;</p></td>
+<td class="struct_member_description"><p>The zorder of this pad</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
 </div>
 <hr>
 <div class="refsect2">
 <a name="GstVideoAggregatorPadClass"></a><h3>struct GstVideoAggregatorPadClass</h3>
 <pre class="programlisting">struct GstVideoAggregatorPadClass {
   GstAggregatorPadClass parent_class;
+  gboolean           (*set_info)              (GstVideoAggregatorPad * pad,
+                                               GstVideoAggregator    * videoaggregator,
+                                               GstVideoInfo          * current_info,
+                                               GstVideoInfo          * wanted_info);
 
-  gpointer          _gst_reserved[GST_PADDING];
+  gboolean           (*prepare_frame)         (GstVideoAggregatorPad * pad,
+                                               GstVideoAggregator    * videoaggregator);
+
+  void               (*clean_frame)           (GstVideoAggregatorPad * pad,
+                                               GstVideoAggregator    * videoaggregator);
+
+  gpointer          _gst_reserved[GST_PADDING_LARGE];
 };
 </pre>
+<p><em class="parameter"><code>set_info</code></em>
+: Lets subclass set a converter on the pad,
+                right after a new format has been negotiated.
+<em class="parameter"><code>prepare_frame</code></em>
+: Prepare the frame from the pad buffer (if any)
+                and sets it to <em class="parameter"><code>aggregated_frame</code></em>
+
+<em class="parameter"><code>clean_frame</code></em>
+:   clean the frame previously prepared in prepare_frame</p>
 </div>
 </div>
 </div>
diff --git a/docs/libs/html/gst-plugins-bad-libs-Utilities.html b/docs/libs/html/gst-plugins-bad-libs-Utilities.html
index c25fec2..26957de 100644
--- a/docs/libs/html/gst-plugins-bad-libs-Utilities.html
+++ b/docs/libs/html/gst-plugins-bad-libs-Utilities.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
-<link rel="prev" href="gst-plugins-bad-libs-GstGLUploadMeta.html" title="GstGLUploadMeta">
+<link rel="prev" href="GstGLUploadMeta.html" title="GstGLUploadMeta">
 <link rel="next" href="GstGLWindow.html" title="GstGLWindow">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -19,7 +19,7 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLUploadMeta.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="GstGLUploadMeta.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="GstGLWindow.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -68,14 +68,6 @@
 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-display" title="gst_gl_ensure_display ()">gst_gl_ensure_display</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
 <a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-handle-set-context" title="gst_gl_handle_set_context ()">gst_gl_handle_set_context</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
@@ -124,14 +116,6 @@
 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 </td>
 <td class="function_name">
-<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo" title="gst_gl_context_use_fbo ()">gst_gl_context_use_fbo</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
 <a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo-v2" title="gst_gl_context_use_fbo_v2 ()">gst_gl_context_use_fbo_v2</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
@@ -191,6 +175,38 @@
 <a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-generate-texture-full" title="gst_gl_generate_texture_full ()">gst_gl_generate_texture_full</a> <span class="c_punctuation">()</span>
 </td>
 </tr>
+<tr>
+<td class="function_type">
+<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-caps-replace-all-caps-features" title="gst_gl_caps_replace_all_caps_features ()">gst_gl_caps_replace_all_caps_features</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-element-data" title="gst_gl_ensure_element_data ()">gst_gl_ensure_element_data</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<span class="returnvalue">gsize</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-get-plane-data-size" title="gst_gl_get_plane_data_size ()">gst_gl_get_plane_data_size</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
+<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-Utilities.html#gst-gl-run-query" title="gst_gl_run_query ()">gst_gl_run_query</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -221,7 +237,7 @@
          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> stuff</code></em>);</pre>
 <p>callback definition for operating on textures</p>
 <div class="refsect3">
-<a name="id-1.2.9.19.6.2.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.22.6.2.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -260,7 +276,7 @@
 <span class="c_punctuation">(</span>*GLCB_V2<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> stuff</code></em>);</pre>
 <p>callback definition for operating through a Framebuffer object</p>
 <div class="refsect3">
-<a name="id-1.2.9.19.6.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.22.6.3.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -285,7 +301,7 @@
          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
 <p>client draw callback</p>
 <div class="refsect3">
-<a name="id-1.2.9.19.6.4.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.22.6.4.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -319,18 +335,12 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="gst-gl-ensure-display"></a><h3>gst_gl_ensure_display ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_ensure_display (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> element</code></em>,
-                       <em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> **display_ptr</code></em>);</pre>
-</div>
-<hr>
-<div class="refsect2">
 <a name="gst-gl-handle-set-context"></a><h3>gst_gl_handle_set_context ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_gl_handle_set_context (<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a> *element</code></em>,
                            <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstContext.html"><span class="type">GstContext</span></a> *context</code></em>,
-                           <em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> **display</code></em>);</pre>
+                           <em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> **display</code></em>,
+                           <em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> **other_context</code></em>);</pre>
 </div>
 <hr>
 <div class="refsect2">
@@ -338,7 +348,8 @@
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_gl_handle_context_query (<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a> *element</code></em>,
                              <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html"><span class="type">GstQuery</span></a> *query</code></em>,
-                             <em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> **display</code></em>);</pre>
+                             <em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> **display</code></em>,
+                             <em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> **other_context</code></em>);</pre>
 </div>
 <hr>
 <div class="refsect2">
@@ -377,27 +388,6 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="gst-gl-context-use-fbo"></a><h3>gst_gl_context_use_fbo ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_context_use_fbo (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_width</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> texture_fbo_height</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> fbo</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> depth_buffer</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> texture_fbo</code></em>,
-                        <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Utilities.html#GLCB:CAPS" title="GLCB ()"><span class="type">GLCB</span></a> cb</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> input_texture_width</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> input_texture_height</code></em>,
-                        <em class="parameter"><code><span class="type">GLuint</span> input_texture</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param1</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param2</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param3</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> proj_param4</code></em>,
-                        <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-Utilities.html#GstGLDisplayProjection" title="enum GstGLDisplayProjection"><span class="type">GstGLDisplayProjection</span></a> projection</code></em>,
-                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> stuff</code></em>);</pre>
-</div>
-<hr>
-<div class="refsect2">
 <a name="gst-gl-context-use-fbo-v2"></a><h3>gst_gl_context_use_fbo_v2 ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_gl_context_use_fbo_v2 (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
@@ -464,13 +454,44 @@
                               <em class="parameter"><code><span class="type">gsize</span> size[]</code></em>,
                               <em class="parameter"><code><span class="type">GLuint</span> *pTexture</code></em>);</pre>
 </div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-caps-replace-all-caps-features"></a><h3>gst_gl_caps_replace_all_caps_features ()</h3>
+<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="returnvalue">GstCaps</span></a> *
+gst_gl_caps_replace_all_caps_features (<em class="parameter"><code>const <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *caps</code></em>,
+                                       <em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *feature_name</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-ensure-element-data"></a><h3>gst_gl_ensure_element_data ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_ensure_element_data (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> element</code></em>,
+                            <em class="parameter"><code><a class="link" href="GstGLDisplay.html" title="GstGLDisplay"><span class="type">GstGLDisplay</span></a> **display_ptr</code></em>,
+                            <em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> **other_context_ptr</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-get-plane-data-size"></a><h3>gst_gl_get_plane_data_size ()</h3>
+<pre class="programlisting"><span class="returnvalue">gsize</span>
+gst_gl_get_plane_data_size (<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>,
+                            <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> *align</code></em>,
+                            <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> plane</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-run-query"></a><h3>gst_gl_run_query ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_run_query (<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html"><span class="type">GstElement</span></a> *element</code></em>,
+                  <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstQuery.html"><span class="type">GstQuery</span></a> *query</code></em>,
+                  <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#GstPadDirection"><span class="type">GstPadDirection</span></a> direction</code></em>);</pre>
+</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-libs-Utilities.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
 <a name="GstGLDisplayProjection"></a><h3>enum GstGLDisplayProjection</h3>
 <div class="refsect3">
-<a name="id-1.2.9.19.7.2.3"></a><h4>Members</h4>
+<a name="id-1.2.9.22.7.2.3"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="enum_members_name">
diff --git a/docs/libs/html/gst-plugins-bad-libs-gstglmemory.html b/docs/libs/html/gst-plugins-bad-libs-gstglmemory.html
index 77130f8..1acf1f6 100644
--- a/docs/libs/html/gst-plugins-bad-libs-gstglmemory.html
+++ b/docs/libs/html/gst-plugins-bad-libs-gstglmemory.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
-<link rel="prev" href="gst-plugins-bad-libs-GstGLFramebuffer.html" title="GstGLFramebuffer">
+<link rel="prev" href="GstGLFramebuffer.html" title="GstGLFramebuffer">
 <link rel="next" href="gst-plugins-bad-libs-gstglshader.html" title="GstGLShader">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -20,7 +20,7 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLFramebuffer.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="GstGLFramebuffer.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-libs-gstglshader.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -200,7 +200,7 @@
 <p>Get the currently set flags on <em class="parameter"><code>mem</code></em>
 </p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.2.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.2.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -224,7 +224,7 @@
  is set on <em class="parameter"><code>mem</code></em>
 </p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.3.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -255,7 +255,7 @@
  on <em class="parameter"><code>mem</code></em>
 </p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.4.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.4.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -286,7 +286,7 @@
  on <em class="parameter"><code>mem</code></em>
 </p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.5.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.5.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -321,12 +321,13 @@
 <a name="gst-gl-memory-alloc"></a><h3>gst_gl_memory_alloc ()</h3>
 <pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstMemory.html"><span class="returnvalue">GstMemory</span></a> *
 gst_gl_memory_alloc (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
-                     <em class="parameter"><code><span class="type">GstVideoGLTextureType</span> tex_type</code></em>,
-                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
-                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
-                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> stride</code></em>);</pre>
+                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a> *params</code></em>,
+                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>,
+                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> plane</code></em>,
+                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> *valign</code></em>);</pre>
+<p>Allocated a new <span class="type">GstGlMemory</span>.</p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.7.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.7.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -340,16 +341,32 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>v_info</p></td>
+<td class="parameter_name"><p>params</p></td>
+<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>info</p></td>
 <td class="parameter_description"><p>the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> of the memory</p></td>
 <td class="parameter_annotations"> </td>
 </tr>
+<tr>
+<td class="parameter_name"><p>plane</p></td>
+<td class="parameter_description"><p>the plane this memory will represent</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>valign</p></td>
+<td class="parameter_description"><p>the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> applied to <em class="parameter"><code>info</code></em>
+</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
 </tbody>
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.7.5"></a><h4>Returns</h4>
-<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstMemory.html"><span class="type">GstMemory</span></a> object with a GL texture specified by <em class="parameter"><code>v_info</code></em>
+<a name="id-1.2.9.17.8.7.6"></a><h4>Returns</h4>
+<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstMemory.html"><span class="type">GstMemory</span></a> object with a GL texture specified by <em class="parameter"><code>vinfo</code></em>
 from <em class="parameter"><code>context</code></em>
 </p>
 <p></p>
@@ -360,15 +377,18 @@
 <a name="gst-gl-memory-wrapped"></a><h3>gst_gl_memory_wrapped ()</h3>
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="returnvalue">GstGLMemory</span></a> *
 gst_gl_memory_wrapped (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
-                       <em class="parameter"><code><span class="type">GstVideoGLTextureType</span> tex_type</code></em>,
-                       <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
-                       <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
-                       <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> stride</code></em>,
+                       <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>,
+                       <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> plane</code></em>,
+                       <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> *valign</code></em>,
                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>,
                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
+<p>Wrapped <em class="parameter"><code>data</code></em>
+ into a <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a>. This version will account for padding
+added to the allocation and expressed through <em class="parameter"><code>valign</code></em>
+.</p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.8.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.8.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -382,11 +402,22 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>v_info</p></td>
+<td class="parameter_name"><p>info</p></td>
 <td class="parameter_description"><p>the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> of the memory and data</p></td>
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
+<td class="parameter_name"><p>plane</p></td>
+<td class="parameter_description"><p>the plane this memory will represent</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>valign</p></td>
+<td class="parameter_description"><p>the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> applied to <em class="parameter"><code>info</code></em>
+</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
 <td class="parameter_name"><p>data</p></td>
 <td class="parameter_description"><p>the data to wrap</p></td>
 <td class="parameter_annotations"> </td>
@@ -408,7 +439,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.8.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.17.8.8.6"></a><h4>Returns</h4>
 <p> a <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a> object with a GL texture specified by <em class="parameter"><code>v_info</code></em>
 from <em class="parameter"><code>context</code></em>
 and contents specified by <em class="parameter"><code>data</code></em>
@@ -422,11 +453,65 @@
 <pre class="programlisting"><a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="returnvalue">GstGLMemory</span></a> *
 gst_gl_memory_wrapped_texture (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
                                <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> texture_id</code></em>,
-                               <em class="parameter"><code><span class="type">GstVideoGLTextureType</span> tex_type</code></em>,
-                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
-                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
+                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> texture_target</code></em>,
+                               <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>,
+                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> plane</code></em>,
+                               <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> *valign</code></em>,
                                <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
+<p>Wraps a texture handle into a <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a>.</p>
+<div class="refsect3">
+<a name="id-1.2.9.17.8.9.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>context</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>texture_id</p></td>
+<td class="parameter_description"><p>the GL texture handle</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>texture_target</p></td>
+<td class="parameter_description"><p>the GL texture target</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>info</p></td>
+<td class="parameter_description"><p>the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> of the memory</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>plane</p></td>
+<td class="parameter_description"><p>The plane this memory will represent</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>user data</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>notify</p></td>
+<td class="parameter_description"><p>Destroy callback for the user data</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.17.8.9.6"></a><h4>Returns</h4>
+<p> a newly allocated <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a></p>
+<p></p>
+</div>
 </div>
 <hr>
 <div class="refsect2">
@@ -459,7 +544,7 @@
 using glCopyTexImage.  See the OpenGL specification for details on the
 mappings between texture formats.</p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.10.7"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.10.7"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -508,7 +593,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.10.8"></a><h4>Returns</h4>
+<a name="id-1.2.9.17.8.10.8"></a><h4>Returns</h4>
 <p> Whether the copy suceeded</p>
 <p></p>
 </div>
@@ -518,14 +603,76 @@
 <a name="gst-gl-memory-setup-buffer"></a><h3>gst_gl_memory_setup_buffer ()</h3>
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_gl_memory_setup_buffer (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                            <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a> *params</code></em>,
                             <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>,
+                            <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> *valign</code></em>,
                             <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *buffer</code></em>);</pre>
 <p>Adds the required <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a>s with the correct configuration to
 <em class="parameter"><code>buffer</code></em>
  based on <em class="parameter"><code>info</code></em>
+. This version handles padding through <em class="parameter"><code>valign</code></em>
 .</p>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.11.5"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.11.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>context</p></td>
+<td class="parameter_description"><p>a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>param</p></td>
+<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>info</p></td>
+<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>valign</p></td>
+<td class="parameter_description"><p>the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> applied to <em class="parameter"><code>info</code></em>
+</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>buffer</p></td>
+<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a></p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.2.9.17.8.11.6"></a><h4>Returns</h4>
+<p> whether the memory's were sucessfully added.</p>
+<p></p>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="gst-gl-memory-setup-wrapped"></a><h3>gst_gl_memory_setup_wrapped ()</h3>
+<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
+gst_gl_memory_setup_wrapped (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
+                             <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>,
+                             <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> *valign</code></em>,
+                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data[GST_VIDEO_MAX_PLANES]</code></em>,
+                             <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a> *textures[GST_VIDEO_MAX_PLANES]</code></em>);</pre>
+<p>Wraps per plane data pointer in <em class="parameter"><code>data</code></em>
+ into the corresponding entry in
+<em class="parameter"><code>textures</code></em>
+ based on <em class="parameter"><code>info</code></em>
+ and padding from <em class="parameter"><code>valign</code></em>
+.</p>
+<div class="refsect3">
+<a name="id-1.2.9.17.8.12.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -544,48 +691,7 @@
 <td class="parameter_annotations"> </td>
 </tr>
 <tr>
-<td class="parameter_name"><p>buffer</p></td>
-<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a></p></td>
-<td class="parameter_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<div class="refsect3">
-<a name="id-1.2.9.15.8.11.6"></a><h4>Returns</h4>
-<p> whether the memory's were sucessfully added.</p>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-gl-memory-setup-wrapped"></a><h3>gst_gl_memory_setup_wrapped ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_gl_memory_setup_wrapped (<em class="parameter"><code><a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a> *context</code></em>,
-                             <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> *info</code></em>,
-                             <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data[GST_VIDEO_MAX_PLANES]</code></em>,
-                             <em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a> *textures[GST_VIDEO_MAX_PLANES]</code></em>);</pre>
-<p>Wraps per plane data pointer in <em class="parameter"><code>data</code></em>
- into the corresponding entry in
-<em class="parameter"><code>textures</code></em>
- based on <em class="parameter"><code>info</code></em>
-.</p>
-<div class="refsect3">
-<a name="id-1.2.9.15.8.12.5"></a><h4>Parameters</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="parameters_name">
-<col class="parameters_description">
-<col width="200px" class="parameters_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="parameter_name"><p>context</p></td>
-<td class="parameter_description"><p>a <a class="link" href="GstGLContext.html" title="GstGLContext"><span class="type">GstGLContext</span></a></p></td>
-<td class="parameter_annotations"> </td>
-</tr>
-<tr>
-<td class="parameter_name"><p>info</p></td>
+<td class="parameter_name"><p>valign</p></td>
 <td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a></p></td>
 <td class="parameter_annotations"> </td>
 </tr>
@@ -603,7 +709,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.12.6"></a><h4>Returns</h4>
+<a name="id-1.2.9.17.8.12.6"></a><h4>Returns</h4>
 <p> whether the memory's were sucessfully created.</p>
 <p></p>
 </div>
@@ -622,7 +728,7 @@
 <pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
 gst_is_gl_memory (<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstMemory.html"><span class="type">GstMemory</span></a> *mem</code></em>);</pre>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.14.4"></a><h4>Parameters</h4>
+<a name="id-1.2.9.17.8.14.4"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -637,7 +743,7 @@
 </table></div>
 </div>
 <div class="refsect3">
-<a name="id-1.2.9.15.8.14.5"></a><h4>Returns</h4>
+<a name="id-1.2.9.17.8.14.5"></a><h4>Returns</h4>
 <p> whether the memory at <em class="parameter"><code>mem</code></em>
 is a <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a></p>
 <p></p>
@@ -682,7 +788,7 @@
 <a name="GstGLMemoryFlags"></a><h3>enum GstGLMemoryFlags</h3>
 <p>Flags indicating the current state of a <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLMemory" title="GstGLMemory"><span class="type">GstGLMemory</span></a></p>
 <div class="refsect3">
-<a name="id-1.2.9.15.9.6.4"></a><h4>Members</h4>
+<a name="id-1.2.9.17.9.6.4"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="enum_members_name">
@@ -722,16 +828,17 @@
 
   GstGLContext         *context;
   guint                 tex_id;
+  guint                 tex_target;
   GstVideoGLTextureType tex_type;
-  gint                  width;
-  gint                  height;
-  gint                  stride;
+  GstVideoInfo          info;
+  GstVideoAlignment     valign;
+  guint                 plane;
   gfloat                tex_scaling[2];
 } GstGLMemory;
 </pre>
 <p>Represents information about a GL texture</p>
 <div class="refsect3">
-<a name="id-1.2.9.15.9.7.5"></a><h4>Members</h4>
+<a name="id-1.2.9.17.9.7.5"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="struct_members_name">
@@ -755,22 +862,27 @@
 <td class="struct_member_annotations"> </td>
 </tr>
 <tr>
+<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GstGLMemory.tex-target"></a>tex_target</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
 <td class="struct_member_name"><p><span class="type">GstVideoGLTextureType</span> <em class="structfield"><code><a name="GstGLMemory.tex-type"></a>tex_type</code></em>;</p></td>
 <td> </td>
 <td> </td>
 </tr>
 <tr>
-<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GstGLMemory.width"></a>width</code></em>;</p></td>
-<td class="struct_member_description"><p>width of the texture</p></td>
-<td class="struct_member_annotations"> </td>
+<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoInfo"><span class="type">GstVideoInfo</span></a> <em class="structfield"><code><a name="GstGLMemory.info"></a>info</code></em>;</p></td>
+<td> </td>
+<td> </td>
 </tr>
 <tr>
-<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GstGLMemory.height"></a>height</code></em>;</p></td>
-<td class="struct_member_description"><p>height of the texture</p></td>
-<td class="struct_member_annotations"> </td>
+<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoAlignment"><span class="type">GstVideoAlignment</span></a> <em class="structfield"><code><a name="GstGLMemory.valign"></a>valign</code></em>;</p></td>
+<td> </td>
+<td> </td>
 </tr>
 <tr>
-<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GstGLMemory.stride"></a>stride</code></em>;</p></td>
+<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GstGLMemory.plane"></a>plane</code></em>;</p></td>
 <td> </td>
 <td> </td>
 </tr>
diff --git a/docs/libs/html/gst-plugins-bad-libs-gstglshader.html b/docs/libs/html/gst-plugins-bad-libs-gstglshader.html
index 96c2b59..dbfeb00 100644
--- a/docs/libs/html/gst-plugins-bad-libs-gstglshader.html
+++ b/docs/libs/html/gst-plugins-bad-libs-gstglshader.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="gl.html" title="OpenGL Helper Library">
 <link rel="prev" href="gst-plugins-bad-libs-gstglmemory.html" title="GstGLMemory">
-<link rel="next" href="GstGLUpload.html" title="GstGLUpload">
+<link rel="next" href="gst-plugins-bad-libs-GstGLSyncMeta.html" title="GstGLSyncMeta">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -22,7 +22,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="gl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-libs-gstglmemory.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="GstGLUpload.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-libs-GstGLSyncMeta.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-libs-gstglshader"></a><div class="titlepage"></div>
@@ -109,6 +109,14 @@
 </tr>
 <tr>
 <td class="function_type">
+<span class="returnvalue">int</span>
+</td>
+<td class="function_name">
+<a class="link" href="gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-program-handle" title="gst_gl_shader_get_program_handle ()">gst_gl_shader_get_program_handle</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+<tr>
+<td class="function_type">
 <span class="returnvalue">void</span>
 </td>
 <td class="function_name">
@@ -541,6 +549,12 @@
 </div>
 <hr>
 <div class="refsect2">
+<a name="gst-gl-shader-get-program-handle"></a><h3>gst_gl_shader_get_program_handle ()</h3>
+<pre class="programlisting"><span class="returnvalue">int</span>
+gst_gl_shader_get_program_handle (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-gstglshader.html#GstGLShader"><span class="type">GstGLShader</span></a> *shader</code></em>);</pre>
+</div>
+<hr>
+<div class="refsect2">
 <a name="gst-gl-shader-set-active"></a><h3>gst_gl_shader_set_active ()</h3>
 <pre class="programlisting"><span class="returnvalue">void</span>
 gst_gl_shader_set_active (<em class="parameter"><code><a class="link" href="gst-plugins-bad-libs-gstglshader.html#GstGLShader"><span class="type">GstGLShader</span></a> *shader</code></em>,
@@ -886,7 +900,7 @@
 <div class="refsect2">
 <a name="GstGLShaderError"></a><h3>enum GstGLShaderError</h3>
 <div class="refsect3">
-<a name="id-1.2.9.16.10.2.3"></a><h4>Members</h4>
+<a name="id-1.2.9.18.10.2.3"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="enum_members_name">
@@ -917,7 +931,7 @@
 <div class="refsect2">
 <a name="GstGLShaderSourceType"></a><h3>enum GstGLShaderSourceType</h3>
 <div class="refsect3">
-<a name="id-1.2.9.16.10.3.3"></a><h4>Members</h4>
+<a name="id-1.2.9.18.10.3.3"></a><h4>Members</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="300px" class="enum_members_name">
diff --git a/docs/libs/html/gst-plugins-bad-libs-h264parser.html b/docs/libs/html/gst-plugins-bad-libs-h264parser.html
index 7c46da6..df8900b 100644
--- a/docs/libs/html/gst-plugins-bad-libs-h264parser.html
+++ b/docs/libs/html/gst-plugins-bad-libs-h264parser.html
@@ -1297,7 +1297,7 @@
 <tr>
 <td class="enum_member_name"><p><a name="GST-H264-PARSER-ERROR:CAPS"></a>GST_H264_PARSER_ERROR</p></td>
 <td class="enum_member_description">
-<p>An error accured when parsing</p>
+<p>An error occured when parsing</p>
 </td>
 <td class="enum_member_annotations"> </td>
 </tr>
@@ -1349,7 +1349,22 @@
 <tr>
 <td class="enum_member_name"><p><a name="GST-H264-SEI-RECOVERY-POINT:CAPS"></a>GST_H264_SEI_RECOVERY_POINT</p></td>
 <td class="enum_member_description">
-<p>Recovery Point SEI Message (D.2.7)
+<p>Recovery Point SEI Message (D.2.7)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-H264-SEI-STEREO-VIDEO-INFO:CAPS"></a>GST_H264_SEI_STEREO_VIDEO_INFO</p></td>
+<td class="enum_member_description">
+<p>stereo video info SEI message (Since: 1.6)</p>
+</td>
+<td class="enum_member_annotations"> </td>
+</tr>
+<tr>
+<td class="enum_member_name"><p><a name="GST-H264-SEI-FRAME-PACKING:CAPS"></a>GST_H264_SEI_FRAME_PACKING</p></td>
+<td class="enum_member_description">
+<p>Frame Packing Arrangement (FPA) message that
+    contains the 3D arrangement for stereoscopic 3D video (Since: 1.6)
 ...</p>
 </td>
 <td class="enum_member_annotations"> </td>
@@ -1530,6 +1545,12 @@
   gboolean valid;
 
   guint8 *data;
+
+  guint8 header_bytes;
+  guint8 extension_type;
+  union {
+    GstH264NalUnitExtensionMVC mvc;
+  } extension;
 };
 </pre>
 <p>Structure defining the Nal unit headers</p>
@@ -1592,6 +1613,16 @@
 <td class="struct_member_description"><p>The data from which the Nalu has been parsed</p></td>
 <td class="struct_member_annotations"> </td>
 </tr>
+<tr>
+<td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstH264NalUnit.header-bytes"></a>header_bytes</code></em>;</p></td>
+<td class="struct_member_description"><p>The size of the NALU header in bytes (Since 1.6)</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstH264NalUnit.extension-type"></a>extension_type</code></em>;</p></td>
+<td class="struct_member_description"><p>the extension type (Since 1.6)</p></td>
+<td class="struct_member_annotations"> </td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -1607,6 +1638,8 @@
   guint8 constraint_set1_flag;
   guint8 constraint_set2_flag;
   guint8 constraint_set3_flag;
+  guint8 constraint_set4_flag;
+  guint8 constraint_set5_flag;
   guint8 level_idc;
 
   guint8 chroma_format_idc;
@@ -1662,6 +1695,12 @@
   gint crop_rect_x, crop_rect_y;
   gint fps_num, fps_den;
   gboolean valid;
+
+  /* Subset SPS extensions */
+  guint8 extension_type;
+  union {
+    GstH264SPSExtMVC mvc;
+  } extension;
 };
 </pre>
 <p>H264 Sequence Parameter Set (SPS)</p>
@@ -1705,6 +1744,16 @@
 <td> </td>
 </tr>
 <tr>
+<td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstH264SPS.constraint-set4-flag"></a>constraint_set4_flag</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstH264SPS.constraint-set5-flag"></a>constraint_set5_flag</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
 <td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstH264SPS.level-idc"></a>level_idc</code></em>;</p></td>
 <td> </td>
 <td> </td>
@@ -1914,6 +1963,11 @@
 <td> </td>
 <td> </td>
 </tr>
+<tr>
+<td class="struct_member_name"><p><span class="type">guint8</span> <em class="structfield"><code><a name="GstH264SPS.extension-type"></a>extension_type</code></em>;</p></td>
+<td> </td>
+<td> </td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -2501,12 +2555,12 @@
   GstH264SPS *sps;
 
   /* seq-&gt;vui_parameters-&gt;nal_hrd_parameters_present_flag */
-  guint8 nal_initial_cpb_removal_delay[32];
-  guint8 nal_initial_cpb_removal_delay_offset[32];
+  guint32 nal_initial_cpb_removal_delay[32];
+  guint32 nal_initial_cpb_removal_delay_offset[32];
 
   /* seq-&gt;vui_parameters-&gt;vcl_hrd_parameters_present_flag */
-  guint8 vcl_initial_cpb_removal_delay[32];
-  guint8 vcl_initial_cpb_removal_delay_offset[32];
+  guint32 vcl_initial_cpb_removal_delay[32];
+  guint32 vcl_initial_cpb_removal_delay_offset[32];
 };
 </pre>
 </div>
@@ -2520,6 +2574,8 @@
     GstH264BufferingPeriod buffering_period;
     GstH264PicTiming pic_timing;
     GstH264RecoveryPoint recovery_point;
+    GstH264StereoVideoInfo stereo_video_info;
+    GstH264FramePacking frame_packing;
     /* ... could implement more */
   } payload;
 };
diff --git a/docs/libs/html/gstreamer-libs-hierarchy.html b/docs/libs/html/gstreamer-libs-hierarchy.html
index f584e9a..0e9498e 100644
--- a/docs/libs/html/gstreamer-libs-hierarchy.html
+++ b/docs/libs/html/gstreamer-libs-hierarchy.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
 <link rel="up" href="index.html" title="GStreamer Bad Plugins 1.0 Library Reference Manual">
-<link rel="prev" href="gst-plugins-bad-libs-GstGLWindowX11.html" title="GstGLWindowX11">
+<link rel="prev" href="gst-plugins-bad-libs-GstPhotography.html" title="GstPhotography">
 <link rel="next" href="api-index-full.html" title="Index">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -16,7 +16,7 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
-<td><a accesskey="p" href="gst-plugins-bad-libs-GstGLWindowX11.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-libs-GstPhotography.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="api-index-full.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="part">
@@ -24,24 +24,27 @@
 <a name="gstreamer-libs-hierarchy"></a>Part II. Object Hierarchy</h1></div></div></div>
 <pre class="screen">
     <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
-    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
-        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
-            <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstAllocator.html">GstAllocator</a>
-            <span class="lineart">│</span>   <span class="lineart">╰──</span> <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLAllocator">GstGLAllocator</a>
-            <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
-            <span class="lineart">│</span>   <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBin.html">GstBin</a>
-            <span class="lineart">│</span>   <span class="lineart">│</span>   <span class="lineart">╰──</span> <a class="link" href="gst-plugins-bad-libs-GstInsertbin.html#GstInsertBin">GstInsertBin</a>
-            <span class="lineart">│</span>   <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html">GstBaseTransform</a>
-            <span class="lineart">│</span>       <span class="lineart">╰──</span> <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
-            <span class="lineart">├──</span> <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
-            <span class="lineart">├──</span> <a class="link" href="GstGLDownload.html" title="GstGLDownload">GstGLDownload</a>
-            <span class="lineart">├──</span> <a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert">GstGLColorConvert</a>
-            <span class="lineart">├──</span> <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
-            <span class="lineart">├──</span> <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
-            <span class="lineart">├──</span> <a class="link" href="gst-plugins-bad-libs-gstglshader.html#GstGLShader">GstGLShader</a>
-            <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferPool.html">GstBufferPool</a>
-            <span class="lineart">│</span>   <span class="lineart">╰──</span> <a class="link" href="GstGLBufferPool.html" title="GstGLBufferPool">GstGLBufferPool</a>
-            <span class="lineart">╰──</span> <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+    <span class="lineart">├──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+    <span class="lineart">│</span>   <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstAllocator.html">GstAllocator</a>
+    <span class="lineart">│</span>       <span class="lineart">│</span>   <span class="lineart">╰──</span> <a class="link" href="gst-plugins-bad-libs-gstglmemory.html#GstGLAllocator">GstGLAllocator</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+    <span class="lineart">│</span>       <span class="lineart">│</span>   <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBin.html">GstBin</a>
+    <span class="lineart">│</span>       <span class="lineart">│</span>   <span class="lineart">│</span>   <span class="lineart">╰──</span> <a class="link" href="gst-plugins-bad-libs-GstInsertbin.html#GstInsertBin">GstInsertBin</a>
+    <span class="lineart">│</span>       <span class="lineart">│</span>   <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html">GstBaseTransform</a>
+    <span class="lineart">│</span>       <span class="lineart">│</span>       <span class="lineart">╰──</span> <a class="link" href="GstGLBaseFilter.html" title="GstGLBaseFilter">GstGLBaseFilter</a>
+    <span class="lineart">│</span>       <span class="lineart">│</span>           <span class="lineart">╰──</span> <a class="link" href="GstGLFilter.html" title="GstGLFilter">GstGLFilter</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferPool.html">GstBufferPool</a>
+    <span class="lineart">│</span>       <span class="lineart">│</span>   <span class="lineart">╰──</span> <a class="link" href="GstGLBufferPool.html" title="GstGLBufferPool">GstGLBufferPool</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a class="link" href="GstGLColorConvert.html" title="GstGLColorConvert">GstGLColorConvert</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a class="link" href="GstGLContext.html" title="GstGLContext">GstGLContext</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a class="link" href="GstGLDisplay.html" title="GstGLDisplay">GstGLDisplay</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a class="link" href="GstGLDownload.html" title="GstGLDownload">GstGLDownload</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a class="link" href="gst-plugins-bad-libs-gstglshader.html#GstGLShader">GstGLShader</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a class="link" href="GstGLUpload.html" title="GstGLUpload">GstGLUpload</a>
+    <span class="lineart">│</span>       <span class="lineart">├──</span> <a class="link" href="GstGLUploadMeta.html" title="GstGLUploadMeta">GstGLUploadMeta</a>
+    <span class="lineart">│</span>       <span class="lineart">╰──</span> <a class="link" href="GstGLWindow.html" title="GstGLWindow">GstGLWindow</a>
+    <span class="lineart">╰──</span> <a class="link" href="GstGLFramebuffer.html" title="GstGLFramebuffer">GstGLFramebuffer</a>
     <a href="https://developer.gnome.org/gobject/unstable/gobject-Boxed-Types.html">GBoxed</a>
     <span class="lineart">├──</span> <a class="link" href="gst-plugins-bad-libs-Base-MPEG-TS-sections.html#GstMpegtsSection">GstMpegtsSection</a>
     <span class="lineart">╰──</span> <a class="link" href="gst-plugins-bad-libs-Base-MPEG-TS-descriptors.html#GstMpegtsDescriptor">GstMpegtsDescriptor</a>
diff --git a/docs/libs/html/gstreamer-plugins-bad.html b/docs/libs/html/gstreamer-plugins-bad.html
index 677fb0c..8478a20 100644
--- a/docs/libs/html/gstreamer-plugins-bad.html
+++ b/docs/libs/html/gstreamer-plugins-bad.html
@@ -123,6 +123,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextEGL.html">GstGLContextEGL</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextEagl.html">GstGLContextEagl</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextGLX.html">GstGLContextGLX</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
@@ -138,10 +141,13 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstEGLImageMemory.html">GstEGLImageMemory</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="GstGLBaseFilter.html">GstGLBaseFilter</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="GstGLFilter.html">GstGLFilter</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLFramebuffer.html">GstGLFramebuffer</a></span><span class="refpurpose"></span>
+<span class="refentrytitle"><a href="GstGLFramebuffer.html">GstGLFramebuffer</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-gstglmemory.html">GstGLMemory</a></span><span class="refpurpose"> — memory subclass for GL textures</span>
@@ -150,10 +156,13 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-gstglshader.html">GstGLShader</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLSyncMeta.html">GstGLSyncMeta</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="GstGLUpload.html">GstGLUpload</a></span><span class="refpurpose"> — an object that uploads to GL textures</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLUploadMeta.html">GstGLUploadMeta</a></span><span class="refpurpose">an object that provides <span class="type">GstVideoGLTextureUploadMeta</span></span>
+<span class="refentrytitle"><a href="GstGLUploadMeta.html">GstGLUploadMeta</a></span><span class="refpurpose">an object that provides <span class="type">GstVideoGLTextureUploadMeta</span></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-Utilities.html">Utilities</a></span><span class="refpurpose"></span>
@@ -180,6 +189,10 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLWindowX11.html">GstGLWindowX11</a></span><span class="refpurpose"></span>
 </dt>
 </dl></dd>
+<dt><span class="chapter"><a href="ch07.html">Interfaces</a></span></dt>
+<dd><dl><dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstPhotography.html">GstPhotography</a></span><span class="refpurpose"> — Interface for digital image capture elements</span>
+</dt></dl></dd>
 </dl>
 </div>
 <p>
diff --git a/docs/libs/html/index.html b/docs/libs/html/index.html
index 935c0ba..568131e 100644
--- a/docs/libs/html/index.html
+++ b/docs/libs/html/index.html
@@ -15,7 +15,7 @@
 <div>
 <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">GStreamer Bad Plugins 1.0 Library Reference Manual</p></th></tr></table></div>
 <div><p class="releaseinfo">
-      for GStreamer Bad Library 1.0 (1.4.5)
+      for GStreamer Bad Library 1.0 (1.5.0.1)
       <a class="ulink" href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/" target="_top">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/</a>.
     </p></div>
 </div>
@@ -122,6 +122,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextEGL.html">GstGLContextEGL</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextEagl.html">GstGLContextEagl</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLContextGLX.html">GstGLContextGLX</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
@@ -137,10 +140,13 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstEGLImageMemory.html">GstEGLImageMemory</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="GstGLBaseFilter.html">GstGLBaseFilter</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="GstGLFilter.html">GstGLFilter</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLFramebuffer.html">GstGLFramebuffer</a></span><span class="refpurpose"></span>
+<span class="refentrytitle"><a href="GstGLFramebuffer.html">GstGLFramebuffer</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-gstglmemory.html">GstGLMemory</a></span><span class="refpurpose"> — memory subclass for GL textures</span>
@@ -149,10 +155,13 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-gstglshader.html">GstGLShader</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLSyncMeta.html">GstGLSyncMeta</a></span><span class="refpurpose"></span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="GstGLUpload.html">GstGLUpload</a></span><span class="refpurpose"> — an object that uploads to GL textures</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLUploadMeta.html">GstGLUploadMeta</a></span><span class="refpurpose">an object that provides <span class="type">GstVideoGLTextureUploadMeta</span></span>
+<span class="refentrytitle"><a href="GstGLUploadMeta.html">GstGLUploadMeta</a></span><span class="refpurpose">an object that provides <span class="type">GstVideoGLTextureUploadMeta</span></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-Utilities.html">Utilities</a></span><span class="refpurpose"></span>
@@ -179,6 +188,10 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-libs-GstGLWindowX11.html">GstGLWindowX11</a></span><span class="refpurpose"></span>
 </dt>
 </dl></dd>
+<dt><span class="chapter"><a href="ch07.html">Interfaces</a></span></dt>
+<dd><dl><dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-libs-GstPhotography.html">GstPhotography</a></span><span class="refpurpose"> — Interface for digital image capture elements</span>
+</dt></dl></dd>
 </dl></dd>
 <dt><span class="part"><a href="gstreamer-libs-hierarchy.html">II. Object Hierarchy</a></span></dt>
 <dt><span class="index"><a href="api-index-full.html">Index</a></span></dt>
diff --git a/docs/libs/html/index.sgml b/docs/libs/html/index.sgml
index 5378adc..aa1f534 100644
--- a/docs/libs/html/index.sgml
+++ b/docs/libs/html/index.sgml
@@ -438,6 +438,8 @@
 <ANCHOR id="gst-plugins-bad-libs-GstAggregatorPad.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#gst-plugins-bad-libs-GstAggregatorPad.functions_details">
 <ANCHOR id="gst-aggregator-pad-steal-buffer" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-steal-buffer">
 <ANCHOR id="gst-aggregator-pad-get-buffer" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-get-buffer">
+<ANCHOR id="gst-aggregator-pad-drop-buffer" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-drop-buffer">
+<ANCHOR id="gst-aggregator-pad-is-eos" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#gst-aggregator-pad-is-eos">
 <ANCHOR id="gst-plugins-bad-libs-GstAggregatorPad.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#gst-plugins-bad-libs-GstAggregatorPad.other_details">
 <ANCHOR id="GstAggregatorPad" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad">
 <ANCHOR id="GstAggregatorPadClass" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPadClass">
@@ -490,7 +492,8 @@
 <ANCHOR id="GstGLColorConvert.description" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#GstGLColorConvert.description">
 <ANCHOR id="GstGLColorConvert.functions_details" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#GstGLColorConvert.functions_details">
 <ANCHOR id="gst-gl-color-convert-new" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#gst-gl-color-convert-new">
-<ANCHOR id="gst-gl-color-convert-set-format" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#gst-gl-color-convert-set-format">
+<ANCHOR id="gst-gl-color-convert-set-caps" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#gst-gl-color-convert-set-caps">
+<ANCHOR id="gst-gl-color-convert-transform-caps" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#gst-gl-color-convert-transform-caps">
 <ANCHOR id="gst-gl-color-convert-perform" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#gst-gl-color-convert-perform">
 <ANCHOR id="GstGLColorConvert.other_details" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#GstGLColorConvert.other_details">
 <ANCHOR id="GST-GL-COLOR-CONVERT-FORMATS:CAPS" href="gst-plugins-bad-libs-1.0/GstGLColorConvert.html#GST-GL-COLOR-CONVERT-FORMATS:CAPS">
@@ -510,6 +513,7 @@
 <ANCHOR id="gst-gl-context-new" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-new">
 <ANCHOR id="gst-gl-context-new-wrapped" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-new-wrapped">
 <ANCHOR id="gst-gl-context-create" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-create">
+<ANCHOR id="gst-gl-context-destroy" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-destroy">
 <ANCHOR id="gst-gl-context-activate" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-activate">
 <ANCHOR id="gst-gl-context-default-get-proc-address" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-default-get-proc-address">
 <ANCHOR id="gst-gl-context-get-proc-address" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-proc-address">
@@ -520,11 +524,15 @@
 <ANCHOR id="gst-gl-context-get-gl-api" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-gl-api">
 <ANCHOR id="gst-gl-context-get-gl-context" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-gl-context">
 <ANCHOR id="gst-gl-context-get-gl-platform" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-gl-platform">
+<ANCHOR id="gst-gl-context-get-current-gl-context" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-current-gl-context">
+<ANCHOR id="gst-gl-context-get-current-gl-api" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-current-gl-api">
 <ANCHOR id="gst-gl-context-get-thread" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-thread">
 <ANCHOR id="gst-gl-context-can-share" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-can-share">
 <ANCHOR id="gst-gl-context-check-feature" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-check-feature">
 <ANCHOR id="gst-gl-context-check-gl-version" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-check-gl-version">
 <ANCHOR id="gst-gl-context-get-gl-version" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-gl-version">
+<ANCHOR id="gst-gl-context-fill-info" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-fill-info">
+<ANCHOR id="gst-gl-context-get-current" href="gst-plugins-bad-libs-1.0/GstGLContext.html#gst-gl-context-get-current">
 <ANCHOR id="GstGLContext.other_details" href="gst-plugins-bad-libs-1.0/GstGLContext.html#GstGLContext.other_details">
 <ANCHOR id="GstGLContextError" href="gst-plugins-bad-libs-1.0/GstGLContext.html#GstGLContextError">
 <ANCHOR id="GstGLContext-struct" href="gst-plugins-bad-libs-1.0/GstGLContext.html#GstGLContext-struct">
@@ -535,6 +543,8 @@
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextCocoa.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextCocoa.html#gst-plugins-bad-libs-GstGLContextCocoa.description">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextCocoa.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextCocoa.html#gst-plugins-bad-libs-GstGLContextCocoa.functions_details">
 <ANCHOR id="gst-gl-context-cocoa-new" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-new">
+<ANCHOR id="gst-gl-context-cocoa-get-current-context" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-current-context">
+<ANCHOR id="gst-gl-context-cocoa-get-pixel-format" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextCocoa.html#gst-gl-context-cocoa-get-pixel-format">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextCocoa.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextCocoa.html#gst-plugins-bad-libs-GstGLContextCocoa.other_details">
 <ANCHOR id="GstGLContextCocoa" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextCocoa.html#GstGLContextCocoa">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextEGL" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html">
@@ -543,14 +553,27 @@
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextEGL.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html#gst-plugins-bad-libs-GstGLContextEGL.description">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextEGL.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html#gst-plugins-bad-libs-GstGLContextEGL.functions_details">
 <ANCHOR id="gst-gl-context-egl-new" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-new">
+<ANCHOR id="gst-gl-context-egl-get-current-context" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-current-context">
+<ANCHOR id="gst-gl-context-egl-get-proc-address" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html#gst-gl-context-egl-get-proc-address">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextEGL.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html#gst-plugins-bad-libs-GstGLContextEGL.other_details">
 <ANCHOR id="GstGLContextEGL" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEGL.html#GstGLContextEGL">
+<ANCHOR id="gst-plugins-bad-libs-GstGLContextEagl" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html">
+<ANCHOR id="gst-plugins-bad-libs-GstGLContextEagl.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#gst-plugins-bad-libs-GstGLContextEagl.functions">
+<ANCHOR id="gst-plugins-bad-libs-GstGLContextEagl.other" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#gst-plugins-bad-libs-GstGLContextEagl.other">
+<ANCHOR id="gst-plugins-bad-libs-GstGLContextEagl.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#gst-plugins-bad-libs-GstGLContextEagl.description">
+<ANCHOR id="gst-plugins-bad-libs-GstGLContextEagl.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#gst-plugins-bad-libs-GstGLContextEagl.functions_details">
+<ANCHOR id="gst-gl-context-eagl-new" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-new">
+<ANCHOR id="gst-gl-context-eagl-get-current-context" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#gst-gl-context-eagl-get-current-context">
+<ANCHOR id="gst-plugins-bad-libs-GstGLContextEagl.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#gst-plugins-bad-libs-GstGLContextEagl.other_details">
+<ANCHOR id="GstGLContextEagl" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextEagl.html#GstGLContextEagl">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextGLX" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextGLX.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-plugins-bad-libs-GstGLContextGLX.functions">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextGLX.other" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-plugins-bad-libs-GstGLContextGLX.other">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextGLX.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-plugins-bad-libs-GstGLContextGLX.description">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextGLX.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-plugins-bad-libs-GstGLContextGLX.functions_details">
 <ANCHOR id="gst-gl-context-glx-new" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-new">
+<ANCHOR id="gst-gl-context-glx-get-current-context" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-current-context">
+<ANCHOR id="gst-gl-context-glx-get-proc-address" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-gl-context-glx-get-proc-address">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextGLX.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#gst-plugins-bad-libs-GstGLContextGLX.other_details">
 <ANCHOR id="GstGLContextGLX" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextGLX.html#GstGLContextGLX">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextWGL" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html">
@@ -559,6 +582,8 @@
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextWGL.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html#gst-plugins-bad-libs-GstGLContextWGL.description">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextWGL.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html#gst-plugins-bad-libs-GstGLContextWGL.functions_details">
 <ANCHOR id="gst-gl-context-wgl-new" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-new">
+<ANCHOR id="gst-gl-context-wgl-get-current-context" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-current-context">
+<ANCHOR id="gst-gl-context-wgl-get-proc-address" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html#gst-gl-context-wgl-get-proc-address">
 <ANCHOR id="gst-plugins-bad-libs-GstGLContextWGL.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html#gst-plugins-bad-libs-GstGLContextWGL.other_details">
 <ANCHOR id="GstGLContextWGL" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLContextWGL.html#GstGLContextWGL">
 <ANCHOR id="GstGLDisplay" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html">
@@ -569,6 +594,11 @@
 <ANCHOR id="GstGLDisplay.functions_details" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#GstGLDisplay.functions_details">
 <ANCHOR id="gst-gl-display-new" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-gl-display-new">
 <ANCHOR id="gst-gl-display-get-handle-type" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-gl-display-get-handle-type">
+<ANCHOR id="gst-gl-display-filter-gl-api" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-gl-display-filter-gl-api">
+<ANCHOR id="gst-gl-display-get-gl-api" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-gl-display-get-gl-api">
+<ANCHOR id="gst-gl-display-add-context" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-gl-display-add-context">
+<ANCHOR id="gst-gl-display-get-gl-context-for-thread" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-gl-display-get-gl-context-for-thread">
+<ANCHOR id="gst-gl-display-get-handle" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-gl-display-get-handle">
 <ANCHOR id="gst-context-get-gl-display" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-context-get-gl-display">
 <ANCHOR id="gst-context-set-gl-display" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#gst-context-set-gl-display">
 <ANCHOR id="GstGLDisplay.other_details" href="gst-plugins-bad-libs-1.0/GstGLDisplay.html#GstGLDisplay.other_details">
@@ -584,6 +614,7 @@
 <ANCHOR id="GstGLDownload.functions_details" href="gst-plugins-bad-libs-1.0/GstGLDownload.html#GstGLDownload.functions_details">
 <ANCHOR id="gst-gl-download-new" href="gst-plugins-bad-libs-1.0/GstGLDownload.html#gst-gl-download-new">
 <ANCHOR id="gst-gl-download-set-format" href="gst-plugins-bad-libs-1.0/GstGLDownload.html#gst-gl-download-set-format">
+<ANCHOR id="gst-gl-download-transform-caps" href="gst-plugins-bad-libs-1.0/GstGLDownload.html#gst-gl-download-transform-caps">
 <ANCHOR id="gst-gl-download-perform-with-data" href="gst-plugins-bad-libs-1.0/GstGLDownload.html#gst-gl-download-perform-with-data">
 <ANCHOR id="GstGLDownload.other_details" href="gst-plugins-bad-libs-1.0/GstGLDownload.html#GstGLDownload.other_details">
 <ANCHOR id="GstGLDownload-struct" href="gst-plugins-bad-libs-1.0/GstGLDownload.html#GstGLDownload-struct">
@@ -603,9 +634,19 @@
 <ANCHOR id="gst-plugins-bad-libs-GstEGLImageMemory.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstEGLImageMemory.html#gst-plugins-bad-libs-GstEGLImageMemory.other_details">
 <ANCHOR id="GST-EGL-IMAGE-MEMORY-TYPE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstEGLImageMemory.html#GST-EGL-IMAGE-MEMORY-TYPE:CAPS">
 <ANCHOR id="GST-CAPS-FEATURE-MEMORY-EGL-IMAGE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstEGLImageMemory.html#GST-CAPS-FEATURE-MEMORY-EGL-IMAGE:CAPS">
+<ANCHOR id="GstGLBaseFilter" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html">
+<ANCHOR id="GstGLBaseFilter.properties" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter.properties">
+<ANCHOR id="GstGLBaseFilter.other" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter.other">
+<ANCHOR id="GstGLBaseFilter.object-hierarchy" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter.object-hierarchy">
+<ANCHOR id="GstGLBaseFilter.description" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter.description">
+<ANCHOR id="GstGLBaseFilter.functions_details" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter.functions_details">
+<ANCHOR id="GstGLBaseFilter.other_details" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter.other_details">
+<ANCHOR id="GstGLBaseFilter-struct" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter-struct">
+<ANCHOR id="GstGLBaseFilterClass" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilterClass">
+<ANCHOR id="GstGLBaseFilter.property-details" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter.property-details">
+<ANCHOR id="GstGLBaseFilter--context" href="gst-plugins-bad-libs-1.0/GstGLBaseFilter.html#GstGLBaseFilter--context">
 <ANCHOR id="GstGLFilter" href="gst-plugins-bad-libs-1.0/GstGLFilter.html">
 <ANCHOR id="GstGLFilter.functions" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter.functions">
-<ANCHOR id="GstGLFilter.properties" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter.properties">
 <ANCHOR id="GstGLFilter.other" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter.other">
 <ANCHOR id="GstGLFilter.object-hierarchy" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter.object-hierarchy">
 <ANCHOR id="GstGLFilter.description" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter.description">
@@ -617,21 +658,19 @@
 <ANCHOR id="GstGLFilter.other_details" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter.other_details">
 <ANCHOR id="GstGLFilter-struct" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter-struct">
 <ANCHOR id="GstGLFilterClass" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilterClass">
-<ANCHOR id="GstGLFilter.property-details" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter.property-details">
-<ANCHOR id="GstGLFilter--other-context" href="gst-plugins-bad-libs-1.0/GstGLFilter.html#GstGLFilter--other-context">
-<ANCHOR id="gst-plugins-bad-libs-GstGLFramebuffer" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html">
-<ANCHOR id="gst-plugins-bad-libs-GstGLFramebuffer.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-plugins-bad-libs-GstGLFramebuffer.functions">
-<ANCHOR id="gst-plugins-bad-libs-GstGLFramebuffer.other" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-plugins-bad-libs-GstGLFramebuffer.other">
-<ANCHOR id="gst-plugins-bad-libs-GstGLFramebuffer.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-plugins-bad-libs-GstGLFramebuffer.description">
-<ANCHOR id="gst-plugins-bad-libs-GstGLFramebuffer.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-plugins-bad-libs-GstGLFramebuffer.functions_details">
-<ANCHOR id="gst-gl-framebuffer-new" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-new">
-<ANCHOR id="gst-gl-framebuffer-generate" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-generate">
-<ANCHOR id="gst-gl-framebuffer-delete" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-delete">
-<ANCHOR id="gst-gl-framebuffer-use" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use">
-<ANCHOR id="gst-gl-framebuffer-use-v2" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-gl-framebuffer-use-v2">
-<ANCHOR id="gst-plugins-bad-libs-GstGLFramebuffer.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#gst-plugins-bad-libs-GstGLFramebuffer.other_details">
-<ANCHOR id="GstGLFramebuffer" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebuffer">
-<ANCHOR id="GstGLFramebufferClass" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLFramebuffer.html#GstGLFramebufferClass">
+<ANCHOR id="GstGLFramebuffer" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html">
+<ANCHOR id="GstGLFramebuffer.functions" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebuffer.functions">
+<ANCHOR id="GstGLFramebuffer.other" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebuffer.other">
+<ANCHOR id="GstGLFramebuffer.object-hierarchy" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebuffer.object-hierarchy">
+<ANCHOR id="GstGLFramebuffer.description" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebuffer.description">
+<ANCHOR id="GstGLFramebuffer.functions_details" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebuffer.functions_details">
+<ANCHOR id="gst-gl-framebuffer-new" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#gst-gl-framebuffer-new">
+<ANCHOR id="gst-gl-framebuffer-generate" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#gst-gl-framebuffer-generate">
+<ANCHOR id="gst-gl-framebuffer-delete" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#gst-gl-framebuffer-delete">
+<ANCHOR id="gst-gl-framebuffer-use-v2" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#gst-gl-framebuffer-use-v2">
+<ANCHOR id="GstGLFramebuffer.other_details" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebuffer.other_details">
+<ANCHOR id="GstGLFramebuffer-struct" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebuffer-struct">
+<ANCHOR id="GstGLFramebufferClass" href="gst-plugins-bad-libs-1.0/GstGLFramebuffer.html#GstGLFramebufferClass">
 <ANCHOR id="gst-plugins-bad-libs-gstglmemory" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglmemory.html">
 <ANCHOR id="gst-plugins-bad-libs-gstglmemory.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglmemory.html#gst-plugins-bad-libs-gstglmemory.functions">
 <ANCHOR id="GstGLAllocator" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglmemory.html#GstGLAllocator">
@@ -677,6 +716,7 @@
 <ANCHOR id="gst-gl-shader-set-fragment-source" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-set-fragment-source">
 <ANCHOR id="gst-gl-shader-get-vertex-source" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-vertex-source">
 <ANCHOR id="gst-gl-shader-get-fragment-source" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-fragment-source">
+<ANCHOR id="gst-gl-shader-get-program-handle" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-get-program-handle">
 <ANCHOR id="gst-gl-shader-set-active" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-set-active">
 <ANCHOR id="gst-gl-shader-is-compiled" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-is-compiled">
 <ANCHOR id="gst-gl-shader-compile" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#gst-gl-shader-compile">
@@ -724,6 +764,20 @@
 <ANCHOR id="GstGLShader--compiled" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#GstGLShader--compiled">
 <ANCHOR id="GstGLShader--fragment-src" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#GstGLShader--fragment-src">
 <ANCHOR id="GstGLShader--vertex-src" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-gstglshader.html#GstGLShader--vertex-src">
+<ANCHOR id="gst-plugins-bad-libs-GstGLSyncMeta" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html">
+<ANCHOR id="gst-plugins-bad-libs-GstGLSyncMeta.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-plugins-bad-libs-GstGLSyncMeta.functions">
+<ANCHOR id="gst-plugins-bad-libs-GstGLSyncMeta.other" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-plugins-bad-libs-GstGLSyncMeta.other">
+<ANCHOR id="gst-plugins-bad-libs-GstGLSyncMeta.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-plugins-bad-libs-GstGLSyncMeta.description">
+<ANCHOR id="gst-plugins-bad-libs-GstGLSyncMeta.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-plugins-bad-libs-GstGLSyncMeta.functions_details">
+<ANCHOR id="gst-buffer-add-gl-sync-meta" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-add-gl-sync-meta">
+<ANCHOR id="gst-buffer-get-gl-sync-meta" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-buffer-get-gl-sync-meta">
+<ANCHOR id="gst-gl-sync-meta-api-get-type" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-api-get-type">
+<ANCHOR id="gst-gl-sync-meta-get-info" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-get-info">
+<ANCHOR id="gst-gl-sync-meta-set-sync-point" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-set-sync-point">
+<ANCHOR id="gst-gl-sync-meta-wait" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-gl-sync-meta-wait">
+<ANCHOR id="gst-plugins-bad-libs-GstGLSyncMeta.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#gst-plugins-bad-libs-GstGLSyncMeta.other_details">
+<ANCHOR id="GstGLSyncMeta" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#GstGLSyncMeta">
+<ANCHOR id="GST-BUFFER-POOL-OPTION-GL-SYNC-META:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLSyncMeta.html#GST-BUFFER-POOL-OPTION-GL-SYNC-META:CAPS">
 <ANCHOR id="GstGLUpload" href="gst-plugins-bad-libs-1.0/GstGLUpload.html">
 <ANCHOR id="GstGLUpload.functions" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#GstGLUpload.functions">
 <ANCHOR id="GstGLUpload.other" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#GstGLUpload.other">
@@ -731,27 +785,28 @@
 <ANCHOR id="GstGLUpload.description" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#GstGLUpload.description">
 <ANCHOR id="GstGLUpload.functions_details" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#GstGLUpload.functions_details">
 <ANCHOR id="gst-gl-upload-new" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-new">
-<ANCHOR id="gst-gl-upload-set-format" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-set-format">
-<ANCHOR id="gst-gl-upload-get-format" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-get-format">
-<ANCHOR id="gst-gl-upload-perform-with-data" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-perform-with-data">
-<ANCHOR id="gst-gl-upload-perform-with-gl-texture-upload-meta" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-perform-with-gl-texture-upload-meta">
+<ANCHOR id="gst-gl-upload-get-caps" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-get-caps">
+<ANCHOR id="gst-gl-upload-set-caps" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-set-caps">
+<ANCHOR id="gst-gl-upload-propose-allocation" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-propose-allocation">
+<ANCHOR id="gst-gl-upload-transform-caps" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-transform-caps">
 <ANCHOR id="gst-gl-upload-perform-with-buffer" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-perform-with-buffer">
 <ANCHOR id="gst-gl-upload-release-buffer" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#gst-gl-upload-release-buffer">
 <ANCHOR id="GstGLUpload.other_details" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#GstGLUpload.other_details">
 <ANCHOR id="GstGLUpload-struct" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#GstGLUpload-struct">
 <ANCHOR id="GstGLUpload.see-also" href="gst-plugins-bad-libs-1.0/GstGLUpload.html#GstGLUpload.see-also">
-<ANCHOR id="gst-plugins-bad-libs-GstGLUploadMeta" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html">
-<ANCHOR id="gst-plugins-bad-libs-GstGLUploadMeta.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-plugins-bad-libs-GstGLUploadMeta.functions">
-<ANCHOR id="gst-plugins-bad-libs-GstGLUploadMeta.other" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-plugins-bad-libs-GstGLUploadMeta.other">
-<ANCHOR id="gst-plugins-bad-libs-GstGLUploadMeta.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-plugins-bad-libs-GstGLUploadMeta.description">
-<ANCHOR id="gst-plugins-bad-libs-GstGLUploadMeta.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-plugins-bad-libs-GstGLUploadMeta.functions_details">
-<ANCHOR id="gst-gl-upload-meta-new" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-new">
-<ANCHOR id="gst-gl-upload-meta-set-format" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-set-format">
-<ANCHOR id="gst-gl-upload-meta-get-format" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-get-format">
-<ANCHOR id="gst-gl-upload-meta-add-to-buffer" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer">
-<ANCHOR id="gst-plugins-bad-libs-GstGLUploadMeta.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-plugins-bad-libs-GstGLUploadMeta.other_details">
-<ANCHOR id="GstGLUploadMeta" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#GstGLUploadMeta">
-<ANCHOR id="gst-plugins-bad-libs-GstGLUploadMeta.see-also" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLUploadMeta.html#gst-plugins-bad-libs-GstGLUploadMeta.see-also">
+<ANCHOR id="GstGLUploadMeta" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html">
+<ANCHOR id="GstGLUploadMeta.functions" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta.functions">
+<ANCHOR id="GstGLUploadMeta.other" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta.other">
+<ANCHOR id="GstGLUploadMeta.object-hierarchy" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta.object-hierarchy">
+<ANCHOR id="GstGLUploadMeta.description" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta.description">
+<ANCHOR id="GstGLUploadMeta.functions_details" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta.functions_details">
+<ANCHOR id="gst-gl-upload-meta-new" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#gst-gl-upload-meta-new">
+<ANCHOR id="gst-gl-upload-meta-set-format" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#gst-gl-upload-meta-set-format">
+<ANCHOR id="gst-gl-upload-meta-get-format" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#gst-gl-upload-meta-get-format">
+<ANCHOR id="gst-gl-upload-meta-add-to-buffer" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#gst-gl-upload-meta-add-to-buffer">
+<ANCHOR id="GstGLUploadMeta.other_details" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta.other_details">
+<ANCHOR id="GstGLUploadMeta-struct" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta-struct">
+<ANCHOR id="GstGLUploadMeta.see-also" href="gst-plugins-bad-libs-1.0/GstGLUploadMeta.html#GstGLUploadMeta.see-also">
 <ANCHOR id="gst-plugins-bad-libs-Utilities" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html">
 <ANCHOR id="gst-plugins-bad-libs-Utilities.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-plugins-bad-libs-Utilities.functions">
 <ANCHOR id="gst-plugins-bad-libs-Utilities.other" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-plugins-bad-libs-Utilities.other">
@@ -760,14 +815,12 @@
 <ANCHOR id="GLCB:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#GLCB:CAPS">
 <ANCHOR id="GLCB-V2:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#GLCB-V2:CAPS">
 <ANCHOR id="CDCB:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#CDCB:CAPS">
-<ANCHOR id="gst-gl-ensure-display" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-display">
 <ANCHOR id="gst-gl-handle-set-context" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-handle-set-context">
 <ANCHOR id="gst-gl-handle-context-query" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-handle-context-query">
 <ANCHOR id="gst-gl-context-gen-texture" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-gen-texture">
 <ANCHOR id="gst-gl-context-del-texture" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-del-texture">
 <ANCHOR id="gst-gl-context-gen-fbo" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-gen-fbo">
 <ANCHOR id="gst-gl-context-del-fbo" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-del-fbo">
-<ANCHOR id="gst-gl-context-use-fbo" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo">
 <ANCHOR id="gst-gl-context-use-fbo-v2" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-use-fbo-v2">
 <ANCHOR id="gst-gl-context-gen-shader" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-gen-shader">
 <ANCHOR id="gst-gl-context-del-shader" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-del-shader">
@@ -776,10 +829,15 @@
 <ANCHOR id="gst-gl-context-get-error" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-get-error">
 <ANCHOR id="gst-gl-context-clear-shader" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-context-clear-shader">
 <ANCHOR id="gst-gl-generate-texture-full" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-generate-texture-full">
+<ANCHOR id="gst-gl-caps-replace-all-caps-features" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-caps-replace-all-caps-features">
+<ANCHOR id="gst-gl-ensure-element-data" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-ensure-element-data">
+<ANCHOR id="gst-gl-get-plane-data-size" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-get-plane-data-size">
+<ANCHOR id="gst-gl-run-query" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-gl-run-query">
 <ANCHOR id="gst-plugins-bad-libs-Utilities.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#gst-plugins-bad-libs-Utilities.other_details">
 <ANCHOR id="GstGLDisplayProjection" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-Utilities.html#GstGLDisplayProjection">
 <ANCHOR id="GstGLWindow" href="gst-plugins-bad-libs-1.0/GstGLWindow.html">
 <ANCHOR id="GstGLWindow.functions" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.functions">
+<ANCHOR id="GstGLWindow.signals" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.signals">
 <ANCHOR id="GstGLWindow.other" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.other">
 <ANCHOR id="GstGLWindow.object-hierarchy" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.object-hierarchy">
 <ANCHOR id="GstGLWindow.description" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.description">
@@ -805,10 +863,19 @@
 <ANCHOR id="gst-gl-window-set-resize-callback" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#gst-gl-window-set-resize-callback">
 <ANCHOR id="gst-gl-window-set-window-handle" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#gst-gl-window-set-window-handle">
 <ANCHOR id="gst-gl-window-get-window-handle" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#gst-gl-window-get-window-handle">
+<ANCHOR id="gst-gl-window-set-preferred-size" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#gst-gl-window-set-preferred-size">
+<ANCHOR id="gst-gl-window-show" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#gst-gl-window-show">
+<ANCHOR id="gst-gl-window-get-surface-dimensions" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#gst-gl-window-get-surface-dimensions">
+<ANCHOR id="gst-gl-window-handle-events" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#gst-gl-window-handle-events">
 <ANCHOR id="GstGLWindow.other_details" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.other_details">
 <ANCHOR id="GstGLWindowError" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindowError">
 <ANCHOR id="GstGLWindow-struct" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow-struct">
 <ANCHOR id="GstGLWindowClass" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindowClass">
+<ANCHOR id="GstGLWindow.signal-details" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.signal-details">
+<ANCHOR id="GstGLWindow-key-event" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow-key-event">
+<ANCHOR id="GstGLWindow-mouse-event" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow-mouse-event">
+<ANCHOR id="GstGLWindow-key-event" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow-key-event">
+<ANCHOR id="GstGLWindow-mouse-event" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow-mouse-event">
 <ANCHOR id="GstGLWindow.see-also" href="gst-plugins-bad-libs-1.0/GstGLWindow.html#GstGLWindow.see-also">
 <ANCHOR id="gst-plugins-bad-libs-GstGLWindowAndroid" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLWindowAndroid.html">
 <ANCHOR id="gst-plugins-bad-libs-GstGLWindowAndroid.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLWindowAndroid.html#gst-plugins-bad-libs-GstGLWindowAndroid.functions">
@@ -869,12 +936,78 @@
 <ANCHOR id="gst-plugins-bad-libs-GstGLWindowX11.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLWindowX11.html#gst-plugins-bad-libs-GstGLWindowX11.other_details">
 <ANCHOR id="GstGLWindowX11" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLWindowX11.html#GstGLWindowX11">
 <ANCHOR id="GstGLWindowX11Class" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstGLWindowX11.html#GstGLWindowX11Class">
+<ANCHOR id="gst-plugins-bad-libs-GstPhotography" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html">
+<ANCHOR id="gst-plugins-bad-libs-GstPhotography.stability-level" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-plugins-bad-libs-GstPhotography.stability-level">
+<ANCHOR id="gst-plugins-bad-libs-GstPhotography.functions" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-plugins-bad-libs-GstPhotography.functions">
+<ANCHOR id="gst-plugins-bad-libs-GstPhotography.other" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-plugins-bad-libs-GstPhotography.other">
+<ANCHOR id="gst-plugins-bad-libs-GstPhotography.description" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-plugins-bad-libs-GstPhotography.description">
+<ANCHOR id="gst-plugins-bad-libs-GstPhotography.functions_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-plugins-bad-libs-GstPhotography.functions_details">
+<ANCHOR id="GstPhotographyCapturePrepared" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCapturePrepared">
+<ANCHOR id="gst-photography-get-ev-compensation" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-ev-compensation">
+<ANCHOR id="gst-photography-get-iso-speed" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-iso-speed">
+<ANCHOR id="gst-photography-get-aperture" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-aperture">
+<ANCHOR id="gst-photography-get-exposure" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-exposure">
+<ANCHOR id="gst-photography-get-white-balance-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-white-balance-mode">
+<ANCHOR id="gst-photography-get-color-tone-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-color-tone-mode">
+<ANCHOR id="gst-photography-get-scene-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-scene-mode">
+<ANCHOR id="gst-photography-get-flash-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flash-mode">
+<ANCHOR id="gst-photography-get-flicker-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-flicker-mode">
+<ANCHOR id="gst-photography-get-focus-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-focus-mode">
+<ANCHOR id="gst-photography-get-noise-reduction" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-noise-reduction">
+<ANCHOR id="gst-photography-get-zoom" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-zoom">
+<ANCHOR id="gst-photography-set-ev-compensation" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-ev-compensation">
+<ANCHOR id="gst-photography-set-iso-speed" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-iso-speed">
+<ANCHOR id="gst-photography-set-aperture" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-aperture">
+<ANCHOR id="gst-photography-set-exposure" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-exposure">
+<ANCHOR id="gst-photography-set-white-balance-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-white-balance-mode">
+<ANCHOR id="gst-photography-set-color-tone-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-color-tone-mode">
+<ANCHOR id="gst-photography-set-scene-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-scene-mode">
+<ANCHOR id="gst-photography-set-flash-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flash-mode">
+<ANCHOR id="gst-photography-set-flicker-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-flicker-mode">
+<ANCHOR id="gst-photography-set-focus-mode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-focus-mode">
+<ANCHOR id="gst-photography-set-noise-reduction" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-noise-reduction">
+<ANCHOR id="gst-photography-set-zoom" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-zoom">
+<ANCHOR id="gst-photography-get-capabilities" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-capabilities">
+<ANCHOR id="gst-photography-prepare-for-capture" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-prepare-for-capture">
+<ANCHOR id="gst-photography-set-autofocus" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-autofocus">
+<ANCHOR id="gst-photography-set-config" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-set-config">
+<ANCHOR id="gst-photography-get-config" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-photography-get-config">
+<ANCHOR id="gst-plugins-bad-libs-GstPhotography.other_details" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#gst-plugins-bad-libs-GstPhotography.other_details">
+<ANCHOR id="GstPhotography" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotography">
+<ANCHOR id="GstPhotographyNoiseReduction" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyNoiseReduction">
+<ANCHOR id="GstPhotographyWhiteBalanceMode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyWhiteBalanceMode">
+<ANCHOR id="GstPhotographyColorToneMode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyColorToneMode">
+<ANCHOR id="GstPhotographySceneMode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographySceneMode">
+<ANCHOR id="GstPhotographyFlashMode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlashMode">
+<ANCHOR id="GstPhotographyFlickerReductionMode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFlickerReductionMode">
+<ANCHOR id="GstPhotographyFocusMode" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusMode">
+<ANCHOR id="GstPhotographyFocusStatus" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyFocusStatus">
+<ANCHOR id="GstPhotographyCaps" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyCaps">
+<ANCHOR id="GstPhotographyShakeRisk" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GstPhotographyShakeRisk">
+<ANCHOR id="GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-SHAKE-RISK:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-WB-MODE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-WB-MODE:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-SCENE-MODE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SCENE-MODE:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-FLASH-MODE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLASH-MODE:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-NOISE-REDUCTION:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-NOISE-REDUCTION:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-FOCUS-STATUS:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-STATUS:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-CAPABILITIES:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-CAPABILITIES:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-SHAKE-RISK:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-SHAKE-RISK:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-EV-COMP:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-EV-COMP:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-ISO-SPEED:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ISO-SPEED:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-APERTURE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-APERTURE:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-IMAGE-CAPTURE-SUPPORTED-CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-CAPTURE-SUPPORTED-CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-IMAGE-PREVIEW-SUPPORTED-CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-IMAGE-PREVIEW-SUPPORTED-CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-FLICKER-MODE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FLICKER-MODE:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-FOCUS-MODE:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-FOCUS-MODE:CAPS">
+<ANCHOR id="GST-PHOTOGRAPHY-PROP-ZOOM:CAPS" href="gst-plugins-bad-libs-1.0/gst-plugins-bad-libs-GstPhotography.html#GST-PHOTOGRAPHY-PROP-ZOOM:CAPS">
 <ANCHOR id="annotation-glossterm-allow-none" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-allow-none">
 <ANCHOR id="annotation-glossterm-closure" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-closure">
 <ANCHOR id="annotation-glossterm-destroy" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-destroy">
 <ANCHOR id="annotation-glossterm-element-type" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-element-type">
 <ANCHOR id="annotation-glossterm-out" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-out">
 <ANCHOR id="annotation-glossterm-scope async" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-scope async">
+<ANCHOR id="annotation-glossterm-scope call" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-scope call">
 <ANCHOR id="annotation-glossterm-scope notified" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-scope notified">
 <ANCHOR id="annotation-glossterm-transfer container" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-transfer container">
 <ANCHOR id="annotation-glossterm-transfer full" href="gst-plugins-bad-libs-1.0/annotation-glossary.html#annotation-glossterm-transfer full">
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index b093bcf..2d1f148 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -85,7 +85,6 @@
 	$(top_srcdir)/ext/modplug/gstmodplug.h \
 	$(top_srcdir)/ext/mpeg2enc/gstmpeg2enc.hh \
 	$(top_srcdir)/ext/mplex/gstmplex.hh \
-	$(top_srcdir)/ext/mythtv/gstmythtvsrc.h \
 	$(top_srcdir)/ext/opencv/gstcvdilate.h \
 	$(top_srcdir)/ext/opencv/gstcverode.h \
 	$(top_srcdir)/ext/opencv/gstcvequalizehist.h \
@@ -163,11 +162,9 @@
 	$(top_srcdir)/gst/speed/gstspeed.h \
 	$(top_srcdir)/gst/stereo/gststereo.h \
 	$(top_srcdir)/gst/videosignal/gstvideoanalyse.h \
-	$(top_srcdir)/sys/directdraw/gstdirectdrawsink.h \
 	$(top_srcdir)/sys/dvb/gstdvbsrc.h \
 	$(top_srcdir)/sys/shm/gstshmsink.h \
-	$(top_srcdir)/sys/shm/gstshmsrc.h \
-	$(top_srcdir)/gst-libs/gst/interfaces/photography.h
+	$(top_srcdir)/sys/shm/gstshmsrc.h
 
 # Images to copy into HTML directory.
 HTML_IMAGES = camerabin.png
@@ -182,7 +179,6 @@
 # contains GtkObjects/GObjects and you want to document signals and properties.
 GTKDOC_CFLAGS = -DGST_USE_UNSTABLE_API $(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) -I$(top_builddir)
 GTKDOC_LIBS = \
-	$(top_builddir)/gst-libs/gst/interfaces/libgstphotography-@GST_API_VERSION@.la \
 	$(GST_BASE_LIBS)
 
 GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)
diff --git a/docs/plugins/Makefile.in b/docs/plugins/Makefile.in
index 7650a64..1267c70 100644
--- a/docs/plugins/Makefile.in
+++ b/docs/plugins/Makefile.in
@@ -106,6 +106,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -119,7 +120,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -237,8 +237,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -277,7 +281,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -285,6 +288,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -334,8 +339,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -414,7 +417,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -423,7 +425,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -436,7 +437,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -461,6 +461,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -534,10 +536,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -563,6 +569,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -599,6 +608,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -639,17 +649,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -666,6 +675,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -808,7 +818,6 @@
 	$(top_srcdir)/ext/modplug/gstmodplug.h \
 	$(top_srcdir)/ext/mpeg2enc/gstmpeg2enc.hh \
 	$(top_srcdir)/ext/mplex/gstmplex.hh \
-	$(top_srcdir)/ext/mythtv/gstmythtvsrc.h \
 	$(top_srcdir)/ext/opencv/gstcvdilate.h \
 	$(top_srcdir)/ext/opencv/gstcverode.h \
 	$(top_srcdir)/ext/opencv/gstcvequalizehist.h \
@@ -886,11 +895,9 @@
 	$(top_srcdir)/gst/speed/gstspeed.h \
 	$(top_srcdir)/gst/stereo/gststereo.h \
 	$(top_srcdir)/gst/videosignal/gstvideoanalyse.h \
-	$(top_srcdir)/sys/directdraw/gstdirectdrawsink.h \
 	$(top_srcdir)/sys/dvb/gstdvbsrc.h \
 	$(top_srcdir)/sys/shm/gstshmsink.h \
-	$(top_srcdir)/sys/shm/gstshmsrc.h \
-	$(top_srcdir)/gst-libs/gst/interfaces/photography.h
+	$(top_srcdir)/sys/shm/gstshmsrc.h
 
 
 # Images to copy into HTML directory.
@@ -906,7 +913,6 @@
 # contains GtkObjects/GObjects and you want to document signals and properties.
 GTKDOC_CFLAGS = -DGST_USE_UNSTABLE_API $(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) -I$(top_builddir)
 GTKDOC_LIBS = \
-	$(top_builddir)/gst-libs/gst/interfaces/libgstphotography-@GST_API_VERSION@.la \
 	$(GST_BASE_LIBS)
 
 GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC)
diff --git a/docs/plugins/gst-plugins-bad-plugins-docs.sgml b/docs/plugins/gst-plugins-bad-plugins-docs.sgml
index 2ef5941..51278e9 100644
--- a/docs/plugins/gst-plugins-bad-plugins-docs.sgml
+++ b/docs/plugins/gst-plugins-bad-plugins-docs.sgml
@@ -18,8 +18,12 @@
   <chapter>
     <title>gst-plugins-bad Elements</title>
     <xi:include href="xml/element-accurip.xml" />
+    <xi:include href="xml/element-aiffparse.xml" />
+    <xi:include href="xml/element-aiffmux.xml" />
     <xi:include href="xml/element-assrender.xml" />
+    <xi:include href="xml/element-audiomixer.xml" />
     <xi:include href="xml/element-autoconvert.xml" />
+    <xi:include href="xml/element-bs2b.xml" />
     <xi:include href="xml/element-bulge.xml" />
     <xi:include href="xml/element-burn.xml" />
     <xi:include href="xml/element-camerabin.xml" />
@@ -44,7 +48,6 @@
     <xi:include href="xml/element-dvdspu.xml" />
     <xi:include href="xml/element-exclusion.xml" />
     <xi:include href="xml/element-edgedetect.xml" />
-    <xi:include href="xml/element-eglglessink.xml" />
     <xi:include href="xml/element-faac.xml" />
     <xi:include href="xml/element-faad.xml" />
     <xi:include href="xml/element-faceblur.xml" />
@@ -62,12 +65,19 @@
     <xi:include href="xml/element-mirror.xml" />
     <xi:include href="xml/element-modplug.xml" />
     <xi:include href="xml/element-mpeg2enc.xml" />
+    <xi:include href="xml/element-mpegpsmux.xml" />
+    <xi:include href="xml/element-mpegtsmux.xml" />
     <xi:include href="xml/element-mplex.xml" />
     <xi:include href="xml/element-mpg123audiodec.xml" />
     <xi:include href="xml/element-neonhttpsrc.xml" />
     <xi:include href="xml/element-ofa.xml" />
     <xi:include href="xml/element-openalsrc.xml" />
     <xi:include href="xml/element-openalsink.xml" />
+    <xi:include href="xml/element-opusdec.xml" />
+    <xi:include href="xml/element-opusenc.xml" />
+    <xi:include href="xml/element-opusparse.xml" />
+    <xi:include href="xml/element-rtpopuspay.xml" />
+    <xi:include href="xml/element-rtpopusdepay.xml" />
     <xi:include href="xml/element-pcapparse.xml" />
     <xi:include href="xml/element-pinch.xml" />
     <xi:include href="xml/element-pyramidsegment.xml" />
@@ -99,10 +109,13 @@
 
   <chapter>
     <title>gst-plugins-bad Plugins</title>
+    <xi:include href="xml/plugin-aiff.xml" />
+    <xi:include href="xml/plugin-audiomixer.xml" />
     <xi:include href="xml/plugin-audiovisualizers.xml" />
     <xi:include href="xml/plugin-autoconvert.xml" />
     <xi:include href="xml/plugin-assrender.xml" />
     <xi:include href="xml/plugin-bayer.xml" />
+    <xi:include href="xml/plugin-bs2b.xml" />
     <xi:include href="xml/plugin-bz2.xml" />
     <xi:include href="xml/plugin-camerabin.xml" />
     <xi:include href="xml/plugin-coloreffects.xml" />
@@ -112,7 +125,6 @@
     <xi:include href="xml/plugin-dtsdec.xml" />
     <xi:include href="xml/plugin-dvb.xml" />
     <xi:include href="xml/plugin-dvdspu.xml" />
-    <xi:include href="xml/plugin-eglglessink.xml" />
     <xi:include href="xml/plugin-faac.xml" />
     <xi:include href="xml/plugin-faad.xml" />
     <xi:include href="xml/plugin-festival.xml" />
@@ -125,12 +137,14 @@
     <xi:include href="xml/plugin-mms.xml" />
     <xi:include href="xml/plugin-modplug.xml" />
     <xi:include href="xml/plugin-mpeg2enc.xml" />
+    <xi:include href="xml/plugin-mpegpsmux.xml" />
     <xi:include href="xml/plugin-mpegtsmux.xml" />
     <xi:include href="xml/plugin-mplex.xml" />
     <xi:include href="xml/plugin-neon.xml" />
     <xi:include href="xml/plugin-ofa.xml" />
     <xi:include href="xml/plugin-openal.xml" />
     <xi:include href="xml/plugin-opencv.xml" />
+    <xi:include href="xml/plugin-opus.xml" />
     <xi:include href="xml/plugin-pcapparse.xml" />
     <xi:include href="xml/plugin-rawparse.xml" />
     <xi:include href="xml/plugin-rfbsrc.xml" />
@@ -143,9 +157,4 @@
     <xi:include href="xml/plugin-voamrwbenc.xml" />
     <xi:include href="xml/plugin-zbar.xml" />
   </chapter>
-
-  <chapter>
-    <title>gst-plugins-bad Interfaces</title>
-    <xi:include href="xml/gstphotography.xml" />
-  </chapter>
 </book>
diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt
index e42f1b3..5e869c8 100644
--- a/docs/plugins/gst-plugins-bad-plugins-sections.txt
+++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt
@@ -56,6 +56,20 @@
 </SECTION>
 
 <SECTION>
+<FILE>element-audiomixer</FILE>
+<TITLE>audiomixer</TITLE>
+GstAudioMixer
+<SUBSECTION Standard>
+GstAudioMixerClass
+GST_AUDIO_MIXER
+GST_AUDIO_MIXER_CLASS
+GST_IS_AUDIO_MIXER
+GST_IS_AUDIO_MIXER_CLASS
+GST_TYPE_AUDIO_MIXER
+gst_audio_mixer_get_type
+</SECTION>
+
+<SECTION>
 <FILE>element-audioparse</FILE>
 <TITLE>audioparse</TITLE>
 GstAudioParse
@@ -69,7 +83,6 @@
 gst_audio_parse_get_type
 </SECTION>
 
-
 <SECTION>
 <FILE>element-autoconvert</FILE>
 <TITLE>autoconvert</TITLE>
@@ -84,6 +97,22 @@
 </SECTION>
 
 <SECTION>
+<FILE>element-bs2b</FILE>
+<TITLE>bs2b</TITLE>
+GstBs2b
+<SUBSECTION Standard>
+GstBs2bClass
+GST_BS2B
+GST_BS2B_CAST
+GST_BS2B_CLASS
+GST_IS_BS2B
+GST_IS_BS2B_CLASS
+GST_TYPE_BS2B
+gst_bs2b_get_type
+gst_bs2b_plugin_init
+</SECTION>
+
+<SECTION>
 <FILE>element-bulge</FILE>
 <TITLE>bulge</TITLE>
 GstBulge
@@ -132,8 +161,8 @@
 <SECTION>
 <FILE>element-chromium</FILE>
 <TITLE>chromium</TITLE>
-GstChromium
 <SUBSECTION Standard>
+GstChromium
 GstChromiumClass
 GST_CHROMIUM
 GST_CHROMIUM_CLASS
@@ -415,25 +444,6 @@
 </SECTION>
 
 <SECTION>
-<FILE>element-directdrawsink</FILE>
-<TITLE>directdrawsink</TITLE>
-GstDirectDrawSink
-<SUBSECTION Standard>
-GstDirectDrawSinkClass
-GST_DIRECTDRAW_SINK
-GST_DIRECTDRAW_SINK_CLASS
-GST_IS_DIRECTDRAW_SINK
-GST_IS_DIRECTDRAW_SINK_CLASS
-GST_TYPE_DIRECTDRAW_SINK
-gst_directdraw_sink_get_type
-GstDDrawSurface
-GST_DDRAWSURFACE
-GST_IS_DDRAWSURFACE
-GST_TYPE_DDRAWSURFACE
-DIRECTDRAW_VERSION
-</SECTION>
-
-<SECTION>
 <FILE>element-dodge</FILE>
 <TITLE>dodge</TITLE>
 GstDodge
@@ -544,20 +554,6 @@
 </SECTION>
 
 <SECTION>
-<FILE>element-eglglessink</FILE>
-<TITLE>eglglessink</TITLE>
-GstEglGlesSink
-<SUBSECTION Standard>
-GstEglGlesSinkClass
-GST_TYPE_EGLGLESSINK
-GST_EGLGLESSINK
-GST_IS_EGLGLESSINK
-GST_EGLGLESSINK_CLASS
-GST_IS_EGLGLESSINK_CLASS
-gst_eglglessink_get_type
-</SECTION>
-
-<SECTION>
 <FILE>element-exclusion</FILE>
 <TITLE>exclusion</TITLE>
 GstExclusion
@@ -923,6 +919,51 @@
 </SECTION>
 
 <SECTION>
+<FILE>element-mpegpsmux</FILE>
+<TITLE>mpegpsmux</TITLE>
+<SUBSECTION Standard>
+MpegPsMux
+GST_MPEG_PSMUX
+GST_TYPE_MPEG_PSMUX
+MpegPsMuxClass
+mpegpsmux_get_type
+<SUBSECTION Private>
+MpegPsPadData
+MpegPsPadDataPrepareFunction
+CLOCK_BASE
+CLOCK_FREQ
+GSTTIME_TO_MPEGTIME
+NORMAL_TS_PACKET_LENGTH
+M2TS_PACKET_LENGTH
+STANDARD_TIME_CLOCK
+TWO_POW_33_MINUS1
+</SECTION>
+
+<SECTION>
+<FILE>element-mpegtsmux</FILE>
+<TITLE>mpegtsmux</TITLE>
+<SUBSECTION Standard>
+MpegTsMux
+GST_MPEG_TSMUX
+GST_TYPE_MPEG_TSMUX
+MpegTsMuxClass
+mpegtsmux_get_type
+<SUBSECTION Private>
+MpegTsPadData
+CLOCK_BASE
+CLOCK_FREQ
+CLOCK_FREQ_SCR
+MPEGTIME_TO_GSTTIME
+GSTTIME_TO_MPEGTIME
+MPEG_SYS_TIME_TO_GSTTIME
+GSTTIME_TO_MPEG_SYS_TIME
+NORMAL_TS_PACKET_LENGTH
+M2TS_PACKET_LENGTH
+MAX_PROG_NUMBER
+DEFAULT_PROG_ID
+</SECTION>
+
+<SECTION>
 <FILE>element-mplex</FILE>
 <TITLE>mplex</TITLE>
 GstMplex
@@ -956,21 +997,6 @@
 </SECTION>
 
 <SECTION>
-<FILE>element-mythtvsrc</FILE>
-<TITLE>mythtvsrc</TITLE>
-GstMythtvSrc
-<SUBSECTION Standard>
-GstMythtvSrcClass
-GstMythtvState
-GST_MYTHTV_SRC
-GST_MYTHTV_SRC_CLASS
-GST_IS_MYTHTV_SRC
-GST_IS_MYTHTV_SRC_CLASS
-GST_TYPE_MYTHTV_SRC
-gst_mythtv_src_get_type
-</SECTION>
-
-<SECTION>
 <FILE>element-mxfdemux</FILE>
 <TITLE>mxfdemux</TITLE>
 GstMXFDemux
@@ -1083,6 +1109,71 @@
 gst_opencv_text_overlay_plugin_init
 </SECTION>
 
+<FILE>element-opusdec</FILE>
+<TITLE>opusdec</TITLE>
+GstOpusDec
+<SUBSECTION Standard>
+GstOpusDecClass
+gst_opus_dec_get_type
+GST_TYPE_OPUS_DEC
+GST_OPUS_DEC
+GST_OPUS_DEC_CLASS
+GST_IS_OPUS_DEC
+GST_IS_OPUS_DEC_CLASS
+</SECTION>
+
+<FILE>element-opusenc</FILE>
+<TITLE>opusenc</TITLE>
+GstOpusEnc
+<SUBSECTION Standard>
+GstOpusEncClass
+gst_opus_enc_get_type
+GST_TYPE_OPUS_ENC
+GST_OPUS_ENC
+GST_OPUS_ENC_CLASS
+GST_IS_OPUS_ENC
+GST_IS_OPUS_ENC_CLASS
+</SECTION>
+
+<FILE>element-opusparse</FILE>
+<TITLE>opusparse</TITLE>
+GstOpusParse
+<SUBSECTION Standard>
+GstOpusParseClass
+gst_opus_parse_get_type
+GST_TYPE_OPUS_PARSE
+GST_OPUS_PARSE
+GST_OPUS_PARSE_CLASS
+GST_IS_OPUS_PARSE
+GST_IS_OPUS_PARSE_CLASS
+</SECTION>
+
+<FILE>element-rtpopusdepay</FILE>
+<TITLE>rtpopusdepay</TITLE>
+GstRTPOpusDepay
+<SUBSECTION Standard>
+GstRTPOpusDepayClass
+gst_rtp_opus_depay_get_type
+GST_TYPE_RTP_OPUS_DEPAY
+GST_RTP_OPUS_DEPAY
+GST_RTP_OPUS_DEPAY_CLASS
+GST_IS_RTP_OPUS_DEPAY
+GST_IS_RTP_OPUS_DEPAY_CLASS
+</SECTION>
+
+<FILE>element-rtpopuspay</FILE>
+<TITLE>rtpopuspay</TITLE>
+GstRtpOPUSPay
+<SUBSECTION Standard>
+GstRtpOPUSPayClass
+gst_rtp_opus_pay_get_type
+GST_TYPE_RTP_OPUS_PAY
+GST_RTP_OPUS_PAY
+GST_RTP_OPUS_PAY_CLASS
+GST_IS_RTP_OPUS_PAY
+GST_IS_RTP_OPUS_PAY_CLASS
+</SECTION>
+
 <SECTION>
 <FILE>element-pcapparse</FILE>
 <TITLE>pcapparse</TITLE>
@@ -1643,56 +1734,3 @@
 GST_IS_COMPOSITOR_PAD_CLASS
 GST_TYPE_COMPOSITOR_PAD
 </SECTION>
-
-# gst-libs
-
-<SECTION>
-<FILE>gstphotography</FILE>
-<TITLE>GstPhotography</TITLE>
-GstPhotography
-GST_PHOTOGRAPHY_AUTOFOCUS_DONE
-GST_PHOTOGRAPHY_SHAKE_RISK
-GstPhotographyNoiseReduction
-GstPhotographyWhiteBalanceMode
-GstPhotographyColorToneMode
-GstPhotographySceneMode
-GstPhotographyFlashMode
-GstPhotographyFlickerReductionMode
-GstPhotographyFocusMode
-GstPhotographyFocusStatus
-GstPhotographyCaps
-GstPhotographyShakeRisk
-GstPhotographySettings
-GstPhotographyCapturePrepared
-gst_photography_get_ev_compensation
-gst_photography_get_iso_speed
-gst_photography_get_aperture
-gst_photography_get_exposure
-gst_photography_get_white_balance_mode
-gst_photography_get_color_tone_mode
-gst_photography_get_scene_mode
-gst_photography_get_flash_mode
-gst_photography_get_noise_reduction
-gst_photography_get_zoom
-gst_photography_set_ev_compensation
-gst_photography_set_iso_speed
-gst_photography_set_aperture
-gst_photography_set_exposure
-gst_photography_set_white_balance_mode
-gst_photography_set_color_tone_mode
-gst_photography_set_scene_mode
-gst_photography_set_flash_mode
-gst_photography_set_noise_reduction
-gst_photography_set_zoom
-gst_photography_get_capabilities
-gst_photography_prepare_for_capture
-gst_photography_set_autofocus
-gst_photography_set_config
-gst_photography_get_config
-<SUBSECTION Standard>
-GST_PHOTOGRAPHY
-GST_IS_PHOTOGRAPHY
-GST_PHOTOGRAPHY_GET_INTERFACE
-gst_photography_get_type
-</SECTION>
-
diff --git a/docs/plugins/gst-plugins-bad-plugins.args b/docs/plugins/gst-plugins-bad-plugins.args
index 07565cd..82ccb51 100644
--- a/docs/plugins/gst-plugins-bad-plugins.args
+++ b/docs/plugins/gst-plugins-bad-plugins.args
@@ -1339,6 +1339,36 @@
 </ARG>
 
 <ARG>
+<NAME>GstGLImageSink::context</NAME>
+<TYPE>GstGLContext*</TYPE>
+<RANGE></RANGE>
+<FLAGS>r</FLAGS>
+<NICK>OpenGL context</NICK>
+<BLURB>Get OpenGL context.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSink::handle-events</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Handle XEvents</NICK>
+<BLURB>When enabled, XEvents will be selected and handled.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSink::ignore-alpha</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Ignore Alpha</NICK>
+<BLURB>When enabled, alpha will be ignored and converted to black.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstRgAnalysis::forced</NAME>
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
@@ -1744,7 +1774,7 @@
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
 <NICK>modulation</NICK>
-<BLURB>(DVB-T and DVB-C) Modulation type.</BLURB>
+<BLURB>(DVB-T/T2/C/S2, TURBO and ATSC) Modulation type.</BLURB>
 <DEFAULT>QAM 16</DEFAULT>
 </ARG>
 
@@ -1823,8 +1853,8 @@
 <TYPE>guint</TYPE>
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
-<NICK>frequency</NICK>
-<BLURB>Frequency.</BLURB>
+<NICK>Center frequency</NICK>
+<BLURB>Center frequency to tune into. Measured in kHz for the satellite distribution standars and Hz for all the rest.</BLURB>
 <DEFAULT>0</DEFAULT>
 </ARG>
 
@@ -1854,7 +1884,7 @@
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
 <NICK>symbol rate</NICK>
-<BLURB>(DVB-S/S2, DVB-C) Symbol rate in bauds.</BLURB>
+<BLURB>(DVB-S/S2, DVB-C) Symbol rate in kBd (kilo bauds).</BLURB>
 <DEFAULT>0</DEFAULT>
 </ARG>
 
@@ -1939,6 +1969,226 @@
 </ARG>
 
 <ARG>
+<NAME>GstDvbSrc::isdbt-layer-enabled</NAME>
+<TYPE>guint</TYPE>
+<RANGE>[1,7]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer enabled</NICK>
+<BLURB>(ISDB-T) Layer Enabled (7 = All layers).</BLURB>
+<DEFAULT>7</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layera-fec</NAME>
+<TYPE>GstDvbSrcCode_Rate</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDB-T layer A FEC</NICK>
+<BLURB>(ISDB-T) layer A Forward Error Correction.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layera-modulation</NAME>
+<TYPE>GstDvbSrcModulation</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDBT layer A modulation</NICK>
+<BLURB>(ISDB-T) Layer A modulation type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layera-segment-count</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer A segment count</NICK>
+<BLURB>(ISDB-T) Layer A segment count (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layera-time-interleaving</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,8]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer A time interleaving </NICK>
+<BLURB>(ISDB-T) Layer A time interleaving (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerb-fec</NAME>
+<TYPE>GstDvbSrcCode_Rate</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDB-T layer B FEC</NICK>
+<BLURB>(ISDB-T) layer B Forward Error Correction.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerb-modulation</NAME>
+<TYPE>GstDvbSrcModulation</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDBT layer B modulation</NICK>
+<BLURB>(ISDB-T) Layer B modulation type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerb-segment-count</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer B segment count</NICK>
+<BLURB>(ISDB-T) Layer B segment count (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerb-time-interleaving</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,8]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer B time interleaving </NICK>
+<BLURB>(ISDB-T) Layer B time interleaving (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerc-fec</NAME>
+<TYPE>GstDvbSrcCode_Rate</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDB-T layer A FEC</NICK>
+<BLURB>(ISDB-T) layer C Forward Error Correction.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerc-modulation</NAME>
+<TYPE>GstDvbSrcModulation</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDBT layer C modulation</NICK>
+<BLURB>(ISDB-T) Layer C modulation type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerc-segment-count</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer C segment count</NICK>
+<BLURB>(ISDB-T) Layer C segment count (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-layerc-time-interleaving</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,8]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer C time interleaving </NICK>
+<BLURB>(ISDB-T) Layer C time interleaving (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-partial-reception</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,1]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T partial reception</NICK>
+<BLURB>(ISDB-T) Partial Reception (-1 = AUTO).</BLURB>
+<DEFAULT>1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-sb-segment-count</NAME>
+<TYPE>guint</TYPE>
+<RANGE>[1,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T SB segment count</NICK>
+<BLURB>(ISDB-T) SB segment count.</BLURB>
+<DEFAULT>1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-sb-segment-idx</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[0,12]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T SB segment IDX</NICK>
+<BLURB>(ISDB-T) SB segment IDX.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-sb-subchannel-id</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,41]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T SB subchannel ID</NICK>
+<BLURB>(ISDB-T) SB Subchannel ID (-1 = AUTO).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::isdbt-sound-broadcasting</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[0,1]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T sound broadcasting</NICK>
+<BLURB>(ISDB-T) Sound Broadcasting.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::lnb-lof1</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Low band local oscillator frequency</NICK>
+<BLURB>LNB's Local oscillator frequency used for low band reception (kHz).</BLURB>
+<DEFAULT>9750000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::lnb-lof2</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>High band local oscillator frequency</NICK>
+<BLURB>LNB's Local oscillator frequency used for high band reception (kHz).</BLURB>
+<DEFAULT>10600000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::lnb-slof</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Tuning Timeout</NICK>
+<BLURB>LNB's Upper bound for low band reception (kHz).</BLURB>
+<DEFAULT>11700000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDvbSrc::interleaving</NAME>
+<TYPE>GstDvbSrcInterleaving</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>DTMB Interleaving</NICK>
+<BLURB>(DTMB) Interleaving type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstRfbSrc::host</NAME>
 <TYPE>gchar*</TYPE>
 <RANGE></RANGE>
@@ -17159,206 +17409,6 @@
 </ARG>
 
 <ARG>
-<NAME>GstRealAudioDec::password</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Password</NICK>
-<BLURB>Password.</BLURB>
-<DEFAULT>"Ardubancel Quazanga"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::path-ra14-4</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to 14_4 driver</NICK>
-<BLURB>Path to 14_4 driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/14_4.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::path-ra28-8</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to 28_8 driver</NICK>
-<BLURB>Path to 28_8 driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/28_8.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::path-raatrk</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to atrk driver</NICK>
-<BLURB>Path to atrk driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/atrk.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::path-racook</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to cook driver</NICK>
-<BLURB>Path to cook driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/cook.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::path-rasipr</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to sipr driver</NICK>
-<BLURB>Path to sipr driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/sipr.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::ra14-4-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of 14_4 driver</NICK>
-<BLURB>Names of 14_4 driver.</BLURB>
-<DEFAULT>"14_4.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::ra28-8-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of 28_8 driver</NICK>
-<BLURB>Names of 28_8 driver.</BLURB>
-<DEFAULT>"28_8.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::raatrk-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of atrk driver</NICK>
-<BLURB>Names of atrk driver.</BLURB>
-<DEFAULT>"atrc.so:atrc.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::racook-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of cook driver</NICK>
-<BLURB>Names of cook driver.</BLURB>
-<DEFAULT>"cook.so:cook.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::rasipr-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of sipr driver</NICK>
-<BLURB>Names of sipr driver.</BLURB>
-<DEFAULT>"sipr.so:sipr.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealAudioDec::real-codecs-path</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path where to search for RealPlayer codecs</NICK>
-<BLURB>Path where to search for RealPlayer codecs.</BLURB>
-<DEFAULT>"/usr/lib64/win32:/usr/lib64/codecs:/usr/local/lib64/win32:/usr/local/lib64/codecs"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::path-rv20</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to rv20 driver</NICK>
-<BLURB>Path to rv20 driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/drv2.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::path-rv30</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to rv30 driver</NICK>
-<BLURB>Path to rv30 driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/drv3.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::path-rv40</NAME>
-<TYPE>gchararray</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path to rv40 driver</NICK>
-<BLURB>Path to rv40 driver.</BLURB>
-<DEFAULT>"/usr/lib/win32/drv4.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::real-codecs-path</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Path where to search for RealPlayer codecs</NICK>
-<BLURB>Path where to search for RealPlayer codecs.</BLURB>
-<DEFAULT>"/usr/lib64/win32:/usr/lib64/codecs:/usr/local/lib64/win32:/usr/local/lib64/codecs"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::rv20-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of rv20 driver</NICK>
-<BLURB>Names of rv20 driver.</BLURB>
-<DEFAULT>"drv2.so:drv2.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::rv30-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of rv30 driver</NICK>
-<BLURB>Names of rv30 driver.</BLURB>
-<DEFAULT>"drvc.so:drv3.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::rv40-names</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Names of rv40 driver</NICK>
-<BLURB>Names of rv40 driver.</BLURB>
-<DEFAULT>"drvc.so:drv4.so.6.0"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstRealVideoDec::max-errors</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Max errors</NICK>
-<BLURB>Maximum number of consecutive errors (0 = unlimited).</BLURB>
-<DEFAULT>25</DEFAULT>
-</ARG>
-
-<ARG>
 <NAME>GstOSXVideoSink::embed</NAME>
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
@@ -17983,8 +18033,8 @@
 <TYPE>guint</TYPE>
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
-<NICK>frequency</NICK>
-<BLURB>Frequency.</BLURB>
+<NICK>Center frequency</NICK>
+<BLURB>Center frequency to tune into. Measured in kHz for the satellite distribution standars and Hz for all the rest.</BLURB>
 <DEFAULT>0</DEFAULT>
 </ARG>
 
@@ -18034,7 +18084,7 @@
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
 <NICK>modulation</NICK>
-<BLURB>(DVB-T and DVB-C) Modulation type.</BLURB>
+<BLURB>(DVB-T/T2/C/S2, TURBO and ATSC) Modulation type.</BLURB>
 <DEFAULT>QAM 16</DEFAULT>
 </ARG>
 
@@ -18074,7 +18124,7 @@
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
 <NICK>symbol rate</NICK>
-<BLURB>(DVB-S/S2, DVB-C) Symbol rate in bauds.</BLURB>
+<BLURB>(DVB-S/S2, DVB-C) Symbol rate in kBd (kilo bauds).</BLURB>
 <DEFAULT>0</DEFAULT>
 </ARG>
 
@@ -18149,6 +18199,226 @@
 </ARG>
 
 <ARG>
+<NAME>DvbBaseBin::isdbt-layer-enabled</NAME>
+<TYPE>guint</TYPE>
+<RANGE>[1,7]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer enabled</NICK>
+<BLURB>(ISDB-T) Layer Enabled (7 = All layers).</BLURB>
+<DEFAULT>7</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layera-fec</NAME>
+<TYPE>GstDvbSrcCode_Rate</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDB-T layer A FEC</NICK>
+<BLURB>(ISDB-T) layer A Forward Error Correction.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layera-modulation</NAME>
+<TYPE>GstDvbSrcModulation</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDBT layer A modulation</NICK>
+<BLURB>(ISDB-T) Layer A modulation type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layera-segment-count</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer A segment count</NICK>
+<BLURB>(ISDB-T) Layer A segment count (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layera-time-interleaving</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,8]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer A time interleaving </NICK>
+<BLURB>(ISDB-T) Layer A time interleaving (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerb-fec</NAME>
+<TYPE>GstDvbSrcCode_Rate</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDB-T layer B FEC</NICK>
+<BLURB>(ISDB-T) layer B Forward Error Correction.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerb-modulation</NAME>
+<TYPE>GstDvbSrcModulation</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDBT layer B modulation</NICK>
+<BLURB>(ISDB-T) Layer B modulation type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerb-segment-count</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer B segment count</NICK>
+<BLURB>(ISDB-T) Layer B segment count (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerb-time-interleaving</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,8]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer B time interleaving </NICK>
+<BLURB>(ISDB-T) Layer B time interleaving (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerc-fec</NAME>
+<TYPE>GstDvbSrcCode_Rate</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDB-T layer A FEC</NICK>
+<BLURB>(ISDB-T) layer C Forward Error Correction.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerc-modulation</NAME>
+<TYPE>GstDvbSrcModulation</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISDBT layer C modulation</NICK>
+<BLURB>(ISDB-T) Layer C modulation type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerc-segment-count</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer C segment count</NICK>
+<BLURB>(ISDB-T) Layer C segment count (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-layerc-time-interleaving</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,8]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T layer C time interleaving </NICK>
+<BLURB>(ISDB-T) Layer C time interleaving (-1 = AUTO).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-partial-reception</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,1]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T partial reception</NICK>
+<BLURB>(ISDB-T) Partial Reception (-1 = AUTO).</BLURB>
+<DEFAULT>1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-sb-segment-count</NAME>
+<TYPE>guint</TYPE>
+<RANGE>[1,13]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T SB segment count</NICK>
+<BLURB>(ISDB-T) SB segment count.</BLURB>
+<DEFAULT>1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-sb-segment-idx</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[0,12]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T SB segment IDX</NICK>
+<BLURB>(ISDB-T) SB segment IDX.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-sb-subchannel-id</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[G_MAXULONG,41]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T SB subchannel ID</NICK>
+<BLURB>(ISDB-T) SB Subchannel ID (-1 = AUTO).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::isdbt-sound-broadcasting</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[0,1]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>ISB-T sound broadcasting</NICK>
+<BLURB>(ISDB-T) Sound Broadcasting.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::lnb-lof1</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Low band local oscillator frequency</NICK>
+<BLURB>LNB's Local oscillator frequency used for low band reception (kHz).</BLURB>
+<DEFAULT>9750000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::lnb-lof2</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>High band local oscillator frequency</NICK>
+<BLURB>LNB's Local oscillator frequency used for high band reception (kHz).</BLURB>
+<DEFAULT>10600000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::lnb-slof</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Tuning Timeout</NICK>
+<BLURB>LNB's Upper bound for low band reception (kHz).</BLURB>
+<DEFAULT>11700000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>DvbBaseBin::interleaving</NAME>
+<TYPE>GstDvbSrcInterleaving</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>DTMB Interleaving</NICK>
+<BLURB>(DTMB) Interleaving type.</BLURB>
+<DEFAULT>AUTO</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstSDPDemux::debug</NAME>
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
@@ -18589,81 +18859,6 @@
 </ARG>
 
 <ARG>
-<NAME>GstMythtvSrc::location</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Location</NICK>
-<BLURB>The location. In the form:
-			myth://a.com/file.nuv
-			myth://a.com:23223/file.nuv
-			myth://a.com/?channel=123
-			myth://a.com/?channel=Channel%203
-			a.com/file.nuv - default scheme 'myth'.</BLURB>
-<DEFAULT>""</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstMythtvSrc::mythtv-channel</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>mythtv-channel</NICK>
-<BLURB>Change MythTV channel number.</BLURB>
-<DEFAULT>""</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstMythtvSrc::mythtv-enable-timing-position</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>mythtv-enable-timing-position</NICK>
-<BLURB>Enable MythTV Live TV content size continuous updating.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstMythtvSrc::mythtv-live</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>mythtv-live</NICK>
-<BLURB>Enable MythTV Live TV content streaming.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstMythtvSrc::mythtv-live-chainid</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>mythtv-live-chainid</NICK>
-<BLURB>Sets the MythTV chain ID (from TV Chain).</BLURB>
-<DEFAULT>""</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstMythtvSrc::mythtv-live-id</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,200]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>mythtv-live-id</NICK>
-<BLURB>Change MythTV version.</BLURB>
-<DEFAULT>1</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstMythtvSrc::mythtv-version</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[26,30]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>mythtv-version</NICK>
-<BLURB>Change MythTV version.</BLURB>
-<DEFAULT>26</DEFAULT>
-</ARG>
-
-<ARG>
 <NAME>GstGLTestSrc::is-live</NAME>
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
@@ -45854,846 +46049,6 @@
 </ARG>
 
 <ARG>
-<NAME>GstFlacParse::check-frame-checksums</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Check Frame Checksums</NICK>
-<BLURB>Check the overall checksums of every frame.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Dec::deblocking-level</NAME>
-<TYPE>guint</TYPE>
-<RANGE><= 16</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Deblocking Level</NICK>
-<BLURB>Deblocking level.</BLURB>
-<DEFAULT>4</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Dec::noise-level</NAME>
-<TYPE>guint</TYPE>
-<RANGE><= 16</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Noise Level</NICK>
-<BLURB>Noise level.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Dec::post-processing</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Post Processing</NICK>
-<BLURB>Enable post processing.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Dec::post-processing-flags</NAME>
-<TYPE>GstVP8DecPostProcessingFlags</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Post Processing Flags</NICK>
-<BLURB>Flags to control post processing.</BLURB>
-<DEFAULT>Deblock|Demacroblock|Multi-frame quality enhancement</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Dec::threads</NAME>
-<TYPE>guint</TYPE>
-<RANGE>[1,16]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Max Threads</NICK>
-<BLURB>Maximum number of decoding threads.</BLURB>
-<DEFAULT>1</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::bitrate</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,1000000000]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Bit rate</NICK>
-<BLURB>Bit rate (in bits/sec).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::error-resilient</NAME>
-<TYPE>GstVP8EncErFlags</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Error resilient</NICK>
-<BLURB>Error resilience flags.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::max-keyframe-distance</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,9999]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Maximum Key frame distance</NICK>
-<BLURB>Maximum distance between key frames.</BLURB>
-<DEFAULT>60</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::max-latency</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,25]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Max latency</NICK>
-<BLURB>Number of frames in encoder queue.</BLURB>
-<DEFAULT>10</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::mode</NAME>
-<TYPE>GstVP8EncMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Mode</NICK>
-<BLURB>Mode.</BLURB>
-<DEFAULT>Variable Bit Rate (VBR) mode</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::quality</NAME>
-<TYPE>gdouble</TYPE>
-<RANGE>[0,10]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Quality</NICK>
-<BLURB>Quality. This parameter sets a constant quantizer.</BLURB>
-<DEFAULT>5</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::speed</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,7]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Speed</NICK>
-<BLURB>Speed.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::threads</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,64]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Threads</NICK>
-<BLURB>Number of threads to use.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::multipass-cache-file</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Multipass Cache File</NICK>
-<BLURB>Multipass cache file.</BLURB>
-<DEFAULT>"multipass.cache"</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::multipass-mode</NAME>
-<TYPE>GstVP8EncMultipassMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Multipass Mode</NICK>
-<BLURB>Multipass encode mode.</BLURB>
-<DEFAULT>One pass encoding (default)</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::auto-alt-ref-frames</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Auto Alt Ref Frames</NICK>
-<BLURB>Automatically create alternative reference frames.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::max-quantizer</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,63]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Maximum Quantizer</NICK>
-<BLURB>Maximum Quantizer (worst).</BLURB>
-<DEFAULT>63</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::min-quantizer</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,63]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Minimum Quantizer</NICK>
-<BLURB>Minimum Quantizer (best).</BLURB>
-<DEFAULT>4</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::drop-frame</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,100]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Drop Frame</NICK>
-<BLURB>Drop Frame.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::lag-in-frames</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,25]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Lag in frames</NICK>
-<BLURB>Maximum number of frames to lag.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::maxsection-pct</NAME>
-<TYPE>guint</TYPE>
-<RANGE>[200,800]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>maximum percentage allocation per section</NICK>
-<BLURB>The numbers represent a percentage of the average allocation per section (frame).</BLURB>
-<DEFAULT>800</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::minsection-pct</NAME>
-<TYPE>guint</TYPE>
-<RANGE><= 20</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>minimum percentage allocation per section</NICK>
-<BLURB>The numbers represent a percentage of the average allocation per section (frame).</BLURB>
-<DEFAULT>5</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::noise-sensitivity</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,6]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Noise sensitivity</NICK>
-<BLURB>Noise sensisivity (frames to blur).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::resize-allowed</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Resize Allowed</NICK>
-<BLURB>Allow spatial resampling.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::sharpness</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,7]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Sharpness</NICK>
-<BLURB>Filter sharpness.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::static-threshold</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Static Threshold</NICK>
-<BLURB>Motion detection threshold.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::token-parts</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,3]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Token Parts</NICK>
-<BLURB>Token Parts.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::tune</NAME>
-<TYPE>GstVP8EncTune</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Tune</NICK>
-<BLURB>Tune.</BLURB>
-<DEFAULT>Tune for PSNR</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::arnr-maxframes</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,15]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>AltRef max frames</NICK>
-<BLURB>AltRef maximum number of frames.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::arnr-strength</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,6]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>AltRef strength</NICK>
-<BLURB>AltRef strength.</BLURB>
-<DEFAULT>3</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::arnr-type</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[1,3]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>AltRef type</NICK>
-<BLURB>AltRef type.</BLURB>
-<DEFAULT>3</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::auto-alt-ref</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Auto alt reference frames</NICK>
-<BLURB>Automatically generate alt reference frames.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::buffer-initial-size</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Buffer initial size</NICK>
-<BLURB>Initial client buffer size (ms).</BLURB>
-<DEFAULT>4000</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::buffer-optimal-size</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Buffer optimal size</NICK>
-<BLURB>Optimal client buffer size (ms).</BLURB>
-<DEFAULT>5000</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::buffer-size</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Buffer size</NICK>
-<BLURB>Client buffer size (ms).</BLURB>
-<DEFAULT>6000</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::cpu-used</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[-16,16]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>CPU used</NICK>
-<BLURB>CPU used.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::cq-level</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,63]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Constrained quality level</NICK>
-<BLURB>Constrained quality level.</BLURB>
-<DEFAULT>10</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::deadline</NAME>
-<TYPE>gint64</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Deadline</NICK>
-<BLURB>Deadline per frame (usec, 0=disabled).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::dropframe-threshold</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,100]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Drop Frame Threshold</NICK>
-<BLURB>Temporal resampling threshold (buf %).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::end-usage</NAME>
-<TYPE>GstVP8EncEndUsage</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Rate control mode</NICK>
-<BLURB>Rate control mode.</BLURB>
-<DEFAULT>Variable Bit Rate (VBR) mode</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::h-scaling-mode</NAME>
-<TYPE>GstVP8EncScalingMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Horizontal scaling mode</NICK>
-<BLURB>Horizontal scaling mode.</BLURB>
-<DEFAULT>Normal</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::kf-max-dist</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Keyframe max distance</NICK>
-<BLURB>Maximum distance between keyframes (number of frames).</BLURB>
-<DEFAULT>128</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::kf-mode</NAME>
-<TYPE>GstVP8EncKfMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Keyframe Mode</NICK>
-<BLURB>Keyframe placement.</BLURB>
-<DEFAULT>Determine optimal placement automatically</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::max-intra-bitrate-pct</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Max Intra bitrate</NICK>
-<BLURB>Maximum Intra frame bitrate.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::overshoot-pct</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,1000]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Overshoot PCT</NICK>
-<BLURB>Datarate overshoot (max) target (%).</BLURB>
-<DEFAULT>100</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::resize-down-threshold</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,100]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Resize Down Threshold</NICK>
-<BLURB>Downscale threshold (buf %).</BLURB>
-<DEFAULT>60</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::resize-up-threshold</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,100]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Resize Up Threshold</NICK>
-<BLURB>Upscale threshold (buf %).</BLURB>
-<DEFAULT>30</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::target-bitrate</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Target bitrate</NICK>
-<BLURB>Target bitrate (in bits/sec).</BLURB>
-<DEFAULT>256000</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::token-partitions</NAME>
-<TYPE>GstVP8EncTokenPartitions</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Token partitions</NICK>
-<BLURB>Number of token partitions.</BLURB>
-<DEFAULT>One token partition</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::ts-layer-id</NAME>
-<TYPE>GValueArray*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Coding layer identification</NICK>
-<BLURB>Sequence defining coding layer membership.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::ts-number-layers</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[1,5]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Number of coding layers</NICK>
-<BLURB>Number of coding layers to use.</BLURB>
-<DEFAULT>1</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::ts-periodicity</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,16]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Layer periodicity</NICK>
-<BLURB>Length of sequence that defines layer membership periodicity.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::ts-rate-decimator</NAME>
-<TYPE>GValueArray*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Coding layer rate decimator</NICK>
-<BLURB>Rate decimation factors for each layer.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::ts-target-bitrate</NAME>
-<TYPE>GValueArray*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Coding layer target bitrates</NICK>
-<BLURB>Target bitrates for coding layers (one per layer, decreasing).</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::tuning</NAME>
-<TYPE>GstVP8EncTuning</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Tuning</NICK>
-<BLURB>Tuning.</BLURB>
-<DEFAULT>Tune for PSNR</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::twopass-vbr-bias-pct</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,100]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>2-pass VBR bias</NICK>
-<BLURB>CBR/VBR bias (0=CBR, 100=VBR).</BLURB>
-<DEFAULT>50</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::twopass-vbr-maxsection-pct</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>2-pass GOP max bitrate</NICK>
-<BLURB>GOP maximum bitrate (% target).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::twopass-vbr-minsection-pct</NAME>
-<TYPE>gint</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>2-pass GOP min bitrate</NICK>
-<BLURB>GOP minimum bitrate (% target).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::undershoot-pct</NAME>
-<TYPE>gint</TYPE>
-<RANGE>[0,1000]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Undershoot PCT</NICK>
-<BLURB>Datarate undershoot (min) target (%).</BLURB>
-<DEFAULT>100</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstVP8Enc::v-scaling-mode</NAME>
-<TYPE>GstVP8EncScalingMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Vertical scaling mode</NICK>
-<BLURB>Vertical scaling mode.</BLURB>
-<DEFAULT>Normal</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::aperture</NAME>
-<TYPE>guint</TYPE>
-<RANGE><= 255</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Aperture property</NICK>
-<BLURB>Aperture defines the size of lens opening  (0 = auto).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::capabilities</NAME>
-<TYPE>gulong</TYPE>
-<RANGE></RANGE>
-<FLAGS>r</FLAGS>
-<NICK>Photo capabilities bitmask</NICK>
-<BLURB>Tells the photo capabilities of the device.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::colour-tone-mode</NAME>
-<TYPE>GstColourToneMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Colour tone mode property</NICK>
-<BLURB>Colour tone setting changes colour shading in the photo.</BLURB>
-<DEFAULT>GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::ev-compensation</NAME>
-<TYPE>gfloat</TYPE>
-<RANGE>[-2.5,2.5]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>EV compensation property</NICK>
-<BLURB>EV compensation affects the brightness of the image.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::exposure</NAME>
-<TYPE>guint</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Exposure time in milliseconds</NICK>
-<BLURB>Exposure time defines how long the shutter will stay open (0 = auto).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::flash-mode</NAME>
-<TYPE>GstPhotographyFlashMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Flash mode property</NICK>
-<BLURB>Flash mode defines how the flash light should be used.</BLURB>
-<DEFAULT>GST_PHOTOGRAPHY_FLASH_MODE_AUTO</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::flicker-mode</NAME>
-<TYPE>GstPhotographyFlickerReductionMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Flicker reduction mode property</NICK>
-<BLURB>Flicker reduction mode defines a line frequency for flickering prevention.</BLURB>
-<DEFAULT>GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::focus-mode</NAME>
-<TYPE>GstPhotographyFocusMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Focus mode property</NICK>
-<BLURB>Focus mode defines the range of focal lengths to use in autofocus search.</BLURB>
-<DEFAULT>GST_PHOTOGRAPHY_FOCUS_MODE_AUTO</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::image-capture-supported-caps</NAME>
-<TYPE>GstCaps*</TYPE>
-<RANGE></RANGE>
-<FLAGS>r</FLAGS>
-<NICK>Image capture supported caps</NICK>
-<BLURB>Caps describing supported image capture formats.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::iso-speed</NAME>
-<TYPE>guint</TYPE>
-<RANGE><= 6400</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>ISO speed property</NICK>
-<BLURB>ISO speed defines the light sensitivity (0 = auto).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::scene-mode</NAME>
-<TYPE>GstPhotographySceneMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Scene mode property</NICK>
-<BLURB>Scene mode works as a preset for different photo shooting mode settings.</BLURB>
-<DEFAULT>GST_PHOTOGRAPHY_SCENE_MODE_AUTO</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::white-balance-mode</NAME>
-<TYPE>GstPhotographyWhiteBalanceMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>White balance mode property</NICK>
-<BLURB>White balance affects the color temperature of the photo.</BLURB>
-<DEFAULT>GST_PHOTOGRAPHY_WB_MODE_AUTO</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::image-preview-supported-caps</NAME>
-<TYPE>GstCaps*</TYPE>
-<RANGE></RANGE>
-<FLAGS>r</FLAGS>
-<NICK>Image preview supported caps</NICK>
-<BLURB>Caps describing supported image preview formats.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::noise-reduction</NAME>
-<TYPE>GstPhotographyNoiseReduction</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Noise Reduction settings</NICK>
-<BLURB>Which noise reduction modes are enabled (0 = disabled).</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::zoom</NAME>
-<TYPE>gfloat</TYPE>
-<RANGE>[1,10]</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Zoom property</NICK>
-<BLURB>How much the resulted image will be zoomed.</BLURB>
-<DEFAULT>1</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::analog-gain</NAME>
-<TYPE>gfloat</TYPE>
-<RANGE>>= 1</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Analog gain applied to the sensor</NICK>
-<BLURB>Analog gain applied to the sensor.</BLURB>
-<DEFAULT>1</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::color-temperature</NAME>
-<TYPE>guint</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Color temperature in Kelvin units</NICK>
-<BLURB>Color temperature in Kelvin units for manual white balance.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::color-tone-mode</NAME>
-<TYPE>GstPhotographyColorToneMode</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Color tone mode property</NICK>
-<BLURB>Color tone setting changes color shading in the photo.</BLURB>
-<DEFAULT>GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::exposure-time</NAME>
-<TYPE>guint</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Exposure time in milliseconds</NICK>
-<BLURB>Exposure time defines how long the shutter will stay open (0 = auto).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::lens-focus</NAME>
-<TYPE>gfloat</TYPE>
-<RANGE>>= 0</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Manual lens focus</NICK>
-<BLURB>Focus point in diopter units.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::max-exposure-time</NAME>
-<TYPE>guint</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Maximum exposure time</NICK>
-<BLURB>Maximum exposure time for automatic exposure mode.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::min-exposure-time</NAME>
-<TYPE>guint</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Minimum exposure time</NICK>
-<BLURB>Minimum exposure time for automatic exposure mode.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstPhotography::white-point</NAME>
-<TYPE>GValueArray*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>White point</NICK>
-<BLURB>Describe color white as raw values.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
 <NAME>GstWaterRipple::amplitude</NAME>
 <TYPE>gdouble</TYPE>
 <RANGE></RANGE>
@@ -48074,56 +47429,6 @@
 </ARG>
 
 <ARG>
-<NAME>GstLegacyH264Parse::access-unit</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Access Units</NICK>
-<BLURB>Output Acess Units rather than NALUs.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstLegacyH264Parse::config-interval</NAME>
-<TYPE>guint</TYPE>
-<RANGE><= 3600</RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>SPS PPS Send Interval</NICK>
-<BLURB>Send SPS and PPS Insertion Interval in seconds (sprop parameter sets will be multiplexed in the data stream when detected.) (0 = disabled).</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstLegacyH264Parse::output-format</NAME>
-<TYPE>GstH264ParseFormat</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Output Format</NICK>
-<BLURB>Output Format of stream (bytestream or otherwise).</BLURB>
-<DEFAULT>Input Format</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstLegacyH264Parse::split-packetized</NAME>
-<TYPE>gboolean</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Split packetized</NICK>
-<BLURB>Split NAL units of packetized streams.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GstCsp::dither</NAME>
-<TYPE>GstColorspaceDitherMethod</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Dither</NICK>
-<BLURB>Apply dithering while converting.</BLURB>
-<DEFAULT>No dithering (default)</DEFAULT>
-</ARG>
-
-<ARG>
 <NAME>MpegTSParse2::program-numbers</NAME>
 <TYPE>gchar*</TYPE>
 <RANGE></RANGE>
@@ -48134,6 +47439,36 @@
 </ARG>
 
 <ARG>
+<NAME>MpegTSParse2::pcr-pid</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= G_MAXULONG</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>PID containing PCR</NICK>
+<BLURB>Set the PID to use for PCR values (-1 for auto).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>MpegTSParse2::set-timestamps</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Timestamp (or re-timestamp) the output stream</NICK>
+<BLURB>If set, timestamps will be set on the output buffers using PCRs and smoothed over the smoothing-latency period.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>MpegTSParse2::smoothing-latency</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Smoothing Latency</NICK>
+<BLURB>Additional latency in microseconds for smoothing jitter in input timestamps on live capture.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstTSDemux::emit-stats</NAME>
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
@@ -58918,8 +58253,8 @@
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
-<NICK>Audio or voice</NICK>
-<BLURB>Audio or voice.</BLURB>
+<NICK>Audio or voice (obsolete, use audio-type)</NICK>
+<BLURB>Audio or voice (obsolete, use audio-type).</BLURB>
 <DEFAULT>TRUE</DEFAULT>
 </ARG>
 
@@ -59024,6 +58359,26 @@
 </ARG>
 
 <ARG>
+<NAME>GstOpusEnc::audio-type</NAME>
+<TYPE>GstOpusEncAudioType</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>What type of audio to optimize for</NICK>
+<BLURB>What type of audio to optimize for.</BLURB>
+<DEFAULT>Generic audio</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpusEnc::bitrate-type</NAME>
+<TYPE>GstOpusEncBitrateType</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Bitrate type</NICK>
+<BLURB>Bitrate type.</BLURB>
+<DEFAULT>CBR</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstOpusDec::apply-gain</NAME>
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
@@ -59054,6 +58409,16 @@
 </ARG>
 
 <ARG>
+<NAME>GstInterVideoSrc::timeout</NAME>
+<TYPE>guint64</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Timeout</NICK>
+<BLURB>Timeout after which to start outputting black frames.</BLURB>
+<DEFAULT>1000000000</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstInterVideoSink::channel</NAME>
 <TYPE>gchar*</TYPE>
 <RANGE></RANGE>
@@ -59094,6 +58459,36 @@
 </ARG>
 
 <ARG>
+<NAME>GstInterAudioSrc::buffer-time</NAME>
+<TYPE>guint64</TYPE>
+<RANGE>>= 1</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Buffer Time</NICK>
+<BLURB>Size of audio buffer.</BLURB>
+<DEFAULT>1000000000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstInterAudioSrc::latency-time</NAME>
+<TYPE>guint64</TYPE>
+<RANGE>>= 1</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Latency Time</NICK>
+<BLURB>Latency as reported by the source.</BLURB>
+<DEFAULT>100000000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstInterAudioSrc::period-time</NAME>
+<TYPE>guint64</TYPE>
+<RANGE>>= 1</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Period Time</NICK>
+<BLURB>The minimum amount of data to read in each iteration.</BLURB>
+<DEFAULT>25000000</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstInterAudioSink::channel</NAME>
 <TYPE>gchar*</TYPE>
 <RANGE></RANGE>
@@ -59370,7 +58765,7 @@
 <FLAGS>rw</FLAGS>
 <NICK>Flags</NICK>
 <BLURB>Flags to cvHaarDetectObjects.</BLURB>
-<DEFAULT></DEFAULT>
+<DEFAULT>Do Canny edge detection to discard some regions</DEFAULT>
 </ARG>
 
 <ARG>
@@ -59390,7 +58785,7 @@
 <FLAGS>rw</FLAGS>
 <NICK>Minimum face height</NICK>
 <BLURB>Minimum area height to be recognized as a face.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>30</DEFAULT>
 </ARG>
 
 <ARG>
@@ -59400,7 +58795,7 @@
 <FLAGS>rw</FLAGS>
 <NICK>Minimum face width</NICK>
 <BLURB>Minimum area width to be recognized as a face.</BLURB>
-<DEFAULT>0</DEFAULT>
+<DEFAULT>30</DEFAULT>
 </ARG>
 
 <ARG>
@@ -59440,7 +58835,7 @@
 <FLAGS>rw</FLAGS>
 <NICK>Scale factor</NICK>
 <BLURB>Factor by which the frame is scaled after each object scan.</BLURB>
-<DEFAULT>1.1</DEFAULT>
+<DEFAULT>1.25</DEFAULT>
 </ARG>
 
 <ARG>
@@ -59454,6 +58849,16 @@
 </ARG>
 
 <ARG>
+<NAME>GstFaceDetect::min-stddev</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[0,255]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Minimum image standard deviation</NICK>
+<BLURB>Minimum image average standard deviation: on images with standard deviation lesser than this value facedetection will not be performed. Setting this property help to save cpu and reduce false positives not performing face detection on images with little changes.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstFaceBlur::profile</NAME>
 <TYPE>gchar*</TYPE>
 <RANGE></RANGE>
@@ -59464,6 +58869,56 @@
 </ARG>
 
 <ARG>
+<NAME>GstFaceBlur::flags</NAME>
+<TYPE>GstOpencvFaceBlurFlags</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Flags</NICK>
+<BLURB>Flags to cvHaarDetectObjects.</BLURB>
+<DEFAULT>Do Canny edge detection to discard some regions</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstFaceBlur::min-neighbors</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Mininum neighbors</NICK>
+<BLURB>Minimum number (minus 1) of neighbor rectangles that makes up an object.</BLURB>
+<DEFAULT>3</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstFaceBlur::min-size-height</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Minimum size height</NICK>
+<BLURB>Minimum window height size.</BLURB>
+<DEFAULT>30</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstFaceBlur::min-size-width</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Minimum size width</NICK>
+<BLURB>Minimum window width size.</BLURB>
+<DEFAULT>30</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstFaceBlur::scale-factor</NAME>
+<TYPE>gdouble</TYPE>
+<RANGE>[1.1,10]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Scale factor</NICK>
+<BLURB>Factor by which the windows is scaled after each scan.</BLURB>
+<DEFAULT>1.25</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstEdgeDetect::aperture</NAME>
 <TYPE>gint</TYPE>
 <RANGE>[3,7]</RANGE>
@@ -60369,7 +59824,7 @@
 <RANGE>[0,1]</RANGE>
 <FLAGS>rw</FLAGS>
 <NICK>Bandwidth usage [0..1]</NICK>
-<BLURB>Percentage of the available bandwidth to use when selecting representations.</BLURB>
+<BLURB>Percentage of the available bandwidth to use when selecting representations (deprecated).</BLURB>
 <DEFAULT>0.8</DEFAULT>
 </ARG>
 
@@ -60580,10 +60035,10 @@
 <ARG>
 <NAME>GstHlsSink::playlist-length</NAME>
 <TYPE>guint</TYPE>
-<RANGE>>= 1</RANGE>
+<RANGE></RANGE>
 <FLAGS>rw</FLAGS>
 <NICK>Playlist length</NICK>
-<BLURB>Length of HLS playlist. To allow players to conform to section 6.3.3 of the HLS specification, this should be at least 3.</BLURB>
+<BLURB>Length of HLS playlist. To allow players to conform to section 6.3.3 of the HLS specification, this should be at least 3. If set to 0, the playlist will be infinite.</BLURB>
 <DEFAULT>5</DEFAULT>
 </ARG>
 
@@ -60688,6 +60143,16 @@
 </ARG>
 
 <ARG>
+<NAME>GstAudioMixer::output-buffer-duration</NAME>
+<TYPE>guint64</TYPE>
+<RANGE>>= 1</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Output Buffer Duration</NICK>
+<BLURB>Output block size in nanoseconds.</BLURB>
+<DEFAULT>10000000</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstDaalaEnc::keyframe-rate</NAME>
 <TYPE>gint</TYPE>
 <RANGE>>= 1</RANGE>
@@ -67532,8 +66997,8 @@
 <TYPE>gchar*</TYPE>
 <RANGE></RANGE>
 <FLAGS>rw</FLAGS>
-<NICK>Location of the image</NICK>
-<BLURB>Location of the image.</BLURB>
+<NICK>location</NICK>
+<BLURB>Location of image file to overlay.</BLURB>
 <DEFAULT>NULL</DEFAULT>
 </ARG>
 
@@ -67646,6 +67111,76 @@
 </ARG>
 
 <ARG>
+<NAME>GstGLOverlay::alpha</NAME>
+<TYPE>gdouble</TYPE>
+<RANGE>[0,1]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Alpha</NICK>
+<BLURB>Global alpha of overlay image.</BLURB>
+<DEFAULT>1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLOverlay::offset-x</NAME>
+<TYPE>gint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>X Offset</NICK>
+<BLURB>For positive value, horizontal offset of overlay image in pixels from left of video image. For negative value, horizontal offset of overlay image in pixels from right of video image.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLOverlay::offset-y</NAME>
+<TYPE>gint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Y Offset</NICK>
+<BLURB>For positive value, vertical offset of overlay image in pixels from top of video image. For negative value, vertical offset of overlay image in pixels from bottom of video image.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLOverlay::overlay-height</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Overlay Height</NICK>
+<BLURB>Height of overlay image in pixels (0 = same as overlay image).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLOverlay::overlay-width</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Overlay Width</NICK>
+<BLURB>Width of overlay image in pixels (0 = same as overlay image).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLOverlay::relative-x</NAME>
+<TYPE>gdouble</TYPE>
+<RANGE>[0,1]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Relative X Offset</NICK>
+<BLURB>Horizontal offset of overlay image in fractions of video image width, from top-left corner of video image.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLOverlay::relative-y</NAME>
+<TYPE>gdouble</TYPE>
+<RANGE>[0,1]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Relative Y Offset</NICK>
+<BLURB>Vertical offset of overlay image in fractions of video image height, from top-left corner of video image.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
 <NAME>GstGLFilterSobel::invert</NAME>
 <TYPE>gboolean</TYPE>
 <RANGE></RANGE>
@@ -67761,7 +67296,7 @@
 <RANGE>[0,1]</RANGE>
 <FLAGS>rw</FLAGS>
 <NICK>Green</NICK>
-<BLURB>Background reen color.</BLURB>
+<BLURB>Background green color.</BLURB>
 <DEFAULT>0</DEFAULT>
 </ARG>
 
@@ -67875,3 +67410,603 @@
 <DEFAULT>Checker pattern</DEFAULT>
 </ARG>
 
+<ARG>
+<NAME>GstGLVideoMixer::background</NAME>
+<TYPE>GstGLVideoMixerBackground</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Background</NICK>
+<BLURB>Background type.</BLURB>
+<DEFAULT>Checker pattern</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstWebpEnc::lossless</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Lossless</NICK>
+<BLURB>Enable lossless encoding.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstWebpEnc::preset</NAME>
+<TYPE>GstWebpEncPreset</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>preset tuning</NICK>
+<BLURB>Preset name for visual tuning.</BLURB>
+<DEFAULT>Outdoor photo, natural lighting</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstWebpEnc::quality</NAME>
+<TYPE>gfloat</TYPE>
+<RANGE>[0,100]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>quality-level</NICK>
+<BLURB>quality level, between 0 (smallest file) and 100 (biggest).</BLURB>
+<DEFAULT>90</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstWebpEnc::speed</NAME>
+<TYPE>guint</TYPE>
+<RANGE><= 6</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Compression Method</NICK>
+<BLURB>quality/speed trade-off (0=fast, 6=slower-better).</BLURB>
+<DEFAULT>4</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstRtpH265Pay::config-interval</NAME>
+<TYPE>guint</TYPE>
+<RANGE><= 3600</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>VPS SPS PPS Send Interval</NICK>
+<BLURB>Send VPS, SPS and PPS Insertion Interval in seconds (sprop parameter sets will be multiplexed in the data stream when detected.) (0 = disabled).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstRtpH265Pay::sprop-parameter-sets</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>sprop-parameter-sets</NICK>
+<BLURB>The base64 sprop-parameter-sets to set in out caps (set to NULL to extract from stream).</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstRtpOnvifTimestamp::cseq</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>CSeq</NICK>
+<BLURB>The RTSP CSeq which initiated the playback.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstRtpOnvifTimestamp::ntp-offset</NAME>
+<TYPE>guint64</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>NTP offset</NICK>
+<BLURB>Offset between the pipeline running time and the absolute UTC time, in nano-seconds since 1900 (-1 for automatic computation).</BLURB>
+<DEFAULT>18446744073709551615</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstRtpOnvifTimestamp::set-e-bit</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Set 'E' bit</NICK>
+<BLURB>If the element should set the 'E' bit as defined in the ONVIF RTP extension. This increases latency by one packet.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSrc::buffer-size</NAME>
+<TYPE>guint</TYPE>
+<RANGE>[1,G_MAXINT]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Buffer Size</NICK>
+<BLURB>Size of internal buffer in number of video frames.</BLURB>
+<DEFAULT>5</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSrc::connection</NAME>
+<TYPE>GstDecklinkConnection</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Connection</NICK>
+<BLURB>Video input connection to use.</BLURB>
+<DEFAULT>auto</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSrc::device-number</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Device number</NICK>
+<BLURB>Output device instance to use.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSrc::mode</NAME>
+<TYPE>GstDecklinkModes</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Playback Mode</NICK>
+<BLURB>Video Mode to use for playback.</BLURB>
+<DEFAULT>auto</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSink::device-number</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Device number</NICK>
+<BLURB>Output device instance to use.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSink::mode</NAME>
+<TYPE>GstDecklinkModes</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Playback Mode</NICK>
+<BLURB>Video Mode to use for playback.</BLURB>
+<DEFAULT>ntsc</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkAudioSrc::alignment-threshold</NAME>
+<TYPE>guint64</TYPE>
+<RANGE><= 18446744073709551614</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Alignment Threshold</NICK>
+<BLURB>Timestamp alignment threshold in nanoseconds.</BLURB>
+<DEFAULT>40000000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkAudioSrc::buffer-size</NAME>
+<TYPE>guint</TYPE>
+<RANGE>[1,G_MAXINT]</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Buffer Size</NICK>
+<BLURB>Size of internal buffer in number of video frames.</BLURB>
+<DEFAULT>5</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkAudioSrc::connection</NAME>
+<TYPE>GstDecklinkAudioConnection</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Connection</NICK>
+<BLURB>Audio input connection to use.</BLURB>
+<DEFAULT>auto</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkAudioSrc::device-number</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Device number</NICK>
+<BLURB>Output device instance to use.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkAudioSrc::discont-wait</NAME>
+<TYPE>guint64</TYPE>
+<RANGE><= 18446744073709551614</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Discont Wait</NICK>
+<BLURB>Window of time in nanoseconds to wait before creating a discontinuity.</BLURB>
+<DEFAULT>1000000000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkAudioSink::device-number</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Device number</NICK>
+<BLURB>Output device instance to use.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::adaptive-quantization</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Adaptive quantization</NICK>
+<BLURB>Adaptive quantization.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::background-detection</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Background detection</NICK>
+<BLURB>Background detection.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::bitrate</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Bitrate</NICK>
+<BLURB>Bitrate (in bits per second).</BLURB>
+<DEFAULT>128000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::deblocking</NAME>
+<TYPE>GstOpenh264encDeblockingModes</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Deblocking mode</NICK>
+<BLURB>Deblocking mode.</BLURB>
+<DEFAULT>Deblocking on</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::enable-denoise</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Denoise Control</NICK>
+<BLURB>Denoise control.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::enable-frame-skip</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Skip Frames</NICK>
+<BLURB>Skip frames to reach target bitrate.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::gop-size</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>GOP size</NICK>
+<BLURB>Number of frames between intra frames.</BLURB>
+<DEFAULT>90</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::max-slice-size</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Max slice size</NICK>
+<BLURB>The maximum size of one slice (in bytes).</BLURB>
+<DEFAULT>1500000</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::multi-thread</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Number of threads</NICK>
+<BLURB>The number of threads.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::num-slices</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Number of slices</NICK>
+<BLURB>The number of slices (needs slice-mode=n-slices).</BLURB>
+<DEFAULT>1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::rate-control</NAME>
+<TYPE>RC_MODES</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Rate control</NICK>
+<BLURB>Rate control mode.</BLURB>
+<DEFAULT>Quality mode</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::scene-change-detection</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Scene change detection</NICK>
+<BLURB>Scene change detection.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::slice-mode</NAME>
+<TYPE>GstOpenh264encSliceModes</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Slice mode</NICK>
+<BLURB>Slice mode.</BLURB>
+<DEFAULT>num-slices slices</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstOpenh264Enc::usage-type</NAME>
+<TYPE>EUsageType</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Usage type</NICK>
+<BLURB>Type of video content.</BLURB>
+<DEFAULT>video from camera</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstLibde265Dec::max-threads</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Maximum decode threads</NICK>
+<BLURB>Maximum number of worker threads to spawn. (0 = auto).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLVideoMixerBin::background</NAME>
+<TYPE>GstGLVideoMixerBackground</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Background</NICK>
+<BLURB>Background type.</BLURB>
+<DEFAULT>Checker pattern</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLSrcBin::src</NAME>
+<TYPE>GstElement*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>GL src element</NICK>
+<BLURB>The GL src chain to use.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLSinkBin::force-aspect-ratio</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Force aspect ratio</NICK>
+<BLURB>When enabled, scaling will respect original aspect ratio.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLSinkBin::sink</NAME>
+<TYPE>GstElement*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>GL sink element</NICK>
+<BLURB>The GL sink chain to use.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLMixerBin::latency</NAME>
+<TYPE>gint64</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Buffer latency</NICK>
+<BLURB>Additional latency in live mode to allow upstream to take longer to produce buffers for the current position.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLMixerBin::mixer</NAME>
+<TYPE>GstElement*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>GL mixer element</NICK>
+<BLURB>The GL mixer chain to use.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::async</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Async</NICK>
+<BLURB>Go asynchronously to PAUSED.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::blocksize</NAME>
+<TYPE>guint</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Block size</NICK>
+<BLURB>Size in bytes to pull per buffer (0 = default).</BLURB>
+<DEFAULT>4096</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::context</NAME>
+<TYPE>GstGLContext*</TYPE>
+<RANGE></RANGE>
+<FLAGS>r</FLAGS>
+<NICK>OpenGL context</NICK>
+<BLURB>Get OpenGL context.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::enable-last-sample</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Enable Last Buffer</NICK>
+<BLURB>Enable the last-sample property.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::force-aspect-ratio</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Force aspect ratio</NICK>
+<BLURB>When enabled, scaling will respect original aspect ratio.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::ignore-alpha</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Ignore Alpha</NICK>
+<BLURB>When enabled, alpha will be ignored and converted to black.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::last-sample</NAME>
+<TYPE>GstSample*</TYPE>
+<RANGE></RANGE>
+<FLAGS>r</FLAGS>
+<NICK>Last Sample</NICK>
+<BLURB>The last sample received in the sink.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::max-bitrate</NAME>
+<TYPE>guint64</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Max Bitrate</NICK>
+<BLURB>The maximum bits per second to render (0 = disabled).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::max-lateness</NAME>
+<TYPE>gint64</TYPE>
+<RANGE>>= G_MAXULONG</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Max Lateness</NICK>
+<BLURB>Maximum number of nanoseconds that a buffer can be late before it is dropped (-1 unlimited).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::pixel-aspect-ratio</NAME>
+<TYPE>GstFraction</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Pixel Aspect Ratio</NICK>
+<BLURB>The pixel aspect ratio of the device.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::qos</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Qos</NICK>
+<BLURB>Generate Quality-of-Service events upstream.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::render-delay</NAME>
+<TYPE>guint64</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Render Delay</NICK>
+<BLURB>Additional render delay of the sink in nanoseconds.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::show-preroll-frame</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Show preroll frame</NICK>
+<BLURB>Whether to render video frames during preroll.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::sync</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Sync</NICK>
+<BLURB>Sync on the clock.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::throttle-time</NAME>
+<TYPE>guint64</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Throttle time</NICK>
+<BLURB>The time to keep between rendered buffers (0 = disabled).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLImageSinkBin::ts-offset</NAME>
+<TYPE>gint64</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>TS Offset</NICK>
+<BLURB>Timestamp offset in nanoseconds.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstGLFilterBin::filter</NAME>
+<TYPE>GstElement*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>GL filter element</NICK>
+<BLURB>The GL filter chain to use.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
diff --git a/docs/plugins/gst-plugins-bad-plugins.hierarchy b/docs/plugins/gst-plugins-bad-plugins.hierarchy
index 2df71bd..90776fc 100644
--- a/docs/plugins/gst-plugins-bad-plugins.hierarchy
+++ b/docs/plugins/gst-plugins-bad-plugins.hierarchy
@@ -3,6 +3,8 @@
     GstObject
       GstAllocator
         GstAllocatorSysmem
+        GstVdpVideoAllocator
+        GstWlShmAllocator
       GstAudioRingBuffer
         GstAudioSinkRingBuffer
         GstAudioSrcRingBuffer
@@ -14,11 +16,12 @@
       GstControlSource
       GstElement
         GstAggregator
+          GstAudioMixer
           GstVideoAggregator
             GstCompositor
-            GstGLMixer
-              GstGLMosaic
-              GstGLVideoMixer
+            GstGLBaseMixer
+              GstGLMixer
+                GstGLMosaic
         GstAiffMux
         GstAiffParse
         GstAsfMux
@@ -34,13 +37,13 @@
           GstSirenDec
         GstAudioEncoder
           ADPCMEnc
+          GstFaac
           GstGSMEnc
           GstOpusEnc
           GstSbcEnc
           GstSirenEnc
           GstVoAacEnc
           GstVoAmrWbEnc
-        GstAudioMixer
         GstAudioVisualizer-BadGstAudioVisualizers
           GstSpaceScope
           GstSpectraScope
@@ -54,6 +57,7 @@
           GstH265Parse
           GstIRTSPParse
           GstIvfParse
+          GstJpegParse
           GstMpeg4VParse
           GstMpegvParse
           GstOpusParse
@@ -63,24 +67,28 @@
           GstAudioBaseSink
             GstAudioSink
               GstOpenALSink
+            GstDecklinkAudioSink
+          GstAvdtpSink
           GstChecksumSink
           GstCurlBaseSink
             GstCurlFileSink
+            GstCurlSshSink
+              GstCurlSftpSink
             GstCurlTlsSink
               GstCurlFtpSink
               GstCurlHttpSink
               GstCurlSmtpSink
+          GstDecklinkVideoSink
           GstInterAudioSink
           GstInterSubSink
           GstInterVideoSink
           GstRTMPSink
           GstShmSink
           GstVideoSink
-            GstDfbVideoSink
             GstFBDEVSink
-            GstGLImageSink
             GstWaylandSink
         GstBaseSrc
+          GstAvdtpSrc
           GstDataURISrc
           GstFliteTestSrc
           GstInterAudioSrc
@@ -93,12 +101,16 @@
             GstAudioBaseSrc
               GstAudioSrc
                 GstOpenalSrc
+            GstDecklinkAudioSrc
+            GstDecklinkVideoSrc
             GstDvbSrc
             GstGLTestSrc
             GstMMS
+            GstNeonhttpSrc
             GstRTMPSrc
             GstRfbSrc
             GstShmSrc
+            GstVCDSrc
         GstBaseTransform
           GstAudioFilter
             GstAccurip
@@ -118,23 +130,24 @@
             GstStereo
           GstBayer2RGB
           GstDebugSpy
-          GstDtmfDetect
           GstFreeverb
-          GstGLFilter
-            GstGLBumper
-            GstGLColorscale
-            GstGLDeinterlace
-            GstGLDifferenceMatte
-            GstGLEffects
-            GstGLFilterApp
-            GstGLFilterBlur
-            GstGLFilterCube
-            GstGLFilterGlass
-            GstGLFilterLaplacian
-            GstGLFilterReflectedScreen
-            GstGLFilterShader
-            GstGLFilterSobel
-            GstGLOverlay
+          GstGLBaseFilter
+            GstGLColorConvertElement
+            GstGLDownloadElement
+            GstGLFilter
+              GstGLColorscale
+              GstGLDeinterlace
+              GstGLDifferenceMatte
+              GstGLEffects
+              GstGLFilterApp
+              GstGLFilterBlur
+              GstGLFilterCube
+              GstGLFilterGlass
+              GstGLFilterLaplacian
+              GstGLFilterShader
+              GstGLFilterSobel
+              GstGLOverlay
+            GstGLUploadElement
           GstIvtc
           GstRGB2Bayer
           GstRemoveSilence
@@ -189,22 +202,29 @@
             GstSolarize
             GstVideoAnalyse
             GstVideoDiff
-            GstZBar
             GstZebraStripe
           GstWatchdog
           GstYadif
         GstBin
           DvbBaseBin
+          GstA2dpSink
+          GstAdaptiveDemux
+            GstDashDemux
+            GstHLSDemux
+            GstMssDemux
           GstAutoConvert
           GstAutoVideoConvert
           GstBaseCameraSrc
             GstUvcH264Src
             GstWrapperCameraBinSrc
-          GstDashDemux
           GstFPSDisplaySink
-          GstHLSDemux
+          GstGLFilterBin
+          GstGLMixerBin
+            GstGLVideoMixerBin
+          GstGLSinkBin
+            GstGLImageSinkBin
+          GstGLSrcBin
           GstHlsSink
-          GstMssDemux
           GstPipeline
             GstCameraBin
           GstSDPDemux
@@ -216,8 +236,6 @@
         GstCompare
         GstDVBSubOverlay
         GstDVDSpu
-        GstDecklinkSink
-        GstDecklinkSrc
         GstDisparity
         GstEdgeDetect
         GstFestival
@@ -229,7 +247,6 @@
         GstInterlace
         GstJP2kDecimator
         GstJifMux
-        GstJpegParse
         GstKateDec
         GstKateEnc
         GstKateParse
@@ -247,21 +264,23 @@
         GstOpencvTextOverlay
         GstPcapParse
         GstPitch
-        GstPnmenc
         GstPyramidSegment
         GstRTPBaseDepayload
           GstRTPOpusDepay
+          GstRtpH265Depay
         GstRTPBasePayload
           GstRtpAsfPay
+          GstRtpH265Pay
           GstRtpOPUSPay
         GstRawParse
           GstAudioParse
           GstVideoParse
+        GstRtpOnvifParse
+        GstRtpOnvifTimestamp
         GstSFDec
         GstSegmentClip
           GstAudioSegmentClip
           GstVideoSegmentClip
-        GstSpanPlc
         GstSpeed
         GstSrtEnc
         GstSrtpDec
@@ -271,16 +290,23 @@
         GstTemplateMatch
         GstUvcH264MjpgDemux
         GstVideoDecoder
+          GstLibde265Dec
           GstOpenEXRDec
           GstOpenJPEGDec
+          GstOpenh264Dec
           GstPnmdec
           GstRsvgDec
           GstSchroDec
           GstVMncDec
+          GstVdpDecoder
+            GstVdpMpegDec
           GstWebPDec
         GstVideoEncoder
           GstOpenJPEGEnc
+          GstOpenh264Enc
+          GstPnmenc
           GstSchroEnc
+          GstWebpEnc
         GstWebvttEnc
         GstWildmidi
         GstY4mDec
@@ -292,10 +318,11 @@
       GstGLContext
       GstPad
         GstAggregatorPad
+          GstAudioMixerPad
           GstVideoAggregatorPad
             GstCompositorPad
-            GstGLMixerPad
-              GstGLVideoMixerPad
+            GstGLBaseMixerPad
+              GstGLMixerPad
       GstPadTemplate
       GstPlugin
       GstPluginFeature
@@ -305,8 +332,8 @@
       GstRegistry
       GstTask
       GstTaskPool
-  GstColorBalanceChannel
   GstEncodingProfile
+  GstVdpDevice
   MXFMetadataBase
     MXFDescriptiveMetadata
       MXFDMS1
@@ -383,9 +410,7 @@
 GInterface
   GTypePlugin
   GstChildProxy
-  GstColorBalance
   GstNavigation
-  GstPhotography
   GstPreset
   GstTagSetter
   GstTagXmpWriter
diff --git a/docs/plugins/gst-plugins-bad-plugins.interfaces b/docs/plugins/gst-plugins-bad-plugins.interfaces
index a1abf41..b2425c6 100644
--- a/docs/plugins/gst-plugins-bad-plugins.interfaces
+++ b/docs/plugins/gst-plugins-bad-plugins.interfaces
@@ -1,6 +1,7 @@
 ADPCMEnc GstPreset
 DvbBaseBin GstChildProxy GstURIHandler
 GstA2dpSink GstChildProxy
+GstAdaptiveDemux GstChildProxy
 GstAmrWbEnc GstPreset
 GstApExSink GstImplementsInterface GstMixer
 GstAsfMux GstTagSetter
@@ -27,10 +28,18 @@
 GstFaac GstPreset
 GstFaceOverlay GstChildProxy
 GstFreeverb GstPreset
+GstGLBaseMixer GstChildProxy
+GstGLFilterBin GstChildProxy
 GstGLImageSink GstVideoOverlay
+GstGLImageSink GstVideoOverlay GstNavigation
+GstGLImageSinkBin GstChildProxy GstVideoOverlay GstNavigation
 GstGLMixer GstChildProxy
+GstGLMixerBin GstChildProxy
 GstGLMosaic GstChildProxy
+GstGLSinkBin GstChildProxy GstVideoOverlay GstNavigation
+GstGLSrcBin GstChildProxy
 GstGLVideoMixer GstChildProxy
+GstGLVideoMixerBin GstChildProxy
 GstGSMEnc GstPreset
 GstGSettingsAudioSink GstChildProxy
 GstGSettingsAudioSrc GstChildProxy
@@ -52,8 +61,10 @@
 GstMythtvSrc GstURIHandler
 GstNeonhttpSrc GstURIHandler
 GstOpenJPEGEnc GstPreset
+GstOpenh264Enc GstPreset
 GstOpusEnc GstPreset GstTagSetter
 GstPipeline GstChildProxy
+GstPnmenc GstPreset
 GstRTMPSink GstURIHandler
 GstRTMPSrc GstURIHandler
 GstSDLVideoSink GstImplementsInterface GstXOverlay GstNavigation
@@ -72,6 +83,7 @@
 GstVoAacEnc GstPreset
 GstVoAmrWbEnc GstPreset
 GstWaylandSink GstVideoOverlay GstWaylandVideo
+GstWebpEnc GstPreset
 GstWrapperCameraBinSrc GstChildProxy
 GstXvidEnc GstPreset
 MXFDMS1ClipFramework MXFDescriptiveMetadataFrameworkInterface
diff --git a/docs/plugins/gst-plugins-bad-plugins.prerequisites b/docs/plugins/gst-plugins-bad-plugins.prerequisites
index aff93ba..993b636 100644
--- a/docs/plugins/gst-plugins-bad-plugins.prerequisites
+++ b/docs/plugins/gst-plugins-bad-plugins.prerequisites
@@ -1,11 +1,5 @@
 GstChildProxy GObject
-GstChildProxy GstObject
-GstColorBalance GstImplementsInterface GstElement
-GstImplementsInterface GstElement
-GstMixer GstImplementsInterface GstElement
-GstPhotography GstImplementsInterface GstElement
 GstTagSetter GstElement
 GstTagXmpWriter GstElement
 GstWaylandVideo GstVideoOverlay
-GstXOverlay GstImplementsInterface GstElement
 MXFDescriptiveMetadataFrameworkInterface MXFDescriptiveMetadata
diff --git a/docs/plugins/gst-plugins-bad-plugins.signals b/docs/plugins/gst-plugins-bad-plugins.signals
index d9cc154..7c57afa 100644
--- a/docs/plugins/gst-plugins-bad-plugins.signals
+++ b/docs/plugins/gst-plugins-bad-plugins.signals
@@ -619,6 +619,13 @@
 </SIGNAL>
 
 <SIGNAL>
+<NAME>GstDvbSrc::tune</NAME>
+<RETURNS>void</RETURNS>
+<FLAGS>la</FLAGS>
+GstDvbSrc *gstdvbsrc
+</SIGNAL>
+
+<SIGNAL>
 <NAME>DvbBaseBin::tuning-done</NAME>
 <RETURNS>void</RETURNS>
 <FLAGS>l</FLAGS>
@@ -640,13 +647,21 @@
 </SIGNAL>
 
 <SIGNAL>
+<NAME>DvbBaseBin::tune</NAME>
+<RETURNS>void</RETURNS>
+<FLAGS>la</FLAGS>
+DvbBaseBin *dvbbasebin
+</SIGNAL>
+
+<SIGNAL>
 <NAME>GstGLImageSink::client-draw</NAME>
 <RETURNS>gboolean</RETURNS>
 <FLAGS>l</FLAGS>
 GstGLImageSink *gstglimagesink
-guint  arg1
+GstGLContext *arg1
 guint  arg2
 guint  arg3
+guint  arg4
 </SIGNAL>
 
 <SIGNAL>
@@ -654,8 +669,9 @@
 <RETURNS>gboolean</RETURNS>
 <FLAGS>l</FLAGS>
 GstGLImageSink *gstglimagesink
-guint  arg1
+GstGLContext *arg1
 guint  arg2
+guint  arg3
 </SIGNAL>
 
 <SIGNAL>
@@ -668,3 +684,52 @@
 guint  arg3
 </SIGNAL>
 
+<SIGNAL>
+<NAME>GstGLSrcBin::create-element</NAME>
+<RETURNS>GstElement*</RETURNS>
+<FLAGS>l</FLAGS>
+GstGLSrcBin *gstglsrcbin
+</SIGNAL>
+
+<SIGNAL>
+<NAME>GstGLSinkBin::create-element</NAME>
+<RETURNS>GstElement*</RETURNS>
+<FLAGS>l</FLAGS>
+GstGLSinkBin *gstglsinkbin
+</SIGNAL>
+
+<SIGNAL>
+<NAME>GstGLMixerBin::create-element</NAME>
+<RETURNS>GstElement*</RETURNS>
+<FLAGS>l</FLAGS>
+GstGLMixerBin *gstglmixerbin
+</SIGNAL>
+
+<SIGNAL>
+<NAME>GstGLImageSinkBin::client-draw</NAME>
+<RETURNS>gboolean</RETURNS>
+<FLAGS>l</FLAGS>
+GstGLImageSinkBin *gstglimagesinkbin
+GstGLContext *arg1
+guint  arg2
+guint  arg3
+guint  arg4
+</SIGNAL>
+
+<SIGNAL>
+<NAME>GstGLImageSinkBin::client-reshape</NAME>
+<RETURNS>gboolean</RETURNS>
+<FLAGS>l</FLAGS>
+GstGLImageSinkBin *gstglimagesinkbin
+GstGLContext *arg1
+guint  arg2
+guint  arg3
+</SIGNAL>
+
+<SIGNAL>
+<NAME>GstGLFilterBin::create-element</NAME>
+<RETURNS>GstElement*</RETURNS>
+<FLAGS>l</FLAGS>
+GstGLFilterBin *gstglfilterbin
+</SIGNAL>
+
diff --git a/docs/plugins/gst-plugins-bad-plugins.types b/docs/plugins/gst-plugins-bad-plugins.types
index 3117ba5..e69de29 100644
--- a/docs/plugins/gst-plugins-bad-plugins.types
+++ b/docs/plugins/gst-plugins-bad-plugins.types
@@ -1,6 +0,0 @@
-#include <gst/gst.h>
-
-#include <gst/interfaces/photography.h>
-
-gst_photography_get_type
-
diff --git a/docs/plugins/html/GstPhotography.html b/docs/plugins/html/GstPhotography.html
deleted file mode 100644
index d023224..0000000
--- a/docs/plugins/html/GstPhotography.html
+++ /dev/null
@@ -1,1642 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: GstPhotography</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
-<link rel="up" href="ch03.html" title="gst-plugins-bad Interfaces">
-<link rel="prev" href="ch03.html" title="gst-plugins-bad Interfaces">
-<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
-<link rel="stylesheet" href="style.css" type="text/css">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
-<td width="100%" align="left" class="shortcuts">
-<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#GstPhotography.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
-                  <a href="#GstPhotography.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_prerequisites">  <span class="dim">|</span> 
-                  <a href="#GstPhotography.prerequisites" class="shortcut">Prerequisites</a></span><span id="nav_properties">  <span class="dim">|</span> 
-                  <a href="#GstPhotography.properties" class="shortcut">Properties</a></span>
-</td>
-<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
-<td><a accesskey="u" href="ch03.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="ch03.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><img src="right-insensitive.png" width="16" height="16" border="0"></td>
-</tr></table>
-<div class="refentry">
-<a name="GstPhotography"></a><div class="titlepage"></div>
-<div class="refnamediv"><table width="100%"><tr>
-<td valign="top">
-<h2><span class="refentrytitle"><a name="GstPhotography.top_of_page"></a>GstPhotography</span></h2>
-<p>GstPhotography</p>
-</td>
-<td class="gallery_image" valign="top" align="right"></td>
-</tr></table></div>
-<div class="refsect1">
-<a name="GstPhotography.functions"></a><h2>Functions</h2>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="functions_return">
-<col class="functions_name">
-</colgroup>
-<tbody>
-<tr>
-<td class="function_type">
-<span class="returnvalue">void</span>
-</td>
-<td class="function_name">
-<span class="c_punctuation">(</span><a class="link" href="GstPhotography.html#GstPhotographyCapturePrepared" title="GstPhotographyCapturePrepared ()">*GstPhotographyCapturePrepared</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-ev-compensation" title="gst_photography_get_ev_compensation ()">gst_photography_get_ev_compensation</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-iso-speed" title="gst_photography_get_iso_speed ()">gst_photography_get_iso_speed</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-aperture" title="gst_photography_get_aperture ()">gst_photography_get_aperture</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-exposure" title="gst_photography_get_exposure ()">gst_photography_get_exposure</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-white-balance-mode" title="gst_photography_get_white_balance_mode ()">gst_photography_get_white_balance_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-color-tone-mode" title="gst_photography_get_color_tone_mode ()">gst_photography_get_color_tone_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-scene-mode" title="gst_photography_get_scene_mode ()">gst_photography_get_scene_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-flash-mode" title="gst_photography_get_flash_mode ()">gst_photography_get_flash_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-noise-reduction" title="gst_photography_get_noise_reduction ()">gst_photography_get_noise_reduction</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-zoom" title="gst_photography_get_zoom ()">gst_photography_get_zoom</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-ev-compensation" title="gst_photography_set_ev_compensation ()">gst_photography_set_ev_compensation</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-iso-speed" title="gst_photography_set_iso_speed ()">gst_photography_set_iso_speed</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-aperture" title="gst_photography_set_aperture ()">gst_photography_set_aperture</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-exposure" title="gst_photography_set_exposure ()">gst_photography_set_exposure</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-white-balance-mode" title="gst_photography_set_white_balance_mode ()">gst_photography_set_white_balance_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-color-tone-mode" title="gst_photography_set_color_tone_mode ()">gst_photography_set_color_tone_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-scene-mode" title="gst_photography_set_scene_mode ()">gst_photography_set_scene_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-flash-mode" title="gst_photography_set_flash_mode ()">gst_photography_set_flash_mode</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-noise-reduction" title="gst_photography_set_noise_reduction ()">gst_photography_set_noise_reduction</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-zoom" title="gst_photography_set_zoom ()">gst_photography_set_zoom</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a class="link" href="GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps"><span class="returnvalue">GstPhotographyCaps</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-capabilities" title="gst_photography_get_capabilities ()">gst_photography_get_capabilities</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-prepare-for-capture" title="gst_photography_prepare_for_capture ()">gst_photography_prepare_for_capture</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<span class="returnvalue">void</span>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-autofocus" title="gst_photography_set_autofocus ()">gst_photography_set_autofocus</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-set-config" title="gst_photography_set_config ()">gst_photography_set_config</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-<tr>
-<td class="function_type">
-<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-</td>
-<td class="function_name">
-<a class="link" href="GstPhotography.html#gst-photography-get-config" title="gst_photography_get_config ()">gst_photography_get_config</a> <span class="c_punctuation">()</span>
-</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.properties"></a><h2>Properties</h2>
-<div class="informaltable"><table border="0">
-<colgroup>
-<col width="150px" class="properties_type">
-<col width="300px" class="properties_name">
-<col width="200px" class="properties_flags">
-</colgroup>
-<tbody>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--aperture" title="The “aperture” property">aperture</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--capabilities" title="The “capabilities” property">capabilities</a></td>
-<td class="property_flags">Read</td>
-</tr>
-<tr>
-<td class="property_type"><span class="type">GstColourToneMode</span></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--colour-tone-mode" title="The “colour-tone-mode” property">colour-tone-mode</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--ev-compensation" title="The “ev-compensation” property">ev-compensation</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--exposure" title="The “exposure” property">exposure</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a class="link" href="GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--flash-mode" title="The “flash-mode” property">flash-mode</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a class="link" href="GstPhotography.html#GstPhotographyFlickerReductionMode" title="enum GstPhotographyFlickerReductionMode"><span class="type">GstPhotographyFlickerReductionMode</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--flicker-mode" title="The “flicker-mode” property">flicker-mode</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a class="link" href="GstPhotography.html#GstPhotographyFocusMode" title="enum GstPhotographyFocusMode"><span class="type">GstPhotographyFocusMode</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--focus-mode" title="The “focus-mode” property">focus-mode</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type">
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *</td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--image-capture-supported-caps" title="The “image-capture-supported-caps” property">image-capture-supported-caps</a></td>
-<td class="property_flags">Read</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--iso-speed" title="The “iso-speed” property">iso-speed</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a class="link" href="GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--scene-mode" title="The “scene-mode” property">scene-mode</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a class="link" href="GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--white-balance-mode" title="The “white-balance-mode” property">white-balance-mode</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type">
-<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *</td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--image-preview-supported-caps" title="The “image-preview-supported-caps” property">image-preview-supported-caps</a></td>
-<td class="property_flags">Read</td>
-</tr>
-<tr>
-<td class="property_type"><a class="link" href="GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction"><span class="type">GstPhotographyNoiseReduction</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--noise-reduction" title="The “noise-reduction” property">noise-reduction</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--zoom" title="The “zoom” property">zoom</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--analog-gain" title="The “analog-gain” property">analog-gain</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--color-temperature" title="The “color-temperature” property">color-temperature</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a class="link" href="GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--color-tone-mode" title="The “color-tone-mode” property">color-tone-mode</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--exposure-time" title="The “exposure-time” property">exposure-time</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--lens-focus" title="The “lens-focus” property">lens-focus</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--max-exposure-time" title="The “max-exposure-time” property">max-exposure-time</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--min-exposure-time" title="The “min-exposure-time” property">min-exposure-time</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-<tr>
-<td class="property_type">
-<a href="https://developer.gnome.org/gobject/unstable/gobject-Value-arrays.html#GValueArray"><span class="type">GValueArray</span></a> *</td>
-<td class="property_name"><a class="link" href="GstPhotography.html#GstPhotography--white-point" title="The “white-point” property">white-point</a></td>
-<td class="property_flags">Read / Write</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.other"></a><h2>Types and Values</h2>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="name">
-<col class="description">
-</colgroup>
-<tbody>
-<tr>
-<td class="datatype_keyword"> </td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotography-struct" title="GstPhotography">GstPhotography</a></td>
-</tr>
-<tr>
-<td class="define_keyword">#define</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS" title="GST_PHOTOGRAPHY_AUTOFOCUS_DONE">GST_PHOTOGRAPHY_AUTOFOCUS_DONE</a></td>
-</tr>
-<tr>
-<td class="define_keyword">#define</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS" title="GST_PHOTOGRAPHY_SHAKE_RISK">GST_PHOTOGRAPHY_SHAKE_RISK</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction">GstPhotographyNoiseReduction</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode">GstPhotographyWhiteBalanceMode</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode">GstPhotographyColorToneMode</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode">GstPhotographySceneMode</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode">GstPhotographyFlashMode</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyFlickerReductionMode" title="enum GstPhotographyFlickerReductionMode">GstPhotographyFlickerReductionMode</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyFocusMode" title="enum GstPhotographyFocusMode">GstPhotographyFocusMode</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyFocusStatus" title="enum GstPhotographyFocusStatus">GstPhotographyFocusStatus</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps">GstPhotographyCaps</a></td>
-</tr>
-<tr>
-<td class="datatype_keyword">enum</td>
-<td class="function_name"><a class="link" href="GstPhotography.html#GstPhotographyShakeRisk" title="enum GstPhotographyShakeRisk">GstPhotographyShakeRisk</a></td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.object-hierarchy"></a><h2>Object Hierarchy</h2>
-<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/GTypeModule.html">GInterface</a>
-    <span class="lineart">╰──</span> GstPhotography
-</pre>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.prerequisites"></a><h2>Prerequisites</h2>
-<p>
-GstPhotography requires
- GstImplementsInterface and  <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>.</p>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.description"></a><h2>Description</h2>
-<p>
-</p>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.functions_details"></a><h2>Functions</h2>
-<div class="refsect2">
-<a name="GstPhotographyCapturePrepared"></a><h3>GstPhotographyCapturePrepared ()</h3>
-<pre class="programlisting"><span class="returnvalue">void</span>
-<span class="c_punctuation">(</span>*GstPhotographyCapturePrepared<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>,
-                                  <em class="parameter"><code>const <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *configured_caps</code></em>);</pre>
-<p>
-</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-ev-compensation"></a><h3>gst_photography_get_ev_compensation ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_ev_compensation (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> *ev_comp</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.3.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-iso-speed"></a><h3>gst_photography_get_iso_speed ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_iso_speed (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *iso_speed</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.4.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-aperture"></a><h3>gst_photography_get_aperture ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_aperture (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                              <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *aperture</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.5.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-exposure"></a><h3>gst_photography_get_exposure ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_exposure (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                              <em class="parameter"><code><span class="type">guint32</span> *exposure</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.6.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-white-balance-mode"></a><h3>gst_photography_get_white_balance_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_white_balance_mode
-                               (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a> *wb_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.7.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-color-tone-mode"></a><h3>gst_photography_get_color_tone_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_color_tone_mode (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                     <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a> *tone_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.8.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-scene-mode"></a><h3>gst_photography_get_scene_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_scene_mode (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a> *scene_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.9.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-flash-mode"></a><h3>gst_photography_get_flash_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_flash_mode (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a> *flash_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.10.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-noise-reduction"></a><h3>gst_photography_get_noise_reduction ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_noise_reduction (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                     <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction"><span class="type">GstPhotographyNoiseReduction</span></a> *noise_reduction</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.11.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-zoom"></a><h3>gst_photography_get_zoom ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_zoom (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> *zoom</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.12.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-ev-compensation"></a><h3>gst_photography_set_ev_compensation ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_ev_compensation (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> ev_comp</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.13.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-iso-speed"></a><h3>gst_photography_set_iso_speed ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_iso_speed (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> iso_speed</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.14.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-aperture"></a><h3>gst_photography_set_aperture ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_aperture (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                              <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> aperture</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.15.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-exposure"></a><h3>gst_photography_set_exposure ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_exposure (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                              <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> exposure</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.16.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-white-balance-mode"></a><h3>gst_photography_set_white_balance_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_white_balance_mode
-                               (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a> wb_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.17.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-color-tone-mode"></a><h3>gst_photography_set_color_tone_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_color_tone_mode (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                     <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a> tone_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.18.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-scene-mode"></a><h3>gst_photography_set_scene_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_scene_mode (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a> scene_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.19.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-flash-mode"></a><h3>gst_photography_set_flash_mode ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_flash_mode (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a> flash_mode</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.20.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-noise-reduction"></a><h3>gst_photography_set_noise_reduction ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_noise_reduction (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                     <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction"><span class="type">GstPhotographyNoiseReduction</span></a> noise_reduction</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.21.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-zoom"></a><h3>gst_photography_set_zoom ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_zoom (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                          <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a> zoom</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.22.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-capabilities"></a><h3>gst_photography_get_capabilities ()</h3>
-<pre class="programlisting"><a class="link" href="GstPhotography.html#GstPhotographyCaps" title="enum GstPhotographyCaps"><span class="returnvalue">GstPhotographyCaps</span></a>
-gst_photography_get_capabilities (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.23.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-prepare-for-capture"></a><h3>gst_photography_prepare_for_capture ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_prepare_for_capture (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                                     <em class="parameter"><code><a class="link" href="GstPhotography.html#GstPhotographyCapturePrepared" title="GstPhotographyCapturePrepared ()"><span class="type">GstPhotographyCapturePrepared</span></a> func</code></em>,
-                                     <em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *capture_caps</code></em>,
-                                     <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.24.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-autofocus"></a><h3>gst_photography_set_autofocus ()</h3>
-<pre class="programlisting"><span class="returnvalue">void</span>
-gst_photography_set_autofocus (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                               <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> on</code></em>);</pre>
-<p>
-</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-set-config"></a><h3>gst_photography_set_config ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_set_config (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                            <em class="parameter"><code><span class="type">GstPhotographySettings</span> *config</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.26.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="gst-photography-get-config"></a><h3>gst_photography_get_config ()</h3>
-<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
-gst_photography_get_config (<em class="parameter"><code><a class="link" href="GstPhotography.html" title="GstPhotography"><span class="type">GstPhotography</span></a> *photo</code></em>,
-                            <em class="parameter"><code><span class="type">GstPhotographySettings</span> *config</code></em>);</pre>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.9.27.5"></a><h4>Returns</h4>
-<p></p>
-</div>
-</div>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.other_details"></a><h2>Types and Values</h2>
-<div class="refsect2">
-<a name="GstPhotography-struct"></a><h3>GstPhotography</h3>
-<pre class="programlisting">typedef struct _GstPhotography GstPhotography;</pre>
-<p>
-</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS"></a><h3>GST_PHOTOGRAPHY_AUTOFOCUS_DONE</h3>
-<pre class="programlisting">#define GST_PHOTOGRAPHY_AUTOFOCUS_DONE "autofocus-done"
-</pre>
-<p>
-</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GST-PHOTOGRAPHY-SHAKE-RISK:CAPS"></a><h3>GST_PHOTOGRAPHY_SHAKE_RISK</h3>
-<pre class="programlisting">#define GST_PHOTOGRAPHY_SHAKE_RISK "shake-risk"
-</pre>
-<p>
-</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyNoiseReduction"></a><h3>enum GstPhotographyNoiseReduction</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.5.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-BAYER:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_BAYER</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-YCC:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_YCC</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-TEMPORAL:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_TEMPORAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-FIXED:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_FIXED</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-NOISE-REDUCTION-EXTRA:CAPS"></a>GST_PHOTOGRAPHY_NOISE_REDUCTION_EXTRA</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyWhiteBalanceMode"></a><h3>enum GstPhotographyWhiteBalanceMode</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.6.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_AUTO</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-DAYLIGHT:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-CLOUDY:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_CLOUDY</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-SUNSET:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_SUNSET</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-TUNGSTEN:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-FLUORESCENT:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-MANUAL:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_MANUAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-WARM-FLUORESCENT:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_WARM_FLUORESCENT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-WB-MODE-SHADE:CAPS"></a>GST_PHOTOGRAPHY_WB_MODE_SHADE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyColorToneMode"></a><h3>enum GstPhotographyColorToneMode</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.7.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-NORMAL:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SEPIA:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-NEGATIVE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-GRAYSCALE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-NATURAL:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_NATURAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-VIVID:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_VIVID</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-COLORSWAP:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_COLORSWAP</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SOLARIZE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-OUT-OF-FOCUS:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_OUT_OF_FOCUS</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SKY-BLUE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKY_BLUE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-GRASS-GREEN:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRASS_GREEN</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-SKIN-WHITEN:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKIN_WHITEN</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-POSTERIZE:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-WHITEBOARD:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-BLACKBOARD:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-COLOR-TONE-MODE-AQUA:CAPS"></a>GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographySceneMode"></a><h3>enum GstPhotographySceneMode</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.8.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-MANUAL:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_MANUAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-CLOSEUP:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-PORTRAIT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-LANDSCAPE:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-SPORT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_SPORT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-NIGHT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_NIGHT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_AUTO</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-ACTION:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_ACTION</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-NIGHT-PORTRAIT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-THEATRE:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_THEATRE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-BEACH:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_BEACH</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-SNOW:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_SNOW</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-SUNSET:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_SUNSET</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-STEADY-PHOTO:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-FIREWORKS:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-PARTY:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_PARTY</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-CANDLELIGHT:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SCENE-MODE-BARCODE:CAPS"></a>GST_PHOTOGRAPHY_SCENE_MODE_BARCODE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyFlashMode"></a><h3>enum GstPhotographyFlashMode</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.9.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_AUTO</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-OFF:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_OFF</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-ON:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_ON</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-FILL-IN:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLASH-MODE-RED-EYE:CAPS"></a>GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyFlickerReductionMode"></a><h3>enum GstPhotographyFlickerReductionMode</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.10.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-OFF:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-50HZ:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_50HZ</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-60HZ:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_60HZ</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FLICKER-REDUCTION-AUTO:CAPS"></a>GST_PHOTOGRAPHY_FLICKER_REDUCTION_AUTO</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyFocusMode"></a><h3>enum GstPhotographyFocusMode</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.11.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-AUTO:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_AUTO</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-MACRO:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_MACRO</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-PORTRAIT:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_PORTRAIT</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-INFINITY:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-HYPERFOCAL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-EXTENDED:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-CONTINUOUS-NORMAL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-CONTINUOUS-EXTENDED:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-MODE-MANUAL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyFocusStatus"></a><h3>enum GstPhotographyFocusStatus</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.12.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-NONE:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_NONE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-RUNNING:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-FAIL:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-FOCUS-STATUS-SUCCESS:CAPS"></a>GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyCaps"></a><h3>enum GstPhotographyCaps</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.13.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-NONE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_NONE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-EV-COMP:CAPS"></a>GST_PHOTOGRAPHY_CAPS_EV_COMP</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-ISO-SPEED:CAPS"></a>GST_PHOTOGRAPHY_CAPS_ISO_SPEED</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-WB-MODE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_WB_MODE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-TONE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_TONE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-SCENE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_SCENE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-FLASH:CAPS"></a>GST_PHOTOGRAPHY_CAPS_FLASH</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-ZOOM:CAPS"></a>GST_PHOTOGRAPHY_CAPS_ZOOM</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-FOCUS:CAPS"></a>GST_PHOTOGRAPHY_CAPS_FOCUS</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-APERTURE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_APERTURE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-EXPOSURE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_EXPOSURE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-SHAKE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_SHAKE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-WHITE-BALANCE:CAPS"></a>GST_PHOTOGRAPHY_CAPS_WHITE_BALANCE</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-NOISE-REDUCTION:CAPS"></a>GST_PHOTOGRAPHY_CAPS_NOISE_REDUCTION</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-FLICKER-REDUCTION:CAPS"></a>GST_PHOTOGRAPHY_CAPS_FLICKER_REDUCTION</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-CAPS-ALL:CAPS"></a>GST_PHOTOGRAPHY_CAPS_ALL</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotographyShakeRisk"></a><h3>enum GstPhotographyShakeRisk</h3>
-<p>
-</p>
-<div class="refsect3">
-<a name="id-1.4.2.10.14.4"></a><h4>Members</h4>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="300px" class="enum_members_name">
-<col class="enum_members_description">
-<col width="200px" class="enum_members_annotations">
-</colgroup>
-<tbody>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SHAKE-RISK-LOW:CAPS"></a>GST_PHOTOGRAPHY_SHAKE_RISK_LOW</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SHAKE-RISK-MEDIUM:CAPS"></a>GST_PHOTOGRAPHY_SHAKE_RISK_MEDIUM</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-<tr>
-<td class="enum_member_name"><p><a name="GST-PHOTOGRAPHY-SHAKE-RISK-HIGH:CAPS"></a>GST_PHOTOGRAPHY_SHAKE_RISK_HIGH</p></td>
-<td class="enum_member_description"> </td>
-<td class="enum_member_annotations"> </td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-</div>
-<div class="refsect1">
-<a name="GstPhotography.property-details"></a><h2>Property Details</h2>
-<div class="refsect2">
-<a name="GstPhotography--aperture"></a><h3>The <code class="literal">“aperture”</code> property</h3>
-<pre class="programlisting">  “aperture”                 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>Aperture defines the size of lens opening  (0 = auto).</p>
-<p>Flags: Read / Write</p>
-<p>Allowed values: &lt;= 255</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--capabilities"></a><h3>The <code class="literal">“capabilities”</code> property</h3>
-<pre class="programlisting">  “capabilities”             <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a></pre>
-<p>Tells the photo capabilities of the device.</p>
-<p>Flags: Read</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--colour-tone-mode"></a><h3>The <code class="literal">“colour-tone-mode”</code> property</h3>
-<pre class="programlisting">  “colour-tone-mode”         <span class="type">GstColourToneMode</span></pre>
-<p>Colour tone setting changes colour shading in the photo.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--ev-compensation"></a><h3>The <code class="literal">“ev-compensation”</code> property</h3>
-<pre class="programlisting">  “ev-compensation”          <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></pre>
-<p>EV compensation affects the brightness of the image.</p>
-<p>Flags: Read / Write</p>
-<p>Allowed values: [-2.5,2.5]</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--exposure"></a><h3>The <code class="literal">“exposure”</code> property</h3>
-<pre class="programlisting">  “exposure”                 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>Exposure time defines how long the shutter will stay open (0 = auto).</p>
-<p>Flags: Read / Write</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--flash-mode"></a><h3>The <code class="literal">“flash-mode”</code> property</h3>
-<pre class="programlisting">  “flash-mode”               <a class="link" href="GstPhotography.html#GstPhotographyFlashMode" title="enum GstPhotographyFlashMode"><span class="type">GstPhotographyFlashMode</span></a></pre>
-<p>Flash mode defines how the flash light should be used.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: GST_PHOTOGRAPHY_FLASH_MODE_AUTO</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--flicker-mode"></a><h3>The <code class="literal">“flicker-mode”</code> property</h3>
-<pre class="programlisting">  “flicker-mode”             <a class="link" href="GstPhotography.html#GstPhotographyFlickerReductionMode" title="enum GstPhotographyFlickerReductionMode"><span class="type">GstPhotographyFlickerReductionMode</span></a></pre>
-<p>Flicker reduction mode defines a line frequency for flickering prevention.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--focus-mode"></a><h3>The <code class="literal">“focus-mode”</code> property</h3>
-<pre class="programlisting">  “focus-mode”               <a class="link" href="GstPhotography.html#GstPhotographyFocusMode" title="enum GstPhotographyFocusMode"><span class="type">GstPhotographyFocusMode</span></a></pre>
-<p>Focus mode defines the range of focal lengths to use in autofocus search.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: GST_PHOTOGRAPHY_FOCUS_MODE_AUTO</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--image-capture-supported-caps"></a><h3>The <code class="literal">“image-capture-supported-caps”</code> property</h3>
-<pre class="programlisting">  “image-capture-supported-caps” <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *</pre>
-<p>Caps describing supported image capture formats.</p>
-<p>Flags: Read</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--iso-speed"></a><h3>The <code class="literal">“iso-speed”</code> property</h3>
-<pre class="programlisting">  “iso-speed”                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>ISO speed defines the light sensitivity (0 = auto).</p>
-<p>Flags: Read / Write</p>
-<p>Allowed values: &lt;= 6400</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--scene-mode"></a><h3>The <code class="literal">“scene-mode”</code> property</h3>
-<pre class="programlisting">  “scene-mode”               <a class="link" href="GstPhotography.html#GstPhotographySceneMode" title="enum GstPhotographySceneMode"><span class="type">GstPhotographySceneMode</span></a></pre>
-<p>Scene mode works as a preset for different photo shooting mode settings.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: GST_PHOTOGRAPHY_SCENE_MODE_AUTO</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--white-balance-mode"></a><h3>The <code class="literal">“white-balance-mode”</code> property</h3>
-<pre class="programlisting">  “white-balance-mode”       <a class="link" href="GstPhotography.html#GstPhotographyWhiteBalanceMode" title="enum GstPhotographyWhiteBalanceMode"><span class="type">GstPhotographyWhiteBalanceMode</span></a></pre>
-<p>White balance affects the color temperature of the photo.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: GST_PHOTOGRAPHY_WB_MODE_AUTO</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--image-preview-supported-caps"></a><h3>The <code class="literal">“image-preview-supported-caps”</code> property</h3>
-<pre class="programlisting">  “image-preview-supported-caps” <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *</pre>
-<p>Caps describing supported image preview formats.</p>
-<p>Flags: Read</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--noise-reduction"></a><h3>The <code class="literal">“noise-reduction”</code> property</h3>
-<pre class="programlisting">  “noise-reduction”          <a class="link" href="GstPhotography.html#GstPhotographyNoiseReduction" title="enum GstPhotographyNoiseReduction"><span class="type">GstPhotographyNoiseReduction</span></a></pre>
-<p>Which noise reduction modes are enabled (0 = disabled).</p>
-<p>Flags: Read / Write</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--zoom"></a><h3>The <code class="literal">“zoom”</code> property</h3>
-<pre class="programlisting">  “zoom”                     <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></pre>
-<p>How much the resulted image will be zoomed.</p>
-<p>Flags: Read / Write</p>
-<p>Allowed values: [1,10]</p>
-<p>Default value: 1</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--analog-gain"></a><h3>The <code class="literal">“analog-gain”</code> property</h3>
-<pre class="programlisting">  “analog-gain”              <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></pre>
-<p>Analog gain applied to the sensor.</p>
-<p>Flags: Read / Write</p>
-<p>Allowed values: &gt;= 1</p>
-<p>Default value: 1</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--color-temperature"></a><h3>The <code class="literal">“color-temperature”</code> property</h3>
-<pre class="programlisting">  “color-temperature”        <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>Color temperature in Kelvin units for manual white balance.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--color-tone-mode"></a><h3>The <code class="literal">“color-tone-mode”</code> property</h3>
-<pre class="programlisting">  “color-tone-mode”          <a class="link" href="GstPhotography.html#GstPhotographyColorToneMode" title="enum GstPhotographyColorToneMode"><span class="type">GstPhotographyColorToneMode</span></a></pre>
-<p>Color tone setting changes color shading in the photo.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--exposure-time"></a><h3>The <code class="literal">“exposure-time”</code> property</h3>
-<pre class="programlisting">  “exposure-time”            <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>Exposure time defines how long the shutter will stay open (0 = auto).</p>
-<p>Flags: Read / Write</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--lens-focus"></a><h3>The <code class="literal">“lens-focus”</code> property</h3>
-<pre class="programlisting">  “lens-focus”               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gfloat"><span class="type">gfloat</span></a></pre>
-<p>Focus point in diopter units.</p>
-<p>Flags: Read / Write</p>
-<p>Allowed values: &gt;= 0</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--max-exposure-time"></a><h3>The <code class="literal">“max-exposure-time”</code> property</h3>
-<pre class="programlisting">  “max-exposure-time”        <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>Maximum exposure time for automatic exposure mode.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--min-exposure-time"></a><h3>The <code class="literal">“min-exposure-time”</code> property</h3>
-<pre class="programlisting">  “min-exposure-time”        <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>Minimum exposure time for automatic exposure mode.</p>
-<p>Flags: Read / Write</p>
-<p>Default value: 0</p>
-</div>
-<hr>
-<div class="refsect2">
-<a name="GstPhotography--white-point"></a><h3>The <code class="literal">“white-point”</code> property</h3>
-<pre class="programlisting">  “white-point”              <a href="https://developer.gnome.org/gobject/unstable/gobject-Value-arrays.html#GValueArray"><span class="type">GValueArray</span></a> *</pre>
-<p>Describe color white as raw values.</p>
-<p>Flags: Read / Write</p>
-</div>
-</div>
-</div>
-<div class="footer">
-<hr>
-          Generated by GTK-Doc V1.21</div>
-</body>
-</html>
\ No newline at end of file
diff --git a/docs/plugins/html/ch01.html b/docs/plugins/html/ch01.html
index b67c745..a124fa2 100644
--- a/docs/plugins/html/ch01.html
+++ b/docs/plugins/html/ch01.html
@@ -27,12 +27,24 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-accurip.html">accurip</a></span><span class="refpurpose"> — Computes an AccurateRip CRC</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-aiffparse.html">aiffparse</a></span><span class="refpurpose"> — Parse a .aiff file into raw audio</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-aiffmux.html">aiffmux</a></span><span class="refpurpose"> — Multiplex raw audio into AIFF</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-assrender.html">assrender</a></span><span class="refpurpose"> — Renders ASS/SSA subtitles with libass</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-audiomixer.html">audiomixer</a></span><span class="refpurpose"> — Mixes multiple audio streams</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-autoconvert.html">autoconvert</a></span><span class="refpurpose"> — Selects the right transform element based on the caps</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-bs2b.html">bs2b</a></span><span class="refpurpose"> — Improve headphone listening of stereo audio records using the bs2b library.</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-bulge.html">bulge</a></span><span class="refpurpose"> — Adds a protuberance in the center point</span>
 </dt>
 <dt>
@@ -51,7 +63,7 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-coloreffects.html">coloreffects</a></span><span class="refpurpose"> — Color Look-up Table filter</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-plugins-compositor.html">compositor</a></span><span class="refpurpose"> — Composite multiple video streams</span>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-compositor.html">compositor</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-cvdilate.html">cvdilate</a></span><span class="refpurpose"> — Applies cvDilate OpenCV function to the image</span>
@@ -102,9 +114,6 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-edgedetect.html">edgedetect</a></span><span class="refpurpose"> — Performs canny edge detection on videos and images.</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-plugins-eglglessink.html">eglglessink</a></span><span class="refpurpose"> — An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</span>
-</dt>
-<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-faac.html">faac</a></span><span class="refpurpose"> — Free MPEG-2/4 AAC encoder</span>
 </dt>
 <dt>
@@ -156,6 +165,12 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-mpeg2enc.html">mpeg2enc</a></span><span class="refpurpose"> — High-quality MPEG-1/2 video encoder</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-mpegpsmux.html">mpegpsmux</a></span><span class="refpurpose"> — Multiplexes media streams into an MPEG Program Stream</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-mpegtsmux.html">mpegtsmux</a></span><span class="refpurpose"> — Multiplexes media streams into an MPEG Transport Stream</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-mplex.html">mplex</a></span><span class="refpurpose"> — High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer</span>
 </dt>
 <dt>
@@ -174,6 +189,21 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-openalsink.html">openalsink</a></span><span class="refpurpose"> — Output audio through OpenAL</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-opusdec.html">opusdec</a></span><span class="refpurpose"> — decode opus streams to audio</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-opusenc.html">opusenc</a></span><span class="refpurpose"> — Encodes audio in Opus format</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-opusparse.html">opusparse</a></span><span class="refpurpose"> — parses opus audio streams</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-rtpopuspay.html">rtpopuspay</a></span><span class="refpurpose"> — Puts Opus audio in RTP packets</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-rtpopusdepay.html">rtpopusdepay</a></span><span class="refpurpose"> — Extracts Opus audio from RTP packets</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-pcapparse.html">pcapparse</a></span><span class="refpurpose"> — Parses a raw pcap stream</span>
 </dt>
 <dt>
diff --git a/docs/plugins/html/ch02.html b/docs/plugins/html/ch02.html
index f6ec1e4..c3ade9b 100644
--- a/docs/plugins/html/ch02.html
+++ b/docs/plugins/html/ch02.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="prev" href="gst-plugins-bad-plugins-wavescope.html" title="wavescope">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-audiovisualizers.html" title="audiovisualizers">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-aiff.html" title="aiff">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -17,13 +17,19 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-wavescope.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-audiovisualizers.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-aiff.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="chapter">
 <div class="titlepage"><div><div><h1 class="title">
 <a name="id-1.3"></a>gst-plugins-bad Plugins</h1></div></div></div>
 <div class="toc"><dl class="toc">
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-aiff.html">aiff</a></span><span class="refpurpose">Create and parse Audio Interchange File Format (AIFF) files</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-audiomixer.html">audiomixer</a></span><span class="refpurpose">Mixes multiple audio streams</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-audiovisualizers.html">audiovisualizers</a></span><span class="refpurpose">Creates video visualizations of audio input</span>
 </dt>
 <dt>
@@ -36,6 +42,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-bayer.html">bayer</a></span><span class="refpurpose">Elements to convert Bayer images</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-bs2b.html">bs2b</a></span><span class="refpurpose">Improve headphone listening of stereo audio recordsusing the bs2b library.</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-bz2.html">bz2</a></span><span class="refpurpose">Compress or decompress streams</span>
 </dt>
 <dt>
@@ -63,9 +72,6 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-dvdspu.html">dvdspu</a></span><span class="refpurpose">DVD Sub-picture Overlay element</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-eglglessink.html">eglglessink</a></span><span class="refpurpose">EGL/GLES sink</span>
-</dt>
-<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-faac.html">faac</a></span><span class="refpurpose">Free AAC Encoder (FAAC)</span>
 </dt>
 <dt>
@@ -102,6 +108,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-mpeg2enc.html">mpeg2enc</a></span><span class="refpurpose">High-quality MPEG-1/2 video encoder</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-mpegpsmux.html">mpegpsmux</a></span><span class="refpurpose">MPEG-PS muxer</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-mpegtsmux.html">mpegtsmux</a></span><span class="refpurpose">MPEG-TS muxer</span>
 </dt>
 <dt>
@@ -120,6 +129,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-opencv.html">opencv</a></span><span class="refpurpose">GStreamer OpenCV Plugins</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-opus.html">opus</a></span><span class="refpurpose">OPUS plugin library</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-pcapparse.html">pcapparse</a></span><span class="refpurpose">Element parsing raw pcap streams</span>
 </dt>
 <dt>
diff --git a/docs/plugins/html/ch03.html b/docs/plugins/html/ch03.html
deleted file mode 100644
index 0bf4d7a..0000000
--- a/docs/plugins/html/ch03.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: gst-plugins-bad Interfaces</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
-<link rel="up" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-zbar.html" title="zbar">
-<link rel="next" href="GstPhotography.html" title="GstPhotography">
-<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
-<link rel="stylesheet" href="style.css" type="text/css">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
-<td width="100%" align="left" class="shortcuts"></td>
-<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
-<td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-zbar.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="GstPhotography.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
-</tr></table>
-<div class="chapter">
-<div class="titlepage"><div><div><h1 class="title">
-<a name="id-1.4"></a>gst-plugins-bad Interfaces</h1></div></div></div>
-<div class="toc"><dl class="toc"><dt>
-<span class="refentrytitle"><a href="GstPhotography.html">GstPhotography</a></span><span class="refpurpose"></span>
-</dt></dl></div>
-</div>
-<div class="footer">
-<hr>
-          Generated by GTK-Doc V1.21</div>
-</body>
-</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-1.0.devhelp2 b/docs/plugins/html/gst-plugins-bad-plugins-1.0.devhelp2
index 60c2f58..6b1e10d 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-1.0.devhelp2
+++ b/docs/plugins/html/gst-plugins-bad-plugins-1.0.devhelp2
@@ -4,8 +4,12 @@
   <chapters>
     <sub name="gst-plugins-bad Elements" link="ch01.html">
       <sub name="accurip" link="gst-plugins-bad-plugins-accurip.html"/>
+      <sub name="aiffparse" link="gst-plugins-bad-plugins-aiffparse.html"/>
+      <sub name="aiffmux" link="gst-plugins-bad-plugins-aiffmux.html"/>
       <sub name="assrender" link="gst-plugins-bad-plugins-assrender.html"/>
+      <sub name="audiomixer" link="gst-plugins-bad-plugins-audiomixer.html"/>
       <sub name="autoconvert" link="gst-plugins-bad-plugins-autoconvert.html"/>
+      <sub name="bs2b" link="gst-plugins-bad-plugins-bs2b.html"/>
       <sub name="bulge" link="gst-plugins-bad-plugins-bulge.html"/>
       <sub name="burn" link="gst-plugins-bad-plugins-burn.html"/>
       <sub name="camerabin" link="gst-plugins-bad-plugins-camerabin.html"/>
@@ -29,7 +33,6 @@
       <sub name="dvdspu" link="gst-plugins-bad-plugins-dvdspu.html"/>
       <sub name="exclusion" link="gst-plugins-bad-plugins-exclusion.html"/>
       <sub name="edgedetect" link="gst-plugins-bad-plugins-edgedetect.html"/>
-      <sub name="eglglessink" link="gst-plugins-bad-plugins-eglglessink.html"/>
       <sub name="faac" link="gst-plugins-bad-plugins-faac.html"/>
       <sub name="faad" link="gst-plugins-bad-plugins-faad.html"/>
       <sub name="faceblur" link="gst-plugins-bad-plugins-faceblur.html"/>
@@ -47,12 +50,19 @@
       <sub name="mirror" link="gst-plugins-bad-plugins-mirror.html"/>
       <sub name="modplug" link="gst-plugins-bad-plugins-modplug.html"/>
       <sub name="mpeg2enc" link="gst-plugins-bad-plugins-mpeg2enc.html"/>
+      <sub name="mpegpsmux" link="gst-plugins-bad-plugins-mpegpsmux.html"/>
+      <sub name="mpegtsmux" link="gst-plugins-bad-plugins-mpegtsmux.html"/>
       <sub name="mplex" link="gst-plugins-bad-plugins-mplex.html"/>
       <sub name="mpg123audiodec" link="gst-plugins-bad-plugins-mpg123audiodec.html"/>
       <sub name="neonhttpsrc" link="gst-plugins-bad-plugins-neonhttpsrc.html"/>
       <sub name="ofa" link="gst-plugins-bad-plugins-ofa.html"/>
       <sub name="openalsrc" link="gst-plugins-bad-plugins-openalsrc.html"/>
       <sub name="openalsink" link="gst-plugins-bad-plugins-openalsink.html"/>
+      <sub name="opusdec" link="gst-plugins-bad-plugins-opusdec.html"/>
+      <sub name="opusenc" link="gst-plugins-bad-plugins-opusenc.html"/>
+      <sub name="opusparse" link="gst-plugins-bad-plugins-opusparse.html"/>
+      <sub name="rtpopuspay" link="gst-plugins-bad-plugins-rtpopuspay.html"/>
+      <sub name="rtpopusdepay" link="gst-plugins-bad-plugins-rtpopusdepay.html"/>
       <sub name="pcapparse" link="gst-plugins-bad-plugins-pcapparse.html"/>
       <sub name="pinch" link="gst-plugins-bad-plugins-pinch.html"/>
       <sub name="pyramidsegment" link="gst-plugins-bad-plugins-pyramidsegment.html"/>
@@ -82,10 +92,13 @@
       <sub name="wavescope" link="gst-plugins-bad-plugins-wavescope.html"/>
     </sub>
     <sub name="gst-plugins-bad Plugins" link="ch02.html">
+      <sub name="aiff" link="gst-plugins-bad-plugins-plugin-aiff.html"/>
+      <sub name="audiomixer" link="gst-plugins-bad-plugins-plugin-audiomixer.html"/>
       <sub name="audiovisualizers" link="gst-plugins-bad-plugins-plugin-audiovisualizers.html"/>
       <sub name="autoconvert" link="gst-plugins-bad-plugins-plugin-autoconvert.html"/>
       <sub name="assrender" link="gst-plugins-bad-plugins-plugin-assrender.html"/>
       <sub name="bayer" link="gst-plugins-bad-plugins-plugin-bayer.html"/>
+      <sub name="bs2b" link="gst-plugins-bad-plugins-plugin-bs2b.html"/>
       <sub name="bz2" link="gst-plugins-bad-plugins-plugin-bz2.html"/>
       <sub name="camerabin" link="gst-plugins-bad-plugins-plugin-camerabin.html"/>
       <sub name="coloreffects" link="gst-plugins-bad-plugins-plugin-coloreffects.html"/>
@@ -95,7 +108,6 @@
       <sub name="dtsdec" link="gst-plugins-bad-plugins-plugin-dtsdec.html"/>
       <sub name="dvb" link="gst-plugins-bad-plugins-plugin-dvb.html"/>
       <sub name="dvdspu" link="gst-plugins-bad-plugins-plugin-dvdspu.html"/>
-      <sub name="eglglessink" link="gst-plugins-bad-plugins-plugin-eglglessink.html"/>
       <sub name="faac" link="gst-plugins-bad-plugins-plugin-faac.html"/>
       <sub name="faad" link="gst-plugins-bad-plugins-plugin-faad.html"/>
       <sub name="festival" link="gst-plugins-bad-plugins-plugin-festival.html"/>
@@ -108,12 +120,14 @@
       <sub name="mms" link="gst-plugins-bad-plugins-plugin-mms.html"/>
       <sub name="modplug" link="gst-plugins-bad-plugins-plugin-modplug.html"/>
       <sub name="mpeg2enc" link="gst-plugins-bad-plugins-plugin-mpeg2enc.html"/>
+      <sub name="mpegpsmux" link="gst-plugins-bad-plugins-plugin-mpegpsmux.html"/>
       <sub name="mpegtsmux" link="gst-plugins-bad-plugins-plugin-mpegtsmux.html"/>
       <sub name="mplex" link="gst-plugins-bad-plugins-plugin-mplex.html"/>
       <sub name="neon" link="gst-plugins-bad-plugins-plugin-neon.html"/>
       <sub name="ofa" link="gst-plugins-bad-plugins-plugin-ofa.html"/>
       <sub name="openal" link="gst-plugins-bad-plugins-plugin-openal.html"/>
       <sub name="opencv" link="gst-plugins-bad-plugins-plugin-opencv.html"/>
+      <sub name="opus" link="gst-plugins-bad-plugins-plugin-opus.html"/>
       <sub name="pcapparse" link="gst-plugins-bad-plugins-plugin-pcapparse.html"/>
       <sub name="rawparse" link="gst-plugins-bad-plugins-plugin-rawparse.html"/>
       <sub name="rfbsrc" link="gst-plugins-bad-plugins-plugin-rfbsrc.html"/>
@@ -126,9 +140,6 @@
       <sub name="voamrwbenc" link="gst-plugins-bad-plugins-plugin-voamrwbenc.html"/>
       <sub name="zbar" link="gst-plugins-bad-plugins-plugin-zbar.html"/>
     </sub>
-    <sub name="gst-plugins-bad Interfaces" link="ch03.html">
-      <sub name="GstPhotography" link="GstPhotography.html"/>
-    </sub>
   </chapters>
   <functions>
     <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-accurip.html#id-1.2.2.7.5"/>
@@ -137,107 +148,123 @@
     <keyword type="struct" name="struct GstAccurip" link="gst-plugins-bad-plugins-accurip.html#GstAccurip-struct"/>
     <keyword type="property" name="The “first-track” property" link="gst-plugins-bad-plugins-accurip.html#GstAccurip--first-track"/>
     <keyword type="property" name="The “last-track” property" link="gst-plugins-bad-plugins-accurip.html#GstAccurip--last-track"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-assrender.html#id-1.2.3.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-assrender.html#id-1.2.3.7.2.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-aiffparse.html#id-1.2.3.6.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-aiffparse.html#id-1.2.3.6.3.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-aiffparse.html#id-1.2.3.6.3.2"/>
+    <keyword type="struct" name="struct GstAiffParse" link="gst-plugins-bad-plugins-aiffparse.html#GstAiffParse-struct"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-aiffmux.html#id-1.2.4.6.2.1.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-aiffmux.html#id-1.2.4.6.2.1.2"/>
+    <keyword type="struct" name="struct GstAiffMux" link="gst-plugins-bad-plugins-aiffmux.html#GstAiffMux-struct"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-assrender.html#id-1.2.5.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-assrender.html#id-1.2.5.7.2.2"/>
     <keyword type="struct" name="struct GstAssRender" link="gst-plugins-bad-plugins-assrender.html#GstAssRender-struct"/>
     <keyword type="property" name="The “embeddedfonts” property" link="gst-plugins-bad-plugins-assrender.html#GstAssRender--embeddedfonts"/>
     <keyword type="property" name="The “enable” property" link="gst-plugins-bad-plugins-assrender.html#GstAssRender--enable"/>
     <keyword type="property" name="The “wait-text” property" link="gst-plugins-bad-plugins-assrender.html#GstAssRender--wait-text"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-autoconvert.html#id-1.2.4.8.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-autoconvert.html#id-1.2.4.8.3.2.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-audiomixer.html#id-1.2.6.8.6"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-audiomixer.html#id-1.2.6.8.7.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-audiomixer.html#id-1.2.6.8.7.2"/>
+    <keyword type="struct" name="struct GstAudioMixer" link="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer-struct"/>
+    <keyword type="property" name="The “alignment-threshold” property" link="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--alignment-threshold"/>
+    <keyword type="property" name="The “caps” property" link="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--caps"/>
+    <keyword type="property" name="The “discont-wait” property" link="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--discont-wait"/>
+    <keyword type="property" name="The “blocksize” property" link="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--blocksize"/>
+    <keyword type="property" name="The “output-buffer-duration” property" link="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--output-buffer-duration"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-autoconvert.html#id-1.2.7.8.3.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-autoconvert.html#id-1.2.7.8.3.2.2"/>
     <keyword type="struct" name="struct GstAutoConvert" link="gst-plugins-bad-plugins-autoconvert.html#GstAutoConvert-struct"/>
     <keyword type="property" name="The “factories” property" link="gst-plugins-bad-plugins-autoconvert.html#GstAutoConvert--factories"/>
     <keyword type="property" name="The “initial-identity” property" link="gst-plugins-bad-plugins-autoconvert.html#GstAutoConvert--initial-identity"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-bulge.html#id-1.2.5.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-bulge.html#id-1.2.5.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-bs2b.html#id-1.2.8.4.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-bs2b.html#id-1.2.8.4.2.2"/>
+    <keyword type="struct" name="struct GstBs2b" link="gst-plugins-bad-plugins-bs2b.html#GstBs2b"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-bulge.html#id-1.2.9.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-bulge.html#id-1.2.9.7.2.2"/>
     <keyword type="struct" name="struct GstBulge" link="gst-plugins-bad-plugins-bulge.html#GstBulge-struct"/>
     <keyword type="property" name="The “zoom” property" link="gst-plugins-bad-plugins-bulge.html#GstBulge--zoom"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-burn.html#id-1.2.6.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-burn.html#id-1.2.6.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-burn.html#id-1.2.6.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-burn.html#id-1.2.10.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-burn.html#id-1.2.10.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-burn.html#id-1.2.10.7.4.2"/>
     <keyword type="struct" name="struct GstBurn" link="gst-plugins-bad-plugins-burn.html#GstBurn-struct"/>
     <keyword type="property" name="The “silent” property" link="gst-plugins-bad-plugins-burn.html#GstBurn--silent"/>
     <keyword type="property" name="The “adjustment” property" link="gst-plugins-bad-plugins-burn.html#GstBurn--adjustment"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-camerabin.html#id-1.2.7.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-camerabin.html#id-1.2.7.3.2.2"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-chromium.html#id-1.2.8.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-chromium.html#id-1.2.8.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-chromium.html#id-1.2.8.7.4.2"/>
-    <keyword type="typedef" name="GstChromium" link="gst-plugins-bad-plugins-chromium.html#GstChromium"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-camerabin.html#id-1.2.11.3.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-camerabin.html#id-1.2.11.3.2.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-chromium.html#id-1.2.12.6.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-chromium.html#id-1.2.12.6.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-chromium.html#id-1.2.12.6.4.2"/>
     <keyword type="property" name="The “silent” property" link="gst-plugins-bad-plugins-chromium.html#GstChromium--silent"/>
     <keyword type="property" name="The “edge-a” property" link="gst-plugins-bad-plugins-chromium.html#GstChromium--edge-a"/>
     <keyword type="property" name="The “edge-b” property" link="gst-plugins-bad-plugins-chromium.html#GstChromium--edge-b"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-circle.html#id-1.2.9.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-circle.html#id-1.2.9.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-circle.html#id-1.2.13.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-circle.html#id-1.2.13.7.2.2"/>
     <keyword type="struct" name="struct GstCircle" link="gst-plugins-bad-plugins-circle.html#GstCircle-struct"/>
     <keyword type="property" name="The “angle” property" link="gst-plugins-bad-plugins-circle.html#GstCircle--angle"/>
     <keyword type="property" name="The “height” property" link="gst-plugins-bad-plugins-circle.html#GstCircle--height"/>
     <keyword type="property" name="The “spread-angle” property" link="gst-plugins-bad-plugins-circle.html#GstCircle--spread-angle"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-coloreffects.html#id-1.2.10.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-coloreffects.html#id-1.2.10.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-coloreffects.html#id-1.2.10.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-coloreffects.html#id-1.2.14.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-coloreffects.html#id-1.2.14.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-coloreffects.html#id-1.2.14.7.4.2"/>
     <keyword type="struct" name="struct GstColorEffects" link="gst-plugins-bad-plugins-coloreffects.html#GstColorEffects-struct"/>
     <keyword type="property" name="The “preset” property" link="gst-plugins-bad-plugins-coloreffects.html#GstColorEffects--preset"/>
-    <keyword type="" name="Sample pipelines" link="gst-plugins-bad-plugins-compositor.html#id-1.2.11.7.5"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-compositor.html#id-1.2.11.7.6.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-compositor.html#id-1.2.11.7.6.2"/>
+    <keyword type="" name="Sample pipelines" link="gst-plugins-bad-plugins-compositor.html#id-1.2.15.7.6"/>
     <keyword type="property" name="The “background” property" link="gst-plugins-bad-plugins-compositor.html#GstCompositor--background"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvdilate.html#id-1.2.12.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvdilate.html#id-1.2.12.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvdilate.html#id-1.2.16.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvdilate.html#id-1.2.16.6.2.2"/>
     <keyword type="struct" name="struct GstCvDilate" link="gst-plugins-bad-plugins-cvdilate.html#GstCvDilate-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cverode.html#id-1.2.13.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cverode.html#id-1.2.13.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cverode.html#id-1.2.17.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cverode.html#id-1.2.17.6.2.2"/>
     <keyword type="struct" name="struct GstCvErode" link="gst-plugins-bad-plugins-cverode.html#GstCvErode-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvequalizehist.html#id-1.2.14.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvequalizehist.html#id-1.2.14.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvequalizehist.html#id-1.2.18.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvequalizehist.html#id-1.2.18.6.2.2"/>
     <keyword type="struct" name="struct GstCvEqualizeHist" link="gst-plugins-bad-plugins-cvequalizehist.html#GstCvEqualizeHist-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvlaplace.html#id-1.2.15.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvlaplace.html#id-1.2.15.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvlaplace.html#id-1.2.19.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvlaplace.html#id-1.2.19.7.2.2"/>
     <keyword type="struct" name="struct GstCvLaplace" link="gst-plugins-bad-plugins-cvlaplace.html#GstCvLaplace-struct"/>
     <keyword type="property" name="The “aperture-size” property" link="gst-plugins-bad-plugins-cvlaplace.html#GstCvLaplace--aperture-size"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvsmooth.html#id-1.2.16.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvsmooth.html#id-1.2.16.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvsmooth.html#id-1.2.20.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvsmooth.html#id-1.2.20.7.2.2"/>
     <keyword type="struct" name="struct GstCvSmooth" link="gst-plugins-bad-plugins-cvsmooth.html#GstCvSmooth-struct"/>
     <keyword type="property" name="The “param1” property" link="gst-plugins-bad-plugins-cvsmooth.html#GstCvSmooth--param1"/>
     <keyword type="property" name="The “param2” property" link="gst-plugins-bad-plugins-cvsmooth.html#GstCvSmooth--param2"/>
     <keyword type="property" name="The “param3” property" link="gst-plugins-bad-plugins-cvsmooth.html#GstCvSmooth--param3"/>
     <keyword type="property" name="The “param4” property" link="gst-plugins-bad-plugins-cvsmooth.html#GstCvSmooth--param4"/>
     <keyword type="property" name="The “type” property" link="gst-plugins-bad-plugins-cvsmooth.html#GstCvSmooth--type"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvsobel.html#id-1.2.17.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvsobel.html#id-1.2.17.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-cvsobel.html#id-1.2.21.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-cvsobel.html#id-1.2.21.7.2.2"/>
     <keyword type="struct" name="struct GstCvSobel" link="gst-plugins-bad-plugins-cvsobel.html#GstCvSobel-struct"/>
     <keyword type="property" name="The “aperture-size” property" link="gst-plugins-bad-plugins-cvsobel.html#GstCvSobel--aperture-size"/>
     <keyword type="property" name="The “x-order” property" link="gst-plugins-bad-plugins-cvsobel.html#GstCvSobel--x-order"/>
     <keyword type="property" name="The “y-order” property" link="gst-plugins-bad-plugins-cvsobel.html#GstCvSobel--y-order"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dataurisrc.html#id-1.2.18.8.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dataurisrc.html#id-1.2.18.8.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dataurisrc.html#id-1.2.18.8.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dataurisrc.html#id-1.2.22.8.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dataurisrc.html#id-1.2.22.8.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dataurisrc.html#id-1.2.22.8.4.2"/>
     <keyword type="struct" name="struct GstDataURISrc" link="gst-plugins-bad-plugins-dataurisrc.html#GstDataURISrc-struct"/>
     <keyword type="property" name="The “uri” property" link="gst-plugins-bad-plugins-dataurisrc.html#GstDataURISrc--uri"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-diffuse.html#id-1.2.19.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-diffuse.html#id-1.2.19.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-diffuse.html#id-1.2.23.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-diffuse.html#id-1.2.23.7.2.2"/>
     <keyword type="struct" name="struct GstDiffuse" link="gst-plugins-bad-plugins-diffuse.html#GstDiffuse-struct"/>
     <keyword type="property" name="The “scale” property" link="gst-plugins-bad-plugins-diffuse.html#GstDiffuse--scale"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dilate.html#id-1.2.20.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dilate.html#id-1.2.20.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dilate.html#id-1.2.20.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dilate.html#id-1.2.24.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dilate.html#id-1.2.24.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dilate.html#id-1.2.24.7.4.2"/>
     <keyword type="struct" name="struct GstDilate" link="gst-plugins-bad-plugins-dilate.html#GstDilate-struct"/>
     <keyword type="property" name="The “silent” property" link="gst-plugins-bad-plugins-dilate.html#GstDilate--silent"/>
     <keyword type="property" name="The “erode” property" link="gst-plugins-bad-plugins-dilate.html#GstDilate--erode"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dodge.html#id-1.2.21.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dodge.html#id-1.2.21.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dodge.html#id-1.2.21.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dodge.html#id-1.2.25.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dodge.html#id-1.2.25.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dodge.html#id-1.2.25.7.4.2"/>
     <keyword type="struct" name="struct GstDodge" link="gst-plugins-bad-plugins-dodge.html#GstDodge-struct"/>
     <keyword type="property" name="The “silent” property" link="gst-plugins-bad-plugins-dodge.html#GstDodge--silent"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dtmfdetect.html#id-1.2.22.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dtmfdetect.html#id-1.2.22.6.2.2"/>
-    <keyword type="struct" name="struct GstDtmfDetect" link="gst-plugins-bad-plugins-dtmfdetect.html#GstDtmfDetect-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dtsdec.html#id-1.2.23.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dtsdec.html#id-1.2.23.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dtmfdetect.html#id-1.2.26.4.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dtmfdetect.html#id-1.2.26.4.2.2"/>
+    <keyword type="struct" name="struct GstDtmfDetect" link="gst-plugins-bad-plugins-dtmfdetect.html#GstDtmfDetect"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dtsdec.html#id-1.2.27.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dtsdec.html#id-1.2.27.7.2.2"/>
     <keyword type="struct" name="struct GstDtsDec" link="gst-plugins-bad-plugins-dtsdec.html#GstDtsDec-struct"/>
     <keyword type="property" name="The “drc” property" link="gst-plugins-bad-plugins-dtsdec.html#GstDtsDec--drc"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dvbsrc.html#id-1.2.24.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dvbsrc.html#id-1.2.24.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dvbsrc.html#id-1.2.28.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dvbsrc.html#id-1.2.28.8.2.2"/>
     <keyword type="struct" name="struct GstDvbSrc" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-struct"/>
     <keyword type="property" name="The “bandwidth-hz” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--bandwidth-hz"/>
     <keyword type="property" name="The “bandwidth” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--bandwidth"/>
@@ -269,26 +296,47 @@
     <keyword type="property" name="The “rolloff” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--rolloff"/>
     <keyword type="property" name="The “stream-id” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--stream-id"/>
     <keyword type="property" name="The “tuning-timeout” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--tuning-timeout"/>
+    <keyword type="property" name="The “isdbt-layer-enabled” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layer-enabled"/>
+    <keyword type="property" name="The “isdbt-layera-fec” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-fec"/>
+    <keyword type="property" name="The “isdbt-layera-modulation” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-modulation"/>
+    <keyword type="property" name="The “isdbt-layera-segment-count” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-segment-count"/>
+    <keyword type="property" name="The “isdbt-layera-time-interleaving” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-time-interleaving"/>
+    <keyword type="property" name="The “isdbt-layerb-fec” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-fec"/>
+    <keyword type="property" name="The “isdbt-layerb-modulation” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-modulation"/>
+    <keyword type="property" name="The “isdbt-layerb-segment-count” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-segment-count"/>
+    <keyword type="property" name="The “isdbt-layerb-time-interleaving” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-time-interleaving"/>
+    <keyword type="property" name="The “isdbt-layerc-fec” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-fec"/>
+    <keyword type="property" name="The “isdbt-layerc-modulation” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-modulation"/>
+    <keyword type="property" name="The “isdbt-layerc-segment-count” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-segment-count"/>
+    <keyword type="property" name="The “isdbt-layerc-time-interleaving” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-time-interleaving"/>
+    <keyword type="property" name="The “isdbt-partial-reception” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-partial-reception"/>
+    <keyword type="property" name="The “isdbt-sb-segment-count” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-segment-count"/>
+    <keyword type="property" name="The “isdbt-sb-segment-idx” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-segment-idx"/>
+    <keyword type="property" name="The “isdbt-sb-subchannel-id” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-subchannel-id"/>
+    <keyword type="property" name="The “isdbt-sound-broadcasting” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sound-broadcasting"/>
+    <keyword type="property" name="The “lnb-lof1” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-lof1"/>
+    <keyword type="property" name="The “lnb-lof2” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-lof2"/>
+    <keyword type="property" name="The “lnb-slof” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-slof"/>
+    <keyword type="property" name="The “interleaving” property" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--interleaving"/>
     <keyword type="signal" name="The “tuning-done” signal" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tuning-done"/>
     <keyword type="signal" name="The “tuning-fail” signal" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tuning-fail"/>
     <keyword type="signal" name="The “tuning-start” signal" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tuning-start"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dvdspu.html#id-1.2.25.6.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dvdspu.html#id-1.2.25.6.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dvdspu.html#id-1.2.25.6.4.2"/>
+    <keyword type="signal" name="The “tune” signal" link="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tune"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-dvdspu.html#id-1.2.29.6.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-dvdspu.html#id-1.2.29.6.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-dvdspu.html#id-1.2.29.6.4.2"/>
     <keyword type="struct" name="GstDVDSpu" link="gst-plugins-bad-plugins-dvdspu.html#GstDVDSpu-struct"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-exclusion.html#id-1.2.26.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-exclusion.html#id-1.2.26.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-exclusion.html#id-1.2.26.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-exclusion.html#id-1.2.30.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-exclusion.html#id-1.2.30.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-exclusion.html#id-1.2.30.7.4.2"/>
     <keyword type="struct" name="struct GstExclusion" link="gst-plugins-bad-plugins-exclusion.html#GstExclusion-struct"/>
     <keyword type="property" name="The “silent” property" link="gst-plugins-bad-plugins-exclusion.html#GstExclusion--silent"/>
     <keyword type="property" name="The “factor” property" link="gst-plugins-bad-plugins-exclusion.html#GstExclusion--factor"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-edgedetect.html#id-1.2.27.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-edgedetect.html#id-1.2.27.3.2.2"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-eglglessink.html#id-1.2.28.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-eglglessink.html#id-1.2.28.3.2.2"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-faac.html#id-1.2.29.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-faac.html#id-1.2.29.6.2.2"/>
-    <keyword type="struct" name="struct GstFaac" link="gst-plugins-bad-plugins-faac.html#GstFaac"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-edgedetect.html#id-1.2.31.3.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-edgedetect.html#id-1.2.31.3.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-faac.html#id-1.2.32.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-faac.html#id-1.2.32.8.2.2"/>
+    <keyword type="struct" name="struct GstFaac" link="gst-plugins-bad-plugins-faac.html#GstFaac-struct"/>
     <keyword type="property" name="The “bitrate” property" link="gst-plugins-bad-plugins-faac.html#GstFaac--bitrate"/>
     <keyword type="property" name="The “midside” property" link="gst-plugins-bad-plugins-faac.html#GstFaac--midside"/>
     <keyword type="property" name="The “outputformat” property" link="gst-plugins-bad-plugins-faac.html#GstFaac--outputformat"/>
@@ -297,23 +345,23 @@
     <keyword type="property" name="The “tns” property" link="gst-plugins-bad-plugins-faac.html#GstFaac--tns"/>
     <keyword type="property" name="The “quality” property" link="gst-plugins-bad-plugins-faac.html#GstFaac--quality"/>
     <keyword type="property" name="The “rate-control” property" link="gst-plugins-bad-plugins-faac.html#GstFaac--rate-control"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-faad.html#id-1.2.30.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-faad.html#id-1.2.30.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-faad.html#id-1.2.33.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-faad.html#id-1.2.33.6.2.2"/>
     <keyword type="struct" name="GstFaad" link="gst-plugins-bad-plugins-faad.html#GstFaad-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-faceblur.html#id-1.2.31.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-faceblur.html#id-1.2.31.3.2.2"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-facedetect.html#id-1.2.32.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-facedetect.html#id-1.2.32.3.2.2"/>
-    <keyword type="" name="Example pipeline" link="gst-plugins-bad-plugins-festival.html#id-1.2.33.6.5"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-festival.html#id-1.2.33.6.6.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-festival.html#id-1.2.33.6.6.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-faceblur.html#id-1.2.34.3.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-faceblur.html#id-1.2.34.3.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-facedetect.html#id-1.2.35.3.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-facedetect.html#id-1.2.35.3.2.2"/>
+    <keyword type="" name="Example pipeline" link="gst-plugins-bad-plugins-festival.html#id-1.2.36.6.5"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-festival.html#id-1.2.36.6.6.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-festival.html#id-1.2.36.6.6.2"/>
     <keyword type="struct" name="struct GstFestival" link="gst-plugins-bad-plugins-festival.html#GstFestival-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-fisheye.html#id-1.2.34.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-fisheye.html#id-1.2.34.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-fisheye.html#id-1.2.37.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-fisheye.html#id-1.2.37.6.2.2"/>
     <keyword type="struct" name="struct GstFisheye" link="gst-plugins-bad-plugins-fisheye.html#GstFisheye-struct"/>
-    <keyword type="" name="Example launch lines" link="gst-plugins-bad-plugins-fpsdisplaysink.html#id-1.2.35.9.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-fpsdisplaysink.html#id-1.2.35.9.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-fpsdisplaysink.html#id-1.2.35.9.4.2"/>
+    <keyword type="" name="Example launch lines" link="gst-plugins-bad-plugins-fpsdisplaysink.html#id-1.2.38.9.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-fpsdisplaysink.html#id-1.2.38.9.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-fpsdisplaysink.html#id-1.2.38.9.4.2"/>
     <keyword type="struct" name="struct GstFPSDisplaySink" link="gst-plugins-bad-plugins-fpsdisplaysink.html#GstFPSDisplaySink-struct"/>
     <keyword type="property" name="The “sync” property" link="gst-plugins-bad-plugins-fpsdisplaysink.html#GstFPSDisplaySink--sync"/>
     <keyword type="property" name="The “text-overlay” property" link="gst-plugins-bad-plugins-fpsdisplaysink.html#GstFPSDisplaySink--text-overlay"/>
@@ -327,12 +375,12 @@
     <keyword type="property" name="The “last-message” property" link="gst-plugins-bad-plugins-fpsdisplaysink.html#GstFPSDisplaySink--last-message"/>
     <keyword type="property" name="The “silent” property" link="gst-plugins-bad-plugins-fpsdisplaysink.html#GstFPSDisplaySink--silent"/>
     <keyword type="signal" name="The “fps-measurements” signal" link="gst-plugins-bad-plugins-fpsdisplaysink.html#GstFPSDisplaySink-fps-measurements"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-gaussianblur.html#id-1.2.36.3.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-gaussianblur.html#id-1.2.36.3.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-gaussianblur.html#id-1.2.36.3.4.2"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-jpegparse.html#id-1.2.37.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-jpegparse.html#id-1.2.37.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-jpegparse.html#id-1.2.37.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-gaussianblur.html#id-1.2.39.3.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-gaussianblur.html#id-1.2.39.3.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-gaussianblur.html#id-1.2.39.3.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-jpegparse.html#id-1.2.40.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-jpegparse.html#id-1.2.40.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-jpegparse.html#id-1.2.40.7.4.2"/>
     <keyword type="macro" name="GST_JPEG_PARSE()" link="gst-plugins-bad-plugins-jpegparse.html#GST-JPEG-PARSE:CAPS"/>
     <keyword type="macro" name="GST_JPEG_PARSE_CLASS()" link="gst-plugins-bad-plugins-jpegparse.html#GST-JPEG-PARSE-CLASS:CAPS"/>
     <keyword type="macro" name="GST_IS_JPEG_PARSE()" link="gst-plugins-bad-plugins-jpegparse.html#GST-IS-JPEG-PARSE:CAPS"/>
@@ -341,36 +389,36 @@
     <keyword type="struct" name="struct GstJpegParse" link="gst-plugins-bad-plugins-jpegparse.html#GstJpegParse-struct"/>
     <keyword type="struct" name="struct GstJpegParseClass" link="gst-plugins-bad-plugins-jpegparse.html#GstJpegParseClass"/>
     <keyword type="macro" name="GST_TYPE_JPEG_PARSE" link="gst-plugins-bad-plugins-jpegparse.html#GST-TYPE-JPEG-PARSE:CAPS"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-kaleidoscope.html#id-1.2.38.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-kaleidoscope.html#id-1.2.38.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-kaleidoscope.html#id-1.2.41.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-kaleidoscope.html#id-1.2.41.7.2.2"/>
     <keyword type="struct" name="struct GstKaleidoscope" link="gst-plugins-bad-plugins-kaleidoscope.html#GstKaleidoscope-struct"/>
     <keyword type="property" name="The “angle” property" link="gst-plugins-bad-plugins-kaleidoscope.html#GstKaleidoscope--angle"/>
     <keyword type="property" name="The “angle2” property" link="gst-plugins-bad-plugins-kaleidoscope.html#GstKaleidoscope--angle2"/>
     <keyword type="property" name="The “sides” property" link="gst-plugins-bad-plugins-kaleidoscope.html#GstKaleidoscope--sides"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-liveadder.html#id-1.2.39.7.3.1.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-liveadder.html#id-1.2.39.7.3.1.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-liveadder.html#id-1.2.42.7.3.1.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-liveadder.html#id-1.2.42.7.3.1.2"/>
     <keyword type="struct" name="struct GstLiveAdder" link="gst-plugins-bad-plugins-liveadder.html#GstLiveAdder-struct"/>
     <keyword type="property" name="The “latency” property" link="gst-plugins-bad-plugins-liveadder.html#GstLiveAdder--latency"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-marble.html#id-1.2.40.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-marble.html#id-1.2.40.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-marble.html#id-1.2.43.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-marble.html#id-1.2.43.7.2.2"/>
     <keyword type="struct" name="struct GstMarble" link="gst-plugins-bad-plugins-marble.html#GstMarble-struct"/>
     <keyword type="property" name="The “amount” property" link="gst-plugins-bad-plugins-marble.html#GstMarble--amount"/>
     <keyword type="property" name="The “turbulence” property" link="gst-plugins-bad-plugins-marble.html#GstMarble--turbulence"/>
     <keyword type="property" name="The “x-scale” property" link="gst-plugins-bad-plugins-marble.html#GstMarble--x-scale"/>
     <keyword type="property" name="The “y-scale” property" link="gst-plugins-bad-plugins-marble.html#GstMarble--y-scale"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mimenc.html#id-1.2.41.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mimenc.html#id-1.2.41.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mimenc.html#id-1.2.44.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mimenc.html#id-1.2.44.7.2.2"/>
     <keyword type="struct" name="struct GstMimEnc" link="gst-plugins-bad-plugins-mimenc.html#GstMimEnc-struct"/>
     <keyword type="property" name="The “paused-mode” property" link="gst-plugins-bad-plugins-mimenc.html#GstMimEnc--paused-mode"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mimdec.html#id-1.2.42.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mimdec.html#id-1.2.42.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mimdec.html#id-1.2.45.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mimdec.html#id-1.2.45.6.2.2"/>
     <keyword type="struct" name="struct GstMimDec" link="gst-plugins-bad-plugins-mimdec.html#GstMimDec-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mirror.html#id-1.2.43.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mirror.html#id-1.2.43.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mirror.html#id-1.2.46.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mirror.html#id-1.2.46.7.2.2"/>
     <keyword type="struct" name="struct GstMirror" link="gst-plugins-bad-plugins-mirror.html#GstMirror-struct"/>
     <keyword type="property" name="The “mode” property" link="gst-plugins-bad-plugins-mirror.html#GstMirror--mode"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-modplug.html#id-1.2.44.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-modplug.html#id-1.2.44.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-modplug.html#id-1.2.47.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-modplug.html#id-1.2.47.7.2.2"/>
     <keyword type="struct" name="GstModPlug" link="gst-plugins-bad-plugins-modplug.html#GstModPlug-struct"/>
     <keyword type="property" name="The “megabass” property" link="gst-plugins-bad-plugins-modplug.html#GstModPlug--megabass"/>
     <keyword type="property" name="The “megabass-amount” property" link="gst-plugins-bad-plugins-modplug.html#GstModPlug--megabass-amount"/>
@@ -384,8 +432,8 @@
     <keyword type="property" name="The “surround” property" link="gst-plugins-bad-plugins-modplug.html#GstModPlug--surround"/>
     <keyword type="property" name="The “surround-delay” property" link="gst-plugins-bad-plugins-modplug.html#GstModPlug--surround-delay"/>
     <keyword type="property" name="The “surround-depth” property" link="gst-plugins-bad-plugins-modplug.html#GstModPlug--surround-depth"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mpeg2enc.html#id-1.2.45.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mpeg2enc.html#id-1.2.45.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mpeg2enc.html#id-1.2.48.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mpeg2enc.html#id-1.2.48.8.2.2"/>
     <keyword type="struct" name="GstMpeg2enc" link="gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc-struct"/>
     <keyword type="property" name="The “altscan-mpeg2” property" link="gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--altscan-mpeg2"/>
     <keyword type="property" name="The “aspect” property" link="gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--aspect"/>
@@ -421,8 +469,19 @@
     <keyword type="property" name="The “sequence-length” property" link="gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--sequence-length"/>
     <keyword type="property" name="The “unit-coeff-elim” property" link="gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--unit-coeff-elim"/>
     <keyword type="property" name="The “vcd-still-size” property" link="gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--vcd-still-size"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mplex.html#id-1.2.46.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mplex.html#id-1.2.46.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mpegpsmux.html#id-1.2.49.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mpegpsmux.html#id-1.2.49.6.2.2"/>
+    <keyword type="property" name="The “aggregate-gops” property" link="gst-plugins-bad-plugins-mpegpsmux.html#MpegPsMux--aggregate-gops"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mpegtsmux.html#id-1.2.50.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mpegtsmux.html#id-1.2.50.6.2.2"/>
+    <keyword type="property" name="The “m2ts-mode” property" link="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--m2ts-mode"/>
+    <keyword type="property" name="The “prog-map” property" link="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--prog-map"/>
+    <keyword type="property" name="The “pat-interval” property" link="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--pat-interval"/>
+    <keyword type="property" name="The “pmt-interval” property" link="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--pmt-interval"/>
+    <keyword type="property" name="The “alignment” property" link="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--alignment"/>
+    <keyword type="property" name="The “si-interval” property" link="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--si-interval"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mplex.html#id-1.2.51.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mplex.html#id-1.2.51.7.2.2"/>
     <keyword type="struct" name="GstMplex" link="gst-plugins-bad-plugins-mplex.html#GstMplex-struct"/>
     <keyword type="property" name="The “bufsize” property" link="gst-plugins-bad-plugins-mplex.html#GstMplex--bufsize"/>
     <keyword type="property" name="The “format” property" link="gst-plugins-bad-plugins-mplex.html#GstMplex--format"/>
@@ -431,12 +490,12 @@
     <keyword type="property" name="The “sector-size” property" link="gst-plugins-bad-plugins-mplex.html#GstMplex--sector-size"/>
     <keyword type="property" name="The “system-headers” property" link="gst-plugins-bad-plugins-mplex.html#GstMplex--system-headers"/>
     <keyword type="property" name="The “vbr” property" link="gst-plugins-bad-plugins-mplex.html#GstMplex--vbr"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mpg123audiodec.html#id-1.2.47.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mpg123audiodec.html#id-1.2.47.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-mpg123audiodec.html#id-1.2.52.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-mpg123audiodec.html#id-1.2.52.6.2.2"/>
     <keyword type="struct" name="struct GstMpg123AudioDec" link="gst-plugins-bad-plugins-mpg123audiodec.html#GstMpg123AudioDec-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-neonhttpsrc.html#id-1.2.48.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-neonhttpsrc.html#id-1.2.48.6.2.2"/>
-    <keyword type="struct" name="struct GstNeonhttpSrc" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-neonhttpsrc.html#id-1.2.53.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-neonhttpsrc.html#id-1.2.53.8.2.2"/>
+    <keyword type="struct" name="struct GstNeonhttpSrc" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc-struct"/>
     <keyword type="property" name="The “location” property" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--location"/>
     <keyword type="property" name="The “proxy” property" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--proxy"/>
     <keyword type="property" name="The “uri” property" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--uri"/>
@@ -451,20 +510,50 @@
     <keyword type="property" name="The “connect-timeout” property" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--connect-timeout"/>
     <keyword type="property" name="The “cookies” property" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--cookies"/>
     <keyword type="property" name="The “read-timeout” property" link="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--read-timeout"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-ofa.html#id-1.2.49.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-ofa.html#id-1.2.49.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-ofa.html#id-1.2.54.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-ofa.html#id-1.2.54.7.2.2"/>
     <keyword type="struct" name="struct GstOFA" link="gst-plugins-bad-plugins-ofa.html#GstOFA-struct"/>
     <keyword type="property" name="The “fingerprint” property" link="gst-plugins-bad-plugins-ofa.html#GstOFA--fingerprint"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-openalsrc.html#id-1.2.50.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-openalsrc.html#id-1.2.50.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-openalsrc.html#id-1.2.55.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-openalsrc.html#id-1.2.55.7.2.2"/>
     <keyword type="struct" name="struct GstOpenalSrc" link="gst-plugins-bad-plugins-openalsrc.html#GstOpenalSrc-struct"/>
     <keyword type="property" name="The “device” property" link="gst-plugins-bad-plugins-openalsrc.html#GstOpenalSrc--device"/>
     <keyword type="property" name="The “device-name” property" link="gst-plugins-bad-plugins-openalsrc.html#GstOpenalSrc--device-name"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-openalsink.html#id-1.2.51.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-openalsink.html#id-1.2.51.3.2.2"/>
-    <keyword type="" name="Example pipelines" link="gst-plugins-bad-plugins-pcapparse.html#id-1.2.52.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-pcapparse.html#id-1.2.52.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-pcapparse.html#id-1.2.52.7.4.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-openalsink.html#id-1.2.56.3.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-openalsink.html#id-1.2.56.3.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-opusdec.html#id-1.2.57.9.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-opusdec.html#id-1.2.57.9.2.2"/>
+    <keyword type="struct" name="struct GstOpusDec" link="gst-plugins-bad-plugins-opusdec.html#GstOpusDec-struct"/>
+    <keyword type="property" name="The “apply-gain” property" link="gst-plugins-bad-plugins-opusdec.html#GstOpusDec--apply-gain"/>
+    <keyword type="property" name="The “use-inband-fec” property" link="gst-plugins-bad-plugins-opusdec.html#GstOpusDec--use-inband-fec"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-opusenc.html#id-1.2.58.10.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-opusenc.html#id-1.2.58.10.2.2"/>
+    <keyword type="struct" name="struct GstOpusEnc" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc-struct"/>
+    <keyword type="property" name="The “audio” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--audio"/>
+    <keyword type="property" name="The “bandwidth” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bandwidth"/>
+    <keyword type="property" name="The “bitrate” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bitrate"/>
+    <keyword type="property" name="The “cbr” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--cbr"/>
+    <keyword type="property" name="The “complexity” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--complexity"/>
+    <keyword type="property" name="The “constrained-vbr” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--constrained-vbr"/>
+    <keyword type="property" name="The “dtx” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--dtx"/>
+    <keyword type="property" name="The “frame-size” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--frame-size"/>
+    <keyword type="property" name="The “inband-fec” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--inband-fec"/>
+    <keyword type="property" name="The “max-payload-size” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--max-payload-size"/>
+    <keyword type="property" name="The “packet-loss-percentage” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--packet-loss-percentage"/>
+    <keyword type="property" name="The “audio-type” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--audio-type"/>
+    <keyword type="property" name="The “bitrate-type” property" link="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bitrate-type"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-opusparse.html#id-1.2.59.10.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-opusparse.html#id-1.2.59.10.2.2"/>
+    <keyword type="struct" name="struct GstOpusParse" link="gst-plugins-bad-plugins-opusparse.html#GstOpusParse-struct"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rtpopuspay.html#id-1.2.60.12.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rtpopuspay.html#id-1.2.60.12.2.2"/>
+    <keyword type="struct" name="struct GstRtpOPUSPay" link="gst-plugins-bad-plugins-rtpopuspay.html#GstRtpOPUSPay-struct"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rtpopusdepay.html#id-1.2.61.11.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rtpopusdepay.html#id-1.2.61.11.2.2"/>
+    <keyword type="struct" name="struct GstRTPOpusDepay" link="gst-plugins-bad-plugins-rtpopusdepay.html#GstRTPOpusDepay-struct"/>
+    <keyword type="" name="Example pipelines" link="gst-plugins-bad-plugins-pcapparse.html#id-1.2.62.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-pcapparse.html#id-1.2.62.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-pcapparse.html#id-1.2.62.7.4.2"/>
     <keyword type="struct" name="struct GstPcapParse" link="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse-struct"/>
     <keyword type="property" name="The “dst-ip” property" link="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse--dst-ip"/>
     <keyword type="property" name="The “dst-port” property" link="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse--dst-port"/>
@@ -472,14 +561,14 @@
     <keyword type="property" name="The “src-port” property" link="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse--src-port"/>
     <keyword type="property" name="The “caps” property" link="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse--caps"/>
     <keyword type="property" name="The “ts-offset” property" link="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse--ts-offset"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-pinch.html#id-1.2.53.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-pinch.html#id-1.2.53.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-pinch.html#id-1.2.63.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-pinch.html#id-1.2.63.7.2.2"/>
     <keyword type="struct" name="struct GstPinch" link="gst-plugins-bad-plugins-pinch.html#GstPinch-struct"/>
     <keyword type="property" name="The “intensity” property" link="gst-plugins-bad-plugins-pinch.html#GstPinch--intensity"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-pyramidsegment.html#id-1.2.54.4.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-pyramidsegment.html#id-1.2.54.4.2.2"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rfbsrc.html#id-1.2.55.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rfbsrc.html#id-1.2.55.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-pyramidsegment.html#id-1.2.64.4.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-pyramidsegment.html#id-1.2.64.4.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rfbsrc.html#id-1.2.65.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rfbsrc.html#id-1.2.65.7.2.2"/>
     <keyword type="struct" name="struct GstRfbSrc" link="gst-plugins-bad-plugins-rfbsrc.html#GstRfbSrc-struct"/>
     <keyword type="property" name="The “host” property" link="gst-plugins-bad-plugins-rfbsrc.html#GstRfbSrc--host"/>
     <keyword type="property" name="The “port” property" link="gst-plugins-bad-plugins-rfbsrc.html#GstRfbSrc--port"/>
@@ -493,16 +582,16 @@
     <keyword type="property" name="The “use-copyrect” property" link="gst-plugins-bad-plugins-rfbsrc.html#GstRfbSrc--use-copyrect"/>
     <keyword type="property" name="The “shared” property" link="gst-plugins-bad-plugins-rfbsrc.html#GstRfbSrc--shared"/>
     <keyword type="property" name="The “view-only” property" link="gst-plugins-bad-plugins-rfbsrc.html#GstRfbSrc--view-only"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rtmpsink.html#id-1.2.56.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rtmpsink.html#id-1.2.56.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rtmpsink.html#id-1.2.66.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rtmpsink.html#id-1.2.66.8.2.2"/>
     <keyword type="struct" name="struct GstRTMPSink" link="gst-plugins-bad-plugins-rtmpsink.html#GstRTMPSink-struct"/>
     <keyword type="property" name="The “location” property" link="gst-plugins-bad-plugins-rtmpsink.html#GstRTMPSink--location"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rtmpsrc.html#id-1.2.57.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rtmpsrc.html#id-1.2.57.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-rtmpsrc.html#id-1.2.67.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-rtmpsrc.html#id-1.2.67.8.2.2"/>
     <keyword type="struct" name="struct GstRTMPSrc" link="gst-plugins-bad-plugins-rtmpsrc.html#GstRTMPSrc-struct"/>
     <keyword type="property" name="The “location” property" link="gst-plugins-bad-plugins-rtmpsrc.html#GstRTMPSrc--location"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-shmsink.html#id-1.2.58.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-shmsink.html#id-1.2.58.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-shmsink.html#id-1.2.68.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-shmsink.html#id-1.2.68.8.2.2"/>
     <keyword type="struct" name="struct GstShmSink" link="gst-plugins-bad-plugins-shmsink.html#GstShmSink-struct"/>
     <keyword type="property" name="The “perms” property" link="gst-plugins-bad-plugins-shmsink.html#GstShmSink--perms"/>
     <keyword type="property" name="The “shm-size” property" link="gst-plugins-bad-plugins-shmsink.html#GstShmSink--shm-size"/>
@@ -511,67 +600,67 @@
     <keyword type="property" name="The “buffer-time” property" link="gst-plugins-bad-plugins-shmsink.html#GstShmSink--buffer-time"/>
     <keyword type="signal" name="The “client-connected” signal" link="gst-plugins-bad-plugins-shmsink.html#GstShmSink-client-connected"/>
     <keyword type="signal" name="The “client-disconnected” signal" link="gst-plugins-bad-plugins-shmsink.html#GstShmSink-client-disconnected"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-shmsrc.html#id-1.2.59.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-shmsrc.html#id-1.2.59.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-shmsrc.html#id-1.2.69.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-shmsrc.html#id-1.2.69.7.2.2"/>
     <keyword type="struct" name="struct GstShmSrc" link="gst-plugins-bad-plugins-shmsrc.html#GstShmSrc-struct"/>
     <keyword type="property" name="The “is-live” property" link="gst-plugins-bad-plugins-shmsrc.html#GstShmSrc--is-live"/>
     <keyword type="property" name="The “socket-path” property" link="gst-plugins-bad-plugins-shmsrc.html#GstShmSrc--socket-path"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-sdpdemux.html#id-1.2.60.8.5"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-sdpdemux.html#id-1.2.60.8.6.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-sdpdemux.html#id-1.2.60.8.6.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-sdpdemux.html#id-1.2.70.8.5"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-sdpdemux.html#id-1.2.70.8.6.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-sdpdemux.html#id-1.2.70.8.6.2"/>
     <keyword type="struct" name="struct GstSDPDemux" link="gst-plugins-bad-plugins-sdpdemux.html#GstSDPDemux-struct"/>
     <keyword type="property" name="The “debug” property" link="gst-plugins-bad-plugins-sdpdemux.html#GstSDPDemux--debug"/>
     <keyword type="property" name="The “latency” property" link="gst-plugins-bad-plugins-sdpdemux.html#GstSDPDemux--latency"/>
     <keyword type="property" name="The “timeout” property" link="gst-plugins-bad-plugins-sdpdemux.html#GstSDPDemux--timeout"/>
     <keyword type="property" name="The “redirect” property" link="gst-plugins-bad-plugins-sdpdemux.html#GstSDPDemux--redirect"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-solarize.html#id-1.2.61.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-solarize.html#id-1.2.61.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-solarize.html#id-1.2.61.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-solarize.html#id-1.2.71.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-solarize.html#id-1.2.71.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-solarize.html#id-1.2.71.7.4.2"/>
     <keyword type="struct" name="struct GstSolarize" link="gst-plugins-bad-plugins-solarize.html#GstSolarize-struct"/>
     <keyword type="property" name="The “silent” property" link="gst-plugins-bad-plugins-solarize.html#GstSolarize--silent"/>
     <keyword type="property" name="The “end” property" link="gst-plugins-bad-plugins-solarize.html#GstSolarize--end"/>
     <keyword type="property" name="The “start” property" link="gst-plugins-bad-plugins-solarize.html#GstSolarize--start"/>
     <keyword type="property" name="The “threshold” property" link="gst-plugins-bad-plugins-solarize.html#GstSolarize--threshold"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-spacescope.html#id-1.2.62.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-spacescope.html#id-1.2.62.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-spacescope.html#id-1.2.62.7.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-spacescope.html#id-1.2.72.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-spacescope.html#id-1.2.72.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-spacescope.html#id-1.2.72.7.4.2"/>
     <keyword type="struct" name="struct GstSpaceScope" link="gst-plugins-bad-plugins-spacescope.html#GstSpaceScope-struct"/>
     <keyword type="property" name="The “style” property" link="gst-plugins-bad-plugins-spacescope.html#GstSpaceScope--style"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-spectrascope.html#id-1.2.63.6.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-spectrascope.html#id-1.2.63.6.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-spectrascope.html#id-1.2.63.6.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-spectrascope.html#id-1.2.73.6.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-spectrascope.html#id-1.2.73.6.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-spectrascope.html#id-1.2.73.6.4.2"/>
     <keyword type="struct" name="struct GstSpectraScope" link="gst-plugins-bad-plugins-spectrascope.html#GstSpectraScope-struct"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-synaescope.html#id-1.2.64.6.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-synaescope.html#id-1.2.64.6.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-synaescope.html#id-1.2.64.6.4.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-synaescope.html#id-1.2.74.6.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-synaescope.html#id-1.2.74.6.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-synaescope.html#id-1.2.74.6.4.2"/>
     <keyword type="struct" name="struct GstSynaeScope" link="gst-plugins-bad-plugins-synaescope.html#GstSynaeScope-struct"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-speed.html#id-1.2.65.7.4"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-speed.html#id-1.2.65.7.5.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-speed.html#id-1.2.65.7.5.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-speed.html#id-1.2.75.7.4"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-speed.html#id-1.2.75.7.5.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-speed.html#id-1.2.75.7.5.2"/>
     <keyword type="struct" name="struct GstSpeed" link="gst-plugins-bad-plugins-speed.html#GstSpeed-struct"/>
     <keyword type="property" name="The “speed” property" link="gst-plugins-bad-plugins-speed.html#GstSpeed--speed"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-sphere.html#id-1.2.66.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-sphere.html#id-1.2.66.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-sphere.html#id-1.2.76.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-sphere.html#id-1.2.76.7.2.2"/>
     <keyword type="struct" name="struct GstSphere" link="gst-plugins-bad-plugins-sphere.html#GstSphere-struct"/>
     <keyword type="property" name="The “refraction” property" link="gst-plugins-bad-plugins-sphere.html#GstSphere--refraction"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-square.html#id-1.2.67.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-square.html#id-1.2.67.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-square.html#id-1.2.77.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-square.html#id-1.2.77.7.2.2"/>
     <keyword type="struct" name="struct GstSquare" link="gst-plugins-bad-plugins-square.html#GstSquare-struct"/>
     <keyword type="property" name="The “height” property" link="gst-plugins-bad-plugins-square.html#GstSquare--height"/>
     <keyword type="property" name="The “width” property" link="gst-plugins-bad-plugins-square.html#GstSquare--width"/>
     <keyword type="property" name="The “zoom” property" link="gst-plugins-bad-plugins-square.html#GstSquare--zoom"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-stretch.html#id-1.2.68.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-stretch.html#id-1.2.68.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-stretch.html#id-1.2.78.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-stretch.html#id-1.2.78.7.2.2"/>
     <keyword type="struct" name="struct GstStretch" link="gst-plugins-bad-plugins-stretch.html#GstStretch-struct"/>
     <keyword type="property" name="The “intensity” property" link="gst-plugins-bad-plugins-stretch.html#GstStretch--intensity"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-templatematch.html#id-1.2.69.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-templatematch.html#id-1.2.69.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-templatematch.html#id-1.2.79.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-templatematch.html#id-1.2.79.8.2.2"/>
     <keyword type="struct" name="struct GstTemplateMatch" link="gst-plugins-bad-plugins-templatematch.html#GstTemplateMatch-struct"/>
     <keyword type="property" name="The “display” property" link="gst-plugins-bad-plugins-templatematch.html#GstTemplateMatch--display"/>
     <keyword type="property" name="The “method” property" link="gst-plugins-bad-plugins-templatematch.html#GstTemplateMatch--method"/>
     <keyword type="property" name="The “template” property" link="gst-plugins-bad-plugins-templatematch.html#GstTemplateMatch--template"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-opencvtextoverlay.html#id-1.2.70.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-opencvtextoverlay.html#id-1.2.70.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-opencvtextoverlay.html#id-1.2.80.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-opencvtextoverlay.html#id-1.2.80.8.2.2"/>
     <keyword type="struct" name="struct GstOpencvTextOverlay" link="gst-plugins-bad-plugins-opencvtextoverlay.html#GstOpencvTextOverlay-struct"/>
     <keyword type="property" name="The “colorB” property" link="gst-plugins-bad-plugins-opencvtextoverlay.html#GstOpencvTextOverlay--colorB"/>
     <keyword type="property" name="The “colorG” property" link="gst-plugins-bad-plugins-opencvtextoverlay.html#GstOpencvTextOverlay--colorG"/>
@@ -582,15 +671,15 @@
     <keyword type="property" name="The “width” property" link="gst-plugins-bad-plugins-opencvtextoverlay.html#GstOpencvTextOverlay--width"/>
     <keyword type="property" name="The “xpos” property" link="gst-plugins-bad-plugins-opencvtextoverlay.html#GstOpencvTextOverlay--xpos"/>
     <keyword type="property" name="The “ypos” property" link="gst-plugins-bad-plugins-opencvtextoverlay.html#GstOpencvTextOverlay--ypos"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-tunnel.html#id-1.2.71.6.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-tunnel.html#id-1.2.71.6.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-tunnel.html#id-1.2.81.6.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-tunnel.html#id-1.2.81.6.2.2"/>
     <keyword type="struct" name="struct GstTunnel" link="gst-plugins-bad-plugins-tunnel.html#GstTunnel-struct"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-twirl.html#id-1.2.72.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-twirl.html#id-1.2.72.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-twirl.html#id-1.2.82.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-twirl.html#id-1.2.82.7.2.2"/>
     <keyword type="struct" name="struct GstTwirl" link="gst-plugins-bad-plugins-twirl.html#GstTwirl-struct"/>
     <keyword type="property" name="The “angle” property" link="gst-plugins-bad-plugins-twirl.html#GstTwirl--angle"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-videoparse.html#id-1.2.73.7.2.1.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-videoparse.html#id-1.2.73.7.2.1.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-videoparse.html#id-1.2.83.7.2.1.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-videoparse.html#id-1.2.83.7.2.1.2"/>
     <keyword type="struct" name="struct GstVideoParse" link="gst-plugins-bad-plugins-videoparse.html#GstVideoParse-struct"/>
     <keyword type="property" name="The “alpha-mask” property" link="gst-plugins-bad-plugins-videoparse.html#GstVideoParse--alpha-mask"/>
     <keyword type="property" name="The “blue-mask” property" link="gst-plugins-bad-plugins-videoparse.html#GstVideoParse--blue-mask"/>
@@ -606,89 +695,27 @@
     <keyword type="property" name="The “width” property" link="gst-plugins-bad-plugins-videoparse.html#GstVideoParse--width"/>
     <keyword type="property" name="The “interlaced” property" link="gst-plugins-bad-plugins-videoparse.html#GstVideoParse--interlaced"/>
     <keyword type="property" name="The “top-field-first” property" link="gst-plugins-bad-plugins-videoparse.html#GstVideoParse--top-field-first"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-waterripple.html#id-1.2.74.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-waterripple.html#id-1.2.74.7.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-waterripple.html#id-1.2.84.7.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-waterripple.html#id-1.2.84.7.2.2"/>
     <keyword type="struct" name="struct GstWaterRipple" link="gst-plugins-bad-plugins-waterripple.html#GstWaterRipple-struct"/>
     <keyword type="property" name="The “amplitude” property" link="gst-plugins-bad-plugins-waterripple.html#GstWaterRipple--amplitude"/>
     <keyword type="property" name="The “phase” property" link="gst-plugins-bad-plugins-waterripple.html#GstWaterRipple--phase"/>
     <keyword type="property" name="The “wavelength” property" link="gst-plugins-bad-plugins-waterripple.html#GstWaterRipple--wavelength"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-zbar.html#id-1.2.75.7.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-zbar.html#id-1.2.75.7.2.2"/>
-    <keyword type="struct" name="struct GstZBar" link="gst-plugins-bad-plugins-zbar.html#GstZBar-struct"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-zbar.html#id-1.2.85.5.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-zbar.html#id-1.2.85.5.2.2"/>
+    <keyword type="struct" name="struct GstZBar" link="gst-plugins-bad-plugins-zbar.html#GstZBar"/>
     <keyword type="property" name="The “message” property" link="gst-plugins-bad-plugins-zbar.html#GstZBar--message"/>
     <keyword type="property" name="The “cache” property" link="gst-plugins-bad-plugins-zbar.html#GstZBar--cache"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-voaacenc.html#id-1.2.76.8.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-voaacenc.html#id-1.2.76.8.2.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-voaacenc.html#id-1.2.86.8.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-voaacenc.html#id-1.2.86.8.2.2"/>
     <keyword type="struct" name="struct GstVoAacEnc" link="gst-plugins-bad-plugins-voaacenc.html#GstVoAacEnc-struct"/>
     <keyword type="property" name="The “bitrate” property" link="gst-plugins-bad-plugins-voaacenc.html#GstVoAacEnc--bitrate"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-voamrwbenc.html#id-1.2.77.3.2.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-voamrwbenc.html#id-1.2.77.3.2.2"/>
-    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-wavescope.html#id-1.2.78.7.3"/>
-    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-wavescope.html#id-1.2.78.7.4.1"/>
-    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-wavescope.html#id-1.2.78.7.4.2"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-voamrwbenc.html#id-1.2.87.3.2.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-voamrwbenc.html#id-1.2.87.3.2.2"/>
+    <keyword type="" name="Example launch line" link="gst-plugins-bad-plugins-wavescope.html#id-1.2.88.7.3"/>
+    <keyword type="" name="Element Information" link="gst-plugins-bad-plugins-wavescope.html#id-1.2.88.7.4.1"/>
+    <keyword type="" name="Element Pads" link="gst-plugins-bad-plugins-wavescope.html#id-1.2.88.7.4.2"/>
     <keyword type="struct" name="struct GstWaveScope" link="gst-plugins-bad-plugins-wavescope.html#GstWaveScope-struct"/>
     <keyword type="property" name="The “style” property" link="gst-plugins-bad-plugins-wavescope.html#GstWaveScope--style"/>
-    <keyword type="function" name="GstPhotographyCapturePrepared ()" link="GstPhotography.html#GstPhotographyCapturePrepared"/>
-    <keyword type="function" name="gst_photography_get_ev_compensation ()" link="GstPhotography.html#gst-photography-get-ev-compensation"/>
-    <keyword type="function" name="gst_photography_get_iso_speed ()" link="GstPhotography.html#gst-photography-get-iso-speed"/>
-    <keyword type="function" name="gst_photography_get_aperture ()" link="GstPhotography.html#gst-photography-get-aperture"/>
-    <keyword type="function" name="gst_photography_get_exposure ()" link="GstPhotography.html#gst-photography-get-exposure"/>
-    <keyword type="function" name="gst_photography_get_white_balance_mode ()" link="GstPhotography.html#gst-photography-get-white-balance-mode"/>
-    <keyword type="function" name="gst_photography_get_color_tone_mode ()" link="GstPhotography.html#gst-photography-get-color-tone-mode"/>
-    <keyword type="function" name="gst_photography_get_scene_mode ()" link="GstPhotography.html#gst-photography-get-scene-mode"/>
-    <keyword type="function" name="gst_photography_get_flash_mode ()" link="GstPhotography.html#gst-photography-get-flash-mode"/>
-    <keyword type="function" name="gst_photography_get_noise_reduction ()" link="GstPhotography.html#gst-photography-get-noise-reduction"/>
-    <keyword type="function" name="gst_photography_get_zoom ()" link="GstPhotography.html#gst-photography-get-zoom"/>
-    <keyword type="function" name="gst_photography_set_ev_compensation ()" link="GstPhotography.html#gst-photography-set-ev-compensation"/>
-    <keyword type="function" name="gst_photography_set_iso_speed ()" link="GstPhotography.html#gst-photography-set-iso-speed"/>
-    <keyword type="function" name="gst_photography_set_aperture ()" link="GstPhotography.html#gst-photography-set-aperture"/>
-    <keyword type="function" name="gst_photography_set_exposure ()" link="GstPhotography.html#gst-photography-set-exposure"/>
-    <keyword type="function" name="gst_photography_set_white_balance_mode ()" link="GstPhotography.html#gst-photography-set-white-balance-mode"/>
-    <keyword type="function" name="gst_photography_set_color_tone_mode ()" link="GstPhotography.html#gst-photography-set-color-tone-mode"/>
-    <keyword type="function" name="gst_photography_set_scene_mode ()" link="GstPhotography.html#gst-photography-set-scene-mode"/>
-    <keyword type="function" name="gst_photography_set_flash_mode ()" link="GstPhotography.html#gst-photography-set-flash-mode"/>
-    <keyword type="function" name="gst_photography_set_noise_reduction ()" link="GstPhotography.html#gst-photography-set-noise-reduction"/>
-    <keyword type="function" name="gst_photography_set_zoom ()" link="GstPhotography.html#gst-photography-set-zoom"/>
-    <keyword type="function" name="gst_photography_get_capabilities ()" link="GstPhotography.html#gst-photography-get-capabilities"/>
-    <keyword type="function" name="gst_photography_prepare_for_capture ()" link="GstPhotography.html#gst-photography-prepare-for-capture"/>
-    <keyword type="function" name="gst_photography_set_autofocus ()" link="GstPhotography.html#gst-photography-set-autofocus"/>
-    <keyword type="function" name="gst_photography_set_config ()" link="GstPhotography.html#gst-photography-set-config"/>
-    <keyword type="function" name="gst_photography_get_config ()" link="GstPhotography.html#gst-photography-get-config"/>
-    <keyword type="struct" name="GstPhotography" link="GstPhotography.html#GstPhotography-struct"/>
-    <keyword type="macro" name="GST_PHOTOGRAPHY_AUTOFOCUS_DONE" link="GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS"/>
-    <keyword type="macro" name="GST_PHOTOGRAPHY_SHAKE_RISK" link="GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS"/>
-    <keyword type="enum" name="enum GstPhotographyNoiseReduction" link="GstPhotography.html#GstPhotographyNoiseReduction"/>
-    <keyword type="enum" name="enum GstPhotographyWhiteBalanceMode" link="GstPhotography.html#GstPhotographyWhiteBalanceMode"/>
-    <keyword type="enum" name="enum GstPhotographyColorToneMode" link="GstPhotography.html#GstPhotographyColorToneMode"/>
-    <keyword type="enum" name="enum GstPhotographySceneMode" link="GstPhotography.html#GstPhotographySceneMode"/>
-    <keyword type="enum" name="enum GstPhotographyFlashMode" link="GstPhotography.html#GstPhotographyFlashMode"/>
-    <keyword type="enum" name="enum GstPhotographyFlickerReductionMode" link="GstPhotography.html#GstPhotographyFlickerReductionMode"/>
-    <keyword type="enum" name="enum GstPhotographyFocusMode" link="GstPhotography.html#GstPhotographyFocusMode"/>
-    <keyword type="enum" name="enum GstPhotographyFocusStatus" link="GstPhotography.html#GstPhotographyFocusStatus"/>
-    <keyword type="enum" name="enum GstPhotographyCaps" link="GstPhotography.html#GstPhotographyCaps"/>
-    <keyword type="enum" name="enum GstPhotographyShakeRisk" link="GstPhotography.html#GstPhotographyShakeRisk"/>
-    <keyword type="property" name="The “aperture” property" link="GstPhotography.html#GstPhotography--aperture"/>
-    <keyword type="property" name="The “capabilities” property" link="GstPhotography.html#GstPhotography--capabilities"/>
-    <keyword type="property" name="The “colour-tone-mode” property" link="GstPhotography.html#GstPhotography--colour-tone-mode"/>
-    <keyword type="property" name="The “ev-compensation” property" link="GstPhotography.html#GstPhotography--ev-compensation"/>
-    <keyword type="property" name="The “exposure” property" link="GstPhotography.html#GstPhotography--exposure"/>
-    <keyword type="property" name="The “flash-mode” property" link="GstPhotography.html#GstPhotography--flash-mode"/>
-    <keyword type="property" name="The “flicker-mode” property" link="GstPhotography.html#GstPhotography--flicker-mode"/>
-    <keyword type="property" name="The “focus-mode” property" link="GstPhotography.html#GstPhotography--focus-mode"/>
-    <keyword type="property" name="The “image-capture-supported-caps” property" link="GstPhotography.html#GstPhotography--image-capture-supported-caps"/>
-    <keyword type="property" name="The “iso-speed” property" link="GstPhotography.html#GstPhotography--iso-speed"/>
-    <keyword type="property" name="The “scene-mode” property" link="GstPhotography.html#GstPhotography--scene-mode"/>
-    <keyword type="property" name="The “white-balance-mode” property" link="GstPhotography.html#GstPhotography--white-balance-mode"/>
-    <keyword type="property" name="The “image-preview-supported-caps” property" link="GstPhotography.html#GstPhotography--image-preview-supported-caps"/>
-    <keyword type="property" name="The “noise-reduction” property" link="GstPhotography.html#GstPhotography--noise-reduction"/>
-    <keyword type="property" name="The “zoom” property" link="GstPhotography.html#GstPhotography--zoom"/>
-    <keyword type="property" name="The “analog-gain” property" link="GstPhotography.html#GstPhotography--analog-gain"/>
-    <keyword type="property" name="The “color-temperature” property" link="GstPhotography.html#GstPhotography--color-temperature"/>
-    <keyword type="property" name="The “color-tone-mode” property" link="GstPhotography.html#GstPhotography--color-tone-mode"/>
-    <keyword type="property" name="The “exposure-time” property" link="GstPhotography.html#GstPhotography--exposure-time"/>
-    <keyword type="property" name="The “lens-focus” property" link="GstPhotography.html#GstPhotography--lens-focus"/>
-    <keyword type="property" name="The “max-exposure-time” property" link="GstPhotography.html#GstPhotography--max-exposure-time"/>
-    <keyword type="property" name="The “min-exposure-time” property" link="GstPhotography.html#GstPhotography--min-exposure-time"/>
-    <keyword type="property" name="The “white-point” property" link="GstPhotography.html#GstPhotography--white-point"/>
   </functions>
 </book>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-accurip.html b/docs/plugins/html/gst-plugins-bad-plugins-accurip.html
index 16d26e7..e9ec83b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-accurip.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-accurip.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
 <link rel="prev" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="next" href="gst-plugins-bad-plugins-assrender.html" title="assrender">
+<link rel="next" href="gst-plugins-bad-plugins-aiffparse.html" title="aiffparse">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -22,7 +22,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="ch01.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-assrender.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-aiffparse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-accurip"></a><div class="titlepage"></div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-aiffmux.html b/docs/plugins/html/gst-plugins-bad-plugins-aiffmux.html
new file mode 100644
index 0000000..a5dff7a
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-aiffmux.html
@@ -0,0 +1,159 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: aiffmux</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-aiffparse.html" title="aiffparse">
+<link rel="next" href="gst-plugins-bad-plugins-assrender.html" title="assrender">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-aiffmux.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-aiffmux.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-aiffparse.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-assrender.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-aiffmux"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-aiffmux.top_of_page"></a>aiffmux</span></h2>
+<p>aiffmux — Multiplex raw audio into AIFF</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<a name="GstAiffMux"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffmux.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-aiffmux.html#GstAiffMux-struct" title="struct GstAiffMux">GstAiffMux</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffmux.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> GstAiffMux
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffmux.description"></a><h2>Description</h2>
+<p>Format an audio stream into the Audio Interchange File Format</p>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.4.6.2.1.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-aiff.html#plugin-aiff">aiff</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Robert Swain &lt;robert.swain@gmail.com&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Muxer/Audio</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.4.6.2.1.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string){ S8, S16BE, S24BE, S32BE }, channels=(int)[ 1, 2147483647 ], rate=(int)[ 1, 2147483647 ]</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-aiff</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffmux.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffmux.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstAiffMux-struct"></a><h3>struct GstAiffMux</h3>
+<pre class="programlisting">struct GstAiffMux;</pre>
+<p>Opaque data structure.</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-aiffparse.html b/docs/plugins/html/gst-plugins-bad-plugins-aiffparse.html
new file mode 100644
index 0000000..d32c8d7
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-aiffparse.html
@@ -0,0 +1,185 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: aiffparse</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-accurip.html" title="accurip">
+<link rel="next" href="gst-plugins-bad-plugins-aiffmux.html" title="aiffmux">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-aiffparse.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-aiffparse.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-accurip.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-aiffmux.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-aiffparse"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-aiffparse.top_of_page"></a>aiffparse</span></h2>
+<p>aiffparse — Parse a .aiff file into raw audio</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<a name="GstAiffParse"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffparse.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-aiffparse.html#GstAiffParse-struct" title="struct GstAiffParse">GstAiffParse</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffparse.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> GstAiffParse
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffparse.description"></a><h2>Description</h2>
+<div class="refsect2">
+<a name="id-1.2.3.6.2"></a><h3>Example launch line</h3>
+<p>
+Parse a .aiff file into raw or compressed audio.
+</p>
+<p>
+The aiffparse element supports both push and pull mode operations, making it
+possible to stream from a network source.
+</p>
+<p>
+</p>
+<pre class="programlisting">
+gst-launch filesrc location=sine.aiff ! aiffparse ! audioconvert ! alsasink
+</pre>
+<p>
+Read a aiff file and output to the soundcard using the ALSA element. The
+aiff file is assumed to contain raw uncompressed samples.
+</p>
+<p>
+</p>
+<pre class="programlisting">
+gst-launch souphhtpsrc location=http://www.example.org/sine.aiff ! queue ! aiffparse ! audioconvert ! alsasink
+</pre>
+<p>
+Stream data from a network url.
+</p>
+</div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.3.6.3.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-aiff.html#plugin-aiff">aiff</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Pioneers of the Inevitable &lt;songbird@songbirdnest.com&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Demuxer/Audio</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.3.6.3.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-aiff</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string){ S8, S16BE, S16LE, S24BE, S24LE, S32LE, S32BE, F32BE, F64BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffparse.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-aiffparse.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstAiffParse-struct"></a><h3>struct GstAiffParse</h3>
+<pre class="programlisting">struct GstAiffParse;</pre>
+<p>Opaque data structure.</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-assrender.html b/docs/plugins/html/gst-plugins-bad-plugins-assrender.html
index 676493a..7e1c6bc 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-assrender.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-assrender.html
@@ -6,8 +6,8 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="prev" href="gst-plugins-bad-plugins-accurip.html" title="accurip">
-<link rel="next" href="gst-plugins-bad-plugins-autoconvert.html" title="autoconvert">
+<link rel="prev" href="gst-plugins-bad-plugins-aiffmux.html" title="aiffmux">
+<link rel="next" href="gst-plugins-bad-plugins-audiomixer.html" title="audiomixer">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -21,8 +21,8 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-accurip.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-autoconvert.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-aiffmux.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-audiomixer.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-assrender"></a><div class="titlepage"></div>
@@ -87,7 +87,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.3.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.5.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -113,7 +113,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.3.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.5.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -166,7 +166,7 @@
 </tr>
 <tr>
 <td><p><span class="term"></span></p></td>
-<td> video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
+<td> video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
 </tr>
 </tbody>
 </table></div>
@@ -194,7 +194,7 @@
 </tr>
 <tr>
 <td><p><span class="term"></span></p></td>
-<td> video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
+<td> video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
 </tr>
 </tbody>
 </table></div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-audiomixer.html b/docs/plugins/html/gst-plugins-bad-plugins-audiomixer.html
new file mode 100644
index 0000000..c383c94
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-audiomixer.html
@@ -0,0 +1,277 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: audiomixer</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-assrender.html" title="assrender">
+<link rel="next" href="gst-plugins-bad-plugins-autoconvert.html" title="autoconvert">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-audiomixer.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-audiomixer.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-audiomixer.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-audiomixer.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-assrender.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-autoconvert.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-audiomixer"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-audiomixer.top_of_page"></a>audiomixer</span></h2>
+<p>audiomixer — Mixes multiple audio streams</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="property_type"><span class="type">guint64</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--alignment-threshold" title="The “alignment-threshold” property">alignment-threshold</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *</td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--caps" title="The “caps” property">caps</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">guint64</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--discont-wait" title="The “discont-wait” property">discont-wait</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--blocksize" title="The “blocksize” property">blocksize</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">guint64</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--output-buffer-duration" title="The “output-buffer-duration” property">output-buffer-duration</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<a name="GstAudioMixer"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer-struct" title="struct GstAudioMixer">GstAudioMixer</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> GstAggregator
+                    <span class="lineart">╰──</span> GstAudioMixer
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
+<p>
+GstAudioMixer implements
+ <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstChildProxy.html">GstChildProxy</a>.</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.description"></a><h2>Description</h2>
+<p>The audiomixer allows to mix several streams into one by adding the data.
+Mixed data is clamped to the min/max values of the data format.</p>
+<p>The audiomixer currently mixes all data received on the sinkpads as soon as
+possible without trying to synchronize the streams.</p>
+<p>The input pads are from a GstPad subclass and have additional
+properties to mute each pad individually and set the volume:</p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+"mute": Whether to mute the pad or not (<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>)
+</li>
+<li class="listitem">
+"volume": The volume of the pad, between 0.0 and 10.0 (<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>)
+</li>
+</ul></div>
+<div class="refsect2">
+<a name="id-1.2.6.8.6"></a><h3>Example launch line</h3>
+<div class="informalexample">
+  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
+    <tbody>
+      <tr>
+        <td class="listing_lines" align="right"><pre>1</pre></td>
+        <td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch audiotestsrc freq<span class="gtkdoc opt">=</span><span class="number">100</span> <span class="gtkdoc opt">!</span> audiomixer name<span class="gtkdoc opt">=</span>mix <span class="gtkdoc opt">!</span> audioconvert <span class="gtkdoc opt">!</span> alsasink audiotestsrc freq<span class="gtkdoc opt">=</span><span class="number">500</span> <span class="gtkdoc opt">!</span> mix<span class="gtkdoc opt">.</span></pre></td>
+      </tr>
+    </tbody>
+  </table>
+</div>
+ This pipeline produces two sine waves mixed together.
+</div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.6.8.7.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-audiomixer.html#plugin-audiomixer">audiomixer</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Sebastian Dröge &lt;sebastian@centricular.com&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Generic/Audio</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.6.8.7.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink_%u</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>request</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string){ S32LE, U32LE, S16LE, U16LE, S8, U8, F32LE, F64LE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string){ interleaved, non-interleaved }</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string){ S32LE, U32LE, S16LE, U16LE, S8, U8, F32LE, F64LE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string){ interleaved, non-interleaved }</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstAudioMixer-struct"></a><h3>struct GstAudioMixer</h3>
+<pre class="programlisting">struct GstAudioMixer;</pre>
+<p>The audiomixer object structure.</p>
+</div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-audiomixer.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="GstAudioMixer--alignment-threshold"></a><h3>The <code class="literal">“alignment-threshold”</code> property</h3>
+<pre class="programlisting">  “alignment-threshold”      <span class="type">guint64</span></pre>
+<p>Timestamp alignment threshold in nanoseconds.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: &lt;= 18446744073709551614</p>
+<p>Default value: 40000000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstAudioMixer--caps"></a><h3>The <code class="literal">“caps”</code> property</h3>
+<pre class="programlisting">  “caps”                     <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstCaps.html"><span class="type">GstCaps</span></a> *</pre>
+<p>Set target format for mixing (NULL means ANY). Setting this property takes a reference to the supplied GstCaps object.</p>
+<p>Flags: Read / Write</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstAudioMixer--discont-wait"></a><h3>The <code class="literal">“discont-wait”</code> property</h3>
+<pre class="programlisting">  “discont-wait”             <span class="type">guint64</span></pre>
+<p>Window of time in nanoseconds to wait before creating a discontinuity.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: &lt;= 18446744073709551614</p>
+<p>Default value: 1000000000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstAudioMixer--blocksize"></a><h3>The <code class="literal">“blocksize”</code> property</h3>
+<pre class="programlisting">  “blocksize”                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>Output block size in number of samples.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: 1024</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstAudioMixer--output-buffer-duration"></a><h3>The <code class="literal">“output-buffer-duration”</code> property</h3>
+<pre class="programlisting">  “output-buffer-duration”   <span class="type">guint64</span></pre>
+<p>Output block size in nanoseconds.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: &gt;= 1</p>
+<p>Default value: 10000000</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-autoconvert.html b/docs/plugins/html/gst-plugins-bad-plugins-autoconvert.html
index 5df5588..62dc4c2 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-autoconvert.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-autoconvert.html
@@ -6,8 +6,8 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="prev" href="gst-plugins-bad-plugins-assrender.html" title="assrender">
-<link rel="next" href="gst-plugins-bad-plugins-bulge.html" title="bulge">
+<link rel="prev" href="gst-plugins-bad-plugins-audiomixer.html" title="audiomixer">
+<link rel="next" href="gst-plugins-bad-plugins-bs2b.html" title="bs2b">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -22,8 +22,8 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-assrender.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-bulge.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-audiomixer.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-bs2b.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-autoconvert"></a><div class="titlepage"></div>
@@ -98,7 +98,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.4.8.3.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.7.8.3.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -124,7 +124,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.4.8.3.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.7.8.3.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-bs2b.html b/docs/plugins/html/gst-plugins-bad-plugins-bs2b.html
new file mode 100644
index 0000000..0622337
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-bs2b.html
@@ -0,0 +1,160 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: bs2b</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-autoconvert.html" title="autoconvert">
+<link rel="next" href="gst-plugins-bad-plugins-bulge.html" title="bulge">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-bs2b.description" class="shortcut">Description</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-autoconvert.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-bulge.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-bs2b"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-bs2b.top_of_page"></a>bs2b</span></h2>
+<p>bs2b — Improve headphone listening of stereo audio records using the bs2b library.</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-bs2b.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-bs2b.html#GstBs2b" title="struct GstBs2b">GstBs2b</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-bs2b.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.8.4.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-bs2b.html#plugin-bs2b">bs2b</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Christoph Reiter &lt;reiter.christoph@gmail.com&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Effect/Audio</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.8.4.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 2000, 384000 ], channels=(int)2, channel-mask=(bitmask)0x0000000000000003, layout=(string)interleaved</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/x-raw, channels=(int)1</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 2000, 384000 ], channels=(int)2, channel-mask=(bitmask)0x0000000000000003, layout=(string)interleaved</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/x-raw, channels=(int)1</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-bs2b.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-bs2b.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstBs2b"></a><h3>struct GstBs2b</h3>
+<pre class="programlisting">struct GstBs2b {
+  GstAudioFilter element;
+};
+</pre>
+<p>
+</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-bulge.html b/docs/plugins/html/gst-plugins-bad-plugins-bulge.html
index 0294180..2b1e622 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-bulge.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-bulge.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="prev" href="gst-plugins-bad-plugins-autoconvert.html" title="autoconvert">
+<link rel="prev" href="gst-plugins-bad-plugins-bs2b.html" title="bs2b">
 <link rel="next" href="gst-plugins-bad-plugins-burn.html" title="burn">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -21,7 +21,7 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-autoconvert.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-bs2b.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-burn.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -79,7 +79,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.5.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.9.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -105,7 +105,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.5.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.9.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-burn.html b/docs/plugins/html/gst-plugins-bad-plugins-burn.html
index 5bf1b27..e4e79ce 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-burn.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-burn.html
@@ -83,7 +83,7 @@
 <a name="gst-plugins-bad-plugins-burn.description"></a><h2>Description</h2>
 <p>Burn adjusts the colors of a video stream in realtime.</p>
 <div class="refsect2">
-<a name="id-1.2.6.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.10.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -99,7 +99,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.6.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.10.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -125,7 +125,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.6.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.10.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-camerabin.html b/docs/plugins/html/gst-plugins-bad-plugins-camerabin.html
index 61ffa66..361dfa8 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-camerabin.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-camerabin.html
@@ -36,7 +36,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.7.3.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.11.3.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -62,7 +62,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.7.3.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.11.3.2.2"></a><h3>Element Pads</h3>
 </div>
 </div>
 <p>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-chromium.html b/docs/plugins/html/gst-plugins-bad-plugins-chromium.html
index a2dd371..5c53396 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-chromium.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-chromium.html
@@ -61,19 +61,6 @@
 </table></div>
 </div>
 <a name="GstChromium"></a><div class="refsect1">
-<a name="gst-plugins-bad-plugins-chromium.other"></a><h2>Types and Values</h2>
-<div class="informaltable"><table width="100%" border="0">
-<colgroup>
-<col width="150px" class="name">
-<col class="description">
-</colgroup>
-<tbody><tr>
-<td class="typedef_keyword">typedef</td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-chromium.html#GstChromium">GstChromium</a></td>
-</tr></tbody>
-</table></div>
-</div>
-<div class="refsect1">
 <a name="gst-plugins-bad-plugins-chromium.object-hierarchy"></a><h2>Object Hierarchy</h2>
 <pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
     <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
@@ -88,7 +75,7 @@
 <a name="gst-plugins-bad-plugins-chromium.description"></a><h2>Description</h2>
 <p>Chromium breaks the colors of a video stream in realtime.</p>
 <div class="refsect2">
-<a name="id-1.2.8.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.12.6.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -104,7 +91,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.8.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.12.6.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -130,7 +117,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.8.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.12.6.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -189,13 +176,6 @@
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-chromium.other_details"></a><h2>Types and Values</h2>
-<div class="refsect2">
-<a name="GstChromium"></a><h3>GstChromium</h3>
-<pre class="programlisting">typedef struct GstChromium      GstChromium;
-</pre>
-<p>
-</p>
-</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-chromium.property-details"></a><h2>Property Details</h2>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-circle.html b/docs/plugins/html/gst-plugins-bad-plugins-circle.html
index 92f45a5..b8d0db5 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-circle.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-circle.html
@@ -91,7 +91,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.9.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.13.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -117,7 +117,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.9.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.13.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-coloreffects.html b/docs/plugins/html/gst-plugins-bad-plugins-coloreffects.html
index 33cd021..18e0931 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-coloreffects.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-coloreffects.html
@@ -76,7 +76,7 @@
 <a name="gst-plugins-bad-plugins-coloreffects.description"></a><h2>Description</h2>
 <p>Map colors of the video input to a lookup table</p>
 <div class="refsect2">
-<a name="id-1.2.10.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.14.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -94,7 +94,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.10.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.14.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -120,7 +120,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.10.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.14.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-compositor.html b/docs/plugins/html/gst-plugins-bad-plugins-compositor.html
index 46d76aa..3c0aee4 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-compositor.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-compositor.html
@@ -29,7 +29,7 @@
 <div class="refnamediv"><table width="100%"><tr>
 <td valign="top">
 <h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-compositor.top_of_page"></a>compositor</span></h2>
-<p>compositor — Composite multiple video streams</p>
+<p>compositor</p>
 </td>
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
@@ -54,12 +54,12 @@
     <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
         <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
             <span class="lineart">├──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
-            <span class="lineart">│</span>   <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/gst-plugins-bad-libs-GstAggregator.html#GstAggregator">GstAggregator</a>
-            <span class="lineart">│</span>       <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/gst-plugins-bad-libs-GstVideoAggregator.html#GstVideoAggregator">GstVideoAggregator</a>
+            <span class="lineart">│</span>   <span class="lineart">╰──</span> GstAggregator
+            <span class="lineart">│</span>       <span class="lineart">╰──</span> GstVideoAggregator
             <span class="lineart">│</span>           <span class="lineart">╰──</span> GstCompositor
             <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html">GstPad</a>
-                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/gst-plugins-bad-libs-GstAggregatorPad.html#GstAggregatorPad">GstAggregatorPad</a>
-                    <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/gst-plugins-bad-libs-GstVideoAggregatorPad.html#GstVideoAggregatorPad">GstVideoAggregatorPad</a>
+                <span class="lineart">╰──</span> GstAggregatorPad
+                    <span class="lineart">╰──</span> GstVideoAggregatorPad
                         <span class="lineart">╰──</span> GstCompositorPad
 </pre>
 </div>
@@ -71,9 +71,36 @@
 biggest incoming video stream and the framerate of the fastest incoming one.</p>
 <p>Compositor will do colorspace conversion.</p>
 <p>Individual parameters for each input stream can be configured on the
-<a class="link" href="gst-plugins-bad-plugins-compositor.html#GstCompositorPad"><span class="type">GstCompositorPad</span></a>.</p>
+<a class="link" href="gst-plugins-bad-plugins-compositor.html#GstCompositorPad"><span class="type">GstCompositorPad</span></a>:</p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+"xpos": The x-coordinate position of the top-left corner of the picture
+(<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>)
+</li>
+<li class="listitem">
+"ypos": The y-coordinate position of the top-left corner of the picture
+(<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>)
+</li>
+<li class="listitem">
+"width": The width of the picture; the input will be scaled if necessary
+(<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>)
+</li>
+<li class="listitem">
+"height": The height of the picture; the input will be scaled if necessary
+(<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>)
+</li>
+<li class="listitem">
+"alpha": The transparency of the picture; between 0.0 and 1.0. The blending
+is a simple copy when fully-transparent (0.0) and fully-opaque (1.0).
+(<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>)
+</li>
+<li class="listitem">
+"zorder": The z-order position of the picture in the composition; between
+0 and 10000. (<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a>)
+</li>
+</ul></div>
 <div class="refsect2">
-<a name="id-1.2.11.7.5"></a><h3>Sample pipelines</h3>
+<a name="id-1.2.15.7.6"></a><h3>Sample pipelines</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -169,86 +196,6 @@
 </div>
  A pipeline to demonstrate synchronized compositing (the second stream starts after 3 seconds)
 </div>
-<div class="refsynopsisdiv">
-<h2>Synopsis</h2>
-<div class="refsect2">
-<a name="id-1.2.11.7.6.1"></a><h3>Element Information</h3>
-<div class="variablelist"><table border="0" class="variablelist">
-<colgroup>
-<col align="left" valign="top">
-<col>
-</colgroup>
-<tbody>
-<tr>
-<td><p><span class="term">plugin</span></p></td>
-<td>
-            compositor
-          </td>
-</tr>
-<tr>
-<td><p><span class="term">author</span></p></td>
-<td>Wim Taymans &lt;wim@fluendo.com&gt;, Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</td>
-</tr>
-<tr>
-<td><p><span class="term">class</span></p></td>
-<td>Filter/Editor/Video/Compositor</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="id-1.2.11.7.6.2"></a><h3>Element Pads</h3>
-<div class="variablelist"><table border="0" class="variablelist">
-<colgroup>
-<col align="left" valign="top">
-<col>
-</colgroup>
-<tbody>
-<tr>
-<td><p><span class="term">name</span></p></td>
-<td>sink_%u</td>
-</tr>
-<tr>
-<td><p><span class="term">direction</span></p></td>
-<td>sink</td>
-</tr>
-<tr>
-<td><p><span class="term">presence</span></p></td>
-<td>request</td>
-</tr>
-<tr>
-<td><p><span class="term">details</span></p></td>
-<td>video/x-raw, format=(string){ AYUV, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, YVYU, I420, YV12, NV12, NV21, Y41B, RGB, BGR, xRGB, xBGR, RGBx, BGRx }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
-</tr>
-</tbody>
-</table></div>
-<div class="variablelist"><table border="0" class="variablelist">
-<colgroup>
-<col align="left" valign="top">
-<col>
-</colgroup>
-<tbody>
-<tr>
-<td><p><span class="term">name</span></p></td>
-<td>src</td>
-</tr>
-<tr>
-<td><p><span class="term">direction</span></p></td>
-<td>source</td>
-</tr>
-<tr>
-<td><p><span class="term">presence</span></p></td>
-<td>always</td>
-</tr>
-<tr>
-<td><p><span class="term">details</span></p></td>
-<td>video/x-raw, format=(string){ AYUV, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, YVYU, I420, YV12, NV12, NV21, Y41B, RGB, BGR, xRGB, xBGR, RGBx, BGRx }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
 <p>
 </p>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-cvdilate.html b/docs/plugins/html/gst-plugins-bad-plugins-cvdilate.html
index a248fa1..a43cccb 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-cvdilate.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-cvdilate.html
@@ -63,7 +63,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.12.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.16.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -89,7 +89,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.12.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.16.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-cvequalizehist.html b/docs/plugins/html/gst-plugins-bad-plugins-cvequalizehist.html
index 28ba303..bb65c14 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-cvequalizehist.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-cvequalizehist.html
@@ -62,7 +62,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.14.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.18.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -88,7 +88,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.14.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.18.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-cverode.html b/docs/plugins/html/gst-plugins-bad-plugins-cverode.html
index dac967c..cb82a2f 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-cverode.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-cverode.html
@@ -63,7 +63,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.13.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.17.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -89,7 +89,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.13.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.17.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-cvlaplace.html b/docs/plugins/html/gst-plugins-bad-plugins-cvlaplace.html
index badee94..5db420c 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-cvlaplace.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-cvlaplace.html
@@ -78,7 +78,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.15.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.19.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -104,7 +104,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.15.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.19.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-cvsmooth.html b/docs/plugins/html/gst-plugins-bad-plugins-cvsmooth.html
index 9dcb991..412e49c 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-cvsmooth.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-cvsmooth.html
@@ -100,7 +100,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.16.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.20.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -126,7 +126,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.16.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.20.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-cvsobel.html b/docs/plugins/html/gst-plugins-bad-plugins-cvsobel.html
index ac1cdc2..eb85569 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-cvsobel.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-cvsobel.html
@@ -90,7 +90,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.17.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.21.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -116,7 +116,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.17.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.21.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-dataurisrc.html b/docs/plugins/html/gst-plugins-bad-plugins-dataurisrc.html
index d0be97d..e91e56d 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-dataurisrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-dataurisrc.html
@@ -83,7 +83,7 @@
 <a name="gst-plugins-bad-plugins-dataurisrc.description"></a><h2>Description</h2>
 <p>dataurisrc handles data: URIs, see <a class="ulink" href="http://tools.ietf.org/html/rfc2397" target="_top">RFC 2397</a> for more information.</p>
 <div class="refsect2">
-<a name="id-1.2.18.8.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.22.8.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -99,7 +99,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.18.8.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.22.8.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -125,7 +125,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.18.8.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.22.8.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-diffuse.html b/docs/plugins/html/gst-plugins-bad-plugins-diffuse.html
index 4fa568d..8b1bd73 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-diffuse.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-diffuse.html
@@ -78,7 +78,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.19.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.23.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -104,7 +104,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.19.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.23.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-dilate.html b/docs/plugins/html/gst-plugins-bad-plugins-dilate.html
index 3e4386e..cb44deb 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-dilate.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-dilate.html
@@ -83,7 +83,7 @@
 <a name="gst-plugins-bad-plugins-dilate.description"></a><h2>Description</h2>
 <p>Dilate adjusts the colors of a video stream in realtime.</p>
 <div class="refsect2">
-<a name="id-1.2.20.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.24.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -99,7 +99,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.20.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.24.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -125,7 +125,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.20.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.24.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-dodge.html b/docs/plugins/html/gst-plugins-bad-plugins-dodge.html
index 1d8e493..86e88bf 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-dodge.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-dodge.html
@@ -76,7 +76,7 @@
 <a name="gst-plugins-bad-plugins-dodge.description"></a><h2>Description</h2>
 <p>Dodge saturates the colors of a video stream in realtime.</p>
 <div class="refsect2">
-<a name="id-1.2.21.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.25.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -92,7 +92,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.21.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.25.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -118,7 +118,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.21.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.25.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-dtmfdetect.html b/docs/plugins/html/gst-plugins-bad-plugins-dtmfdetect.html
index b8d78b5..9ba81a7 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-dtmfdetect.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-dtmfdetect.html
@@ -15,8 +15,7 @@
 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
 <td width="100%" align="left" class="shortcuts">
 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-plugins-dtmfdetect.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-plugins-dtmfdetect.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+                  <a href="#gst-plugins-bad-plugins-dtmfdetect.description" class="shortcut">Description</a></span>
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
@@ -32,7 +31,7 @@
 </td>
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
-<a name="GstDtmfDetect"></a><div class="refsect1">
+<div class="refsect1">
 <a name="gst-plugins-bad-plugins-dtmfdetect.other"></a><h2>Types and Values</h2>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
@@ -41,26 +40,16 @@
 </colgroup>
 <tbody><tr>
 <td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-dtmfdetect.html#GstDtmfDetect-struct" title="struct GstDtmfDetect">GstDtmfDetect</a></td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-dtmfdetect.html#GstDtmfDetect" title="struct GstDtmfDetect">GstDtmfDetect</a></td>
 </tr></tbody>
 </table></div>
 </div>
 <div class="refsect1">
-<a name="gst-plugins-bad-plugins-dtmfdetect.object-hierarchy"></a><h2>Object Hierarchy</h2>
-<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
-    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
-        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
-            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
-                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html">GstBaseTransform</a>
-                    <span class="lineart">╰──</span> GstDtmfDetect
-</pre>
-</div>
-<div class="refsect1">
 <a name="gst-plugins-bad-plugins-dtmfdetect.description"></a><h2>Description</h2>
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.22.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.26.4.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -86,7 +75,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.22.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.26.4.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -146,8 +135,13 @@
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-dtmfdetect.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
-<a name="GstDtmfDetect-struct"></a><h3>struct GstDtmfDetect</h3>
-<pre class="programlisting">struct GstDtmfDetect;</pre>
+<a name="GstDtmfDetect"></a><h3>struct GstDtmfDetect</h3>
+<pre class="programlisting">struct GstDtmfDetect {
+  GstBaseTransform parent;
+
+  dtmf_rx_state_t *dtmf_state;
+};
+</pre>
 <p>
 </p>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-dtsdec.html b/docs/plugins/html/gst-plugins-bad-plugins-dtsdec.html
index 60b2e63..e97b4d4 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-dtsdec.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-dtsdec.html
@@ -76,7 +76,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.23.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.27.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -102,7 +102,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.23.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.27.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-dvbsrc.html b/docs/plugins/html/gst-plugins-bad-plugins-dvbsrc.html
index 0248416..75263ad 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-dvbsrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-dvbsrc.html
@@ -195,6 +195,116 @@
 <td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--tuning-timeout" title="The “tuning-timeout” property">tuning-timeout</a></td>
 <td class="property_flags">Read / Write</td>
 </tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layer-enabled" title="The “isdbt-layer-enabled” property">isdbt-layer-enabled</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstDvbSrcCode_Rate</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-fec" title="The “isdbt-layera-fec” property">isdbt-layera-fec</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstDvbSrcModulation</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-modulation" title="The “isdbt-layera-modulation” property">isdbt-layera-modulation</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-segment-count" title="The “isdbt-layera-segment-count” property">isdbt-layera-segment-count</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-time-interleaving" title="The “isdbt-layera-time-interleaving” property">isdbt-layera-time-interleaving</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstDvbSrcCode_Rate</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-fec" title="The “isdbt-layerb-fec” property">isdbt-layerb-fec</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstDvbSrcModulation</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-modulation" title="The “isdbt-layerb-modulation” property">isdbt-layerb-modulation</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-segment-count" title="The “isdbt-layerb-segment-count” property">isdbt-layerb-segment-count</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-time-interleaving" title="The “isdbt-layerb-time-interleaving” property">isdbt-layerb-time-interleaving</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstDvbSrcCode_Rate</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-fec" title="The “isdbt-layerc-fec” property">isdbt-layerc-fec</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstDvbSrcModulation</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-modulation" title="The “isdbt-layerc-modulation” property">isdbt-layerc-modulation</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-segment-count" title="The “isdbt-layerc-segment-count” property">isdbt-layerc-segment-count</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-time-interleaving" title="The “isdbt-layerc-time-interleaving” property">isdbt-layerc-time-interleaving</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-partial-reception" title="The “isdbt-partial-reception” property">isdbt-partial-reception</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-segment-count" title="The “isdbt-sb-segment-count” property">isdbt-sb-segment-count</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-segment-idx" title="The “isdbt-sb-segment-idx” property">isdbt-sb-segment-idx</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-subchannel-id" title="The “isdbt-sb-subchannel-id” property">isdbt-sb-subchannel-id</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sound-broadcasting" title="The “isdbt-sound-broadcasting” property">isdbt-sound-broadcasting</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-lof1" title="The “lnb-lof1” property">lnb-lof1</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-lof2" title="The “lnb-lof2” property">lnb-lof2</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-slof" title="The “lnb-slof” property">lnb-slof</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstDvbSrcInterleaving</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--interleaving" title="The “interleaving” property">interleaving</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -222,6 +332,11 @@
 <td class="signal_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tuning-start" title="The “tuning-start” signal">tuning-start</a></td>
 <td class="signal_flags">Run Last</td>
 </tr>
+<tr>
+<td class="signal_type"><span class="returnvalue">void</span></td>
+<td class="signal_name"><a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tune" title="The “tune” signal">tune</a></td>
+<td class="signal_flags">Action</td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -254,7 +369,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.24.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.28.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -269,7 +384,8 @@
 </tr>
 <tr>
 <td><p><span class="term">author</span></p></td>
-<td>P2P-VCR, C-Lab, University of Paderborn,Zaheer Abbas Merali &lt;zaheerabbas at merali dot org&gt;</td>
+<td>P2P-VCR, C-Lab, University of Paderborn, Zaheer Abbas Merali &lt;zaheerabbas at merali dot org&gt;
+Reynaldo H. Verdejo Pinochet &lt;r.verdejo@sisa.samsung.com&gt;</td>
 </tr>
 <tr>
 <td><p><span class="term">class</span></p></td>
@@ -280,7 +396,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.24.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.28.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -409,7 +525,7 @@
 <div class="refsect2">
 <a name="GstDvbSrc--modulation"></a><h3>The <code class="literal">“modulation”</code> property</h3>
 <pre class="programlisting">  “modulation”               <span class="type">GstDvbSrcModulation</span></pre>
-<p>(DVB-T and DVB-C) Modulation type.</p>
+<p>(DVB-T/T2/C/S2, TURBO and ATSC) Modulation type.</p>
 <p>Flags: Read / Write</p>
 <p>Default value: QAM 16</p>
 </div>
@@ -475,7 +591,7 @@
 <div class="refsect2">
 <a name="GstDvbSrc--frequency"></a><h3>The <code class="literal">“frequency”</code> property</h3>
 <pre class="programlisting">  “frequency”                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>Frequency.</p>
+<p>Center frequency to tune into. Measured in kHz for the satellite distribution standars and Hz for all the rest.</p>
 <p>Flags: Read / Write</p>
 <p>Default value: 0</p>
 </div>
@@ -500,7 +616,7 @@
 <div class="refsect2">
 <a name="GstDvbSrc--symbol-rate"></a><h3>The <code class="literal">“symbol-rate”</code> property</h3>
 <pre class="programlisting">  “symbol-rate”              <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
-<p>(DVB-S/S2, DVB-C) Symbol rate in bauds.</p>
+<p>(DVB-S/S2, DVB-C) Symbol rate in kBd (kilo bauds).</p>
 <p>Flags: Read / Write</p>
 <p>Default value: 0</p>
 </div>
@@ -569,6 +685,194 @@
 <p>Flags: Read / Write</p>
 <p>Default value: 10000000000</p>
 </div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layer-enabled"></a><h3>The <code class="literal">“isdbt-layer-enabled”</code> property</h3>
+<pre class="programlisting">  “isdbt-layer-enabled”      <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>(ISDB-T) Layer Enabled (7 = All layers).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [1,7]</p>
+<p>Default value: 7</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layera-fec"></a><h3>The <code class="literal">“isdbt-layera-fec”</code> property</h3>
+<pre class="programlisting">  “isdbt-layera-fec”         <span class="type">GstDvbSrcCode_Rate</span></pre>
+<p>(ISDB-T) layer A Forward Error Correction.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: AUTO</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layera-modulation"></a><h3>The <code class="literal">“isdbt-layera-modulation”</code> property</h3>
+<pre class="programlisting">  “isdbt-layera-modulation”  <span class="type">GstDvbSrcModulation</span></pre>
+<p>(ISDB-T) Layer A modulation type.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: AUTO</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layera-segment-count"></a><h3>The <code class="literal">“isdbt-layera-segment-count”</code> property</h3>
+<pre class="programlisting">  “isdbt-layera-segment-count” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Layer A segment count (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,13]</p>
+<p>Default value: -1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layera-time-interleaving"></a><h3>The <code class="literal">“isdbt-layera-time-interleaving”</code> property</h3>
+<pre class="programlisting">  “isdbt-layera-time-interleaving” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Layer A time interleaving (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,8]</p>
+<p>Default value: -1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerb-fec"></a><h3>The <code class="literal">“isdbt-layerb-fec”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerb-fec”         <span class="type">GstDvbSrcCode_Rate</span></pre>
+<p>(ISDB-T) layer B Forward Error Correction.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: AUTO</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerb-modulation"></a><h3>The <code class="literal">“isdbt-layerb-modulation”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerb-modulation”  <span class="type">GstDvbSrcModulation</span></pre>
+<p>(ISDB-T) Layer B modulation type.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: AUTO</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerb-segment-count"></a><h3>The <code class="literal">“isdbt-layerb-segment-count”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerb-segment-count” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Layer B segment count (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,13]</p>
+<p>Default value: -1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerb-time-interleaving"></a><h3>The <code class="literal">“isdbt-layerb-time-interleaving”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerb-time-interleaving” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Layer B time interleaving (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,8]</p>
+<p>Default value: -1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerc-fec"></a><h3>The <code class="literal">“isdbt-layerc-fec”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerc-fec”         <span class="type">GstDvbSrcCode_Rate</span></pre>
+<p>(ISDB-T) layer C Forward Error Correction.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: AUTO</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerc-modulation"></a><h3>The <code class="literal">“isdbt-layerc-modulation”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerc-modulation”  <span class="type">GstDvbSrcModulation</span></pre>
+<p>(ISDB-T) Layer C modulation type.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: AUTO</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerc-segment-count"></a><h3>The <code class="literal">“isdbt-layerc-segment-count”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerc-segment-count” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Layer C segment count (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,13]</p>
+<p>Default value: -1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-layerc-time-interleaving"></a><h3>The <code class="literal">“isdbt-layerc-time-interleaving”</code> property</h3>
+<pre class="programlisting">  “isdbt-layerc-time-interleaving” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Layer C time interleaving (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,8]</p>
+<p>Default value: -1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-partial-reception"></a><h3>The <code class="literal">“isdbt-partial-reception”</code> property</h3>
+<pre class="programlisting">  “isdbt-partial-reception”  <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Partial Reception (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,1]</p>
+<p>Default value: 1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-sb-segment-count"></a><h3>The <code class="literal">“isdbt-sb-segment-count”</code> property</h3>
+<pre class="programlisting">  “isdbt-sb-segment-count”   <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>(ISDB-T) SB segment count.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [1,13]</p>
+<p>Default value: 1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-sb-segment-idx"></a><h3>The <code class="literal">“isdbt-sb-segment-idx”</code> property</h3>
+<pre class="programlisting">  “isdbt-sb-segment-idx”     <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) SB segment IDX.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [0,12]</p>
+<p>Default value: 0</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-sb-subchannel-id"></a><h3>The <code class="literal">“isdbt-sb-subchannel-id”</code> property</h3>
+<pre class="programlisting">  “isdbt-sb-subchannel-id”   <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) SB Subchannel ID (-1 = AUTO).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [G_MAXULONG,41]</p>
+<p>Default value: 0</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--isdbt-sound-broadcasting"></a><h3>The <code class="literal">“isdbt-sound-broadcasting”</code> property</h3>
+<pre class="programlisting">  “isdbt-sound-broadcasting” <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>(ISDB-T) Sound Broadcasting.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [0,1]</p>
+<p>Default value: 0</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--lnb-lof1"></a><h3>The <code class="literal">“lnb-lof1”</code> property</h3>
+<pre class="programlisting">  “lnb-lof1”                 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>LNB's Local oscillator frequency used for low band reception (kHz).</p>
+<p>Flags: Read / Write</p>
+<p>Default value: 9750000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--lnb-lof2"></a><h3>The <code class="literal">“lnb-lof2”</code> property</h3>
+<pre class="programlisting">  “lnb-lof2”                 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>LNB's Local oscillator frequency used for high band reception (kHz).</p>
+<p>Flags: Read / Write</p>
+<p>Default value: 10600000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--lnb-slof"></a><h3>The <code class="literal">“lnb-slof”</code> property</h3>
+<pre class="programlisting">  “lnb-slof”                 <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>LNB's Upper bound for low band reception (kHz).</p>
+<p>Flags: Read / Write</p>
+<p>Default value: 11700000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc--interleaving"></a><h3>The <code class="literal">“interleaving”</code> property</h3>
+<pre class="programlisting">  “interleaving”             <span class="type">GstDvbSrcInterleaving</span></pre>
+<p>(DTMB) Interleaving type.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: AUTO</p>
+</div>
 </div>
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-dvbsrc.signal-details"></a><h2>Signal Details</h2>
@@ -580,7 +884,7 @@
 <p>
 </p>
 <div class="refsect3">
-<a name="id-1.2.24.12.2.5"></a><h4>Parameters</h4>
+<a name="id-1.2.28.12.2.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -612,7 +916,7 @@
 <p>
 </p>
 <div class="refsect3">
-<a name="id-1.2.24.12.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.28.12.3.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -644,7 +948,7 @@
 <p>
 </p>
 <div class="refsect3">
-<a name="id-1.2.24.12.4.5"></a><h4>Parameters</h4>
+<a name="id-1.2.28.12.4.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -667,6 +971,38 @@
 </div>
 <p>Flags: Run Last</p>
 </div>
+<hr>
+<div class="refsect2">
+<a name="GstDvbSrc-tune"></a><h3>The <code class="literal">“tune”</code> signal</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+user_function (<a class="link" href="gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc"><span class="type">GstDvbSrc</span></a> *gstdvbsrc,
+               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>   user_data)</pre>
+<p>
+</p>
+<div class="refsect3">
+<a name="id-1.2.28.12.5.5"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+<col width="200px" class="parameters_annotations">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>gstdvbsrc</p></td>
+<td class="parameter_description"><p>the object which received the signal.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+<tr>
+<td class="parameter_name"><p>user_data</p></td>
+<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
+<td class="parameter_annotations"> </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<p>Flags: Action</p>
+</div>
 </div>
 </div>
 <div class="footer">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-dvdspu.html b/docs/plugins/html/gst-plugins-bad-plugins-dvdspu.html
index 2668e8e..ac6e017 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-dvdspu.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-dvdspu.html
@@ -58,7 +58,7 @@
 <a name="gst-plugins-bad-plugins-dvdspu.description"></a><h2>Description</h2>
 <p>DVD sub picture overlay element.</p>
 <div class="refsect2">
-<a name="id-1.2.25.6.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.29.6.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -74,7 +74,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.25.6.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.29.6.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -100,7 +100,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.25.6.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.29.6.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-edgedetect.html b/docs/plugins/html/gst-plugins-bad-plugins-edgedetect.html
index 8125bae..74c9310 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-edgedetect.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-edgedetect.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
 <link rel="prev" href="gst-plugins-bad-plugins-exclusion.html" title="exclusion">
-<link rel="next" href="gst-plugins-bad-plugins-eglglessink.html" title="eglglessink">
+<link rel="next" href="gst-plugins-bad-plugins-faac.html" title="faac">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -20,7 +20,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-exclusion.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-eglglessink.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-faac.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-edgedetect"></a><div class="titlepage"></div>
@@ -36,7 +36,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.27.3.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.31.3.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -62,7 +62,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.27.3.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.31.3.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-eglglessink.html b/docs/plugins/html/gst-plugins-bad-plugins-eglglessink.html
deleted file mode 100644
index e4c6cc4..0000000
--- a/docs/plugins/html/gst-plugins-bad-plugins-eglglessink.html
+++ /dev/null
@@ -1,114 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: eglglessink</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
-<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
-<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="prev" href="gst-plugins-bad-plugins-edgedetect.html" title="edgedetect">
-<link rel="next" href="gst-plugins-bad-plugins-faac.html" title="faac">
-<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
-<link rel="stylesheet" href="style.css" type="text/css">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
-<td width="100%" align="left" class="shortcuts">
-<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-plugins-eglglessink.description" class="shortcut">Description</a></span>
-</td>
-<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
-<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-edgedetect.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-faac.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
-</tr></table>
-<div class="refentry">
-<a name="gst-plugins-bad-plugins-eglglessink"></a><div class="titlepage"></div>
-<div class="refnamediv"><table width="100%"><tr>
-<td valign="top">
-<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-eglglessink.top_of_page"></a>eglglessink</span></h2>
-<p>eglglessink — An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</p>
-</td>
-<td class="gallery_image" valign="top" align="right"></td>
-</tr></table></div>
-<div class="refsect1">
-<a name="gst-plugins-bad-plugins-eglglessink.description"></a><h2>Description</h2>
-<div class="refsynopsisdiv">
-<h2>Synopsis</h2>
-<div class="refsect2">
-<a name="id-1.2.28.3.2.1"></a><h3>Element Information</h3>
-<div class="variablelist"><table border="0" class="variablelist">
-<colgroup>
-<col align="left" valign="top">
-<col>
-</colgroup>
-<tbody>
-<tr>
-<td><p><span class="term">plugin</span></p></td>
-<td>
-            <a class="link" href="gst-plugins-bad-plugins-plugin-eglglessink.html#plugin-eglglessink">eglglessink</a>
-          </td>
-</tr>
-<tr>
-<td><p><span class="term">author</span></p></td>
-<td>Reynaldo H. Verdejo Pinochet &lt;reynaldo@collabora.com&gt;, Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</td>
-</tr>
-<tr>
-<td><p><span class="term">class</span></p></td>
-<td>Sink/Video</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<hr>
-<div class="refsect2">
-<a name="id-1.2.28.3.2.2"></a><h3>Element Pads</h3>
-<div class="variablelist"><table border="0" class="variablelist">
-<colgroup>
-<col align="left" valign="top">
-<col>
-</colgroup>
-<tbody>
-<tr>
-<td><p><span class="term">name</span></p></td>
-<td>sink</td>
-</tr>
-<tr>
-<td><p><span class="term">direction</span></p></td>
-<td>sink</td>
-</tr>
-<tr>
-<td><p><span class="term">presence</span></p></td>
-<td>always</td>
-</tr>
-<tr>
-<td><p><span class="term">details</span></p></td>
-<td>video/x-raw(memory:EGLImage), format=(string){ RGBA, BGRA, ARGB, ABGR, RGBx, BGRx, xRGB, xBGR, AYUV, Y444, I420, YV12, NV12, NV21, Y42B, Y41B, RGB, BGR, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
-</tr>
-<tr>
-<td><p><span class="term"></span></p></td>
-<td> video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string){ RGBA, BGRA, ARGB, ABGR, RGBx, BGRx, xRGB, xBGR, AYUV, Y444, I420, YV12, NV12, NV21, Y42B, Y41B, RGB, BGR, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
-</tr>
-<tr>
-<td><p><span class="term"></span></p></td>
-<td> video/x-raw, format=(string){ RGBA, BGRA, ARGB, ABGR, RGBx, BGRx, xRGB, xBGR, AYUV, Y444, I420, YV12, NV12, NV21, Y42B, Y41B, RGB, BGR, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-</div>
-<p>
-</p>
-</div>
-<div class="refsect1">
-<a name="gst-plugins-bad-plugins-eglglessink.functions_details"></a><h2>Functions</h2>
-</div>
-<div class="refsect1">
-<a name="gst-plugins-bad-plugins-eglglessink.other_details"></a><h2>Types and Values</h2>
-</div>
-</div>
-<div class="footer">
-<hr>
-          Generated by GTK-Doc V1.21</div>
-</body>
-</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-exclusion.html b/docs/plugins/html/gst-plugins-bad-plugins-exclusion.html
index 1e112ed..90075ff 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-exclusion.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-exclusion.html
@@ -83,7 +83,7 @@
 <a name="gst-plugins-bad-plugins-exclusion.description"></a><h2>Description</h2>
 <p>Exclusion saturates the colors of a video stream in realtime.</p>
 <div class="refsect2">
-<a name="id-1.2.26.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.30.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -99,7 +99,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.26.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.30.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -125,7 +125,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.26.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.30.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-faac.html b/docs/plugins/html/gst-plugins-bad-plugins-faac.html
index 4d0098e..6aad547 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-faac.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-faac.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="prev" href="gst-plugins-bad-plugins-eglglessink.html" title="eglglessink">
+<link rel="prev" href="gst-plugins-bad-plugins-edgedetect.html" title="edgedetect">
 <link rel="next" href="gst-plugins-bad-plugins-faad.html" title="faad">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -15,13 +15,14 @@
 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
 <td width="100%" align="left" class="shortcuts">
 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-plugins-faac.description" class="shortcut">Description</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-faac.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-faac.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
                   <a href="#gst-plugins-bad-plugins-faac.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
                   <a href="#gst-plugins-bad-plugins-faac.properties" class="shortcut">Properties</a></span>
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-eglglessink.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-edgedetect.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-faad.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -85,7 +86,7 @@
 </tbody>
 </table></div>
 </div>
-<div class="refsect1">
+<a name="GstFaac"></a><div class="refsect1">
 <a name="gst-plugins-bad-plugins-faac.other"></a><h2>Types and Values</h2>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
@@ -94,11 +95,21 @@
 </colgroup>
 <tbody><tr>
 <td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-faac.html#GstFaac" title="struct GstFaac">GstFaac</a></td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-faac.html#GstFaac-struct" title="struct GstFaac">GstFaac</a></td>
 </tr></tbody>
 </table></div>
 </div>
 <div class="refsect1">
+<a name="gst-plugins-bad-plugins-faac.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstaudioencoder.html#GstAudioEncoder">GstAudioEncoder</a>
+                    <span class="lineart">╰──</span> GstFaac
+</pre>
+</div>
+<div class="refsect1">
 <a name="gst-plugins-bad-plugins-faac.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
 <p>
 GstFaac implements
@@ -109,7 +120,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.29.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.32.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -135,7 +146,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.29.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.32.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -180,11 +191,11 @@
 </tr>
 <tr>
 <td><p><span class="term">details</span></p></td>
-<td>audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, base-profile=(string){ main, lc, ssr, ltp }</td>
+<td>audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, base-profile=(string){ main, lc, ssr, ltp }, framed=(boolean)true</td>
 </tr>
 <tr>
 <td><p><span class="term"></span></p></td>
-<td> audio/mpeg, mpegversion=(int)2, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, profile=(string){ main, lc }</td>
+<td> audio/mpeg, mpegversion=(int)2, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, profile=(string){ main, lc }, framed=(boolean)true</td>
 </tr>
 </tbody>
 </table></div>
@@ -199,33 +210,8 @@
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-faac.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
-<a name="GstFaac"></a><h3>struct GstFaac</h3>
-<pre class="programlisting">struct GstFaac {
-  GstAudioEncoder element;
-
-  /* input format */
-  gint format;
-  /* input frame size */
-  gint samples;
-  /* required output buffer size */
-  gint bytes;
-
-  /* negotiated */
-  gint mpegversion, outputformat;
-
-  /* properties */
-  gint bitrate,
-       profile,
-       quality,
-       brtype,
-       shortctl;
-  gboolean tns,
-           midside;
-
-  /* FAAC object */
-  faacEncHandle handle;
-};
-</pre>
+<a name="GstFaac-struct"></a><h3>struct GstFaac</h3>
+<pre class="programlisting">struct GstFaac;</pre>
 <p>
 </p>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-faad.html b/docs/plugins/html/gst-plugins-bad-plugins-faad.html
index f9b2ff9..40e47da 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-faad.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-faad.html
@@ -60,7 +60,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.30.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.33.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -86,7 +86,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.30.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.33.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-faceblur.html b/docs/plugins/html/gst-plugins-bad-plugins-faceblur.html
index 51a71df..52d4736 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-faceblur.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-faceblur.html
@@ -36,7 +36,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.31.3.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.34.3.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -51,7 +51,7 @@
 </tr>
 <tr>
 <td><p><span class="term">author</span></p></td>
-<td>Michael Sheldon &lt;mike@mikeasoft.com&gt;</td>
+<td>Michael Sheldon &lt;mike@mikeasoft.com&gt;,Robert Jobbagy &lt;jobbagy.robert@gmail.com&gt;</td>
 </tr>
 <tr>
 <td><p><span class="term">class</span></p></td>
@@ -62,7 +62,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.31.3.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.34.3.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-facedetect.html b/docs/plugins/html/gst-plugins-bad-plugins-facedetect.html
index 82751fd..78aaa45 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-facedetect.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-facedetect.html
@@ -36,7 +36,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.32.3.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.35.3.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -62,7 +62,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.32.3.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.35.3.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-festival.html b/docs/plugins/html/gst-plugins-bad-plugins-festival.html
index 465e725..58be981 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-festival.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-festival.html
@@ -61,7 +61,7 @@
 in server mode, started as </p>
 <pre class="screen">festival --server</pre>
 <div class="refsect2">
-<a name="id-1.2.33.6.5"></a><h3>Example pipeline</h3>
+<a name="id-1.2.36.6.5"></a><h3>Example pipeline</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -77,7 +77,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.33.6.6.1"></a><h3>Element Information</h3>
+<a name="id-1.2.36.6.6.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -103,7 +103,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.33.6.6.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.36.6.6.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-fisheye.html b/docs/plugins/html/gst-plugins-bad-plugins-fisheye.html
index a5e061b..ef59658 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-fisheye.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-fisheye.html
@@ -62,7 +62,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.34.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.37.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -88,7 +88,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.34.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.37.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-fpsdisplaysink.html b/docs/plugins/html/gst-plugins-bad-plugins-fpsdisplaysink.html
index fc638e7..355eacb 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-fpsdisplaysink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-fpsdisplaysink.html
@@ -152,7 +152,7 @@
 <a name="gst-plugins-bad-plugins-fpsdisplaysink.description"></a><h2>Description</h2>
 <p>Can display the current and average framerate as a testoverlay or on stdout.</p>
 <div class="refsect2">
-<a name="id-1.2.35.9.3"></a><h3>Example launch lines</h3>
+<a name="id-1.2.38.9.3"></a><h3>Example launch lines</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -174,7 +174,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.35.9.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.38.9.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -200,7 +200,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.35.9.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.38.9.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -346,7 +346,7 @@
                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>           user_data)</pre>
 <p>Signals the application about the measured fps</p>
 <div class="refsect3">
-<a name="id-1.2.35.13.2.5"></a><h4>Parameters</h4>
+<a name="id-1.2.38.13.2.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-gaussianblur.html b/docs/plugins/html/gst-plugins-bad-plugins-gaussianblur.html
index d40f8af..5825009 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-gaussianblur.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-gaussianblur.html
@@ -35,7 +35,7 @@
 <a name="gst-plugins-bad-plugins-gaussianblur.description"></a><h2>Description</h2>
 <p>Gaussianblur blurs the video stream in realtime.</p>
 <div class="refsect2">
-<a name="id-1.2.36.3.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.39.3.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -51,7 +51,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.36.3.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.39.3.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -77,7 +77,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.36.3.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.39.3.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-jpegparse.html b/docs/plugins/html/gst-plugins-bad-plugins-jpegparse.html
index eb3733d..761f8a3 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-jpegparse.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-jpegparse.html
@@ -104,7 +104,8 @@
     <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
         <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
             <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
-                <span class="lineart">╰──</span> GstJpegParse
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseParse.html">GstBaseParse</a>
+                    <span class="lineart">╰──</span> GstJpegParse
 </pre>
 </div>
 <div class="refsect1">
@@ -114,7 +115,7 @@
 image header searching for image properties such as width and height
 among others. Jpegparse can also extract metadata (e.g. xmp).</p>
 <div class="refsect2">
-<a name="id-1.2.37.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.40.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -132,7 +133,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.37.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.40.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -158,7 +159,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.37.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.40.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -203,7 +204,7 @@
 </tr>
 <tr>
 <td><p><span class="term">details</span></p></td>
-<td>image/jpeg, format=(string){ I420, Y41B, UYVY, YV12 }, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], interlaced=(boolean){ true, false }, framerate=(fraction)[ 0/1, 2147483647/1 ], parsed=(boolean)true</td>
+<td>image/jpeg, format=(string){ I420, Y41B, UYVY, YV12 }, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], parsed=(boolean)true</td>
 </tr>
 </tbody>
 </table></div>
@@ -249,7 +250,7 @@
 <p>
 </p>
 <div class="refsect3">
-<a name="id-1.2.37.8.6.5"></a><h4>Returns</h4>
+<a name="id-1.2.40.8.6.5"></a><h4>Returns</h4>
 <p></p>
 </div>
 </div>
@@ -266,7 +267,7 @@
 <div class="refsect2">
 <a name="GstJpegParseClass"></a><h3>struct GstJpegParseClass</h3>
 <pre class="programlisting">struct GstJpegParseClass {
-  GstElementClass  parent_class;
+  GstBaseParseClass  parent_class;
 };
 </pre>
 <p>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-kaleidoscope.html b/docs/plugins/html/gst-plugins-bad-plugins-kaleidoscope.html
index 4145730..a242bb0 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-kaleidoscope.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-kaleidoscope.html
@@ -91,7 +91,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.38.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.41.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -117,7 +117,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.38.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.41.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-liveadder.html b/docs/plugins/html/gst-plugins-bad-plugins-liveadder.html
index dfdd764..7e5fc5b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-liveadder.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-liveadder.html
@@ -79,7 +79,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.39.7.3.1.1"></a><h3>Element Information</h3>
+<a name="id-1.2.42.7.3.1.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -105,7 +105,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.39.7.3.1.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.42.7.3.1.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-marble.html b/docs/plugins/html/gst-plugins-bad-plugins-marble.html
index 50f8a06..a0f87be 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-marble.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-marble.html
@@ -95,7 +95,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.40.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.43.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -121,7 +121,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.40.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.43.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mimdec.html b/docs/plugins/html/gst-plugins-bad-plugins-mimdec.html
index 77a443c..d07e429 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-mimdec.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mimdec.html
@@ -59,7 +59,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.42.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.45.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -85,7 +85,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.42.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.45.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mimenc.html b/docs/plugins/html/gst-plugins-bad-plugins-mimenc.html
index 826c8c0..0fa3e8d 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-mimenc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mimenc.html
@@ -75,7 +75,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.41.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.44.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -101,7 +101,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.41.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.44.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mirror.html b/docs/plugins/html/gst-plugins-bad-plugins-mirror.html
index 8fb1047..d9a4a0b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-mirror.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mirror.html
@@ -78,7 +78,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.43.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.46.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -104,7 +104,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.43.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.46.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-modplug.html b/docs/plugins/html/gst-plugins-bad-plugins-modplug.html
index 3fb7d83..f1a63c6 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-modplug.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-modplug.html
@@ -133,7 +133,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.44.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.47.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -159,7 +159,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.44.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.47.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mpeg2enc.html b/docs/plugins/html/gst-plugins-bad-plugins-mpeg2enc.html
index 5ce918a..00573d6 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-mpeg2enc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mpeg2enc.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
 <link rel="prev" href="gst-plugins-bad-plugins-modplug.html" title="modplug">
-<link rel="next" href="gst-plugins-bad-plugins-mplex.html" title="mplex">
+<link rel="next" href="gst-plugins-bad-plugins-mpegpsmux.html" title="mpegpsmux">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -23,7 +23,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-modplug.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-mplex.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-mpegpsmux.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-mpeg2enc"></a><div class="titlepage"></div>
@@ -249,7 +249,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.45.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.48.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -276,7 +276,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.45.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.48.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mpegpsmux.html b/docs/plugins/html/gst-plugins-bad-plugins-mpegpsmux.html
new file mode 100644
index 0000000..14945b8
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mpegpsmux.html
@@ -0,0 +1,186 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: mpegpsmux</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-mpeg2enc.html" title="mpeg2enc">
+<link rel="next" href="gst-plugins-bad-plugins-mpegtsmux.html" title="mpegtsmux">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-mpegpsmux.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-mpegpsmux.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-mpegpsmux.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-mpeg2enc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-mpegtsmux.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-mpegpsmux"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-mpegpsmux.top_of_page"></a>mpegpsmux</span></h2>
+<p>mpegpsmux — Multiplexes media streams into an MPEG Program Stream</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegpsmux.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody><tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-mpegpsmux.html#MpegPsMux--aggregate-gops" title="The “aggregate-gops” property">aggregate-gops</a></td>
+<td class="property_flags">Read / Write</td>
+</tr></tbody>
+</table></div>
+</div>
+<a name="MpegPsMux"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegpsmux.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> MpegPsMux
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegpsmux.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.49.6.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-mpegpsmux.html#plugin-mpegpsmux">mpegpsmux</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Lin YANG &lt;oxcsnicho@gmail.com&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Muxer</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.49.6.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink_%u</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>request</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> video/x-dirac</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> video/x-h264</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/mpeg, mpegversion=(int){ 1, 2 }</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/mpeg, mpegversion=(int)4, stream-format=(string){ raw, adts }</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/x-lpcm, width=(int){ 16, 20, 24 }, rate=(int){ 48000, 96000 }, channels=(int)[ 1, 8 ], dynamic_range=(int)[ 0, 255 ], emphasis=(boolean){ false, true }, mute=(boolean){ false, true }</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>video/mpeg, mpegversion=(int)2, systemstream=(boolean)true</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegpsmux.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegpsmux.other_details"></a><h2>Types and Values</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegpsmux.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="MpegPsMux--aggregate-gops"></a><h3>The <code class="literal">“aggregate-gops”</code> property</h3>
+<pre class="programlisting">  “aggregate-gops”           <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Whether to aggregate GOPs and push them out as buffer lists.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: FALSE</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mpegtsmux.html b/docs/plugins/html/gst-plugins-bad-plugins-mpegtsmux.html
new file mode 100644
index 0000000..1652647
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mpegtsmux.html
@@ -0,0 +1,273 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: mpegtsmux</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-mpegpsmux.html" title="mpegpsmux">
+<link rel="next" href="gst-plugins-bad-plugins-mplex.html" title="mplex">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-mpegtsmux.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-mpegtsmux.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-mpegtsmux.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-mpegpsmux.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-mplex.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-mpegtsmux"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-mpegtsmux.top_of_page"></a>mpegtsmux</span></h2>
+<p>mpegtsmux — Multiplexes media streams into an MPEG Transport Stream</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegtsmux.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--m2ts-mode" title="The “m2ts-mode” property">m2ts-mode</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type">
+<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstStructure.html"><span class="type">GstStructure</span></a> *</td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--prog-map" title="The “prog-map” property">prog-map</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--pat-interval" title="The “pat-interval” property">pat-interval</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--pmt-interval" title="The “pmt-interval” property">pmt-interval</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--alignment" title="The “alignment” property">alignment</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--si-interval" title="The “si-interval” property">si-interval</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<a name="MpegTsMux"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegtsmux.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> MpegTsMux
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegtsmux.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.50.6.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-mpegtsmux.html#plugin-mpegtsmux">mpegtsmux</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Fluendo &lt;contact@fluendo.com&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Muxer</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.50.6.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink_%d</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>request</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>video/mpeg, parsed=(boolean)true, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> video/x-dirac</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> video/x-h264, stream-format=(string)byte-stream, alignment=(string){ au, nal }</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/mpeg, parsed=(boolean)true, mpegversion=(int){ 1, 2 }</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/mpeg, framed=(boolean)true, mpegversion=(int)4, stream-format=(string){ raw, adts }</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/x-lpcm, width=(int){ 16, 20, 24 }, rate=(int){ 48000, 96000 }, channels=(int)[ 1, 8 ], dynamic_range=(int)[ 0, 255 ], emphasis=(boolean){ false, true }, mute=(boolean){ false, true }</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/x-ac3, framed=(boolean)true</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> audio/x-dts, framed=(boolean)true</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> subpicture/x-dvb</td>
+</tr>
+<tr>
+<td><p><span class="term"></span></p></td>
+<td> application/x-teletext</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>video/mpegts, systemstream=(boolean)true, packetsize=(int){ 188, 192 }</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegtsmux.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegtsmux.other_details"></a><h2>Types and Values</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-mpegtsmux.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="MpegTsMux--m2ts-mode"></a><h3>The <code class="literal">“m2ts-mode”</code> property</h3>
+<pre class="programlisting">  “m2ts-mode”                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Set to TRUE to output Blu-Ray disc format with 192 byte packets. FALSE for standard TS format with 188 byte packets.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: FALSE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="MpegTsMux--prog-map"></a><h3>The <code class="literal">“prog-map”</code> property</h3>
+<pre class="programlisting">  “prog-map”                 <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstStructure.html"><span class="type">GstStructure</span></a> *</pre>
+<p>A GstStructure specifies the mapping from elementary streams to programs.</p>
+<p>Flags: Read / Write</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="MpegTsMux--pat-interval"></a><h3>The <code class="literal">“pat-interval”</code> property</h3>
+<pre class="programlisting">  “pat-interval”             <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>Set the interval (in ticks of the 90kHz clock) for writing out the PAT table.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: &gt;= 1</p>
+<p>Default value: 9000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="MpegTsMux--pmt-interval"></a><h3>The <code class="literal">“pmt-interval”</code> property</h3>
+<pre class="programlisting">  “pmt-interval”             <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>Set the interval (in ticks of the 90kHz clock) for writing out the PMT table.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: &gt;= 1</p>
+<p>Default value: 9000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="MpegTsMux--alignment"></a><h3>The <code class="literal">“alignment”</code> property</h3>
+<pre class="programlisting">  “alignment”                <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>Number of packets per buffer (padded with dummy packets on EOS) (-1 = auto, 0 = all available packets).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: &gt;= G_MAXULONG</p>
+<p>Default value: -1</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="MpegTsMux--si-interval"></a><h3>The <code class="literal">“si-interval”</code> property</h3>
+<pre class="programlisting">  “si-interval”              <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>Set the interval (in ticks of the 90kHz clock) for writing out the ServiceInformation tables.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: &gt;= 1</p>
+<p>Default value: 9000</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mpg123audiodec.html b/docs/plugins/html/gst-plugins-bad-plugins-mpg123audiodec.html
index 174e4cd..f6d25df 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-mpg123audiodec.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mpg123audiodec.html
@@ -60,7 +60,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.47.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.52.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -86,7 +86,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.47.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.52.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -107,7 +107,7 @@
 </tr>
 <tr>
 <td><p><span class="term">details</span></p></td>
-<td>audio/mpeg, mpegversion=(int){ 1 }, layer=(int)[ 1, 3 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ], parsed=(boolean)true</td>
+<td>audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ], parsed=(boolean)true</td>
 </tr>
 </tbody>
 </table></div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-mplex.html b/docs/plugins/html/gst-plugins-bad-plugins-mplex.html
index 6d22e38..a11735c 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-mplex.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-mplex.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="prev" href="gst-plugins-bad-plugins-mpeg2enc.html" title="mpeg2enc">
+<link rel="prev" href="gst-plugins-bad-plugins-mpegtsmux.html" title="mpegtsmux">
 <link rel="next" href="gst-plugins-bad-plugins-mpg123audiodec.html" title="mpg123audiodec">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -21,7 +21,7 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-mpeg2enc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-mpegtsmux.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-mpg123audiodec.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -107,7 +107,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.46.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.51.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -135,7 +135,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.46.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.51.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-neonhttpsrc.html b/docs/plugins/html/gst-plugins-bad-plugins-neonhttpsrc.html
index 0f32e54..6b57483 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-neonhttpsrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-neonhttpsrc.html
@@ -15,7 +15,8 @@
 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
 <td width="100%" align="left" class="shortcuts">
 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-plugins-neonhttpsrc.description" class="shortcut">Description</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-neonhttpsrc.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-neonhttpsrc.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
                   <a href="#gst-plugins-bad-plugins-neonhttpsrc.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
                   <a href="#gst-plugins-bad-plugins-neonhttpsrc.properties" class="shortcut">Properties</a></span>
 </td>
@@ -121,7 +122,7 @@
 </tbody>
 </table></div>
 </div>
-<div class="refsect1">
+<a name="GstNeonhttpSrc"></a><div class="refsect1">
 <a name="gst-plugins-bad-plugins-neonhttpsrc.other"></a><h2>Types and Values</h2>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
@@ -130,11 +131,22 @@
 </colgroup>
 <tbody><tr>
 <td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc" title="struct GstNeonhttpSrc">GstNeonhttpSrc</a></td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc-struct" title="struct GstNeonhttpSrc">GstNeonhttpSrc</a></td>
 </tr></tbody>
 </table></div>
 </div>
 <div class="refsect1">
+<a name="gst-plugins-bad-plugins-neonhttpsrc.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseSrc.html">GstBaseSrc</a>
+                    <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstPushSrc.html">GstPushSrc</a>
+                        <span class="lineart">╰──</span> GstNeonhttpSrc
+</pre>
+</div>
+<div class="refsect1">
 <a name="gst-plugins-bad-plugins-neonhttpsrc.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
 <p>
 GstNeonhttpSrc implements
@@ -145,7 +157,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.48.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.53.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -171,7 +183,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.48.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.53.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -207,44 +219,8 @@
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-neonhttpsrc.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
-<a name="GstNeonhttpSrc"></a><h3>struct GstNeonhttpSrc</h3>
-<pre class="programlisting">struct GstNeonhttpSrc {
-  GstPushSrc element;
-
-  /* socket */
-  ne_session *session;
-  ne_request *request;
-  ne_uri uri;
-  gchar *location;
-  gchar *query_string;
-  ne_uri proxy;
-  gchar *user_agent;
-  gchar **cookies;
-
-  guint64 content_size;
-
-  gboolean eos;
-
-  /* whether to request icecast metadata */
-  gboolean iradio_mode;
-
-  /* enable Neon HTTP redirects (HTTP 302 status code) */
-  gboolean automatic_redirect;
-
-  /* enable Neon HTTP debug messages */
-  gboolean neon_http_debug;
-
-  /* accept self-signed certificates */
-  gboolean accept_self_signed;
-
-  gint64 read_position;
-  gboolean seekable;
-
-  /* seconds before timing out when connecting or reading to/from a socket */
-  guint connect_timeout;
-  guint read_timeout;
-};
-</pre>
+<a name="GstNeonhttpSrc-struct"></a><h3>struct GstNeonhttpSrc</h3>
+<pre class="programlisting">struct GstNeonhttpSrc;</pre>
 <p>
 </p>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-ofa.html b/docs/plugins/html/gst-plugins-bad-plugins-ofa.html
index be348ab..6ba6d84 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-ofa.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-ofa.html
@@ -78,7 +78,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.49.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.54.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -104,7 +104,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.49.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.54.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-openalsink.html b/docs/plugins/html/gst-plugins-bad-plugins-openalsink.html
index f9d8283..0ee1050 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-openalsink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-openalsink.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
 <link rel="prev" href="gst-plugins-bad-plugins-openalsrc.html" title="openalsrc">
-<link rel="next" href="gst-plugins-bad-plugins-pcapparse.html" title="pcapparse">
+<link rel="next" href="gst-plugins-bad-plugins-opusdec.html" title="opusdec">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -20,7 +20,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-openalsrc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-pcapparse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-opusdec.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-openalsink"></a><div class="titlepage"></div>
@@ -36,7 +36,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.51.3.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.56.3.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -62,7 +62,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.51.3.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.56.3.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-openalsrc.html b/docs/plugins/html/gst-plugins-bad-plugins-openalsrc.html
index c2dbbba..376fb12 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-openalsrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-openalsrc.html
@@ -88,7 +88,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.50.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.55.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -114,7 +114,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.50.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.55.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-opencvtextoverlay.html b/docs/plugins/html/gst-plugins-bad-plugins-opencvtextoverlay.html
index 03f1219..a2a96f1 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-opencvtextoverlay.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-opencvtextoverlay.html
@@ -118,7 +118,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.70.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.80.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -144,7 +144,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.70.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.80.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-opusdec.html b/docs/plugins/html/gst-plugins-bad-plugins-opusdec.html
new file mode 100644
index 0000000..53953c7
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-opusdec.html
@@ -0,0 +1,201 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: opusdec</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-openalsink.html" title="openalsink">
+<link rel="next" href="gst-plugins-bad-plugins-opusenc.html" title="opusenc">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusdec.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusdec.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusdec.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-openalsink.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-opusenc.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-opusdec"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-opusdec.top_of_page"></a>opusdec</span></h2>
+<p>opusdec — decode opus streams to audio</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusdec.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusdec.html#GstOpusDec--apply-gain" title="The “apply-gain” property">apply-gain</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusdec.html#GstOpusDec--use-inband-fec" title="The “use-inband-fec” property">use-inband-fec</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<a name="GstOpenalSrc"></a><a name="GstOpencvTextOverlay"></a><a name="GstOpusDec"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusdec.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-opusdec.html#GstOpusDec-struct" title="struct GstOpusDec">GstOpusDec</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusdec.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstaudiodecoder.html#GstAudioDecoder">GstAudioDecoder</a>
+                    <span class="lineart">╰──</span> GstOpusDec
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusdec.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.57.9.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-opus.html#plugin-opus">opus</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Vincent Penquerc'h &lt;vincent.penquerch@collabora.co.uk&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Decoder/Audio</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.57.9.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-opus</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int){ 48000, 24000, 16000, 12000, 8000 }, channels=(int)[ 1, 8 ]</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusdec.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusdec.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstOpusDec-struct"></a><h3>struct GstOpusDec</h3>
+<pre class="programlisting">struct GstOpusDec;</pre>
+<p>
+</p>
+</div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusdec.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="GstOpusDec--apply-gain"></a><h3>The <code class="literal">“apply-gain”</code> property</h3>
+<pre class="programlisting">  “apply-gain”               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Apply gain if any is specified in the header.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: TRUE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusDec--use-inband-fec"></a><h3>The <code class="literal">“use-inband-fec”</code> property</h3>
+<pre class="programlisting">  “use-inband-fec”           <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Use forward error correction if available.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: FALSE</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-opusenc.html b/docs/plugins/html/gst-plugins-bad-plugins-opusenc.html
new file mode 100644
index 0000000..1f729a9
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-opusenc.html
@@ -0,0 +1,348 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: opusenc</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-opusdec.html" title="opusdec">
+<link rel="next" href="gst-plugins-bad-plugins-opusparse.html" title="opusparse">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusenc.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusenc.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusenc.properties" class="shortcut">Properties</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-opusdec.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-opusparse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-opusenc"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-opusenc.top_of_page"></a>opusenc</span></h2>
+<p>opusenc — Encodes audio in Opus format</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusenc.properties"></a><h2>Properties</h2>
+<div class="informaltable"><table border="0">
+<colgroup>
+<col width="150px" class="properties_type">
+<col width="300px" class="properties_name">
+<col width="200px" class="properties_flags">
+</colgroup>
+<tbody>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--audio" title="The “audio” property">audio</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstOpusEncBandwidth</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bandwidth" title="The “bandwidth” property">bandwidth</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bitrate" title="The “bitrate” property">bitrate</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--cbr" title="The “cbr” property">cbr</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--complexity" title="The “complexity” property">complexity</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--constrained-vbr" title="The “constrained-vbr” property">constrained-vbr</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--dtx" title="The “dtx” property">dtx</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstOpusEncFrameSize</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--frame-size" title="The “frame-size” property">frame-size</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--inband-fec" title="The “inband-fec” property">inband-fec</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--max-payload-size" title="The “max-payload-size” property">max-payload-size</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--packet-loss-percentage" title="The “packet-loss-percentage” property">packet-loss-percentage</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstOpusEncAudioType</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--audio-type" title="The “audio-type” property">audio-type</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+<tr>
+<td class="property_type"><span class="type">GstOpusEncBitrateType</span></td>
+<td class="property_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bitrate-type" title="The “bitrate-type” property">bitrate-type</a></td>
+<td class="property_flags">Read / Write</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<a name="GstOpenalSrc"></a><a name="GstOpencvTextOverlay"></a><a name="GstOpusDec"></a><a name="GstOpusEnc"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusenc.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-opusenc.html#GstOpusEnc-struct" title="struct GstOpusEnc">GstOpusEnc</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusenc.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstaudioencoder.html#GstAudioEncoder">GstAudioEncoder</a>
+                    <span class="lineart">╰──</span> GstOpusEnc
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusenc.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.58.10.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-opus.html#plugin-opus">opus</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Vincent Penquerc'h &lt;vincent.penquerch@collabora.co.uk&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Encoder/Audio</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.58.10.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int){ 8000, 12000, 16000, 24000, 48000 }, channels=(int)[ 1, 2 ]</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-opus</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusenc.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusenc.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstOpusEnc-struct"></a><h3>struct GstOpusEnc</h3>
+<pre class="programlisting">struct GstOpusEnc;</pre>
+<p>
+</p>
+</div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusenc.property-details"></a><h2>Property Details</h2>
+<div class="refsect2">
+<a name="GstOpusEnc--audio"></a><h3>The <code class="literal">“audio”</code> property</h3>
+<pre class="programlisting">  “audio”                    <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Audio or voice (obsolete, use audio-type).</p>
+<p>Flags: Read / Write</p>
+<p>Default value: TRUE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--bandwidth"></a><h3>The <code class="literal">“bandwidth”</code> property</h3>
+<pre class="programlisting">  “bandwidth”                <span class="type">GstOpusEncBandwidth</span></pre>
+<p>Audio Band Width.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: Full band</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--bitrate"></a><h3>The <code class="literal">“bitrate”</code> property</h3>
+<pre class="programlisting">  “bitrate”                  <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>Specify an encoding bit-rate (in bps).</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [4000,650000]</p>
+<p>Default value: 64000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--cbr"></a><h3>The <code class="literal">“cbr”</code> property</h3>
+<pre class="programlisting">  “cbr”                      <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Constant bit rate.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: TRUE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--complexity"></a><h3>The <code class="literal">“complexity”</code> property</h3>
+<pre class="programlisting">  “complexity”               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>Complexity.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [0,10]</p>
+<p>Default value: 10</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--constrained-vbr"></a><h3>The <code class="literal">“constrained-vbr”</code> property</h3>
+<pre class="programlisting">  “constrained-vbr”          <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Constrained VBR.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: TRUE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--dtx"></a><h3>The <code class="literal">“dtx”</code> property</h3>
+<pre class="programlisting">  “dtx”                      <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>DTX.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: FALSE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--frame-size"></a><h3>The <code class="literal">“frame-size”</code> property</h3>
+<pre class="programlisting">  “frame-size”               <span class="type">GstOpusEncFrameSize</span></pre>
+<p>The duration of an audio frame, in ms.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: 20</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--inband-fec"></a><h3>The <code class="literal">“inband-fec”</code> property</h3>
+<pre class="programlisting">  “inband-fec”               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a></pre>
+<p>Enable forward error correction.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: FALSE</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--max-payload-size"></a><h3>The <code class="literal">“max-payload-size”</code> property</h3>
+<pre class="programlisting">  “max-payload-size”         <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
+<p>Maximum payload size in bytes.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [2,4000]</p>
+<p>Default value: 4000</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--packet-loss-percentage"></a><h3>The <code class="literal">“packet-loss-percentage”</code> property</h3>
+<pre class="programlisting">  “packet-loss-percentage”   <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a></pre>
+<p>Packet loss percentage.</p>
+<p>Flags: Read / Write</p>
+<p>Allowed values: [0,100]</p>
+<p>Default value: 0</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--audio-type"></a><h3>The <code class="literal">“audio-type”</code> property</h3>
+<pre class="programlisting">  “audio-type”               <span class="type">GstOpusEncAudioType</span></pre>
+<p>What type of audio to optimize for.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: Generic audio</p>
+</div>
+<hr>
+<div class="refsect2">
+<a name="GstOpusEnc--bitrate-type"></a><h3>The <code class="literal">“bitrate-type”</code> property</h3>
+<pre class="programlisting">  “bitrate-type”             <span class="type">GstOpusEncBitrateType</span></pre>
+<p>Bitrate type.</p>
+<p>Flags: Read / Write</p>
+<p>Default value: CBR</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-opusparse.html b/docs/plugins/html/gst-plugins-bad-plugins-opusparse.html
new file mode 100644
index 0000000..443eae3
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-opusparse.html
@@ -0,0 +1,160 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: opusparse</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-opusenc.html" title="opusenc">
+<link rel="next" href="gst-plugins-bad-plugins-rtpopuspay.html" title="rtpopuspay">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusparse.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-opusparse.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-opusenc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-rtpopuspay.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-opusparse"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-opusparse.top_of_page"></a>opusparse</span></h2>
+<p>opusparse — parses opus audio streams</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<a name="GstOpenalSrc"></a><a name="GstOpencvTextOverlay"></a><a name="GstOpusDec"></a><a name="GstOpusEnc"></a><a name="GstOpusParse"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusparse.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-opusparse.html#GstOpusParse-struct" title="struct GstOpusParse">GstOpusParse</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusparse.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseParse.html">GstBaseParse</a>
+                    <span class="lineart">╰──</span> GstOpusParse
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusparse.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.59.10.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-opus.html#plugin-opus">opus</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Vincent Penquerc'h &lt;vincent.penquerch@collabora.co.uk&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Parser/Audio</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.59.10.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-opus</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-opus, framed=(boolean)true</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusparse.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-opusparse.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstOpusParse-struct"></a><h3>struct GstOpusParse</h3>
+<pre class="programlisting">struct GstOpusParse;</pre>
+<p>
+</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-pcapparse.html b/docs/plugins/html/gst-plugins-bad-plugins-pcapparse.html
index 1beb427..d4d5da0 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-pcapparse.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-pcapparse.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
-<link rel="prev" href="gst-plugins-bad-plugins-openalsink.html" title="openalsink">
+<link rel="prev" href="gst-plugins-bad-plugins-rtpopusdepay.html" title="rtpopusdepay">
 <link rel="next" href="gst-plugins-bad-plugins-pinch.html" title="pinch">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -21,7 +21,7 @@
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-openalsink.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-rtpopusdepay.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-pinch.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -107,7 +107,7 @@
 <a class="link" href="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse--src-port" title="The “src-port” property"><span class="type">“src-port”</span></a> and <a class="link" href="gst-plugins-bad-plugins-pcapparse.html#GstPcapParse--dst-port" title="The “dst-port” property"><span class="type">“dst-port”</span></a> to restrict which packets
 should be included.</p>
 <div class="refsect2">
-<a name="id-1.2.52.7.3"></a><h3>Example pipelines</h3>
+<a name="id-1.2.62.7.3"></a><h3>Example pipelines</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -126,7 +126,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.52.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.62.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -152,7 +152,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.52.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.62.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-pinch.html b/docs/plugins/html/gst-plugins-bad-plugins-pinch.html
index c7d9c4a..9ad5b69 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-pinch.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-pinch.html
@@ -79,7 +79,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.53.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.63.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -105,7 +105,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.53.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.63.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-aiff.html
similarity index 62%
copy from docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
copy to docs/plugins/html/gst-plugins-bad-plugins-plugin-aiff.html
index a6a2502..d0bbfc9 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-aiff.html
@@ -2,12 +2,12 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: eglglessink</title>
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: aiff</title>
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-dvdspu.html" title="dvdspu">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-faac.html" title="faac">
+<link rel="prev" href="ch02.html" title="gst-plugins-bad Plugins">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-audiomixer.html" title="audiomixer">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -16,20 +16,20 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-dvdspu.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-faac.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="ch02.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-audiomixer.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
-<a name="gst-plugins-bad-plugins-plugin-eglglessink"></a><div class="titlepage"></div>
+<a name="gst-plugins-bad-plugins-plugin-aiff"></a><div class="titlepage"></div>
 <div class="refnamediv"><table width="100%"><tr>
 <td valign="top">
-<h2><span class="refentrytitle">eglglessink</span></h2>
-<p>eglglessink — <a name="plugin-eglglessink"></a>EGL/GLES sink</p>
+<h2><span class="refentrytitle">aiff</span></h2>
+<p>aiff — <a name="plugin-aiff"></a>Create and parse Audio Interchange File Format (AIFF) files</p>
 </td>
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.15.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.2.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -38,11 +38,11 @@
 <tbody>
 <tr>
 <td><p><span class="term">filename</span></p></td>
-<td>libgsteglglessink.so</td>
+<td>libgstaiff.so</td>
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.2.0</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,16 +60,22 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.15.4"></a><h2>Elements</h2>
+<a name="id-1.3.2.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
 <col>
 </colgroup>
-<tbody><tr>
-<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-eglglessink.html" title="eglglessink">eglglessink</a></span></p></td>
-<td>An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</td>
-</tr></tbody>
+<tbody>
+<tr>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-aiffmux.html" title="aiffmux">aiffmux</a></span></p></td>
+<td>Multiplex raw audio into AIFF</td>
+</tr>
+<tr>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-aiffparse.html" title="aiffparse">aiffparse</a></span></p></td>
+<td>Parse a .aiff file into raw audio</td>
+</tr>
+</tbody>
 </table></div>
 </div>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-assrender.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-assrender.html
index 1c8c355..a339d89 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-assrender.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-assrender.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.4.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.6.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.4.4"></a><h2>Elements</h2>
+<a name="id-1.3.6.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-audiomixer.html
similarity index 65%
copy from docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
copy to docs/plugins/html/gst-plugins-bad-plugins-plugin-audiomixer.html
index a6a2502..32e378a 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-audiomixer.html
@@ -2,12 +2,12 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: eglglessink</title>
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: audiomixer</title>
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-dvdspu.html" title="dvdspu">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-faac.html" title="faac">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-aiff.html" title="aiff">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-audiovisualizers.html" title="audiovisualizers">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -16,20 +16,20 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-dvdspu.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-faac.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-aiff.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-audiovisualizers.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
-<a name="gst-plugins-bad-plugins-plugin-eglglessink"></a><div class="titlepage"></div>
+<a name="gst-plugins-bad-plugins-plugin-audiomixer"></a><div class="titlepage"></div>
 <div class="refnamediv"><table width="100%"><tr>
 <td valign="top">
-<h2><span class="refentrytitle">eglglessink</span></h2>
-<p>eglglessink — <a name="plugin-eglglessink"></a>EGL/GLES sink</p>
+<h2><span class="refentrytitle">audiomixer</span></h2>
+<p>audiomixer — <a name="plugin-audiomixer"></a>Mixes multiple audio streams</p>
 </td>
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.15.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.3.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -38,11 +38,11 @@
 <tbody>
 <tr>
 <td><p><span class="term">filename</span></p></td>
-<td>libgsteglglessink.so</td>
+<td>libgstaudiomixer.so</td>
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.2.0</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,15 +60,15 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.15.4"></a><h2>Elements</h2>
+<a name="id-1.3.3.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
 <col>
 </colgroup>
 <tbody><tr>
-<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-eglglessink.html" title="eglglessink">eglglessink</a></span></p></td>
-<td>An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</td>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-audiomixer.html" title="audiomixer">audiomixer</a></span></p></td>
+<td>Mixes multiple audio streams</td>
 </tr></tbody>
 </table></div>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-audiovisualizers.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-audiovisualizers.html
index 4672550..9e8e844 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-audiovisualizers.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-audiovisualizers.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="ch02.html" title="gst-plugins-bad Plugins">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-audiomixer.html" title="audiomixer">
 <link rel="next" href="gst-plugins-bad-plugins-plugin-autoconvert.html" title="autoconvert">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -16,7 +16,7 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="ch02.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-audiomixer.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-autoconvert.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.2.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.4.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.2.4"></a><h2>Elements</h2>
+<a name="id-1.3.4.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-autoconvert.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-autoconvert.html
index 82cc7c7..4f3c6fa 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-autoconvert.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-autoconvert.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.3.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.5.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.3.4"></a><h2>Elements</h2>
+<a name="id-1.3.5.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-bayer.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-bayer.html
index e3d48cb..32d918c 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-bayer.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-bayer.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
 <link rel="prev" href="gst-plugins-bad-plugins-plugin-assrender.html" title="assrender">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-bz2.html" title="bz2">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-bs2b.html" title="bs2b">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -17,7 +17,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-assrender.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-bz2.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-bs2b.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-plugin-bayer"></a><div class="titlepage"></div>
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.5.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.7.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.5.4"></a><h2>Elements</h2>
+<a name="id-1.3.7.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-bs2b.html
similarity index 65%
copy from docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
copy to docs/plugins/html/gst-plugins-bad-plugins-plugin-bs2b.html
index a6a2502..3c5faa9 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-bs2b.html
@@ -2,12 +2,12 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: eglglessink</title>
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: bs2b</title>
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-dvdspu.html" title="dvdspu">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-faac.html" title="faac">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-bayer.html" title="bayer">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-bz2.html" title="bz2">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -16,20 +16,20 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-dvdspu.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-faac.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-bayer.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-bz2.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
-<a name="gst-plugins-bad-plugins-plugin-eglglessink"></a><div class="titlepage"></div>
+<a name="gst-plugins-bad-plugins-plugin-bs2b"></a><div class="titlepage"></div>
 <div class="refnamediv"><table width="100%"><tr>
 <td valign="top">
-<h2><span class="refentrytitle">eglglessink</span></h2>
-<p>eglglessink — <a name="plugin-eglglessink"></a>EGL/GLES sink</p>
+<h2><span class="refentrytitle">bs2b</span></h2>
+<p>bs2b — <a name="plugin-bs2b"></a>Improve headphone listening of stereo audio recordsusing the bs2b library.</p>
 </td>
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.15.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.8.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -38,11 +38,11 @@
 <tbody>
 <tr>
 <td><p><span class="term">filename</span></p></td>
-<td>libgsteglglessink.so</td>
+<td>libgstbs2b.so</td>
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.2.0</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,15 +60,15 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.15.4"></a><h2>Elements</h2>
+<a name="id-1.3.8.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
 <col>
 </colgroup>
 <tbody><tr>
-<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-eglglessink.html" title="eglglessink">eglglessink</a></span></p></td>
-<td>An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</td>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-bs2b.html" title="bs2b">bs2b</a></span></p></td>
+<td>Improve headphone listening of stereo audio records using the bs2b library.</td>
 </tr></tbody>
 </table></div>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-bz2.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-bz2.html
index 5476ca6..6111602 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-bz2.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-bz2.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-bayer.html" title="bayer">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-bs2b.html" title="bs2b">
 <link rel="next" href="gst-plugins-bad-plugins-plugin-camerabin.html" title="camerabin">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -16,7 +16,7 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-bayer.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-bs2b.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-camerabin.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.6.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.9.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.6.4"></a><h2>Elements</h2>
+<a name="id-1.3.9.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-camerabin.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-camerabin.html
index d641942..533a974 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-camerabin.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-camerabin.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.7.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.10.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.7.4"></a><h2>Elements</h2>
+<a name="id-1.3.10.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-coloreffects.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-coloreffects.html
index 5d8e40b..59e7501 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-coloreffects.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-coloreffects.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.8.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.11.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.8.4"></a><h2>Elements</h2>
+<a name="id-1.3.11.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-curl.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-curl.html
index 062c712..04069e9 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-curl.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-curl.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.9.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.12.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.9.4"></a><h2>Elements</h2>
+<a name="id-1.3.12.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -80,6 +80,10 @@
 <td>Upload data over HTTP/HTTPS protocol using libcurl</td>
 </tr>
 <tr>
+<td><p><span class="term">curlsftpsink</span></p></td>
+<td>Upload data over the SFTP protocol using libcurl</td>
+</tr>
+<tr>
 <td><p><span class="term">curlsmtpsink</span></p></td>
 <td>Upload data over SMTP protocol using libcurl</td>
 </tr>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dataurisrc.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dataurisrc.html
index 0c28890..52d0fa7 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dataurisrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dataurisrc.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.10.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.13.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.10.4"></a><h2>Elements</h2>
+<a name="id-1.3.13.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-debugutilsbad.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-debugutilsbad.html
index 2c5c331..9a13b53 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-debugutilsbad.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-debugutilsbad.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.11.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.14.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.11.4"></a><h2>Elements</h2>
+<a name="id-1.3.14.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dtsdec.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dtsdec.html
index cad32b0..78a55c8 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dtsdec.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dtsdec.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.12.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.15.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.12.4"></a><h2>Elements</h2>
+<a name="id-1.3.15.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvb.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvb.html
index bf4ebd6..6bc19b8 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvb.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvb.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.13.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.16.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.13.4"></a><h2>Elements</h2>
+<a name="id-1.3.16.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvdspu.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvdspu.html
index a6a157b..2bc20a0 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvdspu.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-dvdspu.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
 <link rel="prev" href="gst-plugins-bad-plugins-plugin-dvb.html" title="dvb">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-eglglessink.html" title="eglglessink">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-faac.html" title="faac">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -17,7 +17,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-dvb.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-eglglessink.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-faac.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-plugin-dvdspu"></a><div class="titlepage"></div>
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.14.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.17.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.14.4"></a><h2>Elements</h2>
+<a name="id-1.3.17.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-faac.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-faac.html
index 97d265b..3892b06 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-faac.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-faac.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-eglglessink.html" title="eglglessink">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-dvdspu.html" title="dvdspu">
 <link rel="next" href="gst-plugins-bad-plugins-plugin-faad.html" title="faad">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -16,7 +16,7 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-eglglessink.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-dvdspu.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-faad.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.16.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.18.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.3</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.16.4"></a><h2>Elements</h2>
+<a name="id-1.3.18.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-faad.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-faad.html
index 39a61bb..8a86da2 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-faad.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-faad.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.17.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.19.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.17.4"></a><h2>Elements</h2>
+<a name="id-1.3.19.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-festival.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-festival.html
index b41947b..964712e 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-festival.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-festival.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.18.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.20.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.18.4"></a><h2>Elements</h2>
+<a name="id-1.3.20.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-gaudieffects.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-gaudieffects.html
index 8ce98f4..e411201 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-gaudieffects.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-gaudieffects.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.19.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.21.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.19.4"></a><h2>Elements</h2>
+<a name="id-1.3.21.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-geometrictransform.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-geometrictransform.html
index 2f4b139..b716539 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-geometrictransform.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-geometrictransform.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.20.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.22.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.20.4"></a><h2>Elements</h2>
+<a name="id-1.3.22.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-gsm.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-gsm.html
index e13e50f..12e5c0b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-gsm.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-gsm.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.21.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.23.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.21.4"></a><h2>Elements</h2>
+<a name="id-1.3.23.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-jpegformat.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-jpegformat.html
index 212db35..3e31e6d 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-jpegformat.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-jpegformat.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.22.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.24.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.22.4"></a><h2>Elements</h2>
+<a name="id-1.3.24.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-liveadder.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-liveadder.html
index c18cd73..6af933f 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-liveadder.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-liveadder.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.23.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.25.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.23.4"></a><h2>Elements</h2>
+<a name="id-1.3.25.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mimic.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mimic.html
index ac31a09..de2723a 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mimic.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mimic.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.24.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.26.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.24.4"></a><h2>Elements</h2>
+<a name="id-1.3.26.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mms.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mms.html
index 6fcaa0e..fa2edba 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mms.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mms.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.25.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.27.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.25.4"></a><h2>Elements</h2>
+<a name="id-1.3.27.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-modplug.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-modplug.html
index cb0eab8..d203d7d 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-modplug.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-modplug.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.26.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.28.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.26.4"></a><h2>Elements</h2>
+<a name="id-1.3.28.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpeg2enc.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpeg2enc.html
index 7c3778f..f9adf70 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpeg2enc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpeg2enc.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
 <link rel="prev" href="gst-plugins-bad-plugins-plugin-modplug.html" title="modplug">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-mpegtsmux.html" title="mpegtsmux">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-mpegpsmux.html" title="mpegpsmux">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -17,7 +17,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-modplug.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-mpegtsmux.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-mpegpsmux.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-plugin-mpeg2enc"></a><div class="titlepage"></div>
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.27.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.29.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.27.4"></a><h2>Elements</h2>
+<a name="id-1.3.29.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpegpsmux.html
similarity index 65%
rename from docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
rename to docs/plugins/html/gst-plugins-bad-plugins-plugin-mpegpsmux.html
index a6a2502..bf3b282 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-eglglessink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpegpsmux.html
@@ -2,12 +2,12 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: eglglessink</title>
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: mpegpsmux</title>
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-dvdspu.html" title="dvdspu">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-faac.html" title="faac">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-mpeg2enc.html" title="mpeg2enc">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-mpegtsmux.html" title="mpegtsmux">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -16,20 +16,20 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-dvdspu.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-faac.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-mpeg2enc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-mpegtsmux.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
-<a name="gst-plugins-bad-plugins-plugin-eglglessink"></a><div class="titlepage"></div>
+<a name="gst-plugins-bad-plugins-plugin-mpegpsmux"></a><div class="titlepage"></div>
 <div class="refnamediv"><table width="100%"><tr>
 <td valign="top">
-<h2><span class="refentrytitle">eglglessink</span></h2>
-<p>eglglessink — <a name="plugin-eglglessink"></a>EGL/GLES sink</p>
+<h2><span class="refentrytitle">mpegpsmux</span></h2>
+<p>mpegpsmux — <a name="plugin-mpegpsmux"></a>MPEG-PS muxer</p>
 </td>
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.15.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.30.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -38,11 +38,11 @@
 <tbody>
 <tr>
 <td><p><span class="term">filename</span></p></td>
-<td>libgsteglglessink.so</td>
+<td>libgstmpegpsmux.so</td>
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.2.0</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,15 +60,15 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.15.4"></a><h2>Elements</h2>
+<a name="id-1.3.30.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
 <col>
 </colgroup>
 <tbody><tr>
-<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-eglglessink.html" title="eglglessink">eglglessink</a></span></p></td>
-<td>An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</td>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-mpegpsmux.html" title="mpegpsmux">mpegpsmux</a></span></p></td>
+<td>Multiplexes media streams into an MPEG Program Stream</td>
 </tr></tbody>
 </table></div>
 </div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpegtsmux.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpegtsmux.html
index 0400613..3c72d9b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpegtsmux.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mpegtsmux.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-mpeg2enc.html" title="mpeg2enc">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-mpegpsmux.html" title="mpegpsmux">
 <link rel="next" href="gst-plugins-bad-plugins-plugin-mplex.html" title="mplex">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -16,7 +16,7 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-mpeg2enc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-mpegpsmux.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-mplex.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.28.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.31.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,14 +60,14 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.28.4"></a><h2>Elements</h2>
+<a name="id-1.3.31.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
 <col>
 </colgroup>
 <tbody><tr>
-<td><p><span class="term">mpegtsmux</span></p></td>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-mpegtsmux.html" title="mpegtsmux">mpegtsmux</a></span></p></td>
 <td>Multiplexes media streams into an MPEG Transport Stream</td>
 </tr></tbody>
 </table></div>
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mplex.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mplex.html
index f0d350c..23ced08 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-mplex.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-mplex.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.29.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.32.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.29.4"></a><h2>Elements</h2>
+<a name="id-1.3.32.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-neon.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-neon.html
index b606842..9fd2291 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-neon.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-neon.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.30.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.33.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.3.2.1</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.30.4"></a><h2>Elements</h2>
+<a name="id-1.3.33.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-ofa.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-ofa.html
index 633cc7e..8924f6f 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-ofa.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-ofa.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.31.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.34.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.31.4"></a><h2>Elements</h2>
+<a name="id-1.3.34.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-openal.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-openal.html
index ce85f0b..b8162f1 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-openal.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-openal.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.32.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.35.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.32.4"></a><h2>Elements</h2>
+<a name="id-1.3.35.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-opencv.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-opencv.html
index 8f808e6..62e3229 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-opencv.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-opencv.html
@@ -7,7 +7,7 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
 <link rel="prev" href="gst-plugins-bad-plugins-plugin-openal.html" title="openal">
-<link rel="next" href="gst-plugins-bad-plugins-plugin-pcapparse.html" title="pcapparse">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-opus.html" title="opus">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -17,7 +17,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-openal.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-pcapparse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-opus.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-plugin-opencv"></a><div class="titlepage"></div>
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.33.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.36.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.33.4"></a><h2>Elements</h2>
+<a name="id-1.3.36.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-opus.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-opus.html
new file mode 100644
index 0000000..a515bc9
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-opus.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: opus</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-opencv.html" title="opencv">
+<link rel="next" href="gst-plugins-bad-plugins-plugin-pcapparse.html" title="pcapparse">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts"></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-opencv.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-pcapparse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-plugin-opus"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">opus</span></h2>
+<p>opus — <a name="plugin-opus"></a>OPUS plugin library</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="id-1.3.37.3"></a><h2>Plugin Information</h2>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">filename</span></p></td>
+<td>libgstopus.so</td>
+</tr>
+<tr>
+<td><p><span class="term">version</span></p></td>
+<td>1.5.0.1</td>
+</tr>
+<tr>
+<td><p><span class="term">run-time license</span></p></td>
+<td>LGPL</td>
+</tr>
+<tr>
+<td><p><span class="term">package</span></p></td>
+<td>GStreamer Bad Plug-ins git</td>
+</tr>
+<tr>
+<td><p><span class="term">origin</span></p></td>
+<td>Unknown package origin</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="id-1.3.37.4"></a><h2>Elements</h2>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-opusdec.html" title="opusdec">opusdec</a></span></p></td>
+<td>decode opus streams to audio</td>
+</tr>
+<tr>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-opusenc.html" title="opusenc">opusenc</a></span></p></td>
+<td>Encodes audio in Opus format</td>
+</tr>
+<tr>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-opusparse.html" title="opusparse">opusparse</a></span></p></td>
+<td>parses opus audio streams</td>
+</tr>
+<tr>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-rtpopusdepay.html" title="rtpopusdepay">rtpopusdepay</a></span></p></td>
+<td>Extracts Opus audio from RTP packets</td>
+</tr>
+<tr>
+<td><p><span class="term"><a class="link" href="gst-plugins-bad-plugins-rtpopuspay.html" title="rtpopuspay">rtpopuspay</a></span></p></td>
+<td>Puts Opus audio in RTP packets</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-pcapparse.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-pcapparse.html
index 45b1ef7..6860019 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-pcapparse.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-pcapparse.html
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
-<link rel="prev" href="gst-plugins-bad-plugins-plugin-opencv.html" title="opencv">
+<link rel="prev" href="gst-plugins-bad-plugins-plugin-opus.html" title="opus">
 <link rel="next" href="gst-plugins-bad-plugins-plugin-rawparse.html" title="rawparse">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
@@ -16,7 +16,7 @@
 <td width="100%" align="left" class="shortcuts"></td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
-<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-opencv.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-opus.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
 <td><a accesskey="n" href="gst-plugins-bad-plugins-plugin-rawparse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
 </tr></table>
 <div class="refentry">
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.34.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.38.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.34.4"></a><h2>Elements</h2>
+<a name="id-1.3.38.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-rawparse.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-rawparse.html
index 3cc93fa..37cf546 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-rawparse.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-rawparse.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.35.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.39.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.35.4"></a><h2>Elements</h2>
+<a name="id-1.3.39.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-rfbsrc.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-rfbsrc.html
index 617913b..9c37c5f 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-rfbsrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-rfbsrc.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.36.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.40.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.36.4"></a><h2>Elements</h2>
+<a name="id-1.3.40.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-rtmp.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-rtmp.html
index 0efb52a..4311f6b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-rtmp.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-rtmp.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.37.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.41.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.37.4"></a><h2>Elements</h2>
+<a name="id-1.3.41.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-sdp.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-sdp.html
index 7a36788..c120aad 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-sdp.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-sdp.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.38.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.42.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.38.4"></a><h2>Elements</h2>
+<a name="id-1.3.42.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-shm.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-shm.html
index fa5ebab..d33a375 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-shm.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-shm.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.39.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.43.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.39.4"></a><h2>Elements</h2>
+<a name="id-1.3.43.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-soundtouch.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-soundtouch.html
index 3285c16..5cbf163 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-soundtouch.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-soundtouch.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.40.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.44.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.40.4"></a><h2>Elements</h2>
+<a name="id-1.3.44.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-speed.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-speed.html
index 3ca6847..ebea1db 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-speed.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-speed.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.41.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.45.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.41.4"></a><h2>Elements</h2>
+<a name="id-1.3.45.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-voaacenc.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-voaacenc.html
index e6e8ce6..d8db377 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-voaacenc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-voaacenc.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.42.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.46.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.42.4"></a><h2>Elements</h2>
+<a name="id-1.3.46.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-voamrwbenc.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-voamrwbenc.html
index a08d553..0b9a60f 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-voamrwbenc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-voamrwbenc.html
@@ -29,7 +29,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.43.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.47.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +42,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +50,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +60,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.43.4"></a><h2>Elements</h2>
+<a name="id-1.3.47.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-plugin-zbar.html b/docs/plugins/html/gst-plugins-bad-plugins-plugin-zbar.html
index b9e36d4..6186f40 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-plugin-zbar.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-plugin-zbar.html
@@ -7,7 +7,6 @@
 <link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
 <link rel="up" href="ch02.html" title="gst-plugins-bad Plugins">
 <link rel="prev" href="gst-plugins-bad-plugins-plugin-voamrwbenc.html" title="voamrwbenc">
-<link rel="next" href="ch03.html" title="gst-plugins-bad Interfaces">
 <meta name="generator" content="GTK-Doc V1.21 (XML mode)">
 <link rel="stylesheet" href="style.css" type="text/css">
 </head>
@@ -17,7 +16,7 @@
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
 <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
 <td><a accesskey="p" href="gst-plugins-bad-plugins-plugin-voamrwbenc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
-<td><a accesskey="n" href="ch03.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+<td><img src="right-insensitive.png" width="16" height="16" border="0"></td>
 </tr></table>
 <div class="refentry">
 <a name="gst-plugins-bad-plugins-plugin-zbar"></a><div class="titlepage"></div>
@@ -29,7 +28,7 @@
 <td class="gallery_image" valign="top" align="right"></td>
 </tr></table></div>
 <div class="refsect1">
-<a name="id-1.3.44.3"></a><h2>Plugin Information</h2>
+<a name="id-1.3.48.3"></a><h2>Plugin Information</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -42,7 +41,7 @@
 </tr>
 <tr>
 <td><p><span class="term">version</span></p></td>
-<td>1.4.5</td>
+<td>1.5.0.1</td>
 </tr>
 <tr>
 <td><p><span class="term">run-time license</span></p></td>
@@ -50,7 +49,7 @@
 </tr>
 <tr>
 <td><p><span class="term">package</span></p></td>
-<td>GStreamer Bad Plug-ins source release</td>
+<td>GStreamer Bad Plug-ins git</td>
 </tr>
 <tr>
 <td><p><span class="term">origin</span></p></td>
@@ -60,7 +59,7 @@
 </table></div>
 </div>
 <div class="refsect1">
-<a name="id-1.3.44.4"></a><h2>Elements</h2>
+<a name="id-1.3.48.4"></a><h2>Elements</h2>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-pyramidsegment.html b/docs/plugins/html/gst-plugins-bad-plugins-pyramidsegment.html
index 06933b5..e80ea42 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-pyramidsegment.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-pyramidsegment.html
@@ -36,7 +36,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.54.4.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.64.4.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -62,7 +62,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.54.4.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.64.4.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-rfbsrc.html b/docs/plugins/html/gst-plugins-bad-plugins-rfbsrc.html
index ab85400..e748cc5 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-rfbsrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-rfbsrc.html
@@ -137,7 +137,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.55.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.65.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -163,7 +163,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.55.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.65.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-rtmpsink.html b/docs/plugins/html/gst-plugins-bad-plugins-rtmpsink.html
index 664db8a..c73a626 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-rtmpsink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-rtmpsink.html
@@ -84,7 +84,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.56.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.66.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -110,7 +110,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.56.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.66.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-rtmpsrc.html b/docs/plugins/html/gst-plugins-bad-plugins-rtmpsrc.html
index 51a37a7..5b575f0 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-rtmpsrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-rtmpsrc.html
@@ -85,7 +85,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.57.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.67.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -111,7 +111,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.57.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.67.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-rtpopusdepay.html b/docs/plugins/html/gst-plugins-bad-plugins-rtpopusdepay.html
new file mode 100644
index 0000000..fb9503b
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-rtpopusdepay.html
@@ -0,0 +1,160 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: rtpopusdepay</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-rtpopuspay.html" title="rtpopuspay">
+<link rel="next" href="gst-plugins-bad-plugins-pcapparse.html" title="pcapparse">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-rtpopusdepay.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-rtpopusdepay.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-rtpopuspay.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-pcapparse.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-rtpopusdepay"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-rtpopusdepay.top_of_page"></a>rtpopusdepay</span></h2>
+<p>rtpopusdepay — Extracts Opus audio from RTP packets</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<a name="GstOpenalSrc"></a><a name="GstOpencvTextOverlay"></a><a name="GstOpusDec"></a><a name="GstOpusEnc"></a><a name="GstOpusParse"></a><a name="GstRTPOpusDepay"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopusdepay.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-rtpopusdepay.html#GstRTPOpusDepay-struct" title="struct GstRTPOpusDepay">GstRTPOpusDepay</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopusdepay.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstrtpbasedepayload.html#GstRTPBaseDepayload">GstRTPBaseDepayload</a>
+                    <span class="lineart">╰──</span> GstRTPOpusDepay
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopusdepay.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.61.11.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-opus.html#plugin-opus">opus</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Danilo Cesar Lemes de Paula &lt;danilo.cesar@collabora.co.uk&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Depayloader/Network/RTP</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.61.11.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)48000, encoding-name=(string){ OPUS, X-GST-OPUS-DRAFT-SPITTKA-00 }</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-opus</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopusdepay.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopusdepay.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstRTPOpusDepay-struct"></a><h3>struct GstRTPOpusDepay</h3>
+<pre class="programlisting">struct GstRTPOpusDepay;</pre>
+<p>
+</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-rtpopuspay.html b/docs/plugins/html/gst-plugins-bad-plugins-rtpopuspay.html
new file mode 100644
index 0000000..a3f3744
--- /dev/null
+++ b/docs/plugins/html/gst-plugins-bad-plugins-rtpopuspay.html
@@ -0,0 +1,160 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>GStreamer Bad Plugins 1.0 Plugins Reference Manual: rtpopuspay</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="GStreamer Bad Plugins 1.0 Plugins Reference Manual">
+<link rel="up" href="ch01.html" title="gst-plugins-bad Elements">
+<link rel="prev" href="gst-plugins-bad-plugins-opusparse.html" title="opusparse">
+<link rel="next" href="gst-plugins-bad-plugins-rtpopusdepay.html" title="rtpopusdepay">
+<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
+<td width="100%" align="left" class="shortcuts">
+<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-rtpopuspay.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-rtpopuspay.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
+</td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
+<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
+<td><a accesskey="p" href="gst-plugins-bad-plugins-opusparse.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
+<td><a accesskey="n" href="gst-plugins-bad-plugins-rtpopusdepay.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry">
+<a name="gst-plugins-bad-plugins-rtpopuspay"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="gst-plugins-bad-plugins-rtpopuspay.top_of_page"></a>rtpopuspay</span></h2>
+<p>rtpopuspay — Puts Opus audio in RTP packets</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<a name="GstOpenalSrc"></a><a name="GstOpencvTextOverlay"></a><a name="GstOpusDec"></a><a name="GstOpusEnc"></a><a name="GstOpusParse"></a><a name="GstRTPOpusDepay"></a><a name="GstRtpOPUSPay"></a><div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopuspay.other"></a><h2>Types and Values</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="name">
+<col class="description">
+</colgroup>
+<tbody><tr>
+<td class="datatype_keyword">struct</td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-rtpopuspay.html#GstRtpOPUSPay-struct" title="struct GstRtpOPUSPay">GstRtpOPUSPay</a></td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopuspay.object-hierarchy"></a><h2>Object Hierarchy</h2>
+<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
+    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
+        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
+            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
+                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstrtpbasepayload.html#GstRTPBasePayload">GstRTPBasePayload</a>
+                    <span class="lineart">╰──</span> GstRtpOPUSPay
+</pre>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopuspay.description"></a><h2>Description</h2>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<div class="refsect2">
+<a name="id-1.2.60.12.2.1"></a><h3>Element Information</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">plugin</span></p></td>
+<td>
+            <a class="link" href="gst-plugins-bad-plugins-plugin-opus.html#plugin-opus">opus</a>
+          </td>
+</tr>
+<tr>
+<td><p><span class="term">author</span></p></td>
+<td>Danilo Cesar Lemes de Paula &lt;danilo.cesar@collabora.co.uk&gt;</td>
+</tr>
+<tr>
+<td><p><span class="term">class</span></p></td>
+<td>Codec/Payloader/Network/RTP</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="id-1.2.60.12.2.2"></a><h3>Element Pads</h3>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>sink</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>audio/x-opus, multistream=(boolean)false</td>
+</tr>
+</tbody>
+</table></div>
+<div class="variablelist"><table border="0" class="variablelist">
+<colgroup>
+<col align="left" valign="top">
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><p><span class="term">name</span></p></td>
+<td>src</td>
+</tr>
+<tr>
+<td><p><span class="term">direction</span></p></td>
+<td>source</td>
+</tr>
+<tr>
+<td><p><span class="term">presence</span></p></td>
+<td>always</td>
+</tr>
+<tr>
+<td><p><span class="term">details</span></p></td>
+<td>application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)48000, encoding-name=(string){ OPUS, X-GST-OPUS-DRAFT-SPITTKA-00 }</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<p>
+</p>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopuspay.functions_details"></a><h2>Functions</h2>
+</div>
+<div class="refsect1">
+<a name="gst-plugins-bad-plugins-rtpopuspay.other_details"></a><h2>Types and Values</h2>
+<div class="refsect2">
+<a name="GstRtpOPUSPay-struct"></a><h3>struct GstRtpOPUSPay</h3>
+<pre class="programlisting">struct GstRtpOPUSPay;</pre>
+<p>
+</p>
+</div>
+</div>
+</div>
+<div class="footer">
+<hr>
+          Generated by GTK-Doc V1.21</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-sdpdemux.html b/docs/plugins/html/gst-plugins-bad-plugins-sdpdemux.html
index ef07814..f2f6a9a 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-sdpdemux.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-sdpdemux.html
@@ -98,7 +98,7 @@
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-sdpdemux.description"></a><h2>Description</h2>
 <p>sdpdemux currently understands SDP as the input format of the session description.
-For each stream listed in the SDP a new stream_<code class="literal">u</code> pad will be created
+For each stream listed in the SDP a new stream_%u pad will be created
 with caps derived from the SDP media description. This is a caps of mime type
 "application/x-rtp" that can be connected to any available RTP depayloader
 element. </p>
@@ -108,7 +108,7 @@
 <p>sdpdemux acts like a live element and will therefore only generate data in the 
 PLAYING state.</p>
 <div class="refsect2">
-<a name="id-1.2.60.8.5"></a><h3>Example launch line</h3>
+<a name="id-1.2.70.8.5"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -125,7 +125,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.60.8.6.1"></a><h3>Element Information</h3>
+<a name="id-1.2.70.8.6.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -151,7 +151,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.60.8.6.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.70.8.6.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-shmsink.html b/docs/plugins/html/gst-plugins-bad-plugins-shmsink.html
index 9e4c748..3cf5440 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-shmsink.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-shmsink.html
@@ -122,7 +122,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.58.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.68.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -148,7 +148,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.58.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.68.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -245,7 +245,7 @@
 <p>
 </p>
 <div class="refsect3">
-<a name="id-1.2.58.12.2.5"></a><h4>Parameters</h4>
+<a name="id-1.2.68.12.2.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
@@ -278,7 +278,7 @@
 <p>
 </p>
 <div class="refsect3">
-<a name="id-1.2.58.12.3.5"></a><h4>Parameters</h4>
+<a name="id-1.2.68.12.3.5"></a><h4>Parameters</h4>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
 <col width="150px" class="parameters_name">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-shmsrc.html b/docs/plugins/html/gst-plugins-bad-plugins-shmsrc.html
index 5376aff..78a4cb7 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-shmsrc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-shmsrc.html
@@ -85,7 +85,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.59.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.69.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -111,7 +111,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.59.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.69.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-solarize.html b/docs/plugins/html/gst-plugins-bad-plugins-solarize.html
index b8cb61a..166e012 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-solarize.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-solarize.html
@@ -93,7 +93,7 @@
 <a name="gst-plugins-bad-plugins-solarize.description"></a><h2>Description</h2>
 <p>Solarize does a smart inverse in a video stream in realtime.</p>
 <div class="refsect2">
-<a name="id-1.2.61.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.71.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -109,7 +109,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.61.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.71.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -135,7 +135,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.61.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.71.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-spacescope.html b/docs/plugins/html/gst-plugins-bad-plugins-spacescope.html
index 17da940..14748a1 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-spacescope.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-spacescope.html
@@ -76,7 +76,7 @@
 <p>Spacescope is a simple audio visualisation element. It maps the left and
 right channel to x and y coordinates.</p>
 <div class="refsect2">
-<a name="id-1.2.62.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.72.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -92,7 +92,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.62.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.72.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -118,7 +118,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.62.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.72.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-spectrascope.html b/docs/plugins/html/gst-plugins-bad-plugins-spectrascope.html
index 1e52a99..b183c72 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-spectrascope.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-spectrascope.html
@@ -60,7 +60,7 @@
 <p>Spectrascope is a simple spectrum visualisation element. It renders the
 frequency spectrum as a series of bars.</p>
 <div class="refsect2">
-<a name="id-1.2.63.6.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.73.6.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -76,7 +76,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.63.6.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.73.6.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -102,7 +102,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.63.6.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.73.6.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-speed.html b/docs/plugins/html/gst-plugins-bad-plugins-speed.html
index 742ca19..0324835 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-speed.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-speed.html
@@ -78,7 +78,7 @@
 element (but relies on the decoder/demuxer to handle this correctly, also
 requires a fairly up-to-date gst-plugins-base, as of February 2007).</p>
 <div class="refsect2">
-<a name="id-1.2.65.7.4"></a><h3>Example launch line</h3>
+<a name="id-1.2.75.7.4"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -94,7 +94,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.65.7.5.1"></a><h3>Element Information</h3>
+<a name="id-1.2.75.7.5.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -120,7 +120,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.65.7.5.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.75.7.5.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-sphere.html b/docs/plugins/html/gst-plugins-bad-plugins-sphere.html
index 8d70a9d..728ac79 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-sphere.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-sphere.html
@@ -79,7 +79,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.66.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.76.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -105,7 +105,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.66.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.76.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-square.html b/docs/plugins/html/gst-plugins-bad-plugins-square.html
index c4e55cf..dc4a53f 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-square.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-square.html
@@ -90,7 +90,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.67.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.77.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -116,7 +116,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.67.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.77.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-stretch.html b/docs/plugins/html/gst-plugins-bad-plugins-stretch.html
index 4249413..da3a58b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-stretch.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-stretch.html
@@ -79,7 +79,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.68.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.78.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -105,7 +105,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.68.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.78.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-synaescope.html b/docs/plugins/html/gst-plugins-bad-plugins-synaescope.html
index 33fa7df..92a93f1 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-synaescope.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-synaescope.html
@@ -60,7 +60,7 @@
 <p>Synaescope is an audio visualisation element. It analyzes frequencies and
 out-of phase properties of audio and draws this as clouds of stars.</p>
 <div class="refsect2">
-<a name="id-1.2.64.6.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.74.6.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -76,7 +76,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.64.6.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.74.6.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -102,7 +102,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.64.6.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.74.6.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-templatematch.html b/docs/plugins/html/gst-plugins-bad-plugins-templatematch.html
index b1abe3b..eee35de 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-templatematch.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-templatematch.html
@@ -88,7 +88,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.69.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.79.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -114,7 +114,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.69.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.79.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-tunnel.html b/docs/plugins/html/gst-plugins-bad-plugins-tunnel.html
index 84fd316..169b056 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-tunnel.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-tunnel.html
@@ -63,7 +63,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.71.6.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.81.6.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -89,7 +89,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.71.6.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.81.6.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-twirl.html b/docs/plugins/html/gst-plugins-bad-plugins-twirl.html
index 7c85406..528de2f 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-twirl.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-twirl.html
@@ -79,7 +79,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.72.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.82.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -105,7 +105,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.72.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.82.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-videoparse.html b/docs/plugins/html/gst-plugins-bad-plugins-videoparse.html
index 706f1a7..7c0ee87 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-videoparse.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-videoparse.html
@@ -144,7 +144,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.73.7.2.1.1"></a><h3>Element Information</h3>
+<a name="id-1.2.83.7.2.1.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -170,7 +170,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.73.7.2.1.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.83.7.2.1.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-voaacenc.html b/docs/plugins/html/gst-plugins-bad-plugins-voaacenc.html
index f532206..17b51dc 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-voaacenc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-voaacenc.html
@@ -83,7 +83,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.76.8.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.86.8.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -109,7 +109,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.76.8.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.86.8.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-voamrwbenc.html b/docs/plugins/html/gst-plugins-bad-plugins-voamrwbenc.html
index dd207b8..1242645 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-voamrwbenc.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-voamrwbenc.html
@@ -36,7 +36,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.77.3.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.87.3.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -62,7 +62,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.77.3.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.87.3.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-waterripple.html b/docs/plugins/html/gst-plugins-bad-plugins-waterripple.html
index 3c9621a..3382f96 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-waterripple.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-waterripple.html
@@ -91,7 +91,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.74.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.84.7.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -117,7 +117,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.74.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.84.7.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-wavescope.html b/docs/plugins/html/gst-plugins-bad-plugins-wavescope.html
index 1408ed4..bedb2e6 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-wavescope.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-wavescope.html
@@ -76,7 +76,7 @@
 <p>Wavescope is a simple audio visualisation element. It renders the waveforms
 like on an oscilloscope.</p>
 <div class="refsect2">
-<a name="id-1.2.78.7.3"></a><h3>Example launch line</h3>
+<a name="id-1.2.88.7.3"></a><h3>Example launch line</h3>
 <div class="informalexample">
   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
     <tbody>
@@ -92,7 +92,7 @@
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.78.7.4.1"></a><h3>Element Information</h3>
+<a name="id-1.2.88.7.4.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -118,7 +118,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.78.7.4.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.88.7.4.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
diff --git a/docs/plugins/html/gst-plugins-bad-plugins-zbar.html b/docs/plugins/html/gst-plugins-bad-plugins-zbar.html
index 0bcb51f..b404b4b 100644
--- a/docs/plugins/html/gst-plugins-bad-plugins-zbar.html
+++ b/docs/plugins/html/gst-plugins-bad-plugins-zbar.html
@@ -15,8 +15,7 @@
 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
 <td width="100%" align="left" class="shortcuts">
 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-plugins-zbar.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
-                  <a href="#gst-plugins-bad-plugins-zbar.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
+                  <a href="#gst-plugins-bad-plugins-zbar.description" class="shortcut">Description</a></span><span id="nav_properties">  <span class="dim">|</span> 
                   <a href="#gst-plugins-bad-plugins-zbar.properties" class="shortcut">Properties</a></span>
 </td>
 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
@@ -55,7 +54,7 @@
 </tbody>
 </table></div>
 </div>
-<a name="GstZBar"></a><div class="refsect1">
+<div class="refsect1">
 <a name="gst-plugins-bad-plugins-zbar.other"></a><h2>Types and Values</h2>
 <div class="informaltable"><table width="100%" border="0">
 <colgroup>
@@ -64,27 +63,16 @@
 </colgroup>
 <tbody><tr>
 <td class="datatype_keyword">struct</td>
-<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-zbar.html#GstZBar-struct" title="struct GstZBar">GstZBar</a></td>
+<td class="function_name"><a class="link" href="gst-plugins-bad-plugins-zbar.html#GstZBar" title="struct GstZBar">GstZBar</a></td>
 </tr></tbody>
 </table></div>
 </div>
 <div class="refsect1">
-<a name="gst-plugins-bad-plugins-zbar.object-hierarchy"></a><h2>Object Hierarchy</h2>
-<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
-    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
-        <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
-            <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
-                <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html">GstBaseTransform</a>
-                    <span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideofilter.html#GstVideoFilter">GstVideoFilter</a>
-                        <span class="lineart">╰──</span> GstZBar
-</pre>
-</div>
-<div class="refsect1">
 <a name="gst-plugins-bad-plugins-zbar.description"></a><h2>Description</h2>
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
 <div class="refsect2">
-<a name="id-1.2.75.7.2.1"></a><h3>Element Information</h3>
+<a name="id-1.2.85.5.2.1"></a><h3>Element Information</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -110,7 +98,7 @@
 </div>
 <hr>
 <div class="refsect2">
-<a name="id-1.2.75.7.2.2"></a><h3>Element Pads</h3>
+<a name="id-1.2.85.5.2.2"></a><h3>Element Pads</h3>
 <div class="variablelist"><table border="0" class="variablelist">
 <colgroup>
 <col align="left" valign="top">
@@ -170,8 +158,10 @@
 <div class="refsect1">
 <a name="gst-plugins-bad-plugins-zbar.other_details"></a><h2>Types and Values</h2>
 <div class="refsect2">
-<a name="GstZBar-struct"></a><h3>struct GstZBar</h3>
-<pre class="programlisting">struct GstZBar;</pre>
+<a name="GstZBar"></a><h3>struct GstZBar</h3>
+<pre class="programlisting">struct GstZBar {
+};
+</pre>
 <p>
 </p>
 </div>
diff --git a/docs/plugins/html/index.html b/docs/plugins/html/index.html
index 611d01b..c232ee4 100644
--- a/docs/plugins/html/index.html
+++ b/docs/plugins/html/index.html
@@ -15,7 +15,7 @@
 <div>
 <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">GStreamer Bad Plugins 1.0 Plugins Reference Manual</p></th></tr></table></div>
 <div><p class="releaseinfo">
-      for GStreamer Bad Plugins 1.0 (1.4.5)
+      for GStreamer Bad Plugins 1.0 (1.5.0.1)
       The latest version of this documentation can be found on-line at
       <a class="ulink" href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/" target="_top">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/</a>.
     </p></div>
@@ -29,12 +29,24 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-accurip.html">accurip</a></span><span class="refpurpose"> — Computes an AccurateRip CRC</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-aiffparse.html">aiffparse</a></span><span class="refpurpose"> — Parse a .aiff file into raw audio</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-aiffmux.html">aiffmux</a></span><span class="refpurpose"> — Multiplex raw audio into AIFF</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-assrender.html">assrender</a></span><span class="refpurpose"> — Renders ASS/SSA subtitles with libass</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-audiomixer.html">audiomixer</a></span><span class="refpurpose"> — Mixes multiple audio streams</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-autoconvert.html">autoconvert</a></span><span class="refpurpose"> — Selects the right transform element based on the caps</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-bs2b.html">bs2b</a></span><span class="refpurpose"> — Improve headphone listening of stereo audio records using the bs2b library.</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-bulge.html">bulge</a></span><span class="refpurpose"> — Adds a protuberance in the center point</span>
 </dt>
 <dt>
@@ -53,7 +65,7 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-coloreffects.html">coloreffects</a></span><span class="refpurpose"> — Color Look-up Table filter</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-plugins-compositor.html">compositor</a></span><span class="refpurpose"> — Composite multiple video streams</span>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-compositor.html">compositor</a></span><span class="refpurpose"></span>
 </dt>
 <dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-cvdilate.html">cvdilate</a></span><span class="refpurpose"> — Applies cvDilate OpenCV function to the image</span>
@@ -104,9 +116,6 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-edgedetect.html">edgedetect</a></span><span class="refpurpose"> — Performs canny edge detection on videos and images.</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-plugins-eglglessink.html">eglglessink</a></span><span class="refpurpose"> — An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</span>
-</dt>
-<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-faac.html">faac</a></span><span class="refpurpose"> — Free MPEG-2/4 AAC encoder</span>
 </dt>
 <dt>
@@ -158,6 +167,12 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-mpeg2enc.html">mpeg2enc</a></span><span class="refpurpose"> — High-quality MPEG-1/2 video encoder</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-mpegpsmux.html">mpegpsmux</a></span><span class="refpurpose"> — Multiplexes media streams into an MPEG Program Stream</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-mpegtsmux.html">mpegtsmux</a></span><span class="refpurpose"> — Multiplexes media streams into an MPEG Transport Stream</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-mplex.html">mplex</a></span><span class="refpurpose"> — High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer</span>
 </dt>
 <dt>
@@ -176,6 +191,21 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-openalsink.html">openalsink</a></span><span class="refpurpose"> — Output audio through OpenAL</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-opusdec.html">opusdec</a></span><span class="refpurpose"> — decode opus streams to audio</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-opusenc.html">opusenc</a></span><span class="refpurpose"> — Encodes audio in Opus format</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-opusparse.html">opusparse</a></span><span class="refpurpose"> — parses opus audio streams</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-rtpopuspay.html">rtpopuspay</a></span><span class="refpurpose"> — Puts Opus audio in RTP packets</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-rtpopusdepay.html">rtpopusdepay</a></span><span class="refpurpose"> — Extracts Opus audio from RTP packets</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-pcapparse.html">pcapparse</a></span><span class="refpurpose"> — Parses a raw pcap stream</span>
 </dt>
 <dt>
@@ -260,6 +290,12 @@
 <dt><span class="chapter"><a href="ch02.html">gst-plugins-bad Plugins</a></span></dt>
 <dd><dl>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-aiff.html">aiff</a></span><span class="refpurpose">Create and parse Audio Interchange File Format (AIFF) files</span>
+</dt>
+<dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-audiomixer.html">audiomixer</a></span><span class="refpurpose">Mixes multiple audio streams</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-audiovisualizers.html">audiovisualizers</a></span><span class="refpurpose">Creates video visualizations of audio input</span>
 </dt>
 <dt>
@@ -272,6 +308,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-bayer.html">bayer</a></span><span class="refpurpose">Elements to convert Bayer images</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-bs2b.html">bs2b</a></span><span class="refpurpose">Improve headphone listening of stereo audio recordsusing the bs2b library.</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-bz2.html">bz2</a></span><span class="refpurpose">Compress or decompress streams</span>
 </dt>
 <dt>
@@ -299,9 +338,6 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-dvdspu.html">dvdspu</a></span><span class="refpurpose">DVD Sub-picture Overlay element</span>
 </dt>
 <dt>
-<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-eglglessink.html">eglglessink</a></span><span class="refpurpose">EGL/GLES sink</span>
-</dt>
-<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-faac.html">faac</a></span><span class="refpurpose">Free AAC Encoder (FAAC)</span>
 </dt>
 <dt>
@@ -338,6 +374,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-mpeg2enc.html">mpeg2enc</a></span><span class="refpurpose">High-quality MPEG-1/2 video encoder</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-mpegpsmux.html">mpegpsmux</a></span><span class="refpurpose">MPEG-PS muxer</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-mpegtsmux.html">mpegtsmux</a></span><span class="refpurpose">MPEG-TS muxer</span>
 </dt>
 <dt>
@@ -356,6 +395,9 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-opencv.html">opencv</a></span><span class="refpurpose">GStreamer OpenCV Plugins</span>
 </dt>
 <dt>
+<span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-opus.html">opus</a></span><span class="refpurpose">OPUS plugin library</span>
+</dt>
+<dt>
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-pcapparse.html">pcapparse</a></span><span class="refpurpose">Element parsing raw pcap streams</span>
 </dt>
 <dt>
@@ -389,10 +431,6 @@
 <span class="refentrytitle"><a href="gst-plugins-bad-plugins-plugin-zbar.html">zbar</a></span><span class="refpurpose">zbar barcode scanner</span>
 </dt>
 </dl></dd>
-<dt><span class="chapter"><a href="ch03.html">gst-plugins-bad Interfaces</a></span></dt>
-<dd><dl><dt>
-<span class="refentrytitle"><a href="GstPhotography.html">GstPhotography</a></span><span class="refpurpose"></span>
-</dt></dl></dd>
 </dl></div>
 </div>
 <div class="footer">
diff --git a/docs/plugins/html/index.sgml b/docs/plugins/html/index.sgml
index 97c5d29..c3fef1a 100644
--- a/docs/plugins/html/index.sgml
+++ b/docs/plugins/html/index.sgml
@@ -11,6 +11,22 @@
 <ANCHOR id="gst-plugins-bad-plugins-accurip.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-accurip.html#gst-plugins-bad-plugins-accurip.property-details">
 <ANCHOR id="GstAccurip--first-track" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-accurip.html#GstAccurip--first-track">
 <ANCHOR id="GstAccurip--last-track" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-accurip.html#GstAccurip--last-track">
+<ANCHOR id="gst-plugins-bad-plugins-aiffparse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html">
+<ANCHOR id="GstAiffParse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html#GstAiffParse">
+<ANCHOR id="gst-plugins-bad-plugins-aiffparse.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html#gst-plugins-bad-plugins-aiffparse.other">
+<ANCHOR id="gst-plugins-bad-plugins-aiffparse.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html#gst-plugins-bad-plugins-aiffparse.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-aiffparse.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html#gst-plugins-bad-plugins-aiffparse.description">
+<ANCHOR id="gst-plugins-bad-plugins-aiffparse.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html#gst-plugins-bad-plugins-aiffparse.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-aiffparse.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html#gst-plugins-bad-plugins-aiffparse.other_details">
+<ANCHOR id="GstAiffParse-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffparse.html#GstAiffParse-struct">
+<ANCHOR id="gst-plugins-bad-plugins-aiffmux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html">
+<ANCHOR id="GstAiffMux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html#GstAiffMux">
+<ANCHOR id="gst-plugins-bad-plugins-aiffmux.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html#gst-plugins-bad-plugins-aiffmux.other">
+<ANCHOR id="gst-plugins-bad-plugins-aiffmux.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html#gst-plugins-bad-plugins-aiffmux.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-aiffmux.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html#gst-plugins-bad-plugins-aiffmux.description">
+<ANCHOR id="gst-plugins-bad-plugins-aiffmux.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html#gst-plugins-bad-plugins-aiffmux.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-aiffmux.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html#gst-plugins-bad-plugins-aiffmux.other_details">
+<ANCHOR id="GstAiffMux-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-aiffmux.html#GstAiffMux-struct">
 <ANCHOR id="gst-plugins-bad-plugins-assrender" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-assrender.html">
 <ANCHOR id="gst-plugins-bad-plugins-assrender.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-assrender.html#gst-plugins-bad-plugins-assrender.properties">
 <ANCHOR id="GstAssRender" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-assrender.html#GstAssRender">
@@ -24,6 +40,22 @@
 <ANCHOR id="GstAssRender--embeddedfonts" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-assrender.html#GstAssRender--embeddedfonts">
 <ANCHOR id="GstAssRender--enable" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-assrender.html#GstAssRender--enable">
 <ANCHOR id="GstAssRender--wait-text" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-assrender.html#GstAssRender--wait-text">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.properties">
+<ANCHOR id="GstAudioMixer" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.other">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.implemented-interfaces" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.implemented-interfaces">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.description">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.other_details">
+<ANCHOR id="GstAudioMixer-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer-struct">
+<ANCHOR id="gst-plugins-bad-plugins-audiomixer.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#gst-plugins-bad-plugins-audiomixer.property-details">
+<ANCHOR id="GstAudioMixer--alignment-threshold" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--alignment-threshold">
+<ANCHOR id="GstAudioMixer--caps" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--caps">
+<ANCHOR id="GstAudioMixer--discont-wait" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--discont-wait">
+<ANCHOR id="GstAudioMixer--blocksize" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--blocksize">
+<ANCHOR id="GstAudioMixer--output-buffer-duration" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-audiomixer.html#GstAudioMixer--output-buffer-duration">
 <ANCHOR id="gst-plugins-bad-plugins-autoconvert" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-autoconvert.html">
 <ANCHOR id="gst-plugins-bad-plugins-autoconvert.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-autoconvert.html#gst-plugins-bad-plugins-autoconvert.properties">
 <ANCHOR id="GstAutoConvert" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-autoconvert.html#GstAutoConvert">
@@ -37,6 +69,12 @@
 <ANCHOR id="gst-plugins-bad-plugins-autoconvert.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-autoconvert.html#gst-plugins-bad-plugins-autoconvert.property-details">
 <ANCHOR id="GstAutoConvert--factories" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-autoconvert.html#GstAutoConvert--factories">
 <ANCHOR id="GstAutoConvert--initial-identity" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-autoconvert.html#GstAutoConvert--initial-identity">
+<ANCHOR id="gst-plugins-bad-plugins-bs2b" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bs2b.html">
+<ANCHOR id="gst-plugins-bad-plugins-bs2b.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bs2b.html#gst-plugins-bad-plugins-bs2b.other">
+<ANCHOR id="gst-plugins-bad-plugins-bs2b.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bs2b.html#gst-plugins-bad-plugins-bs2b.description">
+<ANCHOR id="gst-plugins-bad-plugins-bs2b.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bs2b.html#gst-plugins-bad-plugins-bs2b.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-bs2b.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bs2b.html#gst-plugins-bad-plugins-bs2b.other_details">
+<ANCHOR id="GstBs2b" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bs2b.html#GstBs2b">
 <ANCHOR id="gst-plugins-bad-plugins-bulge" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bulge.html">
 <ANCHOR id="gst-plugins-bad-plugins-bulge.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bulge.html#gst-plugins-bad-plugins-bulge.properties">
 <ANCHOR id="GstBulge" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-bulge.html#GstBulge">
@@ -67,12 +105,10 @@
 <ANCHOR id="gst-plugins-bad-plugins-chromium" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html">
 <ANCHOR id="gst-plugins-bad-plugins-chromium.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#gst-plugins-bad-plugins-chromium.properties">
 <ANCHOR id="GstChromium" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#GstChromium">
-<ANCHOR id="gst-plugins-bad-plugins-chromium.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#gst-plugins-bad-plugins-chromium.other">
 <ANCHOR id="gst-plugins-bad-plugins-chromium.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#gst-plugins-bad-plugins-chromium.object-hierarchy">
 <ANCHOR id="gst-plugins-bad-plugins-chromium.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#gst-plugins-bad-plugins-chromium.description">
 <ANCHOR id="gst-plugins-bad-plugins-chromium.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#gst-plugins-bad-plugins-chromium.functions_details">
 <ANCHOR id="gst-plugins-bad-plugins-chromium.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#gst-plugins-bad-plugins-chromium.other_details">
-<ANCHOR id="GstChromium" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#GstChromium">
 <ANCHOR id="gst-plugins-bad-plugins-chromium.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#gst-plugins-bad-plugins-chromium.property-details">
 <ANCHOR id="GstChromium--silent" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#GstChromium--silent">
 <ANCHOR id="GstChromium--edge-a" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-chromium.html#GstChromium--edge-a">
@@ -221,13 +257,11 @@
 <ANCHOR id="gst-plugins-bad-plugins-dodge.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dodge.html#gst-plugins-bad-plugins-dodge.property-details">
 <ANCHOR id="GstDodge--silent" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dodge.html#GstDodge--silent">
 <ANCHOR id="gst-plugins-bad-plugins-dtmfdetect" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html">
-<ANCHOR id="GstDtmfDetect" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#GstDtmfDetect">
 <ANCHOR id="gst-plugins-bad-plugins-dtmfdetect.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#gst-plugins-bad-plugins-dtmfdetect.other">
-<ANCHOR id="gst-plugins-bad-plugins-dtmfdetect.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#gst-plugins-bad-plugins-dtmfdetect.object-hierarchy">
 <ANCHOR id="gst-plugins-bad-plugins-dtmfdetect.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#gst-plugins-bad-plugins-dtmfdetect.description">
 <ANCHOR id="gst-plugins-bad-plugins-dtmfdetect.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#gst-plugins-bad-plugins-dtmfdetect.functions_details">
 <ANCHOR id="gst-plugins-bad-plugins-dtmfdetect.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#gst-plugins-bad-plugins-dtmfdetect.other_details">
-<ANCHOR id="GstDtmfDetect-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#GstDtmfDetect-struct">
+<ANCHOR id="GstDtmfDetect" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtmfdetect.html#GstDtmfDetect">
 <ANCHOR id="gst-plugins-bad-plugins-dtsdec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtsdec.html">
 <ANCHOR id="gst-plugins-bad-plugins-dtsdec.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtsdec.html#gst-plugins-bad-plugins-dtsdec.properties">
 <ANCHOR id="GstDtsDec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dtsdec.html#GstDtsDec">
@@ -280,10 +314,33 @@
 <ANCHOR id="GstDvbSrc--rolloff" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--rolloff">
 <ANCHOR id="GstDvbSrc--stream-id" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--stream-id">
 <ANCHOR id="GstDvbSrc--tuning-timeout" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--tuning-timeout">
+<ANCHOR id="GstDvbSrc--isdbt-layer-enabled" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layer-enabled">
+<ANCHOR id="GstDvbSrc--isdbt-layera-fec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-fec">
+<ANCHOR id="GstDvbSrc--isdbt-layera-modulation" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-modulation">
+<ANCHOR id="GstDvbSrc--isdbt-layera-segment-count" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-segment-count">
+<ANCHOR id="GstDvbSrc--isdbt-layera-time-interleaving" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layera-time-interleaving">
+<ANCHOR id="GstDvbSrc--isdbt-layerb-fec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-fec">
+<ANCHOR id="GstDvbSrc--isdbt-layerb-modulation" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-modulation">
+<ANCHOR id="GstDvbSrc--isdbt-layerb-segment-count" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-segment-count">
+<ANCHOR id="GstDvbSrc--isdbt-layerb-time-interleaving" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerb-time-interleaving">
+<ANCHOR id="GstDvbSrc--isdbt-layerc-fec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-fec">
+<ANCHOR id="GstDvbSrc--isdbt-layerc-modulation" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-modulation">
+<ANCHOR id="GstDvbSrc--isdbt-layerc-segment-count" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-segment-count">
+<ANCHOR id="GstDvbSrc--isdbt-layerc-time-interleaving" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-layerc-time-interleaving">
+<ANCHOR id="GstDvbSrc--isdbt-partial-reception" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-partial-reception">
+<ANCHOR id="GstDvbSrc--isdbt-sb-segment-count" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-segment-count">
+<ANCHOR id="GstDvbSrc--isdbt-sb-segment-idx" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-segment-idx">
+<ANCHOR id="GstDvbSrc--isdbt-sb-subchannel-id" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sb-subchannel-id">
+<ANCHOR id="GstDvbSrc--isdbt-sound-broadcasting" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--isdbt-sound-broadcasting">
+<ANCHOR id="GstDvbSrc--lnb-lof1" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-lof1">
+<ANCHOR id="GstDvbSrc--lnb-lof2" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-lof2">
+<ANCHOR id="GstDvbSrc--lnb-slof" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--lnb-slof">
+<ANCHOR id="GstDvbSrc--interleaving" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc--interleaving">
 <ANCHOR id="gst-plugins-bad-plugins-dvbsrc.signal-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#gst-plugins-bad-plugins-dvbsrc.signal-details">
 <ANCHOR id="GstDvbSrc-tuning-done" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tuning-done">
 <ANCHOR id="GstDvbSrc-tuning-fail" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tuning-fail">
 <ANCHOR id="GstDvbSrc-tuning-start" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tuning-start">
+<ANCHOR id="GstDvbSrc-tune" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvbsrc.html#GstDvbSrc-tune">
 <ANCHOR id="gst-plugins-bad-plugins-dvdspu" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvdspu.html">
 <ANCHOR id="GstDVDSpu" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvdspu.html#GstDVDSpu">
 <ANCHOR id="gst-plugins-bad-plugins-dvdspu.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-dvdspu.html#gst-plugins-bad-plugins-dvdspu.other">
@@ -308,18 +365,16 @@
 <ANCHOR id="gst-plugins-bad-plugins-edgedetect.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-edgedetect.html#gst-plugins-bad-plugins-edgedetect.description">
 <ANCHOR id="gst-plugins-bad-plugins-edgedetect.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-edgedetect.html#gst-plugins-bad-plugins-edgedetect.functions_details">
 <ANCHOR id="gst-plugins-bad-plugins-edgedetect.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-edgedetect.html#gst-plugins-bad-plugins-edgedetect.other_details">
-<ANCHOR id="gst-plugins-bad-plugins-eglglessink" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-eglglessink.html">
-<ANCHOR id="gst-plugins-bad-plugins-eglglessink.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-eglglessink.html#gst-plugins-bad-plugins-eglglessink.description">
-<ANCHOR id="gst-plugins-bad-plugins-eglglessink.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-eglglessink.html#gst-plugins-bad-plugins-eglglessink.functions_details">
-<ANCHOR id="gst-plugins-bad-plugins-eglglessink.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-eglglessink.html#gst-plugins-bad-plugins-eglglessink.other_details">
 <ANCHOR id="gst-plugins-bad-plugins-faac" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html">
 <ANCHOR id="gst-plugins-bad-plugins-faac.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.properties">
+<ANCHOR id="GstFaac" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#GstFaac">
 <ANCHOR id="gst-plugins-bad-plugins-faac.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.other">
+<ANCHOR id="gst-plugins-bad-plugins-faac.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.object-hierarchy">
 <ANCHOR id="gst-plugins-bad-plugins-faac.implemented-interfaces" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.implemented-interfaces">
 <ANCHOR id="gst-plugins-bad-plugins-faac.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.description">
 <ANCHOR id="gst-plugins-bad-plugins-faac.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.functions_details">
 <ANCHOR id="gst-plugins-bad-plugins-faac.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.other_details">
-<ANCHOR id="GstFaac" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#GstFaac">
+<ANCHOR id="GstFaac-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#GstFaac-struct">
 <ANCHOR id="gst-plugins-bad-plugins-faac.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#gst-plugins-bad-plugins-faac.property-details">
 <ANCHOR id="GstFaac--bitrate" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#GstFaac--bitrate">
 <ANCHOR id="GstFaac--midside" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-faac.html#GstFaac--midside">
@@ -542,6 +597,29 @@
 <ANCHOR id="GstMpeg2enc--sequence-length" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--sequence-length">
 <ANCHOR id="GstMpeg2enc--unit-coeff-elim" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--unit-coeff-elim">
 <ANCHOR id="GstMpeg2enc--vcd-still-size" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpeg2enc.html#GstMpeg2enc--vcd-still-size">
+<ANCHOR id="gst-plugins-bad-plugins-mpegpsmux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html">
+<ANCHOR id="gst-plugins-bad-plugins-mpegpsmux.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#gst-plugins-bad-plugins-mpegpsmux.properties">
+<ANCHOR id="MpegPsMux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#MpegPsMux">
+<ANCHOR id="gst-plugins-bad-plugins-mpegpsmux.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#gst-plugins-bad-plugins-mpegpsmux.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-mpegpsmux.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#gst-plugins-bad-plugins-mpegpsmux.description">
+<ANCHOR id="gst-plugins-bad-plugins-mpegpsmux.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#gst-plugins-bad-plugins-mpegpsmux.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-mpegpsmux.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#gst-plugins-bad-plugins-mpegpsmux.other_details">
+<ANCHOR id="gst-plugins-bad-plugins-mpegpsmux.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#gst-plugins-bad-plugins-mpegpsmux.property-details">
+<ANCHOR id="MpegPsMux--aggregate-gops" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegpsmux.html#MpegPsMux--aggregate-gops">
+<ANCHOR id="gst-plugins-bad-plugins-mpegtsmux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html">
+<ANCHOR id="gst-plugins-bad-plugins-mpegtsmux.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#gst-plugins-bad-plugins-mpegtsmux.properties">
+<ANCHOR id="MpegTsMux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux">
+<ANCHOR id="gst-plugins-bad-plugins-mpegtsmux.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#gst-plugins-bad-plugins-mpegtsmux.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-mpegtsmux.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#gst-plugins-bad-plugins-mpegtsmux.description">
+<ANCHOR id="gst-plugins-bad-plugins-mpegtsmux.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#gst-plugins-bad-plugins-mpegtsmux.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-mpegtsmux.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#gst-plugins-bad-plugins-mpegtsmux.other_details">
+<ANCHOR id="gst-plugins-bad-plugins-mpegtsmux.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#gst-plugins-bad-plugins-mpegtsmux.property-details">
+<ANCHOR id="MpegTsMux--m2ts-mode" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--m2ts-mode">
+<ANCHOR id="MpegTsMux--prog-map" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--prog-map">
+<ANCHOR id="MpegTsMux--pat-interval" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--pat-interval">
+<ANCHOR id="MpegTsMux--pmt-interval" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--pmt-interval">
+<ANCHOR id="MpegTsMux--alignment" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--alignment">
+<ANCHOR id="MpegTsMux--si-interval" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpegtsmux.html#MpegTsMux--si-interval">
 <ANCHOR id="gst-plugins-bad-plugins-mplex" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mplex.html">
 <ANCHOR id="gst-plugins-bad-plugins-mplex.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mplex.html#gst-plugins-bad-plugins-mplex.properties">
 <ANCHOR id="GstMplex" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mplex.html#GstMplex">
@@ -569,12 +647,14 @@
 <ANCHOR id="GstMpg123AudioDec-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-mpg123audiodec.html#GstMpg123AudioDec-struct">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.properties">
+<ANCHOR id="GstNeonhttpSrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.other">
+<ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.object-hierarchy">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.implemented-interfaces" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.implemented-interfaces">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.description">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.functions_details">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.other_details">
-<ANCHOR id="GstNeonhttpSrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc">
+<ANCHOR id="GstNeonhttpSrc-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc-struct">
 <ANCHOR id="gst-plugins-bad-plugins-neonhttpsrc.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#gst-plugins-bad-plugins-neonhttpsrc.property-details">
 <ANCHOR id="GstNeonhttpSrc--location" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--location">
 <ANCHOR id="GstNeonhttpSrc--proxy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-neonhttpsrc.html#GstNeonhttpSrc--proxy">
@@ -617,6 +697,85 @@
 <ANCHOR id="gst-plugins-bad-plugins-openalsink.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-openalsink.html#gst-plugins-bad-plugins-openalsink.description">
 <ANCHOR id="gst-plugins-bad-plugins-openalsink.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-openalsink.html#gst-plugins-bad-plugins-openalsink.functions_details">
 <ANCHOR id="gst-plugins-bad-plugins-openalsink.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-openalsink.html#gst-plugins-bad-plugins-openalsink.other_details">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#gst-plugins-bad-plugins-opusdec.properties">
+<ANCHOR id="GstOpenalSrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#GstOpenalSrc">
+<ANCHOR id="GstOpencvTextOverlay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#GstOpencvTextOverlay">
+<ANCHOR id="GstOpusDec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#GstOpusDec">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#gst-plugins-bad-plugins-opusdec.other">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#gst-plugins-bad-plugins-opusdec.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#gst-plugins-bad-plugins-opusdec.description">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#gst-plugins-bad-plugins-opusdec.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#gst-plugins-bad-plugins-opusdec.other_details">
+<ANCHOR id="GstOpusDec-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#GstOpusDec-struct">
+<ANCHOR id="gst-plugins-bad-plugins-opusdec.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#gst-plugins-bad-plugins-opusdec.property-details">
+<ANCHOR id="GstOpusDec--apply-gain" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#GstOpusDec--apply-gain">
+<ANCHOR id="GstOpusDec--use-inband-fec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusdec.html#GstOpusDec--use-inband-fec">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#gst-plugins-bad-plugins-opusenc.properties">
+<ANCHOR id="GstOpenalSrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpenalSrc">
+<ANCHOR id="GstOpencvTextOverlay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpencvTextOverlay">
+<ANCHOR id="GstOpusDec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusDec">
+<ANCHOR id="GstOpusEnc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#gst-plugins-bad-plugins-opusenc.other">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#gst-plugins-bad-plugins-opusenc.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#gst-plugins-bad-plugins-opusenc.description">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#gst-plugins-bad-plugins-opusenc.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#gst-plugins-bad-plugins-opusenc.other_details">
+<ANCHOR id="GstOpusEnc-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc-struct">
+<ANCHOR id="gst-plugins-bad-plugins-opusenc.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#gst-plugins-bad-plugins-opusenc.property-details">
+<ANCHOR id="GstOpusEnc--audio" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--audio">
+<ANCHOR id="GstOpusEnc--bandwidth" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bandwidth">
+<ANCHOR id="GstOpusEnc--bitrate" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bitrate">
+<ANCHOR id="GstOpusEnc--cbr" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--cbr">
+<ANCHOR id="GstOpusEnc--complexity" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--complexity">
+<ANCHOR id="GstOpusEnc--constrained-vbr" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--constrained-vbr">
+<ANCHOR id="GstOpusEnc--dtx" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--dtx">
+<ANCHOR id="GstOpusEnc--frame-size" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--frame-size">
+<ANCHOR id="GstOpusEnc--inband-fec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--inband-fec">
+<ANCHOR id="GstOpusEnc--max-payload-size" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--max-payload-size">
+<ANCHOR id="GstOpusEnc--packet-loss-percentage" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--packet-loss-percentage">
+<ANCHOR id="GstOpusEnc--audio-type" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--audio-type">
+<ANCHOR id="GstOpusEnc--bitrate-type" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusenc.html#GstOpusEnc--bitrate-type">
+<ANCHOR id="gst-plugins-bad-plugins-opusparse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html">
+<ANCHOR id="GstOpenalSrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#GstOpenalSrc">
+<ANCHOR id="GstOpencvTextOverlay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#GstOpencvTextOverlay">
+<ANCHOR id="GstOpusDec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#GstOpusDec">
+<ANCHOR id="GstOpusEnc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#GstOpusEnc">
+<ANCHOR id="GstOpusParse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#GstOpusParse">
+<ANCHOR id="gst-plugins-bad-plugins-opusparse.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#gst-plugins-bad-plugins-opusparse.other">
+<ANCHOR id="gst-plugins-bad-plugins-opusparse.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#gst-plugins-bad-plugins-opusparse.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-opusparse.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#gst-plugins-bad-plugins-opusparse.description">
+<ANCHOR id="gst-plugins-bad-plugins-opusparse.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#gst-plugins-bad-plugins-opusparse.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-opusparse.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#gst-plugins-bad-plugins-opusparse.other_details">
+<ANCHOR id="GstOpusParse-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-opusparse.html#GstOpusParse-struct">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopuspay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html">
+<ANCHOR id="GstOpenalSrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstOpenalSrc">
+<ANCHOR id="GstOpencvTextOverlay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstOpencvTextOverlay">
+<ANCHOR id="GstOpusDec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstOpusDec">
+<ANCHOR id="GstOpusEnc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstOpusEnc">
+<ANCHOR id="GstOpusParse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstOpusParse">
+<ANCHOR id="GstRTPOpusDepay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstRTPOpusDepay">
+<ANCHOR id="GstRtpOPUSPay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstRtpOPUSPay">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopuspay.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#gst-plugins-bad-plugins-rtpopuspay.other">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopuspay.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#gst-plugins-bad-plugins-rtpopuspay.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopuspay.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#gst-plugins-bad-plugins-rtpopuspay.description">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopuspay.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#gst-plugins-bad-plugins-rtpopuspay.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopuspay.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#gst-plugins-bad-plugins-rtpopuspay.other_details">
+<ANCHOR id="GstRtpOPUSPay-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopuspay.html#GstRtpOPUSPay-struct">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopusdepay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html">
+<ANCHOR id="GstOpenalSrc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#GstOpenalSrc">
+<ANCHOR id="GstOpencvTextOverlay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#GstOpencvTextOverlay">
+<ANCHOR id="GstOpusDec" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#GstOpusDec">
+<ANCHOR id="GstOpusEnc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#GstOpusEnc">
+<ANCHOR id="GstOpusParse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#GstOpusParse">
+<ANCHOR id="GstRTPOpusDepay" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#GstRTPOpusDepay">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopusdepay.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#gst-plugins-bad-plugins-rtpopusdepay.other">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopusdepay.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#gst-plugins-bad-plugins-rtpopusdepay.object-hierarchy">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopusdepay.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#gst-plugins-bad-plugins-rtpopusdepay.description">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopusdepay.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#gst-plugins-bad-plugins-rtpopusdepay.functions_details">
+<ANCHOR id="gst-plugins-bad-plugins-rtpopusdepay.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#gst-plugins-bad-plugins-rtpopusdepay.other_details">
+<ANCHOR id="GstRTPOpusDepay-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-rtpopusdepay.html#GstRTPOpusDepay-struct">
 <ANCHOR id="gst-plugins-bad-plugins-pcapparse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-pcapparse.html">
 <ANCHOR id="gst-plugins-bad-plugins-pcapparse.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-pcapparse.html#gst-plugins-bad-plugins-pcapparse.properties">
 <ANCHOR id="GstPcapParse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-pcapparse.html#GstPcapParse">
@@ -923,13 +1082,11 @@
 <ANCHOR id="GstWaterRipple--wavelength" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-waterripple.html#GstWaterRipple--wavelength">
 <ANCHOR id="gst-plugins-bad-plugins-zbar" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html">
 <ANCHOR id="gst-plugins-bad-plugins-zbar.properties" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#gst-plugins-bad-plugins-zbar.properties">
-<ANCHOR id="GstZBar" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#GstZBar">
 <ANCHOR id="gst-plugins-bad-plugins-zbar.other" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#gst-plugins-bad-plugins-zbar.other">
-<ANCHOR id="gst-plugins-bad-plugins-zbar.object-hierarchy" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#gst-plugins-bad-plugins-zbar.object-hierarchy">
 <ANCHOR id="gst-plugins-bad-plugins-zbar.description" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#gst-plugins-bad-plugins-zbar.description">
 <ANCHOR id="gst-plugins-bad-plugins-zbar.functions_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#gst-plugins-bad-plugins-zbar.functions_details">
 <ANCHOR id="gst-plugins-bad-plugins-zbar.other_details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#gst-plugins-bad-plugins-zbar.other_details">
-<ANCHOR id="GstZBar-struct" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#GstZBar-struct">
+<ANCHOR id="GstZBar" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#GstZBar">
 <ANCHOR id="gst-plugins-bad-plugins-zbar.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#gst-plugins-bad-plugins-zbar.property-details">
 <ANCHOR id="GstZBar--message" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#GstZBar--message">
 <ANCHOR id="GstZBar--cache" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-zbar.html#GstZBar--cache">
@@ -961,6 +1118,10 @@
 <ANCHOR id="gst-plugins-bad-plugins-wavescope.property-details" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-wavescope.html#gst-plugins-bad-plugins-wavescope.property-details">
 <ANCHOR id="GstWaveScope--style" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-wavescope.html#GstWaveScope--style">
 <ANCHOR id="gst-plugins-bad-plugins-wavescope.see-also" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-wavescope.html#gst-plugins-bad-plugins-wavescope.see-also">
+<ANCHOR id="gst-plugins-bad-plugins-plugin-aiff" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-aiff.html">
+<ANCHOR id="plugin-aiff" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-aiff.html#plugin-aiff">
+<ANCHOR id="gst-plugins-bad-plugins-plugin-audiomixer" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-audiomixer.html">
+<ANCHOR id="plugin-audiomixer" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-audiomixer.html#plugin-audiomixer">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-audiovisualizers" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-audiovisualizers.html">
 <ANCHOR id="plugin-audiovisualizers" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-audiovisualizers.html#plugin-audiovisualizers">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-autoconvert" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-autoconvert.html">
@@ -969,6 +1130,8 @@
 <ANCHOR id="plugin-assrender" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-assrender.html#plugin-assrender">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-bayer" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-bayer.html">
 <ANCHOR id="plugin-bayer" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-bayer.html#plugin-bayer">
+<ANCHOR id="gst-plugins-bad-plugins-plugin-bs2b" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-bs2b.html">
+<ANCHOR id="plugin-bs2b" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-bs2b.html#plugin-bs2b">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-bz2" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-bz2.html">
 <ANCHOR id="plugin-bz2" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-bz2.html#plugin-bz2">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-camerabin" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-camerabin.html">
@@ -987,8 +1150,6 @@
 <ANCHOR id="plugin-dvb" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-dvb.html#plugin-dvb">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-dvdspu" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-dvdspu.html">
 <ANCHOR id="plugin-dvdspu" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-dvdspu.html#plugin-dvdspu">
-<ANCHOR id="gst-plugins-bad-plugins-plugin-eglglessink" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-eglglessink.html">
-<ANCHOR id="plugin-eglglessink" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-eglglessink.html#plugin-eglglessink">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-faac" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-faac.html">
 <ANCHOR id="plugin-faac" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-faac.html#plugin-faac">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-faad" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-faad.html">
@@ -1013,6 +1174,8 @@
 <ANCHOR id="plugin-modplug" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-modplug.html#plugin-modplug">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-mpeg2enc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-mpeg2enc.html">
 <ANCHOR id="plugin-mpeg2enc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-mpeg2enc.html#plugin-mpeg2enc">
+<ANCHOR id="gst-plugins-bad-plugins-plugin-mpegpsmux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-mpegpsmux.html">
+<ANCHOR id="plugin-mpegpsmux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-mpegpsmux.html#plugin-mpegpsmux">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-mpegtsmux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-mpegtsmux.html">
 <ANCHOR id="plugin-mpegtsmux" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-mpegtsmux.html#plugin-mpegtsmux">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-mplex" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-mplex.html">
@@ -1025,6 +1188,8 @@
 <ANCHOR id="plugin-openal" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-openal.html#plugin-openal">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-opencv" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-opencv.html">
 <ANCHOR id="plugin-opencv" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-opencv.html#plugin-opencv">
+<ANCHOR id="gst-plugins-bad-plugins-plugin-opus" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-opus.html">
+<ANCHOR id="plugin-opus" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-opus.html#plugin-opus">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-pcapparse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-pcapparse.html">
 <ANCHOR id="plugin-pcapparse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-pcapparse.html#plugin-pcapparse">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-rawparse" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-rawparse.html">
@@ -1047,75 +1212,3 @@
 <ANCHOR id="plugin-voamrwbenc" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-voamrwbenc.html#plugin-voamrwbenc">
 <ANCHOR id="gst-plugins-bad-plugins-plugin-zbar" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-zbar.html">
 <ANCHOR id="plugin-zbar" href="gst-plugins-bad-plugins-1.0/gst-plugins-bad-plugins-plugin-zbar.html#plugin-zbar">
-<ANCHOR id="GstPhotography" href="gst-plugins-bad-plugins-1.0/GstPhotography.html">
-<ANCHOR id="GstPhotography.functions" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.functions">
-<ANCHOR id="GstPhotography.properties" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.properties">
-<ANCHOR id="GstPhotography.other" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.other">
-<ANCHOR id="GstPhotography.object-hierarchy" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.object-hierarchy">
-<ANCHOR id="GstPhotography.prerequisites" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.prerequisites">
-<ANCHOR id="GstPhotography.description" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.description">
-<ANCHOR id="GstPhotography.functions_details" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.functions_details">
-<ANCHOR id="GstPhotographyCapturePrepared" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyCapturePrepared">
-<ANCHOR id="gst-photography-get-ev-compensation" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-ev-compensation">
-<ANCHOR id="gst-photography-get-iso-speed" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-iso-speed">
-<ANCHOR id="gst-photography-get-aperture" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-aperture">
-<ANCHOR id="gst-photography-get-exposure" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-exposure">
-<ANCHOR id="gst-photography-get-white-balance-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-white-balance-mode">
-<ANCHOR id="gst-photography-get-color-tone-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-color-tone-mode">
-<ANCHOR id="gst-photography-get-scene-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-scene-mode">
-<ANCHOR id="gst-photography-get-flash-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-flash-mode">
-<ANCHOR id="gst-photography-get-noise-reduction" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-noise-reduction">
-<ANCHOR id="gst-photography-get-zoom" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-zoom">
-<ANCHOR id="gst-photography-set-ev-compensation" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-ev-compensation">
-<ANCHOR id="gst-photography-set-iso-speed" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-iso-speed">
-<ANCHOR id="gst-photography-set-aperture" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-aperture">
-<ANCHOR id="gst-photography-set-exposure" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-exposure">
-<ANCHOR id="gst-photography-set-white-balance-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-white-balance-mode">
-<ANCHOR id="gst-photography-set-color-tone-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-color-tone-mode">
-<ANCHOR id="gst-photography-set-scene-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-scene-mode">
-<ANCHOR id="gst-photography-set-flash-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-flash-mode">
-<ANCHOR id="gst-photography-set-noise-reduction" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-noise-reduction">
-<ANCHOR id="gst-photography-set-zoom" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-zoom">
-<ANCHOR id="gst-photography-get-capabilities" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-capabilities">
-<ANCHOR id="gst-photography-prepare-for-capture" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-prepare-for-capture">
-<ANCHOR id="gst-photography-set-autofocus" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-autofocus">
-<ANCHOR id="gst-photography-set-config" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-set-config">
-<ANCHOR id="gst-photography-get-config" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#gst-photography-get-config">
-<ANCHOR id="GstPhotography.other_details" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.other_details">
-<ANCHOR id="GstPhotography-struct" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography-struct">
-<ANCHOR id="GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GST-PHOTOGRAPHY-AUTOFOCUS-DONE:CAPS">
-<ANCHOR id="GST-PHOTOGRAPHY-SHAKE-RISK:CAPS" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GST-PHOTOGRAPHY-SHAKE-RISK:CAPS">
-<ANCHOR id="GstPhotographyNoiseReduction" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyNoiseReduction">
-<ANCHOR id="GstPhotographyWhiteBalanceMode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyWhiteBalanceMode">
-<ANCHOR id="GstPhotographyColorToneMode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyColorToneMode">
-<ANCHOR id="GstPhotographySceneMode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographySceneMode">
-<ANCHOR id="GstPhotographyFlashMode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyFlashMode">
-<ANCHOR id="GstPhotographyFlickerReductionMode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyFlickerReductionMode">
-<ANCHOR id="GstPhotographyFocusMode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyFocusMode">
-<ANCHOR id="GstPhotographyFocusStatus" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyFocusStatus">
-<ANCHOR id="GstPhotographyCaps" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyCaps">
-<ANCHOR id="GstPhotographyShakeRisk" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotographyShakeRisk">
-<ANCHOR id="GstPhotography.property-details" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography.property-details">
-<ANCHOR id="GstPhotography--aperture" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--aperture">
-<ANCHOR id="GstPhotography--capabilities" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--capabilities">
-<ANCHOR id="GstPhotography--colour-tone-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--colour-tone-mode">
-<ANCHOR id="GstPhotography--ev-compensation" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--ev-compensation">
-<ANCHOR id="GstPhotography--exposure" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--exposure">
-<ANCHOR id="GstPhotography--flash-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--flash-mode">
-<ANCHOR id="GstPhotography--flicker-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--flicker-mode">
-<ANCHOR id="GstPhotography--focus-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--focus-mode">
-<ANCHOR id="GstPhotography--image-capture-supported-caps" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--image-capture-supported-caps">
-<ANCHOR id="GstPhotography--iso-speed" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--iso-speed">
-<ANCHOR id="GstPhotography--scene-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--scene-mode">
-<ANCHOR id="GstPhotography--white-balance-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--white-balance-mode">
-<ANCHOR id="GstPhotography--image-preview-supported-caps" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--image-preview-supported-caps">
-<ANCHOR id="GstPhotography--noise-reduction" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--noise-reduction">
-<ANCHOR id="GstPhotography--zoom" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--zoom">
-<ANCHOR id="GstPhotography--analog-gain" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--analog-gain">
-<ANCHOR id="GstPhotography--color-temperature" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--color-temperature">
-<ANCHOR id="GstPhotography--color-tone-mode" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--color-tone-mode">
-<ANCHOR id="GstPhotography--exposure-time" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--exposure-time">
-<ANCHOR id="GstPhotography--lens-focus" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--lens-focus">
-<ANCHOR id="GstPhotography--max-exposure-time" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--max-exposure-time">
-<ANCHOR id="GstPhotography--min-exposure-time" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--min-exposure-time">
-<ANCHOR id="GstPhotography--white-point" href="gst-plugins-bad-plugins-1.0/GstPhotography.html#GstPhotography--white-point">
diff --git a/docs/plugins/inspect/plugin-accurip.xml b/docs/plugins/inspect/plugin-accurip.xml
index 2b981e7..d99c398 100644
--- a/docs/plugins/inspect/plugin-accurip.xml
+++ b/docs/plugins/inspect/plugin-accurip.xml
@@ -3,10 +3,10 @@
   <description>Computes an AccurateRip CRC</description>
   <filename>../../gst/accurip/.libs/libgstaccurip.so</filename>
   <basename>libgstaccurip.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-adpcmdec.xml b/docs/plugins/inspect/plugin-adpcmdec.xml
index be0cc23..a6c6d31 100644
--- a/docs/plugins/inspect/plugin-adpcmdec.xml
+++ b/docs/plugins/inspect/plugin-adpcmdec.xml
@@ -3,10 +3,10 @@
   <description>ADPCM decoder</description>
   <filename>../../gst/adpcmdec/.libs/libgstadpcmdec.so</filename>
   <basename>libgstadpcmdec.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-adpcmenc.xml b/docs/plugins/inspect/plugin-adpcmenc.xml
index 0a08b30..d78aee2 100644
--- a/docs/plugins/inspect/plugin-adpcmenc.xml
+++ b/docs/plugins/inspect/plugin-adpcmenc.xml
@@ -3,10 +3,10 @@
   <description>ADPCM encoder</description>
   <filename>../../gst/adpcmenc/.libs/libgstadpcmenc.so</filename>
   <basename>libgstadpcmenc.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -26,7 +26,7 @@
           <name>src</name>
           <direction>source</direction>
           <presence>always</presence>
-          <details>audio/x-adpcm, layout=(string){ dvi }, block_align=(int)[ 64, 8192 ], rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]</details>
+          <details>audio/x-adpcm, layout=(string)dvi, block_align=(int)[ 64, 8192 ], rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-aiff.xml b/docs/plugins/inspect/plugin-aiff.xml
index b54948d..82523a1 100644
--- a/docs/plugins/inspect/plugin-aiff.xml
+++ b/docs/plugins/inspect/plugin-aiff.xml
@@ -3,10 +3,10 @@
   <description>Create and parse Audio Interchange File Format (AIFF) files</description>
   <filename>../../gst/aiff/.libs/libgstaiff.so</filename>
   <basename>libgstaiff.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-asfmux.xml b/docs/plugins/inspect/plugin-asfmux.xml
index d607408..2ecfd4a 100644
--- a/docs/plugins/inspect/plugin-asfmux.xml
+++ b/docs/plugins/inspect/plugin-asfmux.xml
@@ -3,10 +3,10 @@
   <description>ASF Muxer Plugin</description>
   <filename>../../gst/asfmux/.libs/libgstasfmux.so</filename>
   <basename>libgstasfmux.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-assrender.xml b/docs/plugins/inspect/plugin-assrender.xml
index 3b3b6ba..539d4ef 100644
--- a/docs/plugins/inspect/plugin-assrender.xml
+++ b/docs/plugins/inspect/plugin-assrender.xml
@@ -3,10 +3,10 @@
   <description>ASS/SSA subtitle renderer</description>
   <filename>../../ext/assrender/.libs/libgstassrender.so</filename>
   <basename>libgstassrender.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -26,13 +26,13 @@
           <name>video_sink</name>
           <direction>sink</direction>
           <presence>always</presence>
-          <details>video/x-raw, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
+          <details>video/x-raw, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, 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, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
+          <details>video/x-raw, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-audiofxbad.xml b/docs/plugins/inspect/plugin-audiofxbad.xml
deleted file mode 100644
index 26415a0..0000000
--- a/docs/plugins/inspect/plugin-audiofxbad.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>audiofxbad</name>
-  <description>Audio filters from gst-plugins-bad</description>
-  <filename>../../gst/audiofxbad/.libs/libgstaudiofxbad.so</filename>
-  <basename>libgstaudiofxbad.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>audiochannelmix</name>
-      <longname>Simple stereo audio mixer</longname>
-      <class>Audio/Mixer</class>
-      <description>Mixes left/right channels of stereo audio</description>
-      <author>David Schleef &lt;ds@schleef.org&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int)[ 1, 2147483647 ], channels=(int)2, layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int)[ 1, 2147483647 ], channels=(int)2, layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-audiomixer.xml b/docs/plugins/inspect/plugin-audiomixer.xml
index 190db26..bd441d2 100644
--- a/docs/plugins/inspect/plugin-audiomixer.xml
+++ b/docs/plugins/inspect/plugin-audiomixer.xml
@@ -3,10 +3,10 @@
   <description>Mixes multiple audio streams</description>
   <filename>../../gst/audiomixer/.libs/libgstaudiomixer.so</filename>
   <basename>libgstaudiomixer.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-audiovisualizers.xml b/docs/plugins/inspect/plugin-audiovisualizers.xml
index 04c619a..694b7da 100644
--- a/docs/plugins/inspect/plugin-audiovisualizers.xml
+++ b/docs/plugins/inspect/plugin-audiovisualizers.xml
@@ -3,10 +3,10 @@
   <description>Creates video visualizations of audio input</description>
   <filename>../../gst/audiovisualizers/.libs/libgstaudiovisualizers.so</filename>
   <basename>libgstaudiovisualizers.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>GPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-autoconvert.xml b/docs/plugins/inspect/plugin-autoconvert.xml
index b74056c..b2d3ff2 100644
--- a/docs/plugins/inspect/plugin-autoconvert.xml
+++ b/docs/plugins/inspect/plugin-autoconvert.xml
@@ -3,10 +3,10 @@
   <description>Selects convertor element based on caps</description>
   <filename>../../gst/autoconvert/.libs/libgstautoconvert.so</filename>
   <basename>libgstautoconvert.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-bayer.xml b/docs/plugins/inspect/plugin-bayer.xml
index 56fafed..1ca3144 100644
--- a/docs/plugins/inspect/plugin-bayer.xml
+++ b/docs/plugins/inspect/plugin-bayer.xml
@@ -3,10 +3,10 @@
   <description>Elements to convert Bayer images</description>
   <filename>../../gst/bayer/.libs/libgstbayer.so</filename>
   <basename>libgstbayer.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-bs2b.xml b/docs/plugins/inspect/plugin-bs2b.xml
new file mode 100644
index 0000000..c646cbe
--- /dev/null
+++ b/docs/plugins/inspect/plugin-bs2b.xml
@@ -0,0 +1,34 @@
+<plugin>
+  <name>bs2b</name>
+  <description>Improve headphone listening of stereo audio recordsusing the bs2b library.</description>
+  <filename>../../ext/bs2b/.libs/libgstbs2b.so</filename>
+  <basename>libgstbs2b.so</basename>
+  <version>1.5.0.1</version>
+  <license>LGPL</license>
+  <source>gst-plugins-bad</source>
+  <package>GStreamer Bad Plug-ins git</package>
+  <origin>Unknown package origin</origin>
+  <elements>
+    <element>
+      <name>bs2b</name>
+      <longname>Crossfeed effect</longname>
+      <class>Effect/Audio</class>
+      <description>Improve headphone listening of stereo audio records using the bs2b library.</description>
+      <author>Christoph Reiter &lt;reiter.christoph@gmail.com&gt;</author>
+      <pads>
+        <caps>
+          <name>sink</name>
+          <direction>sink</direction>
+          <presence>always</presence>
+          <details>audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 2000, 384000 ], channels=(int)2, channel-mask=(bitmask)0x0000000000000003, layout=(string)interleaved; audio/x-raw, channels=(int)1</details>
+        </caps>
+        <caps>
+          <name>src</name>
+          <direction>source</direction>
+          <presence>always</presence>
+          <details>audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 2000, 384000 ], channels=(int)2, channel-mask=(bitmask)0x0000000000000003, layout=(string)interleaved; audio/x-raw, channels=(int)1</details>
+        </caps>
+      </pads>
+    </element>
+  </elements>
+</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-bz2.xml b/docs/plugins/inspect/plugin-bz2.xml
index 32abfdf..c82731b 100644
--- a/docs/plugins/inspect/plugin-bz2.xml
+++ b/docs/plugins/inspect/plugin-bz2.xml
@@ -3,10 +3,10 @@
   <description>Compress or decompress streams</description>
   <filename>../../ext/bz2/.libs/libgstbz2.so</filename>
   <basename>libgstbz2.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-camerabin.xml b/docs/plugins/inspect/plugin-camerabin.xml
index 58fc10a..67cdf51 100644
--- a/docs/plugins/inspect/plugin-camerabin.xml
+++ b/docs/plugins/inspect/plugin-camerabin.xml
@@ -3,10 +3,10 @@
   <description>Take image snapshots and record movies from camera</description>
   <filename>../../gst/camerabin2/.libs/libgstcamerabin2.so</filename>
   <basename>libgstcamerabin2.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-chromaprint.xml b/docs/plugins/inspect/plugin-chromaprint.xml
index c454e68..433eecd 100644
--- a/docs/plugins/inspect/plugin-chromaprint.xml
+++ b/docs/plugins/inspect/plugin-chromaprint.xml
@@ -3,10 +3,10 @@
   <description>Calculate Chromaprint fingerprint from audio files</description>
   <filename>../../ext/chromaprint/.libs/libgstchromaprint.so</filename>
   <basename>libgstchromaprint.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-coloreffects.xml b/docs/plugins/inspect/plugin-coloreffects.xml
index 49ce112..748eb8f 100644
--- a/docs/plugins/inspect/plugin-coloreffects.xml
+++ b/docs/plugins/inspect/plugin-coloreffects.xml
@@ -3,10 +3,10 @@
   <description>Color Look-up Table filters</description>
   <filename>../../gst/coloreffects/.libs/libgstcoloreffects.so</filename>
   <basename>libgstcoloreffects.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-compositor.xml b/docs/plugins/inspect/plugin-compositor.xml
deleted file mode 100644
index 161998c..0000000
--- a/docs/plugins/inspect/plugin-compositor.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>compositor</name>
-  <description>Compositor</description>
-  <filename>../../gst/compositor/.libs/libgstcompositor.so</filename>
-  <basename>libgstcompositor.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>compositor</name>
-      <longname>Compositor</longname>
-      <class>Filter/Editor/Video/Compositor</class>
-      <description>Composite multiple video streams</description>
-      <author>Wim Taymans &lt;wim@fluendo.com&gt;, Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink_%u</name>
-          <direction>sink</direction>
-          <presence>request</presence>
-          <details>video/x-raw, format=(string){ AYUV, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, YVYU, I420, YV12, NV12, NV21, Y41B, RGB, BGR, xRGB, xBGR, RGBx, BGRx }, 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, format=(string){ AYUV, BGRA, ARGB, RGBA, ABGR, Y444, Y42B, YUY2, UYVY, YVYU, I420, YV12, NV12, NV21, Y41B, RGB, BGR, xRGB, xBGR, RGBx, BGRx }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-curl.xml b/docs/plugins/inspect/plugin-curl.xml
index c54d313..fe81dd0 100644
--- a/docs/plugins/inspect/plugin-curl.xml
+++ b/docs/plugins/inspect/plugin-curl.xml
@@ -3,10 +3,10 @@
   <description>libcurl-based elements</description>
   <filename>../../ext/curl/.libs/libgstcurl.so</filename>
   <basename>libgstcurl.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -55,6 +55,21 @@
       </pads>
     </element>
     <element>
+      <name>curlsftpsink</name>
+      <longname>Curl sftp sink</longname>
+      <class>Sink/Network</class>
+      <description>Upload data over the SFTP protocol using libcurl</description>
+      <author>Sorin L. &lt;sorin@axis.com&gt;</author>
+      <pads>
+        <caps>
+          <name>sink</name>
+          <direction>sink</direction>
+          <presence>always</presence>
+          <details>ANY</details>
+        </caps>
+      </pads>
+    </element>
+    <element>
       <name>curlsmtpsink</name>
       <longname>Curl smtp sink</longname>
       <class>Sink/Network</class>
diff --git a/docs/plugins/inspect/plugin-dashdemux.xml b/docs/plugins/inspect/plugin-dashdemux.xml
deleted file mode 100644
index c911b39..0000000
--- a/docs/plugins/inspect/plugin-dashdemux.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<plugin>
-  <name>dashdemux</name>
-  <description>DASH demuxer plugin</description>
-  <filename>../../ext/dash/.libs/libgstdashdemux.so</filename>
-  <basename>libgstdashdemux.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins</package>
-  <origin>http://www.gstreamer.org/</origin>
-  <elements>
-    <element>
-      <name>dashdemux</name>
-      <longname>DASH Demuxer</longname>
-      <class>Codec/Demuxer/Adaptive</class>
-      <description>Dynamic Adaptive Streaming over HTTP demuxer</description>
-      <author>David Corvoysier &lt;david.corvoysier@orange.com&gt;
-                Hamid Zakari &lt;hamid.zakari@gmail.com&gt;
-                Gianluca Gennari &lt;gennarone@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>application/dash+xml</details>
-        </caps>
-        <caps>
-          <name>src_%u</name>
-          <direction>source</direction>
-          <presence>sometimes</presence>
-          <details>ANY</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-dataurisrc.xml b/docs/plugins/inspect/plugin-dataurisrc.xml
index 11c1058..29001d6 100644
--- a/docs/plugins/inspect/plugin-dataurisrc.xml
+++ b/docs/plugins/inspect/plugin-dataurisrc.xml
@@ -3,10 +3,10 @@
   <description>data: URI source</description>
   <filename>../../gst/dataurisrc/.libs/libgstdataurisrc.so</filename>
   <basename>libgstdataurisrc.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-debugutilsbad.xml b/docs/plugins/inspect/plugin-debugutilsbad.xml
index b47938b..39f5d38 100644
--- a/docs/plugins/inspect/plugin-debugutilsbad.xml
+++ b/docs/plugins/inspect/plugin-debugutilsbad.xml
@@ -3,10 +3,10 @@
   <description>Collection of elements that may or may not be useful for debugging</description>
   <filename>../../gst/debugutils/.libs/libgstdebugutilsbad.so</filename>
   <basename>libgstdebugutilsbad.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-decklink.xml b/docs/plugins/inspect/plugin-decklink.xml
deleted file mode 100644
index 1d4069c..0000000
--- a/docs/plugins/inspect/plugin-decklink.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<plugin>
-  <name>decklink</name>
-  <description>Blackmagic Decklink plugin</description>
-  <filename>../../sys/decklink/.libs/libgstdecklink.so</filename>
-  <basename>libgstdecklink.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>decklinksink</name>
-      <longname>Decklink Sink</longname>
-      <class>Video/Sink</class>
-      <description>Decklink Sink</description>
-      <author>David Schleef &lt;ds@entropywave.com&gt;</author>
-      <pads>
-        <caps>
-          <name>audiosink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, channels=(int)2, rate=(int)48000, layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>videosink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string)UYVY, width=(int)720, height=(int)486, framerate=(fraction)30000/1001, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)10/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)486, framerate=(fraction)24000/1001, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)10/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)576, framerate=(fraction)25/1, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)12/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)486, framerate=(fraction)30000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)10/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)576, framerate=(fraction)25/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)12/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)24000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)24/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)25/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60000/1001, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)50/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>decklinksrc</name>
-      <longname>Decklink source</longname>
-      <class>Source/Video</class>
-      <description>DeckLink Source</description>
-      <author>David Schleef &lt;ds@entropywave.com&gt;</author>
-      <pads>
-        <caps>
-          <name>audiosrc</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, channels=(int)2, rate=(int)48000, layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>videosrc</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string)UYVY, width=(int)720, height=(int)486, framerate=(fraction)30000/1001, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)10/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)486, framerate=(fraction)24000/1001, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)10/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)576, framerate=(fraction)25/1, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)12/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)486, framerate=(fraction)30000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)10/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)720, height=(int)576, framerate=(fraction)25/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)12/11, colorimetry=(string)bt601, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)24000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)24/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)25/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60000/1001, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)50/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60000/1001, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2; video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt709, chroma-site=(string)mpeg2</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-dfbvideosink.xml b/docs/plugins/inspect/plugin-dfbvideosink.xml
deleted file mode 100644
index c401bd7..0000000
--- a/docs/plugins/inspect/plugin-dfbvideosink.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<plugin>
-  <name>dfbvideosink</name>
-  <description>DirectFB video output plugin</description>
-  <filename>../../ext/directfb/.libs/libgstdfbvideosink.so</filename>
-  <basename>libgstdfbvideosink.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>dfbvideosink</name>
-      <longname>DirectFB video sink</longname>
-      <class>Sink/Video</class>
-      <description>A DirectFB based videosink</description>
-      <author>Julien Moutte &lt;julien@moutte.net&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-dtsdec.xml b/docs/plugins/inspect/plugin-dtsdec.xml
index 40c6d05..a5147bb 100644
--- a/docs/plugins/inspect/plugin-dtsdec.xml
+++ b/docs/plugins/inspect/plugin-dtsdec.xml
@@ -3,10 +3,10 @@
   <description>Decodes DTS audio streams</description>
   <filename>../../ext/dts/.libs/libgstdtsdec.so</filename>
   <basename>libgstdtsdec.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>GPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-dvb.xml b/docs/plugins/inspect/plugin-dvb.xml
index 6b13e03..d015b6f 100644
--- a/docs/plugins/inspect/plugin-dvb.xml
+++ b/docs/plugins/inspect/plugin-dvb.xml
@@ -3,10 +3,10 @@
   <description>DVB elements</description>
   <filename>../../sys/dvb/.libs/libgstdvb.so</filename>
   <basename>libgstdvb.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -14,7 +14,8 @@
       <longname>DVB bin</longname>
       <class>Source/Bin/Video</class>
       <description>Access descramble and split DVB streams</description>
-      <author>Alessandro Decina &lt;alessandro@nnva.org&gt;</author>
+      <author>Alessandro Decina &lt;alessandro@nnva.org&gt;
+Reynaldo H. Verdejo Pinochet &lt;r.verdejo@sisa.samsung.com&gt;</author>
       <pads>
         <caps>
           <name>src</name>
@@ -35,7 +36,8 @@
       <longname>DVB Source</longname>
       <class>Source/Video</class>
       <description>Digital Video Broadcast Source</description>
-      <author>P2P-VCR, C-Lab, University of Paderborn,Zaheer Abbas Merali &lt;zaheerabbas at merali dot org&gt;</author>
+      <author>P2P-VCR, C-Lab, University of Paderborn, Zaheer Abbas Merali &lt;zaheerabbas at merali dot org&gt;
+Reynaldo H. Verdejo Pinochet &lt;r.verdejo@sisa.samsung.com&gt;</author>
       <pads>
         <caps>
           <name>src</name>
diff --git a/docs/plugins/inspect/plugin-dvbsuboverlay.xml b/docs/plugins/inspect/plugin-dvbsuboverlay.xml
index 3314a20..5046c1b 100644
--- a/docs/plugins/inspect/plugin-dvbsuboverlay.xml
+++ b/docs/plugins/inspect/plugin-dvbsuboverlay.xml
@@ -3,10 +3,10 @@
   <description>DVB subtitle renderer</description>
   <filename>../../gst/dvbsuboverlay/.libs/libgstdvbsuboverlay.so</filename>
   <basename>libgstdvbsuboverlay.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -26,13 +26,13 @@
           <name>video_sink</name>
           <direction>sink</direction>
           <presence>always</presence>
-          <details>video/x-raw, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
+          <details>video/x-raw, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, 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, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
+          <details>video/x-raw, format=(string){ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(ANY), format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-dvdspu.xml b/docs/plugins/inspect/plugin-dvdspu.xml
index ac7aaec..61b9317 100644
--- a/docs/plugins/inspect/plugin-dvdspu.xml
+++ b/docs/plugins/inspect/plugin-dvdspu.xml
@@ -3,10 +3,10 @@
   <description>DVD Sub-picture Overlay element</description>
   <filename>../../gst/dvdspu/.libs/libgstdvdspu.so</filename>
   <basename>libgstdvdspu.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-eglglessink.xml b/docs/plugins/inspect/plugin-eglglessink.xml
deleted file mode 100644
index 9e5a10d..0000000
--- a/docs/plugins/inspect/plugin-eglglessink.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<plugin>
-  <name>eglglessink</name>
-  <description>EGL/GLES sink</description>
-  <filename>../../ext/eglgles/.libs/libgsteglglessink.so</filename>
-  <basename>libgsteglglessink.so</basename>
-  <version>1.2.0</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>eglglessink</name>
-      <longname>EGL/GLES vout Sink</longname>
-      <class>Sink/Video</class>
-      <description>An EGL/GLES Video Output Sink Implementing the VideoOverlay interface</description>
-      <author>Reynaldo H. Verdejo Pinochet &lt;reynaldo@collabora.com&gt;, Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:EGLImage), format=(string){ RGBA, BGRA, ARGB, ABGR, RGBx, BGRx, xRGB, xBGR, AYUV, Y444, I420, YV12, NV12, NV21, Y42B, Y41B, RGB, BGR, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string){ RGBA, BGRA, ARGB, ABGR, RGBx, BGRx, xRGB, xBGR, AYUV, Y444, I420, YV12, NV12, NV21, Y42B, Y41B, RGB, BGR, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGBA, BGRA, ARGB, ABGR, RGBx, BGRx, xRGB, xBGR, AYUV, Y444, I420, YV12, NV12, NV21, Y42B, Y41B, RGB, BGR, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-faac.xml b/docs/plugins/inspect/plugin-faac.xml
index a1397d8..1b91088 100644
--- a/docs/plugins/inspect/plugin-faac.xml
+++ b/docs/plugins/inspect/plugin-faac.xml
@@ -3,10 +3,10 @@
   <description>Free AAC Encoder (FAAC)</description>
   <filename>../../ext/faac/.libs/libgstfaac.so</filename>
   <basename>libgstfaac.so</basename>
-  <version>1.4.3</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -26,7 +26,7 @@
           <name>src</name>
           <direction>source</direction>
           <presence>always</presence>
-          <details>audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, base-profile=(string){ main, lc, ssr, ltp }; audio/mpeg, mpegversion=(int)2, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, profile=(string){ main, lc }</details>
+          <details>audio/mpeg, mpegversion=(int)4, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, base-profile=(string){ main, lc, ssr, ltp }, framed=(boolean)true; audio/mpeg, mpegversion=(int)2, channels=(int)[ 1, 6 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, stream-format=(string){ adts, raw }, profile=(string){ main, lc }, framed=(boolean)true</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-faad.xml b/docs/plugins/inspect/plugin-faad.xml
index eb243c6..2bf8963 100644
--- a/docs/plugins/inspect/plugin-faad.xml
+++ b/docs/plugins/inspect/plugin-faad.xml
@@ -3,10 +3,10 @@
   <description>Free AAC Decoder (FAAD)</description>
   <filename>../../ext/faad/.libs/libgstfaad.so</filename>
   <basename>libgstfaad.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>GPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-fbdevsink.xml b/docs/plugins/inspect/plugin-fbdevsink.xml
deleted file mode 100644
index fb0d55f..0000000
--- a/docs/plugins/inspect/plugin-fbdevsink.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<plugin>
-  <name>fbdevsink</name>
-  <description>Linux framebuffer video sink</description>
-  <filename>../../sys/fbdev/.libs/libgstfbdevsink.so</filename>
-  <basename>libgstfbdevsink.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>fbdevsink</name>
-      <longname>fbdev video sink</longname>
-      <class>Sink/Video</class>
-      <description>Linux framebuffer videosink</description>
-      <author>Sean D&apos;Epagnier &lt;sean@depagnier.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ RGB, BGR, BGRx, xBGR, RGB, RGBx, xRGB, RGB15, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-festival.xml b/docs/plugins/inspect/plugin-festival.xml
index a2c7cd7..d63ce62 100644
--- a/docs/plugins/inspect/plugin-festival.xml
+++ b/docs/plugins/inspect/plugin-festival.xml
@@ -3,10 +3,10 @@
   <description>Synthesizes plain text into audio</description>
   <filename>../../gst/festival/.libs/libgstfestival.so</filename>
   <basename>libgstfestival.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-fieldanalysis.xml b/docs/plugins/inspect/plugin-fieldanalysis.xml
index a39ee17..60c8aff 100644
--- a/docs/plugins/inspect/plugin-fieldanalysis.xml
+++ b/docs/plugins/inspect/plugin-fieldanalysis.xml
@@ -3,7 +3,7 @@
   <description>Video field analysis</description>
   <filename>../../gst/fieldanalysis/.libs/libgstfieldanalysis.so</filename>
   <basename>libgstfieldanalysis.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer</package>
diff --git a/docs/plugins/inspect/plugin-flite.xml b/docs/plugins/inspect/plugin-flite.xml
index 0e302aa..aa2a90c 100644
--- a/docs/plugins/inspect/plugin-flite.xml
+++ b/docs/plugins/inspect/plugin-flite.xml
@@ -3,10 +3,10 @@
   <description>Flite speech synthesizer plugin</description>
   <filename>../../ext/flite/.libs/libgstflite.so</filename>
   <basename>libgstflite.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-fluidsynthmidi.xml b/docs/plugins/inspect/plugin-fluidsynthmidi.xml
deleted file mode 100644
index 6556c4b..0000000
--- a/docs/plugins/inspect/plugin-fluidsynthmidi.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>fluidsynthmidi</name>
-  <description>Fluidsynth MIDI Plugin</description>
-  <filename>../../ext/fluidsynth/.libs/libgstfluidsynthmidi.so</filename>
-  <basename>libgstfluidsynthmidi.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>fluiddec</name>
-      <longname>Fluidsynth</longname>
-      <class>Codec/Decoder/Audio</class>
-      <description>Midi Synthesizer Element</description>
-      <author>Wim Taymans &lt;wim.taymans@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-midi-event</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, rate=(int)44100, channels=(int)2, layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-fragmented.xml b/docs/plugins/inspect/plugin-fragmented.xml
index 067c080..54b8407 100644
--- a/docs/plugins/inspect/plugin-fragmented.xml
+++ b/docs/plugins/inspect/plugin-fragmented.xml
@@ -3,7 +3,7 @@
   <description>Fragmented streaming plugins</description>
   <filename>../../ext/hls/.libs/libgstfragmented.so</filename>
   <basename>libgstfragmented.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer Bad Plug-ins</package>
diff --git a/docs/plugins/inspect/plugin-freeverb.xml b/docs/plugins/inspect/plugin-freeverb.xml
deleted file mode 100644
index 69f956a..0000000
--- a/docs/plugins/inspect/plugin-freeverb.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>freeverb</name>
-  <description>Reverberation/room effect</description>
-  <filename>../../gst/freeverb/.libs/libgstfreeverb.so</filename>
-  <basename>libgstfreeverb.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>freeverb</name>
-      <longname>Reverberation/room effect</longname>
-      <class>Filter/Effect/Audio</class>
-      <description>Add reverberation to audio streams</description>
-      <author>Stefan Sauer &lt;ensonic@users.sf.net&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string){ F32LE, S16LE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string){ F32LE, S16LE }, rate=(int)[ 1, 2147483647 ], channels=(int)2, layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-frei0r.xml b/docs/plugins/inspect/plugin-frei0r.xml
index 4d0f72b..22d7262 100644
--- a/docs/plugins/inspect/plugin-frei0r.xml
+++ b/docs/plugins/inspect/plugin-frei0r.xml
@@ -3,10 +3,10 @@
   <description>frei0r plugin library</description>
   <filename>../../gst/frei0r/.libs/libgstfrei0r.so</filename>
   <basename>libgstfrei0r.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
   </elements>
diff --git a/docs/plugins/inspect/plugin-gaudieffects.xml b/docs/plugins/inspect/plugin-gaudieffects.xml
index 6d697ed..465a76d 100644
--- a/docs/plugins/inspect/plugin-gaudieffects.xml
+++ b/docs/plugins/inspect/plugin-gaudieffects.xml
@@ -3,7 +3,7 @@
   <description>Gaudi video effects.</description>
   <filename>../../gst/gaudieffects/.libs/libgstgaudieffects.so</filename>
   <basename>libgstgaudieffects.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer</package>
diff --git a/docs/plugins/inspect/plugin-gdp.xml b/docs/plugins/inspect/plugin-gdp.xml
index 6e45f75..6cbcccf 100644
--- a/docs/plugins/inspect/plugin-gdp.xml
+++ b/docs/plugins/inspect/plugin-gdp.xml
@@ -3,10 +3,10 @@
   <description>Payload/depayload GDP packets</description>
   <filename>../../gst/gdp/.libs/libgstgdp.so</filename>
   <basename>libgstgdp.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-geometrictransform.xml b/docs/plugins/inspect/plugin-geometrictransform.xml
index c46ec3b..b667910 100644
--- a/docs/plugins/inspect/plugin-geometrictransform.xml
+++ b/docs/plugins/inspect/plugin-geometrictransform.xml
@@ -3,10 +3,10 @@
   <description>Various geometric image transform elements</description>
   <filename>../../gst/geometrictransform/.libs/libgstgeometrictransform.so</filename>
   <basename>libgstgeometrictransform.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-gmedec.xml b/docs/plugins/inspect/plugin-gmedec.xml
index 2e4283e..050c934 100644
--- a/docs/plugins/inspect/plugin-gmedec.xml
+++ b/docs/plugins/inspect/plugin-gmedec.xml
@@ -3,10 +3,10 @@
   <description>GME Audio Decoder</description>
   <filename>../../ext/gme/.libs/libgstgme.so</filename>
   <basename>libgstgme.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-gsm.xml b/docs/plugins/inspect/plugin-gsm.xml
index 2b28557..4e3f9dc 100644
--- a/docs/plugins/inspect/plugin-gsm.xml
+++ b/docs/plugins/inspect/plugin-gsm.xml
@@ -3,10 +3,10 @@
   <description>GSM encoder/decoder</description>
   <filename>../../ext/gsm/.libs/libgstgsm.so</filename>
   <basename>libgstgsm.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-gstsiren.xml b/docs/plugins/inspect/plugin-gstsiren.xml
index ae40d2f..9a4866f 100644
--- a/docs/plugins/inspect/plugin-gstsiren.xml
+++ b/docs/plugins/inspect/plugin-gstsiren.xml
@@ -3,10 +3,10 @@
   <description>Siren encoder/decoder/payloader/depayloader plugins</description>
   <filename>../../gst/siren/.libs/libgstsiren.so</filename>
   <basename>libgstsiren.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-id3tag.xml b/docs/plugins/inspect/plugin-id3tag.xml
index 598fe25..4f8b2c2 100644
--- a/docs/plugins/inspect/plugin-id3tag.xml
+++ b/docs/plugins/inspect/plugin-id3tag.xml
@@ -3,10 +3,10 @@
   <description>ID3 v1 and v2 muxing plugin</description>
   <filename>../../gst/id3tag/.libs/libgstid3tag.so</filename>
   <basename>libgstid3tag.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-inter.xml b/docs/plugins/inspect/plugin-inter.xml
index 239234d..dcd55e3 100644
--- a/docs/plugins/inspect/plugin-inter.xml
+++ b/docs/plugins/inspect/plugin-inter.xml
@@ -3,7 +3,7 @@
   <description>plugin for inter-pipeline communication</description>
   <filename>../../gst/inter/.libs/libgstinter.so</filename>
   <basename>libgstinter.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer Bad Plug-ins</package>
@@ -20,7 +20,7 @@
           <name>sink</name>
           <direction>sink</direction>
           <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int)48000, channels=(int)2</details>
+          <details>audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
         </caps>
       </pads>
     </element>
@@ -35,7 +35,7 @@
           <name>src</name>
           <direction>source</direction>
           <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int)48000, channels=(int)2</details>
+          <details>audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
         </caps>
       </pads>
     </element>
@@ -80,7 +80,7 @@
           <name>sink</name>
           <direction>sink</direction>
           <presence>always</presence>
-          <details>video/x-raw, format=(string)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
+          <details>video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
         </caps>
       </pads>
     </element>
@@ -95,7 +95,7 @@
           <name>src</name>
           <direction>source</direction>
           <presence>always</presence>
-          <details>video/x-raw, format=(string)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
+          <details>video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-interlace.xml b/docs/plugins/inspect/plugin-interlace.xml
index 1da7d4e..19c0813 100644
--- a/docs/plugins/inspect/plugin-interlace.xml
+++ b/docs/plugins/inspect/plugin-interlace.xml
@@ -3,10 +3,10 @@
   <description>Create an interlaced video stream</description>
   <filename>../../gst/interlace/.libs/libgstinterlace.so</filename>
   <basename>libgstinterlace.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-ivfparse.xml b/docs/plugins/inspect/plugin-ivfparse.xml
deleted file mode 100644
index e0b9aa0..0000000
--- a/docs/plugins/inspect/plugin-ivfparse.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>ivfparse</name>
-  <description>IVF parser</description>
-  <filename>../../gst/ivfparse/.libs/libgstivfparse.so</filename>
-  <basename>libgstivfparse.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>ivfparse</name>
-      <longname>IVF parser</longname>
-      <class>Codec/Demuxer</class>
-      <description>Demuxes a IVF stream</description>
-      <author>Philip Jägenstedt &lt;philipj@opera.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-ivf</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>ANY</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-ivtc.xml b/docs/plugins/inspect/plugin-ivtc.xml
deleted file mode 100644
index 05d01f3..0000000
--- a/docs/plugins/inspect/plugin-ivtc.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<plugin>
-  <name>ivtc</name>
-  <description>Inverse Telecine</description>
-  <filename>../../gst/ivtc/.libs/libgstivtc.so</filename>
-  <basename>libgstivtc.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>combdetect</name>
-      <longname>Comb Detect</longname>
-      <class>Video/Filter</class>
-      <description>Detect combing artifacts in video stream</description>
-      <author>David Schleef &lt;ds@schleef.org&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, Y444, Y42B }, width=(int)[ 1, 2048 ], 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, format=(string){ I420, Y444, Y42B }, width=(int)[ 1, 2048 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ivtc</name>
-      <longname>Inverse Telecine</longname>
-      <class>Video/Filter</class>
-      <description>Inverse Telecine Filter</description>
-      <author>David Schleef &lt;ds@schleef.org&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, Y444, Y42B }, width=(int)[ 1, 2048 ], 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, format=(string){ I420, Y444, Y42B }, width=(int)[ 1, 2048 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-jp2kdecimator.xml b/docs/plugins/inspect/plugin-jp2kdecimator.xml
deleted file mode 100644
index dcf2d95..0000000
--- a/docs/plugins/inspect/plugin-jp2kdecimator.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>jp2kdecimator</name>
-  <description>JPEG2000 decimator</description>
-  <filename>../../gst/jp2kdecimator/.libs/libgstjp2kdecimator.so</filename>
-  <basename>libgstjp2kdecimator.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>jp2kdecimator</name>
-      <longname>JPEG2000 decimator</longname>
-      <class>Filter/Image</class>
-      <description>Removes information from JPEG2000 streams without recompression</description>
-      <author>Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>image/x-jpc</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>image/x-jpc</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-jpegformat.xml b/docs/plugins/inspect/plugin-jpegformat.xml
index b39863d..421fe36 100644
--- a/docs/plugins/inspect/plugin-jpegformat.xml
+++ b/docs/plugins/inspect/plugin-jpegformat.xml
@@ -3,10 +3,10 @@
   <description>JPEG interchange format plugin</description>
   <filename>../../gst/jpegformat/.libs/libgstjpegformat.so</filename>
   <basename>libgstjpegformat.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -47,7 +47,7 @@
           <name>src</name>
           <direction>source</direction>
           <presence>always</presence>
-          <details>image/jpeg, format=(string){ I420, Y41B, UYVY, YV12 }, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], interlaced=(boolean){ true, false }, framerate=(fraction)[ 0/1, 2147483647/1 ], parsed=(boolean)true</details>
+          <details>image/jpeg, format=(string){ I420, Y41B, UYVY, YV12 }, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], parsed=(boolean)true</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-kate.xml b/docs/plugins/inspect/plugin-kate.xml
deleted file mode 100644
index 9561102..0000000
--- a/docs/plugins/inspect/plugin-kate.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<plugin>
-  <name>kate</name>
-  <description>Kate plugin</description>
-  <filename>../../ext/kate/.libs/libgstkate.so</filename>
-  <basename>libgstkate.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>katedec</name>
-      <longname>Kate stream text decoder</longname>
-      <class>Codec/Decoder/Subtitle</class>
-      <description>Decodes Kate text streams</description>
-      <author>Vincent Penquerc&apos;h &lt;ogg.k.ogg.k@googlemail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>subtitle/x-kate</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>text/x-raw, format=(string){ pango-markup, utf8 }; subpicture/x-dvd</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>kateenc</name>
-      <longname>Kate stream encoder</longname>
-      <class>Codec/Encoder/Subtitle</class>
-      <description>Encodes Kate streams from text or subpictures</description>
-      <author>Vincent Penquerc&apos;h &lt;ogg.k.ogg.k@googlemail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>text/x-raw, format=(string){ pango-markup, utf8 }; subpicture/x-dvd</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>subtitle/x-kate; application/x-kate</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>kateparse</name>
-      <longname>Kate stream parser</longname>
-      <class>Codec/Parser/Subtitle</class>
-      <description>parse raw kate streams</description>
-      <author>Vincent Penquerc&apos;h &lt;ogg.k.ogg.k at googlemail dot com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>subtitle/x-kate; application/x-kate</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>subtitle/x-kate; application/x-kate</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>katetag</name>
-      <longname>Kate stream tagger</longname>
-      <class>Formatter/Metadata</class>
-      <description>Retags kate streams</description>
-      <author>Vincent Penquerc&apos;h &lt;ogg.k.ogg.k@googlemail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>subtitle/x-kate; application/x-kate</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>subtitle/x-kate; application/x-kate</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-ladspa.xml b/docs/plugins/inspect/plugin-ladspa.xml
deleted file mode 100644
index 81f9d0f..0000000
--- a/docs/plugins/inspect/plugin-ladspa.xml
+++ /dev/null
@@ -1,211 +0,0 @@
-<plugin>
-  <name>ladspa</name>
-  <description>LADSPA plugin</description>
-  <filename>../../ext/ladspa/.libs/libgstladspa.so</filename>
-  <basename>libgstladspa.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>ladspa-amp-so-amp-mono</name>
-      <longname>Mono Amplifier</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Mono Amplifier</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspa-amp-so-amp-stereo</name>
-      <longname>Stereo Amplifier</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Stereo Amplifier</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)2, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)2, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspa-delay-so-delay-5s</name>
-      <longname>Simple Delay Line</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Simple Delay Line</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspa-filter-so-hpf</name>
-      <longname>Simple High Pass Filter</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Simple High Pass Filter</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspa-filter-so-lpf</name>
-      <longname>Simple Low Pass Filter</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Simple Low Pass Filter</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspa-sine-so-sine-faaa</name>
-      <longname>Sine Oscillator (Freq:audio, Amp:audio)</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Sine Oscillator (Freq:audio, Amp:audio)</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)2, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspa-sine-so-sine-faac</name>
-      <longname>Sine Oscillator (Freq:audio, Amp:control)</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Sine Oscillator (Freq:audio, Amp:control)</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspa-sine-so-sine-fcaa</name>
-      <longname>Sine Oscillator (Freq:control, Amp:audio)</longname>
-      <class>Filter/Effect/Audio/LADSPA</class>
-      <description>Sine Oscillator (Freq:control, Amp:audio)</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspasrc-noise-so-noise-white</name>
-      <longname>White Noise Source</longname>
-      <class>Source/Audio/LADSPA</class>
-      <description>White Noise Source</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>ladspasrc-sine-so-sine-fcac</name>
-      <longname>Sine Oscillator (Freq:control, Amp:control)</longname>
-      <class>Source/Audio/LADSPA</class>
-      <description>Sine Oscillator (Freq:control, Amp:control)</description>
-      <author>Richard Furse (LADSPA example plugins), Juan Manuel Borges Caño &lt;juanmabcmail@gmail.com&gt;, Andy Wingo &lt;wingo at pobox.com&gt;, Steve Baker &lt;stevebaker_org@yahoo.co.uk&gt;, Erik Walthinsen &lt;omega@cse.ogi.edu&gt;, Stefan Sauer &lt;ensonic@users.sf.net&gt;, Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)F32LE, channels=(int)1, rate=(int)[ 1, 2147483647 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-liveadder.xml b/docs/plugins/inspect/plugin-liveadder.xml
index 91a3f74..1d5b834 100644
--- a/docs/plugins/inspect/plugin-liveadder.xml
+++ b/docs/plugins/inspect/plugin-liveadder.xml
@@ -3,10 +3,10 @@
   <description>Adds multiple live discontinuous streams</description>
   <filename>../../gst/liveadder/.libs/libgstliveadder.so</filename>
   <basename>libgstliveadder.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-midi.xml b/docs/plugins/inspect/plugin-midi.xml
deleted file mode 100644
index eb860ae..0000000
--- a/docs/plugins/inspect/plugin-midi.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>midi</name>
-  <description>Parse MIDI files</description>
-  <filename>../../gst/midi/.libs/libgstmidi.so</filename>
-  <basename>libgstmidi.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>midiparse</name>
-      <longname>MidiParse</longname>
-      <class>Codec/Demuxer/Audio</class>
-      <description>Midi Parser Element</description>
-      <author>Wim Taymans &lt;wim.taymans@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/midi; audio/riff-midi</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-midi-event</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-mimic.xml b/docs/plugins/inspect/plugin-mimic.xml
index 49faa78..af26cc0 100644
--- a/docs/plugins/inspect/plugin-mimic.xml
+++ b/docs/plugins/inspect/plugin-mimic.xml
@@ -3,10 +3,10 @@
   <description>Mimic codec</description>
   <filename>../../ext/mimic/.libs/libgstmimic.so</filename>
   <basename>libgstmimic.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mms.xml b/docs/plugins/inspect/plugin-mms.xml
index 5041fcb..27380a6 100644
--- a/docs/plugins/inspect/plugin-mms.xml
+++ b/docs/plugins/inspect/plugin-mms.xml
@@ -3,10 +3,10 @@
   <description>Microsoft Multi Media Server streaming protocol support</description>
   <filename>../../ext/libmms/.libs/libgstmms.so</filename>
   <basename>libgstmms.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-modplug.xml b/docs/plugins/inspect/plugin-modplug.xml
index 66553ea..b6049c8 100644
--- a/docs/plugins/inspect/plugin-modplug.xml
+++ b/docs/plugins/inspect/plugin-modplug.xml
@@ -3,10 +3,10 @@
   <description>.MOD audio decoding</description>
   <filename>../../ext/modplug/.libs/libgstmodplug.so</filename>
   <basename>libgstmodplug.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mpeg2enc.xml b/docs/plugins/inspect/plugin-mpeg2enc.xml
index b7f385c..bc09764 100644
--- a/docs/plugins/inspect/plugin-mpeg2enc.xml
+++ b/docs/plugins/inspect/plugin-mpeg2enc.xml
@@ -3,10 +3,10 @@
   <description>High-quality MPEG-1/2 video encoder</description>
   <filename>../../ext/mpeg2enc/.libs/libgstmpeg2enc.so</filename>
   <basename>libgstmpeg2enc.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>GPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mpegpsdemux.xml b/docs/plugins/inspect/plugin-mpegpsdemux.xml
index e3b4c0f..d74dd78 100644
--- a/docs/plugins/inspect/plugin-mpegpsdemux.xml
+++ b/docs/plugins/inspect/plugin-mpegpsdemux.xml
@@ -3,10 +3,10 @@
   <description>MPEG-PS demuxer</description>
   <filename>../../gst/mpegdemux/.libs/libgstmpegpsdemux.so</filename>
   <basename>libgstmpegpsdemux.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>unknown</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mpegpsmux.xml b/docs/plugins/inspect/plugin-mpegpsmux.xml
index a5c2623..9176573 100644
--- a/docs/plugins/inspect/plugin-mpegpsmux.xml
+++ b/docs/plugins/inspect/plugin-mpegpsmux.xml
@@ -3,10 +3,10 @@
   <description>MPEG-PS muxer</description>
   <filename>../../gst/mpegpsmux/.libs/libgstmpegpsmux.so</filename>
   <basename>libgstmpegpsmux.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mpegtsdemux.xml b/docs/plugins/inspect/plugin-mpegtsdemux.xml
index 745cb81..537be5f 100644
--- a/docs/plugins/inspect/plugin-mpegtsdemux.xml
+++ b/docs/plugins/inspect/plugin-mpegtsdemux.xml
@@ -3,10 +3,10 @@
   <description>MPEG TS demuxer</description>
   <filename>../../gst/mpegtsdemux/.libs/libgstmpegtsdemux.so</filename>
   <basename>libgstmpegtsdemux.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mpegtsmux.xml b/docs/plugins/inspect/plugin-mpegtsmux.xml
index a9999a3..415814b 100644
--- a/docs/plugins/inspect/plugin-mpegtsmux.xml
+++ b/docs/plugins/inspect/plugin-mpegtsmux.xml
@@ -3,10 +3,10 @@
   <description>MPEG-TS muxer</description>
   <filename>../../gst/mpegtsmux/.libs/libgstmpegtsmux.so</filename>
   <basename>libgstmpegtsmux.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mpg123.xml b/docs/plugins/inspect/plugin-mpg123.xml
index 1175738..4bee373 100644
--- a/docs/plugins/inspect/plugin-mpg123.xml
+++ b/docs/plugins/inspect/plugin-mpg123.xml
@@ -3,10 +3,10 @@
   <description>mp3 decoding based on the mpg123 library</description>
   <filename>../../ext/mpg123/.libs/libgstmpg123.so</filename>
   <basename>libgstmpg123.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -20,7 +20,7 @@
           <name>sink</name>
           <direction>sink</direction>
           <presence>always</presence>
-          <details>audio/mpeg, mpegversion=(int){ 1 }, layer=(int)[ 1, 3 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ], parsed=(boolean)true</details>
+          <details>audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ], rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ], parsed=(boolean)true</details>
         </caps>
         <caps>
           <name>src</name>
diff --git a/docs/plugins/inspect/plugin-mplex.xml b/docs/plugins/inspect/plugin-mplex.xml
index 2a86a28..860b034 100644
--- a/docs/plugins/inspect/plugin-mplex.xml
+++ b/docs/plugins/inspect/plugin-mplex.xml
@@ -3,10 +3,10 @@
   <description>High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer</description>
   <filename>../../ext/mplex/.libs/libgstmplex.so</filename>
   <basename>libgstmplex.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>GPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-mxf.xml b/docs/plugins/inspect/plugin-mxf.xml
deleted file mode 100644
index e39fbf3..0000000
--- a/docs/plugins/inspect/plugin-mxf.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>mxf</name>
-  <description>MXF plugin library</description>
-  <filename>../../gst/mxf/.libs/libgstmxf.so</filename>
-  <basename>libgstmxf.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>mxfdemux</name>
-      <longname>MXF Demuxer</longname>
-      <class>Codec/Demuxer</class>
-      <description>Demux MXF files</description>
-      <author>Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>application/mxf</details>
-        </caps>
-        <caps>
-          <name>track_%u</name>
-          <direction>source</direction>
-          <presence>sometimes</presence>
-          <details>ANY</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-neon.xml b/docs/plugins/inspect/plugin-neon.xml
index 09e5dcc..b470f44 100644
--- a/docs/plugins/inspect/plugin-neon.xml
+++ b/docs/plugins/inspect/plugin-neon.xml
@@ -3,7 +3,7 @@
   <description>lib neon http client src</description>
   <filename>../../ext/neon/.libs/libgstneonhttpsrc.so</filename>
   <basename>libgstneonhttpsrc.so</basename>
-  <version>1.3.2.1</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer Bad Plug-ins git</package>
diff --git a/docs/plugins/inspect/plugin-ofa.xml b/docs/plugins/inspect/plugin-ofa.xml
index 3de74cb..131a2ff 100644
--- a/docs/plugins/inspect/plugin-ofa.xml
+++ b/docs/plugins/inspect/plugin-ofa.xml
@@ -3,10 +3,10 @@
   <description>Calculate MusicIP fingerprint from audio files</description>
   <filename>../../ext/ofa/.libs/libgstofa.so</filename>
   <basename>libgstofa.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>GPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-openal.xml b/docs/plugins/inspect/plugin-openal.xml
index dc657ea..ea80e6d 100644
--- a/docs/plugins/inspect/plugin-openal.xml
+++ b/docs/plugins/inspect/plugin-openal.xml
@@ -3,10 +3,10 @@
   <description>OpenAL plugin library</description>
   <filename>../../ext/openal/.libs/libgstopenal.so</filename>
   <basename>libgstopenal.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-opencv.xml b/docs/plugins/inspect/plugin-opencv.xml
index c8e5e88..8b73a97 100644
--- a/docs/plugins/inspect/plugin-opencv.xml
+++ b/docs/plugins/inspect/plugin-opencv.xml
@@ -3,10 +3,10 @@
   <description>GStreamer OpenCV Plugins</description>
   <filename>../../ext/opencv/.libs/libgstopencv.so</filename>
   <basename>libgstopencv.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -182,7 +182,7 @@
       <longname>faceblur</longname>
       <class>Filter/Effect/Video</class>
       <description>Blurs faces in images and videos</description>
-      <author>Michael Sheldon &lt;mike@mikeasoft.com&gt;</author>
+      <author>Michael Sheldon &lt;mike@mikeasoft.com&gt;,Robert Jobbagy &lt;jobbagy.robert@gmail.com&gt;</author>
       <pads>
         <caps>
           <name>sink</name>
diff --git a/docs/plugins/inspect/plugin-openexr.xml b/docs/plugins/inspect/plugin-openexr.xml
deleted file mode 100644
index a5fe5f1..0000000
--- a/docs/plugins/inspect/plugin-openexr.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>openexr</name>
-  <description>OpenEXR image plugin</description>
-  <filename>../../ext/openexr/.libs/libgstopenexr.so</filename>
-  <basename>libgstopenexr.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>openexrdec</name>
-      <longname>OpenEXR decoder</longname>
-      <class>Codec/Decoder/Video</class>
-      <description>Decode EXR streams</description>
-      <author>Sebastian Dröge &lt;sebastian@centricular.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>image/x-exr</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string)ARGB64, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-opengl.xml b/docs/plugins/inspect/plugin-opengl.xml
deleted file mode 100644
index 7abbec4..0000000
--- a/docs/plugins/inspect/plugin-opengl.xml
+++ /dev/null
@@ -1,379 +0,0 @@
-<plugin>
-  <name>opengl</name>
-  <description>OpenGL plugin</description>
-  <filename>../../ext/gl/.libs/libgstopengl.so</filename>
-  <basename>libgstopengl.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>glbumper</name>
-      <longname>OpenGL bumper filter</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Bump mapping filter</description>
-      <author>Cyril Comparon &lt;cyril.comparon@gmail.com&gt;, Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glcolorscale</name>
-      <longname>OpenGL color scale</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Colorspace converter and video scaler</description>
-      <author>Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>gldeinterlace</name>
-      <longname>OpenGL deinterlacing filter</longname>
-      <class>Deinterlace</class>
-      <description>Deinterlacing based on fragment shaders</description>
-      <author>Julien Isorce &lt;julien.isorce@mail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>gldifferencematte</name>
-      <longname>Gstreamer OpenGL DifferenceMatte</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Saves a background frame and replace it with a pixbuf</description>
-      <author>Filippo Argiolas &lt;filippo.argiolas@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>gleffects</name>
-      <longname>Gstreamer OpenGL Effects</longname>
-      <class>Filter/Effect/Video</class>
-      <description>GL Shading Language effects</description>
-      <author>Filippo Argiolas &lt;filippo.argiolas@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glfilterapp</name>
-      <longname>OpenGL application filter</longname>
-      <class>Filter/Effect</class>
-      <description>Use client callbacks to define the scene</description>
-      <author>Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glfilterblur</name>
-      <longname>Gstreamer OpenGL Blur</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Blur with 9x9 separable convolution</description>
-      <author>Filippo Argiolas &lt;filippo.argiolas@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glfiltercube</name>
-      <longname>OpenGL cube filter</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Map input texture on the 6 cube faces</description>
-      <author>Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glfilterglass</name>
-      <longname>OpenGL glass filter</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Glass Filter</description>
-      <author>Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glfilterlaplacian</name>
-      <longname>OpenGL laplacian filter</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Laplacian Convolution Demo Filter</description>
-      <author>Filippo Argiolas &lt;filippo.argiolas@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glfilterreflectedscreen</name>
-      <longname>OpenGL Reflected Screen filter</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Reflected Screen Filter</description>
-      <author>Pierre POUZOL &lt;pierre.pouzol@hotmail.fr&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glfiltersobel</name>
-      <longname>Gstreamer OpenGL Sobel</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Sobel edge detection</description>
-      <author>Filippo Argiolas &lt;filippo.argiolas@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glimagesink</name>
-      <longname>OpenGL video sink</longname>
-      <class>Sink/Video</class>
-      <description>A videosink based on OpenGL</description>
-      <author>Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glmosaic</name>
-      <longname>OpenGL mosaic</longname>
-      <class>Filter/Effect/Video</class>
-      <description>OpenGL mosaic</description>
-      <author>Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink_%u</name>
-          <direction>sink</direction>
-          <presence>request</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>gloverlay</name>
-      <longname>Gstreamer OpenGL Overlay</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Overlay GL video texture with a PNG image</description>
-      <author>Filippo Argiolas &lt;filippo.argiolas@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glshader</name>
-      <longname>OpenGL fragment shader filter</longname>
-      <class>Filter/Effect</class>
-      <description>Load GLSL fragment shader from file</description>
-      <author>&lt;luc.deschenaux@freesurf.ch&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>gltestsrc</name>
-      <longname>Video test source</longname>
-      <class>Source/Video</class>
-      <description>Creates a test video stream</description>
-      <author>David A. Schleef &lt;ds@schleef.org&gt;</author>
-      <pads>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:EGLImage), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>glvideomixer</name>
-      <longname>OpenGL video_mixer</longname>
-      <class>Filter/Effect/Video/Compositor</class>
-      <description>OpenGL video_mixer</description>
-      <author>Julien Isorce &lt;julien.isorce@gmail.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink_%u</name>
-          <direction>sink</direction>
-          <presence>request</presence>
-          <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, 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(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(meta:GstVideoGLTextureUploadMeta), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw, format=(string){ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-openjpeg.xml b/docs/plugins/inspect/plugin-openjpeg.xml
deleted file mode 100644
index 4051d7f..0000000
--- a/docs/plugins/inspect/plugin-openjpeg.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<plugin>
-  <name>openjpeg</name>
-  <description>OpenJPEG-based JPEG2000 image decoder/encoder</description>
-  <filename>../../ext/openjpeg/.libs/libgstopenjpeg.so</filename>
-  <basename>libgstopenjpeg.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>openjpegdec</name>
-      <longname>OpenJPEG JPEG2000 decoder</longname>
-      <class>Codec/Decoder/Video</class>
-      <description>Decode JPEG2000 streams</description>
-      <author>Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>image/x-j2c, colorspace=(string){ sRGB, sYUV, GRAY }; image/x-jpc, colorspace=(string){ sRGB, sYUV, GRAY }; image/jp2</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ ARGB64, ARGB, xRGB, AYUV64, Y444_10LE, I422_10LE, I420_10LE, AYUV, Y444, Y42B, I420, Y41B, YUV9, GRAY8, GRAY16_LE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>openjpegenc</name>
-      <longname>OpenJPEG JPEG2000 encoder</longname>
-      <class>Codec/Encoder/Video</class>
-      <description>Encode JPEG2000 streams</description>
-      <author>Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ ARGB64, ARGB, xRGB, AYUV64, Y444_10LE, I422_10LE, I420_10LE, AYUV, Y444, Y42B, I420, Y41B, YUV9, GRAY8, GRAY16_LE }, 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>image/x-j2c, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], num-components=(int)[ 1, 4 ], colorspace=(string){ sRGB, sYUV, GRAY }; image/x-jpc, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], num-components=(int)[ 1, 4 ], colorspace=(string){ sRGB, sYUV, GRAY }; image/jp2, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-opus.xml b/docs/plugins/inspect/plugin-opus.xml
index de54f9d..1694ac2 100644
--- a/docs/plugins/inspect/plugin-opus.xml
+++ b/docs/plugins/inspect/plugin-opus.xml
@@ -3,10 +3,10 @@
   <description>OPUS plugin library</description>
   <filename>../../ext/opus/.libs/libgstopus.so</filename>
   <basename>libgstopus.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
@@ -26,7 +26,7 @@
           <name>src</name>
           <direction>source</direction>
           <presence>always</presence>
-          <details>audio/x-raw, format=(string){ S16LE }, layout=(string)interleaved, rate=(int){ 48000, 24000, 16000, 12000, 8000 }, channels=(int)[ 1, 8 ]</details>
+          <details>audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int){ 48000, 24000, 16000, 12000, 8000 }, channels=(int)[ 1, 8 ]</details>
         </caps>
       </pads>
     </element>
@@ -83,7 +83,7 @@
           <name>sink</name>
           <direction>sink</direction>
           <presence>always</presence>
-          <details>application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)48000, encoding-name=(string)X-GST-OPUS-DRAFT-SPITTKA-00</details>
+          <details>application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)48000, encoding-name=(string){ OPUS, X-GST-OPUS-DRAFT-SPITTKA-00 }</details>
         </caps>
         <caps>
           <name>src</name>
@@ -110,7 +110,7 @@
           <name>src</name>
           <direction>source</direction>
           <presence>always</presence>
-          <details>application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)48000, encoding-name=(string)X-GST-OPUS-DRAFT-SPITTKA-00</details>
+          <details>application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)48000, encoding-name=(string){ OPUS, X-GST-OPUS-DRAFT-SPITTKA-00 }</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-pcapparse.xml b/docs/plugins/inspect/plugin-pcapparse.xml
index d8cd1a2..eda2665 100644
--- a/docs/plugins/inspect/plugin-pcapparse.xml
+++ b/docs/plugins/inspect/plugin-pcapparse.xml
@@ -3,7 +3,7 @@
   <description>Element parsing raw pcap streams</description>
   <filename>../../gst/pcapparse/.libs/libgstpcapparse.so</filename>
   <basename>libgstpcapparse.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer</package>
diff --git a/docs/plugins/inspect/plugin-pnm.xml b/docs/plugins/inspect/plugin-pnm.xml
index 80081d3..2d0de81 100644
--- a/docs/plugins/inspect/plugin-pnm.xml
+++ b/docs/plugins/inspect/plugin-pnm.xml
@@ -3,10 +3,10 @@
   <description>PNM plugin</description>
   <filename>../../gst/pnm/.libs/libgstpnm.so</filename>
   <basename>libgstpnm.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-rawparse.xml b/docs/plugins/inspect/plugin-rawparse.xml
index 9bf4682..025fcc0 100644
--- a/docs/plugins/inspect/plugin-rawparse.xml
+++ b/docs/plugins/inspect/plugin-rawparse.xml
@@ -3,10 +3,10 @@
   <description>Parses byte streams into raw frames</description>
   <filename>../../gst/rawparse/.libs/libgstrawparse.so</filename>
   <basename>libgstrawparse.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-removesilence.xml b/docs/plugins/inspect/plugin-removesilence.xml
index eb7ec23..e68fcde 100644
--- a/docs/plugins/inspect/plugin-removesilence.xml
+++ b/docs/plugins/inspect/plugin-removesilence.xml
@@ -3,10 +3,10 @@
   <description>Removes silence from an audio stream</description>
   <filename>../../gst/removesilence/.libs/libgstremovesilence.so</filename>
   <basename>libgstremovesilence.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-resindvd.xml b/docs/plugins/inspect/plugin-resindvd.xml
index b761510..71f6a1a 100644
--- a/docs/plugins/inspect/plugin-resindvd.xml
+++ b/docs/plugins/inspect/plugin-resindvd.xml
@@ -3,7 +3,7 @@
   <description>Resin DVD playback elements</description>
   <filename>../../ext/resindvd/.libs/libgstresindvd.so</filename>
   <basename>libgstresindvd.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>GPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer</package>
@@ -32,7 +32,7 @@
           <name>video</name>
           <direction>source</direction>
           <presence>sometimes</presence>
-          <details>video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
+          <details>video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
         </caps>
       </pads>
     </element>
diff --git a/docs/plugins/inspect/plugin-rfbsrc.xml b/docs/plugins/inspect/plugin-rfbsrc.xml
index 340855f..b7ca012 100644
--- a/docs/plugins/inspect/plugin-rfbsrc.xml
+++ b/docs/plugins/inspect/plugin-rfbsrc.xml
@@ -3,10 +3,10 @@
   <description>Connects to a VNC server and decodes RFB stream</description>
   <filename>../../gst/librfb/.libs/libgstrfbsrc.so</filename>
   <basename>libgstrfbsrc.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-rsvg.xml b/docs/plugins/inspect/plugin-rsvg.xml
deleted file mode 100644
index 7ac1011..0000000
--- a/docs/plugins/inspect/plugin-rsvg.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<plugin>
-  <name>rsvg</name>
-  <description>RSVG plugin library</description>
-  <filename>../../ext/rsvg/.libs/libgstrsvg.so</filename>
-  <basename>libgstrsvg.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>rsvgdec</name>
-      <longname>SVG image decoder</longname>
-      <class>Codec/Decoder/Image</class>
-      <description>Uses librsvg to decode SVG images</description>
-      <author>Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>image/svg+xml; image/svg</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string)BGRA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>rsvgoverlay</name>
-      <longname>RSVG overlay</longname>
-      <class>Filter/Editor/Video</class>
-      <description>Overlays SVG graphics over a video stream</description>
-      <author>Olivier Aubert &lt;olivier.aubert@liris.cnrs.fr&gt;</author>
-      <pads>
-        <caps>
-          <name>data_sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>image/svg+xml; image/svg; text/plain</details>
-        </caps>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string)BGRA, 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, format=(string)BGRA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-rtmp.xml b/docs/plugins/inspect/plugin-rtmp.xml
index 590ac61..cca1260 100644
--- a/docs/plugins/inspect/plugin-rtmp.xml
+++ b/docs/plugins/inspect/plugin-rtmp.xml
@@ -3,10 +3,10 @@
   <description>RTMP source and sink</description>
   <filename>../../ext/rtmp/.libs/libgstrtmp.so</filename>
   <basename>libgstrtmp.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-rtpvp8.xml b/docs/plugins/inspect/plugin-rtpvp8.xml
deleted file mode 100644
index 26a854b..0000000
--- a/docs/plugins/inspect/plugin-rtpvp8.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<plugin>
-  <name>rtpvp8</name>
-  <description>rtpvp8</description>
-  <filename>../../gst/rtpvp8/.libs/libgstrtpvp8.so</filename>
-  <basename>libgstrtpvp8.so</basename>
-  <version>1.1.0.1</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins git</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>rtpvp8depay</name>
-      <longname>RTP VP8 depayloader</longname>
-      <class>Codec/Depayloader/Network/RTP</class>
-      <description>Extracts VP8 video from RTP packets)</description>
-      <author>Sjoerd Simons &lt;sjoerd@luon.net&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>application/x-rtp, payload=(int)[ 96, 127 ], clock-rate=(int)90000, media=(string)video, encoding-name=(string)VP8-DRAFT-IETF-01</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-vp8</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>rtpvp8pay</name>
-      <longname>RTP VP8 payloader</longname>
-      <class>Codec/Payloader/Network/RTP</class>
-      <description>Puts VP8 video in RTP packets)</description>
-      <author>Sjoerd Simons &lt;sjoerd@luon.net&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-vp8</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>application/x-rtp, payload=(int)[ 96, 127 ], clock-rate=(int)90000, encoding-name=(string)VP8-DRAFT-IETF-01</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-sbc.xml b/docs/plugins/inspect/plugin-sbc.xml
deleted file mode 100644
index 02b3477..0000000
--- a/docs/plugins/inspect/plugin-sbc.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<plugin>
-  <name>sbc</name>
-  <description>SBC bluetooth audio support</description>
-  <filename>../../ext/sbc/.libs/libgstsbc.so</filename>
-  <basename>libgstsbc.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>sbcdec</name>
-      <longname>Bluetooth SBC audio decoder</longname>
-      <class>Codec/Decoder/Audio</class>
-      <description>Decode an SBC audio stream</description>
-      <author>Marcel Holtmann &lt;marcel@holtmann.org&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-sbc, channels=(int)[ 1, 2 ], rate=(int){ 16000, 32000, 44100, 48000 }, parsed=(boolean)true</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int){ 16000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ], layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>sbcenc</name>
-      <longname>Bluetooth SBC audio encoder</longname>
-      <class>Codec/Encoder/Audio</class>
-      <description>Encode an SBC audio stream</description>
-      <author>Marcel Holtmann &lt;marcel@holtmann.org&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int){ 16000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ]</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-sbc, rate=(int){ 16000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ], channel-mode=(string){ mono, dual, stereo, joint }, blocks=(int){ 4, 8, 12, 16 }, subbands=(int){ 4, 8 }, allocation-method=(string){ snr, loudness }, bitpool=(int)[ 2, 64 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-schro.xml b/docs/plugins/inspect/plugin-schro.xml
index 58bfd91..f341f85 100644
--- a/docs/plugins/inspect/plugin-schro.xml
+++ b/docs/plugins/inspect/plugin-schro.xml
@@ -3,10 +3,10 @@
   <description>Schroedinger plugin</description>
   <filename>../../ext/schroedinger/.libs/libgstschro.so</filename>
   <basename>libgstschro.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-sdp.xml b/docs/plugins/inspect/plugin-sdp.xml
index 523bc2f..d66e6c1 100644
--- a/docs/plugins/inspect/plugin-sdp.xml
+++ b/docs/plugins/inspect/plugin-sdp.xml
@@ -3,10 +3,10 @@
   <description>configure streaming sessions using SDP</description>
   <filename>../../gst/sdp/.libs/libgstsdpelem.so</filename>
   <basename>libgstsdpelem.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-segmentclip.xml b/docs/plugins/inspect/plugin-segmentclip.xml
index ed349d7..5a2c107 100644
--- a/docs/plugins/inspect/plugin-segmentclip.xml
+++ b/docs/plugins/inspect/plugin-segmentclip.xml
@@ -3,10 +3,10 @@
   <description>Segment clip elements</description>
   <filename>../../gst/segmentclip/.libs/libgstsegmentclip.so</filename>
   <basename>libgstsegmentclip.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-shm.xml b/docs/plugins/inspect/plugin-shm.xml
index b17849b..d201322 100644
--- a/docs/plugins/inspect/plugin-shm.xml
+++ b/docs/plugins/inspect/plugin-shm.xml
@@ -3,10 +3,10 @@
   <description>shared memory sink source</description>
   <filename>../../sys/shm/.libs/libgstshm.so</filename>
   <basename>libgstshm.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-smooth.xml b/docs/plugins/inspect/plugin-smooth.xml
index bdf2660..10dd3c0 100644
--- a/docs/plugins/inspect/plugin-smooth.xml
+++ b/docs/plugins/inspect/plugin-smooth.xml
@@ -3,10 +3,10 @@
   <description>Apply a smooth filter to an image</description>
   <filename>../../gst/smooth/.libs/libgstsmooth.so</filename>
   <basename>libgstsmooth.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-smoothstreaming.xml b/docs/plugins/inspect/plugin-smoothstreaming.xml
deleted file mode 100644
index e06e276..0000000
--- a/docs/plugins/inspect/plugin-smoothstreaming.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<plugin>
-  <name>smoothstreaming</name>
-  <description>Microsoft&apos;s Smooth Streaming format support </description>
-  <filename>../../ext/smoothstreaming/.libs/libgstsmoothstreaming.so</filename>
-  <basename>libgstsmoothstreaming.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>mssdemux</name>
-      <longname>Smooth Streaming demuxer</longname>
-      <class>Codec/Demuxer/Adaptive</class>
-      <description>Parse and demultiplex a Smooth Streaming manifest into audio and video streams</description>
-      <author>Thiago Santos &lt;thiago.sousa.santos@collabora.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>application/vnd.ms-sstr+xml</details>
-        </caps>
-        <caps>
-          <name>audio_%02u</name>
-          <direction>source</direction>
-          <presence>sometimes</presence>
-          <details>ANY</details>
-        </caps>
-        <caps>
-          <name>video_%02u</name>
-          <direction>source</direction>
-          <presence>sometimes</presence>
-          <details>ANY</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-sndfile.xml b/docs/plugins/inspect/plugin-sndfile.xml
deleted file mode 100644
index 9a73f03..0000000
--- a/docs/plugins/inspect/plugin-sndfile.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>sndfile</name>
-  <description>use libsndfile to read and write various audio formats</description>
-  <filename>../../ext/sndfile/.libs/libgstsndfile.so</filename>
-  <basename>libgstsndfile.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>sfdec</name>
-      <longname>Sndfile decoder</longname>
-      <class>Decoder/Audio</class>
-      <description>Read audio streams using libsndfile</description>
-      <author>Stefan Sauer &lt;ensonic@user.sf.net&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/ogg; audio/x-aiff; audio/x-au; audio/x-flac; audio/x-ircam; audio/x-nist; audio/x-paris; audio/x-raw; audio/x-rf64; audio/x-sds; audio/x-svx; audio/x-voc; audio/x-w64; audio/x-wav; audio/x-xi</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string){ F32LE, S32LE, S16LE }, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-soundtouch.xml b/docs/plugins/inspect/plugin-soundtouch.xml
index 0142318..f035cda 100644
--- a/docs/plugins/inspect/plugin-soundtouch.xml
+++ b/docs/plugins/inspect/plugin-soundtouch.xml
@@ -3,10 +3,10 @@
   <description>Audio Pitch Controller &amp; BPM Detection</description>
   <filename>../../ext/soundtouch/.libs/libgstsoundtouch.so</filename>
   <basename>libgstsoundtouch.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-spandsp.xml b/docs/plugins/inspect/plugin-spandsp.xml
index c1d4c71..967ac81 100644
--- a/docs/plugins/inspect/plugin-spandsp.xml
+++ b/docs/plugins/inspect/plugin-spandsp.xml
@@ -3,10 +3,10 @@
   <description>libspandsp plugin</description>
   <filename>../../ext/spandsp/.libs/libgstspandsp.so</filename>
   <basename>libgstspandsp.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-speed.xml b/docs/plugins/inspect/plugin-speed.xml
index 6e41064..62206f8 100644
--- a/docs/plugins/inspect/plugin-speed.xml
+++ b/docs/plugins/inspect/plugin-speed.xml
@@ -3,10 +3,10 @@
   <description>Set speed/pitch on audio/raw streams (resampler)</description>
   <filename>../../gst/speed/.libs/libgstspeed.so</filename>
   <basename>libgstspeed.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-srtp.xml b/docs/plugins/inspect/plugin-srtp.xml
deleted file mode 100644
index c573eb0..0000000
--- a/docs/plugins/inspect/plugin-srtp.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<plugin>
-  <name>srtp</name>
-  <description>GStreamer SRTP</description>
-  <filename>../../ext/srtp/.libs/libgstsrtp.so</filename>
-  <basename>libgstsrtp.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer</package>
-  <origin>http://gstreamer.net/</origin>
-  <elements>
-    <element>
-      <name>srtpdec</name>
-      <longname>SRTP decoder</longname>
-      <class>Filter/Network/SRTP</class>
-      <description>A SRTP and SRTCP decoder</description>
-      <author>Gabriel Millaire &lt;millaire.gabriel@collabora.com&gt;</author>
-      <pads>
-        <caps>
-          <name>rtcp_sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>application/x-srtcp</details>
-        </caps>
-        <caps>
-          <name>rtp_sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>application/x-srtp</details>
-        </caps>
-        <caps>
-          <name>rtcp_src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>application/x-rtcp</details>
-        </caps>
-        <caps>
-          <name>rtp_src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>application/x-rtp</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>srtpenc</name>
-      <longname>SRTP encoder</longname>
-      <class>Filter/Network/SRTP</class>
-      <description>A SRTP and SRTCP encoder</description>
-      <author>Gabriel Millaire &lt;millaire.gabriel@collabora.com&gt;</author>
-      <pads>
-        <caps>
-          <name>rtcp_sink_%u</name>
-          <direction>sink</direction>
-          <presence>request</presence>
-          <details>application/x-rtcp</details>
-        </caps>
-        <caps>
-          <name>rtp_sink_%u</name>
-          <direction>sink</direction>
-          <presence>request</presence>
-          <details>application/x-rtp</details>
-        </caps>
-        <caps>
-          <name>rtcp_src_%u</name>
-          <direction>source</direction>
-          <presence>sometimes</presence>
-          <details>application/x-srtcp</details>
-        </caps>
-        <caps>
-          <name>rtp_src_%u</name>
-          <direction>source</direction>
-          <presence>sometimes</presence>
-          <details>application/x-srtp</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-stereo.xml b/docs/plugins/inspect/plugin-stereo.xml
deleted file mode 100644
index ff24584..0000000
--- a/docs/plugins/inspect/plugin-stereo.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>stereo</name>
-  <description>Muck with the stereo signal, enhance it&apos;s &apos;stereo-ness&apos;</description>
-  <filename>../../gst/stereo/.libs/libgststereo.so</filename>
-  <basename>libgststereo.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>stereo</name>
-      <longname>Stereo effect</longname>
-      <class>Filter/Effect/Audio</class>
-      <description>Muck with the stereo signal to enhance its &apos;stereo-ness&apos;</description>
-      <author>Erik Walthinsen &lt;omega@cse.ogi.edu&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int)[ 1, 2147483647 ], channels=(int)2</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int)[ 1, 2147483647 ], channels=(int)2</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-subenc.xml b/docs/plugins/inspect/plugin-subenc.xml
index 39ddd84..8f32467 100644
--- a/docs/plugins/inspect/plugin-subenc.xml
+++ b/docs/plugins/inspect/plugin-subenc.xml
@@ -3,10 +3,10 @@
   <description>subtitle encoders</description>
   <filename>../../gst/subenc/.libs/libgstsubenc.so</filename>
   <basename>libgstsubenc.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-uvch264.xml b/docs/plugins/inspect/plugin-uvch264.xml
deleted file mode 100644
index 8f043f4..0000000
--- a/docs/plugins/inspect/plugin-uvch264.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<plugin>
-  <name>uvch264</name>
-  <description>UVC compliant H264 encoding cameras plugin</description>
-  <filename>../../sys/uvch264/.libs/libgstuvch264.so</filename>
-  <basename>libgstuvch264.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>uvch264mjpgdemux</name>
-      <longname>UVC H264 MJPG Demuxer</longname>
-      <class>Video/Demuxer</class>
-      <description>Demux UVC H264 auxiliary streams from MJPG images</description>
-      <author>Youness Alaoui &lt;youness.alaoui@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>image/jpeg, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-        <caps>
-          <name>h264</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-h264, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-        <caps>
-          <name>jpeg</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>image/jpeg, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-        <caps>
-          <name>nv12</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string)NV12, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-        <caps>
-          <name>yuy2</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string)YUY2, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>uvch264src</name>
-      <longname>UVC H264 Source</longname>
-      <class>Source/Video</class>
-      <description>UVC H264 Encoding camera source</description>
-      <author>Youness Alaoui &lt;youness.alaoui@collabora.co.uk&gt;</author>
-      <pads>
-        <caps>
-          <name>imgsrc</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>EMPTY</details>
-        </caps>
-        <caps>
-          <name>vfsrc</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-        <caps>
-          <name>vidsrc</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], stream-format=(string){ byte-stream, avc }, alignment=(string){ au }, profile=(string){ high, main, baseline, constrained-baseline }</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-videofiltersbad.xml b/docs/plugins/inspect/plugin-videofiltersbad.xml
deleted file mode 100644
index e6ccfba..0000000
--- a/docs/plugins/inspect/plugin-videofiltersbad.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<plugin>
-  <name>videofiltersbad</name>
-  <description>Video filters in gst-plugins-bad</description>
-  <filename>../../gst/videofilters/.libs/libgstvideofiltersbad.so</filename>
-  <basename>libgstvideofiltersbad.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>scenechange</name>
-      <longname>Scene change detector</longname>
-      <class>Video/Filter</class>
-      <description>Detects scene changes in video</description>
-      <author>David Schleef &lt;ds@entropywave.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, Y42B, Y41B, Y444 }, 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, format=(string){ I420, Y42B, Y41B, Y444 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>videodiff</name>
-      <longname>FIXME Long name</longname>
-      <class>Generic</class>
-      <description>FIXME Description</description>
-      <author>FIXME &lt;fixme@example.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, Y444, Y42B, UYVY, RGBA }, 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, format=(string){ I420, Y444, Y42B, UYVY, RGBA }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>zebrastripe</name>
-      <longname>Zebra stripe overlay</longname>
-      <class>Filter/Analysis</class>
-      <description>Overlays zebra striping on overexposed areas of video</description>
-      <author>David Schleef &lt;ds@entropywave.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, Y444, Y42B, Y41B, YUY2, UYVY, AYUV }, 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, format=(string){ I420, Y444, Y42B, Y41B, YUY2, UYVY, AYUV }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-videoparsersbad.xml b/docs/plugins/inspect/plugin-videoparsersbad.xml
index 23965be..01fe187 100644
--- a/docs/plugins/inspect/plugin-videoparsersbad.xml
+++ b/docs/plugins/inspect/plugin-videoparsersbad.xml
@@ -3,10 +3,10 @@
   <description>videoparsers</description>
   <filename>../../gst/videoparsers/.libs/libgstvideoparsersbad.so</filename>
   <basename>libgstvideoparsersbad.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-videosignal.xml b/docs/plugins/inspect/plugin-videosignal.xml
deleted file mode 100644
index c61f4a8..0000000
--- a/docs/plugins/inspect/plugin-videosignal.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<plugin>
-  <name>videosignal</name>
-  <description>Various video signal analysers</description>
-  <filename>../../gst/videosignal/.libs/libgstvideosignal.so</filename>
-  <basename>libgstvideosignal.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>simplevideomark</name>
-      <longname>Video marker</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Marks a video signal with a pattern</description>
-      <author>Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, YV12, Y41B, Y42B, Y444, YUY2, UYVY, AYUV, YVYU }, 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, format=(string){ I420, YV12, Y41B, Y42B, Y444, YUY2, UYVY, AYUV, YVYU }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>simplevideomarkdetect</name>
-      <longname>Video detecter</longname>
-      <class>Filter/Effect/Video</class>
-      <description>Detect patterns in a video signal</description>
-      <author>Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, YV12, Y41B, Y42B, Y444, YUY2, UYVY, AYUV, YVYU }, 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, format=(string){ I420, YV12, Y41B, Y42B, Y444, YUY2, UYVY, AYUV, YVYU }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-    <element>
-      <name>videoanalyse</name>
-      <longname>Video analyser</longname>
-      <class>Filter/Analyzer/Video</class>
-      <description>Analyse video signal</description>
-      <author>Wim Taymans &lt;wim@fluendo.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ I420, YV12, Y444, Y42B, Y41B }, 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, format=(string){ I420, YV12, Y444, Y42B, Y41B }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-vmnc.xml b/docs/plugins/inspect/plugin-vmnc.xml
deleted file mode 100644
index e11aded..0000000
--- a/docs/plugins/inspect/plugin-vmnc.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>vmnc</name>
-  <description>VmWare Video Codec plugins</description>
-  <filename>../../gst/vmnc/.libs/libgstvmnc.so</filename>
-  <basename>libgstvmnc.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>vmncdec</name>
-      <longname>VMnc video decoder</longname>
-      <class>Codec/Decoder/Video</class>
-      <description>Decode VmWare video to raw (RGB) video</description>
-      <author>Michael Smith &lt;msmith@xiph.org&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-vmnc, version=(int)1, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ]</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ RGBx, BGRx, xRGB, xBGR, RGB15, BGR15, RGB16, BGR16, GRAY8 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-voaacenc.xml b/docs/plugins/inspect/plugin-voaacenc.xml
index d08683c..bea79cb 100644
--- a/docs/plugins/inspect/plugin-voaacenc.xml
+++ b/docs/plugins/inspect/plugin-voaacenc.xml
@@ -3,10 +3,10 @@
   <description>AAC audio encoder</description>
   <filename>../../ext/voaacenc/.libs/libgstvoaacenc.so</filename>
   <basename>libgstvoaacenc.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-voamrwbenc.xml b/docs/plugins/inspect/plugin-voamrwbenc.xml
index 5bd740d..be490fc 100644
--- a/docs/plugins/inspect/plugin-voamrwbenc.xml
+++ b/docs/plugins/inspect/plugin-voamrwbenc.xml
@@ -3,10 +3,10 @@
   <description>Adaptive Multi-Rate Wide-Band Encoder</description>
   <filename>../../ext/voamrwbenc/.libs/libgstvoamrwbenc.so</filename>
   <basename>libgstvoamrwbenc.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>unknown</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-waylandsink.xml b/docs/plugins/inspect/plugin-waylandsink.xml
index 8e398c1..3b7cde6 100644
--- a/docs/plugins/inspect/plugin-waylandsink.xml
+++ b/docs/plugins/inspect/plugin-waylandsink.xml
@@ -3,10 +3,10 @@
   <description>Wayland Video Sink</description>
   <filename>../../ext/wayland/.libs/libgstwaylandsink.so</filename>
   <basename>libgstwaylandsink.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/docs/plugins/inspect/plugin-webp.xml b/docs/plugins/inspect/plugin-webp.xml
deleted file mode 100644
index 25408ed..0000000
--- a/docs/plugins/inspect/plugin-webp.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>webp</name>
-  <description>WebP plugin</description>
-  <filename>../../ext/webp/.libs/libgstwebp.so</filename>
-  <basename>libgstwebp.so</basename>
-  <version>1.4.5</version>
-  <license>LGPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>webpdec</name>
-      <longname>WebP image decoder</longname>
-      <class>Codec/Decoder/Image</class>
-      <description>Decode images from WebP format</description>
-      <author>Sreerenj Balachandran &lt;sreerenj.balachandrn@intel.com&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>image/webp</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ RGB, RGBA, BGR, BGRA, ARGB, RGB16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-wildmidi.xml b/docs/plugins/inspect/plugin-wildmidi.xml
deleted file mode 100644
index 3f93418..0000000
--- a/docs/plugins/inspect/plugin-wildmidi.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>wildmidi</name>
-  <description>Wildmidi Plugin</description>
-  <filename>../../ext/timidity/.libs/libgstwildmidi.so</filename>
-  <basename>libgstwildmidi.so</basename>
-  <version>1.4.5</version>
-  <license>GPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>wildmidi</name>
-      <longname>WildMidi</longname>
-      <class>Codec/Decoder/Audio</class>
-      <description>Midi Synthesizer Element</description>
-      <author>Wouter Paesen &lt;wouter@blue-gate.be&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>audio/midi; audio/riff-midi</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>audio/x-raw, format=(string)S16LE, rate=(int)44100, channels=(int)2, layout=(string)interleaved</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-y4mdec.xml b/docs/plugins/inspect/plugin-y4mdec.xml
index 9ecdaf0..d3ff2bf 100644
--- a/docs/plugins/inspect/plugin-y4mdec.xml
+++ b/docs/plugins/inspect/plugin-y4mdec.xml
@@ -3,7 +3,7 @@
   <description>Demuxes/decodes YUV4MPEG streams</description>
   <filename>../../gst/y4m/.libs/libgsty4mdec.so</filename>
   <basename>libgsty4mdec.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
   <package>GStreamer Bad Plug-ins</package>
diff --git a/docs/plugins/inspect/plugin-yadif.xml b/docs/plugins/inspect/plugin-yadif.xml
deleted file mode 100644
index 617fc7b..0000000
--- a/docs/plugins/inspect/plugin-yadif.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<plugin>
-  <name>yadif</name>
-  <description>YADIF deinterlacing filter</description>
-  <filename>../../gst/yadif/.libs/libgstyadif.so</filename>
-  <basename>libgstyadif.so</basename>
-  <version>1.4.5</version>
-  <license>GPL</license>
-  <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins</package>
-  <origin>Unknown package origin</origin>
-  <elements>
-    <element>
-      <name>yadif</name>
-      <longname>YADIF deinterlacer</longname>
-      <class>Video/Filter</class>
-      <description>Deinterlace video using YADIF filter</description>
-      <author>David Schleef &lt;ds@schleef.org&gt;</author>
-      <pads>
-        <caps>
-          <name>sink</name>
-          <direction>sink</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ Y42B, I420, Y444 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], interlace-mode=(string){ interleaved, mixed, progressive }</details>
-        </caps>
-        <caps>
-          <name>src</name>
-          <direction>source</direction>
-          <presence>always</presence>
-          <details>video/x-raw, format=(string){ Y42B, I420, Y444 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], interlace-mode=(string)progressive</details>
-        </caps>
-      </pads>
-    </element>
-  </elements>
-</plugin>
\ No newline at end of file
diff --git a/docs/plugins/inspect/plugin-zbar.xml b/docs/plugins/inspect/plugin-zbar.xml
index 6f7854b..54be397 100644
--- a/docs/plugins/inspect/plugin-zbar.xml
+++ b/docs/plugins/inspect/plugin-zbar.xml
@@ -3,10 +3,10 @@
   <description>zbar barcode scanner</description>
   <filename>../../ext/zbar/.libs/libgstzbar.so</filename>
   <basename>libgstzbar.so</basename>
-  <version>1.4.5</version>
+  <version>1.5.0.1</version>
   <license>LGPL</license>
   <source>gst-plugins-bad</source>
-  <package>GStreamer Bad Plug-ins source release</package>
+  <package>GStreamer Bad Plug-ins git</package>
   <origin>Unknown package origin</origin>
   <elements>
     <element>
diff --git a/ext/Makefile.am b/ext/Makefile.am
index 5701057..394c71d 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -22,6 +22,12 @@
 AUDIOFILE_DIR=
 # endif
 
+if USE_BS2B
+BS2B_DIR=bs2b
+else
+BS2B_DIR=
+endif
+
 if USE_BZ2
 BZ2_DIR=bz2
 else
@@ -142,6 +148,12 @@
 LV2_DIR =
 endif
 
+if USE_LIBDE265
+LIBDE265_DIR = libde265
+else
+LIBDE265_DIR =
+endif
+
 # if USE_LIBFAME
 # LIBFAME_DIR=libfame
 # else
@@ -196,12 +208,6 @@
 MUSEPACK_DIR=
 endif
 
-if USE_MYTHTV
-MYTHTV_DIR=mythtv
-else
-MYTHTV_DIR=
-endif
-
 if USE_NAS
 NAS_DIR=nas
 else
@@ -238,6 +244,12 @@
 OPENEXR_DIR =
 endif
 
+if USE_OPENH264
+OPENH264_DIR = openh264
+else
+OPENH264_DIR =
+endif
+
 if USE_OPENNI2
 OPENNI2_DIR=openni2
 else
@@ -394,12 +406,25 @@
 WEBP_DIR=
 endif
 
+if USE_X265
+X265_DIR=x265
+else
+X265_DIR=
+endif
+
+if USE_DTLS
+DTLS_DIR=dtls
+else
+DTLS_DIR=
+endif
+
 SUBDIRS=\
 	$(VOAACENC_DIR) \
 	$(ASSRENDER_DIR) \
 	$(VOAMRWBENC_DIR) \
 	$(APEXSINK_DIR) \
 	$(AUDIOFILE_DIR) \
+	$(BS2B_DIR) \
 	$(BZ2_DIR) \
 	$(CHROMAPRINT_DIR) \
 	$(CURL_DIR) \
@@ -421,6 +446,7 @@
 	$(KATE_DIR) \
 	$(LADSPA_DIR) \
 	$(LV2_DIR) \
+	$(LIBDE265_DIR) \
 	$(LIBFAME_DIR) \
 	$(LIBMMS_DIR) \
 	$(LIBVISUAL_DIR) \
@@ -430,13 +456,13 @@
 	$(MIMIC_DIR) \
 	$(MPLEX_DIR) \
 	$(MUSEPACK_DIR) \
-	$(MYTHTV_DIR) \
 	$(NAS_DIR) \
 	$(NEON_DIR) \
 	$(OFA_DIR) \
 	$(OPENAL_DIR) \
 	$(OPENCV_DIR) \
 	$(OPENEXR_DIR) \
+	$(OPENH264_DIR) \
 	$(OPENJPEG_DIR) \
 	$(OPENNI2_DIR) \
 	$(OPUS_DIR) \
@@ -459,11 +485,14 @@
 	$(ZBAR_DIR) \
 	$(RTMP_DIR) \
 	$(HLS_DIR) \
-	$(WEBP_DIR)
+	$(WEBP_DIR) \
+	$(X265_DIR) \
+	$(DTLS_DIR)
 
 DIST_SUBDIRS = \
 	assrender \
 	apexsink \
+	bs2b \
 	bz2 \
 	chromaprint \
 	curl \
@@ -480,6 +509,7 @@
 	hls \
 	ladspa \
 	kate \
+	libde265 \
 	libmms \
 	libvisual \
 	lv2 \
@@ -492,13 +522,13 @@
 	mpg123 \
 	mplex \
 	musepack \
-	mythtv \
 	nas \
 	neon \
 	ofa \
 	openal \
 	opencv \
 	openexr \
+	openh264 \
 	openni2 \
 	openjpeg \
 	opus \
@@ -522,6 +552,8 @@
 	xvid \
 	zbar \
 	rtmp \
-	webp
+	webp \
+	x265 \
+	dtls
 
 include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/ext/Makefile.in b/ext/Makefile.in
index b782b71..31197d9 100644
--- a/ext/Makefile.in
+++ b/ext/Makefile.in
@@ -93,6 +93,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -106,7 +107,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -223,8 +223,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -263,7 +267,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -271,6 +274,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -320,8 +325,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -400,7 +403,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -409,7 +411,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -422,7 +423,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -447,6 +447,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -520,10 +522,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -549,6 +555,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -585,6 +594,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -625,17 +635,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -652,6 +661,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -714,8 +724,10 @@
 # AUDIOFILE_DIR=audiofile
 # else
 AUDIOFILE_DIR = 
-@USE_BZ2_FALSE@BZ2_DIR = 
+@USE_BS2B_FALSE@BS2B_DIR = 
 # endif
+@USE_BS2B_TRUE@BS2B_DIR = bs2b
+@USE_BZ2_FALSE@BZ2_DIR = 
 @USE_BZ2_TRUE@BZ2_DIR = bz2
 @USE_CHROMAPRINT_FALSE@CHROMAPRINT_DIR = 
 @USE_CHROMAPRINT_TRUE@CHROMAPRINT_DIR = chromaprint
@@ -759,6 +771,8 @@
 @USE_LADSPA_TRUE@LADSPA_DIR = ladspa
 @USE_LV2_FALSE@LV2_DIR = 
 @USE_LV2_TRUE@LV2_DIR = lv2
+@USE_LIBDE265_FALSE@LIBDE265_DIR = 
+@USE_LIBDE265_TRUE@LIBDE265_DIR = libde265
 
 # if USE_LIBFAME
 # LIBFAME_DIR=libfame
@@ -781,8 +795,6 @@
 @USE_MPLEX_TRUE@MPLEX_DIR = mplex
 @USE_MUSEPACK_FALSE@MUSEPACK_DIR = 
 @USE_MUSEPACK_TRUE@MUSEPACK_DIR = musepack
-@USE_MYTHTV_FALSE@MYTHTV_DIR = 
-@USE_MYTHTV_TRUE@MYTHTV_DIR = mythtv
 @USE_NAS_FALSE@NAS_DIR = 
 @USE_NAS_TRUE@NAS_DIR = nas
 @USE_NEON_FALSE@NEON_DIR = 
@@ -795,6 +807,8 @@
 @USE_OPENCV_TRUE@OPENCV_DIR = opencv
 @USE_OPENEXR_FALSE@OPENEXR_DIR = 
 @USE_OPENEXR_TRUE@OPENEXR_DIR = openexr
+@USE_OPENH264_FALSE@OPENH264_DIR = 
+@USE_OPENH264_TRUE@OPENH264_DIR = openh264
 @USE_OPENNI2_FALSE@OPENNI2_DIR = 
 @USE_OPENNI2_TRUE@OPENNI2_DIR = openni2
 @USE_OPENJPEG_FALSE@OPENJPEG_DIR = 
@@ -849,12 +863,17 @@
 @USE_HLS_TRUE@HLS_DIR = hls
 @USE_WEBP_FALSE@WEBP_DIR = 
 @USE_WEBP_TRUE@WEBP_DIR = webp
+@USE_X265_FALSE@X265_DIR = 
+@USE_X265_TRUE@X265_DIR = x265
+@USE_DTLS_FALSE@DTLS_DIR = 
+@USE_DTLS_TRUE@DTLS_DIR = dtls
 SUBDIRS = \
 	$(VOAACENC_DIR) \
 	$(ASSRENDER_DIR) \
 	$(VOAMRWBENC_DIR) \
 	$(APEXSINK_DIR) \
 	$(AUDIOFILE_DIR) \
+	$(BS2B_DIR) \
 	$(BZ2_DIR) \
 	$(CHROMAPRINT_DIR) \
 	$(CURL_DIR) \
@@ -876,6 +895,7 @@
 	$(KATE_DIR) \
 	$(LADSPA_DIR) \
 	$(LV2_DIR) \
+	$(LIBDE265_DIR) \
 	$(LIBFAME_DIR) \
 	$(LIBMMS_DIR) \
 	$(LIBVISUAL_DIR) \
@@ -885,13 +905,13 @@
 	$(MIMIC_DIR) \
 	$(MPLEX_DIR) \
 	$(MUSEPACK_DIR) \
-	$(MYTHTV_DIR) \
 	$(NAS_DIR) \
 	$(NEON_DIR) \
 	$(OFA_DIR) \
 	$(OPENAL_DIR) \
 	$(OPENCV_DIR) \
 	$(OPENEXR_DIR) \
+	$(OPENH264_DIR) \
 	$(OPENJPEG_DIR) \
 	$(OPENNI2_DIR) \
 	$(OPUS_DIR) \
@@ -914,11 +934,14 @@
 	$(ZBAR_DIR) \
 	$(RTMP_DIR) \
 	$(HLS_DIR) \
-	$(WEBP_DIR)
+	$(WEBP_DIR) \
+	$(X265_DIR) \
+	$(DTLS_DIR)
 
 DIST_SUBDIRS = \
 	assrender \
 	apexsink \
+	bs2b \
 	bz2 \
 	chromaprint \
 	curl \
@@ -935,6 +958,7 @@
 	hls \
 	ladspa \
 	kate \
+	libde265 \
 	libmms \
 	libvisual \
 	lv2 \
@@ -947,13 +971,13 @@
 	mpg123 \
 	mplex \
 	musepack \
-	mythtv \
 	nas \
 	neon \
 	ofa \
 	openal \
 	opencv \
 	openexr \
+	openh264 \
 	openni2 \
 	openjpeg \
 	opus \
@@ -977,7 +1001,9 @@
 	xvid \
 	zbar \
 	rtmp \
-	webp
+	webp \
+	x265 \
+	dtls
 
 all: all-recursive
 
diff --git a/ext/apexsink/Makefile.in b/ext/apexsink/Makefile.in
index b9835fb..42c520c 100644
--- a/ext/apexsink/Makefile.in
+++ b/ext/apexsink/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/apexsink/gstapexsink.c b/ext/apexsink/gstapexsink.c
index d840ee0..c008e18 100644
--- a/ext/apexsink/gstapexsink.c
+++ b/ext/apexsink/gstapexsink.c
@@ -76,7 +76,7 @@
 gst_apexsink_jackstatus_get_type (void)
 {
   static GType jackstatus_type = 0;
-  static GEnumValue jackstatus[] = {
+  static const GEnumValue jackstatus[] = {
     {GST_APEX_JACK_STATUS_UNDEFINED, "GST_APEX_JACK_STATUS_UNDEFINED",
         "Jack status undefined"},
     {GST_APEX_JACK_STATUS_DISCONNECTED, "GST_APEX_JACK_STATUS_DISCONNECTED",
@@ -97,7 +97,7 @@
 gst_apexsink_jacktype_get_type (void)
 {
   static GType jacktype_type = 0;
-  static GEnumValue jacktype[] = {
+  static const GEnumValue jacktype[] = {
     {GST_APEX_JACK_TYPE_UNDEFINED, "GST_APEX_JACK_TYPE_UNDEFINED",
         "Undefined jack type"},
     {GST_APEX_JACK_TYPE_ANALOG, "GST_APEX_JACK_TYPE_ANALOG", "Analog jack"},
@@ -116,7 +116,7 @@
 gst_apexsink_generation_get_type (void)
 {
   static GType generation_type = 0;
-  static GEnumValue generation[] = {
+  static const GEnumValue generation[] = {
     {GST_APEX_GENERATION_ONE, "generation-one",
         "First generation (e.g., original AirPort Express)"},
     {GST_APEX_GENERATION_TWO, "generation-two",
@@ -135,7 +135,7 @@
 gst_apexsink_transport_protocol_get_type (void)
 {
   static GType transport_protocol_type = 0;
-  static GEnumValue transport_protocol[] = {
+  static const GEnumValue transport_protocol[] = {
     {GST_APEX_TCP, "tcp", "TCP"},
     {GST_APEX_UDP, "udp", "UDP"},
     {0, NULL, NULL},
diff --git a/ext/assrender/Makefile.in b/ext/assrender/Makefile.in
index 8a5d2e3..0574ae1 100644
--- a/ext/assrender/Makefile.in
+++ b/ext/assrender/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/assrender/gstassrender.c b/ext/assrender/gstassrender.c
index 5585bf7..711ab04 100644
--- a/ext/assrender/gstassrender.c
+++ b/ext/assrender/gstassrender.c
@@ -31,10 +31,6 @@
  * </refsect2>
  */
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -119,11 +115,14 @@
 G_DEFINE_TYPE (GstAssRender, gst_ass_render, GST_TYPE_ELEMENT);
 
 static GstCaps *gst_ass_render_get_videosink_caps (GstPad * pad,
-    GstCaps * filter);
-static GstCaps *gst_ass_render_get_src_caps (GstPad * pad, GstCaps * filter);
+    GstAssRender * render, GstCaps * filter);
+static GstCaps *gst_ass_render_get_src_caps (GstPad * pad,
+    GstAssRender * render, GstCaps * filter);
 
-static gboolean gst_ass_render_setcaps_video (GstPad * pad, GstCaps * caps);
-static gboolean gst_ass_render_setcaps_text (GstPad * pad, GstCaps * caps);
+static gboolean gst_ass_render_setcaps_video (GstPad * pad,
+    GstAssRender * render, GstCaps * caps);
+static gboolean gst_ass_render_setcaps_text (GstPad * pad,
+    GstAssRender * render, GstCaps * caps);
 
 static GstFlowReturn gst_ass_render_chain_video (GstPad * pad,
     GstObject * parent, GstBuffer * buf);
@@ -429,7 +428,7 @@
       GstCaps *filter, *caps;
 
       gst_query_parse_caps (query, &filter);
-      caps = gst_ass_render_get_src_caps (pad, filter);
+      caps = gst_ass_render_get_src_caps (pad, (GstAssRender *) parent, filter);
       gst_query_set_caps_result (query, caps);
       gst_caps_unref (caps);
       res = TRUE;
@@ -581,9 +580,9 @@
 }
 
 static GstCaps *
-gst_ass_render_get_videosink_caps (GstPad * pad, GstCaps * filter)
+gst_ass_render_get_videosink_caps (GstPad * pad, GstAssRender * render,
+    GstCaps * filter)
 {
-  GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
   GstPad *srcpad = render->srcpad;
   GstCaps *peer_caps = NULL, *caps = NULL, *assrender_filter = NULL;
 
@@ -638,15 +637,13 @@
 
   GST_DEBUG_OBJECT (render, "returning  %" GST_PTR_FORMAT, caps);
 
-  gst_object_unref (render);
-
   return caps;
 }
 
 static GstCaps *
-gst_ass_render_get_src_caps (GstPad * pad, GstCaps * filter)
+gst_ass_render_get_src_caps (GstPad * pad, GstAssRender * render,
+    GstCaps * filter)
 {
-  GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
   GstPad *sinkpad = render->video_sinkpad;
   GstCaps *peer_caps = NULL, *caps = NULL, *assrender_filter = NULL;
 
@@ -703,8 +700,6 @@
 
   GST_DEBUG_OBJECT (render, "returning  %" GST_PTR_FORMAT, caps);
 
-  gst_object_unref (render);
-
   return caps;
 }
 
@@ -784,9 +779,9 @@
 }
 
 static gboolean
-gst_ass_render_setcaps_video (GstPad * pad, GstCaps * caps)
+gst_ass_render_setcaps_video (GstPad * pad, GstAssRender * render,
+    GstCaps * caps)
 {
-  GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
   GstQuery *query;
   gboolean ret = FALSE;
   gint par_n = 1, par_d = 1;
@@ -819,13 +814,8 @@
     overlay_caps = gst_caps_copy (caps);
 
     f = gst_caps_get_features (overlay_caps, 0);
-    if (f == NULL) {
-      f = gst_caps_features_new
-          (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, NULL);
-    } else {
-      gst_caps_features_add (f,
-          GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
-    }
+    gst_caps_features_add (f,
+        GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
 
     ret = gst_pad_peer_query_accept_caps (render->srcpad, overlay_caps);
     GST_DEBUG_OBJECT (render, "Downstream accepts the overlay meta: %d", ret);
@@ -904,7 +894,6 @@
   GST_DEBUG_OBJECT (render, "ass renderer setup complete");
 
 out:
-  gst_object_unref (render);
 
   return ret;
 
@@ -924,9 +913,9 @@
 }
 
 static gboolean
-gst_ass_render_setcaps_text (GstPad * pad, GstCaps * caps)
+gst_ass_render_setcaps_text (GstPad * pad, GstAssRender * render,
+    GstCaps * caps)
 {
-  GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
   GstStructure *structure;
   const GValue *value;
   GstBuffer *priv;
@@ -968,8 +957,6 @@
   }
   g_mutex_unlock (&render->ass_mutex);
 
-  gst_object_unref (render);
-
   return ret;
 }
 
@@ -1511,7 +1498,7 @@
       GstCaps *caps;
 
       gst_event_parse_caps (event, &caps);
-      ret = gst_ass_render_setcaps_video (pad, caps);
+      ret = gst_ass_render_setcaps_video (pad, render, caps);
       gst_event_unref (event);
       break;
     }
@@ -1595,7 +1582,9 @@
       GstCaps *filter, *caps;
 
       gst_query_parse_caps (query, &filter);
-      caps = gst_ass_render_get_videosink_caps (pad, filter);
+      caps =
+          gst_ass_render_get_videosink_caps (pad, (GstAssRender *) parent,
+          filter);
       gst_query_set_caps_result (query, caps);
       gst_caps_unref (caps);
       res = TRUE;
@@ -1624,7 +1613,7 @@
       GstCaps *caps;
 
       gst_event_parse_caps (event, &caps);
-      ret = gst_ass_render_setcaps_text (pad, caps);
+      ret = gst_ass_render_setcaps_text (pad, render, caps);
       gst_event_unref (event);
       break;
     }
diff --git a/ext/bs2b/Makefile.am b/ext/bs2b/Makefile.am
new file mode 100644
index 0000000..8516ec9
--- /dev/null
+++ b/ext/bs2b/Makefile.am
@@ -0,0 +1,15 @@
+plugin_LTLIBRARIES = libgstbs2b.la
+
+libgstbs2b_la_SOURCES = gstbs2b.c gstbs2b.h
+
+libgstbs2b_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
+	$(BS2B_CFLAGS)
+libgstbs2b_la_LIBADD = \
+	$(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) $(GST_LIBS) \
+	$(BS2B_LIBS)
+libgstbs2b_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstbs2b_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS = gstbs2b.h
diff --git a/ext/mythtv/Makefile.in b/ext/bs2b/Makefile.in
similarity index 91%
rename from ext/mythtv/Makefile.in
rename to ext/bs2b/Makefile.in
index 055754c..c32baff 100644
--- a/ext/mythtv/Makefile.in
+++ b/ext/bs2b/Makefile.in
@@ -80,7 +80,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = ext/mythtv
+subdir = ext/bs2b
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -154,18 +154,19 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstmythtvsrc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+libgstbs2b_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
-am_libgstmythtvsrc_la_OBJECTS = libgstmythtvsrc_la-gstmythtvsrc.lo
-libgstmythtvsrc_la_OBJECTS = $(am_libgstmythtvsrc_la_OBJECTS)
+am_libgstbs2b_la_OBJECTS = libgstbs2b_la-gstbs2b.lo
+libgstbs2b_la_OBJECTS = $(am_libgstbs2b_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstmythtvsrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) \
-	$(libgstmythtvsrc_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstbs2b_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(libgstbs2b_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CCLD) $(libgstbs2b_la_CFLAGS) $(CFLAGS) \
+	$(libgstbs2b_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -200,8 +201,8 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstmythtvsrc_la_SOURCES)
-DIST_SOURCES = $(libgstmythtvsrc_la_SOURCES)
+SOURCES = $(libgstbs2b_la_SOURCES)
+DIST_SOURCES = $(libgstbs2b_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -244,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -724,25 +735,20 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstmythtvsrc.la
-libgstmythtvsrc_la_SOURCES = \
-		gstmythtvsrc.c
+plugin_LTLIBRARIES = libgstbs2b.la
+libgstbs2b_la_SOURCES = gstbs2b.c gstbs2b.h
+libgstbs2b_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
+	$(BS2B_CFLAGS)
 
-libgstmythtvsrc_la_CFLAGS = \
-	$(GST_CFLAGS) \
-	$(GMYTH_CFLAGS)
+libgstbs2b_la_LIBADD = \
+	$(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) $(GST_LIBS) \
+	$(BS2B_LIBS)
 
-libgstmythtvsrc_la_LDFLAGS = \
-	$(GST_PLUGIN_LDFLAGS)
-
-libgstmythtvsrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-libgstmythtvsrc_la_LIBADD = \
-	$(GST_BASE_LIBS) \
-	$(GMYTH_LIBS)
-
-noinst_HEADERS = \
-	gstmythtvsrc.h
-
+libgstbs2b_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstbs2b_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+noinst_HEADERS = gstbs2b.h
 all: all-am
 
 .SUFFIXES:
@@ -756,9 +762,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/mythtv/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/bs2b/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu ext/mythtv/Makefile
+	  $(AUTOMAKE) --gnu ext/bs2b/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -813,8 +819,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstmythtvsrc.la: $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_DEPENDENCIES) $(EXTRA_libgstmythtvsrc_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstmythtvsrc_la_LINK) -rpath $(plugindir) $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_LIBADD) $(LIBS)
+libgstbs2b.la: $(libgstbs2b_la_OBJECTS) $(libgstbs2b_la_DEPENDENCIES) $(EXTRA_libgstbs2b_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libgstbs2b_la_LINK) -rpath $(plugindir) $(libgstbs2b_la_OBJECTS) $(libgstbs2b_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -822,7 +828,7 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbs2b_la-gstbs2b.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -848,12 +854,12 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstmythtvsrc_la-gstmythtvsrc.lo: gstmythtvsrc.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -MT libgstmythtvsrc_la-gstmythtvsrc.lo -MD -MP -MF $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstmythtvsrc.c' object='libgstmythtvsrc_la-gstmythtvsrc.lo' libtool=yes @AMDEPBACKSLASH@
+libgstbs2b_la-gstbs2b.lo: gstbs2b.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstbs2b_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbs2b_la_CFLAGS) $(CFLAGS) -MT libgstbs2b_la-gstbs2b.lo -MD -MP -MF $(DEPDIR)/libgstbs2b_la-gstbs2b.Tpo -c -o libgstbs2b_la-gstbs2b.lo `test -f 'gstbs2b.c' || echo '$(srcdir)/'`gstbs2b.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstbs2b_la-gstbs2b.Tpo $(DEPDIR)/libgstbs2b_la-gstbs2b.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstbs2b.c' object='libgstbs2b_la-gstbs2b.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstbs2b_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbs2b_la_CFLAGS) $(CFLAGS) -c -o libgstbs2b_la-gstbs2b.lo `test -f 'gstbs2b.c' || echo '$(srcdir)/'`gstbs2b.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
diff --git a/ext/bs2b/gstbs2b.c b/ext/bs2b/gstbs2b.c
new file mode 100644
index 0000000..dd29983
--- /dev/null
+++ b/ext/bs2b/gstbs2b.c
@@ -0,0 +1,421 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2003> David Schleef <ds@schleef.org>
+ * Copyright (C) <2011,2014> Christoph Reiter <reiter.christoph@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * SECTION:element-bs2b
+ *
+ * Improve headphone listening of stereo audio records using the bs2b library. 
+ * It does so by mixing the left and right channel in a way that simulates
+ * a stereo speaker setup while using headphones.
+ *
+ * <refsect2>
+ * <title>Example pipelines</title>
+ * |[
+ * gst-launch-1.0 audiotestsrc ! "audio/x-raw,channel-mask=(bitmask)0x1" ! interleave name=i ! bs2b ! autoaudiosink audiotestsrc freq=330 ! "audio/x-raw,channel-mask=(bitmask)0x2" ! i.
+ * ]| Play two independent sine test sources and crossfeed them.
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/gstaudiofilter.h>
+
+#include "gstbs2b.h"
+
+#define GST_BS2B_DP_LOCK(obj) g_mutex_lock (&obj->bs2b_lock)
+#define GST_BS2B_DP_UNLOCK(obj) g_mutex_unlock (&obj->bs2b_lock)
+
+#define SUPPORTED_FORMAT \
+  "(string) { S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, " \
+  "U32BE, S24LE, S24BE, U24LE, U24BE, F32LE, F32BE, F64LE, F64BE }"
+
+#define SUPPORTED_RATE \
+  "(int) [ " G_STRINGIFY (BS2B_MINSRATE) ", " G_STRINGIFY (BS2B_MAXSRATE) " ]"
+
+#define FRONT_L_FRONT_R "(bitmask) 0x3"
+
+#define PAD_CAPS \
+  "audio/x-raw, "                          \
+  "format = " SUPPORTED_FORMAT ", "        \
+  "rate = " SUPPORTED_RATE ", "            \
+  "channels = (int) 2, "                   \
+  "channel-mask = " FRONT_L_FRONT_R ", "   \
+  "layout = (string) interleaved"          \
+  "; "                                     \
+  "audio/x-raw, "                          \
+  "channels = (int) 1"                     \
+
+enum
+{
+  PROP_FCUT = 1,
+  PROP_FEED,
+  PROP_LAST,
+};
+
+static GParamSpec *properties[PROP_LAST];
+
+typedef struct
+{
+  const gchar *name;
+  const gchar *desc;
+  gint preset;
+} GstBs2bPreset;
+
+static const GstBs2bPreset presets[3] = {
+  {
+        "default",
+        "Closest to virtual speaker placement (30°, 3 meter) [700Hz, 4.5dB]",
+      BS2B_DEFAULT_CLEVEL},
+  {
+        "cmoy",
+        "Close to Chu Moy's crossfeeder (popular) [700Hz, 6.0dB]",
+      BS2B_CMOY_CLEVEL},
+  {
+        "jmeier",
+        "Close to Jan Meier's CORDA amplifiers (little change) [650Hz, 9.0dB]",
+      BS2B_JMEIER_CLEVEL}
+};
+
+static void gst_preset_interface_init (gpointer g_iface, gpointer iface_data);
+
+G_DEFINE_TYPE_WITH_CODE (GstBs2b, gst_bs2b, GST_TYPE_AUDIO_FILTER,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, gst_preset_interface_init));
+
+static void gst_bs2b_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_bs2b_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void gst_bs2b_finalize (GObject * object);
+
+static GstFlowReturn gst_bs2b_transform_inplace (GstBaseTransform *
+    base_transform, GstBuffer * buffer);
+static gboolean gst_bs2b_setup (GstAudioFilter * self,
+    const GstAudioInfo * audio_info);
+
+static gchar **
+gst_bs2b_get_preset_names (GstPreset * preset)
+{
+  gchar **names;
+  gint i;
+
+  names = g_new (gchar *, 1 + G_N_ELEMENTS (presets));
+  for (i = 0; i < G_N_ELEMENTS (presets); i++) {
+    names[i] = g_strdup (presets[i].name);
+  }
+  names[i] = NULL;
+  return names;
+}
+
+static gchar **
+gst_bs2b_get_property_names (GstPreset * preset)
+{
+  gchar **names = g_new (gchar *, 3);
+
+  names[0] = g_strdup ("fcut");
+  names[1] = g_strdup ("feed");
+  names[2] = NULL;
+  return names;
+}
+
+static gboolean
+gst_bs2b_load_preset (GstPreset * preset, const gchar * name)
+{
+  GstBs2b *element = GST_BS2B (preset);
+  GObject *object = (GObject *) preset;
+  gint i;
+
+  for (i = 0; i < G_N_ELEMENTS (presets); i++) {
+    if (!g_strcmp0 (presets[i].name, name)) {
+      bs2b_set_level (element->bs2bdp, presets[i].preset);
+      g_object_notify_by_pspec (object, properties[PROP_FCUT]);
+      g_object_notify_by_pspec (object, properties[PROP_FEED]);
+      return TRUE;
+    }
+  }
+  return FALSE;
+}
+
+static gboolean
+gst_bs2b_get_meta (GstPreset * preset, const gchar * name,
+    const gchar * tag, gchar ** value)
+{
+  if (!g_strcmp0 (tag, "comment")) {
+    gint i;
+
+    for (i = 0; i < G_N_ELEMENTS (presets); i++) {
+      if (!g_strcmp0 (presets[i].name, name)) {
+        *value = g_strdup (presets[i].desc);
+        return TRUE;
+      }
+    }
+  }
+  *value = NULL;
+  return FALSE;
+}
+
+static void
+gst_preset_interface_init (gpointer g_iface, gpointer iface_data)
+{
+  GstPresetInterface *iface = g_iface;
+
+  iface->get_preset_names = gst_bs2b_get_preset_names;
+  iface->get_property_names = gst_bs2b_get_property_names;
+
+  iface->load_preset = gst_bs2b_load_preset;
+  iface->save_preset = NULL;
+  iface->rename_preset = NULL;
+  iface->delete_preset = NULL;
+
+  iface->get_meta = gst_bs2b_get_meta;
+  iface->set_meta = NULL;
+}
+
+static void
+gst_bs2b_class_init (GstBs2bClass * klass)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
+  GstAudioFilterClass *filter_class = GST_AUDIO_FILTER_CLASS (klass);
+  GstCaps *caps;
+
+  gobject_class->set_property = gst_bs2b_set_property;
+  gobject_class->get_property = gst_bs2b_get_property;
+  gobject_class->finalize = gst_bs2b_finalize;
+
+  trans_class->transform_ip = gst_bs2b_transform_inplace;
+  trans_class->transform_ip_on_passthrough = FALSE;
+
+  filter_class->setup = gst_bs2b_setup;
+
+  properties[PROP_FCUT] = g_param_spec_int ("fcut", "Frequency cut",
+      "Low-pass filter cut frequency (Hz)",
+      BS2B_MINFCUT, BS2B_MAXFCUT, BS2B_DEFAULT_CLEVEL & 0xFFFF,
+      G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_FEED] =
+      g_param_spec_int ("feed", "Feed level", "Feed Level (dB/10)",
+      BS2B_MINFEED, BS2B_MAXFEED, BS2B_DEFAULT_CLEVEL >> 16,
+      G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, PROP_LAST, properties);
+
+  gst_element_class_set_metadata (element_class,
+      "Crossfeed effect",
+      "Filter/Effect/Audio",
+      "Improve headphone listening of stereo audio records using the bs2b "
+      "library.", "Christoph Reiter <reiter.christoph@gmail.com>");
+
+  caps = gst_caps_from_string (PAD_CAPS);
+  gst_audio_filter_class_add_pad_templates (filter_class, caps);
+  gst_caps_unref (caps);
+}
+
+static void
+gst_bs2b_init (GstBs2b * element)
+{
+  g_mutex_init (&element->bs2b_lock);
+  element->bs2bdp = bs2b_open ();
+}
+
+static gboolean
+gst_bs2b_setup (GstAudioFilter * filter, const GstAudioInfo * audio_info)
+{
+  GstBaseTransform *base_transform = GST_BASE_TRANSFORM (filter);
+  GstBs2b *element = GST_BS2B (filter);
+  gint channels = GST_AUDIO_INFO_CHANNELS (audio_info);
+
+  element->func = NULL;
+
+  if (channels == 1) {
+    gst_base_transform_set_passthrough (base_transform, TRUE);
+    return TRUE;
+  }
+
+  g_assert (channels == 2);
+  gst_base_transform_set_passthrough (base_transform, FALSE);
+
+  switch (GST_AUDIO_INFO_FORMAT (audio_info)) {
+    case GST_AUDIO_FORMAT_S8:
+      element->func = &bs2b_cross_feed_s8;
+      break;
+    case GST_AUDIO_FORMAT_U8:
+      element->func = &bs2b_cross_feed_u8;
+      break;
+    case GST_AUDIO_FORMAT_S16BE:
+      element->func = &bs2b_cross_feed_s16be;
+      break;
+    case GST_AUDIO_FORMAT_S16LE:
+      element->func = &bs2b_cross_feed_s16le;
+      break;
+    case GST_AUDIO_FORMAT_U16BE:
+      element->func = &bs2b_cross_feed_u16be;
+      break;
+    case GST_AUDIO_FORMAT_U16LE:
+      element->func = &bs2b_cross_feed_u16le;
+      break;
+    case GST_AUDIO_FORMAT_S24BE:
+      element->func = &bs2b_cross_feed_s24be;
+      break;
+    case GST_AUDIO_FORMAT_S24LE:
+      element->func = &bs2b_cross_feed_s24le;
+      break;
+    case GST_AUDIO_FORMAT_U24BE:
+      element->func = &bs2b_cross_feed_u24be;
+      break;
+    case GST_AUDIO_FORMAT_U24LE:
+      element->func = &bs2b_cross_feed_u24le;
+      break;
+    case GST_AUDIO_FORMAT_S32BE:
+      element->func = &bs2b_cross_feed_s32be;
+      break;
+    case GST_AUDIO_FORMAT_S32LE:
+      element->func = &bs2b_cross_feed_s32le;
+      break;
+    case GST_AUDIO_FORMAT_U32BE:
+      element->func = &bs2b_cross_feed_u32be;
+      break;
+    case GST_AUDIO_FORMAT_U32LE:
+      element->func = &bs2b_cross_feed_u32le;
+      break;
+    case GST_AUDIO_FORMAT_F32BE:
+      element->func = &bs2b_cross_feed_fbe;
+      break;
+    case GST_AUDIO_FORMAT_F32LE:
+      element->func = &bs2b_cross_feed_fle;
+      break;
+    case GST_AUDIO_FORMAT_F64BE:
+      element->func = &bs2b_cross_feed_dbe;
+      break;
+    case GST_AUDIO_FORMAT_F64LE:
+      element->func = &bs2b_cross_feed_dle;
+      break;
+    default:
+      return FALSE;
+  }
+
+  g_assert (element->func);
+  element->bytes_per_sample =
+      (GST_AUDIO_INFO_WIDTH (audio_info) * channels) / 8;
+
+  GST_BS2B_DP_LOCK (element);
+  bs2b_set_srate (element->bs2bdp, GST_AUDIO_INFO_RATE (audio_info));
+  GST_BS2B_DP_UNLOCK (element);
+
+  return TRUE;
+}
+
+static void
+gst_bs2b_finalize (GObject * object)
+{
+  GstBs2b *element = GST_BS2B (object);
+
+  bs2b_close (element->bs2bdp);
+  element->bs2bdp = NULL;
+
+  G_OBJECT_CLASS (gst_bs2b_parent_class)->finalize (object);
+}
+
+static GstFlowReturn
+gst_bs2b_transform_inplace (GstBaseTransform * base_transform,
+    GstBuffer * buffer)
+{
+  GstBs2b *element = GST_BS2B (base_transform);
+  GstMapInfo map_info;
+
+  if (!gst_buffer_map (buffer, &map_info, GST_MAP_READ | GST_MAP_WRITE))
+    return GST_FLOW_ERROR;
+
+  GST_BS2B_DP_LOCK (element);
+  if (GST_BUFFER_IS_DISCONT (buffer))
+    bs2b_clear (element->bs2bdp);
+  element->func (element->bs2bdp, map_info.data,
+      map_info.size / element->bytes_per_sample);
+  GST_BS2B_DP_UNLOCK (element);
+
+  gst_buffer_unmap (buffer, &map_info);
+
+  return GST_FLOW_OK;
+}
+
+static void
+gst_bs2b_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstBs2b *element = GST_BS2B (object);
+
+  switch (prop_id) {
+    case PROP_FCUT:
+      GST_BS2B_DP_LOCK (element);
+      bs2b_set_level_fcut (element->bs2bdp, g_value_get_int (value));
+      bs2b_clear (element->bs2bdp);
+      GST_BS2B_DP_UNLOCK (element);
+      break;
+    case PROP_FEED:
+      GST_BS2B_DP_LOCK (element);
+      bs2b_set_level_feed (element->bs2bdp, g_value_get_int (value));
+      bs2b_clear (element->bs2bdp);
+      GST_BS2B_DP_UNLOCK (element);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_bs2b_get_property (GObject * object, guint prop_id, GValue * value,
+    GParamSpec * pspec)
+{
+  GstBs2b *element = GST_BS2B (object);
+
+  switch (prop_id) {
+    case PROP_FCUT:
+      GST_BS2B_DP_LOCK (element);
+      g_value_set_int (value, bs2b_get_level_fcut (element->bs2bdp));
+      GST_BS2B_DP_UNLOCK (element);
+      break;
+    case PROP_FEED:
+      GST_BS2B_DP_LOCK (element);
+      g_value_set_int (value, bs2b_get_level_feed (element->bs2bdp));
+      GST_BS2B_DP_UNLOCK (element);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  return gst_element_register (plugin, "bs2b", GST_RANK_NONE, GST_TYPE_BS2B);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    bs2b,
+    "Improve headphone listening of stereo audio records"
+    "using the bs2b library.",
+    plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/bs2b/gstbs2b.h b/ext/bs2b/gstbs2b.h
new file mode 100644
index 0000000..8ec7f14
--- /dev/null
+++ b/ext/bs2b/gstbs2b.h
@@ -0,0 +1,63 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2003> David Schleef <ds@schleef.org>
+ * Copyright (C) <2011,2014> Christoph Reiter <reiter.christoph@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __GST_BS2B_H__
+#define __GST_BS2B_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/gstaudiofilter.h>
+#include <bs2b/bs2b.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_BS2B \
+  (gst_bs2b_get_type())
+#define GST_BS2B(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BS2B,GstBs2b))
+#define GST_BS2B_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BS2B,GstBs2bClass))
+#define GST_IS_BS2B(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BS2B))
+#define GST_IS_BS2B_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BS2B))
+typedef struct _GstBs2b GstBs2b;
+typedef struct _GstBs2bClass GstBs2bClass;
+
+
+struct _GstBs2b
+{
+  GstAudioFilter element;
+
+  /*< private > */
+  GMutex bs2b_lock;
+  t_bs2bdp bs2bdp;
+  void (*func) ();
+  guint bytes_per_sample;
+};
+
+struct _GstBs2bClass
+{
+  GstAudioFilterClass parent_class;
+};
+
+GType gst_bs2b_get_type (void);
+
+G_END_DECLS
+#endif /* __GST_BS2B_H__ */
diff --git a/ext/bz2/Makefile.in b/ext/bz2/Makefile.in
index b973dc5..9750bd7 100644
--- a/ext/bz2/Makefile.in
+++ b/ext/bz2/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/chromaprint/Makefile.in b/ext/chromaprint/Makefile.in
index b9513b5..14da5db 100644
--- a/ext/chromaprint/Makefile.in
+++ b/ext/chromaprint/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/curl/Makefile.in b/ext/curl/Makefile.in
index 807b03b..fedb5e0 100644
--- a/ext/curl/Makefile.in
+++ b/ext/curl/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -258,8 +258,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -298,7 +302,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -306,6 +309,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -355,8 +360,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -435,7 +438,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -444,7 +446,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -457,7 +458,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -482,6 +482,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -555,10 +557,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -584,6 +590,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -620,6 +629,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -660,17 +670,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -687,6 +696,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/curl/gstcurlbasesink.c b/ext/curl/gstcurlbasesink.c
index 12ee0f3..1654c45 100644
--- a/ext/curl/gstcurlbasesink.c
+++ b/ext/curl/gstcurlbasesink.c
@@ -124,6 +124,10 @@
     size_t nmemb, void *stream);
 static size_t gst_curl_base_sink_transfer_data_buffer (GstCurlBaseSink * sink,
     void *curl_ptr, size_t block_size, guint * last_chunk);
+#ifndef GST_DISABLE_GST_DEBUG
+static int gst_curl_base_sink_debug_cb (CURL * handle, curl_infotype type,
+    char *data, size_t size, void *clientp);
+#endif
 static int gst_curl_base_sink_transfer_socket_cb (void *clientp,
     curl_socket_t curlfd, curlsocktype purpose);
 static gpointer gst_curl_base_sink_transfer_thread_func (gpointer data);
@@ -609,13 +613,26 @@
   GstCurlBaseSinkClass *klass = GST_CURL_BASE_SINK_GET_CLASS (sink);
   CURLcode res;
 
-#ifdef DEBUG
+#ifndef GST_DISABLE_GST_DEBUG
   res = curl_easy_setopt (sink->curl, CURLOPT_VERBOSE, 1);
   if (res != CURLE_OK) {
     sink->error = g_strdup_printf ("failed to set verbose: %s",
         curl_easy_strerror (res));
     return FALSE;
   }
+  res = curl_easy_setopt (sink->curl, CURLOPT_DEBUGDATA, sink);
+  if (res != CURLE_OK) {
+    sink->error = g_strdup_printf ("failed to set debug user_data: %s",
+        curl_easy_strerror (res));
+    return FALSE;
+  }
+  res = curl_easy_setopt (sink->curl, CURLOPT_DEBUGFUNCTION,
+      gst_curl_base_sink_debug_cb);
+  if (res != CURLE_OK) {
+    sink->error = g_strdup_printf ("failed to set debug functions: %s",
+        curl_easy_strerror (res));
+    return FALSE;
+  }
 #endif
 
   res = curl_easy_setopt (sink->curl, CURLOPT_URL, sink->url);
@@ -683,6 +700,7 @@
     return FALSE;
   }
 
+  GST_LOG ("common options set");
   return TRUE;
 }
 
@@ -747,7 +765,6 @@
     void *curl_ptr, size_t block_size, guint * last_chunk)
 {
   TransferBuffer *buffer;
-  size_t bytes_to_send;
 
   buffer = sink->transfer_buf;
   GST_LOG ("write buf len=%" G_GSIZE_FORMAT ", offset=%" G_GSIZE_FORMAT,
@@ -760,10 +777,7 @@
   }
 
   /* more data in buffer(s) */
-  bytes_to_send = transfer_data_buffer (curl_ptr, sink->transfer_buf,
-      block_size, last_chunk);
-
-  return bytes_to_send;
+  return transfer_data_buffer (curl_ptr, buffer, block_size, last_chunk);
 }
 
 static size_t
@@ -891,12 +905,15 @@
   timeout = sink->timeout;
   GST_OBJECT_UNLOCK (sink);
 
+  GST_DEBUG_OBJECT (sink, "handling transfers");
+
   /* Receiving CURLM_CALL_MULTI_PERFORM means that libcurl may have more data
      available to send or receive - call simply curl_multi_perform before
      poll() on more actions */
   do {
     m_code = curl_multi_perform (sink->multi_handle, &running_handles);
   } while (m_code == CURLM_CALL_MULTI_PERFORM);
+  GST_DEBUG_OBJECT (sink, "running handles: %d", running_handles);
 
   while (running_handles && (m_code == CURLM_OK)) {
     if (klass->transfer_prepare_poll_wait) {
@@ -934,6 +951,7 @@
     do {
       m_code = curl_multi_perform (sink->multi_handle, &running_handles);
     } while (m_code == CURLM_CALL_MULTI_PERFORM);
+    GST_DEBUG_OBJECT (sink, "running handles: %d", running_handles);
   }
 
   if (m_code != CURLM_OK) {
@@ -965,6 +983,60 @@
   return;
 }
 
+#ifndef GST_DISABLE_GST_DEBUG
+static int
+gst_curl_base_sink_debug_cb (CURL * handle, curl_infotype type, char *data,
+    size_t size, void *clientp)
+{
+  GstCurlBaseSink *sink = (GstCurlBaseSink *) clientp;
+  gchar *msg = NULL;
+
+  switch (type) {
+    case CURLINFO_TEXT:
+    case CURLINFO_HEADER_IN:
+    case CURLINFO_HEADER_OUT:
+      msg = g_memdup (data, size);
+      if (size > 0) {
+        msg[size - 1] = '\0';
+        g_strchomp (msg);
+      }
+      break;
+    default:
+      break;
+  }
+
+  switch (type) {
+    case CURLINFO_TEXT:
+      GST_DEBUG_OBJECT (sink, "%s", msg);
+      break;
+    case CURLINFO_HEADER_IN:
+      GST_DEBUG_OBJECT (sink, "incoming header: %s", msg);
+      break;
+    case CURLINFO_HEADER_OUT:
+      GST_DEBUG_OBJECT (sink, "outgoing header: %s", msg);
+      break;
+    case CURLINFO_DATA_IN:
+      GST_MEMDUMP_OBJECT (sink, "incoming data", (guint8 *) data, size);
+      break;
+    case CURLINFO_DATA_OUT:
+      GST_MEMDUMP_OBJECT (sink, "outgoing data", (guint8 *) data, size);
+      break;
+    case CURLINFO_SSL_DATA_IN:
+      GST_MEMDUMP_OBJECT (sink, "incoming ssl data", (guint8 *) data, size);
+      break;
+    case CURLINFO_SSL_DATA_OUT:
+      GST_MEMDUMP_OBJECT (sink, "outgoing ssl data", (guint8 *) data, size);
+      break;
+    default:
+      GST_DEBUG_OBJECT (sink, "unknown debug info type %d", type);
+      GST_MEMDUMP_OBJECT (sink, "unknown data", (guint8 *) data, size);
+      break;
+  }
+  g_free (msg);
+  return 0;
+}
+#endif
+
 /* This function gets called by libcurl after the socket() call but before
  * the connect() call. */
 static int
@@ -982,26 +1054,23 @@
     /* signal an unrecoverable error to the library which will close the socket
        and return CURLE_COULDNT_CONNECT
      */
+    GST_DEBUG_OBJECT (sink, "no curlfd");
     return 1;
   }
 
   gst_poll_fd_init (&sink->fd);
   sink->fd.fd = curlfd;
 
-  ret = ret && gst_poll_add_fd (sink->fdset, &sink->fd);
-  ret = ret && gst_poll_fd_ctl_write (sink->fdset, &sink->fd, TRUE);
-  ret = ret && gst_poll_fd_ctl_read (sink->fdset, &sink->fd, TRUE);
-  GST_DEBUG ("fd: %d", sink->fd.fd);
+  ret &= gst_poll_add_fd (sink->fdset, &sink->fd);
+  ret &= gst_poll_fd_ctl_write (sink->fdset, &sink->fd, TRUE);
+  ret &= gst_poll_fd_ctl_read (sink->fdset, &sink->fd, TRUE);
+  GST_DEBUG_OBJECT (sink, "fd: %d", sink->fd.fd);
   GST_OBJECT_LOCK (sink);
   gst_curl_base_sink_setup_dscp_unlocked (sink);
   GST_OBJECT_UNLOCK (sink);
 
   /* success */
-  if (ret) {
-    return 0;
-  } else {
-    return 1;
-  }
+  return ret ? 0 : 1;
 }
 
 static gboolean
@@ -1067,6 +1136,7 @@
     GST_OBJECT_UNLOCK (sink);
 
     if (data_available) {
+      GST_LOG ("have data");
       if (!gst_curl_base_sink_is_live (sink)) {
         /* prepare transfer if needed */
         if (klass->prepare_transfer) {
@@ -1077,6 +1147,7 @@
           }
           GST_OBJECT_UNLOCK (sink);
         }
+        GST_LOG ("adding handle");
         curl_multi_add_handle (sink->multi_handle, sink->curl);
       }
 
@@ -1086,8 +1157,11 @@
       /* easy handle will be possibly re-used for next transfer, thus it needs
        * to be removed from the multi stack and re-added again */
       if (!gst_curl_base_sink_is_live (sink)) {
+        GST_LOG ("removing handle");
         curl_multi_remove_handle (sink->multi_handle, sink->curl);
       }
+    } else {
+      GST_LOG ("have no data yet");
     }
 
     /* lock again before looping to check the thread closed flag */
@@ -1095,6 +1169,7 @@
   }
 
   if (sink->is_live) {
+    GST_LOG ("removing handle");
     curl_multi_remove_handle (sink->multi_handle, sink->curl);
   }
 
@@ -1134,7 +1209,9 @@
   }
 
   if (!gst_curl_base_sink_transfer_set_options_unlocked (sink)) {
-    sink->error = g_strdup ("failed to setup curl easy handle");
+    if (!sink->error) {
+      sink->error = g_strdup ("failed to setup curl easy handle");
+    }
     return FALSE;
   }
 
@@ -1146,6 +1223,7 @@
     }
   }
 
+  GST_LOG ("transfer setup done");
   return TRUE;
 }
 
diff --git a/ext/curl/gstcurlhttpsink.c b/ext/curl/gstcurlhttpsink.c
index 6fa920a..3660f5b 100644
--- a/ext/curl/gstcurlhttpsink.c
+++ b/ext/curl/gstcurlhttpsink.c
@@ -352,10 +352,12 @@
 
 set_headers:
 
-  tmp = g_strdup_printf ("Content-Disposition: attachment; filename="
-      "\"%s\"", bcsink->file_name);
-  sink->header_list = curl_slist_append (sink->header_list, tmp);
-  g_free (tmp);
+  if (bcsink->file_name) {
+    tmp = g_strdup_printf ("Content-Disposition: attachment; filename="
+        "\"%s\"", bcsink->file_name);
+    sink->header_list = curl_slist_append (sink->header_list, tmp);
+    g_free (tmp);
+  }
   res = curl_easy_setopt (bcsink->curl, CURLOPT_HTTPHEADER, sink->header_list);
   if (res != CURLE_OK) {
     bcsink->error = g_strdup_printf ("failed to set HTTP headers: %s",
@@ -399,6 +401,7 @@
   parent_class = GST_CURL_TLS_SINK_GET_CLASS (sink);
 
   if (g_str_has_prefix (bcsink->url, "https://")) {
+    GST_DEBUG_OBJECT (bcsink, "setting up tls options");
     return parent_class->set_options_unlocked (bcsink);
   }
 
@@ -431,6 +434,7 @@
   if (!sink->proxy_conn_established
       && (sink->proxy_resp != RESPONSE_CONNECT_PROXY)
       && sink->proxy_auth) {
+    GST_DEBUG_OBJECT (sink, "prep transfers: connecting proxy");
     curl_easy_getinfo (bcsink->curl, CURLINFO_HTTP_CONNECTCODE,
         &sink->proxy_resp);
     if (sink->proxy_resp == RESPONSE_CONNECT_PROXY) {
diff --git a/ext/curl/gstcurlsmtpsink.c b/ext/curl/gstcurlsmtpsink.c
index c28213b..7de1ddf 100644
--- a/ext/curl/gstcurlsmtpsink.c
+++ b/ext/curl/gstcurlsmtpsink.c
@@ -204,17 +204,17 @@
       sink->eos = TRUE;
       GST_OBJECT_UNLOCK (sink);
 
-      if (sink->base64_chunk != NULL)
+      if (sink->base64_chunk != NULL && !sink->final_boundary_added) {
         add_final_boundary_unlocked (sink);
 
-      gst_curl_base_sink_transfer_thread_notify_unlocked (bcsink);
+        gst_curl_base_sink_transfer_thread_notify_unlocked (bcsink);
 
-      GST_OBJECT_LOCK (sink);
-      if (sink->base64_chunk != NULL && bcsink->flow_ret == GST_FLOW_OK) {
-        gst_curl_smtp_sink_wait_for_transfer_end_unlocked (sink);
+        GST_OBJECT_LOCK (sink);
+        if (sink->base64_chunk != NULL && bcsink->flow_ret == GST_FLOW_OK) {
+          gst_curl_smtp_sink_wait_for_transfer_end_unlocked (sink);
+        }
+        GST_OBJECT_UNLOCK (sink);
       }
-      GST_OBJECT_UNLOCK (sink);
-
       gst_curl_base_sink_transfer_thread_close (bcsink);
 
       break;
@@ -433,7 +433,7 @@
         break;
       case PROP_NBR_ATTACHMENTS:
         sink->nbr_attachments = g_value_get_int (value);
-        sink->nbr_attachments_left = sink->nbr_attachments;
+        sink->curr_attachment = 1;
         GST_DEBUG_OBJECT (sink, "nbr-attachments set to %d",
             sink->nbr_attachments);
         break;
@@ -773,18 +773,19 @@
   gchar *data_out;
 
   GST_DEBUG
-      ("live: %d, num attachments: %d, num attachments_left: %d, eos: %d, "
-      "close_transfer: %d, final boundary: %d, array_len: %d", bcsink->is_live,
-      sink->nbr_attachments, sink->nbr_attachments_left, sink->eos,
-      close_transfer, sink->final_boundary_added, array->len);
+      ("live: %d, num attachments: %d, curr_attachment: %d, "
+      "eos: %d, close_transfer: %d, final boundary: %d, array_len: %d",
+      bcsink->is_live, sink->nbr_attachments, sink->curr_attachment,
+      sink->eos, close_transfer, sink->final_boundary_added, array->len);
 
 
-  if ((bcsink->is_live && (sink->nbr_attachments_left == sink->nbr_attachments))
+  if ((bcsink->is_live && (sink->curr_attachment == sink->nbr_attachments))
       || (sink->nbr_attachments == 1) || sink->eos
       || sink->final_boundary_added) {
     bcsink->is_live = FALSE;
     sink->reset_transfer_options = TRUE;
     sink->final_boundary_added = FALSE;
+    sink->curr_attachment = 1;
 
     GST_DEBUG ("returning 0, no more data to send in this transfer");
 
@@ -806,12 +807,8 @@
   g_free (data_out);
 
   if (new_file) {
-    sink->nbr_attachments_left--;
-
+    sink->curr_attachment++;
     bcsink->is_live = TRUE;
-    if (sink->nbr_attachments_left <= 1) {
-      sink->nbr_attachments_left = sink->nbr_attachments;
-    }
 
     /* reset flag */
     bcsink->new_file = FALSE;
@@ -929,6 +926,16 @@
         transfer_chunk (curl_ptr, bcsink->transfer_buf, sink->base64_chunk,
         block_size, last_chunk);
 
+    /* if last chunk of current buffer and max attachments per mail is reached
+     * then add final boundary */
+    if (*last_chunk && sink->curr_attachment == sink->nbr_attachments &&
+        !sink->final_boundary_added) {
+      add_final_boundary_unlocked (sink);
+      /* now that we've added the final boundary to the array we have on more
+       * chunk to send */
+      *last_chunk = 0;
+    }
+
     GST_OBJECT_LOCK (sink);
     if (sink->eos) {
       gst_curl_smtp_sink_notify_transfer_end_unlocked (sink);
diff --git a/ext/curl/gstcurlsmtpsink.h b/ext/curl/gstcurlsmtpsink.h
index 94c3349..71c40e5 100644
--- a/ext/curl/gstcurlsmtpsink.h
+++ b/ext/curl/gstcurlsmtpsink.h
@@ -71,7 +71,7 @@
   gboolean transfer_end;
   GCond cond_transfer_end;
 
-  gint nbr_attachments_left;
+  gint curr_attachment;
   gboolean reset_transfer_options;
   gboolean final_boundary_added;
   gboolean eos;
diff --git a/ext/curl/gstcurlsshsink.c b/ext/curl/gstcurlsshsink.c
index 0959413..d2dac8d 100644
--- a/ext/curl/gstcurlsshsink.c
+++ b/ext/curl/gstcurlsshsink.c
@@ -179,7 +179,7 @@
 static void
 gst_curl_ssh_sink_init (GstCurlSshSink * sink)
 {
-  sink->ssh_auth_type = CURLSSH_AUTH_NONE;
+  sink->ssh_auth_type = GST_CURLSSH_AUTH_NONE;
   sink->ssh_pub_keyfile = NULL;
   sink->ssh_priv_keyfile = NULL;
   sink->ssh_key_passphrase = NULL;
@@ -373,8 +373,8 @@
 
   /* make sure we only accept PASSWORD or PUBLICKEY auth methods
    * (can be extended later) */
-  if (sink->ssh_auth_type == CURLSSH_AUTH_PASSWORD ||
-      sink->ssh_auth_type == CURLSSH_AUTH_PUBLICKEY) {
+  if (sink->ssh_auth_type == GST_CURLSSH_AUTH_PASSWORD ||
+      sink->ssh_auth_type == GST_CURLSSH_AUTH_PUBLICKEY) {
 
     /* set the SSH_AUTH_TYPE */
     if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_SSH_AUTH_TYPES,
@@ -385,7 +385,7 @@
     }
 
     /* if key authentication -> provide the private key passphrase as well */
-    if (sink->ssh_auth_type == CURLSSH_AUTH_PUBLICKEY) {
+    if (sink->ssh_auth_type == GST_CURLSSH_AUTH_PUBLICKEY) {
       if (sink->ssh_key_passphrase) {
         if ((curl_err = curl_easy_setopt (bcsink->curl, CURLOPT_KEYPASSWD,
                     sink->ssh_key_passphrase)) != CURLE_OK) {
diff --git a/ext/curl/gstcurlsshsink.h b/ext/curl/gstcurlsshsink.h
index 1b56c4d..376f1b1 100644
--- a/ext/curl/gstcurlsshsink.h
+++ b/ext/curl/gstcurlsshsink.h
@@ -38,9 +38,10 @@
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CURL_SSH_SINK))
 #define GST_IS_CURL_SSH_SINK_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CURL_SSH_SINK))
-/* see <curl/curl.h> */
-    typedef enum
+
+typedef enum
 {
+  /* Keep these in sync with the libcurl definitions. See <curl/curl.h> */
   GST_CURLSSH_AUTH_NONE = CURLSSH_AUTH_NONE,
   GST_CURLSSH_AUTH_PUBLICKEY = CURLSSH_AUTH_PUBLICKEY,
   GST_CURLSSH_AUTH_PASSWORD = CURLSSH_AUTH_PASSWORD
@@ -55,9 +56,10 @@
   GstCurlBaseSink parent;
 
   /*< private > */
-  guint ssh_auth_type;          /* for now, supporting only:
-                                   CURLSSH_AUTH_PASSWORD  (passwd auth) OR
-                                   CURLSSH_AUTH_PUBLICKEY (pub/pvt key auth) */
+  /* for now, supporting only:
+   * GST_CURLSSH_AUTH_PASSWORD (password authentication) and
+   * GST_CURLSSH_AUTH_PUBLICKEY (public key authentication) */
+  GstCurlSshAuthType ssh_auth_type;
 
   gchar *ssh_pub_keyfile;       /* filename for the public key:
                                    CURLOPT_SSH_PUBLIC_KEYFILE */
diff --git a/ext/curl/gstcurltlssink.c b/ext/curl/gstcurltlssink.c
index b6de969..35c1c1c 100644
--- a/ext/curl/gstcurltlssink.c
+++ b/ext/curl/gstcurltlssink.c
@@ -247,8 +247,8 @@
   }
 
   /* crypto engine */
-  if ((g_strcmp0 (sink->crypto_engine, "auto") == 0) ||
-      (sink->crypto_engine == NULL)) {
+  if ((sink->crypto_engine == NULL) ||
+      (strcmp (sink->crypto_engine, "auto") == 0)) {
     res = curl_easy_setopt (bcsink->curl, CURLOPT_SSLENGINE_DEFAULT, 1L);
     if (res != CURLE_OK) {
       bcsink->error =
diff --git a/ext/daala/Makefile.in b/ext/daala/Makefile.in
index c5d8744..422e4f5 100644
--- a/ext/daala/Makefile.in
+++ b/ext/daala/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/dash/Makefile.am b/ext/dash/Makefile.am
index 97d8623..9d4e306 100644
--- a/ext/dash/Makefile.am
+++ b/ext/dash/Makefile.am
@@ -4,19 +4,29 @@
 libgstdashdemux_la_SOURCES =			\
 	gstmpdparser.c				\
 	gstdashdemux.c				\
+	gstisoff.c				\
 	gstplugin.c
 
 # headers we need but don't want installed
 noinst_HEADERS =        \
         gstmpdparser.h	\
 	gstdashdemux.h	\
+	gstisoff.h	\
 	gstdash_debug.h
 
 # compiler and linker flags used to compile this plugin, set in configure.ac
-libgstdashdemux_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS) $(LIBXML2_CFLAGS)
+libgstdashdemux_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	$(GST_BASE_CFLAGS) \
+	$(GST_CFLAGS) \
+	$(LIBXML2_CFLAGS)
 libgstdashdemux_la_LIBADD = \
 	$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la \
-	$(GST_LIBS) $(GST_BASE_LIBS) $(LIBXML2_LIBS)
+	$(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
+	-lgsttag-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) \
+	$(GST_LIBS) \
+	$(LIBXML2_LIBS)
 libgstdashdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstdashdemux_la_LIBTOOLFLAGS = --tag=disable-static
 
diff --git a/ext/dash/Makefile.in b/ext/dash/Makefile.in
index f8e1786..d7a2094 100644
--- a/ext/dash/Makefile.in
+++ b/ext/dash/Makefile.in
@@ -82,7 +82,7 @@
 target_triplet = @target@
 subdir = ext/dash
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/depcomp $(noinst_HEADERS) README
+	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
 	$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -155,11 +155,12 @@
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libgstdashdemux_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la \
+	$(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 am_libgstdashdemux_la_OBJECTS = libgstdashdemux_la-gstmpdparser.lo \
 	libgstdashdemux_la-gstdashdemux.lo \
-	libgstdashdemux_la-gstplugin.lo
+	libgstdashdemux_la-gstisoff.lo libgstdashdemux_la-gstplugin.lo
 libgstdashdemux_la_OBJECTS = $(am_libgstdashdemux_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -247,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -731,6 +742,7 @@
 libgstdashdemux_la_SOURCES = \
 	gstmpdparser.c				\
 	gstdashdemux.c				\
+	gstisoff.c				\
 	gstplugin.c
 
 
@@ -738,14 +750,24 @@
 noinst_HEADERS = \
         gstmpdparser.h	\
 	gstdashdemux.h	\
+	gstisoff.h	\
 	gstdash_debug.h
 
 
 # compiler and linker flags used to compile this plugin, set in configure.ac
-libgstdashdemux_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS) $(LIBXML2_CFLAGS)
+libgstdashdemux_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	$(GST_BASE_CFLAGS) \
+	$(GST_CFLAGS) \
+	$(LIBXML2_CFLAGS)
+
 libgstdashdemux_la_LIBADD = \
 	$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la \
-	$(GST_LIBS) $(GST_BASE_LIBS) $(LIBXML2_LIBS)
+	$(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
+	-lgsttag-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) \
+	$(GST_LIBS) \
+	$(LIBXML2_LIBS)
 
 libgstdashdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstdashdemux_la_LIBTOOLFLAGS = --tag=disable-static
@@ -829,6 +851,7 @@
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstdashdemux.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstisoff.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstmpdparser.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstplugin.Plo@am__quote@
 
@@ -870,6 +893,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -c -o libgstdashdemux_la-gstdashdemux.lo `test -f 'gstdashdemux.c' || echo '$(srcdir)/'`gstdashdemux.c
 
+libgstdashdemux_la-gstisoff.lo: gstisoff.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -MT libgstdashdemux_la-gstisoff.lo -MD -MP -MF $(DEPDIR)/libgstdashdemux_la-gstisoff.Tpo -c -o libgstdashdemux_la-gstisoff.lo `test -f 'gstisoff.c' || echo '$(srcdir)/'`gstisoff.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdashdemux_la-gstisoff.Tpo $(DEPDIR)/libgstdashdemux_la-gstisoff.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstisoff.c' object='libgstdashdemux_la-gstisoff.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -c -o libgstdashdemux_la-gstisoff.lo `test -f 'gstisoff.c' || echo '$(srcdir)/'`gstisoff.c
+
 libgstdashdemux_la-gstplugin.lo: gstplugin.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -MT libgstdashdemux_la-gstplugin.lo -MD -MP -MF $(DEPDIR)/libgstdashdemux_la-gstplugin.Tpo -c -o libgstdashdemux_la-gstplugin.lo `test -f 'gstplugin.c' || echo '$(srcdir)/'`gstplugin.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdashdemux_la-gstplugin.Tpo $(DEPDIR)/libgstdashdemux_la-gstplugin.Plo
diff --git a/ext/dash/README b/ext/dash/README
deleted file mode 100644
index 14734a6..0000000
--- a/ext/dash/README
+++ /dev/null
@@ -1,35 +0,0 @@
-dashdemux
-
-GStreamer plugin allowing the playback of MPEG DASH streams.
-
-The plugin is based on some basic objects defined in the GStreamer HLS
-Demux plugin from the gst-plugins-bad module.
-
-Minimum requirements:
-- glib 2.32.1
-- gstreamer 0.10.36
-- gst-plugins-base 0.10.36
-- gst-plugins-good 0.10.31
-- gst-plugins-bad 0.10.23
-
-The following patches need in addition to be applied:
-
-isomp4 (from gst-plugins-good):
-https://bugzilla.gnome.org/show_bug.cgi?id=677535
-https://bugzilla.gnome.org/show_bug.cgi?id=678767
-https://bugzilla.gnome.org/show_bug.cgi?id=678772
-
-decodebin2 (from gst-plugins-base):
-https://bugzilla.gnome.org/show_bug.cgi?id=685938
-
-To build gst-dashdemux:
-./autogen.sh
-./configure
-./make
-sudo make install
-
-To launch gst-dashdemux:
-
-gst-launch playbin2 uri=http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys13/redbull_4sec.mpd
- 
-gst-launch playbin2 uri=http://download.tsi.telecom-paristech.fr/gpac/DASH_CONFORMANCE/TelecomParisTech/mp4-main-multi/mp4-main-multi-mpd-AV-BS.mpd
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c
index 3f5c17c..16c5488 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -4,7 +4,7 @@
  * gstdashdemux.c
  *
  * Copyright (C) 2012 Orange
- * 
+ *
  * Authors:
  *   David Corvoysier <david.corvoysier@orange.com>
  *   Hamid Zakari <hamid.zakari@gmail.com>
@@ -38,56 +38,56 @@
  */
 
 /* Implementation notes:
- * 
+ *
  * The following section describes how dashdemux works internally.
- * 
+ *
  * Introduction:
- * 
+ *
  * dashdemux is a "fake" demux, as unlike traditional demux elements, it
  * doesn't split data streams contained in an enveloppe to expose them
  * to downstream decoding elements.
- * 
+ *
  * Instead, it parses an XML file called a manifest to identify a set of
  * individual stream fragments it needs to fetch and expose to the actual
- * demux elements that will handle them (this behavior is sometimes 
+ * demux elements that will handle them (this behavior is sometimes
  * referred as the "demux after a demux" scenario).
- * 
+ *
  * For a given section of content, several representations corresponding
  * to different bitrates may be available: dashdemux will select the most
- * appropriate representation based on local conditions (typically the 
+ * appropriate representation based on local conditions (typically the
  * available bandwidth and the amount of buffering available, capped by
- * a maximum allowed bitrate). 
- * 
+ * a maximum allowed bitrate).
+ *
  * The representation selection algorithm can be configured using
  * specific properties: max bitrate, min/max buffering, bandwidth ratio.
- * 
- * 
+ *
+ *
  * General Design:
- * 
- * dashdemux has a single sink pad that accepts the data corresponding 
+ *
+ * dashdemux has a single sink pad that accepts the data corresponding
  * to the manifest, typically fetched from an HTTP or file source.
- * 
+ *
  * dashdemux exposes the streams it recreates based on the fragments it
  * fetches through dedicated src pads corresponding to the caps of the
  * fragments container (ISOBMFF/MP4 or MPEG2TS).
- * 
+ *
  * During playback, new representations will typically be exposed as a
  * new set of pads (see 'Switching between representations' below).
- * 
+ *
  * Fragments downloading is performed using a dedicated task that fills
  * an internal queue. Another task is in charge of popping fragments
  * from the queue and pushing them downstream.
- * 
+ *
  * Switching between representations:
- * 
- * Decodebin supports scenarios allowing to seamlessly switch from one 
+ *
+ * Decodebin supports scenarios allowing to seamlessly switch from one
  * stream to another inside the same "decoding chain".
- * 
+ *
  * To achieve that, it combines the elements it autoplugged in chains
  *  and groups, allowing only one decoding group to be active at a given
  * time for a given chain.
  *
- * A chain can signal decodebin that it is complete by sending a 
+ * A chain can signal decodebin that it is complete by sending a
  * no-more-pads event, but even after that new pads can be added to
  * create new subgroups, providing that a new no-more-pads event is sent.
  *
@@ -96,7 +96,7 @@
  *
  * Typically, assuming that each fragment contains both audio and video,
  * the following tree would be created:
- * 
+ *
  * chain "DASH Demux"
  * |_ group "Representation set 1"
  * |   |_ chain "Qt Demux 0"
@@ -118,26 +118,26 @@
  * |   |       |_ chain "H264"
  * |   |_ chain "Qt Demux 1"
  * |       |_ group "Stream 1"
- * |           |_ chain "AAC" 
+ * |           |_ chain "AAC"
  * |_ group "Representation set 2"
  *     |_ chain "Qt Demux 3"
  *     |   |_ group "Stream 2"
  *     |       |_ chain "H264"
  *     |_ chain "Qt Demux 4"
  *         |_ group "Stream 3"
- *             |_ chain "AAC" 
+ *             |_ chain "AAC"
  *
  * In both cases, when switching from Set 1 to Set 2 an EOS is sent on
  * each end pad corresponding to Rep 0, triggering the "drain" state to
  * propagate upstream.
  * Once both EOS have been processed, the "Set 1" group is completely
  * drained, and decodebin2 will switch to the "Set 2" group.
- * 
- * Note: nothing can be pushed to the new decoding group before the 
- * old one has been drained, which means that in order to be able to 
+ *
+ * Note: nothing can be pushed to the new decoding group before the
+ * old one has been drained, which means that in order to be able to
  * adapt quickly to bandwidth changes, we will not be able to rely
  * on downstream buffering, and will instead manage an internal queue.
- * 
+ *
  */
 
 #ifdef HAVE_CONFIG_H
@@ -147,11 +147,19 @@
 #include <string.h>
 #include <inttypes.h>
 #include <gst/base/gsttypefindhelper.h>
+#include <gst/tag/tag.h>
 #include "gst/gst-i18n-plugin.h"
 #include "gstdashdemux.h"
 #include "gstdash_debug.h"
 
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u",
+static GstStaticPadTemplate gst_dash_demux_videosrc_template =
+GST_STATIC_PAD_TEMPLATE ("video_%02u",
+    GST_PAD_SRC,
+    GST_PAD_SOMETIMES,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate gst_dash_demux_audiosrc_template =
+GST_STATIC_PAD_TEMPLATE ("audio_%02u",
     GST_PAD_SRC,
     GST_PAD_SOMETIMES,
     GST_STATIC_CAPS_ANY);
@@ -179,11 +187,6 @@
 #define DEFAULT_BANDWIDTH_USAGE         0.8     /* 0 to 1     */
 #define DEFAULT_MAX_BITRATE        24000000     /* in bit/s  */
 
-#define DEFAULT_FAILED_COUNT 3
-
-#define GST_DASH_DEMUX_CLIENT_LOCK(d) g_mutex_lock (&d->client_lock)
-#define GST_DASH_DEMUX_CLIENT_UNLOCK(d) g_mutex_unlock (&d->client_lock)
-
 /* GObject */
 static void gst_dash_demux_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
@@ -191,50 +194,53 @@
     GValue * value, GParamSpec * pspec);
 static void gst_dash_demux_dispose (GObject * obj);
 
-/* GstElement */
-static GstStateChangeReturn
-gst_dash_demux_change_state (GstElement * element, GstStateChange transition);
-
-/* GstBin */
-static void gst_dash_demux_handle_message (GstBin * bin, GstMessage * msg);
+/* GstAdaptiveDemux */
+static GstClockTime gst_dash_demux_get_duration (GstAdaptiveDemux * ademux);
+static gboolean gst_dash_demux_is_live (GstAdaptiveDemux * ademux);
+static void gst_dash_demux_reset (GstAdaptiveDemux * ademux);
+static gboolean gst_dash_demux_process_manifest (GstAdaptiveDemux * ademux,
+    GstBuffer * buf);
+static gboolean gst_dash_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek);
+static GstFlowReturn
+gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream);
+static GstFlowReturn gst_dash_demux_stream_seek (GstAdaptiveDemuxStream *
+    stream, GstClockTime ts);
+static GstFlowReturn
+gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream);
+static gboolean
+gst_dash_demux_stream_advance_subfragment (GstAdaptiveDemuxStream * stream);
+static gboolean gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream *
+    stream, guint64 bitrate);
+static gint64
+gst_dash_demux_get_manifest_update_interval (GstAdaptiveDemux * demux);
+static GstFlowReturn
+gst_dash_demux_update_manifest (GstAdaptiveDemux * demux, GstBuffer * buf);
+static gint64
+gst_dash_demux_stream_get_fragment_waiting_time (GstAdaptiveDemuxStream *
+    stream);
+static void gst_dash_demux_advance_period (GstAdaptiveDemux * demux);
+static gboolean gst_dash_demux_has_next_period (GstAdaptiveDemux * demux);
+static GstFlowReturn gst_dash_demux_data_received (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+static GstFlowReturn
+gst_dash_demux_stream_fragment_finished (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
 
 /* GstDashDemux */
-static GstFlowReturn gst_dash_demux_pad (GstPad * pad, GstObject * parent,
-    GstBuffer * buf);
-static gboolean gst_dash_demux_sink_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static gboolean gst_dash_demux_src_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static gboolean gst_dash_demux_src_query (GstPad * pad, GstObject * parent,
-    GstQuery * query);
-static void gst_dash_demux_stream_download_loop (GstDashDemuxStream * stream);
-static void gst_dash_demux_stop (GstDashDemux * demux);
-static void gst_dash_demux_wait_stop (GstDashDemux * demux);
-static void gst_dash_demux_resume_download_task (GstDashDemux * demux);
 static gboolean gst_dash_demux_setup_all_streams (GstDashDemux * demux);
-static GstEvent
-    * gst_dash_demux_stream_select_representation_unlocked (GstDashDemuxStream *
-    stream);
-static GstFlowReturn gst_dash_demux_stream_get_next_fragment (GstDashDemuxStream
-    * stream, GstClockTime * ts);
-static gboolean gst_dash_demux_advance_period (GstDashDemux * demux);
-static void gst_dash_demux_download_wait (GstDashDemuxStream * stream,
-    GstClockTime time_diff);
-static void gst_dash_demux_stream_download_uri (GstDashDemux * demux,
-    GstDashDemuxStream * stream, const gchar * uri, gint64 start, gint64 end);
+static void gst_dash_demux_stream_free (GstAdaptiveDemuxStream * stream);
 
-static void gst_dash_demux_expose_streams (GstDashDemux * demux);
-static void gst_dash_demux_remove_streams (GstDashDemux * demux,
-    GSList * streams);
-static void gst_dash_demux_stream_free (GstDashDemuxStream * stream);
-static void gst_dash_demux_reset (GstDashDemux * demux, gboolean dispose);
 static GstCaps *gst_dash_demux_get_input_caps (GstDashDemux * demux,
     GstActiveStream * stream);
 static GstPad *gst_dash_demux_create_pad (GstDashDemux * demux,
-    GstDashDemuxStream * stream);
+    GstActiveStream * stream);
+
+#define SIDX(s) (&(s)->sidx_parser.sidx)
+#define SIDX_ENTRY(s,i) (&(SIDX(s)->entries[(i)]))
+#define SIDX_CURRENT_ENTRY(s) SIDX_ENTRY(s, SIDX(s)->entry_index)
 
 #define gst_dash_demux_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstDashDemux, gst_dash_demux, GST_TYPE_BIN,
+G_DEFINE_TYPE_WITH_CODE (GstDashDemux, gst_dash_demux, GST_TYPE_ADAPTIVE_DEMUX,
     GST_DEBUG_CATEGORY_INIT (gst_dash_demux_debug, "dashdemux", 0,
         "dashdemux element");
     );
@@ -244,11 +250,11 @@
 {
   GstDashDemux *demux = GST_DASH_DEMUX (obj);
 
-  gst_dash_demux_reset (demux, TRUE);
+  gst_dash_demux_reset (GST_ADAPTIVE_DEMUX_CAST (demux));
 
-  if (demux->downloader != NULL) {
-    g_object_unref (demux->downloader);
-    demux->downloader = NULL;
+  if (demux->client) {
+    gst_mpd_client_free (demux->client);
+    demux->client = NULL;
   }
 
   g_mutex_clear (&demux->client_lock);
@@ -256,34 +262,68 @@
   G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
 
+static gboolean
+gst_dash_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start,
+    gint64 * stop)
+{
+  GstDashDemux *self = GST_DASH_DEMUX (demux);
+  GDateTime *now = g_date_time_new_now_utc ();
+  GDateTime *mstart =
+      gst_date_time_to_g_date_time (self->client->
+      mpd_node->availabilityStartTime);
+  GTimeSpan stream_now;
+
+  stream_now = g_date_time_difference (now, mstart);
+  g_date_time_unref (now);
+  g_date_time_unref (mstart);
+  *stop = stream_now * GST_USECOND;
+
+  *start = *stop - (self->client->mpd_node->timeShiftBufferDepth * GST_MSECOND);
+  return TRUE;
+}
+
+static GstClockTime
+gst_dash_demux_get_presentation_offset (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+
+  return gst_mpd_parser_get_stream_presentation_offset (dashdemux->client,
+      dashstream->index);
+}
+
 static void
 gst_dash_demux_class_init (GstDashDemuxClass * klass)
 {
   GObjectClass *gobject_class;
   GstElementClass *gstelement_class;
-  GstBinClass *gstbin_class;
+  GstAdaptiveDemuxClass *gstadaptivedemux_class;
 
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
-  gstbin_class = (GstBinClass *) klass;
+  gstadaptivedemux_class = (GstAdaptiveDemuxClass *) klass;
 
   gobject_class->set_property = gst_dash_demux_set_property;
   gobject_class->get_property = gst_dash_demux_get_property;
   gobject_class->dispose = gst_dash_demux_dispose;
 
+#ifndef GST_REMOVE_DEPRECATED
   g_object_class_install_property (gobject_class, PROP_MAX_BUFFERING_TIME,
       g_param_spec_uint ("max-buffering-time", "Maximum buffering time",
           "Maximum number of seconds of buffer accumulated during playback"
           "(deprecated)",
           2, G_MAXUINT, DEFAULT_MAX_BUFFERING_TIME,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
 
   g_object_class_install_property (gobject_class, PROP_BANDWIDTH_USAGE,
       g_param_spec_float ("bandwidth-usage",
           "Bandwidth usage [0..1]",
-          "Percentage of the available bandwidth to use when selecting representations",
+          "Percentage of the available bandwidth to use when "
+          "selecting representations (deprecated)",
           0, 1, DEFAULT_BANDWIDTH_USAGE,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#endif
 
   g_object_class_install_property (gobject_class, PROP_MAX_BITRATE,
       g_param_spec_uint ("max-bitrate", "Max bitrate",
@@ -291,11 +331,10 @@
           1000, G_MAXUINT, DEFAULT_MAX_BITRATE,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  gstelement_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_dash_demux_change_state);
-
   gst_element_class_add_pad_template (gstelement_class,
-      gst_static_pad_template_get (&srctemplate));
+      gst_static_pad_template_get (&gst_dash_demux_audiosrc_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_dash_demux_videosrc_template));
 
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&sinktemplate));
@@ -308,38 +347,53 @@
                 Hamid Zakari <hamid.zakari@gmail.com>\n\
                 Gianluca Gennari <gennarone@gmail.com>");
 
-  gstbin_class->handle_message = gst_dash_demux_handle_message;
+
+  gstadaptivedemux_class->get_duration = gst_dash_demux_get_duration;
+  gstadaptivedemux_class->is_live = gst_dash_demux_is_live;
+  gstadaptivedemux_class->reset = gst_dash_demux_reset;
+  gstadaptivedemux_class->seek = gst_dash_demux_seek;
+
+  gstadaptivedemux_class->process_manifest = gst_dash_demux_process_manifest;
+  gstadaptivedemux_class->update_manifest = gst_dash_demux_update_manifest;
+  gstadaptivedemux_class->get_manifest_update_interval =
+      gst_dash_demux_get_manifest_update_interval;
+
+  gstadaptivedemux_class->has_next_period = gst_dash_demux_has_next_period;
+  gstadaptivedemux_class->advance_period = gst_dash_demux_advance_period;
+  gstadaptivedemux_class->stream_advance_fragment =
+      gst_dash_demux_stream_advance_fragment;
+  gstadaptivedemux_class->stream_get_fragment_waiting_time =
+      gst_dash_demux_stream_get_fragment_waiting_time;
+  gstadaptivedemux_class->stream_seek = gst_dash_demux_stream_seek;
+  gstadaptivedemux_class->stream_select_bitrate =
+      gst_dash_demux_stream_select_bitrate;
+  gstadaptivedemux_class->stream_update_fragment_info =
+      gst_dash_demux_stream_update_fragment_info;
+  gstadaptivedemux_class->stream_free = gst_dash_demux_stream_free;
+  gstadaptivedemux_class->get_live_seek_range =
+      gst_dash_demux_get_live_seek_range;
+  gstadaptivedemux_class->get_presentation_offset =
+      gst_dash_demux_get_presentation_offset;
 }
 
 static void
 gst_dash_demux_init (GstDashDemux * demux)
 {
-  /* sink pad */
-  demux->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
-  gst_pad_set_chain_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_dash_demux_pad));
-  gst_pad_set_event_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_dash_demux_sink_event));
-  gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
-
-  gst_segment_init (&demux->segment, GST_FORMAT_TIME);
-
-  /* Downloader */
-  demux->downloader = gst_uri_downloader_new ();
-
   /* Properties */
   demux->max_buffering_time = DEFAULT_MAX_BUFFERING_TIME * GST_SECOND;
-  demux->bandwidth_usage = DEFAULT_BANDWIDTH_USAGE;
   demux->max_bitrate = DEFAULT_MAX_BITRATE;
-  demux->last_manifest_update = GST_CLOCK_TIME_NONE;
 
   g_mutex_init (&demux->client_lock);
+
+  gst_adaptive_demux_set_stream_struct_size (GST_ADAPTIVE_DEMUX_CAST (demux),
+      sizeof (GstDashDemuxStream));
 }
 
 static void
 gst_dash_demux_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
+  GstAdaptiveDemux *adaptivedemux = GST_ADAPTIVE_DEMUX_CAST (object);
   GstDashDemux *demux = GST_DASH_DEMUX (object);
 
   switch (prop_id) {
@@ -347,7 +401,7 @@
       demux->max_buffering_time = g_value_get_uint (value) * GST_SECOND;
       break;
     case PROP_BANDWIDTH_USAGE:
-      demux->bandwidth_usage = g_value_get_float (value);
+      adaptivedemux->bitrate_limit = g_value_get_float (value);
       break;
     case PROP_MAX_BITRATE:
       demux->max_bitrate = g_value_get_uint (value);
@@ -362,6 +416,7 @@
 gst_dash_demux_get_property (GObject * object, guint prop_id, GValue * value,
     GParamSpec * pspec)
 {
+  GstAdaptiveDemux *adaptivedemux = GST_ADAPTIVE_DEMUX_CAST (object);
   GstDashDemux *demux = GST_DASH_DEMUX (object);
 
   switch (prop_id) {
@@ -369,7 +424,7 @@
       g_value_set_uint (value, demux->max_buffering_time / GST_SECOND);
       break;
     case PROP_BANDWIDTH_USAGE:
-      g_value_set_float (value, demux->bandwidth_usage);
+      g_value_set_float (value, adaptivedemux->bitrate_limit);
       break;
     case PROP_MAX_BITRATE:
       g_value_set_uint (value, demux->max_bitrate);
@@ -380,257 +435,6 @@
   }
 }
 
-static GstStateChangeReturn
-gst_dash_demux_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn ret;
-  GstDashDemux *demux = GST_DASH_DEMUX (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      gst_dash_demux_reset (demux, FALSE);
-      break;
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      break;
-    default:
-      break;
-  }
-  return ret;
-}
-
-static void
-gst_dash_demux_handle_message (GstBin * bin, GstMessage * msg)
-{
-  GstDashDemux *demux = GST_DASH_DEMUX_CAST (bin);
-
-  switch (GST_MESSAGE_TYPE (msg)) {
-    case GST_MESSAGE_ERROR:{
-      GSList *iter;
-      GstDashDemuxStream *stream;
-      GError *err = NULL;
-      gchar *debug = NULL;
-
-      for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-        stream = iter->data;
-        if (GST_OBJECT_CAST (stream->src) == GST_MESSAGE_SRC (msg)) {
-          gst_message_parse_error (msg, &err, &debug);
-
-          GST_WARNING_OBJECT (stream->pad, "Source posted error: %d:%d %s (%s)",
-              err->domain, err->code, err->message, debug);
-
-          /* error, but ask to retry */
-          stream->last_ret = GST_FLOW_CUSTOM_ERROR;
-          g_cond_signal (&stream->fragment_download_cond);
-
-          g_error_free (err);
-          g_free (debug);
-          break;
-        }
-      }
-
-      gst_message_unref (msg);
-      msg = NULL;
-    }
-      break;
-    default:
-      break;
-  }
-
-  if (msg)
-    GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
-}
-
-static gboolean
-gst_dash_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  GstDashDemux *demux;
-
-  demux = GST_DASH_DEMUX (parent);
-
-  switch (event->type) {
-    case GST_EVENT_SEEK:
-    {
-      gdouble rate;
-      GstFormat format;
-      GstSeekFlags flags;
-      GstSeekType start_type, stop_type;
-      gint64 start, stop;
-      GList *list;
-      GstClockTime current_pos, target_pos;
-      guint current_period;
-      GstStreamPeriod *period;
-      GSList *iter;
-      gboolean update;
-
-      GST_INFO_OBJECT (demux, "Received seek event");
-
-      if (gst_mpd_client_is_live (demux->client)) {
-        GST_WARNING_OBJECT (demux, "Received seek event for live stream");
-        return FALSE;
-      }
-
-      gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
-          &stop_type, &stop);
-
-      if (format != GST_FORMAT_TIME)
-        return FALSE;
-
-      GST_DEBUG_OBJECT (demux,
-          "seek event, rate: %f type: %d start: %" GST_TIME_FORMAT " stop: %"
-          GST_TIME_FORMAT, rate, start_type, GST_TIME_ARGS (start),
-          GST_TIME_ARGS (stop));
-
-      gst_segment_do_seek (&demux->segment, rate, format, flags, start_type,
-          start, stop_type, stop, &update);
-
-      if (update) {
-        GstEvent *seg_evt;
-
-        GST_DASH_DEMUX_CLIENT_LOCK (demux);
-
-        if (flags & GST_SEEK_FLAG_FLUSH) {
-          GST_DEBUG_OBJECT (demux, "sending flush start");
-          for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-            GstDashDemuxStream *stream;
-            stream = iter->data;
-            gst_pad_push_event (stream->pad, gst_event_new_flush_start ());
-          }
-        }
-
-        gst_dash_demux_stop (demux);
-        GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-        gst_dash_demux_wait_stop (demux);
-
-        /* select the requested Period in the Media Presentation */
-        if (demux->segment.rate > 0.0)
-          target_pos = (GstClockTime) demux->segment.start;
-        else
-          target_pos = (GstClockTime) demux->segment.stop;
-        GST_DEBUG_OBJECT (demux, "Seeking to target %" GST_TIME_FORMAT,
-            GST_TIME_ARGS (target_pos));
-        current_period = 0;
-        for (list = g_list_first (demux->client->periods); list;
-            list = g_list_next (list)) {
-          period = list->data;
-          current_pos = period->start;
-          current_period = period->number;
-          GST_DEBUG_OBJECT (demux, "Looking at period %u pos %" GST_TIME_FORMAT,
-              current_period, GST_TIME_ARGS (current_pos));
-          if (current_pos <= target_pos
-              && target_pos < current_pos + period->duration) {
-            break;
-          }
-        }
-        if (list == NULL) {
-          GST_WARNING_OBJECT (demux, "Could not find seeked Period");
-          return FALSE;
-        }
-        if (current_period != gst_mpd_client_get_period_index (demux->client)) {
-          GSList *streams = NULL;
-
-          GST_DEBUG_OBJECT (demux, "Seeking to Period %d", current_period);
-          streams = demux->streams;
-          demux->streams = NULL;
-          /* clean old active stream list, if any */
-          gst_active_streams_free (demux->client);
-
-          /* setup video, audio and subtitle streams, starting from the new Period */
-          if (!gst_mpd_client_set_period_index (demux->client, current_period)
-              || !gst_dash_demux_setup_all_streams (demux))
-            return FALSE;
-
-          gst_dash_demux_expose_streams (demux);
-          gst_dash_demux_remove_streams (demux, streams);
-        }
-
-        /* Update the current sequence on all streams */
-        seg_evt = gst_event_new_segment (&demux->segment);
-        gst_event_set_seqnum (seg_evt, gst_event_get_seqnum (event));
-        for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-          GstDashDemuxStream *stream = iter->data;
-          gst_mpd_client_stream_seek (demux->client, stream->active_stream,
-              target_pos);
-
-          gst_event_replace (&stream->pending_segment, seg_evt);
-        }
-        gst_event_unref (seg_evt);
-
-        if (flags & GST_SEEK_FLAG_FLUSH) {
-          GST_DEBUG_OBJECT (demux, "Sending flush stop on all pad");
-          for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-            GstDashDemuxStream *stream;
-
-            stream = iter->data;
-            stream->need_header = TRUE;
-            stream->stream_eos = FALSE;
-            gst_pad_push_event (stream->pad, gst_event_new_flush_stop (TRUE));
-          }
-        }
-
-        /* Restart the demux */
-        GST_DASH_DEMUX_CLIENT_LOCK (demux);
-        demux->cancelled = FALSE;
-        demux->end_of_manifest = FALSE;
-        for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-          GstDashDemuxStream *stream = iter->data;
-          stream->last_ret = GST_FLOW_OK;
-        }
-        demux->timestamp_offset = 0;
-        gst_uri_downloader_reset (demux->downloader);
-        GST_DEBUG_OBJECT (demux, "Resuming tasks after seeking");
-        gst_dash_demux_resume_download_task (demux);
-        GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-      }
-
-      return TRUE;
-    }
-    case GST_EVENT_RECONFIGURE:{
-      GSList *iter;
-
-      GST_DASH_DEMUX_CLIENT_LOCK (demux);
-      for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-        GstDashDemuxStream *stream = iter->data;
-
-        if (stream->pad == pad) {
-          if (stream->last_ret == GST_FLOW_NOT_LINKED) {
-            stream->last_ret = GST_FLOW_OK;
-            stream->restart_download = TRUE;
-            stream->need_header = TRUE;
-            stream->discont = TRUE;
-            GST_DEBUG_OBJECT (stream->pad, "Restarting download loop");
-            gst_task_start (stream->download_task);
-          }
-          GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-          gst_event_unref (event);
-          return TRUE;
-        }
-      }
-      GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-    }
-      break;
-    case GST_EVENT_LATENCY:{
-      /* Upstream and our internal source are irrelevant
-       * for latency, and we should not fail here to
-       * configure the latency */
-      gst_event_unref (event);
-      return TRUE;
-    }
-    default:
-      break;
-  }
-
-  return gst_pad_event_default (pad, parent, event);
-}
-
 static gboolean
 gst_dash_demux_setup_mpdparser_streams (GstDashDemux * demux,
     GstMpdClient * client)
@@ -654,35 +458,13 @@
 }
 
 static gboolean
-gst_dash_demux_all_streams_eop (GstDashDemux * demux)
-{
-  GSList *iter = NULL;
-
-  GST_DEBUG_OBJECT (demux, "Checking if all streams are EOP");
-
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-
-    GST_LOG_OBJECT (stream->pad, "EOP: %d (linked: %d)", stream->stream_eos,
-        stream->last_ret != GST_FLOW_NOT_LINKED);
-
-    if (!stream->stream_eos && stream->last_ret != GST_FLOW_NOT_LINKED)
-      return FALSE;
-  }
-
-  return TRUE;
-}
-
-static gboolean
 gst_dash_demux_setup_all_streams (GstDashDemux * demux)
 {
   guint i;
-  GSList *streams = NULL;
 
   GST_DEBUG_OBJECT (demux, "Setting up streams for period %d",
       gst_mpd_client_get_period_index (demux->client));
 
-  GST_MPD_CLIENT_LOCK (demux->client);
   /* clean old active stream list, if any */
   gst_active_streams_free (demux->client);
 
@@ -695,1089 +477,250 @@
     GstDashDemuxStream *stream;
     GstActiveStream *active_stream;
     GstCaps *caps;
-    GstEvent *event;
-    gchar *stream_id;
+    GstPad *srcpad;
+    gchar *lang = NULL;
+    GstTagList *tags = NULL;
 
     active_stream = gst_mpdparser_get_active_stream_by_index (demux->client, i);
     if (active_stream == NULL)
       continue;
 
-    stream = g_new0 (GstDashDemuxStream, 1);
-    stream->demux = demux;
-    stream->active_stream = active_stream;
-    stream->discont = FALSE;
+    srcpad = gst_dash_demux_create_pad (demux, active_stream);
     caps = gst_dash_demux_get_input_caps (demux, active_stream);
-
-    g_rec_mutex_init (&stream->download_task_lock);
-    stream->download_task =
-        gst_task_new ((GstTaskFunction) gst_dash_demux_stream_download_loop,
-        stream, NULL);
-    gst_task_set_lock (stream->download_task, &stream->download_task_lock);
-    g_cond_init (&stream->download_cond);
-    g_mutex_init (&stream->download_mutex);
-    stream->download_total_time = 0;
-    stream->download_total_bytes = 0;
-
-    stream->index = i;
-    stream->input_caps = caps;
-    stream->need_header = TRUE;
-    g_cond_init (&stream->fragment_download_cond);
-    g_mutex_init (&stream->fragment_download_lock);
-
     GST_LOG_OBJECT (demux, "Creating stream %d %" GST_PTR_FORMAT, i, caps);
-    streams = g_slist_prepend (streams, stream);
-    stream->pad = gst_dash_demux_create_pad (demux, stream);
 
-    stream_id =
-        gst_pad_create_stream_id_printf (stream->pad,
-        GST_ELEMENT_CAST (demux), "%d", i);
+    if (active_stream->cur_adapt_set) {
+      GstAdaptationSetNode *adp_set = active_stream->cur_adapt_set;
+      lang = adp_set->lang;
 
-    event =
-        gst_pad_get_sticky_event (demux->sinkpad, GST_EVENT_STREAM_START, 0);
-    if (event) {
-      if (gst_event_parse_group_id (event, &demux->group_id))
-        demux->have_group_id = TRUE;
-      else
-        demux->have_group_id = FALSE;
-      gst_event_unref (event);
-    } else if (!demux->have_group_id) {
-      demux->have_group_id = TRUE;
-      demux->group_id = gst_util_group_id_next ();
+      /* Fallback to the language in ContentComponent node */
+      if (lang == NULL && g_list_length (adp_set->ContentComponents) == 1) {
+        GstContentComponentNode *cc_node = adp_set->ContentComponents->data;
+        lang = cc_node->lang;
+      }
     }
-    event = gst_event_new_stream_start (stream_id);
-    if (demux->have_group_id)
-      gst_event_set_group_id (event, demux->group_id);
 
-    gst_pad_push_event (stream->pad, event);
-    g_free (stream_id);
+    if (lang) {
+      if (gst_tag_check_language_code (lang))
+        tags = gst_tag_list_new (GST_TAG_LANGUAGE_CODE, lang, NULL);
+      else
+        tags = gst_tag_list_new (GST_TAG_LANGUAGE_NAME, lang, NULL);
+    }
 
-    gst_pad_push_event (stream->pad, gst_event_new_caps (caps));
+    stream = (GstDashDemuxStream *)
+        gst_adaptive_demux_stream_new (GST_ADAPTIVE_DEMUX_CAST (demux), srcpad);
+    stream->active_stream = active_stream;
+    gst_adaptive_demux_stream_set_caps (GST_ADAPTIVE_DEMUX_STREAM_CAST (stream),
+        caps);
+    if (tags)
+      gst_adaptive_demux_stream_set_tags (GST_ADAPTIVE_DEMUX_STREAM_CAST
+          (stream), tags);
+    stream->index = i;
+    stream->pending_seek_ts = GST_CLOCK_TIME_NONE;
+    gst_isoff_sidx_parser_init (&stream->sidx_parser);
   }
-  streams = g_slist_reverse (streams);
-
-  demux->next_periods = g_slist_append (demux->next_periods, streams);
-  GST_MPD_CLIENT_UNLOCK (demux->client);
 
   return TRUE;
 }
 
-static gboolean
-gst_dash_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
+static GstClockTime
+gst_dash_demux_get_duration (GstAdaptiveDemux * ademux)
 {
-  GstDashDemux *demux = GST_DASH_DEMUX (parent);
+  GstDashDemux *demux = GST_DASH_DEMUX_CAST (ademux);
 
-  switch (event->type) {
-    case GST_EVENT_FLUSH_STOP:
-      gst_dash_demux_reset (demux, FALSE);
-      break;
-    case GST_EVENT_EOS:{
-      gchar *manifest;
-      GstQuery *query;
-      gboolean query_res;
-      gboolean ret = TRUE;
-      GstMapInfo mapinfo;
+  g_return_val_if_fail (demux->client != NULL, GST_CLOCK_TIME_NONE);
 
-      if (demux->manifest == NULL) {
-        GST_WARNING_OBJECT (demux, "Received EOS without a manifest.");
-        break;
-      }
-
-      GST_DEBUG_OBJECT (demux, "Got EOS on the sink pad: manifest fetched");
-
-      GST_DASH_DEMUX_CLIENT_LOCK (demux);
-      if (demux->client)
-        gst_mpd_client_free (demux->client);
-      demux->client = gst_mpd_client_new ();
-
-      query = gst_query_new_uri ();
-      query_res = gst_pad_peer_query (pad, query);
-      if (query_res) {
-        gchar *uri, *redirect_uri;
-        gboolean permanent;
-
-        gst_query_parse_uri (query, &uri);
-        gst_query_parse_uri_redirection (query, &redirect_uri);
-        gst_query_parse_uri_redirection_permanent (query, &permanent);
-
-        if (permanent && redirect_uri) {
-          demux->client->mpd_uri = redirect_uri;
-          demux->client->mpd_base_uri = NULL;
-          g_free (uri);
-        } else {
-          demux->client->mpd_uri = uri;
-          demux->client->mpd_base_uri = redirect_uri;
-        }
-
-        GST_DEBUG_OBJECT (demux, "Fetched MPD file at URI: %s (base: %s)",
-            demux->client->mpd_uri, GST_STR_NULL (demux->client->mpd_base_uri));
-      } else {
-        GST_WARNING_OBJECT (demux, "MPD URI query failed.");
-      }
-      gst_query_unref (query);
-
-      if (gst_buffer_map (demux->manifest, &mapinfo, GST_MAP_READ)) {
-        manifest = (gchar *) mapinfo.data;
-        if (!gst_mpd_parse (demux->client, manifest, mapinfo.size)) {
-          /* In most cases, this will happen if we set a wrong url in the
-           * source element and we have received the 404 HTML response instead of
-           * the manifest */
-          GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid manifest."),
-              (NULL));
-          ret = FALSE;
-        }
-        gst_buffer_unmap (demux->manifest, &mapinfo);
-      } else {
-        GST_WARNING_OBJECT (demux, "Error validating the manifest.");
-        ret = FALSE;
-      }
-      gst_buffer_unref (demux->manifest);
-      demux->manifest = NULL;
-
-      if (!ret)
-        goto seek_quit;
-
-      if (!gst_mpd_client_setup_media_presentation (demux->client)) {
-        GST_ELEMENT_ERROR (demux, STREAM, DECODE,
-            ("Incompatible manifest file."), (NULL));
-        ret = FALSE;
-        goto seek_quit;
-      }
-
-      /* setup video, audio and subtitle streams, starting from first Period */
-      if (!gst_mpd_client_set_period_index (demux->client, 0) ||
-          !gst_dash_demux_setup_all_streams (demux)) {
-        ret = FALSE;
-        goto seek_quit;
-      }
-
-      gst_dash_demux_advance_period (demux);
-
-      /* If stream is live, try to find the segment that is closest to current time */
-      if (gst_mpd_client_is_live (demux->client)) {
-        GSList *iter;
-        GstDateTime *now = gst_date_time_new_now_utc ();
-        gint seg_idx;
-
-        GST_DEBUG_OBJECT (demux,
-            "Seeking to current time of day for live stream ");
-        if (demux->client->mpd_node->suggestedPresentationDelay != -1) {
-          GstDateTime *target = gst_mpd_client_add_time_difference (now,
-              demux->client->mpd_node->suggestedPresentationDelay * -1000);
-          gst_date_time_unref (now);
-          now = target;
-        }
-        for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-          GstDashDemuxStream *stream = iter->data;
-          GstActiveStream *active_stream = stream->active_stream;
-
-          /* Get segment index corresponding to current time. */
-          seg_idx =
-              gst_mpd_client_get_segment_index_at_time (demux->client,
-              active_stream, now);
-          if (seg_idx < 0) {
-            GST_WARNING_OBJECT (demux,
-                "Failed to find a segment that is available "
-                "at this point in time for stream %d.", stream->index);
-            seg_idx = 0;
-          }
-          GST_INFO_OBJECT (demux,
-              "Segment index corresponding to current time for stream "
-              "%d is %d.", stream->index, seg_idx);
-          gst_mpd_client_set_segment_index (active_stream, seg_idx);
-        }
-
-        gst_date_time_unref (now);
-      } else {
-        GST_DEBUG_OBJECT (demux,
-            "Seeking to first segment for on-demand stream ");
-
-        /* start playing from the first segment */
-        gst_mpd_client_set_segment_index_for_all_streams (demux->client, 0);
-      }
-
-      /* Send duration message */
-      if (!gst_mpd_client_is_live (demux->client)) {
-        GstClockTime duration =
-            gst_mpd_client_get_media_presentation_duration (demux->client);
-
-        if (duration != GST_CLOCK_TIME_NONE) {
-          GST_DEBUG_OBJECT (demux,
-              "Sending duration message : %" GST_TIME_FORMAT,
-              GST_TIME_ARGS (duration));
-          gst_element_post_message (GST_ELEMENT (demux),
-              gst_message_new_duration_changed (GST_OBJECT (demux)));
-        } else {
-          GST_DEBUG_OBJECT (demux,
-              "mediaPresentationDuration unknown, can not send the duration message");
-        }
-      }
-      demux->timestamp_offset = -1;
-      gst_dash_demux_resume_download_task (demux);
-      GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-
-    seek_quit:
-      gst_event_unref (event);
-      return ret;
-    }
-    case GST_EVENT_SEGMENT:
-      /* Swallow newsegments, we'll push our own */
-      gst_event_unref (event);
-      return TRUE;
-    default:
-      break;
-  }
-
-  return gst_pad_event_default (pad, parent, event);
+  return gst_mpd_client_get_media_presentation_duration (demux->client);
 }
 
 static gboolean
-gst_dash_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
+gst_dash_demux_is_live (GstAdaptiveDemux * ademux)
 {
-  GstDashDemux *dashdemux;
-  gboolean ret = FALSE;
+  GstDashDemux *demux = GST_DASH_DEMUX_CAST (ademux);
 
-  if (query == NULL)
-    return FALSE;
+  g_return_val_if_fail (demux->client != NULL, FALSE);
 
-  dashdemux = GST_DASH_DEMUX (parent);
+  return gst_mpd_client_is_live (demux->client);
+}
 
-  switch (query->type) {
-    case GST_QUERY_DURATION:{
-      GstClockTime duration = -1;
-      GstFormat fmt;
+static gboolean
+gst_dash_demux_setup_streams (GstAdaptiveDemux * demux)
+{
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+  gboolean ret = TRUE;
+  GstDateTime *now = NULL;
+  guint period_idx;
 
-      gst_query_parse_duration (query, &fmt, NULL);
-      if (fmt == GST_FORMAT_TIME) {
-        duration =
-            gst_mpd_client_get_media_presentation_duration (dashdemux->client);
-        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) {
-          gst_query_set_duration (query, GST_FORMAT_TIME, duration);
-          ret = TRUE;
-        }
-      }
-      GST_DEBUG_OBJECT (dashdemux,
-          "GST_QUERY_DURATION returns %s with duration %" GST_TIME_FORMAT,
-          ret ? "TRUE" : "FALSE", GST_TIME_ARGS (duration));
-      break;
+  /* setup video, audio and subtitle streams, starting from first Period if
+   * non-live */
+  period_idx = 0;
+  if (gst_mpd_client_is_live (dashdemux->client)) {
+
+    /* get period index for period encompassing the current time */
+    now = gst_date_time_new_now_utc ();
+    if (dashdemux->client->mpd_node->suggestedPresentationDelay != -1) {
+      GstDateTime *target = gst_mpd_client_add_time_difference (now,
+          dashdemux->client->mpd_node->suggestedPresentationDelay * -1000);
+      gst_date_time_unref (now);
+      now = target;
     }
-    case GST_QUERY_SEEKING:{
-      GstFormat fmt;
-      gint64 start;
-      gint64 end;
-      gint64 stop = -1;
-
-      gst_query_parse_seeking (query, &fmt, NULL, &start, &end);
-      GST_DEBUG_OBJECT (dashdemux,
-          "Received GST_QUERY_SEEKING with format %d - %" G_GINT64_FORMAT
-          " %" G_GINT64_FORMAT, fmt, start, end);
-      if (fmt == GST_FORMAT_TIME) {
-        GstClockTime duration;
-
-        duration =
-            gst_mpd_client_get_media_presentation_duration (dashdemux->client);
-        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0)
-          stop = duration;
-
-        gst_query_set_seeking (query, fmt,
-            !gst_mpd_client_is_live (dashdemux->client), 0, stop);
-        ret = TRUE;
-
-        GST_DEBUG_OBJECT (dashdemux, "GST_QUERY_SEEKING returning with stop : %"
-            GST_TIME_FORMAT, GST_TIME_ARGS (stop));
-      }
-      break;
-    }
-    case GST_QUERY_LATENCY:
-    {
-      gboolean live;
-      GstClockTime min, max;
-
-      gst_query_parse_latency (query, &live, &min, &max);
-
-      if (dashdemux->client && gst_mpd_client_is_live (dashdemux->client))
-        live = TRUE;
-
-      if (dashdemux->max_buffering_time > 0)
-        max += dashdemux->max_buffering_time;
-
-      gst_query_set_latency (query, live, min, max);
-      ret = TRUE;
-      break;
-    }
-    default:{
-      /* By default, do not forward queries upstream */
-      break;
+    period_idx =
+        gst_mpd_client_get_period_index_at_time (dashdemux->client, now);
+    if (period_idx == G_MAXUINT) {
+#ifndef GST_DISABLE_GST_DEBUG
+      gchar *date_str = gst_date_time_to_iso8601_string (now);
+      GST_DEBUG_OBJECT (demux, "Unable to find live period active at %s",
+          date_str);
+      g_free (date_str);
+#endif
+      ret = FALSE;
+      goto done;
     }
   }
 
+  if (!gst_mpd_client_set_period_index (dashdemux->client, period_idx) ||
+      !gst_dash_demux_setup_all_streams (dashdemux)) {
+    ret = FALSE;
+    goto done;
+  }
+
+  /* If stream is live, try to find the segment that
+   * is closest to current time */
+  if (gst_mpd_client_is_live (dashdemux->client)) {
+    GList *iter;
+    gint seg_idx;
+
+    GST_DEBUG_OBJECT (demux, "Seeking to current time of day for live stream ");
+    for (iter = demux->next_streams; iter; iter = g_list_next (iter)) {
+      GstDashDemuxStream *stream = iter->data;
+      GstActiveStream *active_stream = stream->active_stream;
+
+      /* Get segment index corresponding to current time. */
+      seg_idx =
+          gst_mpd_client_get_segment_index_at_time (dashdemux->client,
+          active_stream, now);
+      if (seg_idx < 0) {
+        GST_WARNING_OBJECT (demux,
+            "Failed to find a segment that is available "
+            "at this point in time for stream %d.", stream->index);
+        seg_idx = 0;
+      }
+      GST_INFO_OBJECT (demux,
+          "Segment index corresponding to current time for stream "
+          "%d is %d.", stream->index, seg_idx);
+      gst_mpd_client_set_segment_index (active_stream, seg_idx);
+    }
+
+  } else {
+    GST_DEBUG_OBJECT (demux, "Seeking to first segment for on-demand stream ");
+
+    /* start playing from the first segment */
+    gst_mpd_client_set_segment_index_for_all_streams (dashdemux->client, 0);
+  }
+
+done:
+  if (now != NULL)
+    gst_date_time_unref (now);
+  return ret;
+}
+
+static gboolean
+gst_dash_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
+{
+  GstAdaptiveDemuxClass *klass;
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+  gboolean ret = FALSE;
+  gchar *manifest;
+  GstMapInfo mapinfo;
+
+  if (dashdemux->client)
+    gst_mpd_client_free (dashdemux->client);
+  dashdemux->client = gst_mpd_client_new ();
+
+  dashdemux->client->mpd_uri = g_strdup (demux->manifest_uri);
+  dashdemux->client->mpd_base_uri = g_strdup (demux->manifest_base_uri);
+
+  GST_DEBUG_OBJECT (demux, "Fetched MPD file at URI: %s (base: %s)",
+      dashdemux->client->mpd_uri,
+      GST_STR_NULL (dashdemux->client->mpd_base_uri));
+
+  if (gst_buffer_map (buf, &mapinfo, GST_MAP_READ)) {
+    manifest = (gchar *) mapinfo.data;
+    if (gst_mpd_parse (dashdemux->client, manifest, mapinfo.size)) {
+      if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client)) {
+        klass = GST_ADAPTIVE_DEMUX_GET_CLASS (dashdemux);
+
+        klass->data_received = gst_dash_demux_data_received;
+        klass->finish_fragment = gst_dash_demux_stream_fragment_finished;
+      }
+
+      if (gst_mpd_client_setup_media_presentation (dashdemux->client)) {
+        ret = TRUE;
+      } else {
+        GST_ELEMENT_ERROR (demux, STREAM, DECODE,
+            ("Incompatible manifest file."), (NULL));
+      }
+    }
+    gst_buffer_unmap (buf, &mapinfo);
+  } else {
+    GST_WARNING_OBJECT (demux, "Failed to map manifest buffer");
+  }
+
+  if (ret)
+    ret = gst_dash_demux_setup_streams (demux);
+
   return ret;
 }
 
-static GstFlowReturn
-gst_dash_demux_pad (GstPad * pad, GstObject * parent, GstBuffer * buf)
-{
-  GstDashDemux *demux = GST_DASH_DEMUX (parent);
-
-  if (demux->manifest == NULL)
-    demux->manifest = buf;
-  else
-    demux->manifest = gst_buffer_append (demux->manifest, buf);
-
-  return GST_FLOW_OK;
-}
-
-static void
-gst_dash_demux_wait_stop (GstDashDemux * demux)
-{
-  GSList *iter;
-
-  GST_DEBUG_OBJECT (demux, "Waiting for threads to stop");
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-
-    gst_task_join (stream->download_task);
-    gst_element_set_state (stream->src, GST_STATE_NULL);
-  }
-}
-
-static void
-gst_dash_demux_stop (GstDashDemux * demux)
-{
-  GSList *iter;
-
-  GST_DEBUG_OBJECT (demux, "Stopping demux");
-  demux->cancelled = TRUE;
-
-  if (demux->downloader)
-    gst_uri_downloader_cancel (demux->downloader);
-
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-
-    stream->last_ret = GST_FLOW_FLUSHING;
-    stream->need_header = TRUE;
-    gst_task_stop (stream->download_task);
-    GST_TASK_SIGNAL (stream->download_task);
-    gst_element_set_state (stream->src, GST_STATE_READY);
-    g_cond_signal (&stream->fragment_download_cond);
-  }
-}
-
 static GstPad *
-gst_dash_demux_create_pad (GstDashDemux * demux, GstDashDemuxStream * stream)
+gst_dash_demux_create_pad (GstDashDemux * demux, GstActiveStream * stream)
 {
   GstPad *pad;
   GstPadTemplate *tmpl;
+  gchar *name;
 
-  tmpl = gst_static_pad_template_get (&srctemplate);
+  switch (stream->mimeType) {
+    case GST_STREAM_AUDIO:
+      name = g_strdup_printf ("audio_%02u", demux->n_audio_streams++);
+      tmpl = gst_static_pad_template_get (&gst_dash_demux_audiosrc_template);
+      break;
+    case GST_STREAM_VIDEO:
+      name = g_strdup_printf ("video_%02u", demux->n_video_streams++);
+      tmpl = gst_static_pad_template_get (&gst_dash_demux_videosrc_template);
+      break;
+    default:
+      g_assert_not_reached ();
+      return NULL;
+  }
 
   /* Create and activate new pads */
-  pad = gst_ghost_pad_new_no_target_from_template (NULL, tmpl);
+  pad = gst_ghost_pad_new_no_target_from_template (name, tmpl);
+  g_free (name);
   gst_object_unref (tmpl);
 
-  gst_pad_set_event_function (pad,
-      GST_DEBUG_FUNCPTR (gst_dash_demux_src_event));
-  gst_pad_set_query_function (pad,
-      GST_DEBUG_FUNCPTR (gst_dash_demux_src_query));
-  gst_pad_set_element_private (pad, stream);
-
   gst_pad_set_active (pad, TRUE);
   GST_INFO_OBJECT (demux, "Creating srcpad %s:%s", GST_DEBUG_PAD_NAME (pad));
   return pad;
 }
 
 static void
-gst_dash_demux_expose_streams (GstDashDemux * demux)
+gst_dash_demux_reset (GstAdaptiveDemux * ademux)
 {
-  GSList *iter;
-
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-
-    GST_LOG_OBJECT (stream->pad, "Exposing stream %d %" GST_PTR_FORMAT,
-        stream->index, stream->input_caps);
-
-    gst_element_add_pad (GST_ELEMENT (demux), gst_object_ref (stream->pad));
-  }
-  gst_element_no_more_pads (GST_ELEMENT_CAST (demux));
-}
-
-static void
-gst_dash_demux_remove_streams (GstDashDemux * demux, GSList * streams)
-{
-  GSList *iter;
-  GstEvent *eos = gst_event_new_eos ();
-
-  for (iter = streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;;
-
-    GST_LOG_OBJECT (stream->pad, "Removing stream %d %" GST_PTR_FORMAT,
-        stream->index, stream->input_caps);
-    gst_pad_push_event (stream->pad, gst_event_ref (eos));
-    gst_pad_set_active (stream->pad, FALSE);
-    gst_element_remove_pad (GST_ELEMENT (demux), stream->pad);
-    gst_dash_demux_stream_free (stream);
-  }
-  gst_event_unref (eos);
-  g_slist_free (streams);
-}
-
-static gboolean
-gst_dash_demux_advance_period (GstDashDemux * demux)
-{
-  GSList *old_period = NULL;
-  GSList *iter;
-  GstEvent *seg_evt;
-
-  GST_DEBUG_OBJECT (demux, "Advancing period from %p", demux->streams);
-
-  if (demux->streams) {
-    g_assert (demux->streams == demux->next_periods->data);
-
-    demux->next_periods = g_slist_remove (demux->next_periods, demux->streams);
-    old_period = demux->streams;
-    demux->streams = NULL;
-  }
-
-  GST_DEBUG_OBJECT (demux, "Next period %p", demux->next_periods);
-
-  if (demux->next_periods) {
-    demux->streams = demux->next_periods->data;
-  } else {
-    GST_DEBUG_OBJECT (demux, "No next periods, return FALSE");
-    GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-    return FALSE;
-  }
-
-  GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-
-  /* TODO protect with lock, using the client lock isn't useful
-   * because causes deadlocks with the event_src handler */
-  gst_dash_demux_expose_streams (demux);
-  seg_evt = gst_event_new_segment (&demux->segment);
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-
-    gst_event_replace (&stream->pending_segment, seg_evt);
-  }
-  gst_event_unref (seg_evt);
-  gst_dash_demux_remove_streams (demux, old_period);
-
-  GST_DASH_DEMUX_CLIENT_LOCK (demux);
-  return TRUE;
-}
-
-static void
-gst_dash_demux_stream_free (GstDashDemuxStream * stream)
-{
-  if (stream->input_caps) {
-    gst_caps_unref (stream->input_caps);
-    stream->input_caps = NULL;
-  }
-  if (stream->pending_segment) {
-    gst_event_unref (stream->pending_segment);
-  }
-  if (stream->pad) {
-    gst_object_unref (stream->pad);
-    stream->pad = NULL;
-  }
-  if (stream->download_task) {
-    gst_task_stop (stream->download_task);
-    gst_object_unref (stream->download_task);
-    g_rec_mutex_clear (&stream->download_task_lock);
-  }
-  g_cond_clear (&stream->download_cond);
-  g_mutex_clear (&stream->download_mutex);
-
-  if (stream->src_srcpad) {
-    gst_object_unref (stream->src_srcpad);
-    stream->src_srcpad = NULL;
-  }
-
-  if (stream->src) {
-    gst_element_set_state (stream->src, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (stream->demux), stream->src);
-    stream->src = NULL;
-  }
-
-  g_cond_clear (&stream->fragment_download_cond);
-  g_mutex_clear (&stream->fragment_download_lock);
-
-  g_free (stream);
-}
-
-static void
-gst_dash_demux_reset (GstDashDemux * demux, gboolean dispose)
-{
-  GSList *iter;
+  GstDashDemux *demux = GST_DASH_DEMUX_CAST (ademux);
 
   GST_DEBUG_OBJECT (demux, "Resetting demux");
 
   demux->end_of_period = FALSE;
   demux->end_of_manifest = FALSE;
 
-  gst_dash_demux_stop (demux);
-  gst_dash_demux_wait_stop (demux);
-  if (demux->downloader)
-    gst_uri_downloader_reset (demux->downloader);
-
-  if (demux->next_periods) {
-    g_assert (demux->next_periods->data == demux->streams);
-    demux->next_periods =
-        g_slist_delete_link (demux->next_periods, demux->next_periods);
-  }
-
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-    if (stream->pad) {
-      GST_INFO_OBJECT (demux, "Removing stream pad %s:%s",
-          GST_DEBUG_PAD_NAME (stream->pad));
-      gst_element_remove_pad (GST_ELEMENT (demux), stream->pad);
-    }
-    gst_dash_demux_stream_free (stream);
-  }
-  g_slist_free (demux->streams);
-  demux->streams = NULL;
-
-  for (iter = demux->next_periods; iter; iter = g_slist_next (iter)) {
-    GSList *streams = iter->data;
-    g_slist_free_full (streams, (GDestroyNotify) gst_dash_demux_stream_free);
-  }
-  g_slist_free (demux->next_periods);
-  demux->next_periods = NULL;
-
-  if (demux->manifest) {
-    gst_buffer_unref (demux->manifest);
-    demux->manifest = NULL;
-  }
   if (demux->client) {
     gst_mpd_client_free (demux->client);
     demux->client = NULL;
   }
-  if (!dispose) {
-    demux->client = gst_mpd_client_new ();
-  }
+  demux->client = gst_mpd_client_new ();
 
-  gst_segment_init (&demux->segment, GST_FORMAT_TIME);
-  demux->last_manifest_update = GST_CLOCK_TIME_NONE;
-  demux->cancelled = FALSE;
-}
-
-static GstFlowReturn
-gst_dash_demux_refresh_mpd (GstDashDemux * demux)
-{
-  GstFragment *download;
-  GstBuffer *buffer;
-  GstClockTime duration, now = gst_util_get_timestamp ();
-  gint64 update_period = demux->client->mpd_node->minimumUpdatePeriod;
-
-  if (update_period == -1) {
-    GST_DEBUG_OBJECT (demux, "minimumUpdatePeriod unspecified, "
-        "will not update MPD");
-    return GST_FLOW_OK;
-  }
-
-  /* init reference time for manifest file updates */
-  if (!GST_CLOCK_TIME_IS_VALID (demux->last_manifest_update))
-    demux->last_manifest_update = now;
-
-  GST_DEBUG_OBJECT (demux,
-      "Next update: %" GST_TIME_FORMAT " now: %" GST_TIME_FORMAT,
-      GST_TIME_ARGS ((demux->last_manifest_update +
-              update_period * GST_MSECOND)), GST_TIME_ARGS (now));
-
-  /* update the manifest file */
-  if (now >= demux->last_manifest_update + update_period * GST_MSECOND) {
-    GST_DEBUG_OBJECT (demux, "Updating manifest file from URL %s",
-        demux->client->mpd_uri);
-    download = gst_uri_downloader_fetch_uri (demux->downloader,
-        demux->client->mpd_uri, NULL, TRUE, TRUE, TRUE, NULL);
-    if (download) {
-      GstMpdClient *new_client = NULL;
-
-      buffer = gst_fragment_get_buffer (download);
-      g_object_unref (download);
-      /* parse the manifest file */
-      if (buffer != NULL) {
-        GstMapInfo mapinfo;
-
-        new_client = gst_mpd_client_new ();
-
-        if (download->redirect_permanent && download->redirect_uri) {
-          new_client->mpd_uri = g_strdup (download->redirect_uri);
-          new_client->mpd_base_uri = NULL;
-        } else {
-          new_client->mpd_uri = g_strdup (download->uri);
-          new_client->mpd_base_uri = g_strdup (download->redirect_uri);
-        }
-
-        gst_buffer_map (buffer, &mapinfo, GST_MAP_READ);
-
-        if (gst_mpd_parse (new_client, (gchar *) mapinfo.data, mapinfo.size)) {
-          const gchar *period_id;
-          guint period_idx;
-          GSList *iter;
-
-          /* prepare the new manifest and try to transfer the stream position
-           * status from the old manifest client  */
-
-          gst_buffer_unmap (buffer, &mapinfo);
-          gst_buffer_unref (buffer);
-
-          GST_DEBUG_OBJECT (demux, "Updating manifest");
-
-          period_id = gst_mpd_client_get_period_id (demux->client);
-          period_idx = gst_mpd_client_get_period_index (demux->client);
-
-          /* setup video, audio and subtitle streams, starting from current Period */
-          if (!gst_mpd_client_setup_media_presentation (new_client)) {
-            /* TODO */
-          }
-
-          if (period_idx) {
-            if (!gst_mpd_client_set_period_id (new_client, period_id)) {
-              GST_DEBUG_OBJECT (demux,
-                  "Error setting up the updated manifest file");
-              return GST_FLOW_EOS;
-            }
-          } else {
-            if (!gst_mpd_client_set_period_index (new_client, period_idx)) {
-              GST_DEBUG_OBJECT (demux,
-                  "Error setting up the updated manifest file");
-              return GST_FLOW_EOS;
-            }
-          }
-
-          if (!gst_dash_demux_setup_mpdparser_streams (demux, new_client)) {
-            GST_ERROR_OBJECT (demux, "Failed to setup streams on manifest "
-                "update");
-            return GST_FLOW_ERROR;
-          }
-
-          /* update the streams to play from the next segment */
-          for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-            GstDashDemuxStream *demux_stream = iter->data;
-            GstActiveStream *new_stream = demux_stream->active_stream;
-            GstClockTime ts;
-
-            if (!new_stream) {
-              GST_DEBUG_OBJECT (demux,
-                  "Stream of index %d is missing from manifest update",
-                  demux_stream->index);
-              return GST_FLOW_EOS;
-            }
-
-            if (gst_mpd_client_get_next_fragment_timestamp (demux->client,
-                    demux_stream->index, &ts)) {
-              gst_mpd_client_stream_seek (new_client, new_stream, ts);
-            } else
-                if (gst_mpd_client_get_last_fragment_timestamp (demux->client,
-                    demux_stream->index, &ts)) {
-              /* try to set to the old timestamp + 1 */
-              gst_mpd_client_stream_seek (new_client, new_stream, ts + 1);
-            }
-          }
-
-          gst_mpd_client_free (demux->client);
-          demux->client = new_client;
-
-          /* Send an updated duration message */
-          duration =
-              gst_mpd_client_get_media_presentation_duration (demux->client);
-
-          if (duration != GST_CLOCK_TIME_NONE) {
-            GST_DEBUG_OBJECT (demux,
-                "Sending duration message : %" GST_TIME_FORMAT,
-                GST_TIME_ARGS (duration));
-            gst_element_post_message (GST_ELEMENT (demux),
-                gst_message_new_duration_changed (GST_OBJECT (demux)));
-          } else {
-            GST_DEBUG_OBJECT (demux,
-                "mediaPresentationDuration unknown, can not send the duration message");
-          }
-          demux->last_manifest_update = gst_util_get_timestamp ();
-          GST_DEBUG_OBJECT (demux, "Manifest file successfully updated");
-        } else {
-          /* In most cases, this will happen if we set a wrong url in the
-           * source element and we have received the 404 HTML response instead of
-           * the manifest */
-          GST_WARNING_OBJECT (demux, "Error parsing the manifest.");
-          gst_buffer_unmap (buffer, &mapinfo);
-          gst_buffer_unref (buffer);
-        }
-      } else {
-        /* download suceeded, but resulting buffer is NULL */
-        GST_WARNING_OBJECT (demux, "Error validating the manifest.");
-      }
-    } else {
-      /* download failed */
-      GST_WARNING_OBJECT (demux,
-          "Failed to update the manifest file from URL %s",
-          demux->client->mpd_uri);
-    }
-  }
-  return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_dash_demux_combine_flows (GstDashDemux * demux)
-{
-  gboolean all_notlinked = TRUE;
-  GSList *iter;
-
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-
-    if (stream->last_ret != GST_FLOW_NOT_LINKED)
-      all_notlinked = FALSE;
-
-    if (stream->last_ret <= GST_FLOW_NOT_NEGOTIATED
-        || stream->last_ret == GST_FLOW_FLUSHING)
-      return stream->last_ret;
-  }
-  if (all_notlinked)
-    return GST_FLOW_NOT_LINKED;
-  return GST_FLOW_OK;
-}
-
-
-/* gst_dash_demux_stream_download_loop:
- * 
- * Loop for the "download' task that fetches fragments based on the 
- * selected representations.
- * 
- * During playback:  
- * 
- * It sequentially fetches fragments corresponding to the current 
- * representations and pushes them downstream
- * 
- * When a new set of fragments has been downloaded, it evaluates the
- * download time to check if we can or should switch to a different 
- * set of representations.
- *
- * Teardown:
- * 
- * The task will exit when it encounters an error or when the end of the
- * manifest has been reached.
- */
-static void
-gst_dash_demux_stream_download_loop (GstDashDemuxStream * stream)
-{
-  GstDashDemux *demux = stream->demux;
-  GstFlowReturn flow_ret = GST_FLOW_OK;
-  GstClockTime fragment_ts = GST_CLOCK_TIME_NONE;
-  GstEvent *caps_event;
-
-  GST_LOG_OBJECT (stream->pad, "Starting download loop");
-
-  GST_DASH_DEMUX_CLIENT_LOCK (demux);
-  if (demux->cancelled) {
-    goto cancelled;
-  }
-
-  if (gst_mpd_client_is_live (demux->client)
-      && demux->client->mpd_uri != NULL) {
-    switch (gst_dash_demux_refresh_mpd (demux)) {
-      case GST_FLOW_EOS:
-        GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-        goto end_of_manifest;
-      default:
-        break;
-    }
-  }
-
-  /* try to switch to another set of representations if needed */
-  caps_event = gst_dash_demux_stream_select_representation_unlocked (stream);
-  GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-
-  if (G_UNLIKELY (caps_event && !gst_pad_push_event (stream->pad, caps_event))) {
-    /* TODO fail if caps is rejected */
-  }
-
-  /* fetch the next fragment */
-  flow_ret = gst_dash_demux_stream_get_next_fragment (stream, &fragment_ts);
-
-  GST_DASH_DEMUX_CLIENT_LOCK (demux);
-  if (demux->cancelled) {
-    goto cancelled;
-  }
-
-  stream->last_ret = flow_ret;
-  switch (flow_ret) {
-    case GST_FLOW_OK:
-      break;
-    case GST_FLOW_NOT_LINKED:
-      gst_task_pause (stream->download_task);
-      if (gst_dash_demux_combine_flows (demux) == GST_FLOW_NOT_LINKED) {
-        GST_ELEMENT_ERROR (demux, STREAM, FAILED,
-            (_("Internal data stream error.")),
-            ("stream stopped, reason %s",
-                gst_flow_get_name (GST_FLOW_NOT_LINKED)));
-      }
-      break;
-
-    case GST_FLOW_FLUSHING:
-      gst_dash_demux_stop (demux);
-      break;
-
-    case GST_FLOW_EOS:
-      GST_DEBUG_OBJECT (stream->pad, "EOS");
-      stream->stream_eos = TRUE;
-      if (gst_dash_demux_all_streams_eop (demux)) {
-        GST_INFO_OBJECT (stream->pad, "Reached the end of the Period");
-
-        if (gst_mpd_client_has_next_period (demux->client)) {
-
-          GST_INFO_OBJECT (demux, "Starting next period");
-          /* setup video, audio and subtitle streams, starting from the next Period */
-          if (!gst_mpd_client_set_period_index (demux->client,
-                  gst_mpd_client_get_period_index (demux->client) + 1)
-              || !gst_dash_demux_setup_all_streams (demux)) {
-          }
-
-          stream->last_ret = GST_FLOW_OK;
-          /* start playing from the first segment of the new period */
-          gst_mpd_client_set_segment_index_for_all_streams (demux->client, 0);
-
-          gst_dash_demux_advance_period (demux);
-
-          gst_dash_demux_resume_download_task (demux);
-          GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-
-          /* This pad is now finished, we lost its reference */
-          return;
-        }
-      }
-      gst_task_pause (stream->download_task);
-      break;
-    case GST_FLOW_ERROR:
-      /* Download failed 'by itself'
-       * in case this is live, we might be ahead or before playback, where
-       * segments don't exist (are still being created or were already deleted)
-       * so we either wait or jump ahead */
-      if (gst_mpd_client_is_live (demux->client)) {
-        gint64 time_diff;
-        gint pos;
-
-        pos =
-            gst_mpd_client_check_time_position (demux->client,
-            stream->active_stream, fragment_ts, &time_diff);
-        GST_DEBUG_OBJECT (stream->pad,
-            "Checked position for fragment ts %" GST_TIME_FORMAT
-            ", res: %d, diff: %" G_GINT64_FORMAT, GST_TIME_ARGS (fragment_ts),
-            pos, time_diff);
-
-        time_diff *= GST_USECOND;
-        if (pos < 0) {
-          /* we're behind, try moving to the 'present' */
-          GDateTime *now = g_date_time_new_now_utc ();
-
-          GST_DEBUG_OBJECT (stream->pad,
-              "Falling behind live stream, moving forward");
-          gst_mpd_client_seek_to_time (demux->client, now);
-          g_date_time_unref (now);
-
-        } else if (pos > 0) {
-          /* we're ahead, wait a little */
-
-          GST_DEBUG_OBJECT (stream->pad,
-              "Waiting for next segment to be created");
-          gst_mpd_client_set_segment_index (stream->active_stream,
-              stream->active_stream->segment_idx - 1);
-          gst_dash_demux_download_wait (stream, time_diff);
-        } else {
-          gst_mpd_client_set_segment_index (stream->active_stream,
-              stream->active_stream->segment_idx - 1);
-          demux->client->update_failed_count++;
-        }
-      } else {
-        demux->client->update_failed_count++;
-      }
-
-      if (demux->client->update_failed_count <= DEFAULT_FAILED_COUNT) {
-        GST_WARNING_OBJECT (stream->pad, "Could not fetch the next fragment");
-        goto quit;
-      } else {
-        goto error_downloading;
-      }
-      break;
-    default:
-      break;
-  }
-
-  if (G_LIKELY (stream->last_ret != GST_FLOW_ERROR))
-    demux->client->update_failed_count = 0;
-
-quit:
-  GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-
-  if (G_UNLIKELY (stream->last_ret == GST_FLOW_EOS)) {
-    gst_pad_push_event (stream->pad, gst_event_new_eos ());
-  }
-
-  GST_DEBUG_OBJECT (stream->pad, "Finishing download loop");
-  return;
-
-cancelled:
-  {
-    GST_WARNING_OBJECT (stream->pad, "Cancelled, leaving download task");
-    GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-    return;
-  }
-
-end_of_manifest:
-  {
-    GST_INFO_OBJECT (stream->pad, "End of manifest, leaving download task");
-    gst_task_stop (stream->download_task);
-    /* TODO should push eos? */
-    GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-    return;
-  }
-
-error_downloading:
-  {
-    GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
-        ("Could not fetch the next fragment, leaving download task"), (NULL));
-    gst_task_stop (stream->download_task);
-    GST_DASH_DEMUX_CLIENT_UNLOCK (demux);
-    return;
-  }
-}
-
-static void
-gst_dash_demux_resume_download_task (GstDashDemux * demux)
-{
-  GSList *iter;
-
-  for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-    GstDashDemuxStream *stream = iter->data;
-    gst_task_start (stream->download_task);
-  }
-}
-
-/*
- * gst_dash_demux_stream_select_representation_unlocked:
- *
- * Select the most appropriate media representation based on current target 
- * bitrate.
- */
-static GstEvent *
-gst_dash_demux_stream_select_representation_unlocked (GstDashDemuxStream *
-    stream)
-{
-  GstActiveStream *active_stream = NULL;
-  GList *rep_list = NULL;
-  gint new_index;
-  GstDashDemux *demux = stream->demux;
-  guint64 bitrate = 0;
-
-  active_stream = stream->active_stream;
-  if (active_stream == NULL)
-    return FALSE;
-
-  /* retrieve representation list */
-  if (active_stream->cur_adapt_set)
-    rep_list = active_stream->cur_adapt_set->Representations;
-  if (!rep_list)
-    return FALSE;
-
-  /* compare the time when the fragment was downloaded with the time when it was
-   * scheduled */
-  if (stream->download_total_time)
-    bitrate =
-        (stream->download_total_bytes * 8) /
-        ((double) stream->download_total_time / G_GUINT64_CONSTANT (1000000));
-
-  GST_DEBUG_OBJECT (stream->pad,
-      "Downloaded %u bytes in %" GST_TIME_FORMAT ". Bitrate is : %d",
-      (guint) stream->download_total_bytes,
-      GST_TIME_ARGS (stream->download_total_time * GST_USECOND),
-      (gint) bitrate);
-
-  /* Take old rate into account too */
-  if (stream->current_download_rate != -1)
-    bitrate = (stream->current_download_rate + bitrate * 3) / 4;
-  if (bitrate > G_MAXINT)
-    bitrate = G_MAXINT;
-  stream->current_download_rate = bitrate;
-  bitrate *= demux->bandwidth_usage;
-
-  GST_DEBUG_OBJECT (stream->pad,
-      "Trying to change to bitrate: %" G_GUINT64_FORMAT, bitrate);
-
-  /* get representation index with current max_bandwidth */
-  new_index = gst_mpdparser_get_rep_idx_with_max_bandwidth (rep_list, bitrate);
-
-  /* if no representation has the required bandwidth, take the lowest one */
-  if (new_index == -1)
-    new_index = gst_mpdparser_get_rep_idx_with_min_bandwidth (rep_list);
-
-  if (new_index != active_stream->representation_idx) {
-    GstRepresentationNode *rep = g_list_nth_data (rep_list, new_index);
-    GST_INFO_OBJECT (demux, "Changing representation idx: %d %d %u",
-        stream->index, new_index, rep->bandwidth);
-    if (gst_mpd_client_setup_representation (demux->client, active_stream, rep)) {
-      stream->need_header = TRUE;
-      GST_INFO_OBJECT (demux, "Switching bitrate to %d",
-          active_stream->cur_representation->bandwidth);
-      gst_caps_unref (stream->input_caps);
-      stream->input_caps = gst_dash_demux_get_input_caps (demux, active_stream);
-      return gst_event_new_caps (gst_caps_ref (stream->input_caps));
-    } else {
-      GST_WARNING_OBJECT (demux, "Can not switch representation, aborting...");
-      return NULL;
-    }
-  }
-  return NULL;
-}
-
-static void
-gst_dash_demux_download_header_fragment (GstDashDemux * demux,
-    GstDashDemuxStream * stream, gchar * path, gint64 range_start,
-    gint64 range_end)
-{
-  gchar *next_header_uri;
-
-  if (strncmp (path, "http://", 7) != 0) {
-    next_header_uri =
-        g_strconcat (gst_mpdparser_get_baseURL (demux->client, stream->index),
-        path, NULL);
-    g_free (path);
-  } else {
-    next_header_uri = path;
-  }
-
-  gst_dash_demux_stream_download_uri (demux, stream, next_header_uri,
-      range_start, range_end);
-  g_free (next_header_uri);
-}
-
-static void
-gst_dash_demux_get_next_header (GstDashDemux * demux,
-    GstDashDemuxStream * stream)
-{
-  gchar *initializationURL;
-  gint64 range_start, range_end;
-
-  if (!gst_mpd_client_get_next_header (demux->client, &initializationURL,
-          stream->index, &range_start, &range_end))
-    return;
-
-  GST_INFO_OBJECT (demux, "Fetching header %s %" G_GINT64_FORMAT "-%"
-      G_GINT64_FORMAT, initializationURL, range_start, range_end);
-  gst_dash_demux_download_header_fragment (demux, stream,
-      initializationURL, range_start, range_end);
-
-  /* check if we have an index */
-  if (!demux->cancelled && stream->last_ret == GST_FLOW_OK      /* TODO check for other valid types */
-      && gst_mpd_client_get_next_header_index (demux->client,
-          &initializationURL, stream->index, &range_start, &range_end)) {
-    GST_INFO_OBJECT (demux,
-        "Fetching index %s %" G_GINT64_FORMAT "-%" G_GINT64_FORMAT,
-        initializationURL, range_start, range_end);
-    gst_dash_demux_download_header_fragment (demux, stream,
-        initializationURL, range_start, range_end);
-  }
+  demux->n_audio_streams = 0;
+  demux->n_video_streams = 0;
 }
 
 static GstCaps *
@@ -1875,14 +818,436 @@
 }
 
 static void
-gst_dash_demux_wait_for_fragment_to_be_available (GstDashDemux * demux,
-    GstDashDemuxStream * stream)
+gst_dash_demux_stream_update_headers_info (GstAdaptiveDemuxStream * stream)
 {
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (stream->demux);
+  gchar *path = NULL;
+
+  gst_mpd_client_get_next_header (dashdemux->client,
+      &path, dashstream->index,
+      &stream->fragment.header_range_start, &stream->fragment.header_range_end);
+
+  if (path != NULL && strncmp (path, "http://", 7) != 0) {
+    stream->fragment.header_uri =
+        gst_uri_join_strings (gst_mpdparser_get_baseURL (dashdemux->client,
+            dashstream->index), path);
+    g_free (path);
+  } else {
+    stream->fragment.header_uri = path;
+  }
+  path = NULL;
+
+  gst_mpd_client_get_next_header_index (dashdemux->client,
+      &path, dashstream->index,
+      &stream->fragment.index_range_start, &stream->fragment.index_range_end);
+
+  if (path != NULL && strncmp (path, "http://", 7) != 0) {
+    stream->fragment.index_uri =
+        gst_uri_join_strings (gst_mpdparser_get_baseURL (dashdemux->client,
+            dashstream->index), path);
+    g_free (path);
+  } else {
+    stream->fragment.index_uri = path;
+  }
+}
+
+static GstFlowReturn
+gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream)
+{
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (stream->demux);
+  GstClockTime ts;
+  GstMediaFragmentInfo fragment;
+  gboolean isombff;
+
+  gst_adaptive_demux_stream_fragment_clear (&stream->fragment);
+
+  isombff = gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client);
+
+  if (GST_ADAPTIVE_DEMUX_STREAM_NEED_HEADER (stream) && isombff) {
+    gst_dash_demux_stream_update_headers_info (stream);
+    dashstream->sidx_base_offset = stream->fragment.index_range_end + 1;
+    if (dashstream->sidx_index != 0) {
+      /* request only the index to be downloaded as we need to reposition the
+       * stream to a subsegment */
+      return GST_FLOW_OK;
+    }
+  }
+
+  if (gst_mpd_client_get_next_fragment_timestamp (dashdemux->client,
+          dashstream->index, &ts)) {
+    if (GST_ADAPTIVE_DEMUX_STREAM_NEED_HEADER (stream)) {
+      gst_dash_demux_stream_update_headers_info (stream);
+    }
+
+    gst_mpd_client_get_next_fragment (dashdemux->client, dashstream->index,
+        &fragment);
+
+    stream->fragment.uri = fragment.uri;
+    if (isombff && dashstream->sidx_index != 0) {
+      GstSidxBoxEntry *entry = SIDX_CURRENT_ENTRY (dashstream);
+      stream->fragment.range_start =
+          dashstream->sidx_base_offset + entry->offset;
+      stream->fragment.timestamp = entry->pts;
+      stream->fragment.duration = entry->duration;
+      if (stream->demux->segment.rate < 0.0) {
+        stream->fragment.range_end =
+            stream->fragment.range_start + entry->size - 1;
+      } else {
+        stream->fragment.range_end = fragment.range_end;
+      }
+    } else {
+      stream->fragment.timestamp = fragment.timestamp;
+      stream->fragment.duration = fragment.duration;
+      stream->fragment.range_start =
+          MAX (fragment.range_start, dashstream->sidx_base_offset);
+      stream->fragment.range_end = fragment.range_end;
+    }
+
+    return GST_FLOW_OK;
+  }
+
+  return GST_FLOW_EOS;
+}
+
+static void
+gst_dash_demux_stream_sidx_seek (GstDashDemuxStream * dashstream,
+    GstClockTime ts)
+{
+  GstSidxBox *sidx = SIDX (dashstream);
+  gint i;
+
+  /* TODO optimize to a binary search */
+  for (i = 0; i < sidx->entries_count; i++) {
+    if (sidx->entries[i].pts + sidx->entries[i].duration >= ts)
+      break;
+  }
+  sidx->entry_index = i;
+  dashstream->sidx_index = i;
+  if (i < sidx->entries_count)
+    dashstream->sidx_current_remaining = sidx->entries[i].size;
+  else
+    dashstream->sidx_current_remaining = 0;
+}
+
+static GstFlowReturn
+gst_dash_demux_stream_seek (GstAdaptiveDemuxStream * stream, GstClockTime ts)
+{
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (stream->demux);
+
+  if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client)) {
+    if (dashstream->sidx_parser.status == GST_ISOFF_SIDX_PARSER_FINISHED) {
+      gst_dash_demux_stream_sidx_seek (dashstream, ts);
+    } else {
+      /* no index yet, seek when we have it */
+      dashstream->pending_seek_ts = ts;
+    }
+  }
+
+  gst_mpd_client_stream_seek (dashdemux->client, dashstream->active_stream, ts);
+  return GST_FLOW_OK;
+}
+
+static gboolean
+gst_dash_demux_stream_advance_subfragment (GstAdaptiveDemuxStream * stream)
+{
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+
+  GstSidxBox *sidx = SIDX (dashstream);
+  gboolean fragment_finished = TRUE;
+
+  if (dashstream->sidx_parser.status == GST_ISOFF_SIDX_PARSER_FINISHED) {
+    if (stream->demux->segment.rate > 0.0) {
+      sidx->entry_index++;
+      if (sidx->entry_index < sidx->entries_count) {
+        fragment_finished = FALSE;
+      }
+    } else {
+      sidx->entry_index--;
+      if (sidx->entry_index >= 0) {
+        fragment_finished = FALSE;
+      }
+    }
+  }
+
+  GST_DEBUG_OBJECT (stream->pad, "New sidx index: %d / %d. "
+      "Finished fragment: %d", sidx->entry_index, sidx->entries_count,
+      fragment_finished);
+
+  if (!fragment_finished) {
+    dashstream->sidx_current_remaining = sidx->entries[sidx->entry_index].size;
+  }
+  return !fragment_finished;
+}
+
+static GstFlowReturn
+gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream)
+{
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (stream->demux);
+
+  GST_DEBUG_OBJECT (stream->pad, "Advance fragment");
+
+  if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client)) {
+    if (gst_dash_demux_stream_advance_subfragment (stream))
+      return GST_FLOW_OK;
+  }
+
+  return gst_mpd_client_advance_segment (dashdemux->client,
+      dashstream->active_stream, stream->demux->segment.rate > 0.0);
+}
+
+static gboolean
+gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream,
+    guint64 bitrate)
+{
+  GstActiveStream *active_stream = NULL;
+  GList *rep_list = NULL;
+  gint new_index;
+  GstDashDemux *demux = GST_DASH_DEMUX_CAST (stream->demux);
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+  gboolean ret = FALSE;
+
+  active_stream = dashstream->active_stream;
+  if (active_stream == NULL) {
+    goto end;
+  }
+
+  /* retrieve representation list */
+  if (active_stream->cur_adapt_set)
+    rep_list = active_stream->cur_adapt_set->Representations;
+  if (!rep_list) {
+    goto end;
+  }
+
+  GST_DEBUG_OBJECT (stream->pad,
+      "Trying to change to bitrate: %" G_GUINT64_FORMAT, bitrate);
+
+  /* get representation index with current max_bandwidth */
+  new_index = gst_mpdparser_get_rep_idx_with_max_bandwidth (rep_list, bitrate);
+
+  /* if no representation has the required bandwidth, take the lowest one */
+  if (new_index == -1)
+    new_index = gst_mpdparser_get_rep_idx_with_min_bandwidth (rep_list);
+
+  if (new_index != active_stream->representation_idx) {
+    GstRepresentationNode *rep = g_list_nth_data (rep_list, new_index);
+    GST_INFO_OBJECT (demux, "Changing representation idx: %d %d %u",
+        dashstream->index, new_index, rep->bandwidth);
+    if (gst_mpd_client_setup_representation (demux->client, active_stream, rep)) {
+      GstCaps *caps;
+
+      GST_INFO_OBJECT (demux, "Switching bitrate to %d",
+          active_stream->cur_representation->bandwidth);
+      caps = gst_dash_demux_get_input_caps (demux, active_stream);
+      gst_adaptive_demux_stream_set_caps (stream, caps);
+      ret = TRUE;
+
+    } else {
+      GST_WARNING_OBJECT (demux, "Can not switch representation, aborting...");
+    }
+  }
+
+  if (gst_mpd_client_has_isoff_ondemand_profile (demux->client)) {
+
+    /* store our current position to change to the same one in a different
+     * representation if needed */
+    dashstream->sidx_index = SIDX (dashstream)->entry_index;
+    if (ret) {
+      /* TODO cache indexes to avoid re-downloading and parsing */
+      /* if we switched, we need a new index */
+      gst_isoff_sidx_parser_clear (&dashstream->sidx_parser);
+      gst_isoff_sidx_parser_init (&dashstream->sidx_parser);
+    }
+  }
+
+end:
+  return ret;
+}
+
+static gboolean
+gst_dash_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
+{
+  gdouble rate;
+  GstFormat format;
+  GstSeekFlags flags;
+  GstSeekType start_type, stop_type;
+  gint64 start, stop;
+  GList *list;
+  GstClockTime current_pos, target_pos;
+  guint current_period;
+  GstStreamPeriod *period;
+  GList *iter;
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+
+  gst_event_parse_seek (seek, &rate, &format, &flags, &start_type, &start,
+      &stop_type, &stop);
+
+  /* TODO check if start-type/stop-type is SET */
+  if (demux->segment.rate > 0.0)
+    target_pos = (GstClockTime) demux->segment.start;
+  else
+    target_pos = (GstClockTime) demux->segment.stop;
+
+  /* select the requested Period in the Media Presentation */
+  current_period = 0;
+  for (list = g_list_first (dashdemux->client->periods); list;
+      list = g_list_next (list)) {
+    period = list->data;
+    current_pos = period->start;
+    current_period = period->number;
+    GST_DEBUG_OBJECT (demux, "Looking at period %u pos %" GST_TIME_FORMAT,
+        current_period, GST_TIME_ARGS (current_pos));
+    if (current_pos <= target_pos
+        && target_pos < current_pos + period->duration) {
+      break;
+    }
+  }
+  if (list == NULL) {
+    GST_WARNING_OBJECT (demux, "Could not find seeked Period");
+    return FALSE;
+  }
+  if (current_period != gst_mpd_client_get_period_index (dashdemux->client)) {
+    GST_DEBUG_OBJECT (demux, "Seeking to Period %d", current_period);
+
+    /* clean old active stream list, if any */
+    gst_active_streams_free (dashdemux->client);
+
+    /* setup video, audio and subtitle streams, starting from the new Period */
+    if (!gst_mpd_client_set_period_index (dashdemux->client, current_period)
+        || !gst_dash_demux_setup_all_streams (dashdemux))
+      return FALSE;
+  }
+
+  /* Update the current sequence on all streams */
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstDashDemuxStream *dashstream = iter->data;
+
+    if (flags & GST_SEEK_FLAG_FLUSH) {
+      gst_isoff_sidx_parser_clear (&dashstream->sidx_parser);
+      gst_isoff_sidx_parser_init (&dashstream->sidx_parser);
+    }
+    gst_dash_demux_stream_seek (iter->data, target_pos);
+  }
+  return TRUE;
+}
+
+static gint64
+gst_dash_demux_get_manifest_update_interval (GstAdaptiveDemux * demux)
+{
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+  return dashdemux->client->mpd_node->minimumUpdatePeriod * 1000;
+}
+
+static GstFlowReturn
+gst_dash_demux_update_manifest (GstAdaptiveDemux * demux, GstBuffer * buffer)
+{
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+  GstMpdClient *new_client = NULL;
+  GstMapInfo mapinfo;
+
+  GST_DEBUG_OBJECT (demux, "Updating manifest file from URL");
+
+  /* parse the manifest file */
+  new_client = gst_mpd_client_new ();
+  new_client->mpd_uri = g_strdup (demux->manifest_uri);
+  new_client->mpd_base_uri = g_strdup (demux->manifest_base_uri);
+  gst_buffer_map (buffer, &mapinfo, GST_MAP_READ);
+
+  if (gst_mpd_parse (new_client, (gchar *) mapinfo.data, mapinfo.size)) {
+    const gchar *period_id;
+    guint period_idx;
+    GList *iter;
+    GList *streams_iter;
+
+    /* prepare the new manifest and try to transfer the stream position
+     * status from the old manifest client  */
+
+    GST_DEBUG_OBJECT (demux, "Updating manifest");
+
+    period_id = gst_mpd_client_get_period_id (dashdemux->client);
+    period_idx = gst_mpd_client_get_period_index (dashdemux->client);
+
+    /* setup video, audio and subtitle streams, starting from current Period */
+    if (!gst_mpd_client_setup_media_presentation (new_client)) {
+      /* TODO */
+    }
+
+    if (period_id) {
+      if (!gst_mpd_client_set_period_id (new_client, period_id)) {
+        GST_DEBUG_OBJECT (demux, "Error setting up the updated manifest file");
+        return GST_FLOW_EOS;
+      }
+    } else {
+      if (!gst_mpd_client_set_period_index (new_client, period_idx)) {
+        GST_DEBUG_OBJECT (demux, "Error setting up the updated manifest file");
+        return GST_FLOW_EOS;
+      }
+    }
+
+    if (!gst_dash_demux_setup_mpdparser_streams (dashdemux, new_client)) {
+      GST_ERROR_OBJECT (demux, "Failed to setup streams on manifest " "update");
+      return GST_FLOW_ERROR;
+    }
+
+    /* update the streams to play from the next segment */
+    for (iter = demux->streams, streams_iter = new_client->active_streams;
+        iter && streams_iter;
+        iter = g_list_next (iter), streams_iter = g_list_next (streams_iter)) {
+      GstDashDemuxStream *demux_stream = iter->data;
+      GstActiveStream *new_stream = streams_iter->data;
+      GstClockTime ts;
+
+      if (!new_stream) {
+        GST_DEBUG_OBJECT (demux,
+            "Stream of index %d is missing from manifest update",
+            demux_stream->index);
+        return GST_FLOW_EOS;
+      }
+
+      if (gst_mpd_client_get_next_fragment_timestamp (dashdemux->client,
+              demux_stream->index, &ts)) {
+        gst_mpd_client_stream_seek (new_client, new_stream, ts);
+      } else
+          if (gst_mpd_client_get_last_fragment_timestamp (dashdemux->client,
+              demux_stream->index, &ts)) {
+        /* try to set to the old timestamp + 1 */
+        gst_mpd_client_stream_seek (new_client, new_stream, ts + 1);
+      }
+      demux_stream->active_stream = new_stream;
+    }
+
+    gst_mpd_client_free (dashdemux->client);
+    dashdemux->client = new_client;
+
+    GST_DEBUG_OBJECT (demux, "Manifest file successfully updated");
+  } else {
+    /* In most cases, this will happen if we set a wrong url in the
+     * source element and we have received the 404 HTML response instead of
+     * the manifest */
+    GST_WARNING_OBJECT (demux, "Error parsing the manifest.");
+    gst_buffer_unmap (buffer, &mapinfo);
+    return GST_FLOW_ERROR;
+  }
+
+  gst_buffer_unmap (buffer, &mapinfo);
+
+  return GST_FLOW_OK;
+}
+
+static gint64
+gst_dash_demux_stream_get_fragment_waiting_time (GstAdaptiveDemuxStream *
+    stream)
+{
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (stream->demux);
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
   GstDateTime *seg_end_time;
-  GstActiveStream *active_stream = stream->active_stream;
+  GstActiveStream *active_stream = dashstream->active_stream;
 
   seg_end_time =
-      gst_mpd_client_get_next_segment_availability_end_time (demux->client,
+      gst_mpd_client_get_next_segment_availability_end_time (dashdemux->client,
       active_stream);
 
   if (seg_end_time) {
@@ -1893,500 +1258,167 @@
     diff = gst_mpd_client_calculate_time_difference (cur_time, seg_end_time);
     gst_date_time_unref (seg_end_time);
     gst_date_time_unref (cur_time);
-    if (diff > 0) {
-      GST_DEBUG_OBJECT (demux,
-          "Selected fragment has end timestamp > now (%" G_GINT64_FORMAT
-          "), delaying download", diff);
-      gst_dash_demux_download_wait (stream, diff);
+    return diff;
+  }
+  return 0;
+}
+
+static gboolean
+gst_dash_demux_has_next_period (GstAdaptiveDemux * demux)
+{
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+
+  if (demux->segment.rate >= 0)
+    return gst_mpd_client_has_next_period (dashdemux->client);
+  else
+    return gst_mpd_client_has_previous_period (dashdemux->client);
+}
+
+static void
+gst_dash_demux_advance_period (GstAdaptiveDemux * demux)
+{
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+
+  g_return_if_fail (gst_mpd_client_has_next_period (dashdemux->client));
+
+  if (demux->segment.rate >= 0) {
+    if (!gst_mpd_client_set_period_index (dashdemux->client,
+            gst_mpd_client_get_period_index (dashdemux->client) + 1)) {
+      /* TODO error */
+      return;
     }
+  } else {
+    if (!gst_mpd_client_set_period_index (dashdemux->client,
+            gst_mpd_client_get_period_index (dashdemux->client) - 1)) {
+      /* TODO error */
+      return;
+    }
+  }
+
+  gst_dash_demux_setup_all_streams (dashdemux);
+  gst_mpd_client_set_segment_index_for_all_streams (dashdemux->client, 0);
+}
+
+static GstBuffer *
+_gst_buffer_split (GstBuffer * buffer, gint offset, gsize size)
+{
+  GstBuffer *newbuf = gst_buffer_copy_region (buffer,
+      GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_META
+      | GST_BUFFER_COPY_MEMORY, offset, size - offset);
+
+  gst_buffer_resize (buffer, 0, offset);
+
+  return newbuf;
+}
+
+static GstFlowReturn
+gst_dash_demux_stream_fragment_finished (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (demux);
+  GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
+
+  if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client) &&
+      dashstream->sidx_parser.status == GST_ISOFF_SIDX_PARSER_FINISHED) {
+    /* fragment is advanced on data_received when byte limits are reached */
+    return GST_FLOW_OK;
+  } else {
+    if (G_UNLIKELY (stream->downloading_header || stream->downloading_index))
+      return GST_FLOW_OK;
+    return gst_adaptive_demux_stream_advance_fragment (demux, stream,
+        stream->fragment.duration);
   }
 }
 
 static GstFlowReturn
-_src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+gst_dash_demux_data_received (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
 {
-  GstPad *srcpad = (GstPad *) parent;
-  GstDashDemux *demux = (GstDashDemux *) GST_PAD_PARENT (srcpad);
-  GstDashDemuxStream *stream = gst_pad_get_element_private (srcpad);
-  GstFlowReturn ret;
-  gboolean discont = FALSE;
+  GstDashDemuxStream *dash_stream = (GstDashDemuxStream *) stream;
+  GstFlowReturn ret = GST_FLOW_OK;
+  GstBuffer *buffer;
+  gsize available;
 
-  if (stream->starting_fragment) {
-    if (demux->segment.rate < 0)
-      /* Set DISCONT flag for every first buffer in reverse playback mode
-       * as each fragment for its own has to be reversed */
-      discont = TRUE;
-    stream->starting_fragment = FALSE;
+  if (stream->downloading_index) {
+    GstIsoffParserResult res;
+    guint consumed;
 
-    GST_LOG_OBJECT (stream->pad, "set fragment pts=%" GST_TIME_FORMAT,
-        GST_TIME_ARGS (stream->current_fragment.timestamp));
+    available = gst_adapter_available (stream->adapter);
+    buffer = gst_adapter_take_buffer (stream->adapter, available);
 
-    GST_BUFFER_PTS (buffer) = stream->current_fragment.timestamp;
+    if (dash_stream->sidx_parser.status != GST_ISOFF_SIDX_PARSER_FINISHED) {
+      res =
+          gst_isoff_sidx_parser_add_buffer (&dash_stream->sidx_parser, buffer,
+          &consumed);
 
-    if (stream->pending_segment) {
-      if (demux->timestamp_offset == -1)
-        demux->timestamp_offset = GST_BUFFER_PTS (buffer);
-      else
-        demux->timestamp_offset =
-            MIN (GST_BUFFER_PTS (buffer), demux->timestamp_offset);
-
-      /* And send a newsegment */
-      gst_pad_push_event (stream->pad, stream->pending_segment);
-      stream->pending_segment = NULL;
+      if (res == GST_ISOFF_PARSER_ERROR) {
+      } else if (res == GST_ISOFF_PARSER_UNEXPECTED) {
+        /* this is not a 'sidx' index, just skip it and continue playback */
+      } else {
+        /* when finished, prepare for real data streaming */
+        if (dash_stream->sidx_parser.status == GST_ISOFF_SIDX_PARSER_FINISHED) {
+          if (GST_CLOCK_TIME_IS_VALID (dash_stream->pending_seek_ts)) {
+            gst_dash_demux_stream_sidx_seek (dash_stream,
+                dash_stream->pending_seek_ts);
+            dash_stream->pending_seek_ts = GST_CLOCK_TIME_NONE;
+          } else {
+            SIDX (dash_stream)->entry_index = dash_stream->sidx_index;
+          }
+          dash_stream->sidx_current_remaining =
+              SIDX_CURRENT_ENTRY (dash_stream)->size;
+        } else if (consumed < available) {
+          GstBuffer *pending;
+          /* we still need to keep some data around for the next parsing round
+           * so just push what was already processed by the parser */
+          pending = _gst_buffer_split (buffer, consumed, -1);
+          gst_adapter_push (stream->adapter, pending);
+        }
+      }
     }
+    ret = gst_adaptive_demux_stream_push_buffer (stream, buffer);
+  } else if (dash_stream->sidx_parser.status == GST_ISOFF_SIDX_PARSER_FINISHED) {
 
-    /* make timestamp start from 0 by subtracting the offset */
-    GST_BUFFER_PTS (buffer) -= demux->timestamp_offset;
+    while (ret == GST_FLOW_OK
+        && ((available = gst_adapter_available (stream->adapter)) > 0)) {
+      gboolean advance = FALSE;
 
-    stream->position = demux->segment.position = GST_BUFFER_PTS (buffer);
+      if (available < dash_stream->sidx_current_remaining) {
+        buffer = gst_adapter_take_buffer (stream->adapter, available);
+        dash_stream->sidx_current_remaining -= available;
+      } else {
+        buffer =
+            gst_adapter_take_buffer (stream->adapter,
+            dash_stream->sidx_current_remaining);
+        dash_stream->sidx_current_remaining = 0;
+        advance = TRUE;
+      }
+      ret = gst_adaptive_demux_stream_push_buffer (stream, buffer);
+      if (advance) {
+        GstFlowReturn new_ret;
+        new_ret =
+            gst_adaptive_demux_stream_advance_fragment (demux, stream,
+            SIDX_CURRENT_ENTRY (dash_stream)->duration);
 
-  } else {
-    GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
-  }
-
-  if (stream->discont) {
-    discont = TRUE;
-    stream->discont = FALSE;
-  }
-
-  if (discont) {
-    GST_DEBUG_OBJECT (stream->pad, "Marking fragment as discontinuous");
-    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
-  } else {
-    GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
-  }
-
-  GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
-  GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
-  GST_BUFFER_OFFSET (buffer) =
-      gst_mpd_client_get_segment_index (stream->active_stream) - 1;
-
-  /* accumulate time and size to get this chunk */
-  stream->download_total_time +=
-      g_get_monotonic_time () - stream->download_start_time;
-  stream->download_total_bytes += gst_buffer_get_size (buffer);
-
-  ret = gst_proxy_pad_chain_default (pad, parent, buffer);
-  stream->download_start_time = g_get_monotonic_time ();
-  GST_LOG_OBJECT (pad, "Chain res: %d %s", ret, gst_flow_get_name (ret));
-
-  if (ret != GST_FLOW_OK) {
-    if (ret < GST_FLOW_EOS) {
-      GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL),
-          ("stream stopped, reason %s", gst_flow_get_name (ret)));
-
-      /* TODO push this on all pads */
-      gst_pad_push_event (stream->pad, gst_event_new_eos ());
-    } else {
-      GST_DEBUG_OBJECT (stream->pad, "stream stopped, reason %s",
-          gst_flow_get_name (ret));
+        /* only overwrite if it was OK before */
+        if (ret == GST_FLOW_OK)
+          ret = new_ret;
+      }
     }
-
-    /* TODO properly stop tasks */
-    /* gst_hls_demux_pause_tasks (demux); */
-    g_cond_signal (&stream->fragment_download_cond);
+  } else {
+    /* this should be the main header, just push it all */
+    ret =
+        gst_adaptive_demux_stream_push_buffer (stream,
+        gst_adapter_take_buffer (stream->adapter,
+            gst_adapter_available (stream->adapter)));
   }
 
-  stream->last_ret = ret;
-
   return ret;
 }
 
-static gboolean
-_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  GstPad *srcpad = GST_PAD_CAST (parent);
-  GstDashDemuxStream *stream = gst_pad_get_element_private (srcpad);
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_EOS:
-      g_cond_signal (&stream->fragment_download_cond);
-      break;
-    default:
-      break;
-  }
-
-  gst_event_unref (event);
-
-  return TRUE;
-}
-
-static gboolean
-_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
-{
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_ALLOCATION:
-      return FALSE;
-      break;
-    default:
-      break;
-  }
-
-  return gst_pad_query_default (pad, parent, query);
-}
-
-static gboolean
-gst_dash_demux_stream_update_source (GstDashDemuxStream * stream,
-    const gchar * uri, const gchar * referer, gboolean refresh,
-    gboolean allow_cache)
-{
-  GstDashDemux *demux = stream->demux;
-
-  if (!gst_uri_is_valid (uri)) {
-    GST_WARNING_OBJECT (stream->pad, "Invalid URI: %s", uri);
-    stream->last_ret = GST_FLOW_ERROR;
-    return FALSE;
-  }
-
-  if (stream->src != NULL) {
-    gchar *old_protocol, *new_protocol;
-    gchar *old_uri;
-
-    old_uri = gst_uri_handler_get_uri (GST_URI_HANDLER (stream->src));
-    old_protocol = gst_uri_get_protocol (old_uri);
-    new_protocol = gst_uri_get_protocol (uri);
-
-    if (!g_str_equal (old_protocol, new_protocol)) {
-      gst_object_unref (stream->src_srcpad);
-      gst_element_set_state (stream->src, GST_STATE_NULL);
-      gst_bin_remove (GST_BIN_CAST (demux), stream->src);
-      stream->src = NULL;
-      stream->src_srcpad = NULL;
-      GST_DEBUG_OBJECT (demux, "Can't re-use old source element");
-    } else {
-      GError *err = NULL;
-
-      GST_DEBUG_OBJECT (demux, "Re-using old source element");
-      if (!gst_uri_handler_set_uri (GST_URI_HANDLER (stream->src), uri, &err)) {
-        GST_DEBUG_OBJECT (demux, "Failed to re-use old source element: %s",
-            err->message);
-        g_clear_error (&err);
-        gst_element_set_state (stream->src, GST_STATE_NULL);
-        gst_bin_remove (GST_BIN_CAST (demux), stream->src);
-        stream->src = NULL;
-      }
-    }
-    g_free (old_uri);
-    g_free (old_protocol);
-    g_free (new_protocol);
-  }
-
-  if (stream->src == NULL) {
-    GObjectClass *gobject_class;
-    GstPad *internal_pad;
-
-    stream->src = gst_element_make_from_uri (GST_URI_SRC, uri, NULL, NULL);
-    if (stream->src == NULL) {
-      GST_ELEMENT_ERROR (demux, CORE, MISSING_PLUGIN,
-          ("Missing plugin to handle URI: '%s'", uri), (NULL));
-      return FALSE;
-    }
-
-    gobject_class = G_OBJECT_GET_CLASS (stream->src);
-
-    if (g_object_class_find_property (gobject_class, "compress"))
-      g_object_set (stream->src, "compress", FALSE, NULL);
-    if (g_object_class_find_property (gobject_class, "keep-alive"))
-      g_object_set (stream->src, "keep-alive", TRUE, NULL);
-    if (g_object_class_find_property (gobject_class, "extra-headers")) {
-      if (referer || refresh || !allow_cache) {
-        GstStructure *extra_headers = gst_structure_new_empty ("headers");
-
-        if (referer)
-          gst_structure_set (extra_headers, "Referer", G_TYPE_STRING, referer,
-              NULL);
-
-        if (!allow_cache)
-          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
-              "no-cache", NULL);
-        else if (refresh)
-          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
-              "max-age=0", NULL);
-
-        g_object_set (stream->src, "extra-headers", extra_headers, NULL);
-
-        gst_structure_free (extra_headers);
-      } else {
-        g_object_set (stream->src, "extra-headers", NULL, NULL);
-      }
-    }
-
-    gst_element_set_locked_state (stream->src, TRUE);
-    gst_bin_add (GST_BIN_CAST (demux), stream->src);
-    stream->src_srcpad = gst_element_get_static_pad (stream->src, "src");
-
-    gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (stream->pad),
-        stream->src_srcpad);
-
-    /* set up our internal pad to drop all events from
-     * the http src we don't care about. On the chain function
-     * we just push the buffer forward, but this way dash can get
-     * the flow return from downstream */
-    internal_pad =
-        GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (stream->pad)));
-    gst_pad_set_chain_function (GST_PAD_CAST (internal_pad), _src_chain);
-    gst_pad_set_event_function (GST_PAD_CAST (internal_pad), _src_event);
-    /* need to set query otherwise deadlocks happen with allocation queries */
-    gst_pad_set_query_function (GST_PAD_CAST (internal_pad), _src_query);
-    gst_object_unref (internal_pad);
-  }
-  return TRUE;
-}
-
-/* must be called with the stream's fragment_download_lock */
 static void
-gst_dash_demux_stream_download_uri (GstDashDemux * demux,
-    GstDashDemuxStream * stream, const gchar * uri, gint64 start, gint64 end)
+gst_dash_demux_stream_free (GstAdaptiveDemuxStream * stream)
 {
-  GST_DEBUG_OBJECT (stream->pad, "Downloading uri: %s, range:%" G_GINT64_FORMAT
-      " - %" G_GINT64_FORMAT, uri, start, end);
+  GstDashDemuxStream *dash_stream = (GstDashDemuxStream *) stream;
 
-  if (!gst_dash_demux_stream_update_source (stream, uri, NULL, FALSE, TRUE)) {
-    return;
-  }
-
-  if (gst_element_set_state (stream->src,
-          GST_STATE_READY) != GST_STATE_CHANGE_FAILURE) {
-    if (start != 0 || end != -1) {
-      if (!gst_element_send_event (stream->src, gst_event_new_seek (1.0,
-                  GST_FORMAT_BYTES, (GstSeekFlags) GST_SEEK_FLAG_FLUSH,
-                  GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, end))) {
-
-        /* looks like the source can't handle seeks in READY */
-/*
-        *err = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_NOT_IMPLEMENTED,
-            "Source element can't handle range requests");
-*/
-        stream->last_ret = GST_FLOW_ERROR;
-      }
-    }
-
-    if (G_LIKELY (stream->last_ret == GST_FLOW_OK)) {
-      /* flush the proxypads so that the EOS state is reset */
-      gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_start ());
-      gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_stop (TRUE));
-
-      stream->download_start_time = g_get_monotonic_time ();
-      gst_element_sync_state_with_parent (stream->src);
-
-      /* wait for the fragment to be completely downloaded */
-      GST_DEBUG_OBJECT (stream->pad,
-          "Waiting for fragment download to finish: %s", uri);
-      g_cond_wait (&stream->fragment_download_cond,
-          &stream->fragment_download_lock);
-    }
-  } else {
-    stream->last_ret = GST_FLOW_CUSTOM_ERROR;
-  }
-
-  gst_element_set_state (stream->src, GST_STATE_READY);
-}
-
-static void
-gst_dash_demux_stream_download_fragment (GstDashDemux * demux,
-    GstDashDemuxStream * stream)
-{
-  GstActiveStream *active_stream;
-  guint stream_idx = stream->index;
-  GstMediaFragmentInfo *fragment = &stream->current_fragment;
-
-  if (G_UNLIKELY (stream->restart_download)) {
-    GstSegment segment;
-    GstClockTime cur, ts;
-    gint64 pos;
-    GstEvent *seg_event;
-
-    GST_DEBUG_OBJECT (stream->pad,
-        "Reactivating stream after to reconfigure event");
-
-    cur = GST_CLOCK_TIME_IS_VALID (stream->position) ? stream->position : 0;
-
-    if (gst_pad_peer_query_position (stream->pad, GST_FORMAT_TIME, &pos)) {
-      ts = (GstClockTime) pos;
-      GST_DEBUG_OBJECT (stream->pad, "Downstream position: %"
-          GST_TIME_FORMAT, GST_TIME_ARGS (ts));
-    } else {
-      ts = demux->segment.position;
-      GST_DEBUG_OBJECT (stream->pad, "Downstream position query failed, "
-          "failling back to looking at other pads");
-    }
-
-    GST_DEBUG_OBJECT (stream->pad, "Restarting stream at "
-        "position %" GST_TIME_FORMAT, GST_TIME_ARGS (ts));
-
-    gst_segment_copy_into (&demux->segment, &segment);
-    if (GST_CLOCK_TIME_IS_VALID (ts)) {
-      gst_mpd_client_stream_seek (demux->client, stream->active_stream, ts);
-
-      if (cur < ts) {
-        segment.position = ts;
-      }
-    }
-    seg_event = gst_event_new_segment (&segment);
-    GST_DEBUG_OBJECT (stream->pad, "Sending restart segment: %"
-        GST_PTR_FORMAT, seg_event);
-    gst_pad_push_event (stream->pad, seg_event);
-
-    stream->restart_download = FALSE;
-  }
-
-  g_mutex_lock (&stream->fragment_download_lock);
-  if (gst_mpd_client_get_next_fragment (demux->client, stream_idx, fragment,
-          stream->demux->segment.rate > 0.0)) {
-    GST_INFO_OBJECT (stream->pad,
-        "Fetching next fragment %s ts:%" GST_TIME_FORMAT " dur:%"
-        GST_TIME_FORMAT " Range:%" G_GINT64_FORMAT "-%" G_GINT64_FORMAT,
-        fragment->uri, GST_TIME_ARGS (fragment->timestamp),
-        GST_TIME_ARGS (fragment->duration),
-        fragment->range_start, fragment->range_end);
-
-    /* Reset last flow return */
-    stream->last_ret = GST_FLOW_OK;
-    stream->starting_fragment = TRUE;
-
-    if (stream->need_header) {
-      /* We need to fetch a new header */
-      gst_dash_demux_get_next_header (demux, stream);
-      stream->need_header = FALSE;
-    }
-
-    if (stream->last_ret != GST_FLOW_OK) {
-      GST_WARNING_OBJECT (stream->pad, "Failed to download headers");
-      goto exit;
-    }
-
-    if (demux->cancelled)
-      goto exit;
-
-    /* it is possible to have an index per fragment, so check and download */
-    if (fragment->index_uri || fragment->index_range_start
-        || fragment->index_range_end != -1) {
-      const gchar *uri = fragment->index_uri;
-
-      if (!uri)                 /* fallback to default media uri */
-        uri = fragment->uri;
-
-      GST_DEBUG_OBJECT (stream->pad,
-          "Fragment index download: %s %" G_GINT64_FORMAT "-%"
-          G_GINT64_FORMAT, uri, fragment->index_range_start,
-          fragment->index_range_end);
-      gst_dash_demux_stream_download_uri (demux, stream, uri,
-          fragment->index_range_start, fragment->index_range_end);
-    }
-
-    if (stream->last_ret != GST_FLOW_OK) {
-      GST_WARNING_OBJECT (stream->pad, "Failed to download fragment headers");
-      goto exit;
-    }
-
-    if (demux->cancelled)
-      goto exit;
-
-    /* now get the real fragment */
-    gst_dash_demux_stream_download_uri (demux, stream, fragment->uri,
-        fragment->range_start, fragment->range_end);
-
-    if (stream->last_ret < GST_FLOW_EOS) {
-      gst_media_fragment_info_clear (fragment);
-      goto exit;
-    }
-
-    active_stream = stream->active_stream;
-    if (active_stream == NULL) {
-      gst_media_fragment_info_clear (fragment);
-      stream->last_ret = GST_FLOW_ERROR;
-      goto exit;
-    }
-
-    if (stream->last_ret == GST_FLOW_OK) {
-      stream->position += fragment->duration;
-    }
-
-    gst_media_fragment_info_clear (fragment);
-  } else {
-    GST_WARNING_OBJECT (demux, "Failed to download fragment for stream %p %d",
-        stream, stream->index);
-  }
-
-
-exit:
-  g_mutex_unlock (&stream->fragment_download_lock);
-
-  if (stream->last_ret == GST_FLOW_OK)
-    gst_element_set_state (stream->src, GST_STATE_READY);
-  else
-    gst_element_set_state (stream->src, GST_STATE_NULL);
-}
-
-/* gst_dash_demux_stream_get_next_fragment:
- *
- * Get the next fragments for the stream with the earlier timestamp.
- * It returns the selected timestamp so the caller can deal with
- * sync issues in case the stream is live.
- * 
- * This function uses the generic URI downloader API.
- *
- * Returns FALSE if an error occured while downloading fragments
- */
-static GstFlowReturn
-gst_dash_demux_stream_get_next_fragment (GstDashDemuxStream * stream,
-    GstClockTime * ts)
-{
-  GstDashDemux *demux = stream->demux;
-
-  if (stream->stream_eos)
-    return GST_FLOW_EOS;
-
-  if (stream->last_ret == GST_FLOW_NOT_LINKED) {
-    GST_LOG_OBJECT (demux, "Skipping stream %p %s:%s : not-linked",
-        stream, GST_DEBUG_PAD_NAME (stream->pad));
-    return GST_FLOW_NOT_LINKED;
-  }
-
-  if (!gst_mpd_client_get_next_fragment_timestamp (demux->client,
-          stream->index, ts)) {
-    GST_INFO_OBJECT (demux,
-        "This Period doesn't contain more fragments for stream %u",
-        stream->index);
-
-    /* check if this is live and we should wait for more data */
-    if (gst_mpd_client_is_live (demux->client)
-        && demux->client->mpd_node->minimumUpdatePeriod != -1) {
-      return GST_FLOW_OK;       /* TODO wait */
-    }
-    return GST_FLOW_EOS;
-  }
-
-  /*
-   * If this is a live stream, check the segment end time to make sure
-   * it is available to download
-   */
-  if (gst_mpd_client_is_live (demux->client) &&
-      demux->client->mpd_node->minimumUpdatePeriod != -1) {
-
-    gst_dash_demux_wait_for_fragment_to_be_available (demux, stream);
-  }
-
-  /* Get the fragment corresponding to each stream index */
-  gst_dash_demux_stream_download_fragment (demux, stream);
-
-  demux->end_of_period = FALSE;
-
-  if (stream->last_ret != GST_FLOW_OK) {
-    GST_WARNING_OBJECT (stream->pad, "Failed to download fragment: %s",
-        gst_flow_get_name (stream->last_ret));
-  }
-  return stream->last_ret;
-}
-
-static void
-gst_dash_demux_download_wait (GstDashDemuxStream * stream,
-    GstClockTime time_diff)
-{
-  gint64 end_time = g_get_monotonic_time () + time_diff / GST_USECOND;
-
-  GST_DEBUG_OBJECT (stream->pad, "Download waiting for %" GST_TIME_FORMAT,
-      GST_TIME_ARGS (time_diff));
-  g_cond_wait_until (&stream->download_cond, &stream->download_mutex, end_time);
-  GST_DEBUG_OBJECT (stream->pad, "Download finished waiting");
+  gst_isoff_sidx_parser_clear (&dash_stream->sidx_parser);
 }
diff --git a/ext/dash/gstdashdemux.h b/ext/dash/gstdashdemux.h
index 0c0f799..c945a19 100644
--- a/ext/dash/gstdashdemux.h
+++ b/ext/dash/gstdashdemux.h
@@ -31,9 +31,11 @@
 #define __GST_DASH_DEMUX_H__
 
 #include <gst/gst.h>
+#include <gst/adaptivedemux/gstadaptivedemux.h>
 #include <gst/base/gstadapter.h>
 #include <gst/base/gstdataqueue.h>
 #include "gstmpdparser.h"
+#include "gstisoff.h"
 #include <gst/uridownloader/gsturidownloader.h>
 
 G_BEGIN_DECLS
@@ -56,42 +58,19 @@
 
 struct _GstDashDemuxStream
 {
-  GstPad *pad;
-
-  GstDashDemux *demux;
+  GstAdaptiveDemuxStream parent;
 
   gint index;
   GstActiveStream *active_stream;
 
-  GstCaps *input_caps;
-
-  GstFlowReturn last_ret;
-  GstClockTime position;
-  gboolean restart_download;
-
-  GstEvent *pending_segment;
-
-  gboolean stream_eos;
-  gboolean need_header;
-  gboolean discont;
-
-  /* Download task */
-  GMutex download_mutex;
-  GCond download_cond;
-  GstTask *download_task;
-  GRecMutex download_task_lock;
-
-  /* download tooling */
-  GstElement *src;
-  GstPad *src_srcpad;
-  GMutex fragment_download_lock;
-  GCond fragment_download_cond;
   GstMediaFragmentInfo current_fragment;
-  gboolean starting_fragment;
-  gint64 download_start_time;
-  gint64 download_total_time;
-  gint64 download_total_bytes;
-  gint current_download_rate;
+
+  /* index parsing */
+  GstSidxParser sidx_parser;
+  gsize sidx_current_remaining;
+  gint sidx_index;
+  gint64 sidx_base_offset;
+  GstClockTime pending_seek_ts;
 };
 
 /**
@@ -101,20 +80,10 @@
  */
 struct _GstDashDemux
 {
-  GstBin parent;
-  GstPad *sinkpad;
+  GstAdaptiveDemux parent;
 
-  gboolean have_group_id;
-  guint group_id;
-
-  GSList *streams;
   GSList *next_periods;
 
-  GstSegment segment;
-  GstClockTime timestamp_offset;
-
-  GstBuffer *manifest;
-  GstUriDownloader *downloader;
   GstMpdClient *client;         /* MPD client */
   GMutex client_lock;
 
@@ -123,18 +92,15 @@
 
   /* Properties */
   GstClockTime max_buffering_time;      /* Maximum buffering time accumulated during playback */
-  gfloat bandwidth_usage;       /* Percentage of the available bandwidth to use       */
   guint64 max_bitrate;          /* max of bitrate supported by target decoder         */
 
-  gboolean cancelled;
-
-  /* Manifest update */
-  GstClockTime last_manifest_update;
+  gint n_audio_streams;
+  gint n_video_streams;
 };
 
 struct _GstDashDemuxClass
 {
-  GstBinClass parent_class;
+  GstAdaptiveDemuxClass parent_class;
 };
 
 GType gst_dash_demux_get_type (void);
diff --git a/ext/dash/gstisoff.c b/ext/dash/gstisoff.c
new file mode 100644
index 0000000..e67b11a
--- /dev/null
+++ b/ext/dash/gstisoff.c
@@ -0,0 +1,187 @@
+/*
+ * ISO File Format parsing library
+ *
+ * gstisoff.h
+ *
+ * Copyright (C) 2015 Samsung Electronics. All rights reserved.
+ *   Author: Thiago Santos <thiagoss@osg.samsung.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.1 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 (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gstisoff.h"
+#include <gst/base/gstbytereader.h>
+
+void
+gst_isoff_sidx_parser_init (GstSidxParser * parser)
+{
+  parser->status = GST_ISOFF_SIDX_PARSER_INIT;
+  parser->cumulative_entry_size = 0;
+  parser->sidx.entries = NULL;
+  parser->sidx.entries_count = 0;
+}
+
+void
+gst_isoff_sidx_parser_clear (GstSidxParser * parser)
+{
+  g_free (parser->sidx.entries);
+  parser->sidx.entries = NULL;
+}
+
+static void
+gst_isoff_parse_sidx_entry (GstSidxBoxEntry * entry, GstByteReader * reader)
+{
+  guint32 aux;
+
+  aux = gst_byte_reader_get_uint32_be_unchecked (reader);
+  entry->ref_type = aux >> 31;
+  entry->size = aux & 0x7FFFFFFF;
+  entry->duration = gst_byte_reader_get_uint32_be_unchecked (reader);
+  aux = gst_byte_reader_get_uint32_be_unchecked (reader);
+  entry->starts_with_sap = aux >> 31;
+  entry->sap_type = ((aux >> 28) & 0x7);
+  entry->sap_delta_time = aux & 0xFFFFFFF;
+}
+
+GstIsoffParserResult
+gst_isoff_sidx_parser_add_buffer (GstSidxParser * parser, GstBuffer * buffer,
+    guint * consumed)
+{
+  GstIsoffParserResult res = GST_ISOFF_PARSER_OK;
+  GstByteReader reader;
+  GstMapInfo info;
+  gsize remaining;
+  guint32 fourcc;
+
+  if (!gst_buffer_map (buffer, &info, GST_MAP_READ)) {
+    *consumed = 0;
+    return GST_ISOFF_PARSER_ERROR;
+  }
+
+  gst_byte_reader_init (&reader, info.data, info.size);
+
+  switch (parser->status) {
+    case GST_ISOFF_SIDX_PARSER_INIT:
+      if (gst_byte_reader_get_remaining (&reader) < GST_ISOFF_FULL_BOX_SIZE) {
+        break;
+      }
+
+      parser->size = gst_byte_reader_get_uint32_be_unchecked (&reader);
+      fourcc = gst_byte_reader_get_uint32_le_unchecked (&reader);
+      if (fourcc != GST_ISOFF_FOURCC_SIDX) {
+        res = GST_ISOFF_PARSER_UNEXPECTED;
+        gst_byte_reader_set_pos (&reader, 0);
+        break;
+      }
+      if (parser->size == 1) {
+        if (gst_byte_reader_get_remaining (&reader) < 12) {
+          gst_byte_reader_set_pos (&reader, 0);
+          break;
+        }
+
+        parser->size = gst_byte_reader_get_uint64_be_unchecked (&reader);
+      }
+      if (parser->size == 0) {
+        res = GST_ISOFF_PARSER_ERROR;
+        gst_byte_reader_set_pos (&reader, 0);
+        break;
+      }
+      parser->sidx.version = gst_byte_reader_get_uint8_unchecked (&reader);
+      parser->sidx.flags = gst_byte_reader_get_uint24_le_unchecked (&reader);
+
+      parser->status = GST_ISOFF_SIDX_PARSER_HEADER;
+
+    case GST_ISOFF_SIDX_PARSER_HEADER:
+      remaining = gst_byte_reader_get_remaining (&reader);
+      if (remaining < 12 + (parser->sidx.version == 0 ? 8 : 16)) {
+        break;
+      }
+
+      parser->sidx.ref_id = gst_byte_reader_get_uint32_be_unchecked (&reader);
+      parser->sidx.timescale =
+          gst_byte_reader_get_uint32_be_unchecked (&reader);
+      if (parser->sidx.version == 0) {
+        parser->sidx.earliest_pts =
+            gst_byte_reader_get_uint32_be_unchecked (&reader);
+        parser->sidx.first_offset = parser->sidx.earliest_pts =
+            gst_byte_reader_get_uint32_be_unchecked (&reader);
+      } else {
+        parser->sidx.earliest_pts =
+            gst_byte_reader_get_uint64_be_unchecked (&reader);
+        parser->sidx.first_offset =
+            gst_byte_reader_get_uint64_be_unchecked (&reader);
+      }
+      /* skip 2 reserved bytes */
+      gst_byte_reader_skip_unchecked (&reader, 2);
+      parser->sidx.entries_count =
+          gst_byte_reader_get_uint16_be_unchecked (&reader);
+
+      GST_LOG ("Timescale: %" G_GUINT32_FORMAT, parser->sidx.timescale);
+      GST_LOG ("Earliest pts: %" G_GUINT64_FORMAT, parser->sidx.earliest_pts);
+      GST_LOG ("First offset: %" G_GUINT64_FORMAT, parser->sidx.first_offset);
+
+      parser->cumulative_pts =
+          gst_util_uint64_scale_int_round (parser->sidx.earliest_pts,
+          GST_SECOND, parser->sidx.timescale);
+
+      if (parser->sidx.entries_count) {
+        parser->sidx.entries =
+            g_malloc (sizeof (GstSidxBoxEntry) * parser->sidx.entries_count);
+      }
+      parser->sidx.entry_index = 0;
+
+      parser->status = GST_ISOFF_SIDX_PARSER_DATA;
+
+    case GST_ISOFF_SIDX_PARSER_DATA:
+      while (parser->sidx.entry_index < parser->sidx.entries_count) {
+        GstSidxBoxEntry *entry =
+            &parser->sidx.entries[parser->sidx.entry_index];
+
+        remaining = gst_byte_reader_get_remaining (&reader);
+        if (remaining < 12)
+          break;
+
+        entry->offset = parser->cumulative_entry_size;
+        entry->pts = parser->cumulative_pts;
+        gst_isoff_parse_sidx_entry (entry, &reader);
+        entry->duration = gst_util_uint64_scale_int_round (entry->duration,
+            GST_SECOND, parser->sidx.timescale);
+        parser->cumulative_entry_size += entry->size;
+        parser->cumulative_pts += entry->duration;
+
+        GST_LOG ("Sidx entry %d) offset: %" G_GUINT64_FORMAT ", pts: %"
+            GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT " - size %"
+            G_GUINT32_FORMAT, parser->sidx.entry_index, entry->offset,
+            GST_TIME_ARGS (entry->pts), GST_TIME_ARGS (entry->duration),
+            entry->size);
+
+        parser->sidx.entry_index++;
+      }
+
+      if (parser->sidx.entry_index == parser->sidx.entries_count)
+        parser->status = GST_ISOFF_SIDX_PARSER_FINISHED;
+      else
+        break;
+    case GST_ISOFF_SIDX_PARSER_FINISHED:
+      parser->sidx.entry_index = 0;
+      res = GST_ISOFF_PARSER_DONE;
+      break;
+  }
+
+  *consumed = gst_byte_reader_get_pos (&reader);
+  gst_buffer_unmap (buffer, &info);
+  return res;
+}
diff --git a/ext/dash/gstisoff.h b/ext/dash/gstisoff.h
new file mode 100644
index 0000000..e535c69
--- /dev/null
+++ b/ext/dash/gstisoff.h
@@ -0,0 +1,99 @@
+/*
+ * ISO File Format parsing library
+ *
+ * gstisoff.h
+ *
+ * Copyright (C) 2015 Samsung Electronics. All rights reserved.
+ *   Author: Thiago Santos <thiagoss@osg.samsung.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.1 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 (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_ISOFF_H__
+#define __GST_ISOFF_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+  GST_ISOFF_PARSER_OK,
+  GST_ISOFF_PARSER_DONE,
+  GST_ISOFF_PARSER_UNEXPECTED,
+  GST_ISOFF_PARSER_ERROR
+} GstIsoffParserResult;
+
+/* this is the minimum size, it can be larger if it
+ * uses extended size or type */
+#define GST_ISOFF_FULL_BOX_SIZE 12
+
+#define GST_ISOFF_FOURCC_SIDX GST_MAKE_FOURCC('s','i','d','x')
+typedef struct _GstSidxBoxEntry
+{
+  gboolean ref_type;
+  guint32 size;
+  GstClockTime duration;
+  gboolean starts_with_sap;
+  guint8 sap_type;
+  guint32 sap_delta_time;
+
+  guint64 offset;
+  GstClockTime pts;
+} GstSidxBoxEntry;
+
+typedef struct _GstSidxBox
+{
+  guint8 version;
+  guint32 flags;
+
+  guint32 ref_id;
+  guint32 timescale;
+  guint64 earliest_pts;
+  guint64 first_offset;
+
+  gint entry_index;
+  gint entries_count;
+
+  GstSidxBoxEntry *entries;
+} GstSidxBox;
+
+typedef enum _GstSidxParserStatus
+{
+  GST_ISOFF_SIDX_PARSER_INIT,
+  GST_ISOFF_SIDX_PARSER_HEADER,
+  GST_ISOFF_SIDX_PARSER_DATA,
+  GST_ISOFF_SIDX_PARSER_FINISHED
+} GstSidxParserStatus;
+
+typedef struct _GstSidxParser
+{
+  GstSidxParserStatus status;
+
+  guint64 size;
+  guint64 cumulative_entry_size;
+  guint64 cumulative_pts;
+
+  GstSidxBox sidx;
+} GstSidxParser;
+
+void gst_isoff_sidx_parser_init (GstSidxParser * parser);
+void gst_isoff_sidx_parser_clear (GstSidxParser * parser);
+GstIsoffParserResult gst_isoff_sidx_parser_add_buffer (GstSidxParser * parser, GstBuffer * buf, guint * consumed);
+
+G_END_DECLS
+
+#endif /* __GST_ISOFF_H__ */
+
diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c
index 29c8c1a..369aca4 100644
--- a/ext/dash/gstmpdparser.c
+++ b/ext/dash/gstmpdparser.c
@@ -1344,10 +1344,9 @@
           &intval)) {
     mult_seg_base_type->duration = intval;
   }
-  if (gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "startNumber", 1,
-          &intval)) {
-    mult_seg_base_type->startNumber = intval;
-  }
+
+  gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "startNumber", 1,
+      &mult_seg_base_type->startNumber);
 
   GST_LOG ("extension of MultipleSegmentBaseType extension:");
   gst_mpdparser_parse_seg_base_type_ext (&mult_seg_base_type->SegBaseType,
@@ -1919,11 +1918,11 @@
     mime = adapt_set->RepresentationBase->mimeType;
   }
 
-  if (strncmp_ext (mime, "audio"))
+  if (strncmp_ext (mime, "audio") == 0)
     return GST_STREAM_AUDIO;
-  if (strncmp_ext (mime, "video"))
+  if (strncmp_ext (mime, "video") == 0)
     return GST_STREAM_VIDEO;
-  if (strncmp_ext (mime, "application"))
+  if (strncmp_ext (mime, "application") == 0)
     return GST_STREAM_APPLICATION;
 
   return GST_STREAM_UNKNOWN;
@@ -2009,14 +2008,14 @@
     if (Representation && Representation->SegmentList
         && Representation->SegmentList->MultSegBaseType
         && Representation->SegmentList->MultSegBaseType->SegBaseType
-        && Representation->SegmentList->MultSegBaseType->
-        SegBaseType->Initialization) {
+        && Representation->SegmentList->MultSegBaseType->SegBaseType->
+        Initialization) {
       SegmentBase = Representation->SegmentList->MultSegBaseType->SegBaseType;
     } else if (AdaptationSet && AdaptationSet->SegmentList
         && AdaptationSet->SegmentList->MultSegBaseType
         && AdaptationSet->SegmentList->MultSegBaseType->SegBaseType
-        && AdaptationSet->SegmentList->MultSegBaseType->
-        SegBaseType->Initialization) {
+        && AdaptationSet->SegmentList->MultSegBaseType->SegBaseType->
+        Initialization) {
       SegmentBase = AdaptationSet->SegmentList->MultSegBaseType->SegBaseType;
     } else if (Period && Period->SegmentList
         && Period->SegmentList->MultSegBaseType
@@ -2536,7 +2535,7 @@
 gst_mpdparser_build_URL_from_template (const gchar * url_template,
     const gchar * id, guint number, guint bandwidth, guint64 time)
 {
-  static gchar default_format[] = "%01d";
+  static const gchar default_format[] = "%01d";
   gchar **tokens, *token, *ret;
   const gchar *format;
   gint i, num_tokens;
@@ -2598,6 +2597,39 @@
   return ret;
 }
 
+guint
+gst_mpd_client_get_period_index_at_time (GstMpdClient * client,
+    GstDateTime * time)
+{
+  GList *iter;
+  guint period_idx = G_MAXUINT;
+  guint idx;
+  gint64 time_offset;
+  GstDateTime *avail_start =
+      gst_mpd_client_get_availability_start_time (client);
+  GstStreamPeriod *stream_period;
+
+  if (avail_start == NULL)
+    return 0;
+
+  time_offset = gst_mpd_client_calculate_time_difference (avail_start, time);
+  gst_date_time_unref (avail_start);
+
+  if (time_offset < 0)
+    return 0;
+
+  for (idx = 0, iter = client->periods; iter; idx++, iter = g_list_next (iter)) {
+    stream_period = iter->data;
+    if (stream_period->start <= time_offset
+        && stream_period->start + stream_period->duration > time_offset) {
+      period_idx = idx;
+      break;
+    }
+  }
+
+  return period_idx;
+}
+
 static GstStreamPeriod *
 gst_mpdparser_get_stream_period (GstMpdClient * client)
 {
@@ -2646,101 +2678,84 @@
   return clone;
 }
 
+/*
+ * Combine a base url with the current stream base url from the list of
+ * baseURLs. Takes ownership of base and returns a new base.
+ */
+static GstUri *
+combine_urls (GstUri * base, GList * list, gchar ** query,
+    GstActiveStream * stream)
+{
+  GstBaseURL *baseURL;
+  GstUri *ret = base;
+
+  if (list != NULL) {
+    baseURL = g_list_nth_data (list, stream->baseURL_idx);
+    if (!baseURL) {
+      baseURL = list->data;
+    }
+
+    ret = gst_uri_from_string_with_base (base, baseURL->baseURL);
+    gst_uri_unref (base);
+
+    if (ret && query) {
+      if (*query)
+        g_free (*query);
+      *query = gst_uri_get_query_string (ret);
+      if (*query) {
+        ret = gst_uri_make_writable (ret);
+        gst_uri_set_query_table (ret, NULL);
+      }
+    }
+  }
+
+  return ret;
+}
+
 /* select a stream and extract the baseURL (if present) */
 static gchar *
 gst_mpdparser_parse_baseURL (GstMpdClient * client, GstActiveStream * stream,
     gchar ** query)
 {
   GstStreamPeriod *stream_period;
-  GstBaseURL *baseURL;
-  gchar *mpd_uri;
-  GList *list;
-  static gchar *baseURL_array[5];
-  static gchar empty[] = "";
+  static const gchar empty[] = "";
   gchar *ret = NULL;
+  GstUri *abs_url;
 
-  g_return_val_if_fail (stream != NULL, empty);
+  g_return_val_if_fail (stream != NULL, g_strdup (empty));
   stream_period = gst_mpdparser_get_stream_period (client);
-  g_return_val_if_fail (stream_period != NULL, empty);
-  g_return_val_if_fail (stream_period->period != NULL, empty);
+  g_return_val_if_fail (stream_period != NULL, g_strdup (empty));
+  g_return_val_if_fail (stream_period->period != NULL, g_strdup (empty));
 
-  baseURL_array[0] = baseURL_array[1] = baseURL_array[2] = baseURL_array[3] =
-      empty;
-  baseURL_array[4] = NULL;
+  /* NULLify query return before we start */
+  if (query)
+    *query = NULL;
 
-  /* FIXME: this simple implementation is not fully compliant with RFC 3986 */
-  if ((list = client->mpd_node->BaseURLs) != NULL) {
-    baseURL = g_list_nth_data (list, stream->baseURL_idx);
-    if (!baseURL) {
-      baseURL = list->data;
-    }
-    baseURL_array[0] = baseURL->baseURL;
-  }
-  if ((list = stream_period->period->BaseURLs) != NULL) {
-    baseURL = g_list_nth_data (list, stream->baseURL_idx);
-    if (!baseURL) {
-      baseURL = list->data;
-    }
-    baseURL_array[1] = baseURL->baseURL;
-  }
+  /* initialise base url */
+  abs_url =
+      gst_uri_from_string (client->
+      mpd_base_uri ? client->mpd_base_uri : client->mpd_uri);
+
+  /* combine a BaseURL at the MPD level with the current base url */
+  abs_url = combine_urls (abs_url, client->mpd_node->BaseURLs, query, stream);
+
+  /* combine a BaseURL at the Period level with the current base url */
+  abs_url =
+      combine_urls (abs_url, stream_period->period->BaseURLs, query, stream);
+
   GST_DEBUG ("Current adaptation set id %i (%s)", stream->cur_adapt_set->id,
       stream->cur_adapt_set->contentType);
+  /* combine a BaseURL at the AdaptationSet level with the current base url */
+  abs_url =
+      combine_urls (abs_url, stream->cur_adapt_set->BaseURLs, query, stream);
 
-  if ((list = stream->cur_adapt_set->BaseURLs) != NULL) {
-    baseURL = g_list_nth_data (list, stream->baseURL_idx);
-    if (!baseURL) {
-      baseURL = list->data;
-    }
-    baseURL_array[2] = baseURL->baseURL;
-  }
+  /* combine a BaseURL at the Representation level with the current base url */
+  abs_url =
+      combine_urls (abs_url, stream->cur_representation->BaseURLs, query,
+      stream);
 
-  if ((list = stream->cur_representation->BaseURLs) != NULL) {
-    baseURL = g_list_nth_data (list, stream->baseURL_idx);
-    if (!baseURL) {
-      baseURL = list->data;
-    }
-    baseURL_array[3] = baseURL->baseURL;
-  }
-
-  ret = g_strjoinv (NULL, baseURL_array);
-
-  /* get base URI from MPD file URI, if the "http" scheme is missing */
-  mpd_uri = client->mpd_base_uri ? client->mpd_base_uri : client->mpd_uri;
-  if (mpd_uri != NULL && strncmp (ret, "http://", 7) != 0) {
-    gchar *last_sep, *tmp1, *tmp2;
-
-    if (ret[0] == '?') {
-      if (query)
-        *query = g_strdup (ret);
-      g_free (ret);
-      ret = NULL;
-    } else {
-      if (query)
-        *query = NULL;
-    }
-
-    last_sep = strrchr (mpd_uri, '/');
-    if (last_sep) {
-      tmp1 = g_strndup (mpd_uri, last_sep - mpd_uri + 1);
-      if (ret) {
-        tmp2 = ret;
-        ret = g_strconcat (tmp1, tmp2, NULL);
-        g_free (tmp1);
-        g_free (tmp2);
-      } else {
-        ret = tmp1;
-      }
-      GST_INFO ("Got base URI from MPD file URI %s", ret);
-    }
-  }
-
-  if (ret && *query == NULL) {
-    gchar *params = strchr (ret, '?');
-    if (params) {
-      *query = g_strdup (params);
-      params[0] = '\0';         /* can ignore the rest of the string */
-    }
-  }
+  ret = gst_uri_to_string (abs_url);
+  gst_uri_unref (abs_url);
 
   return ret;
 }
@@ -2788,7 +2803,6 @@
   GstMpdClient *client;
 
   client = g_new0 (GstMpdClient, 1);
-  g_mutex_init (&client->lock);
 
   return client;
 }
@@ -2819,8 +2833,6 @@
 
   gst_active_streams_free (client);
 
-  g_mutex_clear (&client->lock);
-
   g_free (client->mpd_uri);
   client->mpd_uri = NULL;
   g_free (client->mpd_base_uri);
@@ -2829,6 +2841,18 @@
   g_free (client);
 }
 
+static void
+gst_mpd_client_check_profiles (GstMpdClient * client)
+{
+  GST_DEBUG ("Profiles: %s", client->mpd_node->profiles);
+
+  if (g_strstr_len (client->mpd_node->profiles, -1,
+          "urn:mpeg:dash:profile:isoff-on-demand:2011")) {
+    client->profile_isoff_ondemand = TRUE;
+    GST_DEBUG ("Found ISOFF on demand profile (2011)");
+  }
+}
+
 gboolean
 gst_mpd_parse (GstMpdClient * client, const gchar * data, gint size)
 {
@@ -2838,7 +2862,6 @@
 
     GST_DEBUG ("MPD file fully buffered, start parsing...");
 
-    GST_MPD_CLIENT_LOCK (client);
     /* parse the complete MPD file into a tree (using the libxml2 default parser API) */
 
     /* this initialize the library and check potential ABI mismatches
@@ -2850,7 +2873,6 @@
         doc = xmlReadMemory (data, size, "noname.xml", NULL, 0);
     if (doc == NULL) {
       GST_ERROR ("failed to parse the MPD file");
-      GST_MPD_CLIENT_UNLOCK (client);
       return FALSE;
     } else {
       /* get the root element node */
@@ -2867,7 +2889,8 @@
       /* free the document */
       xmlFreeDoc (doc);
     }
-    GST_MPD_CLIENT_UNLOCK (client);
+
+    gst_mpd_client_check_profiles (client);
 
     return TRUE;
   }
@@ -2916,8 +2939,8 @@
     GstClockTime duration;
     GstStreamPeriod *stream_period;
 
-    g_return_val_if_fail (stream->cur_seg_template->
-        MultSegBaseType->SegmentTimeline == NULL, FALSE);
+    g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
+        SegmentTimeline == NULL, FALSE);
     /* segment template generator */
     duration = gst_mpd_client_get_segment_duration (client, stream);
     if (!GST_CLOCK_TIME_IS_VALID (duration))
@@ -2931,7 +2954,7 @@
     segment->duration = duration;
     segment->SegmentURL = NULL;
 
-    if (segment->start_time > stream_period->start + stream_period->duration) {
+    if (segment->start_time >= stream_period->duration) {
       return FALSE;
     }
   }
@@ -2960,6 +2983,10 @@
   media_segment->duration = duration;
 
   g_ptr_array_add (stream->segments, media_segment);
+  GST_LOG ("Added new segment: number %d, ts: %" GST_TIME_FORMAT ", dur: %"
+      GST_TIME_FORMAT " start time %" GST_TIME_FORMAT, number,
+      GST_TIME_ARGS (start), GST_TIME_ARGS (duration),
+      GST_TIME_ARGS (start_time));
 
   return TRUE;
 }
@@ -3113,19 +3140,31 @@
         return FALSE;
       }
     } else {
+      GstMultSegmentBaseType *mult_seg =
+          stream->cur_seg_template->MultSegBaseType;
       /* build segment list */
-      i = stream->cur_seg_template->MultSegBaseType->startNumber;
+      i = mult_seg->startNumber;
       start = 0;
       start_time = PeriodStart;
 
       GST_LOG ("Building media segment list using this template: %s",
           stream->cur_seg_template->media);
-      if (stream->cur_seg_template->MultSegBaseType->SegmentTimeline) {
+      stream->presentationTimeOffset =
+          mult_seg->SegBaseType->presentationTimeOffset * GST_SECOND;
+
+      /* Avoid dividing by zero */
+      if (mult_seg->SegBaseType->timescale)
+        stream->presentationTimeOffset /= mult_seg->SegBaseType->timescale;
+
+      GST_LOG ("Setting stream's presentation time offset to %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (stream->presentationTimeOffset));
+
+      if (mult_seg->SegmentTimeline) {
         GstSegmentTimelineNode *timeline;
         GstSNode *S;
         GList *list;
 
-        timeline = stream->cur_seg_template->MultSegBaseType->SegmentTimeline;
+        timeline = mult_seg->SegmentTimeline;
         gst_mpdparser_init_active_stream_segments (stream);
         for (list = g_queue_peek_head_link (&timeline->S); list;
             list = g_list_next (list)) {
@@ -3135,8 +3174,7 @@
           GST_LOG ("Processing S node: d=%" G_GUINT64_FORMAT " r=%u t=%"
               G_GUINT64_FORMAT, S->d, S->r, S->t);
           duration = S->d * GST_SECOND;
-          timescale =
-              stream->cur_seg_template->MultSegBaseType->SegBaseType->timescale;
+          timescale = mult_seg->SegBaseType->timescale;
           if (timescale > 1)
             duration /= timescale;
           if (S->t > 0) {
@@ -3199,7 +3237,6 @@
   g_return_val_if_fail (client->mpd_node != NULL, FALSE);
 
   GST_DEBUG ("Building the list of Periods in the Media Presentation");
-  GST_MPD_CLIENT_LOCK (client);
   /* clean the old period list, if any */
   if (client->periods) {
     g_list_foreach (client->periods,
@@ -3268,26 +3305,22 @@
         GST_TIME_FORMAT, idx, GST_TIME_ARGS (start), GST_TIME_ARGS (duration));
   }
 
-  GST_MPD_CLIENT_UNLOCK (client);
   GST_DEBUG ("Found a total of %d valid Periods in the Media Presentation",
       idx);
   return ret;
 
 early:
-  GST_MPD_CLIENT_UNLOCK (client);
   GST_WARNING
       ("Found an Early Available Period, skipping the rest of the Media Presentation");
   return ret;
 
 syntax_error:
-  GST_MPD_CLIENT_UNLOCK (client);
   GST_WARNING
       ("Cannot get the duration of the Period %d, skipping the rest of the Media Presentation",
       idx);
   return ret;
 
 no_mem:
-  GST_MPD_CLIENT_UNLOCK (client);
   GST_WARNING ("Allocation of GstStreamPeriod struct failed!");
   return FALSE;
 }
@@ -3391,7 +3424,6 @@
 
   g_return_val_if_fail (stream != NULL, 0);
 
-  GST_MPD_CLIENT_LOCK (client);
   if (stream->segments) {
     for (index = 0; index < stream->segments->len; index++) {
       GstMediaSegment *segment = g_ptr_array_index (stream->segments, index);
@@ -3405,16 +3437,14 @@
     }
 
     if (selectedChunk == NULL) {
-      GST_MPD_CLIENT_UNLOCK (client);
       return FALSE;
     }
   } else {
     GstClockTime duration =
         gst_mpd_client_get_segment_duration (client, stream);
-    g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
-        SegmentTimeline == NULL, FALSE);
+    g_return_val_if_fail (stream->cur_seg_template->
+        MultSegBaseType->SegmentTimeline == NULL, FALSE);
     if (!GST_CLOCK_TIME_IS_VALID (duration)) {
-      GST_MPD_CLIENT_UNLOCK (client);
       return FALSE;
     }
     index = ts / duration;
@@ -3422,7 +3452,6 @@
 
   gst_mpd_client_set_segment_index (stream, index);
 
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return TRUE;
 }
@@ -3509,10 +3538,9 @@
   if (client == NULL)
     return (GstDateTime *) NULL;
 
-  GST_MPD_CLIENT_LOCK (client);
   start_time = client->mpd_node->availabilityStartTime;
-  gst_date_time_ref (start_time);
-  GST_MPD_CLIENT_UNLOCK (client);
+  if (start_time)
+    gst_date_time_ref (start_time);
   return start_time;
 }
 
@@ -3528,18 +3556,15 @@
   stream = g_list_nth_data (client->active_streams, stream_idx);
   g_return_val_if_fail (stream != NULL, 0);
 
-  GST_MPD_CLIENT_LOCK (client);
   segment_idx = gst_mpd_client_get_segments_counts (stream) - 1;
   GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx);
 
   if (!gst_mpdparser_get_chunk_by_index (client, stream_idx, segment_idx,
           &currentChunk)) {
-    GST_MPD_CLIENT_UNLOCK (client);
     return FALSE;
   }
 
   *ts = currentChunk.start_time;
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return TRUE;
 }
@@ -3556,30 +3581,42 @@
   stream = g_list_nth_data (client->active_streams, stream_idx);
   g_return_val_if_fail (stream != NULL, 0);
 
-  GST_MPD_CLIENT_LOCK (client);
   segment_idx = gst_mpd_client_get_segment_index (stream);
   GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx);
 
   if (!gst_mpdparser_get_chunk_by_index (client, stream_idx, segment_idx,
           &currentChunk)) {
-    GST_MPD_CLIENT_UNLOCK (client);
     return FALSE;
   }
 
   *ts = currentChunk.start_time;
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return TRUE;
 }
 
+GstClockTime
+gst_mpd_parser_get_stream_presentation_offset (GstMpdClient * client,
+    guint stream_idx)
+{
+  GstActiveStream *stream = NULL;
+
+  g_return_val_if_fail (client != NULL, FALSE);
+  g_return_val_if_fail (client->active_streams != NULL, FALSE);
+  stream = g_list_nth_data (client->active_streams, stream_idx);
+  g_return_val_if_fail (stream != NULL, FALSE);
+
+  return stream->presentationTimeOffset;
+}
+
 gboolean
 gst_mpd_client_get_next_fragment (GstMpdClient * client,
-    guint indexStream, GstMediaFragmentInfo * fragment, gboolean forward)
+    guint indexStream, GstMediaFragmentInfo * fragment)
 {
   GstActiveStream *stream = NULL;
   GstMediaSegment currentChunk;
   gchar *mediaURL = NULL;
   gchar *indexURL = NULL;
+  GstUri *base_url, *frag_url;
   guint segment_idx;
 
   /* select stream */
@@ -3589,13 +3626,11 @@
   g_return_val_if_fail (stream != NULL, FALSE);
   g_return_val_if_fail (stream->cur_representation != NULL, FALSE);
 
-  GST_MPD_CLIENT_LOCK (client);
   segment_idx = gst_mpd_client_get_segment_index (stream);
   GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx);
 
   if (!gst_mpdparser_get_chunk_by_index (client, indexStream, segment_idx,
           &currentChunk)) {
-    GST_MPD_CLIENT_UNLOCK (client);
     return FALSE;
   }
 
@@ -3611,9 +3646,10 @@
         stream->cur_representation->bandwidth, currentChunk.start);
     if (stream->cur_seg_template->index) {
       indexURL =
-          gst_mpdparser_build_URL_from_template (stream->cur_seg_template->
-          index, stream->cur_representation->id, currentChunk.number,
-          stream->cur_representation->bandwidth, currentChunk.start);
+          gst_mpdparser_build_URL_from_template (stream->
+          cur_seg_template->index, stream->cur_representation->id,
+          currentChunk.number, stream->cur_representation->bandwidth,
+          currentChunk.start);
     }
   }
   GST_DEBUG ("mediaURL = %s", mediaURL);
@@ -3641,32 +3677,27 @@
     }
   }
 
-  if (mediaURL == NULL) {
-    /* single segment with URL encoded in the baseURL syntax element */
-    fragment->uri = g_strdup (stream->baseURL);
-  } else if (strncmp (mediaURL, "http://", 7) != 0) {
-    fragment->uri =
-        g_strconcat (stream->baseURL, mediaURL, stream->queryURL, NULL);
-    g_free (mediaURL);
-  } else if (stream->queryURL) {
-    fragment->uri = g_strconcat (mediaURL, stream->queryURL, NULL);
-    g_free (mediaURL);
-  } else {
-    fragment->uri = mediaURL;
+  base_url = gst_uri_from_string (stream->baseURL);
+  frag_url = gst_uri_from_string_with_base (base_url, mediaURL);
+  if (stream->queryURL) {
+    frag_url = gst_uri_make_writable (frag_url);
+    gst_uri_set_query_string (frag_url, stream->queryURL);
   }
+  fragment->uri = gst_uri_to_string (frag_url);
+  gst_uri_unref (frag_url);
 
   if (indexURL != NULL) {
-    if (strncmp (indexURL, "http://", 7) != 0) {
-      fragment->index_uri =
-          g_strconcat (stream->baseURL, indexURL, stream->queryURL, NULL);
-      g_free (indexURL);
-    } else if (stream->queryURL) {
-      fragment->index_uri = g_strconcat (indexURL, stream->queryURL, NULL);
-      g_free (indexURL);
-    } else {
-      fragment->index_uri = indexURL;
-    }
-  } else if (fragment->index_range_start || fragment->index_range_end != -1) {
+    frag_url = gst_uri_make_writable (gst_uri_from_string_with_base (base_url,
+            indexURL));
+    gst_uri_set_query_string (frag_url, stream->queryURL);
+    fragment->index_uri = gst_uri_to_string (frag_url);
+    gst_uri_unref (frag_url);
+  }
+
+  gst_uri_unref (base_url);
+
+  if (indexURL == NULL && (fragment->index_range_start
+          || fragment->index_range_end != -1)) {
     /* index has no specific URL but has a range, we should only use this if
      * the media also has a range, otherwise we are serving some data twice
      * (in the media fragment and again in the index) */
@@ -3679,15 +3710,37 @@
     }
   }
 
-  gst_mpd_client_set_segment_index (stream,
-      forward ? segment_idx + 1 : segment_idx - 1);
-  GST_MPD_CLIENT_UNLOCK (client);
 
   GST_DEBUG ("Loading chunk with URL %s", fragment->uri);
 
   return TRUE;
 }
 
+static GstFlowReturn
+gst_mpd_client_update_segment (GstMpdClient * client, GstActiveStream * stream,
+    gint update)
+{
+  guint segment_idx;
+
+  segment_idx = gst_mpd_client_get_segment_index (stream);
+  GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx + update);
+
+  gst_mpd_client_set_segment_index (stream, segment_idx + update);
+
+  return GST_FLOW_OK;
+}
+
+
+GstFlowReturn
+gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream,
+    gboolean forward)
+{
+  if (forward)
+    return gst_mpd_client_update_segment (client, stream, 1);
+  else
+    return gst_mpd_client_update_segment (client, stream, -1);
+}
+
 gboolean
 gst_mpd_client_get_next_header (GstMpdClient * client, gchar ** uri,
     guint stream_idx, gint64 * range_start, gint64 * range_end)
@@ -3706,7 +3759,6 @@
   *range_end = -1;
 
   GST_DEBUG ("Looking for current representation header");
-  GST_MPD_CLIENT_LOCK (client);
   *uri = NULL;
   if (stream->cur_segment_base && stream->cur_segment_base->Initialization) {
     *uri =
@@ -3735,7 +3787,6 @@
           stream->cur_representation->bandwidth, 0);
     }
   }
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return *uri == NULL ? FALSE : TRUE;
 }
@@ -3758,7 +3809,6 @@
   *range_end = -1;
 
   GST_DEBUG ("Looking for current representation index");
-  GST_MPD_CLIENT_LOCK (client);
   *uri = NULL;
   if (stream->cur_segment_base && stream->cur_segment_base->indexRange) {
     *uri =
@@ -3782,7 +3832,6 @@
           stream->cur_representation->id, 0,
           stream->cur_representation->bandwidth, 0);
   }
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return *uri == NULL ? FALSE : TRUE;
 }
@@ -3806,8 +3855,8 @@
   } else {
     GstClockTime duration =
         gst_mpd_client_get_segment_duration (client, stream);
-    g_return_val_if_fail (stream->cur_seg_template->
-        MultSegBaseType->SegmentTimeline == NULL, 0);
+    g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
+        SegmentTimeline == NULL, 0);
 
     if (GST_CLOCK_TIME_IS_VALID (duration))
       return duration;
@@ -3822,14 +3871,12 @@
 
   g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE);
 
-  GST_MPD_CLIENT_LOCK (client);
   if (client->mpd_node->mediaPresentationDuration != -1) {
     duration = client->mpd_node->mediaPresentationDuration * GST_MSECOND;
   } else {
     /* We can only get the duration for on-demand streams */
     duration = GST_CLOCK_TIME_NONE;
   }
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return duration;
 }
@@ -3840,22 +3887,23 @@
   GstStreamPeriod *next_stream_period;
   gboolean ret = FALSE;
   GList *iter;
+  guint period_idx;
 
   g_return_val_if_fail (client != NULL, FALSE);
   g_return_val_if_fail (client->periods != NULL, FALSE);
   g_return_val_if_fail (period_id != NULL, FALSE);
 
-  GST_MPD_CLIENT_LOCK (client);
-  for (iter = client->periods; iter; iter = g_list_next (iter)) {
+  for (period_idx = 0, iter = client->periods; iter;
+      period_idx++, iter = g_list_next (iter)) {
     next_stream_period = iter->data;
 
     if (next_stream_period->period->id
         && strcmp (next_stream_period->period->id, period_id) == 0) {
       ret = TRUE;
+      client->period_idx = period_idx;
       break;
     }
   }
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return ret;
 }
@@ -3869,13 +3917,11 @@
   g_return_val_if_fail (client != NULL, FALSE);
   g_return_val_if_fail (client->periods != NULL, FALSE);
 
-  GST_MPD_CLIENT_LOCK (client);
   next_stream_period = g_list_nth_data (client->periods, period_idx);
   if (next_stream_period != NULL) {
     client->period_idx = period_idx;
     ret = TRUE;
   }
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return ret;
 }
@@ -3886,9 +3932,7 @@
   guint period_idx;
 
   g_return_val_if_fail (client != NULL, 0);
-  GST_MPD_CLIENT_LOCK (client);
   period_idx = client->period_idx;
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return period_idx;
 }
@@ -3900,27 +3944,35 @@
   gchar *period_id = NULL;
 
   g_return_val_if_fail (client != NULL, 0);
-  GST_MPD_CLIENT_LOCK (client);
   period = g_list_nth_data (client->periods, client->period_idx);
   if (period && period->period)
     period_id = period->period->id;
-  GST_MPD_CLIENT_UNLOCK (client);
 
   return period_id;
 }
 
 gboolean
+gst_mpd_client_has_previous_period (GstMpdClient * client)
+{
+  GList *next_stream_period;
+  g_return_val_if_fail (client != NULL, FALSE);
+  g_return_val_if_fail (client->periods != NULL, FALSE);
+
+  next_stream_period =
+      g_list_nth_data (client->periods, client->period_idx - 1);
+
+  return next_stream_period != NULL;
+}
+
+gboolean
 gst_mpd_client_has_next_period (GstMpdClient * client)
 {
   GList *next_stream_period;
   g_return_val_if_fail (client != NULL, FALSE);
   g_return_val_if_fail (client->periods != NULL, FALSE);
 
-  GST_MPD_CLIENT_LOCK (client);
   next_stream_period =
       g_list_nth_data (client->periods, client->period_idx + 1);
-  GST_MPD_CLIENT_UNLOCK (client);
-
   return next_stream_period != NULL;
 }
 
@@ -3966,8 +4018,8 @@
 
   if (stream->segments)
     return stream->segments->len;
-  g_return_val_if_fail (stream->cur_seg_template->
-      MultSegBaseType->SegmentTimeline == NULL, 0);
+  g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
+      SegmentTimeline == NULL, 0);
   return 0;
 }
 
@@ -4283,3 +4335,9 @@
   g_free (fragment->uri);
   g_free (fragment->index_uri);
 }
+
+gboolean
+gst_mpd_client_has_isoff_ondemand_profile (GstMpdClient * client)
+{
+  return client->profile_isoff_ondemand;
+}
diff --git a/ext/dash/gstmpdparser.h b/ext/dash/gstmpdparser.h
index 24755de..7a098c3 100644
--- a/ext/dash/gstmpdparser.h
+++ b/ext/dash/gstmpdparser.h
@@ -456,6 +456,7 @@
   GstSegmentTemplateNode *cur_seg_template;   /* active segment template */
   guint segment_idx;                          /* index of next sequence chunk */
   GPtrArray *segments;                        /* array of GstMediaSegment */
+  GstClockTime presentationTimeOffset;        /* presentation time offset of the current segment */
 };
 
 struct _GstMpdClient
@@ -471,7 +472,9 @@
   gchar *mpd_uri;                             /* manifest file URI */
   gchar *mpd_base_uri;                        /* base URI for resolving relative URIs.
                                                * this will be different for redirects */
-  GMutex lock;
+
+  /* profiles */
+  gboolean profile_isoff_ondemand;
 };
 
 /* Basic initialization/deinitialization functions */
@@ -492,7 +495,7 @@
 GstClockTime gst_mpd_client_get_media_presentation_duration (GstMpdClient *client);
 gboolean gst_mpd_client_get_last_fragment_timestamp (GstMpdClient * client, guint stream_idx, GstClockTime * ts);
 gboolean gst_mpd_client_get_next_fragment_timestamp (GstMpdClient * client, guint stream_idx, GstClockTime * ts);
-gboolean gst_mpd_client_get_next_fragment (GstMpdClient *client, guint indexStream, GstMediaFragmentInfo * fragment, gboolean forward);
+gboolean gst_mpd_client_get_next_fragment (GstMpdClient *client, guint indexStream, GstMediaFragmentInfo * fragment);
 gboolean gst_mpd_client_get_next_header (GstMpdClient *client, gchar **uri, guint stream_idx, gint64 * range_start, gint64 * range_end);
 gboolean gst_mpd_client_get_next_header_index (GstMpdClient *client, gchar **uri, guint stream_idx, gint64 * range_start, gint64 * range_end);
 gboolean gst_mpd_client_is_live (GstMpdClient * client);
@@ -501,13 +504,16 @@
 GstDateTime *gst_mpd_client_add_time_difference (GstDateTime * t1, gint64 usecs);
 gint gst_mpd_client_get_segment_index_at_time (GstMpdClient *client, GstActiveStream * stream, const GstDateTime *time);
 gint gst_mpd_client_check_time_position (GstMpdClient * client, GstActiveStream * stream, GstClockTime ts, gint64 * diff);
+GstClockTime gst_mpd_parser_get_stream_presentation_offset (GstMpdClient *client, guint stream_idx);
 
 /* Period selection */
+guint gst_mpd_client_get_period_index_at_time (GstMpdClient * client, GstDateTime * time);
 gboolean gst_mpd_client_set_period_index (GstMpdClient *client, guint period_idx);
 gboolean gst_mpd_client_set_period_id (GstMpdClient *client, const gchar * period_id);
 guint gst_mpd_client_get_period_index (GstMpdClient *client);
 const gchar *gst_mpd_client_get_period_id (GstMpdClient *client);
 gboolean gst_mpd_client_has_next_period (GstMpdClient *client);
+gboolean gst_mpd_client_has_previous_period (GstMpdClient * client);
 GstDateTime *gst_mpd_client_get_next_segment_availability_end_time (GstMpdClient * client, GstActiveStream * stream);
 
 /* Representation selection */
@@ -529,6 +535,7 @@
 void gst_mpd_client_set_segment_index_for_all_streams (GstMpdClient * client, guint segment_idx);
 guint gst_mpd_client_get_segment_index (GstActiveStream * stream);
 void gst_mpd_client_set_segment_index (GstActiveStream * stream, guint segment_idx);
+GstFlowReturn gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward);
 
 /* Get audio/video stream parameters (mimeType, width, height, rate, number of channels) */
 const gchar *gst_mpd_client_get_stream_mimeType (GstActiveStream * stream);
@@ -543,6 +550,9 @@
 
 gint64 gst_mpd_client_calculate_time_difference (const GstDateTime * t1, const GstDateTime * t2);
 
+/* profiles */
+gboolean gst_mpd_client_has_isoff_ondemand_profile (GstMpdClient *client);
+
 G_END_DECLS
 
 #endif /* __GST_MPDPARSER_H__ */
diff --git a/ext/dc1394/Makefile.in b/ext/dc1394/Makefile.in
index e25c7a1..aca8534 100644
--- a/ext/dc1394/Makefile.in
+++ b/ext/dc1394/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/dc1394/gstdc1394.c b/ext/dc1394/gstdc1394.c
index 3f28e1f..4a403b4 100644
--- a/ext/dc1394/gstdc1394.c
+++ b/ext/dc1394/gstdc1394.c
@@ -1254,7 +1254,7 @@
     src->camera = NULL;
   }
 
-  return FALSE;;
+  return FALSE;
 
 }
 
diff --git a/ext/directfb/Makefile.in b/ext/directfb/Makefile.in
index 1efb1e2..d682f14 100644
--- a/ext/directfb/Makefile.in
+++ b/ext/directfb/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -254,8 +254,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -294,7 +298,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -302,6 +305,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -351,8 +356,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -431,7 +434,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -440,7 +442,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -453,7 +454,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -478,6 +478,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -551,10 +553,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -580,6 +586,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -616,6 +625,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -656,17 +666,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -683,6 +692,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/directfb/dfbvideosink.c b/ext/directfb/dfbvideosink.c
index 83ab7f9..bafe4ba 100644
--- a/ext/directfb/dfbvideosink.c
+++ b/ext/directfb/dfbvideosink.c
@@ -1349,8 +1349,10 @@
   dfbvideosink = GST_DFBVIDEOSINK (bsink);
 
   if (!dfbvideosink->setup) {
-    caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD
-            (dfbvideosink)));
+    GstCaps *tcaps =
+        gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD (dfbvideosink));
+    caps = gst_caps_copy (tcaps);
+    gst_caps_unref (tcaps);
     GST_DEBUG_OBJECT (dfbvideosink, "getcaps called and we are not setup yet, "
         "returning template %" GST_PTR_FORMAT, caps);
     goto beach;
diff --git a/ext/dtls/Makefile.am b/ext/dtls/Makefile.am
new file mode 100644
index 0000000..22e31b9
--- /dev/null
+++ b/ext/dtls/Makefile.am
@@ -0,0 +1,35 @@
+plugin_LTLIBRARIES = libgstdtls.la
+
+libgstdtls_la_SOURCES = \
+    plugin.c \
+    gstdtlsdec.c \
+    gstdtlsenc.c \
+    gstdtlssrtpdemux.c \
+    gstdtlssrtpbin.c \
+    gstdtlssrtpdec.c \
+    gstdtlssrtpenc.c \
+    gstdtlsagent.c \
+    gstdtlsconnection.c \
+    gstdtlscertificate.c
+
+libgstdtls_la_CFLAGS = \
+    $(GST_PLUGINS_BASE_CFLAGS) \
+    $(GST_BASE_CFLAGS) \
+    $(GST_CFLAGS) \
+    $(DTLS_CFLAGS)
+
+libgstdtls_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(DTLS_LIBS)
+libgstdtls_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstdtls_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS = \
+    gstdtlsdec.h \
+    gstdtlsenc.h \
+    gstdtlssrtpdemux.h \
+    gstdtlssrtpbin.h \
+    gstdtlssrtpdec.h \
+    gstdtlssrtpenc.h \
+    gstdtlsagent.h \
+    gstdtlsconnection.h \
+    gstdtlscertificate.h
+
diff --git a/sys/qtwrapper/Makefile.in b/ext/dtls/Makefile.in
similarity index 70%
rename from sys/qtwrapper/Makefile.in
rename to ext/dtls/Makefile.in
index a8d369c..9b8ab69 100644
--- a/sys/qtwrapper/Makefile.in
+++ b/ext/dtls/Makefile.in
@@ -80,7 +80,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = sys/qtwrapper
+subdir = ext/dtls
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -154,23 +154,25 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstqtwrapper_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
-am_libgstqtwrapper_la_OBJECTS = libgstqtwrapper_la-qtwrapper.lo \
-	libgstqtwrapper_la-qtutils.lo \
-	libgstqtwrapper_la-codecmapping.lo \
-	libgstqtwrapper_la-audiodecoders.lo \
-	libgstqtwrapper_la-videodecoders.lo \
-	libgstqtwrapper_la-imagedescription.lo
-libgstqtwrapper_la_OBJECTS = $(am_libgstqtwrapper_la_OBJECTS)
+libgstdtls_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libgstdtls_la_OBJECTS = libgstdtls_la-plugin.lo \
+	libgstdtls_la-gstdtlsdec.lo libgstdtls_la-gstdtlsenc.lo \
+	libgstdtls_la-gstdtlssrtpdemux.lo \
+	libgstdtls_la-gstdtlssrtpbin.lo \
+	libgstdtls_la-gstdtlssrtpdec.lo \
+	libgstdtls_la-gstdtlssrtpenc.lo libgstdtls_la-gstdtlsagent.lo \
+	libgstdtls_la-gstdtlsconnection.lo \
+	libgstdtls_la-gstdtlscertificate.lo
+libgstdtls_la_OBJECTS = $(am_libgstdtls_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstqtwrapper_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) \
-	$(libgstqtwrapper_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstdtls_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CCLD) $(libgstdtls_la_CFLAGS) $(CFLAGS) \
+	$(libgstdtls_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -205,8 +207,8 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstqtwrapper_la_SOURCES)
-DIST_SOURCES = $(libgstqtwrapper_la_SOURCES)
+SOURCES = $(libgstdtls_la_SOURCES)
+DIST_SOURCES = $(libgstdtls_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -249,8 +251,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -289,7 +295,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -297,6 +302,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -346,8 +353,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -426,7 +431,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -435,7 +439,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -448,7 +451,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -473,6 +475,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -546,10 +550,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -575,6 +583,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -611,6 +622,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -651,17 +663,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -678,6 +689,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -729,31 +741,38 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstqtwrapper.la
+plugin_LTLIBRARIES = libgstdtls.la
+libgstdtls_la_SOURCES = \
+    plugin.c \
+    gstdtlsdec.c \
+    gstdtlsenc.c \
+    gstdtlssrtpdemux.c \
+    gstdtlssrtpbin.c \
+    gstdtlssrtpdec.c \
+    gstdtlssrtpenc.c \
+    gstdtlsagent.c \
+    gstdtlsconnection.c \
+    gstdtlscertificate.c
 
-# sources used to compile this plug-in
-libgstqtwrapper_la_SOURCES = \
-	qtwrapper.c		\
-	qtutils.c		\
-	codecmapping.c		\
-	audiodecoders.c		\
-	videodecoders.c		\
-	imagedescription.c
+libgstdtls_la_CFLAGS = \
+    $(GST_PLUGINS_BASE_CFLAGS) \
+    $(GST_BASE_CFLAGS) \
+    $(GST_CFLAGS) \
+    $(DTLS_CFLAGS)
 
-
-# flags used to compile this plugin
-# add other _CFLAGS and _LIBS as needed
-libgstqtwrapper_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
-libgstqtwrapper_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
-libgstqtwrapper_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -Wl,-framework,CoreAudio,-framework,AudioToolbox,-framework,Carbon,-framework,QuickTime,-framework,QuartzCore
-libgstqtwrapper_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-# headers we need but don't want installed
+libgstdtls_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(DTLS_LIBS)
+libgstdtls_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstdtls_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
 noinst_HEADERS = \
-	codecmapping.h		\
-	qtwrapper.h		\
-	qtutils.h		\
-	imagedescription.h
+    gstdtlsdec.h \
+    gstdtlsenc.h \
+    gstdtlssrtpdemux.h \
+    gstdtlssrtpbin.h \
+    gstdtlssrtpdec.h \
+    gstdtlssrtpenc.h \
+    gstdtlsagent.h \
+    gstdtlsconnection.h \
+    gstdtlscertificate.h
 
 all: all-am
 
@@ -768,9 +787,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sys/qtwrapper/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/dtls/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu sys/qtwrapper/Makefile
+	  $(AUTOMAKE) --gnu ext/dtls/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -825,8 +844,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstqtwrapper.la: $(libgstqtwrapper_la_OBJECTS) $(libgstqtwrapper_la_DEPENDENCIES) $(EXTRA_libgstqtwrapper_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstqtwrapper_la_LINK) -rpath $(plugindir) $(libgstqtwrapper_la_OBJECTS) $(libgstqtwrapper_la_LIBADD) $(LIBS)
+libgstdtls.la: $(libgstdtls_la_OBJECTS) $(libgstdtls_la_DEPENDENCIES) $(EXTRA_libgstdtls_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libgstdtls_la_LINK) -rpath $(plugindir) $(libgstdtls_la_OBJECTS) $(libgstdtls_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -834,12 +853,16 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstqtwrapper_la-audiodecoders.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstqtwrapper_la-codecmapping.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstqtwrapper_la-imagedescription.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstqtwrapper_la-qtutils.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstqtwrapper_la-qtwrapper.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstqtwrapper_la-videodecoders.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlsagent.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlscertificate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlsconnection.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlsdec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlsenc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlssrtpbin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlssrtpdec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlssrtpdemux.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-gstdtlssrtpenc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdtls_la-plugin.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -865,47 +888,75 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstqtwrapper_la-qtwrapper.lo: qtwrapper.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -MT libgstqtwrapper_la-qtwrapper.lo -MD -MP -MF $(DEPDIR)/libgstqtwrapper_la-qtwrapper.Tpo -c -o libgstqtwrapper_la-qtwrapper.lo `test -f 'qtwrapper.c' || echo '$(srcdir)/'`qtwrapper.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstqtwrapper_la-qtwrapper.Tpo $(DEPDIR)/libgstqtwrapper_la-qtwrapper.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='qtwrapper.c' object='libgstqtwrapper_la-qtwrapper.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdtls_la-plugin.lo: plugin.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-plugin.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-plugin.Tpo -c -o libgstdtls_la-plugin.lo `test -f 'plugin.c' || echo '$(srcdir)/'`plugin.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-plugin.Tpo $(DEPDIR)/libgstdtls_la-plugin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='plugin.c' object='libgstdtls_la-plugin.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -c -o libgstqtwrapper_la-qtwrapper.lo `test -f 'qtwrapper.c' || echo '$(srcdir)/'`qtwrapper.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-plugin.lo `test -f 'plugin.c' || echo '$(srcdir)/'`plugin.c
 
-libgstqtwrapper_la-qtutils.lo: qtutils.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -MT libgstqtwrapper_la-qtutils.lo -MD -MP -MF $(DEPDIR)/libgstqtwrapper_la-qtutils.Tpo -c -o libgstqtwrapper_la-qtutils.lo `test -f 'qtutils.c' || echo '$(srcdir)/'`qtutils.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstqtwrapper_la-qtutils.Tpo $(DEPDIR)/libgstqtwrapper_la-qtutils.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='qtutils.c' object='libgstqtwrapper_la-qtutils.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdtls_la-gstdtlsdec.lo: gstdtlsdec.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlsdec.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlsdec.Tpo -c -o libgstdtls_la-gstdtlsdec.lo `test -f 'gstdtlsdec.c' || echo '$(srcdir)/'`gstdtlsdec.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlsdec.Tpo $(DEPDIR)/libgstdtls_la-gstdtlsdec.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlsdec.c' object='libgstdtls_la-gstdtlsdec.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -c -o libgstqtwrapper_la-qtutils.lo `test -f 'qtutils.c' || echo '$(srcdir)/'`qtutils.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlsdec.lo `test -f 'gstdtlsdec.c' || echo '$(srcdir)/'`gstdtlsdec.c
 
-libgstqtwrapper_la-codecmapping.lo: codecmapping.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -MT libgstqtwrapper_la-codecmapping.lo -MD -MP -MF $(DEPDIR)/libgstqtwrapper_la-codecmapping.Tpo -c -o libgstqtwrapper_la-codecmapping.lo `test -f 'codecmapping.c' || echo '$(srcdir)/'`codecmapping.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstqtwrapper_la-codecmapping.Tpo $(DEPDIR)/libgstqtwrapper_la-codecmapping.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='codecmapping.c' object='libgstqtwrapper_la-codecmapping.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdtls_la-gstdtlsenc.lo: gstdtlsenc.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlsenc.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlsenc.Tpo -c -o libgstdtls_la-gstdtlsenc.lo `test -f 'gstdtlsenc.c' || echo '$(srcdir)/'`gstdtlsenc.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlsenc.Tpo $(DEPDIR)/libgstdtls_la-gstdtlsenc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlsenc.c' object='libgstdtls_la-gstdtlsenc.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -c -o libgstqtwrapper_la-codecmapping.lo `test -f 'codecmapping.c' || echo '$(srcdir)/'`codecmapping.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlsenc.lo `test -f 'gstdtlsenc.c' || echo '$(srcdir)/'`gstdtlsenc.c
 
-libgstqtwrapper_la-audiodecoders.lo: audiodecoders.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -MT libgstqtwrapper_la-audiodecoders.lo -MD -MP -MF $(DEPDIR)/libgstqtwrapper_la-audiodecoders.Tpo -c -o libgstqtwrapper_la-audiodecoders.lo `test -f 'audiodecoders.c' || echo '$(srcdir)/'`audiodecoders.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstqtwrapper_la-audiodecoders.Tpo $(DEPDIR)/libgstqtwrapper_la-audiodecoders.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='audiodecoders.c' object='libgstqtwrapper_la-audiodecoders.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdtls_la-gstdtlssrtpdemux.lo: gstdtlssrtpdemux.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlssrtpdemux.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlssrtpdemux.Tpo -c -o libgstdtls_la-gstdtlssrtpdemux.lo `test -f 'gstdtlssrtpdemux.c' || echo '$(srcdir)/'`gstdtlssrtpdemux.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlssrtpdemux.Tpo $(DEPDIR)/libgstdtls_la-gstdtlssrtpdemux.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlssrtpdemux.c' object='libgstdtls_la-gstdtlssrtpdemux.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -c -o libgstqtwrapper_la-audiodecoders.lo `test -f 'audiodecoders.c' || echo '$(srcdir)/'`audiodecoders.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlssrtpdemux.lo `test -f 'gstdtlssrtpdemux.c' || echo '$(srcdir)/'`gstdtlssrtpdemux.c
 
-libgstqtwrapper_la-videodecoders.lo: videodecoders.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -MT libgstqtwrapper_la-videodecoders.lo -MD -MP -MF $(DEPDIR)/libgstqtwrapper_la-videodecoders.Tpo -c -o libgstqtwrapper_la-videodecoders.lo `test -f 'videodecoders.c' || echo '$(srcdir)/'`videodecoders.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstqtwrapper_la-videodecoders.Tpo $(DEPDIR)/libgstqtwrapper_la-videodecoders.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='videodecoders.c' object='libgstqtwrapper_la-videodecoders.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdtls_la-gstdtlssrtpbin.lo: gstdtlssrtpbin.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlssrtpbin.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlssrtpbin.Tpo -c -o libgstdtls_la-gstdtlssrtpbin.lo `test -f 'gstdtlssrtpbin.c' || echo '$(srcdir)/'`gstdtlssrtpbin.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlssrtpbin.Tpo $(DEPDIR)/libgstdtls_la-gstdtlssrtpbin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlssrtpbin.c' object='libgstdtls_la-gstdtlssrtpbin.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -c -o libgstqtwrapper_la-videodecoders.lo `test -f 'videodecoders.c' || echo '$(srcdir)/'`videodecoders.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlssrtpbin.lo `test -f 'gstdtlssrtpbin.c' || echo '$(srcdir)/'`gstdtlssrtpbin.c
 
-libgstqtwrapper_la-imagedescription.lo: imagedescription.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -MT libgstqtwrapper_la-imagedescription.lo -MD -MP -MF $(DEPDIR)/libgstqtwrapper_la-imagedescription.Tpo -c -o libgstqtwrapper_la-imagedescription.lo `test -f 'imagedescription.c' || echo '$(srcdir)/'`imagedescription.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstqtwrapper_la-imagedescription.Tpo $(DEPDIR)/libgstqtwrapper_la-imagedescription.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='imagedescription.c' object='libgstqtwrapper_la-imagedescription.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdtls_la-gstdtlssrtpdec.lo: gstdtlssrtpdec.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlssrtpdec.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlssrtpdec.Tpo -c -o libgstdtls_la-gstdtlssrtpdec.lo `test -f 'gstdtlssrtpdec.c' || echo '$(srcdir)/'`gstdtlssrtpdec.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlssrtpdec.Tpo $(DEPDIR)/libgstdtls_la-gstdtlssrtpdec.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlssrtpdec.c' object='libgstdtls_la-gstdtlssrtpdec.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstqtwrapper_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstqtwrapper_la_CFLAGS) $(CFLAGS) -c -o libgstqtwrapper_la-imagedescription.lo `test -f 'imagedescription.c' || echo '$(srcdir)/'`imagedescription.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlssrtpdec.lo `test -f 'gstdtlssrtpdec.c' || echo '$(srcdir)/'`gstdtlssrtpdec.c
+
+libgstdtls_la-gstdtlssrtpenc.lo: gstdtlssrtpenc.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlssrtpenc.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlssrtpenc.Tpo -c -o libgstdtls_la-gstdtlssrtpenc.lo `test -f 'gstdtlssrtpenc.c' || echo '$(srcdir)/'`gstdtlssrtpenc.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlssrtpenc.Tpo $(DEPDIR)/libgstdtls_la-gstdtlssrtpenc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlssrtpenc.c' object='libgstdtls_la-gstdtlssrtpenc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlssrtpenc.lo `test -f 'gstdtlssrtpenc.c' || echo '$(srcdir)/'`gstdtlssrtpenc.c
+
+libgstdtls_la-gstdtlsagent.lo: gstdtlsagent.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlsagent.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlsagent.Tpo -c -o libgstdtls_la-gstdtlsagent.lo `test -f 'gstdtlsagent.c' || echo '$(srcdir)/'`gstdtlsagent.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlsagent.Tpo $(DEPDIR)/libgstdtls_la-gstdtlsagent.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlsagent.c' object='libgstdtls_la-gstdtlsagent.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlsagent.lo `test -f 'gstdtlsagent.c' || echo '$(srcdir)/'`gstdtlsagent.c
+
+libgstdtls_la-gstdtlsconnection.lo: gstdtlsconnection.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlsconnection.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlsconnection.Tpo -c -o libgstdtls_la-gstdtlsconnection.lo `test -f 'gstdtlsconnection.c' || echo '$(srcdir)/'`gstdtlsconnection.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlsconnection.Tpo $(DEPDIR)/libgstdtls_la-gstdtlsconnection.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlsconnection.c' object='libgstdtls_la-gstdtlsconnection.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlsconnection.lo `test -f 'gstdtlsconnection.c' || echo '$(srcdir)/'`gstdtlsconnection.c
+
+libgstdtls_la-gstdtlscertificate.lo: gstdtlscertificate.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -MT libgstdtls_la-gstdtlscertificate.lo -MD -MP -MF $(DEPDIR)/libgstdtls_la-gstdtlscertificate.Tpo -c -o libgstdtls_la-gstdtlscertificate.lo `test -f 'gstdtlscertificate.c' || echo '$(srcdir)/'`gstdtlscertificate.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdtls_la-gstdtlscertificate.Tpo $(DEPDIR)/libgstdtls_la-gstdtlscertificate.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdtlscertificate.c' object='libgstdtls_la-gstdtlscertificate.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdtls_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdtls_la_CFLAGS) $(CFLAGS) -c -o libgstdtls_la-gstdtlscertificate.lo `test -f 'gstdtlscertificate.c' || echo '$(srcdir)/'`gstdtlscertificate.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
diff --git a/ext/dtls/gstdtlsagent.c b/ext/dtls/gstdtlsagent.c
new file mode 100644
index 0000000..837ef30
--- /dev/null
+++ b/ext/dtls/gstdtlsagent.c
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstdtlsagent.h"
+
+#ifdef __APPLE__
+# define __AVAILABILITYMACROS__
+# define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_dtls_agent_debug);
+#define GST_CAT_DEFAULT gst_dtls_agent_debug
+
+G_DEFINE_TYPE_WITH_CODE (GstDtlsAgent, gst_dtls_agent, G_TYPE_OBJECT,
+    GST_DEBUG_CATEGORY_INIT (gst_dtls_agent_debug, "dtlsagent", 0,
+        "DTLS Agent"));
+
+#define GST_DTLS_AGENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgentPrivate))
+
+enum
+{
+  PROP_0,
+  PROP_CERTIFICATE,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+struct _GstDtlsAgentPrivate
+{
+  SSL_CTX *ssl_context;
+
+  GstDtlsCertificate *certificate;
+};
+
+static void gst_dtls_agent_finalize (GObject * gobject);
+static void gst_dtls_agent_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+const gchar *gst_dtls_agent_peek_id (GstDtlsAgent *);
+
+static GRWLock *ssl_locks;
+
+static void
+ssl_locking_function (gint mode, gint lock_num, const gchar * file, gint line)
+{
+  gboolean locking;
+  gboolean reading;
+  GRWLock *lock;
+
+  locking = mode & CRYPTO_LOCK;
+  reading = mode & CRYPTO_READ;
+  lock = &ssl_locks[lock_num];
+
+  GST_LOG_OBJECT (NULL, "%s SSL lock for %s, thread=%p location=%s:%d",
+      locking ? "locking" : "unlocking", reading ? "reading" : "writing",
+      g_thread_self (), file, line);
+
+  if (locking) {
+    if (reading) {
+      g_rw_lock_reader_lock (lock);
+    } else {
+      g_rw_lock_writer_lock (lock);
+    }
+  } else {
+    if (reading) {
+      g_rw_lock_reader_unlock (lock);
+    } else {
+      g_rw_lock_writer_unlock (lock);
+    }
+  }
+}
+
+static gulong
+ssl_thread_id_function (void)
+{
+  return (gulong) g_thread_self ();
+}
+
+void
+_gst_dtls_init_openssl (void)
+{
+  static gsize is_init = 0;
+  gint i;
+  gint num_locks;
+
+  if (g_once_init_enter (&is_init)) {
+    if (OPENSSL_VERSION_NUMBER < 0x1000100fL) {
+      GST_WARNING_OBJECT (NULL,
+          "Incorrect OpenSSL version, should be >= 1.0.1, is %s",
+          OPENSSL_VERSION_TEXT);
+      g_assert_not_reached ();
+    }
+
+    GST_INFO_OBJECT (NULL, "initializing openssl %lx", OPENSSL_VERSION_NUMBER);
+    SSL_library_init ();
+    SSL_load_error_strings ();
+    ERR_load_BIO_strings ();
+
+    num_locks = CRYPTO_num_locks ();
+    ssl_locks = g_new (GRWLock, num_locks);
+    for (i = 0; i < num_locks; ++i) {
+      g_rw_lock_init (&ssl_locks[i]);
+    }
+    CRYPTO_set_locking_callback (ssl_locking_function);
+    CRYPTO_set_id_callback (ssl_thread_id_function);
+
+    g_once_init_leave (&is_init, 1);
+  }
+}
+
+static void
+gst_dtls_agent_class_init (GstDtlsAgentClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstDtlsAgentPrivate));
+
+  gobject_class->set_property = gst_dtls_agent_set_property;
+  gobject_class->finalize = gst_dtls_agent_finalize;
+
+  properties[PROP_CERTIFICATE] =
+      g_param_spec_object ("certificate",
+      "GstDtlsCertificate",
+      "Sets the certificate of the agent",
+      GST_TYPE_DTLS_CERTIFICATE,
+      G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+
+  _gst_dtls_init_openssl ();
+}
+
+static void
+gst_dtls_agent_init (GstDtlsAgent * self)
+{
+  GstDtlsAgentPrivate *priv = GST_DTLS_AGENT_GET_PRIVATE (self);
+  self->priv = priv;
+
+  ERR_clear_error ();
+
+  priv->ssl_context = SSL_CTX_new (DTLSv1_method ());
+  if (ERR_peek_error () || !priv->ssl_context) {
+    char buf[512];
+
+    priv->ssl_context = NULL;
+
+    GST_WARNING_OBJECT (self, "Error creating SSL Context: %s",
+        ERR_error_string (ERR_get_error (), buf));
+
+    g_return_if_reached ();
+  }
+
+  SSL_CTX_set_verify_depth (priv->ssl_context, 2);
+  SSL_CTX_set_tlsext_use_srtp (priv->ssl_context, "SRTP_AES128_CM_SHA1_80");
+  SSL_CTX_set_cipher_list (priv->ssl_context,
+      "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
+  SSL_CTX_set_read_ahead (priv->ssl_context, 1);
+#if OPENSSL_VERSION_NUMBER >= 0x1000200fL
+  SSL_CTX_set_ecdh_auto (priv->ssl_context, 1);
+#endif
+}
+
+static void
+gst_dtls_agent_finalize (GObject * gobject)
+{
+  GstDtlsAgentPrivate *priv = GST_DTLS_AGENT (gobject)->priv;
+
+  SSL_CTX_free (priv->ssl_context);
+  priv->ssl_context = NULL;
+
+  GST_DEBUG_OBJECT (gobject, "finalized");
+
+  G_OBJECT_CLASS (gst_dtls_agent_parent_class)->finalize (gobject);
+}
+
+static void
+gst_dtls_agent_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsAgent *self = GST_DTLS_AGENT (object);
+  GstDtlsCertificate *certificate;
+
+  switch (prop_id) {
+    case PROP_CERTIFICATE:
+      certificate = GST_DTLS_CERTIFICATE (g_value_get_object (value));
+      g_return_if_fail (GST_IS_DTLS_CERTIFICATE (certificate));
+      g_return_if_fail (self->priv->ssl_context);
+
+      self->priv->certificate = certificate;
+      g_object_ref (certificate);
+
+      if (!SSL_CTX_use_certificate (self->priv->ssl_context,
+              _gst_dtls_certificate_get_internal_certificate (certificate))) {
+        GST_WARNING_OBJECT (self, "could not use certificate");
+        g_return_if_reached ();
+      }
+
+      if (!SSL_CTX_use_PrivateKey (self->priv->ssl_context,
+              _gst_dtls_certificate_get_internal_key (certificate))) {
+        GST_WARNING_OBJECT (self, "could not use private key");
+        g_return_if_reached ();
+      }
+
+      if (!SSL_CTX_check_private_key (self->priv->ssl_context)) {
+        GST_WARNING_OBJECT (self, "invalid private key");
+        g_return_if_reached ();
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+GstDtlsCertificate *
+gst_dtls_agent_get_certificate (GstDtlsAgent * self)
+{
+  g_return_val_if_fail (GST_IS_DTLS_AGENT (self), NULL);
+  if (self->priv->certificate) {
+    g_object_ref (self->priv->certificate);
+  }
+  return self->priv->certificate;
+}
+
+gchar *
+gst_dtls_agent_get_certificate_pem (GstDtlsAgent * self)
+{
+  gchar *pem;
+  g_return_val_if_fail (GST_IS_DTLS_AGENT (self), NULL);
+  g_return_val_if_fail (GST_IS_DTLS_CERTIFICATE (self->priv->certificate),
+      NULL);
+
+  g_object_get (self->priv->certificate, "pem", &pem, NULL);
+
+  return pem;
+}
+
+const GstDtlsAgentContext
+_gst_dtls_agent_peek_context (GstDtlsAgent * self)
+{
+  g_return_val_if_fail (GST_IS_DTLS_AGENT (self), NULL);
+  return self->priv->ssl_context;
+}
diff --git a/ext/dtls/gstdtlsagent.h b/ext/dtls/gstdtlsagent.h
new file mode 100644
index 0000000..fbfa1e8
--- /dev/null
+++ b/ext/dtls/gstdtlsagent.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlsagent_h
+#define gstdtlsagent_h
+
+#include "gstdtlscertificate.h"
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_AGENT            (gst_dtls_agent_get_type())
+#define GST_DTLS_AGENT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgent))
+#define GST_DTLS_AGENT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_AGENT, GstDtlsAgentClass))
+#define GST_IS_DTLS_AGENT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_AGENT))
+#define GST_IS_DTLS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_AGENT))
+#define GST_DTLS_AGENT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgentClass))
+
+typedef gpointer GstDtlsAgentContext;
+
+typedef struct _GstDtlsAgent        GstDtlsAgent;
+typedef struct _GstDtlsAgentClass   GstDtlsAgentClass;
+typedef struct _GstDtlsAgentPrivate GstDtlsAgentPrivate;
+
+/*
+ * GstDtlsAgent:
+ *
+ * A context for creating GstDtlsConnections with a GstDtlsCertificate.
+ * GstDtlsAgent needs to be constructed with the "certificate" property set.
+ */
+struct _GstDtlsAgent {
+    GObject parent_instance;
+
+    GstDtlsAgentPrivate *priv;
+};
+
+struct _GstDtlsAgentClass {
+    GObjectClass parent_class;
+};
+
+GType gst_dtls_agent_get_type(void) G_GNUC_CONST;
+
+/*
+ * Returns the certificate used by the agent.
+ */
+GstDtlsCertificate *gst_dtls_agent_get_certificate(GstDtlsAgent *);
+
+/*
+ * Returns the certificate used by the agent, in PEM format.
+ */
+gchar *gst_dtls_agent_get_certificate_pem(GstDtlsAgent *self);
+
+/* internal */
+void _gst_dtls_init_openssl(void);
+const GstDtlsAgentContext _gst_dtls_agent_peek_context(GstDtlsAgent *);
+
+G_END_DECLS
+
+#endif /* gstdtlsagent_h */
diff --git a/ext/dtls/gstdtlscertificate.c b/ext/dtls/gstdtlscertificate.c
new file mode 100644
index 0000000..e37494f
--- /dev/null
+++ b/ext/dtls/gstdtlscertificate.c
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstdtlscertificate.h"
+
+#include "gstdtlsagent.h"
+
+#ifdef __APPLE__
+# define __AVAILABILITYMACROS__
+# define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+#include <openssl/ssl.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_dtls_certificate_debug);
+#define GST_CAT_DEFAULT gst_dtls_certificate_debug
+
+G_DEFINE_TYPE_WITH_CODE (GstDtlsCertificate, gst_dtls_certificate,
+    G_TYPE_OBJECT, GST_DEBUG_CATEGORY_INIT (gst_dtls_certificate_debug,
+        "dtlscertificate", 0, "DTLS Certificate"));
+
+#define GST_DTLS_CERTIFICATE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificatePrivate))
+
+enum
+{
+  PROP_0,
+  PROP_PEM,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+#define DEFAULT_PEM NULL
+
+struct _GstDtlsCertificatePrivate
+{
+  X509 *x509;
+  EVP_PKEY *private_key;
+
+  gchar *pem;
+};
+
+static void gst_dtls_certificate_finalize (GObject * gobject);
+static void gst_dtls_certificate_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+static void gst_dtls_certificate_get_property (GObject *, guint prop_id,
+    GValue *, GParamSpec *);
+
+static void init_generated (GstDtlsCertificate *);
+static void init_from_pem_string (GstDtlsCertificate *, const gchar * pem);
+
+static void
+gst_dtls_certificate_class_init (GstDtlsCertificateClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstDtlsCertificatePrivate));
+
+  gobject_class->set_property = gst_dtls_certificate_set_property;
+  gobject_class->get_property = gst_dtls_certificate_get_property;
+
+  properties[PROP_PEM] =
+      g_param_spec_string ("pem",
+      "Pem string",
+      "A string containing a X509 certificate and RSA private key in PEM format",
+      DEFAULT_PEM,
+      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+
+  _gst_dtls_init_openssl ();
+
+  gobject_class->finalize = gst_dtls_certificate_finalize;
+}
+
+static void
+gst_dtls_certificate_init (GstDtlsCertificate * self)
+{
+  GstDtlsCertificatePrivate *priv = GST_DTLS_CERTIFICATE_GET_PRIVATE (self);
+  self->priv = priv;
+
+  priv->x509 = NULL;
+  priv->private_key = NULL;
+  priv->pem = NULL;
+}
+
+static void
+gst_dtls_certificate_finalize (GObject * gobject)
+{
+  GstDtlsCertificatePrivate *priv = GST_DTLS_CERTIFICATE (gobject)->priv;
+
+  X509_free (priv->x509);
+  priv->x509 = NULL;
+
+  EVP_PKEY_free (priv->private_key);
+  priv->private_key = NULL;
+
+
+  g_free (priv->pem);
+  priv->pem = NULL;
+
+  G_OBJECT_CLASS (gst_dtls_certificate_parent_class)->finalize (gobject);
+}
+
+static void
+gst_dtls_certificate_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsCertificate *self = GST_DTLS_CERTIFICATE (object);
+  const gchar *pem;
+
+  switch (prop_id) {
+    case PROP_PEM:
+      pem = g_value_get_string (value);
+      if (pem) {
+        init_from_pem_string (self, pem);
+      } else {
+        init_generated (self);
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static void
+gst_dtls_certificate_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstDtlsCertificate *self = GST_DTLS_CERTIFICATE (object);
+
+  switch (prop_id) {
+    case PROP_PEM:
+      g_return_if_fail (self->priv->pem);
+      g_value_set_string (value, self->priv->pem);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static void
+init_generated (GstDtlsCertificate * self)
+{
+  GstDtlsCertificatePrivate *priv = self->priv;
+  RSA *rsa;
+  X509_NAME *name = NULL;
+
+  g_return_if_fail (!priv->x509);
+  g_return_if_fail (!priv->private_key);
+
+  priv->private_key = EVP_PKEY_new ();
+
+  if (!priv->private_key) {
+    GST_WARNING_OBJECT (self, "failed to create private key");
+    return;
+  }
+
+  priv->x509 = X509_new ();
+
+  if (!priv->x509) {
+    GST_WARNING_OBJECT (self, "failed to create certificate");
+    EVP_PKEY_free (priv->private_key);
+    priv->private_key = NULL;
+    return;
+  }
+  rsa = RSA_generate_key (2048, RSA_F4, NULL, NULL);
+
+  if (!rsa) {
+    GST_WARNING_OBJECT (self, "failed to generate RSA");
+    EVP_PKEY_free (priv->private_key);
+    priv->private_key = NULL;
+    X509_free (priv->x509);
+    priv->x509 = NULL;
+    return;
+  }
+
+  if (!EVP_PKEY_assign_RSA (priv->private_key, rsa)) {
+    GST_WARNING_OBJECT (self, "failed to assign RSA");
+    RSA_free (rsa);
+    rsa = NULL;
+    EVP_PKEY_free (priv->private_key);
+    priv->private_key = NULL;
+    X509_free (priv->x509);
+    priv->x509 = NULL;
+    return;
+  }
+  rsa = NULL;
+
+  X509_set_version (priv->x509, 2);
+  ASN1_INTEGER_set (X509_get_serialNumber (priv->x509), 0);
+  X509_gmtime_adj (X509_get_notBefore (priv->x509), 0);
+  X509_gmtime_adj (X509_get_notAfter (priv->x509), 31536000L);  /* A year */
+  X509_set_pubkey (priv->x509, priv->private_key);
+
+  name = X509_get_subject_name (priv->x509);
+  X509_NAME_add_entry_by_txt (name, "C", MBSTRING_ASC, (unsigned char *) "SE",
+      -1, -1, 0);
+  X509_NAME_add_entry_by_txt (name, "CN", MBSTRING_ASC,
+      (unsigned char *) "OpenWebRTC", -1, -1, 0);
+  X509_set_issuer_name (priv->x509, name);
+  name = NULL;
+
+  if (!X509_sign (priv->x509, priv->private_key, EVP_sha256 ())) {
+    GST_WARNING_OBJECT (self, "failed to sign certificate");
+    EVP_PKEY_free (priv->private_key);
+    priv->private_key = NULL;
+    X509_free (priv->x509);
+    priv->x509 = NULL;
+    return;
+  }
+
+  self->priv->pem = _gst_dtls_x509_to_pem (priv->x509);
+}
+
+static void
+init_from_pem_string (GstDtlsCertificate * self, const gchar * pem)
+{
+  GstDtlsCertificatePrivate *priv = self->priv;
+  BIO *bio;
+
+  g_return_if_fail (pem);
+  g_return_if_fail (!priv->x509);
+  g_return_if_fail (!priv->private_key);
+
+  bio = BIO_new_mem_buf ((gpointer) pem, -1);
+  g_return_if_fail (bio);
+
+  priv->x509 = PEM_read_bio_X509 (bio, NULL, NULL, NULL);
+
+  if (!priv->x509) {
+    GST_WARNING_OBJECT (self, "failed to read certificate from pem string");
+    return;
+  }
+
+  (void) BIO_reset (bio);
+
+  priv->private_key = PEM_read_bio_PrivateKey (bio, NULL, NULL, NULL);
+
+  BIO_free (bio);
+  bio = NULL;
+
+  if (!priv->private_key) {
+    GST_WARNING_OBJECT (self, "failed to read private key from pem string");
+    X509_free (priv->x509);
+    priv->x509 = NULL;
+    return;
+  }
+
+  self->priv->pem = g_strdup (pem);
+}
+
+gchar *
+_gst_dtls_x509_to_pem (gpointer x509)
+{
+#define GST_DTLS_BIO_BUFFER_SIZE 4096
+  BIO *bio;
+  gchar buffer[GST_DTLS_BIO_BUFFER_SIZE] = { 0 };
+  gint len;
+  gchar *pem = NULL;
+
+  bio = BIO_new (BIO_s_mem ());
+  g_return_val_if_fail (bio, NULL);
+
+  if (!PEM_write_bio_X509 (bio, (X509 *) x509)) {
+    g_warn_if_reached ();
+    goto beach;
+  }
+
+  len = BIO_read (bio, buffer, GST_DTLS_BIO_BUFFER_SIZE);
+  if (!len) {
+    g_warn_if_reached ();
+    goto beach;
+  }
+
+  pem = g_strndup (buffer, len);
+
+beach:
+  BIO_free (bio);
+
+  return pem;
+}
+
+GstDtlsCertificateInternalCertificate
+_gst_dtls_certificate_get_internal_certificate (GstDtlsCertificate * self)
+{
+  g_return_val_if_fail (GST_IS_DTLS_CERTIFICATE (self), NULL);
+  return self->priv->x509;
+}
+
+GstDtlsCertificateInternalKey
+_gst_dtls_certificate_get_internal_key (GstDtlsCertificate * self)
+{
+  g_return_val_if_fail (GST_IS_DTLS_CERTIFICATE (self), NULL);
+  return self->priv->private_key;
+}
diff --git a/ext/dtls/gstdtlscertificate.h b/ext/dtls/gstdtlscertificate.h
new file mode 100644
index 0000000..ae083fe
--- /dev/null
+++ b/ext/dtls/gstdtlscertificate.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlscertificate_h
+#define gstdtlscertificate_h
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_CERTIFICATE            (gst_dtls_certificate_get_type())
+#define GST_DTLS_CERTIFICATE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificate))
+#define GST_DTLS_CERTIFICATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificateClass))
+#define GST_IS_DTLS_CERTIFICATE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_CERTIFICATE))
+#define GST_IS_DTLS_CERTIFICATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_CERTIFICATE))
+#define GST_DTLS_CERTIFICATE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificateClass))
+
+typedef gpointer GstDtlsCertificateInternalCertificate;
+typedef gpointer GstDtlsCertificateInternalKey;
+
+typedef struct _GstDtlsCertificate        GstDtlsCertificate;
+typedef struct _GstDtlsCertificateClass   GstDtlsCertificateClass;
+typedef struct _GstDtlsCertificatePrivate GstDtlsCertificatePrivate;
+
+/*
+ * GstDtlsCertificate:
+ *
+ * Handles a X509 certificate and a private key.
+ * If a certificate is created without the "pem" property, a self-signed certificate is generated.
+ */
+struct _GstDtlsCertificate {
+    GObject parent_instance;
+
+    GstDtlsCertificatePrivate *priv;
+};
+
+struct _GstDtlsCertificateClass {
+    GObjectClass parent_class;
+};
+
+GType gst_dtls_certificate_get_type(void) G_GNUC_CONST;
+
+/* internal */
+GstDtlsCertificateInternalCertificate _gst_dtls_certificate_get_internal_certificate(GstDtlsCertificate *);
+GstDtlsCertificateInternalKey _gst_dtls_certificate_get_internal_key(GstDtlsCertificate *);
+gchar *_gst_dtls_x509_to_pem(gpointer x509);
+
+G_END_DECLS
+
+#endif /* gstdtlscertificate_h */
diff --git a/ext/dtls/gstdtlsconnection.c b/ext/dtls/gstdtlsconnection.c
new file mode 100644
index 0000000..c84e9f2
--- /dev/null
+++ b/ext/dtls/gstdtlsconnection.c
@@ -0,0 +1,914 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstdtlsconnection.h"
+
+#include "gstdtlsagent.h"
+#include "gstdtlscertificate.h"
+
+#ifdef __APPLE__
+# define __AVAILABILITYMACROS__
+# define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_dtls_connection_debug);
+#define GST_CAT_DEFAULT gst_dtls_connection_debug
+G_DEFINE_TYPE_WITH_CODE (GstDtlsConnection, gst_dtls_connection, G_TYPE_OBJECT,
+    GST_DEBUG_CATEGORY_INIT (gst_dtls_connection_debug, "dtlsconnection", 0,
+        "DTLS Connection"));
+
+#define GST_DTLS_CONNECTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GST_TYPE_DTLS_CONNECTION, GstDtlsConnectionPrivate))
+
+#define SRTP_KEY_LEN 16
+#define SRTP_SALT_LEN 14
+
+enum
+{
+  SIGNAL_ON_ENCODER_KEY,
+  SIGNAL_ON_DECODER_KEY,
+  SIGNAL_ON_PEER_CERTIFICATE,
+  NUM_SIGNALS
+};
+
+static guint signals[NUM_SIGNALS];
+
+enum
+{
+  PROP_0,
+  PROP_AGENT,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+static int connection_ex_index;
+
+struct _GstDtlsConnectionPrivate
+{
+  SSL *ssl;
+  BIO *bio;
+  GThread *thread;
+
+  gboolean is_client;
+  gboolean is_alive;
+  gboolean keys_exported;
+  gboolean timeout_set;
+
+  GMutex mutex;
+  GCond condition;
+  gpointer bio_buffer;
+  gint bio_buffer_len;
+  gint bio_buffer_offset;
+
+  GClosure *send_closure;
+};
+
+static void gst_dtls_connection_finalize (GObject * gobject);
+static void gst_dtls_connection_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+
+static void log_state (GstDtlsConnection *, const gchar * str);
+static gpointer connection_timeout_thread_func (GstDtlsConnection *);
+static void export_srtp_keys (GstDtlsConnection *);
+static void openssl_poll (GstDtlsConnection *);
+static int openssl_verify_callback (int preverify_ok,
+    X509_STORE_CTX * x509_ctx);
+
+static BIO_METHOD *BIO_s_gst_dtls_connection (void);
+static int bio_method_write (BIO *, const char *data, int size);
+static int bio_method_read (BIO *, char *out_buffer, int size);
+static long bio_method_ctrl (BIO *, int cmd, long arg1, void *arg2);
+static int bio_method_new (BIO *);
+static int bio_method_free (BIO *);
+
+static void
+gst_dtls_connection_class_init (GstDtlsConnectionClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstDtlsConnectionPrivate));
+
+  gobject_class->set_property = gst_dtls_connection_set_property;
+
+  connection_ex_index =
+      SSL_get_ex_new_index (0, (gpointer) "gstdtlsagent connection index", NULL,
+      NULL, NULL);
+
+  signals[SIGNAL_ON_DECODER_KEY] =
+      g_signal_new ("on-decoder-key", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+      g_cclosure_marshal_generic, G_TYPE_NONE, 3,
+      G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT);
+
+  signals[SIGNAL_ON_ENCODER_KEY] =
+      g_signal_new ("on-encoder-key", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+      g_cclosure_marshal_generic, G_TYPE_NONE, 3,
+      G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT);
+
+  signals[SIGNAL_ON_PEER_CERTIFICATE] =
+      g_signal_new ("on-peer-certificate", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+      g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
+
+  properties[PROP_AGENT] =
+      g_param_spec_object ("agent",
+      "DTLS Agent",
+      "Agent to use in creation of the connection",
+      GST_TYPE_DTLS_AGENT,
+      G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+
+  _gst_dtls_init_openssl ();
+
+  gobject_class->finalize = gst_dtls_connection_finalize;
+}
+
+static void
+gst_dtls_connection_init (GstDtlsConnection * self)
+{
+  GstDtlsConnectionPrivate *priv = GST_DTLS_CONNECTION_GET_PRIVATE (self);
+  self->priv = priv;
+
+  priv->ssl = NULL;
+  priv->bio = NULL;
+  priv->thread = NULL;
+
+  priv->send_closure = NULL;
+
+  priv->is_client = FALSE;
+  priv->is_alive = TRUE;
+  priv->keys_exported = FALSE;
+  priv->timeout_set = FALSE;
+
+  priv->bio_buffer = NULL;
+  priv->bio_buffer_len = 0;
+  priv->bio_buffer_offset = 0;
+
+  g_mutex_init (&priv->mutex);
+  g_cond_init (&priv->condition);
+}
+
+static void
+gst_dtls_connection_finalize (GObject * gobject)
+{
+  GstDtlsConnection *self = GST_DTLS_CONNECTION (gobject);
+  GstDtlsConnectionPrivate *priv = self->priv;
+
+
+  SSL_free (priv->ssl);
+  priv->ssl = NULL;
+
+  if (priv->send_closure) {
+    g_closure_unref (priv->send_closure);
+    priv->send_closure = NULL;
+  }
+
+  g_mutex_clear (&priv->mutex);
+  g_cond_clear (&priv->condition);
+
+  GST_DEBUG_OBJECT (self, "finalized");
+
+  G_OBJECT_CLASS (gst_dtls_connection_parent_class)->finalize (gobject);
+}
+
+static void
+gst_dtls_connection_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsConnection *self = GST_DTLS_CONNECTION (object);
+  GstDtlsAgent *agent;
+  GstDtlsConnectionPrivate *priv = self->priv;
+  SSL_CTX *ssl_context;
+
+  switch (prop_id) {
+    case PROP_AGENT:
+      g_return_if_fail (!priv->ssl);
+      agent = GST_DTLS_AGENT (g_value_get_object (value));
+      g_return_if_fail (GST_IS_DTLS_AGENT (agent));
+
+      ssl_context = _gst_dtls_agent_peek_context (agent);
+
+      priv->ssl = SSL_new (ssl_context);
+      g_return_if_fail (priv->ssl);
+
+      priv->bio = BIO_new (BIO_s_gst_dtls_connection ());
+      g_return_if_fail (priv->bio);
+
+      priv->bio->ptr = self;
+      SSL_set_bio (priv->ssl, priv->bio, priv->bio);
+
+      SSL_set_verify (priv->ssl,
+          SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
+          openssl_verify_callback);
+      SSL_set_ex_data (priv->ssl, connection_ex_index, self);
+
+      log_state (self, "connection created");
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+void
+gst_dtls_connection_start (GstDtlsConnection * self, gboolean is_client)
+{
+  GstDtlsConnectionPrivate *priv;
+
+  g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
+
+  priv = self->priv;
+
+  g_return_if_fail (priv->send_closure);
+  g_return_if_fail (priv->ssl);
+  g_return_if_fail (priv->bio);
+
+  GST_TRACE_OBJECT (self, "locking @ start");
+  g_mutex_lock (&priv->mutex);
+  GST_TRACE_OBJECT (self, "locked @ start");
+
+  priv->is_alive = TRUE;
+  priv->timeout_set = FALSE;
+  priv->bio_buffer = NULL;
+  priv->bio_buffer_len = 0;
+  priv->bio_buffer_offset = 0;
+  priv->keys_exported = FALSE;
+
+  priv->is_client = is_client;
+  if (priv->is_client) {
+    SSL_set_connect_state (priv->ssl);
+  } else {
+    SSL_set_accept_state (priv->ssl);
+  }
+  log_state (self, "initial state set");
+
+  openssl_poll (self);
+
+  log_state (self, "first poll done");
+  priv->thread = NULL;
+
+  GST_TRACE_OBJECT (self, "unlocking @ start");
+  g_mutex_unlock (&priv->mutex);
+}
+
+void
+gst_dtls_connection_start_timeout (GstDtlsConnection * self)
+{
+  GstDtlsConnectionPrivate *priv;
+  GError *error = NULL;
+  gchar *thread_name;
+
+  g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
+
+  priv = self->priv;
+
+  thread_name = g_strdup_printf ("connection_thread_%p", self);
+
+  GST_TRACE_OBJECT (self, "locking @ start_timeout");
+  g_mutex_lock (&priv->mutex);
+  GST_TRACE_OBJECT (self, "locked @ start_timeout");
+
+  GST_INFO_OBJECT (self, "starting connection timeout");
+  priv->thread = g_thread_try_new (thread_name,
+      (GThreadFunc) connection_timeout_thread_func, self, &error);
+  if (error) {
+    GST_WARNING_OBJECT (self, "error creating connection thread: %s (%d)",
+        error->message, error->code);
+    g_clear_error (&error);
+  }
+
+  g_free (thread_name);
+
+  GST_TRACE_OBJECT (self, "unlocking @ start_timeout");
+  g_mutex_unlock (&priv->mutex);
+}
+
+void
+gst_dtls_connection_stop (GstDtlsConnection * self)
+{
+  g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
+  g_return_if_fail (self->priv->ssl);
+  g_return_if_fail (self->priv->bio);
+
+  GST_DEBUG_OBJECT (self, "stopping connection");
+
+  GST_TRACE_OBJECT (self, "locking @ stop");
+  g_mutex_lock (&self->priv->mutex);
+  GST_TRACE_OBJECT (self, "locked @ stop");
+
+  self->priv->is_alive = FALSE;
+  GST_TRACE_OBJECT (self, "signaling @ stop");
+  g_cond_signal (&self->priv->condition);
+  GST_TRACE_OBJECT (self, "signaled @ stop");
+
+  GST_TRACE_OBJECT (self, "unlocking @ stop");
+  g_mutex_unlock (&self->priv->mutex);
+
+  GST_DEBUG_OBJECT (self, "stopped connection");
+}
+
+void
+gst_dtls_connection_close (GstDtlsConnection * self)
+{
+  g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
+  g_return_if_fail (self->priv->ssl);
+  g_return_if_fail (self->priv->bio);
+
+  GST_DEBUG_OBJECT (self, "closing connection");
+
+  GST_TRACE_OBJECT (self, "locking @ close");
+  g_mutex_lock (&self->priv->mutex);
+  GST_TRACE_OBJECT (self, "locked @ close");
+
+  if (self->priv->is_alive) {
+    self->priv->is_alive = FALSE;
+    g_cond_signal (&self->priv->condition);
+  }
+
+  GST_TRACE_OBJECT (self, "unlocking @ close");
+  g_mutex_unlock (&self->priv->mutex);
+
+  if (self->priv->thread) {
+    g_thread_join (self->priv->thread);
+    self->priv->thread = NULL;
+  }
+
+  GST_DEBUG_OBJECT (self, "closed connection");
+}
+
+void
+gst_dtls_connection_set_send_callback (GstDtlsConnection * self,
+    GClosure * closure)
+{
+  g_return_if_fail (GST_IS_DTLS_CONNECTION (self));
+
+  GST_TRACE_OBJECT (self, "locking @ set_send_callback");
+  g_mutex_lock (&self->priv->mutex);
+  GST_TRACE_OBJECT (self, "locked @ set_send_callback");
+
+  self->priv->send_closure = closure;
+
+  if (closure && G_CLOSURE_NEEDS_MARSHAL (closure)) {
+    g_closure_set_marshal (closure, g_cclosure_marshal_generic);
+  }
+
+  GST_TRACE_OBJECT (self, "unlocking @ set_send_callback");
+  g_mutex_unlock (&self->priv->mutex);
+}
+
+gint
+gst_dtls_connection_process (GstDtlsConnection * self, gpointer data, gint len)
+{
+  GstDtlsConnectionPrivate *priv;
+  gint result;
+
+  g_return_val_if_fail (GST_IS_DTLS_CONNECTION (self), 0);
+  g_return_val_if_fail (self->priv->ssl, 0);
+  g_return_val_if_fail (self->priv->bio, 0);
+
+  priv = self->priv;
+
+  GST_TRACE_OBJECT (self, "locking @ process");
+  g_mutex_lock (&priv->mutex);
+  GST_TRACE_OBJECT (self, "locked @ process");
+
+  g_warn_if_fail (!priv->bio_buffer);
+
+  priv->bio_buffer = data;
+  priv->bio_buffer_len = len;
+  priv->bio_buffer_offset = 0;
+
+  log_state (self, "process start");
+
+  if (SSL_want_write (priv->ssl)) {
+    openssl_poll (self);
+    log_state (self, "process want write, after poll");
+  }
+
+  result = SSL_read (priv->ssl, data, len);
+
+  log_state (self, "process after read");
+
+  openssl_poll (self);
+
+  log_state (self, "process after poll");
+
+  GST_DEBUG_OBJECT (self, "read result: %d", result);
+
+  GST_TRACE_OBJECT (self, "unlocking @ process");
+  g_mutex_unlock (&priv->mutex);
+
+  return result;
+}
+
+gint
+gst_dtls_connection_send (GstDtlsConnection * self, gpointer data, gint len)
+{
+  int ret = 0;
+
+  g_return_val_if_fail (GST_IS_DTLS_CONNECTION (self), 0);
+
+  g_return_val_if_fail (self->priv->ssl, 0);
+  g_return_val_if_fail (self->priv->bio, 0);
+
+  GST_TRACE_OBJECT (self, "locking @ send");
+  g_mutex_lock (&self->priv->mutex);
+  GST_TRACE_OBJECT (self, "locked @ send");
+
+  if (SSL_is_init_finished (self->priv->ssl)) {
+    ret = SSL_write (self->priv->ssl, data, len);
+    GST_DEBUG_OBJECT (self, "data sent: input was %d B, output is %d B", len,
+        ret);
+  } else {
+    GST_WARNING_OBJECT (self,
+        "tried to send data before handshake was complete");
+    ret = 0;
+  }
+
+  GST_TRACE_OBJECT (self, "unlocking @ send");
+  g_mutex_unlock (&self->priv->mutex);
+
+  return ret;
+}
+
+/*
+     ######   #######  ##    ##
+    ##    ## ##     ## ###   ##
+    ##       ##     ## ####  ##
+    ##       ##     ## ## ## ##
+    ##       ##     ## ##  ####
+    ##    ## ##     ## ##   ###
+     ######   #######  ##    ##
+*/
+
+static void
+log_state (GstDtlsConnection * self, const gchar * str)
+{
+  GstDtlsConnectionPrivate *priv = self->priv;
+  guint states = 0;
+
+  states |= (! !SSL_is_init_finished (priv->ssl) << 0);
+  states |= (! !SSL_in_init (priv->ssl) << 4);
+  states |= (! !SSL_in_before (priv->ssl) << 8);
+  states |= (! !SSL_in_connect_init (priv->ssl) << 12);
+  states |= (! !SSL_in_accept_init (priv->ssl) << 16);
+  states |= (! !SSL_want_write (priv->ssl) << 20);
+  states |= (! !SSL_want_read (priv->ssl) << 24);
+
+  GST_LOG_OBJECT (self, "%s: role=%s buf=(%d,%p:%d/%d) %x|%x %s",
+      str,
+      priv->is_client ? "client" : "server",
+      pqueue_size (priv->ssl->d1->sent_messages),
+      priv->bio_buffer,
+      priv->bio_buffer_offset,
+      priv->bio_buffer_len,
+      states, SSL_get_state (priv->ssl), SSL_state_string_long (priv->ssl));
+}
+
+static gpointer
+connection_timeout_thread_func (GstDtlsConnection * self)
+{
+  GstDtlsConnectionPrivate *priv = self->priv;
+  struct timeval timeout;
+  gint64 end_time, wait_time;
+  gint ret;
+
+  while (priv->is_alive) {
+    GST_TRACE_OBJECT (self, "locking @ timeout");
+    g_mutex_lock (&priv->mutex);
+    GST_TRACE_OBJECT (self, "locked @ timeout");
+
+    if (DTLSv1_get_timeout (priv->ssl, &timeout)) {
+      wait_time = timeout.tv_sec * G_USEC_PER_SEC + timeout.tv_usec;
+
+      if (wait_time) {
+        GST_DEBUG_OBJECT (self, "waiting for %" G_GINT64_FORMAT " usec",
+            wait_time);
+
+        end_time = g_get_monotonic_time () + wait_time;
+
+        GST_TRACE_OBJECT (self, "wait @ timeout");
+        g_cond_wait_until (&priv->condition, &priv->mutex, end_time);
+        GST_TRACE_OBJECT (self, "continued @ timeout");
+      }
+
+      ret = DTLSv1_handle_timeout (priv->ssl);
+
+      GST_DEBUG_OBJECT (self, "handle timeout returned %d, is_alive: %d", ret,
+          priv->is_alive);
+
+      if (ret < 0) {
+        GST_TRACE_OBJECT (self, "unlocking @ timeout failed");
+        g_mutex_unlock (&priv->mutex);
+        break;                  /* self failed after DTLS1_TMO_ALERT_COUNT (12) attempts */
+      }
+
+      if (ret > 0) {
+        log_state (self, "handling timeout before poll");
+        openssl_poll (self);
+        log_state (self, "handling timeout after poll");
+      }
+    } else {
+      GST_DEBUG_OBJECT (self, "waiting indefinitely");
+
+      priv->timeout_set = FALSE;
+
+      while (!priv->timeout_set && priv->is_alive) {
+        GST_TRACE_OBJECT (self, "wait @ timeout");
+        g_cond_wait (&priv->condition, &priv->mutex);
+      }
+      GST_TRACE_OBJECT (self, "continued @ timeout");
+    }
+
+    GST_TRACE_OBJECT (self, "unlocking @ timeout");
+    g_mutex_unlock (&priv->mutex);
+  }
+
+  log_state (self, "timeout thread exiting");
+
+  return NULL;
+}
+
+static void
+export_srtp_keys (GstDtlsConnection * self)
+{
+  typedef struct
+  {
+    guint8 v[SRTP_KEY_LEN];
+  } Key;
+
+  typedef struct
+  {
+    guint8 v[SRTP_SALT_LEN];
+  } Salt;
+
+  struct
+  {
+    Key client_key;
+    Key servgst_key;
+    Salt client_salt;
+    Salt servgst_salt;
+  } exported_keys;
+
+  struct
+  {
+    Key key;
+    Salt salt;
+  } client_key, servgst_key;
+
+  SRTP_PROTECTION_PROFILE *profile;
+  GstDtlsSrtpCipher cipher;
+  GstDtlsSrtpAuth auth;
+  gint success;
+
+  static gchar export_string[] = "EXTRACTOR-dtls_srtp";
+
+  success = SSL_export_keying_material (self->priv->ssl,
+      (gpointer) & exported_keys, 60, export_string, strlen (export_string),
+      NULL, 0, 0);
+
+  if (!success) {
+    GST_WARNING_OBJECT (self, "failed to export srtp keys");
+    return;
+  }
+
+  profile = SSL_get_selected_srtp_profile (self->priv->ssl);
+
+  GST_INFO_OBJECT (self, "keys received, profile is %s", profile->name);
+
+  switch (profile->id) {
+    case SRTP_AES128_CM_SHA1_80:
+      cipher = GST_DTLS_SRTP_CIPHER_AES_128_ICM;
+      auth = GST_DTLS_SRTP_AUTH_HMAC_SHA1_80;
+      break;
+    case SRTP_AES128_CM_SHA1_32:
+      cipher = GST_DTLS_SRTP_CIPHER_AES_128_ICM;
+      auth = GST_DTLS_SRTP_AUTH_HMAC_SHA1_32;
+      break;
+    default:
+      GST_WARNING_OBJECT (self, "invalid crypto suite set by handshake");
+      goto beach;
+  }
+
+  client_key.key = exported_keys.client_key;
+  servgst_key.key = exported_keys.servgst_key;
+  client_key.salt = exported_keys.client_salt;
+  servgst_key.salt = exported_keys.servgst_salt;
+
+  if (self->priv->is_client) {
+    g_signal_emit (self, signals[SIGNAL_ON_ENCODER_KEY], 0, &client_key, cipher,
+        auth);
+    g_signal_emit (self, signals[SIGNAL_ON_DECODER_KEY], 0, &servgst_key,
+        cipher, auth);
+  } else {
+    g_signal_emit (self, signals[SIGNAL_ON_ENCODER_KEY], 0, &servgst_key,
+        cipher, auth);
+    g_signal_emit (self, signals[SIGNAL_ON_DECODER_KEY], 0, &client_key, cipher,
+        auth);
+  }
+
+beach:
+  self->priv->keys_exported = TRUE;
+}
+
+static void
+openssl_poll (GstDtlsConnection * self)
+{
+  int ret;
+  char buf[512];
+  int error;
+
+  log_state (self, "poll: before handshake");
+
+  ret = SSL_do_handshake (self->priv->ssl);
+
+  log_state (self, "poll: after handshake");
+
+  if (ret == 1) {
+    if (!self->priv->keys_exported) {
+      GST_INFO_OBJECT (self,
+          "handshake just completed successfully, exporting keys");
+      export_srtp_keys (self);
+    } else {
+      GST_INFO_OBJECT (self, "handshake is completed");
+    }
+    return;
+  } else {
+    if (ret == 0) {
+      GST_DEBUG_OBJECT (self, "do_handshake encountered EOF");
+    } else if (ret == -1) {
+      GST_WARNING_OBJECT (self, "do_handshake encountered BIO error");
+    } else {
+      GST_DEBUG_OBJECT (self, "do_handshake returned %d", ret);
+    }
+  }
+
+  error = SSL_get_error (self->priv->ssl, ret);
+
+  switch (error) {
+    case SSL_ERROR_NONE:
+      GST_WARNING_OBJECT (self, "no error, handshake should be done");
+      break;
+    case SSL_ERROR_SSL:
+      GST_LOG_OBJECT (self, "SSL error %d: %s", error,
+          ERR_error_string (ERR_get_error (), buf));
+      break;
+    case SSL_ERROR_WANT_READ:
+      GST_LOG_OBJECT (self, "SSL wants read");
+      break;
+    case SSL_ERROR_WANT_WRITE:
+      GST_LOG_OBJECT (self, "SSL wants write");
+      break;
+    case SSL_ERROR_SYSCALL:{
+      GST_LOG_OBJECT (self, "SSL syscall (error) : %lu", ERR_get_error ());
+      break;
+    }
+    default:
+      GST_WARNING_OBJECT (self, "Unknown SSL error: %d, ret: %d", error, ret);
+  }
+}
+
+static int
+openssl_verify_callback (int preverify_ok, X509_STORE_CTX * x509_ctx)
+{
+  GstDtlsConnection *self;
+  SSL *ssl;
+  BIO *bio;
+  gchar *pem = NULL;
+  gboolean accepted = FALSE;
+
+  ssl =
+      X509_STORE_CTX_get_ex_data (x509_ctx,
+      SSL_get_ex_data_X509_STORE_CTX_idx ());
+  self = SSL_get_ex_data (ssl, connection_ex_index);
+  g_return_val_if_fail (GST_IS_DTLS_CONNECTION (self), FALSE);
+
+  pem = _gst_dtls_x509_to_pem (x509_ctx->cert);
+
+  if (!pem) {
+    GST_WARNING_OBJECT (self,
+        "failed to convert received certificate to pem format");
+  } else {
+    bio = BIO_new (BIO_s_mem ());
+    if (bio) {
+      gchar buffer[2048];
+      gint len;
+
+      len =
+          X509_NAME_print_ex (bio, X509_get_subject_name (x509_ctx->cert), 1,
+          XN_FLAG_MULTILINE);
+      BIO_read (bio, buffer, len);
+      buffer[len] = '\0';
+      GST_DEBUG_OBJECT (self, "Peer certificate received:\n%s", buffer);
+      BIO_free (bio);
+    } else {
+      GST_DEBUG_OBJECT (self, "failed to create certificate print membio");
+    }
+
+    g_signal_emit (self, signals[SIGNAL_ON_PEER_CERTIFICATE], 0, pem,
+        &accepted);
+    g_free (pem);
+  }
+
+  return accepted;
+}
+
+/*
+    ########  ####  #######
+    ##     ##  ##  ##     ##
+    ##     ##  ##  ##     ##
+    ########   ##  ##     ##
+    ##     ##  ##  ##     ##
+    ##     ##  ##  ##     ##
+    ########  ####  #######
+*/
+
+static BIO_METHOD custom_bio_methods = {
+  BIO_TYPE_BIO,
+  "stream",
+  bio_method_write,
+  bio_method_read,
+  NULL,
+  NULL,
+  bio_method_ctrl,
+  bio_method_new,
+  bio_method_free,
+  NULL,
+};
+
+static BIO_METHOD *
+BIO_s_gst_dtls_connection (void)
+{
+  return &custom_bio_methods;
+}
+
+static int
+bio_method_write (BIO * bio, const char *data, int size)
+{
+  GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
+
+  GST_LOG_OBJECT (self, "BIO: writing %d", size);
+
+  if (self->priv->send_closure) {
+    GValue values[3] = { G_VALUE_INIT };
+
+    g_value_init (&values[0], GST_TYPE_DTLS_CONNECTION);
+    g_value_set_object (&values[0], self);
+
+    g_value_init (&values[1], G_TYPE_POINTER);
+    g_value_set_pointer (&values[1], (gpointer) data);
+
+    g_value_init (&values[2], G_TYPE_INT);
+    g_value_set_int (&values[2], size);
+
+    g_closure_invoke (self->priv->send_closure, NULL, 3, values, NULL);
+  }
+
+  return size;
+}
+
+static int
+bio_method_read (BIO * bio, char *out_buffer, int size)
+{
+  GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
+  GstDtlsConnectionPrivate *priv = self->priv;
+  guint internal_size;
+  gint copy_size;
+
+  internal_size = priv->bio_buffer_len - priv->bio_buffer_offset;
+
+  if (!priv->bio_buffer) {
+    GST_LOG_OBJECT (self, "BIO: EOF");
+    return 0;
+  }
+
+  if (!out_buffer || size <= 0) {
+    GST_WARNING_OBJECT (self, "BIO: read got invalid arguments");
+    if (internal_size) {
+      BIO_set_retry_read (bio);
+    }
+    return internal_size;
+  }
+
+  if (size > internal_size) {
+    copy_size = internal_size;
+  } else {
+    copy_size = size;
+  }
+
+  GST_DEBUG_OBJECT (self,
+      "reading %d/%d bytes %d at offset %d, output buff size is %d", copy_size,
+      priv->bio_buffer_len, internal_size, priv->bio_buffer_offset, size);
+
+  memcpy (out_buffer, (guint8 *) priv->bio_buffer + priv->bio_buffer_offset,
+      copy_size);
+  priv->bio_buffer_offset += copy_size;
+
+  if (priv->bio_buffer_len == priv->bio_buffer_offset) {
+    priv->bio_buffer = NULL;
+  }
+
+  return copy_size;
+}
+
+static long
+bio_method_ctrl (BIO * bio, int cmd, long arg1, void *arg2)
+{
+  GstDtlsConnection *self = GST_DTLS_CONNECTION (bio->ptr);
+  GstDtlsConnectionPrivate *priv = self->priv;
+
+  switch (cmd) {
+    case BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT:
+    case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT:
+      GST_LOG_OBJECT (self, "BIO: Timeout set");
+      priv->timeout_set = TRUE;
+      g_cond_signal (&priv->condition);
+      return 1;
+    case BIO_CTRL_RESET:
+      priv->bio_buffer = NULL;
+      priv->bio_buffer_len = 0;
+      priv->bio_buffer_offset = 0;
+      GST_LOG_OBJECT (self, "BIO: EOF reset");
+      return 1;
+    case BIO_CTRL_EOF:{
+      gint eof = !(priv->bio_buffer_len - priv->bio_buffer_offset);
+      GST_LOG_OBJECT (self, "BIO: EOF query returned %d", eof);
+      return eof;
+    }
+    case BIO_CTRL_WPENDING:
+      GST_LOG_OBJECT (self, "BIO: pending write");
+      return 1;
+    case BIO_CTRL_PENDING:{
+      gint pending = priv->bio_buffer_len - priv->bio_buffer_offset;
+      GST_LOG_OBJECT (self, "BIO: %d bytes pending", pending);
+      return pending;
+    }
+    case BIO_CTRL_FLUSH:
+      GST_LOG_OBJECT (self, "BIO: flushing");
+      return 1;
+    case BIO_CTRL_DGRAM_QUERY_MTU:
+      GST_DEBUG_OBJECT (self, "BIO: MTU query, returning 0...");
+      return 0;
+    case BIO_CTRL_DGRAM_MTU_EXCEEDED:
+      GST_WARNING_OBJECT (self, "BIO: MTU exceeded");
+      return 0;
+    default:
+      GST_LOG_OBJECT (self, "BIO: unhandled ctrl, %d", cmd);
+      return 0;
+  }
+}
+
+static int
+bio_method_new (BIO * bio)
+{
+  GST_LOG_OBJECT (NULL, "BIO: new");
+
+  bio->shutdown = 0;
+  bio->init = 1;
+
+  return 1;
+}
+
+static int
+bio_method_free (BIO * bio)
+{
+  if (!bio) {
+    GST_LOG_OBJECT (NULL, "BIO free called with null bio");
+    return 0;
+  }
+
+  GST_LOG_OBJECT (GST_DTLS_CONNECTION (bio->ptr), "BIO free");
+  return 0;
+}
diff --git a/ext/dtls/gstdtlsconnection.h b/ext/dtls/gstdtlsconnection.h
new file mode 100644
index 0000000..1f901ac
--- /dev/null
+++ b/ext/dtls/gstdtlsconnection.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlsconnection_h
+#define gstdtlsconnection_h
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_CONNECTION            (gst_dtls_connection_get_type())
+#define GST_DTLS_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_CONNECTION, GstDtlsConnection))
+#define GST_DTLS_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_CONNECTION, GstDtlsConnectionClass))
+#define GST_IS_DTLS_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_CONNECTION))
+#define GST_IS_DTLS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_CONNECTION))
+#define GST_DTLS_CONNECTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_CONNECTION, GstDtlsConnectionClass))
+
+typedef struct _GstDtlsConnection        GstDtlsConnection;
+typedef struct _GstDtlsConnectionClass   GstDtlsConnectionClass;
+typedef struct _GstDtlsConnectionPrivate GstDtlsConnectionPrivate;
+
+/**
+ * GstDtlsSrtpCipher:
+ * @GST_DTLS_SRTP_CIPHER_AES_128_ICM: aes-128-icm
+ *
+ * SRTP Cipher selected by the DTLS handshake, should match the enums in gstsrtp
+ */
+typedef enum {
+    GST_DTLS_SRTP_CIPHER_AES_128_ICM = 1
+} GstDtlsSrtpCipher;
+
+/**
+ * GstDtlsSrtpAuth:
+ * @GST_DTLS_SRTP_AUTH_HMAC_SHA1_32: hmac-sha1-32
+ * @GST_DTLS_SRTP_AUTH_HMAC_SHA1_80: hmac-sha1-80
+ *
+ * SRTP Auth selected by the DTLS handshake, should match the enums in gstsrtp
+ */
+typedef enum {
+    GST_DTLS_SRTP_AUTH_HMAC_SHA1_32 = 1,
+    GST_DTLS_SRTP_AUTH_HMAC_SHA1_80 = 2
+} GstDtlsSrtpAuth;
+
+#define GST_DTLS_SRTP_MASTER_KEY_LENGTH 30
+
+/*
+ * GstDtlsConnection:
+ *
+ * A class that handles a single DTLS connection.
+ * Any connection needs to be created with the agent property set.
+ * Once the DTLS handshake is completed, on-encoder-key and on-decoder-key will be signalled.
+ */
+struct _GstDtlsConnection {
+    GObject parent_instance;
+
+    GstDtlsConnectionPrivate *priv;
+};
+
+struct _GstDtlsConnectionClass {
+    GObjectClass parent_class;
+};
+
+GType gst_dtls_connection_get_type(void) G_GNUC_CONST;
+
+void gst_dtls_connection_start(GstDtlsConnection *, gboolean is_client);
+void gst_dtls_connection_start_timeout(GstDtlsConnection *);
+
+/*
+ * Stops the connections, it is not required to call this function.
+ */
+void gst_dtls_connection_stop(GstDtlsConnection *);
+
+/*
+ * Closes the connection, the function will block until the connection has been stopped.
+ * If stop is called some time before, close will return instantly.
+ */
+void gst_dtls_connection_close(GstDtlsConnection *);
+
+/*
+ * Sets the closure that will be called whenever data needs to be sent.
+ *
+ * The closure will get called with the following arguments:
+ * void cb(GstDtlsConnection *, gpointer data, gint length, gpointer usgst_data)
+ */
+void gst_dtls_connection_set_send_callback(GstDtlsConnection *, GClosure *);
+
+/*
+ * Processes data that has been recevied, the transformation is done in-place.
+ * Returns the length of the plaintext data that was decoded, if no data is available, 0<= will be returned.
+ */
+gint gst_dtls_connection_process(GstDtlsConnection *, gpointer ptr, gint len);
+
+/*
+ * If the DTLS handshake is completed this function will encode the given data.
+ * Returns the length of the data sent, or 0 if the DTLS handshake is not completed.
+ */
+gint gst_dtls_connection_send(GstDtlsConnection *, gpointer ptr, gint len);
+
+G_END_DECLS
+
+#endif /* gstdtlsconnection_h */
diff --git a/ext/dtls/gstdtlsdec.c b/ext/dtls/gstdtlsdec.c
new file mode 100644
index 0000000..a8aa806
--- /dev/null
+++ b/ext/dtls/gstdtlsdec.c
@@ -0,0 +1,636 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdtlsdec.h"
+
+#include "gstdtlscertificate.h"
+
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-dtls")
+    );
+
+static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS_ANY);
+
+GST_DEBUG_CATEGORY_STATIC (gst_dtls_dec_debug);
+#define GST_CAT_DEFAULT gst_dtls_dec_debug
+
+#define gst_dtls_dec_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstDtlsDec, gst_dtls_dec, GST_TYPE_ELEMENT,
+    GST_DEBUG_CATEGORY_INIT (gst_dtls_dec_debug, "dtlsdec", 0, "DTLS Decoder"));
+
+enum
+{
+  SIGNAL_ON_KEY_RECEIVED,
+  NUM_SIGNALS
+};
+
+static guint signals[NUM_SIGNALS];
+
+enum
+{
+  PROP_0,
+  PROP_CONNECTION_ID,
+  PROP_PEM,
+  PROP_PEER_PEM,
+
+  PROP_DECODER_KEY,
+  PROP_SRTP_CIPHER,
+  PROP_SRTP_AUTH,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+#define DEFAULT_CONNECTION_ID NULL
+#define DEFAULT_PEM NULL
+#define DEFAULT_PEER_PEM NULL
+
+#define DEFAULT_DECODER_KEY NULL
+#define DEFAULT_SRTP_CIPHER 0
+#define DEFAULT_SRTP_AUTH 0
+
+
+static void gst_dtls_dec_finalize (GObject *);
+static void gst_dtls_dec_dispose (GObject *);
+static void gst_dtls_dec_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+static void gst_dtls_dec_get_property (GObject *, guint prop_id, GValue *,
+    GParamSpec *);
+
+static GstStateChangeReturn gst_dtls_dec_change_state (GstElement *,
+    GstStateChange);
+static GstPad *gst_dtls_dec_request_new_pad (GstElement *, GstPadTemplate *,
+    const gchar * name, const GstCaps *);
+static void gst_dtls_dec_release_pad (GstElement *, GstPad *);
+
+static void on_key_received (GstDtlsConnection *, gpointer key, guint cipher,
+    guint auth, GstDtlsDec *);
+static gboolean on_pegst_certificate_received (GstDtlsConnection *, gchar * pem,
+    GstDtlsDec *);
+static GstFlowReturn sink_chain (GstPad *, GstObject * parent, GstBuffer *);
+
+static GstDtlsAgent *get_agent_by_pem (const gchar * pem);
+static void agent_weak_ref_notify (gchar * pem, GstDtlsAgent *);
+static void create_connection (GstDtlsDec *, gchar * id);
+static void connection_weak_ref_notify (gchar * id, GstDtlsConnection *);
+
+static void
+gst_dtls_dec_class_init (GstDtlsDecClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = (GstElementClass *) klass;
+
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_dtls_dec_finalize);
+  gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_dtls_dec_dispose);
+  gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dtls_dec_set_property);
+  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_dtls_dec_get_property);
+
+  element_class->change_state = GST_DEBUG_FUNCPTR (gst_dtls_dec_change_state);
+  element_class->request_new_pad =
+      GST_DEBUG_FUNCPTR (gst_dtls_dec_request_new_pad);
+  element_class->release_pad = GST_DEBUG_FUNCPTR (gst_dtls_dec_release_pad);
+
+  signals[SIGNAL_ON_KEY_RECEIVED] =
+      g_signal_new ("on-key-received", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+      g_cclosure_marshal_generic, G_TYPE_NONE, 0);
+
+  properties[PROP_CONNECTION_ID] =
+      g_param_spec_string ("connection-id",
+      "Connection id",
+      "Every encoder/decoder pair should have the same, unique, connection-id",
+      DEFAULT_CONNECTION_ID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_PEM] =
+      g_param_spec_string ("pem",
+      "PEM string",
+      "A string containing a X509 certificate and RSA private key in PEM format",
+      DEFAULT_PEM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_PEER_PEM] =
+      g_param_spec_string ("peer-pem",
+      "Peer PEM string",
+      "The X509 certificate received in the DTLS handshake, in PEM format",
+      DEFAULT_PEER_PEM, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_DECODER_KEY] =
+      g_param_spec_boxed ("decoder-key",
+      "Decoder key",
+      "SRTP key that should be used by the decider",
+      GST_TYPE_CAPS, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTP_CIPHER] =
+      g_param_spec_uint ("srtp-cipher",
+      "SRTP cipher",
+      "The SRTP cipher selected in the DTLS handshake. "
+      "The value will be set to an GstDtlsSrtpCipher.",
+      0, GST_DTLS_SRTP_CIPHER_AES_128_ICM, DEFAULT_SRTP_CIPHER,
+      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTP_AUTH] =
+      g_param_spec_uint ("srtp-auth",
+      "SRTP authentication",
+      "The SRTP authentication selected in the DTLS handshake. "
+      "The value will be set to an GstDtlsSrtpAuth.",
+      0, GST_DTLS_SRTP_AUTH_HMAC_SHA1_80, DEFAULT_SRTP_AUTH,
+      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_template));
+
+  gst_element_class_set_static_metadata (element_class,
+      "DTLS Decoder",
+      "Decoder/Network/DTLS",
+      "Decodes DTLS packets", "Patrik Oldsberg patrik.oldsberg@ericsson.com");
+}
+
+static void
+gst_dtls_dec_init (GstDtlsDec * self)
+{
+  GstPad *sink;
+  self->agent = get_agent_by_pem (NULL);
+  self->connection_id = NULL;
+  self->connection = NULL;
+  self->pegst_pem = NULL;
+
+  self->decodgst_key = NULL;
+  self->srtp_cipher = DEFAULT_SRTP_CIPHER;
+  self->srtp_auth = DEFAULT_SRTP_AUTH;
+
+  g_mutex_init (&self->src_mutex);
+
+  self->src = NULL;
+  sink = gst_pad_new_from_static_template (&sink_template, "sink");
+  g_return_if_fail (sink);
+
+  gst_pad_set_chain_function (sink, GST_DEBUG_FUNCPTR (sink_chain));
+
+  gst_element_add_pad (GST_ELEMENT (self), sink);
+}
+
+static void
+gst_dtls_dec_finalize (GObject * object)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (object);
+
+  if (self->decodgst_key) {
+    gst_buffer_unref (self->decodgst_key);
+    self->decodgst_key = NULL;
+  }
+
+  g_free (self->connection_id);
+  self->connection_id = NULL;
+
+  g_free (self->pegst_pem);
+  self->pegst_pem = NULL;
+
+  g_mutex_clear (&self->src_mutex);
+
+  GST_LOG_OBJECT (self, "finalized");
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_dtls_dec_dispose (GObject * object)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (object);
+
+  if (self->agent) {
+    g_object_unref (self->agent);
+    self->agent = NULL;
+  }
+
+  if (self->connection) {
+    g_object_unref (self->connection);
+    self->connection = NULL;
+  }
+}
+
+static void
+gst_dtls_dec_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (object);
+
+  switch (prop_id) {
+    case PROP_CONNECTION_ID:
+      g_free (self->connection_id);
+      self->connection_id = g_value_dup_string (value);
+      g_return_if_fail (self->agent);
+      create_connection (self, self->connection_id);
+      break;
+    case PROP_PEM:
+      if (self->agent) {
+        g_object_unref (self->agent);
+      }
+      self->agent = get_agent_by_pem (g_value_get_string (value));
+      if (self->connection_id) {
+        create_connection (self, self->connection_id);
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static void
+gst_dtls_dec_get_property (GObject * object, guint prop_id, GValue * value,
+    GParamSpec * pspec)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (object);
+
+  switch (prop_id) {
+    case PROP_CONNECTION_ID:
+      g_value_set_string (value, self->connection_id);
+      break;
+    case PROP_PEM:
+      g_value_take_string (value,
+          gst_dtls_agent_get_certificate_pem (self->agent));
+      break;
+    case PROP_PEER_PEM:
+      g_value_set_string (value, self->pegst_pem);
+      break;
+    case PROP_DECODER_KEY:
+      g_value_set_boxed (value, self->decodgst_key);
+      break;
+    case PROP_SRTP_CIPHER:
+      g_value_set_uint (value, self->srtp_cipher);
+      break;
+    case PROP_SRTP_AUTH:
+      g_value_set_uint (value, self->srtp_auth);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static GstStateChangeReturn
+gst_dtls_dec_change_state (GstElement * element, GstStateChange transition)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (element);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (self->connection) {
+        g_signal_connect_object (self->connection,
+            "on-decoder-key", G_CALLBACK (on_key_received), self, 0);
+        g_signal_connect_object (self->connection,
+            "on-peer-certificate", G_CALLBACK (on_pegst_certificate_received),
+            self, 0);
+      } else {
+        GST_WARNING_OBJECT (self,
+            "trying to change state to ready without connection id and pem");
+        return GST_STATE_CHANGE_FAILURE;
+      }
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+  return ret;
+}
+
+static GstPad *
+gst_dtls_dec_request_new_pad (GstElement * element,
+    GstPadTemplate * tmpl, const gchar * name, const GstCaps * caps)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (element);
+
+  GST_DEBUG_OBJECT (element, "requesting pad");
+
+  g_return_val_if_fail (!self->src, NULL);
+  g_return_val_if_fail (tmpl->direction == GST_PAD_SRC, NULL);
+
+  g_mutex_lock (&self->src_mutex);
+
+  self->src = gst_pad_new_from_template (tmpl, name);
+  g_return_val_if_fail (self->src, NULL);
+
+  if (caps) {
+    g_object_set (self->src, "caps", caps, NULL);
+  }
+
+  gst_pad_set_active (self->src, TRUE);
+  gst_element_add_pad (element, self->src);
+
+  g_mutex_unlock (&self->src_mutex);
+
+  return self->src;
+}
+
+static void
+gst_dtls_dec_release_pad (GstElement * element, GstPad * pad)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (element);
+
+  g_mutex_lock (&self->src_mutex);
+
+  g_return_if_fail (self->src == pad);
+  gst_element_remove_pad (element, self->src);
+  self->src = NULL;
+
+  GST_DEBUG_OBJECT (self, "releasing src pad");
+
+  g_mutex_unlock (&self->src_mutex);
+
+  GST_ELEMENT_GET_CLASS (element)->release_pad (element, pad);
+}
+
+static void
+on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
+    guint auth, GstDtlsDec * self)
+{
+  gpointer key_dup;
+  gchar *key_str;
+
+  g_return_if_fail (GST_IS_DTLS_DEC (self));
+
+  self->srtp_cipher = cipher;
+  self->srtp_auth = auth;
+
+  key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+  self->decodgst_key =
+      gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+
+  key_str = g_base64_encode (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+  GST_INFO_OBJECT (self, "received key: %s", key_str);
+  g_free (key_str);
+
+  g_signal_emit (self, signals[SIGNAL_ON_KEY_RECEIVED], 0);
+}
+
+static gboolean
+signal_pegst_certificate_received (GWeakRef * ref)
+{
+  GstDtlsDec *self;
+
+  self = g_weak_ref_get (ref);
+  g_weak_ref_clear (ref);
+  g_free (ref);
+  ref = NULL;
+
+  if (self) {
+    g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PEER_PEM]);
+    g_object_unref (self);
+    self = NULL;
+  }
+
+  return FALSE;
+}
+
+static gboolean
+on_pegst_certificate_received (GstDtlsConnection * connection, gchar * pem,
+    GstDtlsDec * self)
+{
+  GWeakRef *ref;
+
+  g_return_val_if_fail (GST_IS_DTLS_DEC (self), TRUE);
+
+  GST_DEBUG_OBJECT (self, "Received peer certificate PEM: \n%s", pem);
+
+  self->pegst_pem = g_strdup (pem);
+
+  ref = g_new (GWeakRef, 1);
+  g_weak_ref_init (ref, self);
+
+  g_idle_add ((GSourceFunc) signal_pegst_certificate_received, ref);
+
+  return TRUE;
+}
+
+static GstFlowReturn
+sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+{
+  GstDtlsDec *self = GST_DTLS_DEC (parent);
+  GstFlowReturn ret = GST_FLOW_OK;
+  GstMapInfo map_info = GST_MAP_INFO_INIT;
+  gint size;
+
+  if (!self->agent) {
+    gst_buffer_unref (buffer);
+    return GST_FLOW_OK;
+  }
+
+  GST_DEBUG_OBJECT (self, "received buffer from %s with length %zd",
+      self->connection_id, gst_buffer_get_size (buffer));
+
+  gst_buffer_map (buffer, &map_info, GST_MAP_READWRITE);
+
+  if (!map_info.size) {
+    gst_buffer_unmap (buffer, &map_info);
+    return GST_FLOW_OK;
+  }
+
+  size =
+      gst_dtls_connection_process (self->connection, map_info.data,
+      map_info.size);
+  gst_buffer_unmap (buffer, &map_info);
+
+  if (size <= 0) {
+    gst_buffer_unref (buffer);
+
+    return GST_FLOW_OK;
+  }
+
+  g_mutex_lock (&self->src_mutex);
+
+  if (self->src) {
+    gst_buffer_set_size (buffer, size);
+    GST_LOG_OBJECT (self, "decoded buffer with length %d, pushing", size);
+    ret = gst_pad_push (self->src, buffer);
+  } else {
+    GST_LOG_OBJECT (self, "dropped buffer with length %d, not linked", size);
+    gst_buffer_unref (buffer);
+  }
+
+  g_mutex_unlock (&self->src_mutex);
+
+  return ret;
+}
+
+static GHashTable *agent_table = NULL;
+G_LOCK_DEFINE_STATIC (agent_table);
+
+static GstDtlsAgent *generated_cert_agent = NULL;
+
+static GstDtlsAgent *
+get_agent_by_pem (const gchar * pem)
+{
+  GstDtlsAgent *agent;
+
+  if (!pem) {
+    if (g_once_init_enter (&generated_cert_agent)) {
+      GstDtlsAgent *new_agent;
+
+      new_agent = g_object_new (GST_TYPE_DTLS_AGENT, "certificate",
+          g_object_new (GST_TYPE_DTLS_CERTIFICATE, NULL), NULL);
+
+      GST_DEBUG_OBJECT (generated_cert_agent,
+          "no agent with generated cert found, creating new");
+      g_once_init_leave (&generated_cert_agent, new_agent);
+    } else {
+      GST_DEBUG_OBJECT (generated_cert_agent,
+          "using agent with generated cert");
+    }
+
+    agent = generated_cert_agent;
+    g_object_ref (agent);
+  } else {
+    G_LOCK (agent_table);
+
+    if (!agent_table) {
+      agent_table =
+          g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+    }
+
+    agent = GST_DTLS_AGENT (g_hash_table_lookup (agent_table, pem));
+
+    if (!agent) {
+      agent = g_object_new (GST_TYPE_DTLS_AGENT,
+          "certificate", g_object_new (GST_TYPE_DTLS_CERTIFICATE, "pem", pem,
+              NULL), NULL);
+
+      g_object_weak_ref (G_OBJECT (agent), (GWeakNotify) agent_weak_ref_notify,
+          (gpointer) g_strdup (pem));
+
+      g_hash_table_insert (agent_table, g_strdup (pem), agent);
+
+      GST_DEBUG_OBJECT (agent, "no agent found, created new");
+    } else {
+      g_object_ref (agent);
+      GST_DEBUG_OBJECT (agent, "agent found");
+    }
+
+    G_UNLOCK (agent_table);
+  }
+
+
+  return agent;
+}
+
+static void
+agent_weak_ref_notify (gchar * pem, GstDtlsAgent * agent)
+{
+  G_LOCK (agent_table);
+  g_hash_table_remove (agent_table, pem);
+  G_UNLOCK (agent_table);
+
+  g_free (pem);
+  pem = NULL;
+}
+
+static GHashTable *connection_table = NULL;
+G_LOCK_DEFINE_STATIC (connection_table);
+
+GstDtlsConnection *
+gst_dtls_dec_fetch_connection (gchar * id)
+{
+  GstDtlsConnection *connection;
+  g_return_val_if_fail (id, NULL);
+
+  GST_DEBUG ("fetching '%s' from connection table, size is %d",
+      id, g_hash_table_size (connection_table));
+
+  G_LOCK (connection_table);
+
+  connection = g_hash_table_lookup (connection_table, id);
+
+  if (connection) {
+    g_object_ref (connection);
+    g_hash_table_remove (connection_table, id);
+  } else {
+    GST_WARNING ("no connection with id '%s' found", id);
+  }
+
+  G_UNLOCK (connection_table);
+
+  return connection;
+}
+
+static void
+create_connection (GstDtlsDec * self, gchar * id)
+{
+  g_return_if_fail (GST_IS_DTLS_DEC (self));
+  g_return_if_fail (GST_IS_DTLS_AGENT (self->agent));
+
+  if (self->connection) {
+    g_object_unref (self->connection);
+    self->connection = NULL;
+  }
+
+  G_LOCK (connection_table);
+
+  if (!connection_table) {
+    connection_table =
+        g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+  }
+
+  if (g_hash_table_contains (connection_table, id)) {
+    G_UNLOCK (connection_table);
+
+    g_return_if_reached ();
+  }
+
+  self->connection =
+      g_object_new (GST_TYPE_DTLS_CONNECTION, "agent", self->agent, NULL);
+
+  g_object_weak_ref (G_OBJECT (self->connection),
+      (GWeakNotify) connection_weak_ref_notify, g_strdup (id));
+
+  g_hash_table_insert (connection_table, g_strdup (id), self->connection);
+
+  G_UNLOCK (connection_table);
+}
+
+static void
+connection_weak_ref_notify (gchar * id, GstDtlsConnection * connection)
+{
+  G_LOCK (connection_table);
+  g_hash_table_remove (connection_table, id);
+  G_UNLOCK (connection_table);
+
+  g_free (id);
+  id = NULL;
+}
diff --git a/ext/dtls/gstdtlsdec.h b/ext/dtls/gstdtlsdec.h
new file mode 100644
index 0000000..2c5fc4a
--- /dev/null
+++ b/ext/dtls/gstdtlsdec.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlsdec_h
+#define gstdtlsdec_h
+
+#include "gstdtlsagent.h"
+#include "gstdtlsconnection.h"
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_DEC \
+    (gst_dtls_dec_get_type())
+#define GST_DTLS_DEC(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_DEC, GstDtlsDec))
+#define GST_DTLS_DEC_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_DEC, GstDtlsDecClass))
+#define GST_IS_DTLS_DEC(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_DEC))
+#define GST_IS_DTLS_DEC_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_DEC))
+
+typedef struct _GstDtlsDec GstDtlsDec;
+typedef struct _GstDtlsDecClass GstDtlsDecClass;
+
+struct _GstDtlsDec {
+    GstElement element;
+
+    GstPad *src;
+    GMutex src_mutex;
+
+    GstDtlsAgent *agent;
+    GstDtlsConnection *connection;
+    GMutex connection_mutex;
+    gchar *connection_id;
+    gchar *pegst_pem;
+
+    GstBuffer *decodgst_key;
+    guint srtp_cipher;
+    guint srtp_auth;
+};
+
+struct _GstDtlsDecClass {
+    GstElementClass parent_class;
+};
+
+GType gst_dtls_dec_get_type(void);
+
+gboolean gst_dtls_dec_plugin_init(GstPlugin *);
+
+GstDtlsConnection *gst_dtls_dec_fetch_connection(gchar *id);
+
+G_END_DECLS
+
+#endif /* gstdtlsdec_h */
diff --git a/ext/dtls/gstdtlsenc.c b/ext/dtls/gstdtlsenc.c
new file mode 100644
index 0000000..ff4b4d2
--- /dev/null
+++ b/ext/dtls/gstdtlsenc.c
@@ -0,0 +1,546 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdtlsenc.h"
+
+#include "gstdtlsdec.h"
+
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-dtls")
+    );
+
+GST_DEBUG_CATEGORY_STATIC (gst_dtls_enc_debug);
+#define GST_CAT_DEFAULT gst_dtls_enc_debug
+
+#define gst_dtls_enc_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstDtlsEnc, gst_dtls_enc, GST_TYPE_ELEMENT,
+    GST_DEBUG_CATEGORY_INIT (gst_dtls_enc_debug, "dtlsenc", 0, "DTLS Encoder"));
+
+enum
+{
+  SIGNAL_ON_KEY_RECEIVED,
+  NUM_SIGNALS
+};
+
+static guint signals[NUM_SIGNALS];
+
+enum
+{
+  PROP_0,
+  PROP_CONNECTION_ID,
+  PROP_IS_CLIENT,
+
+  PROP_ENCODER_KEY,
+  PROP_SRTP_CIPHER,
+  PROP_SRTP_AUTH,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+#define DEFAULT_CONNECTION_ID NULL
+#define DEFAULT_IS_CLIENT FALSE
+
+#define DEFAULT_ENCODER_KEY NULL
+#define DEFAULT_SRTP_CIPHER 0
+#define DEFAULT_SRTP_AUTH 0
+
+#define INITIAL_QUEUE_SIZE 64
+
+static void gst_dtls_enc_finalize (GObject *);
+static void gst_dtls_enc_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+static void gst_dtls_enc_get_property (GObject *, guint prop_id, GValue *,
+    GParamSpec *);
+
+static GstStateChangeReturn gst_dtls_enc_change_state (GstElement *,
+    GstStateChange);
+static GstPad *gst_dtls_enc_request_new_pad (GstElement *, GstPadTemplate *,
+    const gchar * name, const GstCaps *);
+
+static gboolean src_activate_mode (GstPad *, GstObject *, GstPadMode,
+    gboolean active);
+static void src_task_loop (GstPad *);
+
+static GstFlowReturn sink_chain (GstPad *, GstObject *, GstBuffer *);
+
+static void on_key_received (GstDtlsConnection *, gpointer key, guint cipher,
+    guint auth, GstDtlsEnc *);
+static void on_send_data (GstDtlsConnection *, gconstpointer data, gint length,
+    GstDtlsEnc *);
+
+static void
+gst_dtls_enc_class_init (GstDtlsEncClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = (GstElementClass *) klass;
+
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_dtls_enc_finalize);
+  gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dtls_enc_set_property);
+  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_dtls_enc_get_property);
+
+  element_class->change_state = GST_DEBUG_FUNCPTR (gst_dtls_enc_change_state);
+  element_class->request_new_pad =
+      GST_DEBUG_FUNCPTR (gst_dtls_enc_request_new_pad);
+
+  signals[SIGNAL_ON_KEY_RECEIVED] =
+      g_signal_new ("on-key-received", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+      g_cclosure_marshal_generic, G_TYPE_NONE, 0);
+
+  properties[PROP_CONNECTION_ID] =
+      g_param_spec_string ("connection-id",
+      "Connection id",
+      "Every encoder/decoder pair should have the same, unique, connection-id",
+      DEFAULT_CONNECTION_ID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_IS_CLIENT] =
+      g_param_spec_boolean ("is-client",
+      "Is client",
+      "Set to true if the decoder should act as"
+      "client and initiate the handshake",
+      DEFAULT_IS_CLIENT,
+      GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_ENCODER_KEY] =
+      g_param_spec_boxed ("encoder-key",
+      "Encoder key",
+      "Master key that should be used by the SRTP encoder",
+      GST_TYPE_BUFFER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTP_CIPHER] =
+      g_param_spec_uint ("srtp-cipher",
+      "SRTP cipher",
+      "The SRTP cipher selected in the DTLS handshake. "
+      "The value will be set to an GstDtlsSrtpCipher.",
+      0, GST_DTLS_SRTP_CIPHER_AES_128_ICM, DEFAULT_SRTP_CIPHER,
+      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTP_AUTH] =
+      g_param_spec_uint ("srtp-auth",
+      "SRTP authentication",
+      "The SRTP authentication selected in the DTLS handshake. "
+      "The value will be set to an GstDtlsSrtpAuth.",
+      0, GST_DTLS_SRTP_AUTH_HMAC_SHA1_80, DEFAULT_SRTP_AUTH,
+      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_template));
+
+  gst_element_class_set_static_metadata (element_class,
+      "DTLS Encoder",
+      "Encoder/Network/DTLS",
+      "Encodes packets with DTLS",
+      "Patrik Oldsberg patrik.oldsberg@ericsson.com");
+}
+
+static void
+gst_dtls_enc_init (GstDtlsEnc * self)
+{
+  self->connection_id = NULL;
+  self->connection = NULL;
+
+  self->is_client = DEFAULT_IS_CLIENT;
+
+  self->encodgst_key = NULL;
+  self->srtp_cipher = DEFAULT_SRTP_CIPHER;
+  self->srtp_auth = DEFAULT_SRTP_AUTH;
+
+  self->queue = g_ptr_array_sized_new (INITIAL_QUEUE_SIZE);
+
+  g_mutex_init (&self->queue_lock);
+  g_cond_init (&self->queue_cond_add);
+
+  self->src = gst_pad_new_from_static_template (&src_template, "src");
+  g_return_if_fail (self->src);
+
+  gst_pad_set_activatemode_function (self->src,
+      GST_DEBUG_FUNCPTR (src_activate_mode));
+
+  gst_element_add_pad (GST_ELEMENT (self), self->src);
+}
+
+static void
+gst_dtls_enc_finalize (GObject * object)
+{
+  GstDtlsEnc *self = GST_DTLS_ENC (object);
+
+  if (self->encodgst_key) {
+    gst_buffer_unref (self->encodgst_key);
+    self->encodgst_key = NULL;
+  }
+
+  g_mutex_lock (&self->queue_lock);
+
+  g_ptr_array_set_free_func (self->queue, (GDestroyNotify) gst_buffer_unref);
+  g_ptr_array_unref (self->queue);
+  self->queue = NULL;
+
+  g_mutex_unlock (&self->queue_lock);
+
+  g_mutex_clear (&self->queue_lock);
+  g_cond_clear (&self->queue_cond_add);
+
+  GST_LOG_OBJECT (self, "finalized");
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_dtls_enc_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsEnc *self = GST_DTLS_ENC (object);
+
+  switch (prop_id) {
+    case PROP_CONNECTION_ID:
+      self->connection_id = g_value_dup_string (value);
+      break;
+    case PROP_IS_CLIENT:
+      self->is_client = g_value_get_boolean (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static void
+gst_dtls_enc_get_property (GObject * object, guint prop_id, GValue * value,
+    GParamSpec * pspec)
+{
+  GstDtlsEnc *self = GST_DTLS_ENC (object);
+
+  switch (prop_id) {
+    case PROP_CONNECTION_ID:
+      g_value_set_string (value, self->connection_id);
+      break;
+    case PROP_IS_CLIENT:
+      g_value_set_boolean (value, self->is_client);
+      break;
+    case PROP_ENCODER_KEY:
+      g_value_set_boxed (value, self->encodgst_key);
+      break;
+    case PROP_SRTP_CIPHER:
+      g_value_set_uint (value, self->srtp_cipher);
+      break;
+    case PROP_SRTP_AUTH:
+      g_value_set_uint (value, self->srtp_auth);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static GstStateChangeReturn
+gst_dtls_enc_change_state (GstElement * element, GstStateChange transition)
+{
+  GstDtlsEnc *self = GST_DTLS_ENC (element);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (self->connection_id) {
+        self->connection = gst_dtls_dec_fetch_connection (self->connection_id);
+
+        if (!self->connection) {
+          GST_WARNING_OBJECT (self,
+              "invalid connection id: '%s', connection not found or already in use",
+              self->connection_id);
+          return GST_STATE_CHANGE_FAILURE;
+        }
+
+        g_signal_connect_object (self->connection,
+            "on-encoder-key", G_CALLBACK (on_key_received), self, 0);
+
+        gst_dtls_connection_set_send_callback (self->connection,
+            g_cclosure_new (G_CALLBACK (on_send_data), self, NULL));
+      } else {
+        GST_WARNING_OBJECT (self,
+            "trying to change state to ready without connection id");
+        return GST_STATE_CHANGE_FAILURE;
+      }
+      break;
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      GST_DEBUG_OBJECT (self, "starting connection %s", self->connection_id);
+      gst_dtls_connection_start (self->connection, self->is_client);
+
+      gst_pad_set_active (self->src, TRUE);
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      GST_DEBUG_OBJECT (self, "stopping connection %s", self->connection_id);
+      gst_pad_set_active (self->src, FALSE);
+
+      gst_dtls_connection_stop (self->connection);
+      break;
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      GST_DEBUG_OBJECT (self, "closing connection %s", self->connection_id);
+
+      if (self->connection) {
+        gst_dtls_connection_close (self->connection);
+        gst_dtls_connection_set_send_callback (self->connection, NULL);
+        g_object_unref (self->connection);
+        self->connection = NULL;
+      }
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+  return ret;
+}
+
+static GstPad *
+gst_dtls_enc_request_new_pad (GstElement * element,
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
+{
+  GstPad *sink;
+  gboolean ret;
+
+  GST_DEBUG_OBJECT (element, "sink pad requested");
+
+  g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL);
+
+  sink = gst_pad_new_from_template (templ, name);
+  g_return_val_if_fail (sink, NULL);
+
+  if (caps) {
+    g_object_set (sink, "caps", caps, NULL);
+  }
+
+  gst_pad_set_chain_function (sink, GST_DEBUG_FUNCPTR (sink_chain));
+
+  ret = gst_pad_set_active (sink, TRUE);
+  g_warn_if_fail (ret);
+
+  gst_element_add_pad (element, sink);
+
+  return sink;
+}
+
+static gboolean
+src_activate_mode (GstPad * pad, GstObject * parent, GstPadMode mode,
+    gboolean active)
+{
+  GstDtlsEnc *self = GST_DTLS_ENC (parent);
+  gboolean success = TRUE;
+  g_return_val_if_fail (mode == GST_PAD_MODE_PUSH, FALSE);
+
+  if (active) {
+    GST_DEBUG_OBJECT (self, "src pad activating in push mode");
+
+    self->send_initial_events = TRUE;
+    success =
+        gst_pad_start_task (pad, (GstTaskFunction) src_task_loop, self->src,
+        NULL);
+    if (!success) {
+      GST_WARNING_OBJECT (self, "failed to activate pad task");
+    }
+  } else {
+    GST_DEBUG_OBJECT (self, "deactivating src pad");
+
+    g_mutex_lock (&self->queue_lock);
+    GST_PAD_MODE (pad) = GST_PAD_MODE_NONE;
+    g_cond_signal (&self->queue_cond_add);
+    g_mutex_unlock (&self->queue_lock);
+    success = gst_pad_stop_task (pad);
+    if (!success) {
+      GST_WARNING_OBJECT (self, "failed to deactivate pad task");
+    }
+  }
+
+  return success;
+}
+
+static void
+src_task_loop (GstPad * pad)
+{
+  GstDtlsEnc *self = GST_DTLS_ENC (GST_PAD_PARENT (pad));
+  GstFlowReturn ret;
+  GstPad *peer;
+  gboolean pegst_is_active;
+
+  GST_TRACE_OBJECT (self, "src loop: acquiring lock");
+  g_mutex_lock (&self->queue_lock);
+  GST_TRACE_OBJECT (self, "src loop: acquired lock");
+
+  if (!gst_pad_is_active (pad)) {
+    GST_LOG_OBJECT (self, "src task loop entered on inactive pad");
+    GST_TRACE_OBJECT (self, "src loop: releasing lock");
+    g_mutex_unlock (&self->queue_lock);
+    return;
+  }
+
+  while (!self->queue->len) {
+    GST_TRACE_OBJECT (self, "src loop: queue empty, waiting for add");
+    g_cond_wait (&self->queue_cond_add, &self->queue_lock);
+    GST_TRACE_OBJECT (self, "src loop: add signaled");
+
+    if (!gst_pad_is_active (pad)) {
+      GST_LOG_OBJECT (self, "pad inactive, task returning");
+      GST_TRACE_OBJECT (self, "src loop: releasing lock");
+      g_mutex_unlock (&self->queue_lock);
+      return;
+    }
+  }
+  GST_TRACE_OBJECT (self, "src loop: queue has element");
+
+  peer = gst_pad_get_peer (pad);
+  pegst_is_active = gst_pad_is_active (peer);
+  gst_object_unref (peer);
+
+  if (pegst_is_active) {
+    GstBuffer *buffer;
+    gboolean start_connection_timeout = FALSE;
+
+    if (self->send_initial_events) {
+      GstSegment segment;
+      gchar s_id[32];
+      GstCaps *caps;
+
+      g_snprintf (s_id, sizeof (s_id), "dtlsenc-%08x", g_random_int ());
+      gst_pad_push_event (self->src, gst_event_new_stream_start (s_id));
+      caps = gst_caps_new_empty_simple ("application/x-dtls");
+      gst_pad_push_event (self->src, gst_event_new_caps (caps));
+      gst_caps_unref (caps);
+      gst_segment_init (&segment, GST_FORMAT_BYTES);
+      gst_pad_push_event (self->src, gst_event_new_segment (&segment));
+      self->send_initial_events = FALSE;
+      start_connection_timeout = TRUE;
+    }
+
+    buffer = g_ptr_array_remove_index (self->queue, 0);
+
+    GST_TRACE_OBJECT (self, "src loop: releasing lock");
+    g_mutex_unlock (&self->queue_lock);
+
+    ret = gst_pad_push (self->src, buffer);
+    if (start_connection_timeout)
+      gst_dtls_connection_start_timeout (self->connection);
+
+    if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+      GST_WARNING_OBJECT (self, "failed to push buffer on src pad: %s",
+          gst_flow_get_name (ret));
+    }
+  } else {
+    g_warn_if_reached ();
+    GST_TRACE_OBJECT (self, "src loop: releasing lock");
+    g_mutex_unlock (&self->queue_lock);
+  }
+}
+
+static GstFlowReturn
+sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+{
+  GstDtlsEnc *self = GST_DTLS_ENC (parent);
+  GstMapInfo map_info;
+  gint ret;
+
+  gst_buffer_map (buffer, &map_info, GST_MAP_READ);
+
+  if (map_info.size) {
+    ret =
+        gst_dtls_connection_send (self->connection, map_info.data,
+        map_info.size);
+    if (ret != map_info.size) {
+      GST_WARNING_OBJECT (self,
+          "error sending data: %d B were written, expected value was %zd B",
+          ret, map_info.size);
+    }
+  }
+
+  gst_buffer_unmap (buffer, &map_info);
+
+  gst_buffer_unref (buffer);
+
+  return GST_FLOW_OK;
+}
+
+static void
+on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
+    guint auth, GstDtlsEnc * self)
+{
+  gpointer key_dup;
+  gchar *key_str;
+
+  g_return_if_fail (GST_IS_DTLS_ENC (self));
+  g_return_if_fail (GST_IS_DTLS_CONNECTION (connection));
+
+  self->srtp_cipher = cipher;
+  self->srtp_auth = auth;
+
+  key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+  self->encodgst_key =
+      gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+
+  key_str = g_base64_encode (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+  GST_INFO_OBJECT (self, "received key: %s", key_str);
+  g_free (key_str);
+
+  g_signal_emit (self, signals[SIGNAL_ON_KEY_RECEIVED], 0);
+}
+
+static void
+on_send_data (GstDtlsConnection * connection, gconstpointer data, gint length,
+    GstDtlsEnc * self)
+{
+  GstBuffer *buffer;
+
+  GST_DEBUG_OBJECT (self, "sending data from %s with length %d",
+      self->connection_id, length);
+
+  buffer = gst_buffer_new_wrapped (g_memdup (data, length), length);
+
+  GST_TRACE_OBJECT (self, "send data: acquiring lock");
+  g_mutex_lock (&self->queue_lock);
+  GST_TRACE_OBJECT (self, "send data: acquired lock");
+
+  g_ptr_array_add (self->queue, buffer);
+
+  GST_TRACE_OBJECT (self, "send data: signaling add");
+  g_cond_signal (&self->queue_cond_add);
+
+  GST_TRACE_OBJECT (self, "send data: releasing lock");
+  g_mutex_unlock (&self->queue_lock);
+}
diff --git a/ext/dtls/gstdtlsenc.h b/ext/dtls/gstdtlsenc.h
new file mode 100644
index 0000000..6dc6bbd
--- /dev/null
+++ b/ext/dtls/gstdtlsenc.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlsenc_h
+#define gstdtlsenc_h
+
+#include "gstdtlsagent.h"
+#include "gstdtlsconnection.h"
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_ENC (gst_dtls_enc_get_type())
+#define GST_DTLS_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_ENC, GstDtlsEnc))
+#define GST_DTLS_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_ENC, GstDtlsEncClass))
+#define GST_IS_DTLS_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_ENC))
+#define GST_IS_DTLS_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_ENC))
+
+typedef struct _GstDtlsEnc GstDtlsEnc;
+typedef struct _GstDtlsEncClass GstDtlsEncClass;
+
+struct _GstDtlsEnc {
+    GstElement element;
+
+    GstPad *src;
+
+    GPtrArray *queue;
+    GMutex queue_lock;
+    GCond queue_cond_add;
+
+    GstDtlsConnection *connection;
+    gchar *connection_id;
+
+    gboolean is_client;
+
+    GstBuffer *encodgst_key;
+    guint srtp_cipher;
+    guint srtp_auth;
+
+    gboolean send_initial_events;
+};
+
+struct _GstDtlsEncClass {
+    GstElementClass parent_class;
+};
+
+GType gst_dtls_enc_get_type(void);
+
+gboolean gst_dtls_enc_plugin_init(GstPlugin *);
+
+G_END_DECLS
+
+#endif /* gstdtlsenc_h */
diff --git a/ext/dtls/gstdtlssrtpbin.c b/ext/dtls/gstdtlssrtpbin.c
new file mode 100644
index 0000000..a4104ff
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpbin.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdtlssrtpbin.h"
+
+#define gst_dtls_srtp_bin_parent_class parent_class
+G_DEFINE_ABSTRACT_TYPE (GstDtlsSrtpBin, gst_dtls_srtp_bin, GST_TYPE_BIN);
+
+enum
+{
+  PROP_0,
+  PROP_CONNECTION_ID,
+  PROP_KEY,
+  PROP_SRTP_AUTH,
+  PROP_SRTP_CIPHER,
+  PROP_SRTCP_AUTH,
+  PROP_SRTCP_CIPHER,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+#define DEFAULT_CONNECTION_ID NULL
+#define DEFAULT_KEY NULL
+#define DEFAULT_SRTP_AUTH NULL
+#define DEFAULT_SRTP_CIPHER NULL
+#define DEFAULT_SRTCP_AUTH NULL
+#define DEFAULT_SRTCP_CIPHER NULL
+
+static void gst_dtls_srtp_bin_finalize (GObject *);
+static void gst_dtls_srtp_bin_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+static void gst_dtls_srtp_bin_get_property (GObject *, guint prop_id,
+    GValue *, GParamSpec *);
+
+static void
+gst_dtls_srtp_bin_class_init (GstDtlsSrtpBinClass * klass)
+{
+  GObjectClass *gobject_class;
+
+  gobject_class = (GObjectClass *) klass;
+
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_dtls_srtp_bin_finalize);
+  gobject_class->set_property =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_bin_set_property);
+  gobject_class->get_property =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_bin_get_property);
+
+  klass->remove_dtls_element = NULL;
+
+  properties[PROP_CONNECTION_ID] =
+      g_param_spec_string ("connection-id",
+      "Connection id",
+      "Every encoder/decoder pair should have the same, unique, connection-id",
+      DEFAULT_CONNECTION_ID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_KEY] =
+      g_param_spec_boxed ("key",
+      "Key",
+      "SRTP master key, if this property is set, DTLS will be disabled",
+      GST_TYPE_BUFFER,
+      G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTP_CIPHER] =
+      g_param_spec_string ("srtp-cipher",
+      "SRTP Cipher",
+      "SRTP cipher name, should be 'null' or 'aes-128-icm', "
+      "if this property is set, DTLS will be disabled",
+      DEFAULT_SRTP_CIPHER,
+      G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTCP_CIPHER] =
+      g_param_spec_string ("srtcp-cipher",
+      "SRTCP Cipher",
+      "SRTCP cipher name, should be 'null' or 'aes-128-icm', "
+      "if this property is set, DTLS will be disabled",
+      DEFAULT_SRTCP_CIPHER,
+      G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTP_AUTH] =
+      g_param_spec_string ("srtp-auth",
+      "SRTP Auth",
+      "SRTP auth name, should be 'null', 'hmac-sha1-32' or 'hmac-sha1-80', "
+      "if this property is set, DTLS will be disabled",
+      DEFAULT_SRTP_AUTH,
+      G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_SRTCP_AUTH] =
+      g_param_spec_string ("srtcp-auth",
+      "SRTCP Auth",
+      "SRTCP auth name, should be 'null', 'hmac-sha1-32' or 'hmac-sha1-80', "
+      "if this property is set, DTLS will be disabled",
+      DEFAULT_SRTCP_AUTH,
+      G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+}
+
+static void
+gst_dtls_srtp_bin_init (GstDtlsSrtpBin * self)
+{
+  self->key = NULL;
+  self->key_is_set = FALSE;
+  self->srtp_auth = NULL;
+  self->srtp_cipher = NULL;
+  self->srtcp_auth = NULL;
+  self->srtcp_cipher = NULL;
+}
+
+static void
+gst_dtls_srtp_bin_finalize (GObject * object)
+{
+  GstDtlsSrtpBin *self = GST_DTLS_SRTP_BIN (object);
+
+  if (self->key) {
+    gst_buffer_unref (self->key);
+    self->key = NULL;
+  }
+  g_free (self->srtp_auth);
+  self->srtp_auth = NULL;
+  g_free (self->srtp_cipher);
+  self->srtp_cipher = NULL;
+  g_free (self->srtcp_auth);
+  self->srtcp_auth = NULL;
+  g_free (self->srtcp_cipher);
+  self->srtcp_cipher = NULL;
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_dtls_srtp_bin_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsSrtpBin *self = GST_DTLS_SRTP_BIN (object);
+  GstDtlsSrtpBinClass *klass = GST_DTLS_SRTP_BIN_GET_CLASS (self);
+
+  switch (prop_id) {
+    case PROP_CONNECTION_ID:
+      if (self->dtls_element) {
+        g_object_set_property (G_OBJECT (self->dtls_element), "connection-id",
+            value);
+      } else {
+        g_warning ("tried to set connection-id after disabling DTLS");
+      }
+      break;
+    case PROP_KEY:
+      if (self->key) {
+        gst_buffer_unref (self->key);
+      }
+      self->key = g_value_dup_boxed (value);
+      self->key_is_set = TRUE;
+      klass->remove_dtls_element (self);
+      break;
+    case PROP_SRTP_AUTH:
+      g_free (self->srtp_auth);
+      self->srtp_auth = g_value_dup_string (value);
+      klass->remove_dtls_element (self);
+      break;
+    case PROP_SRTP_CIPHER:
+      g_free (self->srtp_cipher);
+      self->srtp_cipher = g_value_dup_string (value);
+      klass->remove_dtls_element (self);
+      break;
+    case PROP_SRTCP_AUTH:
+      g_free (self->srtcp_auth);
+      self->srtcp_auth = g_value_dup_string (value);
+      klass->remove_dtls_element (self);
+      break;
+    case PROP_SRTCP_CIPHER:
+      g_free (self->srtcp_cipher);
+      self->srtcp_cipher = g_value_dup_string (value);
+      klass->remove_dtls_element (self);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static void
+gst_dtls_srtp_bin_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec)
+{
+  GstDtlsSrtpBin *self = GST_DTLS_SRTP_BIN (object);
+
+  switch (prop_id) {
+    case PROP_CONNECTION_ID:
+      if (self->dtls_element) {
+        g_object_get_property (G_OBJECT (self->dtls_element), "connection-id",
+            value);
+      } else {
+        g_warning ("tried to get connection-id after disabling DTLS");
+      }
+      break;
+    case PROP_KEY:
+      if (self->key) {
+        g_value_set_boxed (value, self->key);
+      }
+      break;
+    case PROP_SRTP_AUTH:
+      g_value_set_string (value, self->srtp_auth);
+      break;
+    case PROP_SRTP_CIPHER:
+      g_value_set_string (value, self->srtp_cipher);
+      break;
+    case PROP_SRTCP_AUTH:
+      g_value_set_string (value, self->srtcp_auth);
+      break;
+    case PROP_SRTCP_CIPHER:
+      g_value_set_string (value, self->srtcp_cipher);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
diff --git a/ext/dtls/gstdtlssrtpbin.h b/ext/dtls/gstdtlssrtpbin.h
new file mode 100644
index 0000000..2922241
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpbin.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlssrtpbin_h
+#define gstdtlssrtpbin_h
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_SRTP_BIN (gst_dtls_srtp_bin_get_type())
+#define GST_DTLS_SRTP_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_BIN, GstDtlsSrtpBin))
+#define GST_DTLS_SRTP_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_BIN, GstDtlsSrtpBinClass))
+#define GST_DTLS_SRTP_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_SRTP_BIN, GstDtlsSrtpBinClass))
+#define GST_IS_DTLS_SRTP_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_BIN))
+#define GST_IS_DTLS_SRTP_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_BIN))
+
+typedef struct _GstDtlsSrtpBin GstDtlsSrtpBin;
+typedef struct _GstDtlsSrtpBinClass GstDtlsSrtpBinClass;
+
+struct _GstDtlsSrtpBin {
+    GstBin bin;
+
+    GstElement *dtls_element;
+
+    gboolean key_is_set;
+    GstBuffer *key;
+    gchar *srtp_cipher;
+    gchar *srtp_auth;
+    gchar *srtcp_cipher;
+    gchar *srtcp_auth;
+};
+
+struct _GstDtlsSrtpBinClass {
+    GstBinClass parent_class;
+
+    void (*remove_dtls_element)(GstDtlsSrtpBin *);
+};
+
+GType gst_dtls_srtp_bin_get_type(void);
+
+G_END_DECLS
+
+#endif /* gstdtlssrtpbin_h */
diff --git a/ext/dtls/gstdtlssrtpdec.c b/ext/dtls/gstdtlssrtpdec.c
new file mode 100644
index 0000000..347fefd
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpdec.c
@@ -0,0 +1,474 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdtlssrtpdec.h"
+
+#include "gstdtlsconnection.h"
+
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate rtp_src_template =
+    GST_STATIC_PAD_TEMPLATE ("rtp_src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp;application/x-rtcp")
+    );
+
+static GstStaticPadTemplate data_src_template =
+GST_STATIC_PAD_TEMPLATE ("data_src",
+    GST_PAD_SRC,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS_ANY);
+
+GST_DEBUG_CATEGORY_STATIC (gst_dtls_srtp_dec_debug);
+#define GST_CAT_DEFAULT gst_dtls_srtp_dec_debug
+
+#define gst_dtls_srtp_dec_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpDec, gst_dtls_srtp_dec,
+    GST_TYPE_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (gst_dtls_srtp_dec_debug,
+        "dtlssrtpdec", 0, "DTLS Decoder"));
+
+enum
+{
+  PROP_0,
+  PROP_PEM,
+  PROP_PEER_PEM,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+#define DEFAULT_PEM NULL
+#define DEFAULT_PEER_PEM NULL
+
+static void gst_dtls_srtp_dec_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+static void gst_dtls_srtp_dec_get_property (GObject *, guint prop_id,
+    GValue *, GParamSpec *);
+
+static GstPad *gst_dtls_srtp_dec_request_new_pad (GstElement *,
+    GstPadTemplate *, const gchar * name, const GstCaps *);
+static GstCaps *on_decodgst_request_key (GstElement * srtp_decoder, guint ssrc,
+    GstDtlsSrtpBin *);
+static void on_pegst_pem (GstElement * srtp_decoder, GParamSpec * pspec,
+    GstDtlsSrtpDec * self);
+
+static void gst_dtls_srtp_dec_remove_dtls_element (GstDtlsSrtpBin *);
+static GstPadProbeReturn remove_dtls_decodgst_probe_callback (GstPad *,
+    GstPadProbeInfo *, GstElement *);
+
+static GstPadProbeReturn drop_funnel_rtcp_caps (GstPad *, GstPadProbeInfo *,
+    gpointer);
+
+static void
+gst_dtls_srtp_dec_class_init (GstDtlsSrtpDecClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+  GstDtlsSrtpBinClass *dtls_srtp_bin_class;
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = (GstElementClass *) klass;
+  dtls_srtp_bin_class = (GstDtlsSrtpBinClass *) klass;
+
+  gobject_class->set_property =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_set_property);
+  gobject_class->get_property =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_get_property);
+
+  element_class->request_new_pad =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_request_new_pad);
+
+  dtls_srtp_bin_class->remove_dtls_element =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_dec_remove_dtls_element);
+
+  properties[PROP_PEM] =
+      g_param_spec_string ("pem",
+      "PEM string",
+      "A string containing a X509 certificate and RSA private key in PEM format",
+      DEFAULT_PEM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  properties[PROP_PEER_PEM] =
+      g_param_spec_string ("peer-pem",
+      "Peer PEM string",
+      "The X509 certificate received in the DTLS handshake, in PEM format",
+      DEFAULT_PEER_PEM, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+
+  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 (&rtp_src_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&data_src_template));
+
+  gst_element_class_set_static_metadata (element_class,
+      "DTLS-SRTP Decoder",
+      "Decoder/Network/DTLS/SRTP",
+      "Decodes SRTP packets with a key received from DTLS",
+      "Patrik Oldsberg patrik.oldsberg@ericsson.com");
+}
+
+static void
+gst_dtls_srtp_dec_init (GstDtlsSrtpDec * self)
+{
+  GstElementClass *klass = GST_ELEMENT_GET_CLASS (GST_ELEMENT (self));
+  GstPadTemplate *templ;
+  GstPad *target_pad, *ghost_pad, *pad;
+  gboolean ret;
+
+/*
+                                 +--------------------+
+            +--------------+  .-o|       dtlsdec      |o-R----------data
+            |          dtls|o-'  +--------------------+
+    sink---o|  dtlsdemux   |
+            |       srt(c)p|o-.  +-----------+     +-----------+
+            +--------------+  '-o|srtp    rtp|o---o|rtp        |
+                                 |  srtpdec  |     |   funnel  |o---rt(c)p
+                                o|srtcp  rtcp|o---o|rtcp       |
+                                 +-----------+     +-----------+
+*/
+
+  self->srtp_dec = gst_element_factory_make ("srtpdec", "srtp-decoder");
+  if (!self->srtp_dec) {
+    GST_ERROR_OBJECT (self,
+        "failed to create srtp_dec, is the srtp plugin registered?");
+    return;
+  }
+  self->dtls_srtp_demux =
+      gst_element_factory_make ("dtlssrtpdemux", "dtls-srtp-demux");
+  if (!self->dtls_srtp_demux) {
+    GST_ERROR_OBJECT (self, "failed to create dtls_srtp_demux");
+    return;
+  }
+  self->bin.dtls_element = gst_element_factory_make ("dtlsdec", "dtls-decoder");
+  if (!self->bin.dtls_element) {
+    GST_ERROR_OBJECT (self, "failed to create dtls_dec");
+    return;
+  }
+  self->funnel = gst_element_factory_make ("funnel", "funnel");
+  if (!self->funnel) {
+    GST_ERROR_OBJECT (self, "failed to create funnel");
+    return;
+  }
+
+  gst_bin_add_many (GST_BIN (self),
+      self->dtls_srtp_demux,
+      self->bin.dtls_element, self->srtp_dec, self->funnel, NULL);
+
+  ret =
+      gst_element_link_pads (self->dtls_srtp_demux, "dtls_src",
+      self->bin.dtls_element, NULL);
+  g_return_if_fail (ret);
+  ret =
+      gst_element_link_pads (self->dtls_srtp_demux, "rtp_src", self->srtp_dec,
+      "rtp_sink");
+  g_return_if_fail (ret);
+  ret =
+      gst_element_link_pads (self->srtp_dec, "rtp_src", self->funnel, "sink_0");
+  g_return_if_fail (ret);
+  ret =
+      gst_element_link_pads (self->srtp_dec, "rtcp_src", self->funnel,
+      "sink_1");
+  g_return_if_fail (ret);
+
+  pad = gst_element_get_static_pad (self->funnel, "sink_1");
+  gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
+      drop_funnel_rtcp_caps, NULL, NULL);
+  gst_object_unref (pad);
+
+  templ = gst_element_class_get_pad_template (klass, "rtp_src");
+  target_pad = gst_element_get_static_pad (self->funnel, "src");
+  ghost_pad = gst_ghost_pad_new_from_template ("rtp_src", target_pad, templ);
+  gst_object_unref (target_pad);
+  g_return_if_fail (ghost_pad);
+
+  ret = gst_element_add_pad (GST_ELEMENT (self), ghost_pad);
+  g_return_if_fail (ret);
+
+  templ = gst_element_class_get_pad_template (klass, "sink");
+  target_pad = gst_element_get_static_pad (self->dtls_srtp_demux, "sink");
+  ghost_pad = gst_ghost_pad_new_from_template ("sink", target_pad, templ);
+  gst_object_unref (target_pad);
+  g_return_if_fail (ghost_pad);
+
+  ret = gst_element_add_pad (GST_ELEMENT (self), ghost_pad);
+  g_return_if_fail (ret);
+
+  g_signal_connect (self->srtp_dec, "request-key",
+      G_CALLBACK (on_decodgst_request_key), self);
+  g_signal_connect (self->bin.dtls_element, "notify::peer-pem",
+      G_CALLBACK (on_pegst_pem), self);
+}
+
+static void
+gst_dtls_srtp_dec_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (object);
+
+  switch (prop_id) {
+    case PROP_PEM:
+      if (self->bin.dtls_element) {
+        g_object_set_property (G_OBJECT (self->bin.dtls_element), "pem", value);
+      } else {
+        GST_WARNING_OBJECT (self, "tried to set pem after disabling DTLS");
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static void
+gst_dtls_srtp_dec_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec)
+{
+  GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (object);
+
+  switch (prop_id) {
+    case PROP_PEM:
+      if (self->bin.dtls_element) {
+        g_object_get_property (G_OBJECT (self->bin.dtls_element), "pem", value);
+      } else {
+        GST_WARNING_OBJECT (self, "tried to get pem after disabling DTLS");
+      }
+      break;
+    case PROP_PEER_PEM:
+      if (self->bin.dtls_element) {
+        g_object_get_property (G_OBJECT (self->bin.dtls_element), "peer-pem",
+            value);
+      } else {
+        GST_WARNING_OBJECT (self, "tried to get peer-pem after disabling DTLS");
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static GstPad *
+gst_dtls_srtp_dec_request_new_pad (GstElement * element,
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
+{
+  GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (element);
+  GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
+  GstPad *ghost_pad = NULL;
+  gboolean ret;
+
+  GST_DEBUG_OBJECT (element, "pad requested");
+
+  g_return_val_if_fail (self->bin.dtls_element, NULL);
+  g_return_val_if_fail (!self->bin.key_is_set, NULL);
+
+  if (templ == gst_element_class_get_pad_template (klass, "data_src")) {
+    GstPad *target_pad;
+
+    target_pad = gst_element_get_request_pad (self->bin.dtls_element, "src");
+
+    ghost_pad = gst_ghost_pad_new_from_template (name, target_pad, templ);
+    gst_object_unref (target_pad);
+    g_return_val_if_fail (ghost_pad, NULL);
+
+    ret = gst_pad_set_active (ghost_pad, TRUE);
+    g_return_val_if_fail (ret, NULL);
+    ret = gst_element_add_pad (element, ghost_pad);
+    g_return_val_if_fail (ret, NULL);
+
+    GST_LOG_OBJECT (self, "added data src pad");
+
+    if (caps) {
+      g_object_set (ghost_pad, "caps", caps, NULL);
+    }
+
+    return ghost_pad;
+  }
+
+  g_return_val_if_reached (NULL);
+}
+
+static GstCaps *
+on_decodgst_request_key (GstElement * srtp_decoder,
+    guint ssrc, GstDtlsSrtpBin * bin)
+{
+  GstCaps *key_caps;
+  GstBuffer *key_buffer = NULL;
+  guint cipher;
+  guint auth;
+
+  if (bin->key_is_set) {
+    if (bin->key) {
+      if (bin->srtp_cipher && bin->srtp_auth && bin->srtcp_cipher
+          && bin->srtcp_auth) {
+        GST_DEBUG_OBJECT (bin, "setting srtp key");
+        return gst_caps_new_simple ("application/x-srtp",
+            "srtp-key", GST_TYPE_BUFFER, gst_buffer_copy (bin->key),
+            "srtp-auth", G_TYPE_STRING, bin->srtp_auth,
+            "srtcp-auth", G_TYPE_STRING, bin->srtcp_auth,
+            "srtp-cipher", G_TYPE_STRING, bin->srtp_cipher,
+            "srtcp-cipher", G_TYPE_STRING, bin->srtcp_cipher, NULL);
+      } else {
+        GST_WARNING_OBJECT (bin,
+            "srtp key is set but not all ciphers and auths");
+        return NULL;
+      }
+    }
+
+    GST_DEBUG_OBJECT (bin, "setting srtp key to null");
+    return gst_caps_new_simple ("application/x-srtp",
+        "srtp-key", GST_TYPE_BUFFER, NULL,
+        "srtp-auth", G_TYPE_STRING, "null",
+        "srtcp-auth", G_TYPE_STRING, "null",
+        "srtp-cipher", G_TYPE_STRING, "null",
+        "srtcp-cipher", G_TYPE_STRING, "null", NULL);
+  }
+
+  if (bin->dtls_element) {
+    g_object_get (bin->dtls_element, "decoder-key", &key_buffer, NULL);
+  }
+
+  if (key_buffer) {
+    g_object_get (bin->dtls_element,
+        "srtp-cipher", &cipher, "srtp-auth", &auth, NULL);
+
+    g_return_val_if_fail (cipher == GST_DTLS_SRTP_CIPHER_AES_128_ICM, NULL);
+
+    key_caps = gst_caps_new_simple ("application/x-srtp",
+        "srtp-key", GST_TYPE_BUFFER, key_buffer,
+        "srtp-cipher", G_TYPE_STRING, "aes-128-icm",
+        "srtcp-cipher", G_TYPE_STRING, "aes-128-icm", NULL);
+
+    switch (auth) {
+      case GST_DTLS_SRTP_AUTH_HMAC_SHA1_32:
+        gst_caps_set_simple (key_caps,
+            "srtp-auth", G_TYPE_STRING, "hmac-sha1-32",
+            "srtcp-auth", G_TYPE_STRING, "hmac-sha1-32", NULL);
+        break;
+      case GST_DTLS_SRTP_AUTH_HMAC_SHA1_80:
+        gst_caps_set_simple (key_caps,
+            "srtp-auth", G_TYPE_STRING, "hmac-sha1-80",
+            "srtcp-auth", G_TYPE_STRING, "hmac-sha1-80", NULL);
+        break;
+      default:
+        g_return_val_if_reached (NULL);
+        break;
+    }
+
+    return key_caps;
+  }
+
+  return NULL;
+}
+
+static void
+on_pegst_pem (GstElement * srtp_decoder, GParamSpec * pspec,
+    GstDtlsSrtpDec * self)
+{
+  g_return_if_fail (self);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PEER_PEM]);
+}
+
+static void
+gst_dtls_srtp_dec_remove_dtls_element (GstDtlsSrtpBin * bin)
+{
+  GstDtlsSrtpDec *self = GST_DTLS_SRTP_DEC (bin);
+  GstPad *demux_pad;
+  gulong id;
+
+  if (!bin->dtls_element) {
+    return;
+  }
+
+  demux_pad = gst_element_get_static_pad (self->dtls_srtp_demux, "dtls_src");
+
+  id = gst_pad_add_probe (demux_pad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
+      (GstPadProbeCallback) remove_dtls_decodgst_probe_callback,
+      bin->dtls_element, NULL);
+  g_return_if_fail (id);
+  bin->dtls_element = NULL;
+
+  gst_pad_push_event (demux_pad,
+      gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM,
+          gst_structure_new_empty ("dummy")));
+
+  gst_object_unref (demux_pad);
+}
+
+static GstPadProbeReturn
+remove_dtls_decodgst_probe_callback (GstPad * pad,
+    GstPadProbeInfo * info, GstElement * element)
+{
+  gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info));
+
+  gst_element_set_state (GST_ELEMENT (element), GST_STATE_NULL);
+  gst_bin_remove (GST_BIN (GST_ELEMENT_PARENT (element)), element);
+
+  return GST_PAD_PROBE_OK;
+}
+
+static GstPadProbeReturn
+drop_funnel_rtcp_caps (GstPad * pad, GstPadProbeInfo * info, gpointer data)
+{
+  /* FIXME: This is needed for setting the proper caps until
+   * GStreamer supports MIXED caps or another mechanism to
+   * prevent renegotiation all the time when two different caps
+   * are going over the same pad
+   */
+  if (GST_EVENT_TYPE (info->data) == GST_EVENT_CAPS) {
+    GstCaps *caps, *peercaps;
+    GstStructure *s;
+
+    gst_event_parse_caps (GST_EVENT (info->data), &caps);
+    s = gst_caps_get_structure (caps, 0);
+    if (gst_structure_has_name (s, "application/x-rtcp")) {
+      peercaps = gst_pad_query_caps (pad, NULL);
+
+      /* If the peer does not accept RTCP, we are linked to
+       * the RTP sinkpad of rtpbin. In that case we have to
+       * drop the RTCP caps and assume that we sent RTP caps
+       * before here, which is very likely but not guaranteed
+       * if for some reason we receive RTCP before any RTP.
+       * In that unlikely case we will get event misordering
+       * warnings later, instead of getting them always as
+       * happens now.
+       */
+      if (peercaps && !gst_caps_is_subset (caps, peercaps)) {
+        gst_caps_unref (peercaps);
+        return GST_PAD_PROBE_DROP;
+      }
+      gst_caps_replace (&peercaps, NULL);
+    }
+  }
+
+  return GST_PAD_PROBE_OK;
+}
diff --git a/ext/dtls/gstdtlssrtpdec.h b/ext/dtls/gstdtlssrtpdec.h
new file mode 100644
index 0000000..d32a44b
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpdec.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlssrtpdec_h
+#define gstdtlssrtpdec_h
+
+#include "gstdtlssrtpbin.h"
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_SRTP_DEC (gst_dtls_srtp_dec_get_type())
+#define GST_DTLS_SRTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_DEC, GstDtlsSrtpDec))
+#define GST_DTLS_SRTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_DEC, GstDtlsSrtpDecClass))
+#define GST_IS_DTLS_SRTP_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_DEC))
+#define GST_IS_DTLS_SRTP_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_DEC))
+
+typedef struct _GstDtlsSrtpDec GstDtlsSrtpDec;
+typedef struct _GstDtlsSrtpDecClass GstDtlsSrtpDecClass;
+
+struct _GstDtlsSrtpDec {
+    GstDtlsSrtpBin bin;
+
+    GstElement *dtls_srtp_demux;
+    GstElement *srtp_dec;
+    GstElement *funnel;
+};
+
+struct _GstDtlsSrtpDecClass {
+    GstDtlsSrtpBinClass parent_class;
+};
+
+GType gst_dtls_srtp_dec_get_type(void);
+
+gboolean gst_dtls_srtp_dec_plugin_init(GstPlugin *);
+
+G_END_DECLS
+
+#endif /* gstdtlssrtpdec_h */
diff --git a/ext/dtls/gstdtlssrtpdemux.c b/ext/dtls/gstdtlssrtpdemux.c
new file mode 100644
index 0000000..f52d5fb
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpdemux.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdtlssrtpdemux.h"
+
+#define PACKET_IS_DTLS(b) (b > 0x13 && b < 0x40)
+#define PACKET_IS_RTP(b) (b > 0x7f && b < 0xc0)
+
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate rtp_src_template =
+    GST_STATIC_PAD_TEMPLATE ("rtp_src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp;"
+        "application/x-rtcp;" "application/x-srtp;" "application/x-srtcp")
+    );
+
+static GstStaticPadTemplate dtls_src_template =
+GST_STATIC_PAD_TEMPLATE ("dtls_src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-dtls")
+    );
+
+GST_DEBUG_CATEGORY_STATIC (gst_gst_dtls_srtp_demux_debug);
+#define GST_CAT_DEFAULT gst_gst_dtls_srtp_demux_debug
+
+#define gst_dtls_srtp_demux_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpDemux, gst_dtls_srtp_demux,
+    GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_gst_dtls_srtp_demux_debug,
+        "dtlssrtpdemux", 0, "DTLS SRTP Demultiplexer"));
+
+static GstFlowReturn sink_chain (GstPad *, GstObject * self, GstBuffer *);
+
+static void
+gst_dtls_srtp_demux_class_init (GstDtlsSrtpDemuxClass * klass)
+{
+  GstElementClass *element_class;
+
+  element_class = (GstElementClass *) 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 (&rtp_src_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&dtls_src_template));
+
+  gst_element_class_set_static_metadata (element_class,
+      "DTLS SRTP Demultiplexer",
+      "DTLS/SRTP/Demux",
+      "Demultiplexes DTLS and SRTP packets",
+      "Patrik Oldsberg patrik.oldsberg@ericsson.com");
+}
+
+static void
+gst_dtls_srtp_demux_init (GstDtlsSrtpDemux * self)
+{
+  GstPad *sink;
+
+  sink = gst_pad_new_from_static_template (&sink_template, "sink");
+  self->rtp_src =
+      gst_pad_new_from_static_template (&rtp_src_template, "rtp_src");
+  self->dtls_src =
+      gst_pad_new_from_static_template (&dtls_src_template, "dtls_src");
+  g_return_if_fail (sink);
+  g_return_if_fail (self->rtp_src);
+  g_return_if_fail (self->dtls_src);
+
+  gst_pad_set_chain_function (sink, GST_DEBUG_FUNCPTR (sink_chain));
+
+  gst_element_add_pad (GST_ELEMENT (self), sink);
+  gst_element_add_pad (GST_ELEMENT (self), self->rtp_src);
+  gst_element_add_pad (GST_ELEMENT (self), self->dtls_src);
+}
+
+static GstFlowReturn
+sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+{
+  GstDtlsSrtpDemux *self = GST_DTLS_SRTP_DEMUX (parent);
+  guint8 first_byte;
+
+  if (gst_buffer_get_size (buffer) == 0) {
+    GST_LOG_OBJECT (self, "received buffer with size 0");
+    gst_buffer_unref (buffer);
+    return GST_FLOW_OK;
+  }
+
+  if (gst_buffer_extract (buffer, 0, &first_byte, 1) != 1) {
+    GST_WARNING_OBJECT (self, "could not extract first byte from buffer");
+    gst_buffer_unref (buffer);
+    return GST_FLOW_OK;
+  }
+
+  if (PACKET_IS_DTLS (first_byte)) {
+    GST_LOG_OBJECT (self, "pushing dtls packet");
+
+    return gst_pad_push (self->dtls_src, buffer);
+  }
+
+  if (PACKET_IS_RTP (first_byte)) {
+    GST_LOG_OBJECT (self, "pushing rtp packet");
+
+    return gst_pad_push (self->rtp_src, buffer);
+  }
+
+  GST_WARNING_OBJECT (self, "received invalid buffer: %x", first_byte);
+  gst_buffer_unref (buffer);
+  return GST_FLOW_OK;
+}
diff --git a/ext/dtls/gstdtlssrtpdemux.h b/ext/dtls/gstdtlssrtpdemux.h
new file mode 100644
index 0000000..59f7fc3
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpdemux.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlssrtpdemux_h
+#define gstdtlssrtpdemux_h
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_SRTP_DEMUX \
+    (gst_dtls_srtp_demux_get_type())
+#define GST_DTLS_SRTP_DEMUX(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_DEMUX, GstDtlsSrtpDemux))
+#define GST_DTLS_SRTP_DEMUX_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_DEMUX, GstDtlsSrtpDemuxClass))
+#define GST_IS_DTLS_SRTP_DEMUX(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_DEMUX))
+#define GST_IS_DTLS_SRTP_DEMUX_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_DEMUX))
+
+typedef struct _GstDtlsSrtpDemux GstDtlsSrtpDemux;
+typedef struct _GstDtlsSrtpDemuxClass GstDtlsSrtpDemuxClass;
+
+struct _GstDtlsSrtpDemux {
+    GstElement element;
+
+    GstPad *rtp_src;
+    GstPad *dtls_src;
+};
+
+struct _GstDtlsSrtpDemuxClass {
+    GstElementClass parent_class;
+};
+
+GType gst_dtls_srtp_demux_get_type(void);
+
+gboolean gst_dtls_srtp_demux_plugin_init(GstPlugin *);
+
+G_END_DECLS
+
+#endif /* gstdtlssrtpdemux_h */
diff --git a/ext/dtls/gstdtlssrtpenc.c b/ext/dtls/gstdtlssrtpenc.c
new file mode 100644
index 0000000..35bf707
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpenc.c
@@ -0,0 +1,467 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdtlssrtpenc.h"
+
+#include <stdio.h>
+
+static GstStaticPadTemplate rtp_sink_template =
+    GST_STATIC_PAD_TEMPLATE ("rtp_sink_%d",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS ("application/x-rtp;application/x-rtcp")
+    );
+
+static GstStaticPadTemplate rtcp_sink_template =
+    GST_STATIC_PAD_TEMPLATE ("rtcp_sink_%d",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS ("application/x-rtp;application/x-rtcp")
+    );
+
+static GstStaticPadTemplate data_sink_template =
+GST_STATIC_PAD_TEMPLATE ("data_sink",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+GST_DEBUG_CATEGORY_STATIC (gst_dtls_srtp_enc_debug);
+#define GST_CAT_DEFAULT gst_dtls_srtp_enc_debug
+
+#define gst_dtls_srtp_enc_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstDtlsSrtpEnc, gst_dtls_srtp_enc,
+    GST_TYPE_DTLS_SRTP_BIN, GST_DEBUG_CATEGORY_INIT (gst_dtls_srtp_enc_debug,
+        "dtlssrtpenc", 0, "DTLS Decoder"));
+
+enum
+{
+  SIGNAL_ON_KEY_SET,
+  NUM_SIGNALS
+};
+
+static guint signals[NUM_SIGNALS];
+
+enum
+{
+  PROP_0,
+  PROP_IS_CLIENT,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *properties[NUM_PROPERTIES];
+
+#define DEFAULT_IS_CLIENT FALSE
+
+static gboolean transform_enum (GBinding *, const GValue * source_value,
+    GValue * target_value, GEnumClass *);
+
+static void gst_dtls_srtp_enc_set_property (GObject *, guint prop_id,
+    const GValue *, GParamSpec *);
+static void gst_dtls_srtp_enc_get_property (GObject *, guint prop_id,
+    GValue *, GParamSpec *);
+
+static GstPad *add_ghost_pad (GstElement *, const gchar * name, GstPad *,
+    GstPadTemplate *);
+static GstPad *gst_dtls_srtp_enc_request_new_pad (GstElement *,
+    GstPadTemplate *, const gchar * name, const GstCaps *);
+
+static void on_key_received (GObject * encoder, GstDtlsSrtpEnc *);
+
+static void gst_dtls_srtp_enc_remove_dtls_element (GstDtlsSrtpBin *);
+static GstPadProbeReturn remove_dtls_encodgst_probe_callback (GstPad *,
+    GstPadProbeInfo *, GstElement *);
+
+static void
+gst_dtls_srtp_enc_class_init (GstDtlsSrtpEncClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+  GstDtlsSrtpBinClass *dtls_srtp_bin_class;
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = (GstElementClass *) klass;
+  dtls_srtp_bin_class = (GstDtlsSrtpBinClass *) klass;
+
+  gobject_class->set_property =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_set_property);
+  gobject_class->get_property =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_get_property);
+
+  element_class->request_new_pad =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_request_new_pad);
+
+  dtls_srtp_bin_class->remove_dtls_element =
+      GST_DEBUG_FUNCPTR (gst_dtls_srtp_enc_remove_dtls_element);
+
+  signals[SIGNAL_ON_KEY_SET] =
+      g_signal_new ("on-key-set", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+      g_cclosure_marshal_generic, G_TYPE_NONE, 0);
+
+  properties[PROP_IS_CLIENT] =
+      g_param_spec_boolean ("is-client",
+      "Is client",
+      "Set to true if the decoder should act as "
+      "client and initiate the handshake",
+      DEFAULT_IS_CLIENT,
+      GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&rtp_sink_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&rtcp_sink_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&data_sink_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_template));
+
+  gst_element_class_set_static_metadata (element_class,
+      "DTLS-SRTP Encoder",
+      "Encoder/Network/DTLS/SRTP",
+      "Encodes SRTP packets with a key received from DTLS",
+      "Patrik Oldsberg patrik.oldsberg@ericsson.com");
+}
+
+static void
+gst_dtls_srtp_enc_init (GstDtlsSrtpEnc * self)
+{
+  GstElementClass *klass = GST_ELEMENT_GET_CLASS (GST_ELEMENT (self));
+  static GEnumClass *cipher_enum_class, *auth_enum_class;
+  gboolean ret;
+
+/*
+                 +--------------------+     +-----------------+
+     rtp_sink-R-o|rtp_sink     rtp_src|o-R-o|                 |
+                 |       srtpenc      |     |                 |
+    rtcp_sink-R-o|srtcp_sink  rtcp_src|o-R-o|                 |
+                 +--------------------+     |     funnel      |o---src
+                                            |                 |
+                 +--------------------+     |                 |
+    data_sink-R-o|       dtlsenc      |o---o|                 |
+                 +--------------------+     +-----------------+
+*/
+
+  self->srtp_enc = gst_element_factory_make ("srtpenc", "srtp-encoder");
+  if (!self->srtp_enc) {
+    GST_ERROR_OBJECT (self,
+        "failed to create srtp encoder, is the srtp plugin registered?");
+    return;
+  }
+  g_return_if_fail (self->srtp_enc);
+  self->bin.dtls_element = gst_element_factory_make ("dtlsenc", "dtls-encoder");
+  if (!self->bin.dtls_element) {
+    GST_ERROR_OBJECT (self, "failed to create dtls encoder");
+    return;
+  }
+  self->funnel = gst_element_factory_make ("funnel", "funnel");
+  if (!self->funnel) {
+    GST_ERROR_OBJECT (self, "failed to create funnel");
+    return;
+  }
+
+  gst_bin_add_many (GST_BIN (self), self->bin.dtls_element, self->srtp_enc,
+      self->funnel, NULL);
+
+  ret = gst_element_link (self->bin.dtls_element, self->funnel);
+  g_return_if_fail (ret);
+
+  add_ghost_pad (GST_ELEMENT (self), "src",
+      gst_element_get_static_pad (self->funnel, "src"),
+      gst_element_class_get_pad_template (klass, "src"));
+
+  g_signal_connect (self->bin.dtls_element, "on-key-received",
+      G_CALLBACK (on_key_received), self);
+
+  if (g_once_init_enter (&cipher_enum_class)) {
+    GType type = g_type_from_name ("GstSrtpCipherType");
+    g_assert (type);
+    g_once_init_leave (&cipher_enum_class, g_type_class_peek (type));
+  }
+  if (g_once_init_enter (&auth_enum_class)) {
+    GType type = g_type_from_name ("GstSrtpAuthType");
+    g_assert (type);
+    g_once_init_leave (&auth_enum_class, g_type_class_peek (type));
+  }
+
+  g_object_set (self->srtp_enc, "random-key", TRUE, NULL);
+
+  g_object_bind_property (G_OBJECT (self), "key", self->srtp_enc, "key",
+      G_BINDING_DEFAULT);
+  g_object_bind_property_full (G_OBJECT (self), "srtp-cipher", self->srtp_enc,
+      "rtp-cipher", G_BINDING_DEFAULT, (GBindingTransformFunc) transform_enum,
+      NULL, cipher_enum_class, NULL);
+  g_object_bind_property_full (G_OBJECT (self), "srtcp-cipher", self->srtp_enc,
+      "rtcp-cipher", G_BINDING_DEFAULT, (GBindingTransformFunc) transform_enum,
+      NULL, cipher_enum_class, NULL);
+  g_object_bind_property_full (G_OBJECT (self), "srtp-auth", self->srtp_enc,
+      "rtp-auth", G_BINDING_DEFAULT, (GBindingTransformFunc) transform_enum,
+      NULL, auth_enum_class, NULL);
+  g_object_bind_property_full (G_OBJECT (self), "srtcp-auth", self->srtp_enc,
+      "rtcp-auth", G_BINDING_DEFAULT, (GBindingTransformFunc) transform_enum,
+      NULL, auth_enum_class, NULL);
+}
+
+static gboolean
+transform_enum (GBinding * binding, const GValue * source_value,
+    GValue * target_value, GEnumClass * enum_class)
+{
+  GEnumValue *enum_value;
+  const gchar *nick;
+
+  nick = g_value_get_string (source_value);
+  g_return_val_if_fail (nick, FALSE);
+
+  enum_value = g_enum_get_value_by_nick (enum_class, nick);
+  g_return_val_if_fail (enum_value, FALSE);
+
+  GST_DEBUG_OBJECT (g_binding_get_source (binding),
+      "transforming enum from %s to %d", nick, enum_value->value);
+
+  g_value_set_enum (target_value, enum_value->value);
+
+  return TRUE;
+}
+
+static void
+gst_dtls_srtp_enc_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+  GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (object);
+
+  switch (prop_id) {
+    case PROP_IS_CLIENT:
+      if (self->bin.dtls_element) {
+        g_object_set_property (G_OBJECT (self->bin.dtls_element), "is-client",
+            value);
+      } else {
+        GST_WARNING_OBJECT (self,
+            "tried to set is-client after disabling DTLS");
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static void
+gst_dtls_srtp_enc_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec)
+{
+  GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (object);
+
+  switch (prop_id) {
+    case PROP_IS_CLIENT:
+      if (self->bin.dtls_element) {
+        g_object_get_property (G_OBJECT (self->bin.dtls_element), "is-client",
+            value);
+      } else {
+        GST_WARNING_OBJECT (self,
+            "tried to get is-client after disabling DTLS");
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
+  }
+}
+
+static GstPad *
+add_ghost_pad (GstElement * element,
+    const gchar * name, GstPad * target, GstPadTemplate * templ)
+{
+  GstPad *pad;
+  gboolean ret;
+
+  pad = gst_ghost_pad_new_from_template (name, target, templ);
+  gst_object_unref (target);
+  target = NULL;
+
+  ret = gst_pad_set_active (pad, TRUE);
+  g_warn_if_fail (ret);
+
+  ret = gst_element_add_pad (element, pad);
+  g_warn_if_fail (ret);
+
+  return pad;
+}
+
+static GstPad *
+gst_dtls_srtp_enc_request_new_pad (GstElement * element,
+    GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
+{
+  GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (element);
+  GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
+  GstPad *target_pad;
+  GstPad *ghost_pad = NULL;
+  guint pad_n;
+  gchar *srtp_src_name;
+
+  GST_DEBUG_OBJECT (element, "pad requested");
+
+  g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL);
+  g_return_val_if_fail (self->srtp_enc, NULL);
+
+  if (templ == gst_element_class_get_pad_template (klass, "rtp_sink_%d")) {
+    target_pad = gst_element_get_request_pad (self->srtp_enc, name);
+    g_return_val_if_fail (target_pad, NULL);
+
+    sscanf (GST_PAD_NAME (target_pad), "rtp_sink_%d", &pad_n);
+    srtp_src_name = g_strdup_printf ("rtp_src_%d", pad_n);
+
+    gst_element_link_pads (self->srtp_enc, srtp_src_name, self->funnel, NULL);
+
+    g_free (srtp_src_name);
+
+    ghost_pad = add_ghost_pad (element, name, target_pad, templ);
+
+    GST_LOG_OBJECT (self, "added rtp sink pad");
+  } else if (templ == gst_element_class_get_pad_template (klass,
+          "rtcp_sink_%d")) {
+    target_pad = gst_element_get_request_pad (self->srtp_enc, name);
+    g_return_val_if_fail (target_pad, NULL);
+
+    sscanf (GST_PAD_NAME (target_pad), "rtcp_sink_%d", &pad_n);
+    srtp_src_name = g_strdup_printf ("rtcp_src_%d", pad_n);
+
+    gst_element_link_pads (self->srtp_enc, srtp_src_name, self->funnel, NULL);
+
+    g_free (srtp_src_name);
+
+    ghost_pad = add_ghost_pad (element, name, target_pad, templ);
+
+    GST_LOG_OBJECT (self, "added rtcp sink pad");
+  } else if (templ == gst_element_class_get_pad_template (klass, "data_sink")) {
+    g_return_val_if_fail (self->bin.dtls_element, NULL);
+    target_pad = gst_element_get_request_pad (self->bin.dtls_element, "sink");
+
+    ghost_pad = add_ghost_pad (element, name, target_pad, templ);
+
+    GST_LOG_OBJECT (self, "added data sink pad");
+  } else {
+    g_warn_if_reached ();
+  }
+
+  if (caps && ghost_pad) {
+    g_object_set (ghost_pad, "caps", caps, NULL);
+  }
+
+  return ghost_pad;
+}
+
+static void
+on_key_received (GObject * encoder, GstDtlsSrtpEnc * self)
+{
+  GstDtlsSrtpBin *bin = GST_DTLS_SRTP_BIN (self);
+  GstBuffer *buffer = NULL;
+  guint cipher, auth;
+
+  if (!(bin->key_is_set || bin->srtp_cipher || bin->srtp_auth
+          || bin->srtcp_cipher || bin->srtcp_auth)) {
+    g_object_get (encoder,
+        "encoder-key", &buffer,
+        "srtp-cipher", &cipher, "srtp-auth", &auth, NULL);
+
+    g_object_set (self->srtp_enc,
+        "rtp-cipher", cipher,
+        "rtcp-cipher", cipher,
+        "rtp-auth", auth,
+        "rtcp-auth", auth, "key", buffer, "random-key", FALSE, NULL);
+
+    g_signal_emit (self, signals[SIGNAL_ON_KEY_SET], 0);
+  } else {
+    GST_DEBUG_OBJECT (self,
+        "ignoring keys received from DTLS handshake, key struct is set");
+  }
+}
+
+static void
+gst_dtls_srtp_enc_remove_dtls_element (GstDtlsSrtpBin * bin)
+{
+  GstDtlsSrtpEnc *self = GST_DTLS_SRTP_ENC (bin);
+  GstPad *dtls_sink_pad, *pegst_pad;
+  gulong id;
+  guint rtp_cipher = 1, rtcp_cipher = 1, rtp_auth = 1, rtcp_auth = 1;
+
+  if (!bin->dtls_element) {
+    return;
+  }
+
+  g_object_get (self->srtp_enc,
+      "rtp-cipher", &rtp_cipher,
+      "rtcp-cipher", &rtcp_cipher,
+      "rtp-auth", &rtp_auth, "rtcp-auth", &rtcp_auth, NULL);
+
+  if (!rtp_cipher && !rtcp_cipher && !rtp_auth && !rtcp_auth) {
+    g_object_set (self->srtp_enc, "random-key", FALSE, NULL);
+  }
+
+  dtls_sink_pad = gst_element_get_static_pad (bin->dtls_element, "sink");
+
+  if (!dtls_sink_pad) {
+    gst_element_set_state (GST_ELEMENT (bin->dtls_element), GST_STATE_NULL);
+    gst_bin_remove (GST_BIN (self), bin->dtls_element);
+    bin->dtls_element = NULL;
+    return;
+  }
+
+  pegst_pad = gst_pad_get_peer (dtls_sink_pad);
+  g_return_if_fail (pegst_pad);
+  gst_object_unref (dtls_sink_pad);
+  dtls_sink_pad = NULL;
+
+  id = gst_pad_add_probe (pegst_pad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
+      (GstPadProbeCallback) remove_dtls_encodgst_probe_callback,
+      bin->dtls_element, NULL);
+  g_return_if_fail (id);
+  bin->dtls_element = NULL;
+
+  gst_pad_push_event (pegst_pad,
+      gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM,
+          gst_structure_new_empty ("dummy")));
+
+  gst_object_unref (pegst_pad);
+}
+
+static GstPadProbeReturn
+remove_dtls_encodgst_probe_callback (GstPad * pad,
+    GstPadProbeInfo * info, GstElement * element)
+{
+  gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info));
+
+  gst_element_set_state (GST_ELEMENT (element), GST_STATE_NULL);
+  gst_bin_remove (GST_BIN (GST_ELEMENT_PARENT (element)), element);
+
+  return GST_PAD_PROBE_OK;
+}
diff --git a/ext/dtls/gstdtlssrtpenc.h b/ext/dtls/gstdtlssrtpenc.h
new file mode 100644
index 0000000..5cc07ee
--- /dev/null
+++ b/ext/dtls/gstdtlssrtpenc.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifndef gstdtlssrtpenc_h
+#define gstdtlssrtpenc_h
+
+#include "gstdtlssrtpbin.h"
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DTLS_SRTP_ENC (gst_dtls_srtp_enc_get_type())
+#define GST_DTLS_SRTP_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_SRTP_ENC, GstDtlsSrtpEnc))
+#define GST_DTLS_SRTP_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_SRTP_ENC, GstDtlsSrtpEncClass))
+#define GST_IS_DTLS_SRTP_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_SRTP_ENC))
+#define GST_IS_DTLS_SRTP_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_SRTP_ENC))
+
+typedef struct _GstDtlsSrtpEnc GstDtlsSrtpEnc;
+typedef struct _GstDtlsSrtpEncClass GstDtlsSrtpEncClass;
+
+struct _GstDtlsSrtpEnc {
+    GstDtlsSrtpBin bin;
+
+    GstElement *srtp_enc;
+    GstElement *funnel;
+};
+
+struct _GstDtlsSrtpEncClass {
+    GstDtlsSrtpBinClass parent_class;
+};
+
+GType gst_dtls_srtp_enc_get_type(void);
+
+gboolean gst_dtls_srtp_enc_plugin_init(GstPlugin *);
+
+guint gst_dtls_srtp_enc_get_ciphgst_value_by_nick(const gchar *ciphgst_nick);
+guint gst_dtls_srtp_enc_get_auth_value_by_nick(const gchar *auth_nick);
+
+G_END_DECLS
+
+#endif /* gstdtlssrtpenc_h */
diff --git a/ext/dtls/plugin.c b/ext/dtls/plugin.c
new file mode 100644
index 0000000..e531eff
--- /dev/null
+++ b/ext/dtls/plugin.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdtlsdec.h"
+#include "gstdtlsenc.h"
+#include "gstdtlssrtpenc.h"
+#include "gstdtlssrtpdec.h"
+#include "gstdtlssrtpdemux.h"
+
+#include <gst/gst.h>
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  return gst_element_register (plugin, "dtlsenc", GST_RANK_NONE,
+      GST_TYPE_DTLS_ENC)
+      && gst_element_register (plugin, "dtlsdec", GST_RANK_NONE,
+      GST_TYPE_DTLS_DEC)
+      && gst_element_register (plugin, "dtlssrtpdec", GST_RANK_NONE,
+      GST_TYPE_DTLS_SRTP_DEC)
+      && gst_element_register (plugin, "dtlssrtpenc", GST_RANK_NONE,
+      GST_TYPE_DTLS_SRTP_ENC)
+      && gst_element_register (plugin, "dtlssrtpdemux", GST_RANK_NONE,
+      GST_TYPE_DTLS_SRTP_DEMUX);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    dtls,
+    "DTLS decoder and encoder plugins",
+    plugin_init, PACKAGE_VERSION, "BSD", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/dts/Makefile.in b/ext/dts/Makefile.in
index 405d5a9..808a490 100644
--- a/ext/dts/Makefile.in
+++ b/ext/dts/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/faac/Makefile.in b/ext/faac/Makefile.in
index e2cde62..db62636 100644
--- a/ext/faac/Makefile.in
+++ b/ext/faac/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index 4bea1ce..c60a442 100644
--- a/ext/faac/gstfaac.c
+++ b/ext/faac/gstfaac.c
@@ -82,13 +82,15 @@
     "channels = (int) [ 1, 6 ], "      \
     "rate = (int) {" SAMPLE_RATES "}, "   \
     "stream-format = (string) { adts, raw }, " \
-    "base-profile = (string) { main, lc, ssr, ltp }; " \
+    "base-profile = (string) { main, lc, ssr, ltp }, " \
+    "framed = (boolean) true; " \
     "audio/mpeg, "                     \
     "mpegversion = (int) 2, "   \
     "channels = (int) [ 1, 6 ], "      \
     "rate = (int) {" SAMPLE_RATES "}, "   \
     "stream-format = (string) { adts, raw }, " \
-    "profile = (string) { main, lc }"
+    "profile = (string) { main, lc }," \
+    "framed = (boolean) true; "
 static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
@@ -152,7 +154,7 @@
   static GType gst_faac_brtype_type = 0;
 
   if (!gst_faac_brtype_type) {
-    static GEnumValue gst_faac_brtype[] = {
+    static const GEnumValue gst_faac_brtype[] = {
       {VBR, "VBR", "VBR encoding"},
       {ABR, "ABR", "ABR encoding"},
       {0, NULL, NULL},
@@ -172,7 +174,7 @@
   static GType gst_faac_shortctl_type = 0;
 
   if (!gst_faac_shortctl_type) {
-    static GEnumValue gst_faac_shortctl[] = {
+    static const GEnumValue gst_faac_shortctl[] = {
       {SHORTCTL_NORMAL, "SHORTCTL_NORMAL", "Normal block type"},
       {SHORTCTL_NOSHORT, "SHORTCTL_NOSHORT", "No short blocks"},
       {SHORTCTL_NOLONG, "SHORTCTL_NOLONG", "No long blocks"},
@@ -550,7 +552,7 @@
       "channels", G_TYPE_INT, info->channels,
       "rate", G_TYPE_INT, info->rate,
       "stream-format", G_TYPE_STRING, (faac->outputformat ? "adts" : "raw"),
-      NULL);
+      "framed", G_TYPE_BOOLEAN, TRUE, NULL);
 
   /* DecoderSpecificInfo is only available for mpegversion=4 */
   if (faac->mpegversion == 4) {
diff --git a/ext/faad/Makefile.in b/ext/faad/Makefile.in
index fcc0c2c..59bd578 100644
--- a/ext/faad/Makefile.in
+++ b/ext/faad/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index d9313d5..918d636 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -456,7 +456,6 @@
         GST_WARNING_OBJECT (faad,
             "Unsupported FAAD channel position 0x%x encountered", fpos[n]);
         return FALSE;
-        break;
       }
     }
   }
@@ -471,6 +470,7 @@
   gboolean fmt_change = FALSE;
   GstAudioInfo ainfo;
   gint i;
+  GstAudioChannelPosition position[6];
 
   /* see if we need to renegotiate */
   if (info->samplerate != faad->samplerate ||
@@ -496,10 +496,6 @@
   g_free (faad->channel_positions);
   faad->channel_positions = g_memdup (info->channel_position, faad->channels);
 
-  /* FIXME: Use the GstAudioInfo of GstAudioDecoder for all of this */
-  gst_audio_info_init (&ainfo);
-  gst_audio_info_set_format (&ainfo, GST_AUDIO_FORMAT_S16, faad->samplerate,
-      faad->channels, NULL);
   faad->bps = 16 / 8;
 
   if (!gst_faad_chanpos_to_gst (faad, faad->channel_positions,
@@ -507,14 +503,11 @@
     GST_DEBUG_OBJECT (faad, "Could not map channel positions");
     return FALSE;
   }
-  memcpy (ainfo.position, faad->aac_positions,
+
+  memcpy (position, faad->aac_positions, sizeof (position));
+  gst_audio_channel_positions_to_valid_order (position, faad->channels);
+  memcpy (faad->gst_positions, position,
       faad->channels * sizeof (GstAudioChannelPosition));
-  gst_audio_channel_positions_to_valid_order (ainfo.position, faad->channels);
-  memcpy (faad->gst_positions, ainfo.position,
-      faad->channels * sizeof (GstAudioChannelPosition));
-  /* Unset UNPOSITIONED flag */
-  if (ainfo.position[0] != GST_AUDIO_CHANNEL_POSITION_NONE)
-    ainfo.flags &= ~GST_AUDIO_FLAG_UNPOSITIONED;
 
   /* get the remap table */
   memset (faad->reorder_map, 0, sizeof (faad->reorder_map));
@@ -529,6 +522,11 @@
     }
   }
 
+  /* FIXME: Use the GstAudioInfo of GstAudioDecoder for all of this */
+  gst_audio_info_init (&ainfo);
+  gst_audio_info_set_format (&ainfo, GST_AUDIO_FORMAT_S16, faad->samplerate,
+      faad->channels, position);
+
   ret = gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (faad), &ainfo);
 
   return ret;
@@ -890,7 +888,8 @@
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  return gst_element_register (plugin, "faad", GST_RANK_PRIMARY, GST_TYPE_FAAD);
+  return gst_element_register (plugin, "faad", GST_RANK_SECONDARY,
+      GST_TYPE_FAAD);
 }
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
diff --git a/ext/flite/Makefile.in b/ext/flite/Makefile.in
index 6a0d794..c1a45df 100644
--- a/ext/flite/Makefile.in
+++ b/ext/flite/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/fluidsynth/Makefile.in b/ext/fluidsynth/Makefile.in
index 5920456..dac92b4 100644
--- a/ext/fluidsynth/Makefile.in
+++ b/ext/fluidsynth/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -252,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -292,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -300,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -349,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -429,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -438,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -451,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -476,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -549,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -578,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -614,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -654,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -681,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/gl/Makefile.am b/ext/gl/Makefile.am
index b1796f6..7dc1041 100644
--- a/ext/gl/Makefile.am
+++ b/ext/gl/Makefile.am
@@ -1,33 +1,58 @@
-
 plugin_LTLIBRARIES = libgstopengl.la
 
-AM_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-AM_LIBS = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS)
+libgstopengl_la_SOURCES = \
+	gstopengl.c \
+	gstglbasemixer.c \
+	gstgluploadelement.c \
+	gstgldownloadelement.c \
+	gstglcolorconvertelement.c \
+	gstglfilterbin.c \
+	gstglmixerbin.c \
+	gstglsinkbin.c \
+	gstglsrcbin.c \
+	gstglimagesink.c \
+	gstglfiltercube.c \
+	gstgleffects.c \
+	effects/gstgleffectssources.c \
+	effects/gstgleffectidentity.c \
+	effects/gstgleffectmirror.c \
+	effects/gstgleffectsqueeze.c \
+	gstglcolorscale.c \
+	gstglmixer.c \
+	gstglvideomixer.c \
+	gstglfiltershader.c \
+	gstglfilterapp.c
+
+noinst_HEADERS = \
+	gstglbasemixer.h \
+	gstgluploadelement.h \
+	gstgldownloadelement.h \
+	gstglcolorconvertelement.h \
+	gstglfilterbin.h \
+	gstglmixerbin.h \
+	gstglsinkbin.h \
+	gstglsrcbin.h \
+	gstglimagesink.h \
+	gstglfiltercube.h \
+	gstgleffects.h \
+	effects/gstgleffectssources.h \
+	gstglcolorscale.h \
+	gstglmixer.h \
+	gstglvideomixer.h \
+	gstglfiltershader.h \
+	gstglfilterapp.h
 
 # full opengl required
 if USE_OPENGL
-OPENGL_SOURCES =  \
+libgstopengl_la_SOURCES += \
 	gstglfilterblur.c \
-	gstglfilterblur.h \
 	gstglfiltersobel.c \
-	gstglfiltersobel.h \
 	gstglfilterlaplacian.c \
-	gstglfilterlaplacian.h \
 	gstglfilterglass.c \
-	gstglfilterglass.h \
-	gstglfilterapp.c \
-	gstglfilterapp.h \
-	gstglfilterreflectedscreen.c \
-	gstglfilterreflectedscreen.h \
 	gstgldeinterlace.c \
-	gstgldeinterlace.h \
 	gltestsrc.c \
-	gltestsrc.h \
 	gstgltestsrc.c \
-	gstgltestsrc.h \
 	gstglmosaic.c \
-	gstglmosaic.h \
-	effects/gstgleffectscurves.h \
 	effects/gstgleffectstretch.c \
 	effects/gstgleffecttunnel.c \
 	effects/gstgleffectfisheye.c \
@@ -35,49 +60,31 @@
 	effects/gstgleffectbulge.c \
 	effects/gstgleffectsquare.c \
 	effects/gstgleffectlumatocurve.c \
-	effects/gstgleffectlumatocurve.h \
 	effects/gstgleffectrgbtocurve.c \
 	effects/gstgleffectsin.c \
 	effects/gstgleffectglow.c \
 	effects/gstgleffectxray.c
 
-if HAVE_PNG
-OPENGL_SOURCES += \
-	gstglbumper.c \
-	gstglbumper.h \
-	gstgldifferencematte.c \
-	gstgldifferencematte.h
-if HAVE_JPEG
-OPENGL_SOURCES += \
-	gstgloverlay.c \
-	gstgloverlay.h
-endif
-endif
-endif
+noinst_HEADERS += \
+	gstglfilterblur.h \
+	gstglfiltersobel.h \
+	gstglfilterlaplacian.h \
+	gstglfilterglass.h \
+	gstgldeinterlace.h \
+	gltestsrc.h \
+	gstgltestsrc.h \
+	gstglmosaic.h \
+	effects/gstgleffectscurves.h \
+	effects/gstgleffectlumatocurve.h
 
-libgstopengl_la_SOURCES = \
-	gstopengl.c \
-	gstglimagesink.c \
-	gstglimagesink.h \
-	gstglfiltercube.c \
-	gstglfiltercube.h \
-	gstgleffects.c \
-	gstgleffects.h \
-	effects/gstgleffectssources.c \
-	effects/gstgleffectssources.h \
-	effects/gstgleffectidentity.c \
-	effects/gstgleffectmirror.c \
-	effects/gstgleffectsqueeze.c \
-	gstglcolorscale.c \
-	gstglcolorscale.h \
-	gstglmixer.c \
-	gstglmixer.h \
-	gstglmixerpad.h \
-	gstglvideomixer.c \
-	gstglvideomixer.h \
-	gstglfiltershader.c \
-	gstglfiltershader.h \
-	$(OPENGL_SOURCES)
+if HAVE_PNG
+libgstopengl_la_SOURCES += \
+	gstgldifferencematte.c
+
+noinst_HEADERS += \
+	gstgldifferencematte.h
+endif
+endif
 
 if HAVE_GRAPHENE
 libgstopengl_la_SOURCES += \
@@ -85,6 +92,32 @@
 	gstgltransformation.h
 endif
 
+if HAVE_JPEG
+if HAVE_PNG
+libgstopengl_la_SOURCES += \
+	gstgloverlay.c
+
+noinst_HEADERS += \
+	gstgloverlay.h
+endif
+endif
+
+if HAVE_WINDOW_COCOA
+libgstopengl_la_SOURCES += \
+	caopengllayersink.m
+
+noinst_HEADERS += \
+	caopengllayersink.h
+endif
+
+libgstopengl_la_OBJCFLAGS = \
+	-I$(top_srcdir)/gst-libs \
+	-I$(top_builddir)/gst-libs \
+	$(GST_OBJCFLAGS) \
+	$(GST_BASE_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	$(GL_OBJCFLAGS)
+
 # check order of CFLAGS and LIBS, shouldn't the order be the other way around
 # (like in AM_CFLAGS)?
 libgstopengl_la_CFLAGS = \
@@ -111,5 +144,6 @@
 	$(GRAPHENE_LIBS)
 
 libgstopengl_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstopengl_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+libgstopengl_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) --tag=CC
+
 
diff --git a/ext/gl/Makefile.in b/ext/gl/Makefile.in
index 2655825..9d79a39 100644
--- a/ext/gl/Makefile.in
+++ b/ext/gl/Makefile.in
@@ -14,6 +14,7 @@
 
 @SET_MAKE@
 
+
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -79,23 +80,66 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@am__append_1 = \
-@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	gstglbumper.c \
-@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	gstglbumper.h \
-@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	gstgldifferencematte.c \
+
+# full opengl required
+@USE_OPENGL_TRUE@am__append_1 = \
+@USE_OPENGL_TRUE@	gstglfilterblur.c \
+@USE_OPENGL_TRUE@	gstglfiltersobel.c \
+@USE_OPENGL_TRUE@	gstglfilterlaplacian.c \
+@USE_OPENGL_TRUE@	gstglfilterglass.c \
+@USE_OPENGL_TRUE@	gstgldeinterlace.c \
+@USE_OPENGL_TRUE@	gltestsrc.c \
+@USE_OPENGL_TRUE@	gstgltestsrc.c \
+@USE_OPENGL_TRUE@	gstglmosaic.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectstretch.c \
+@USE_OPENGL_TRUE@	effects/gstgleffecttunnel.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectfisheye.c \
+@USE_OPENGL_TRUE@	effects/gstgleffecttwirl.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectbulge.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectsquare.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectlumatocurve.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectrgbtocurve.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectsin.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectglow.c \
+@USE_OPENGL_TRUE@	effects/gstgleffectxray.c
+
+@USE_OPENGL_TRUE@am__append_2 = \
+@USE_OPENGL_TRUE@	gstglfilterblur.h \
+@USE_OPENGL_TRUE@	gstglfiltersobel.h \
+@USE_OPENGL_TRUE@	gstglfilterlaplacian.h \
+@USE_OPENGL_TRUE@	gstglfilterglass.h \
+@USE_OPENGL_TRUE@	gstgldeinterlace.h \
+@USE_OPENGL_TRUE@	gltestsrc.h \
+@USE_OPENGL_TRUE@	gstgltestsrc.h \
+@USE_OPENGL_TRUE@	gstglmosaic.h \
+@USE_OPENGL_TRUE@	effects/gstgleffectscurves.h \
+@USE_OPENGL_TRUE@	effects/gstgleffectlumatocurve.h
+
+@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@am__append_3 = \
+@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	gstgldifferencematte.c
+
+@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@am__append_4 = \
 @HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	gstgldifferencematte.h
 
-@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@am__append_2 = \
-@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	gstgloverlay.c \
-@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	gstgloverlay.h
-
-@HAVE_GRAPHENE_TRUE@am__append_3 = \
+@HAVE_GRAPHENE_TRUE@am__append_5 = \
 @HAVE_GRAPHENE_TRUE@	gstgltransformation.c \
 @HAVE_GRAPHENE_TRUE@	gstgltransformation.h
 
+@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@am__append_6 = \
+@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@	gstgloverlay.c
+
+@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@am__append_7 = \
+@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@	gstgloverlay.h
+
+@HAVE_WINDOW_COCOA_TRUE@am__append_8 = \
+@HAVE_WINDOW_COCOA_TRUE@	caopengllayersink.m
+
+@HAVE_WINDOW_COCOA_TRUE@am__append_9 = \
+@HAVE_WINDOW_COCOA_TRUE@	caopengllayersink.h
+
 subdir = ext/gl
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/depcomp
+	$(top_srcdir)/depcomp $(am__noinst_HEADERS_DIST)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
 	$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -103,6 +147,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -116,7 +161,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -174,41 +218,29 @@
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
-am__libgstopengl_la_SOURCES_DIST = gstopengl.c gstglimagesink.c \
-	gstglimagesink.h gstglfiltercube.c gstglfiltercube.h \
-	gstgleffects.c gstgleffects.h effects/gstgleffectssources.c \
-	effects/gstgleffectssources.h effects/gstgleffectidentity.c \
-	effects/gstgleffectmirror.c effects/gstgleffectsqueeze.c \
-	gstglcolorscale.c gstglcolorscale.h gstglmixer.c gstglmixer.h \
-	gstglmixerpad.h gstglvideomixer.c gstglvideomixer.h \
-	gstglfiltershader.c gstglfiltershader.h gstglfilterblur.c \
-	gstglfilterblur.h gstglfiltersobel.c gstglfiltersobel.h \
-	gstglfilterlaplacian.c gstglfilterlaplacian.h \
-	gstglfilterglass.c gstglfilterglass.h gstglfilterapp.c \
-	gstglfilterapp.h gstglfilterreflectedscreen.c \
-	gstglfilterreflectedscreen.h gstgldeinterlace.c \
-	gstgldeinterlace.h gltestsrc.c gltestsrc.h gstgltestsrc.c \
-	gstgltestsrc.h gstglmosaic.c gstglmosaic.h \
-	effects/gstgleffectscurves.h effects/gstgleffectstretch.c \
+am__libgstopengl_la_SOURCES_DIST = gstopengl.c gstglbasemixer.c \
+	gstgluploadelement.c gstgldownloadelement.c \
+	gstglcolorconvertelement.c gstglfilterbin.c gstglmixerbin.c \
+	gstglsinkbin.c gstglsrcbin.c gstglimagesink.c \
+	gstglfiltercube.c gstgleffects.c effects/gstgleffectssources.c \
+	effects/gstgleffectidentity.c effects/gstgleffectmirror.c \
+	effects/gstgleffectsqueeze.c gstglcolorscale.c gstglmixer.c \
+	gstglvideomixer.c gstglfiltershader.c gstglfilterapp.c \
+	gstglfilterblur.c gstglfiltersobel.c gstglfilterlaplacian.c \
+	gstglfilterglass.c gstgldeinterlace.c gltestsrc.c \
+	gstgltestsrc.c gstglmosaic.c effects/gstgleffectstretch.c \
 	effects/gstgleffecttunnel.c effects/gstgleffectfisheye.c \
 	effects/gstgleffecttwirl.c effects/gstgleffectbulge.c \
 	effects/gstgleffectsquare.c effects/gstgleffectlumatocurve.c \
-	effects/gstgleffectlumatocurve.h \
 	effects/gstgleffectrgbtocurve.c effects/gstgleffectsin.c \
 	effects/gstgleffectglow.c effects/gstgleffectxray.c \
-	gstglbumper.c gstglbumper.h gstgldifferencematte.c \
-	gstgldifferencematte.h gstgloverlay.c gstgloverlay.h \
-	gstgltransformation.c gstgltransformation.h
+	gstgldifferencematte.c gstgltransformation.c \
+	gstgltransformation.h gstgloverlay.c caopengllayersink.m
 am__dirstamp = $(am__leading_dot)dirstamp
-@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@am__objects_1 = libgstopengl_la-gstglbumper.lo \
-@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@	libgstopengl_la-gstgldifferencematte.lo
-@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@am__objects_2 = libgstopengl_la-gstgloverlay.lo
-@USE_OPENGL_TRUE@am__objects_3 = libgstopengl_la-gstglfilterblur.lo \
+@USE_OPENGL_TRUE@am__objects_1 = libgstopengl_la-gstglfilterblur.lo \
 @USE_OPENGL_TRUE@	libgstopengl_la-gstglfiltersobel.lo \
 @USE_OPENGL_TRUE@	libgstopengl_la-gstglfilterlaplacian.lo \
 @USE_OPENGL_TRUE@	libgstopengl_la-gstglfilterglass.lo \
-@USE_OPENGL_TRUE@	libgstopengl_la-gstglfilterapp.lo \
-@USE_OPENGL_TRUE@	libgstopengl_la-gstglfilterreflectedscreen.lo \
 @USE_OPENGL_TRUE@	libgstopengl_la-gstgldeinterlace.lo \
 @USE_OPENGL_TRUE@	libgstopengl_la-gltestsrc.lo \
 @USE_OPENGL_TRUE@	libgstopengl_la-gstgltestsrc.lo \
@@ -223,11 +255,21 @@
 @USE_OPENGL_TRUE@	effects/libgstopengl_la-gstgleffectrgbtocurve.lo \
 @USE_OPENGL_TRUE@	effects/libgstopengl_la-gstgleffectsin.lo \
 @USE_OPENGL_TRUE@	effects/libgstopengl_la-gstgleffectglow.lo \
-@USE_OPENGL_TRUE@	effects/libgstopengl_la-gstgleffectxray.lo \
-@USE_OPENGL_TRUE@	$(am__objects_1) $(am__objects_2)
-@HAVE_GRAPHENE_TRUE@am__objects_4 =  \
+@USE_OPENGL_TRUE@	effects/libgstopengl_la-gstgleffectxray.lo
+@HAVE_PNG_TRUE@@USE_OPENGL_TRUE@am__objects_2 = libgstopengl_la-gstgldifferencematte.lo
+@HAVE_GRAPHENE_TRUE@am__objects_3 =  \
 @HAVE_GRAPHENE_TRUE@	libgstopengl_la-gstgltransformation.lo
+@HAVE_JPEG_TRUE@@HAVE_PNG_TRUE@am__objects_4 = libgstopengl_la-gstgloverlay.lo
+@HAVE_WINDOW_COCOA_TRUE@am__objects_5 =  \
+@HAVE_WINDOW_COCOA_TRUE@	libgstopengl_la-caopengllayersink.lo
 am_libgstopengl_la_OBJECTS = libgstopengl_la-gstopengl.lo \
+	libgstopengl_la-gstglbasemixer.lo \
+	libgstopengl_la-gstgluploadelement.lo \
+	libgstopengl_la-gstgldownloadelement.lo \
+	libgstopengl_la-gstglcolorconvertelement.lo \
+	libgstopengl_la-gstglfilterbin.lo \
+	libgstopengl_la-gstglmixerbin.lo \
+	libgstopengl_la-gstglsinkbin.lo libgstopengl_la-gstglsrcbin.lo \
 	libgstopengl_la-gstglimagesink.lo \
 	libgstopengl_la-gstglfiltercube.lo \
 	libgstopengl_la-gstgleffects.lo \
@@ -238,16 +280,18 @@
 	libgstopengl_la-gstglcolorscale.lo \
 	libgstopengl_la-gstglmixer.lo \
 	libgstopengl_la-gstglvideomixer.lo \
-	libgstopengl_la-gstglfiltershader.lo $(am__objects_3) \
-	$(am__objects_4)
+	libgstopengl_la-gstglfiltershader.lo \
+	libgstopengl_la-gstglfilterapp.lo $(am__objects_1) \
+	$(am__objects_2) $(am__objects_3) $(am__objects_4) \
+	$(am__objects_5)
 libgstopengl_la_OBJECTS = $(am_libgstopengl_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstopengl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+libgstopengl_la_LINK = $(LIBTOOL) $(AM_V_lt) \
 	$(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(libgstopengl_la_CFLAGS) $(CFLAGS) \
+	$(OBJCLD) $(libgstopengl_la_OBJCFLAGS) $(OBJCFLAGS) \
 	$(libgstopengl_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -283,6 +327,24 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
+OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
+LTOBJCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_OBJCFLAGS) $(OBJCFLAGS)
+AM_V_OBJC = $(am__v_OBJC_@AM_V@)
+am__v_OBJC_ = $(am__v_OBJC_@AM_DEFAULT_V@)
+am__v_OBJC_0 = @echo "  OBJC    " $@;
+am__v_OBJC_1 = 
+OBJCLD = $(OBJC)
+OBJCLINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_OBJCLD = $(am__v_OBJCLD_@AM_V@)
+am__v_OBJCLD_ = $(am__v_OBJCLD_@AM_DEFAULT_V@)
+am__v_OBJCLD_0 = @echo "  OBJCLD  " $@;
+am__v_OBJCLD_1 = 
 SOURCES = $(libgstopengl_la_SOURCES)
 DIST_SOURCES = $(am__libgstopengl_la_SOURCES_DIST)
 am__can_run_installinfo = \
@@ -290,6 +352,18 @@
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+am__noinst_HEADERS_DIST = gstglbasemixer.h gstgluploadelement.h \
+	gstgldownloadelement.h gstglcolorconvertelement.h \
+	gstglfilterbin.h gstglmixerbin.h gstglsinkbin.h gstglsrcbin.h \
+	gstglimagesink.h gstglfiltercube.h gstgleffects.h \
+	effects/gstgleffectssources.h gstglcolorscale.h gstglmixer.h \
+	gstglvideomixer.h gstglfiltershader.h gstglfilterapp.h \
+	gstglfilterblur.h gstglfiltersobel.h gstglfilterlaplacian.h \
+	gstglfilterglass.h gstgldeinterlace.h gltestsrc.h \
+	gstgltestsrc.h gstglmosaic.h effects/gstgleffectscurves.h \
+	effects/gstgleffectlumatocurve.h gstgldifferencematte.h \
+	gstgloverlay.h caopengllayersink.h
+HEADERS = $(noinst_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -326,8 +400,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -366,7 +444,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -374,6 +451,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -423,8 +502,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -503,7 +580,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -512,7 +588,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -525,7 +600,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -550,6 +624,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -623,10 +699,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -652,6 +732,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -688,6 +771,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -728,17 +812,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -755,6 +838,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -807,43 +891,32 @@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
 plugin_LTLIBRARIES = libgstopengl.la
-AM_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-AM_LIBS = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS)
+libgstopengl_la_SOURCES = gstopengl.c gstglbasemixer.c \
+	gstgluploadelement.c gstgldownloadelement.c \
+	gstglcolorconvertelement.c gstglfilterbin.c gstglmixerbin.c \
+	gstglsinkbin.c gstglsrcbin.c gstglimagesink.c \
+	gstglfiltercube.c gstgleffects.c effects/gstgleffectssources.c \
+	effects/gstgleffectidentity.c effects/gstgleffectmirror.c \
+	effects/gstgleffectsqueeze.c gstglcolorscale.c gstglmixer.c \
+	gstglvideomixer.c gstglfiltershader.c gstglfilterapp.c \
+	$(am__append_1) $(am__append_3) $(am__append_5) \
+	$(am__append_6) $(am__append_8)
+noinst_HEADERS = gstglbasemixer.h gstgluploadelement.h \
+	gstgldownloadelement.h gstglcolorconvertelement.h \
+	gstglfilterbin.h gstglmixerbin.h gstglsinkbin.h gstglsrcbin.h \
+	gstglimagesink.h gstglfiltercube.h gstgleffects.h \
+	effects/gstgleffectssources.h gstglcolorscale.h gstglmixer.h \
+	gstglvideomixer.h gstglfiltershader.h gstglfilterapp.h \
+	$(am__append_2) $(am__append_4) $(am__append_7) \
+	$(am__append_9)
+libgstopengl_la_OBJCFLAGS = \
+	-I$(top_srcdir)/gst-libs \
+	-I$(top_builddir)/gst-libs \
+	$(GST_OBJCFLAGS) \
+	$(GST_BASE_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	$(GL_OBJCFLAGS)
 
-# full opengl required
-@USE_OPENGL_TRUE@OPENGL_SOURCES = gstglfilterblur.c gstglfilterblur.h \
-@USE_OPENGL_TRUE@	gstglfiltersobel.c gstglfiltersobel.h \
-@USE_OPENGL_TRUE@	gstglfilterlaplacian.c gstglfilterlaplacian.h \
-@USE_OPENGL_TRUE@	gstglfilterglass.c gstglfilterglass.h \
-@USE_OPENGL_TRUE@	gstglfilterapp.c gstglfilterapp.h \
-@USE_OPENGL_TRUE@	gstglfilterreflectedscreen.c \
-@USE_OPENGL_TRUE@	gstglfilterreflectedscreen.h \
-@USE_OPENGL_TRUE@	gstgldeinterlace.c gstgldeinterlace.h \
-@USE_OPENGL_TRUE@	gltestsrc.c gltestsrc.h gstgltestsrc.c \
-@USE_OPENGL_TRUE@	gstgltestsrc.h gstglmosaic.c gstglmosaic.h \
-@USE_OPENGL_TRUE@	effects/gstgleffectscurves.h \
-@USE_OPENGL_TRUE@	effects/gstgleffectstretch.c \
-@USE_OPENGL_TRUE@	effects/gstgleffecttunnel.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectfisheye.c \
-@USE_OPENGL_TRUE@	effects/gstgleffecttwirl.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectbulge.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectsquare.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectlumatocurve.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectlumatocurve.h \
-@USE_OPENGL_TRUE@	effects/gstgleffectrgbtocurve.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectsin.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectglow.c \
-@USE_OPENGL_TRUE@	effects/gstgleffectxray.c $(am__append_1) \
-@USE_OPENGL_TRUE@	$(am__append_2)
-libgstopengl_la_SOURCES = gstopengl.c gstglimagesink.c \
-	gstglimagesink.h gstglfiltercube.c gstglfiltercube.h \
-	gstgleffects.c gstgleffects.h effects/gstgleffectssources.c \
-	effects/gstgleffectssources.h effects/gstgleffectidentity.c \
-	effects/gstgleffectmirror.c effects/gstgleffectsqueeze.c \
-	gstglcolorscale.c gstglcolorscale.h gstglmixer.c gstglmixer.h \
-	gstglmixerpad.h gstglvideomixer.c gstglvideomixer.h \
-	gstglfiltershader.c gstglfiltershader.h $(OPENGL_SOURCES) \
-	$(am__append_3)
 
 # check order of CFLAGS and LIBS, shouldn't the order be the other way around
 # (like in AM_CFLAGS)?
@@ -871,11 +944,11 @@
 	$(GRAPHENE_LIBS)
 
 libgstopengl_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstopengl_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+libgstopengl_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) --tag=CC
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+.SUFFIXES: .c .lo .m .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -979,7 +1052,7 @@
 	effects/$(DEPDIR)/$(am__dirstamp)
 
 libgstopengl.la: $(libgstopengl_la_OBJECTS) $(libgstopengl_la_DEPENDENCIES) $(EXTRA_libgstopengl_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstopengl_la_LINK) -rpath $(plugindir) $(libgstopengl_la_OBJECTS) $(libgstopengl_la_LIBADD) $(LIBS)
+	$(AM_V_OBJCLD)$(libgstopengl_la_LINK) -rpath $(plugindir) $(libgstopengl_la_OBJECTS) $(libgstopengl_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -989,26 +1062,33 @@
 distclean-compile:
 	-rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-caopengllayersink.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gltestsrc.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglbumper.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglbasemixer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglcolorconvertelement.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglcolorscale.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgldeinterlace.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgldifferencematte.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgldownloadelement.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgleffects.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfilterapp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfilterbin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfilterblur.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfiltercube.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfilterglass.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfilterlaplacian.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfilterreflectedscreen.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfiltershader.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglfiltersobel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglimagesink.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglmixer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglmixerbin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglmosaic.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgloverlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglsinkbin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglsrcbin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgltestsrc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgltransformation.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstgluploadelement.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstglvideomixer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopengl_la-gstopengl.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/libgstopengl_la-gstgleffectbulge.Plo@am__quote@
@@ -1058,6 +1138,62 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstopengl.lo `test -f 'gstopengl.c' || echo '$(srcdir)/'`gstopengl.c
 
+libgstopengl_la-gstglbasemixer.lo: gstglbasemixer.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglbasemixer.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglbasemixer.Tpo -c -o libgstopengl_la-gstglbasemixer.lo `test -f 'gstglbasemixer.c' || echo '$(srcdir)/'`gstglbasemixer.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglbasemixer.Tpo $(DEPDIR)/libgstopengl_la-gstglbasemixer.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglbasemixer.c' object='libgstopengl_la-gstglbasemixer.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglbasemixer.lo `test -f 'gstglbasemixer.c' || echo '$(srcdir)/'`gstglbasemixer.c
+
+libgstopengl_la-gstgluploadelement.lo: gstgluploadelement.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstgluploadelement.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstgluploadelement.Tpo -c -o libgstopengl_la-gstgluploadelement.lo `test -f 'gstgluploadelement.c' || echo '$(srcdir)/'`gstgluploadelement.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstgluploadelement.Tpo $(DEPDIR)/libgstopengl_la-gstgluploadelement.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstgluploadelement.c' object='libgstopengl_la-gstgluploadelement.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstgluploadelement.lo `test -f 'gstgluploadelement.c' || echo '$(srcdir)/'`gstgluploadelement.c
+
+libgstopengl_la-gstgldownloadelement.lo: gstgldownloadelement.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstgldownloadelement.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstgldownloadelement.Tpo -c -o libgstopengl_la-gstgldownloadelement.lo `test -f 'gstgldownloadelement.c' || echo '$(srcdir)/'`gstgldownloadelement.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstgldownloadelement.Tpo $(DEPDIR)/libgstopengl_la-gstgldownloadelement.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstgldownloadelement.c' object='libgstopengl_la-gstgldownloadelement.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstgldownloadelement.lo `test -f 'gstgldownloadelement.c' || echo '$(srcdir)/'`gstgldownloadelement.c
+
+libgstopengl_la-gstglcolorconvertelement.lo: gstglcolorconvertelement.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglcolorconvertelement.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglcolorconvertelement.Tpo -c -o libgstopengl_la-gstglcolorconvertelement.lo `test -f 'gstglcolorconvertelement.c' || echo '$(srcdir)/'`gstglcolorconvertelement.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglcolorconvertelement.Tpo $(DEPDIR)/libgstopengl_la-gstglcolorconvertelement.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglcolorconvertelement.c' object='libgstopengl_la-gstglcolorconvertelement.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglcolorconvertelement.lo `test -f 'gstglcolorconvertelement.c' || echo '$(srcdir)/'`gstglcolorconvertelement.c
+
+libgstopengl_la-gstglfilterbin.lo: gstglfilterbin.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglfilterbin.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglfilterbin.Tpo -c -o libgstopengl_la-gstglfilterbin.lo `test -f 'gstglfilterbin.c' || echo '$(srcdir)/'`gstglfilterbin.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglfilterbin.Tpo $(DEPDIR)/libgstopengl_la-gstglfilterbin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglfilterbin.c' object='libgstopengl_la-gstglfilterbin.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglfilterbin.lo `test -f 'gstglfilterbin.c' || echo '$(srcdir)/'`gstglfilterbin.c
+
+libgstopengl_la-gstglmixerbin.lo: gstglmixerbin.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglmixerbin.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglmixerbin.Tpo -c -o libgstopengl_la-gstglmixerbin.lo `test -f 'gstglmixerbin.c' || echo '$(srcdir)/'`gstglmixerbin.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglmixerbin.Tpo $(DEPDIR)/libgstopengl_la-gstglmixerbin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglmixerbin.c' object='libgstopengl_la-gstglmixerbin.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglmixerbin.lo `test -f 'gstglmixerbin.c' || echo '$(srcdir)/'`gstglmixerbin.c
+
+libgstopengl_la-gstglsinkbin.lo: gstglsinkbin.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglsinkbin.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglsinkbin.Tpo -c -o libgstopengl_la-gstglsinkbin.lo `test -f 'gstglsinkbin.c' || echo '$(srcdir)/'`gstglsinkbin.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglsinkbin.Tpo $(DEPDIR)/libgstopengl_la-gstglsinkbin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglsinkbin.c' object='libgstopengl_la-gstglsinkbin.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglsinkbin.lo `test -f 'gstglsinkbin.c' || echo '$(srcdir)/'`gstglsinkbin.c
+
+libgstopengl_la-gstglsrcbin.lo: gstglsrcbin.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglsrcbin.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglsrcbin.Tpo -c -o libgstopengl_la-gstglsrcbin.lo `test -f 'gstglsrcbin.c' || echo '$(srcdir)/'`gstglsrcbin.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglsrcbin.Tpo $(DEPDIR)/libgstopengl_la-gstglsrcbin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglsrcbin.c' object='libgstopengl_la-gstglsrcbin.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglsrcbin.lo `test -f 'gstglsrcbin.c' || echo '$(srcdir)/'`gstglsrcbin.c
+
 libgstopengl_la-gstglimagesink.lo: gstglimagesink.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglimagesink.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglimagesink.Tpo -c -o libgstopengl_la-gstglimagesink.lo `test -f 'gstglimagesink.c' || echo '$(srcdir)/'`gstglimagesink.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglimagesink.Tpo $(DEPDIR)/libgstopengl_la-gstglimagesink.Plo
@@ -1135,6 +1271,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglfiltershader.lo `test -f 'gstglfiltershader.c' || echo '$(srcdir)/'`gstglfiltershader.c
 
+libgstopengl_la-gstglfilterapp.lo: gstglfilterapp.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglfilterapp.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglfilterapp.Tpo -c -o libgstopengl_la-gstglfilterapp.lo `test -f 'gstglfilterapp.c' || echo '$(srcdir)/'`gstglfilterapp.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglfilterapp.Tpo $(DEPDIR)/libgstopengl_la-gstglfilterapp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglfilterapp.c' object='libgstopengl_la-gstglfilterapp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglfilterapp.lo `test -f 'gstglfilterapp.c' || echo '$(srcdir)/'`gstglfilterapp.c
+
 libgstopengl_la-gstglfilterblur.lo: gstglfilterblur.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglfilterblur.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglfilterblur.Tpo -c -o libgstopengl_la-gstglfilterblur.lo `test -f 'gstglfilterblur.c' || echo '$(srcdir)/'`gstglfilterblur.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglfilterblur.Tpo $(DEPDIR)/libgstopengl_la-gstglfilterblur.Plo
@@ -1163,20 +1306,6 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglfilterglass.lo `test -f 'gstglfilterglass.c' || echo '$(srcdir)/'`gstglfilterglass.c
 
-libgstopengl_la-gstglfilterapp.lo: gstglfilterapp.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglfilterapp.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglfilterapp.Tpo -c -o libgstopengl_la-gstglfilterapp.lo `test -f 'gstglfilterapp.c' || echo '$(srcdir)/'`gstglfilterapp.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglfilterapp.Tpo $(DEPDIR)/libgstopengl_la-gstglfilterapp.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglfilterapp.c' object='libgstopengl_la-gstglfilterapp.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglfilterapp.lo `test -f 'gstglfilterapp.c' || echo '$(srcdir)/'`gstglfilterapp.c
-
-libgstopengl_la-gstglfilterreflectedscreen.lo: gstglfilterreflectedscreen.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglfilterreflectedscreen.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglfilterreflectedscreen.Tpo -c -o libgstopengl_la-gstglfilterreflectedscreen.lo `test -f 'gstglfilterreflectedscreen.c' || echo '$(srcdir)/'`gstglfilterreflectedscreen.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglfilterreflectedscreen.Tpo $(DEPDIR)/libgstopengl_la-gstglfilterreflectedscreen.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglfilterreflectedscreen.c' object='libgstopengl_la-gstglfilterreflectedscreen.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglfilterreflectedscreen.lo `test -f 'gstglfilterreflectedscreen.c' || echo '$(srcdir)/'`gstglfilterreflectedscreen.c
-
 libgstopengl_la-gstgldeinterlace.lo: gstgldeinterlace.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstgldeinterlace.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstgldeinterlace.Tpo -c -o libgstopengl_la-gstgldeinterlace.lo `test -f 'gstgldeinterlace.c' || echo '$(srcdir)/'`gstgldeinterlace.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstgldeinterlace.Tpo $(DEPDIR)/libgstopengl_la-gstgldeinterlace.Plo
@@ -1282,13 +1411,6 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o effects/libgstopengl_la-gstgleffectxray.lo `test -f 'effects/gstgleffectxray.c' || echo '$(srcdir)/'`effects/gstgleffectxray.c
 
-libgstopengl_la-gstglbumper.lo: gstglbumper.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstglbumper.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstglbumper.Tpo -c -o libgstopengl_la-gstglbumper.lo `test -f 'gstglbumper.c' || echo '$(srcdir)/'`gstglbumper.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstglbumper.Tpo $(DEPDIR)/libgstopengl_la-gstglbumper.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglbumper.c' object='libgstopengl_la-gstglbumper.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstglbumper.lo `test -f 'gstglbumper.c' || echo '$(srcdir)/'`gstglbumper.c
-
 libgstopengl_la-gstgldifferencematte.lo: gstgldifferencematte.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstgldifferencematte.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstgldifferencematte.Tpo -c -o libgstopengl_la-gstgldifferencematte.lo `test -f 'gstgldifferencematte.c' || echo '$(srcdir)/'`gstgldifferencematte.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstgldifferencematte.Tpo $(DEPDIR)/libgstopengl_la-gstgldifferencematte.Plo
@@ -1296,6 +1418,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstgldifferencematte.lo `test -f 'gstgldifferencematte.c' || echo '$(srcdir)/'`gstgldifferencematte.c
 
+libgstopengl_la-gstgltransformation.lo: gstgltransformation.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstgltransformation.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstgltransformation.Tpo -c -o libgstopengl_la-gstgltransformation.lo `test -f 'gstgltransformation.c' || echo '$(srcdir)/'`gstgltransformation.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstgltransformation.Tpo $(DEPDIR)/libgstopengl_la-gstgltransformation.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstgltransformation.c' object='libgstopengl_la-gstgltransformation.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstgltransformation.lo `test -f 'gstgltransformation.c' || echo '$(srcdir)/'`gstgltransformation.c
+
 libgstopengl_la-gstgloverlay.lo: gstgloverlay.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstgloverlay.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstgloverlay.Tpo -c -o libgstopengl_la-gstgloverlay.lo `test -f 'gstgloverlay.c' || echo '$(srcdir)/'`gstgloverlay.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstgloverlay.Tpo $(DEPDIR)/libgstopengl_la-gstgloverlay.Plo
@@ -1303,12 +1432,36 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstgloverlay.lo `test -f 'gstgloverlay.c' || echo '$(srcdir)/'`gstgloverlay.c
 
-libgstopengl_la-gstgltransformation.lo: gstgltransformation.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -MT libgstopengl_la-gstgltransformation.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-gstgltransformation.Tpo -c -o libgstopengl_la-gstgltransformation.lo `test -f 'gstgltransformation.c' || echo '$(srcdir)/'`gstgltransformation.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-gstgltransformation.Tpo $(DEPDIR)/libgstopengl_la-gstgltransformation.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstgltransformation.c' object='libgstopengl_la-gstgltransformation.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_CFLAGS) $(CFLAGS) -c -o libgstopengl_la-gstgltransformation.lo `test -f 'gstgltransformation.c' || echo '$(srcdir)/'`gstgltransformation.c
+.m.o:
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepOBJC_TRUE@	$(OBJCCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepOBJC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ $<
+
+.m.obj:
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepOBJC_TRUE@	$(OBJCCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepOBJC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.m.lo:
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepOBJC_TRUE@	$(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepOBJC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LTOBJCCOMPILE) -c -o $@ $<
+
+libgstopengl_la-caopengllayersink.lo: caopengllayersink.m
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(LIBTOOL) $(AM_V_lt) $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_OBJCFLAGS) $(OBJCFLAGS) -MT libgstopengl_la-caopengllayersink.lo -MD -MP -MF $(DEPDIR)/libgstopengl_la-caopengllayersink.Tpo -c -o libgstopengl_la-caopengllayersink.lo `test -f 'caopengllayersink.m' || echo '$(srcdir)/'`caopengllayersink.m
+@am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopengl_la-caopengllayersink.Tpo $(DEPDIR)/libgstopengl_la-caopengllayersink.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='caopengllayersink.m' object='libgstopengl_la-caopengllayersink.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstopengl_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopengl_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstopengl_la-caopengllayersink.lo `test -f 'caopengllayersink.m' || echo '$(srcdir)/'`caopengllayersink.m
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -1401,7 +1554,7 @@
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
 	for dir in "$(DESTDIR)$(plugindir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
diff --git a/ext/gl/caopengllayersink.h b/ext/gl/caopengllayersink.h
new file mode 100644
index 0000000..35a4cd2
--- /dev/null
+++ b/ext/gl/caopengllayersink.h
@@ -0,0 +1,97 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __CA_OPENGL_LAYER_SINK_H__
+#define __CA_OPENGL_LAYER_SINK_H__
+
+#include <gst/gst.h>
+#include <gst/video/gstvideosink.h>
+#include <gst/video/video.h>
+
+#include <gst/gl/gl.h>
+#include <gst/gl/cocoa/gstglcaopengllayer.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_CA_OPENGL_LAYER_SINK \
+    (gst_ca_opengl_layer_sink_get_type())
+#define GST_CA_OPENGL_LAYER_SINK(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CA_OPENGL_LAYER_SINK,GstCAOpenGLLayerSink))
+#define GST_CA_OPENGL_LAYER_SINK_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CA_OPENGL_LAYER_SINK,GstCAOpenGLLayerSinkClass))
+#define GST_IS_CA_OPENGL_LAYER_SINK(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CA_OPENGL_LAYER_SINK))
+#define GST_IS_CA_OPENGL_LAYER_SINK_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CA_OPENGL_LAYER_SINK))
+
+typedef struct _GstCAOpenGLLayerSink GstCAOpenGLLayerSink;
+typedef struct _GstCAOpenGLLayerSinkClass GstCAOpenGLLayerSinkClass;
+
+struct _GstCAOpenGLLayerSink
+{
+    GstVideoSink video_sink;
+
+    /* caps */
+    GstVideoInfo info;
+    GstCaps *gl_caps;
+
+    /* gl state */
+    GstGLDisplay *display;
+    GstGLContext *other_context;
+    GstGLContext *context;
+
+    guint      next_tex;
+    GstBuffer *next_buffer;
+
+    GstGLCAOpenGLLayer *layer;
+
+    volatile gint to_quit;
+    gboolean keep_aspect_ratio;
+
+    GstBufferPool *pool;
+
+    /* avoid replacing the stored_buffer while drawing */
+    GMutex drawing_lock;
+    GstBuffer *stored_buffer;
+    GLuint redisplay_texture;
+
+    gboolean caps_change;
+    guint window_width;
+    guint window_height;
+
+    /* gl state */
+    GstGLShader *redisplay_shader;
+    GLuint vao;
+    GLuint vertex_buffer;
+    GLint  attr_position;
+    GLint  attr_texture;
+};
+
+struct _GstCAOpenGLLayerSinkClass
+{
+    GstVideoSinkClass video_sink_class;
+};
+
+GType gst_ca_opengl_layer_sink_get_type(void);
+GType gst_ca_opengl_layer_sink_bin_get_type (void);
+
+G_END_DECLS
+
+#endif /* __CA_OPENGL_LAYER_SINK__ */
diff --git a/ext/gl/caopengllayersink.m b/ext/gl/caopengllayersink.m
new file mode 100644
index 0000000..3656099
--- /dev/null
+++ b/ext/gl/caopengllayersink.m
@@ -0,0 +1,1018 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:element-caopengllayersink
+ *
+ * caopengllayersink renders incoming video frames to CAOpenGLLayer that
+ * can be retreived through the layer property and placed in the Core
+ * Animation render tree.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "caopengllayersink.h"
+#include "gstglsinkbin.h"
+#include <QuartzCore/QuartzCore.h>
+
+GST_DEBUG_CATEGORY (gst_debug_ca_sink);
+#define GST_CAT_DEFAULT gst_debug_ca_sink
+
+typedef GstGLSinkBin GstCAOpenGLLayerSinkBin;
+typedef GstGLSinkBinClass GstCAOpenGLLayerSinkBinClass;
+
+G_DEFINE_TYPE (GstCAOpenGLLayerSinkBin, gst_ca_opengl_layer_sink_bin,
+    GST_TYPE_GL_SINK_BIN);
+
+enum
+{
+  PROP_BIN_0,
+  PROP_BIN_QOS,
+  PROP_BIN_FORCE_ASPECT_RATIO,
+  PROP_BIN_LAST_SAMPLE,
+  PROP_BIN_LAYER,
+};
+
+static void
+_on_notify_layer (GObject * object, GParamSpec *pspec, gpointer user_data)
+{
+  GstCAOpenGLLayerSinkBin *self = user_data;
+
+  g_object_notify (G_OBJECT (self), "layer");
+}
+
+static void
+gst_ca_opengl_layer_sink_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * param_spec)
+{
+  g_object_set_property (G_OBJECT (GST_GL_SINK_BIN (object)->sink),
+      param_spec->name, value);
+}
+
+static void
+gst_ca_opengl_layer_sink_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * param_spec)
+{
+  g_object_get_property (G_OBJECT (GST_GL_SINK_BIN (object)->sink),
+      param_spec->name, value);
+}
+
+static void
+gst_ca_opengl_layer_sink_bin_init (GstCAOpenGLLayerSinkBin * self)
+{
+  GstGLCAOpenGLLayer *sink = g_object_new (GST_TYPE_CA_OPENGL_LAYER_SINK, NULL);
+
+  g_signal_connect (sink, "notify::layer", G_CALLBACK (_on_notify_layer), self);
+
+  gst_gl_sink_bin_finish_init_with_element (GST_GL_SINK_BIN (self),
+      GST_ELEMENT (sink));
+}
+
+static void
+gst_ca_opengl_layer_sink_bin_class_init (GstCAOpenGLLayerSinkBinClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->get_property = gst_ca_opengl_layer_sink_bin_get_property;
+  gobject_class->set_property = gst_ca_opengl_layer_sink_bin_set_property;
+
+  g_object_class_install_property (gobject_class, PROP_BIN_FORCE_ASPECT_RATIO,
+      g_param_spec_boolean ("force-aspect-ratio",
+          "Force aspect ratio",
+          "When enabled, scaling will respect original aspect ratio", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_BIN_LAST_SAMPLE,
+      g_param_spec_boxed ("last-sample", "Last Sample",
+          "The last sample received in the sink", GST_TYPE_SAMPLE,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_BIN_LAYER,
+      g_param_spec_pointer ("layer", "CAOpenGLLayer",
+          "OpenGL Core Animation layer",
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_BIN_QOS,
+      g_param_spec_boolean ("qos", "Quality of Service",
+          "Generate Quality-of-Service events upstream", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+#define GST_CA_OPENGL_LAYER_SINK_GET_LOCK(glsink) \
+  (GST_CA_OPENGL_LAYER_SINK(glsink)->drawing_lock)
+#define GST_CA_OPENGL_LAYER_SINK_LOCK(glsink) \
+  (g_mutex_lock(&GST_CA_OPENGL_LAYER_SINK_GET_LOCK (glsink)))
+#define GST_CA_OPENGL_LAYER_SINK_UNLOCK(glsink) \
+  (g_mutex_unlock(&GST_CA_OPENGL_LAYER_SINK_GET_LOCK (glsink)))
+
+#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
+#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
+#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
+#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
+#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
+
+#define SUPPORTED_GL_APIS GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3
+
+static void gst_ca_opengl_layer_sink_thread_init_redisplay (GstCAOpenGLLayerSink * ca_sink);
+static void gst_ca_opengl_layer_sink_cleanup_glthread (GstCAOpenGLLayerSink * ca_sink);
+static void gst_ca_opengl_layer_sink_on_resize (GstCAOpenGLLayerSink * ca_sink,
+    gint width, gint height);
+static void gst_ca_opengl_layer_sink_on_draw (GstCAOpenGLLayerSink * ca_sink);
+
+static void gst_ca_opengl_layer_sink_finalize (GObject * object);
+static void gst_ca_opengl_layer_sink_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * param_spec);
+static void gst_ca_opengl_layer_sink_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * param_spec);
+
+static gboolean gst_ca_opengl_layer_sink_stop (GstBaseSink * bsink);
+
+static gboolean gst_ca_opengl_layer_sink_query (GstBaseSink * bsink, GstQuery * query);
+static void gst_ca_opengl_layer_sink_set_context (GstElement * element,
+    GstContext * context);
+
+static GstStateChangeReturn gst_ca_opengl_layer_sink_change_state (GstElement *
+    element, GstStateChange transition);
+
+static void gst_ca_opengl_layer_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
+    GstClockTime * start, GstClockTime * end);
+static gboolean gst_ca_opengl_layer_sink_set_caps (GstBaseSink * bsink, GstCaps * caps);
+static GstFlowReturn gst_ca_opengl_layer_sink_prepare (GstBaseSink * bsink,
+    GstBuffer * buf);
+static GstFlowReturn gst_ca_opengl_layer_sink_show_frame (GstVideoSink * bsink,
+    GstBuffer * buf);
+static gboolean gst_ca_opengl_layer_sink_propose_allocation (GstBaseSink * bsink,
+    GstQuery * query);
+
+static GstStaticPadTemplate gst_ca_opengl_layer_sink_template =
+    GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
+        (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
+            "RGBA"))
+    );
+
+enum
+{
+  PROP_0,
+  PROP_FORCE_ASPECT_RATIO,
+  PROP_CONTEXT,
+  PROP_LAYER,
+};
+
+#define gst_ca_opengl_layer_sink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstCAOpenGLLayerSink, gst_ca_opengl_layer_sink,
+    GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT (gst_debug_ca_sink,
+        "caopengllayersink", 0, "CAOpenGLLayer Video Sink"));
+
+static void
+gst_ca_opengl_layer_sink_class_init (GstCAOpenGLLayerSinkClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+  GstBaseSinkClass *gstbasesink_class;
+  GstVideoSinkClass *gstvideosink_class;
+  GstElementClass *element_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+  gstbasesink_class = (GstBaseSinkClass *) klass;
+  gstvideosink_class = (GstVideoSinkClass *) klass;
+  element_class = GST_ELEMENT_CLASS (klass);
+
+  gobject_class->set_property = gst_ca_opengl_layer_sink_set_property;
+  gobject_class->get_property = gst_ca_opengl_layer_sink_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
+      g_param_spec_boolean ("force-aspect-ratio",
+          "Force aspect ratio",
+          "When enabled, scaling will respect original aspect ratio", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_CONTEXT,
+      g_param_spec_object ("context",
+          "OpenGL context",
+          "Get OpenGL context",
+          GST_GL_TYPE_CONTEXT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_LAYER,
+      g_param_spec_pointer ("layer", "CAOpenGLLayer",
+          "OpenGL Core Animation layer",
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  gst_element_class_set_metadata (element_class, "CAOpenGLLayer video sink",
+      "Sink/Video", "A video sink based on CAOpenGLLayer",
+      "Matthew Waters <matthew@centricular.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_ca_opengl_layer_sink_template));
+
+  gobject_class->finalize = gst_ca_opengl_layer_sink_finalize;
+
+  gstelement_class->change_state = gst_ca_opengl_layer_sink_change_state;
+  gstelement_class->set_context = gst_ca_opengl_layer_sink_set_context;
+  gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_ca_opengl_layer_sink_query);
+  gstbasesink_class->set_caps = gst_ca_opengl_layer_sink_set_caps;
+  gstbasesink_class->get_times = gst_ca_opengl_layer_sink_get_times;
+  gstbasesink_class->prepare = gst_ca_opengl_layer_sink_prepare;
+  gstbasesink_class->propose_allocation = gst_ca_opengl_layer_sink_propose_allocation;
+  gstbasesink_class->stop = gst_ca_opengl_layer_sink_stop;
+
+  gstvideosink_class->show_frame =
+      GST_DEBUG_FUNCPTR (gst_ca_opengl_layer_sink_show_frame);
+}
+
+static void
+gst_ca_opengl_layer_sink_init (GstCAOpenGLLayerSink * ca_sink)
+{
+  ca_sink->display = NULL;
+  ca_sink->keep_aspect_ratio = TRUE;
+  ca_sink->pool = NULL;
+  ca_sink->stored_buffer = NULL;
+  ca_sink->redisplay_texture = 0;
+
+  g_mutex_init (&ca_sink->drawing_lock);
+}
+
+static void
+gst_ca_opengl_layer_sink_finalize (GObject * object)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+
+  g_return_if_fail (GST_IS_CA_OPENGL_LAYER_SINK (object));
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (object);
+
+  g_mutex_clear (&ca_sink->drawing_lock);
+
+  GST_DEBUG ("finalized");
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_ca_opengl_layer_sink_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+
+  g_return_if_fail (GST_IS_CA_OPENGL_LAYER_SINK (object));
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (object);
+
+  switch (prop_id) {
+    case PROP_FORCE_ASPECT_RATIO:
+    {
+      ca_sink->keep_aspect_ratio = g_value_get_boolean (value);
+      break;
+    }
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_ca_opengl_layer_sink_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+
+  g_return_if_fail (GST_IS_CA_OPENGL_LAYER_SINK (object));
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (object);
+
+  switch (prop_id) {
+    case PROP_FORCE_ASPECT_RATIO:
+      g_value_set_boolean (value, ca_sink->keep_aspect_ratio);
+      break;
+    case PROP_CONTEXT:
+      g_value_set_object (value, ca_sink->context);
+      break;
+    case PROP_LAYER:
+      g_value_set_pointer (value, ca_sink->layer);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+_create_layer (gpointer data)
+{
+  GstCAOpenGLLayerSink *ca_sink = data;
+
+  if (!ca_sink->layer) {
+    ca_sink->layer = [[NSClassFromString(@"GstGLCAOpenGLLayer") alloc]
+        initWithGstGLContext:GST_GL_CONTEXT_COCOA (ca_sink->context)];
+    [ca_sink->layer setDrawCallback:(GstGLWindowCB)gst_ca_opengl_layer_sink_on_draw
+        data:ca_sink notify:NULL];
+    [ca_sink->layer setResizeCallback:(GstGLWindowResizeCB)gst_ca_opengl_layer_sink_on_resize
+        data:ca_sink notify:NULL];
+    g_object_notify (G_OBJECT (ca_sink), "layer");
+  }
+}
+
+static void
+_invoke_on_main (GstGLWindowCB func, gpointer data)
+{
+  if ([NSThread isMainThread]) {
+    func (data);
+  } else {
+    dispatch_sync (dispatch_get_main_queue (), ^{
+      func (data);
+    });
+  }
+}
+
+static gboolean
+_ensure_gl_setup (GstCAOpenGLLayerSink * ca_sink)
+{
+  GError *error = NULL;
+
+  if (!gst_gl_ensure_element_data (ca_sink, &ca_sink->display,
+          &ca_sink->other_context))
+    return FALSE;
+
+  gst_gl_display_filter_gl_api (ca_sink->display, SUPPORTED_GL_APIS);
+
+  if (!ca_sink->context) {
+    ca_sink->context = gst_gl_context_new (ca_sink->display);
+    if (!ca_sink->context)
+      goto context_creation_error;
+
+    if (!gst_gl_context_create (ca_sink->context, ca_sink->other_context,
+            &error)) {
+      goto context_error;
+    }
+  }
+
+  if (!ca_sink->layer)
+    _invoke_on_main ((GstGLWindowCB) _create_layer, ca_sink);
+
+  return TRUE;
+
+context_creation_error:
+  {
+    GST_ELEMENT_ERROR (ca_sink, RESOURCE, NOT_FOUND,
+        ("Failed to create GL context"), (NULL));
+    return FALSE;
+  }
+
+context_error:
+  {
+    GST_ELEMENT_ERROR (ca_sink, RESOURCE, NOT_FOUND, ("%s", error->message),
+        (NULL));
+    gst_object_unref (ca_sink->context);
+    ca_sink->context = NULL;
+    return FALSE;
+  }
+}
+
+static gboolean
+gst_ca_opengl_layer_sink_query (GstBaseSink * bsink, GstQuery * query)
+{
+  GstCAOpenGLLayerSink *ca_sink = GST_CA_OPENGL_LAYER_SINK (bsink);
+  gboolean res = FALSE;
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_CONTEXT:
+    {
+      const gchar *context_type;
+      GstContext *context, *old_context;
+      gboolean ret;
+
+      ret =
+          gst_gl_handle_context_query ((GstElement *) ca_sink, query,
+          &ca_sink->display, &ca_sink->other_context);
+      if (ca_sink->display)
+        gst_gl_display_filter_gl_api (ca_sink->display, SUPPORTED_GL_APIS);
+
+      gst_query_parse_context_type (query, &context_type);
+
+      if (g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
+        GstStructure *s;
+
+        gst_query_parse_context (query, &old_context);
+
+        if (old_context)
+          context = gst_context_copy (old_context);
+        else
+          context = gst_context_new ("gst.gl.local_context", FALSE);
+
+        s = gst_context_writable_structure (context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT,
+            ca_sink->context, NULL);
+        gst_query_set_context (query, context);
+        gst_context_unref (context);
+
+        ret = ca_sink->context != NULL;
+      }
+      GST_DEBUG_OBJECT (ca_sink, "context query of type %s %i",
+          context_type, ret);
+
+      if (ret)
+        return ret;
+    }
+    case GST_QUERY_DRAIN:
+    {
+      GstBuffer *buf = NULL;
+
+      GST_CA_OPENGL_LAYER_SINK_LOCK (ca_sink);
+      ca_sink->redisplay_texture = 0;
+      buf = ca_sink->stored_buffer;
+      ca_sink->stored_buffer = NULL;
+      GST_CA_OPENGL_LAYER_SINK_UNLOCK (ca_sink);
+
+      if (buf)
+        gst_buffer_unref (buf);
+
+      gst_buffer_replace (&ca_sink->next_buffer, NULL);
+
+      res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
+      break;
+    }
+    default:
+      break;
+  }
+
+  return GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
+}
+
+static gboolean
+gst_ca_opengl_layer_sink_stop (GstBaseSink * bsink)
+{
+  GstCAOpenGLLayerSink *ca_sink = GST_CA_OPENGL_LAYER_SINK (bsink);
+
+  if (ca_sink->pool) {
+    gst_object_unref (ca_sink->pool);
+    ca_sink->pool = NULL;
+  }
+
+  if (ca_sink->gl_caps) {
+    gst_caps_unref (ca_sink->gl_caps);
+    ca_sink->gl_caps = NULL;
+  }
+
+  return TRUE;
+}
+
+static void
+gst_ca_opengl_layer_sink_set_context (GstElement * element, GstContext * context)
+{
+  GstCAOpenGLLayerSink *ca_sink = GST_CA_OPENGL_LAYER_SINK (element);
+
+  gst_gl_handle_set_context (element, context, &ca_sink->display,
+      &ca_sink->other_context);
+
+  if (ca_sink->display)
+    gst_gl_display_filter_gl_api (ca_sink->display, SUPPORTED_GL_APIS);
+}
+
+static GstStateChangeReturn
+gst_ca_opengl_layer_sink_change_state (GstElement * element, GstStateChange transition)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+
+  GST_DEBUG ("changing state: %s => %s",
+      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
+      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (element);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      _ensure_gl_setup (ca_sink);
+      break;
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      g_atomic_int_set (&ca_sink->to_quit, 0);
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      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_PLAYING_TO_PAUSED:
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+    {
+      /* mark the redisplay_texture as unavailable (=0)
+       * to avoid drawing
+       */
+      GST_CA_OPENGL_LAYER_SINK_LOCK (ca_sink);
+      ca_sink->redisplay_texture = 0;
+      if (ca_sink->stored_buffer) {
+        gst_buffer_unref (ca_sink->stored_buffer);
+        ca_sink->stored_buffer = NULL;
+      }
+      GST_CA_OPENGL_LAYER_SINK_UNLOCK (ca_sink);
+      gst_buffer_replace (&ca_sink->next_buffer, NULL);
+
+      if (ca_sink->pool) {
+        gst_buffer_pool_set_active (ca_sink->pool, FALSE);
+        gst_object_unref (ca_sink->pool);
+        ca_sink->pool = NULL;
+      }
+
+      GST_VIDEO_SINK_WIDTH (ca_sink) = 1;
+      GST_VIDEO_SINK_HEIGHT (ca_sink) = 1;
+      if (ca_sink->context) {
+        gst_object_unref (ca_sink->context);
+        ca_sink->context = NULL;
+      }
+
+      if (ca_sink->display) {
+        gst_object_unref (ca_sink->display);
+        ca_sink->display = NULL;
+      }
+      break;
+    }
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      break;
+    default:
+      break;
+  }
+
+  return ret;
+}
+
+static void
+gst_ca_opengl_layer_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
+    GstClockTime * start, GstClockTime * end)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (bsink);
+
+  if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+    *start = GST_BUFFER_TIMESTAMP (buf);
+    if (GST_BUFFER_DURATION_IS_VALID (buf))
+      *end = *start + GST_BUFFER_DURATION (buf);
+    else {
+      if (GST_VIDEO_INFO_FPS_N (&ca_sink->info) > 0) {
+        *end = *start +
+            gst_util_uint64_scale_int (GST_SECOND,
+            GST_VIDEO_INFO_FPS_D (&ca_sink->info),
+            GST_VIDEO_INFO_FPS_N (&ca_sink->info));
+      }
+    }
+  }
+}
+
+static gboolean
+gst_ca_opengl_layer_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+  gint width;
+  gint height;
+  gboolean ok;
+  gint par_n, par_d;
+  gint display_par_n, display_par_d;
+  guint display_ratio_num, display_ratio_den;
+  GstVideoInfo vinfo;
+
+  GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps);
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (bsink);
+
+  ok = gst_video_info_from_caps (&vinfo, caps);
+  if (!ok)
+    return FALSE;
+
+  width = GST_VIDEO_INFO_WIDTH (&vinfo);
+  height = GST_VIDEO_INFO_HEIGHT (&vinfo);
+
+  par_n = GST_VIDEO_INFO_PAR_N (&vinfo);
+  par_d = GST_VIDEO_INFO_PAR_D (&vinfo);
+
+  if (!par_n)
+    par_n = 1;
+
+  display_par_n = 1;
+  display_par_d = 1;
+
+  ok = gst_video_calculate_display_ratio (&display_ratio_num,
+      &display_ratio_den, width, height, par_n, par_d, display_par_n,
+      display_par_d);
+
+  if (!ok)
+    return FALSE;
+
+  GST_TRACE ("PAR: %u/%u DAR:%u/%u", par_n, par_d, display_par_n,
+      display_par_d);
+
+  if (height % display_ratio_den == 0) {
+    GST_DEBUG ("keeping video height");
+    GST_VIDEO_SINK_WIDTH (ca_sink) = (guint)
+        gst_util_uint64_scale_int (height, display_ratio_num,
+        display_ratio_den);
+    GST_VIDEO_SINK_HEIGHT (ca_sink) = height;
+  } else if (width % display_ratio_num == 0) {
+    GST_DEBUG ("keeping video width");
+    GST_VIDEO_SINK_WIDTH (ca_sink) = width;
+    GST_VIDEO_SINK_HEIGHT (ca_sink) = (guint)
+        gst_util_uint64_scale_int (width, display_ratio_den, display_ratio_num);
+  } else {
+    GST_DEBUG ("approximating while keeping video height");
+    GST_VIDEO_SINK_WIDTH (ca_sink) = (guint)
+        gst_util_uint64_scale_int (height, display_ratio_num,
+        display_ratio_den);
+    GST_VIDEO_SINK_HEIGHT (ca_sink) = height;
+  }
+  GST_DEBUG ("scaling to %dx%d", GST_VIDEO_SINK_WIDTH (ca_sink),
+      GST_VIDEO_SINK_HEIGHT (ca_sink));
+
+  ca_sink->info = vinfo;
+  if (!_ensure_gl_setup (ca_sink))
+    return FALSE;
+
+  ca_sink->caps_change = TRUE;
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_ca_opengl_layer_sink_prepare (GstBaseSink * bsink, GstBuffer * buf)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+  GstVideoFrame gl_frame;
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (bsink);
+
+  GST_TRACE ("preparing buffer:%p", buf);
+
+  if (GST_VIDEO_SINK_WIDTH (ca_sink) < 1 ||
+      GST_VIDEO_SINK_HEIGHT (ca_sink) < 1) {
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+
+  if (!_ensure_gl_setup (ca_sink))
+    return GST_FLOW_NOT_NEGOTIATED;
+
+  if (!gst_video_frame_map (&gl_frame, &ca_sink->info, buf,
+          GST_MAP_READ | GST_MAP_GL)) {
+    goto upload_failed;
+  }
+
+  ca_sink->next_tex = *(guint *) gl_frame.data[0];
+
+  gst_buffer_replace (&ca_sink->next_buffer, buf);
+
+  gst_video_frame_unmap (&gl_frame);
+
+  return GST_FLOW_OK;
+
+upload_failed:
+  {
+    GST_ELEMENT_ERROR (ca_sink, RESOURCE, NOT_FOUND,
+        ("%s", "Failed to upload buffer"), (NULL));
+    return GST_FLOW_ERROR;
+  }
+}
+
+static GstFlowReturn
+gst_ca_opengl_layer_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
+{
+  GstCAOpenGLLayerSink *ca_sink;
+  GstBuffer *stored_buffer;
+
+  GST_TRACE ("rendering buffer:%p", buf);
+
+  ca_sink = GST_CA_OPENGL_LAYER_SINK (vsink);
+
+  GST_TRACE ("redisplay texture:%u of size:%ux%u, window size:%ux%u",
+      ca_sink->next_tex, GST_VIDEO_INFO_WIDTH (&ca_sink->info),
+      GST_VIDEO_INFO_HEIGHT (&ca_sink->info),
+      GST_VIDEO_SINK_WIDTH (ca_sink),
+      GST_VIDEO_SINK_HEIGHT (ca_sink));
+
+  /* Avoid to release the texture while drawing */
+  GST_CA_OPENGL_LAYER_SINK_LOCK (ca_sink);
+  ca_sink->redisplay_texture = ca_sink->next_tex;
+  stored_buffer = ca_sink->stored_buffer;
+  ca_sink->stored_buffer = gst_buffer_ref (ca_sink->next_buffer);
+  GST_CA_OPENGL_LAYER_SINK_UNLOCK (ca_sink);
+
+  /* The layer will automatically call the draw callback to draw the new
+   * content */
+  [CATransaction begin];
+  [ca_sink->layer setNeedsDisplay];
+  [CATransaction commit];
+
+  GST_TRACE ("post redisplay");
+
+  if (stored_buffer)
+    gst_buffer_unref (stored_buffer);
+
+  if (g_atomic_int_get (&ca_sink->to_quit) != 0) {
+    GST_ELEMENT_ERROR (ca_sink, RESOURCE, NOT_FOUND,
+        ("%s", gst_gl_context_get_error ()), (NULL));
+    return GST_FLOW_ERROR;
+  }
+
+  return GST_FLOW_OK;
+}
+
+static gboolean
+gst_ca_opengl_layer_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
+{
+  GstCAOpenGLLayerSink *ca_sink = GST_CA_OPENGL_LAYER_SINK (bsink);
+  GstStructure *config;
+  GstCaps *caps;
+  guint size;
+  gboolean need_pool;
+
+  if (!_ensure_gl_setup (ca_sink))
+    return FALSE;
+
+  gst_query_parse_allocation (query, &caps, &need_pool);
+
+  if (caps == NULL)
+    goto no_caps;
+
+  if (need_pool) {
+    GstVideoInfo info;
+
+    if (!gst_video_info_from_caps (&info, caps))
+      goto invalid_caps;
+
+    /* the normal size of a frame */
+    size = info.size;
+
+    if (ca_sink->pool) {
+      GstCaps *pcaps;
+
+      /* we had a pool, check caps */
+      GST_DEBUG_OBJECT (ca_sink, "check existing pool caps");
+      config = gst_buffer_pool_get_config (ca_sink->pool);
+      gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
+
+      if (!gst_caps_is_equal (caps, pcaps)) {
+        GST_DEBUG_OBJECT (ca_sink, "pool has different caps");
+        /* different caps, we can't use this pool */
+        gst_object_unref (ca_sink->pool);
+        ca_sink->pool = NULL;
+      }
+      gst_structure_free (config);
+    }
+
+    if (ca_sink->pool == NULL) {
+      GST_DEBUG_OBJECT (ca_sink, "create new pool");
+
+      ca_sink->pool = gst_gl_buffer_pool_new (ca_sink->context);
+      config = gst_buffer_pool_get_config (ca_sink->pool);
+      gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
+
+      if (!gst_buffer_pool_set_config (ca_sink->pool, config))
+        goto config_failed;
+    }
+
+    /* we need at least 2 buffer because we hold on to the last one */
+    gst_query_add_allocation_pool (query, ca_sink->pool, size, 2, 0);
+  }
+
+  if (ca_sink->context->gl_vtable->FenceSync)
+    gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
+
+  return TRUE;
+
+  /* ERRORS */
+no_caps:
+  {
+    GST_DEBUG_OBJECT (bsink, "no caps specified");
+    return FALSE;
+  }
+invalid_caps:
+  {
+    GST_DEBUG_OBJECT (bsink, "invalid caps specified");
+    return FALSE;
+  }
+config_failed:
+  {
+    GST_DEBUG_OBJECT (bsink, "failed setting config");
+    return FALSE;
+  }
+}
+
+/* *INDENT-OFF* */
+static const GLfloat vertices[] = {
+     1.0f,  1.0f, 0.0f, 1.0f, 0.0f,
+    -1.0f,  1.0f, 0.0f, 0.0f, 0.0f,
+    -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
+     1.0f, -1.0f, 0.0f, 1.0f, 1.0f
+};
+/* *INDENT-ON* */
+
+static void
+_bind_buffer (GstCAOpenGLLayerSink * ca_sink)
+{
+  const GstGLFuncs *gl = ca_sink->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, ca_sink->vertex_buffer);
+  gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
+      GL_STATIC_DRAW);
+
+  /* Load the vertex position */
+  gl->VertexAttribPointer (ca_sink->attr_position, 3, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) 0);
+
+  /* Load the texture coordinate */
+  gl->VertexAttribPointer (ca_sink->attr_texture, 2, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
+
+  gl->EnableVertexAttribArray (ca_sink->attr_position);
+  gl->EnableVertexAttribArray (ca_sink->attr_texture);
+}
+
+static void
+_unbind_buffer (GstCAOpenGLLayerSink * ca_sink)
+{
+  const GstGLFuncs *gl = ca_sink->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  gl->DisableVertexAttribArray (ca_sink->attr_position);
+  gl->DisableVertexAttribArray (ca_sink->attr_texture);
+}
+
+/* Called in the gl thread */
+static void
+gst_ca_opengl_layer_sink_thread_init_redisplay (GstCAOpenGLLayerSink * ca_sink)
+{
+  const GstGLFuncs *gl = ca_sink->context->gl_vtable;
+
+  ca_sink->redisplay_shader = gst_gl_shader_new (ca_sink->context);
+
+  if (!gst_gl_shader_compile_with_default_vf_and_check
+      (ca_sink->redisplay_shader, &ca_sink->attr_position,
+          &ca_sink->attr_texture))
+    gst_ca_opengl_layer_sink_cleanup_glthread (ca_sink);
+
+  if (gl->GenVertexArrays) {
+    gl->GenVertexArrays (1, &ca_sink->vao);
+    gl->BindVertexArray (ca_sink->vao);
+  }
+
+  gl->GenBuffers (1, &ca_sink->vertex_buffer);
+  _bind_buffer (ca_sink);
+
+  if (gl->GenVertexArrays) {
+    gl->BindVertexArray (0);
+    gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+  } else {
+    _unbind_buffer (ca_sink);
+  }
+}
+
+static void
+gst_ca_opengl_layer_sink_cleanup_glthread (GstCAOpenGLLayerSink * ca_sink)
+{
+  const GstGLFuncs *gl = ca_sink->context->gl_vtable;
+
+  if (ca_sink->redisplay_shader) {
+    gst_object_unref (ca_sink->redisplay_shader);
+    ca_sink->redisplay_shader = NULL;
+  }
+
+  if (ca_sink->vao) {
+    gl->DeleteVertexArrays (1, &ca_sink->vao);
+    ca_sink->vao = 0;
+  }
+}
+
+static void
+gst_ca_opengl_layer_sink_on_resize (GstCAOpenGLLayerSink * ca_sink, gint width, gint height)
+{
+  /* Here ca_sink members (ex:ca_sink->info) have a life time of set_caps.
+   * It means that they cannot not change between two set_caps
+   */
+  const GstGLFuncs *gl = ca_sink->context->gl_vtable;
+
+  GST_TRACE ("GL Window resized to %ux%u", width, height);
+
+  width = MAX (1, width);
+  height = MAX (1, height);
+
+  ca_sink->window_width = width;
+  ca_sink->window_height = height;
+
+  /* default reshape */
+  if (ca_sink->keep_aspect_ratio) {
+    GstVideoRectangle src, dst, result;
+
+    src.x = 0;
+    src.y = 0;
+    src.w = GST_VIDEO_SINK_WIDTH (ca_sink);
+    src.h = GST_VIDEO_SINK_HEIGHT (ca_sink);
+
+    dst.x = 0;
+    dst.y = 0;
+    dst.w = width;
+    dst.h = height;
+
+    gst_video_sink_center_rect (src, dst, &result, TRUE);
+    gl->Viewport (result.x, result.y, result.w, result.h);
+  } else {
+    gl->Viewport (0, 0, width, height);
+  }
+}
+
+static void
+gst_ca_opengl_layer_sink_on_draw (GstCAOpenGLLayerSink * ca_sink)
+{
+  /* Here ca_sink members (ex:ca_sink->info) have a life time of set_caps.
+   * It means that they cannot not change between two set_caps as well as
+   * for the redisplay_texture size.
+   * Whereas redisplay_texture id changes every sink_render
+   */
+
+  const GstGLFuncs *gl = NULL;
+  GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+  g_return_if_fail (GST_IS_CA_OPENGL_LAYER_SINK (ca_sink));
+
+  gl = ca_sink->context->gl_vtable;
+
+  GST_CA_OPENGL_LAYER_SINK_LOCK (ca_sink);
+
+  if (G_UNLIKELY (!ca_sink->redisplay_shader)) {
+    gst_ca_opengl_layer_sink_thread_init_redisplay (ca_sink);
+  }
+
+  /* check if texture is ready for being drawn */
+  if (!ca_sink->redisplay_texture) {
+    gl->ClearColor (0.0f, 0.0f, 0.0f, 1.0f);
+    gl->Clear (GL_COLOR_BUFFER_BIT);
+    GST_CA_OPENGL_LAYER_SINK_UNLOCK (ca_sink);
+    return;
+  }
+
+  /* opengl scene */
+  GST_TRACE ("redrawing texture:%u", ca_sink->redisplay_texture);
+
+  if (ca_sink->caps_change) {
+    GST_CA_OPENGL_LAYER_SINK_UNLOCK (ca_sink);
+    gst_ca_opengl_layer_sink_on_resize (ca_sink, ca_sink->window_width,
+        ca_sink->window_height);
+    GST_CA_OPENGL_LAYER_SINK_LOCK (ca_sink);
+    ca_sink->caps_change = TRUE;
+  }
+
+#if GST_GL_HAVE_OPENGL
+  if (USING_OPENGL (ca_sink->context))
+    gl->Disable (GL_TEXTURE_2D);
+#endif
+
+  gl->BindTexture (GL_TEXTURE_2D, 0);
+
+  gl->ClearColor (0.0, 0.0, 0.0, 0.0);
+  gl->Clear (GL_COLOR_BUFFER_BIT);
+
+  gst_gl_shader_use (ca_sink->redisplay_shader);
+
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (ca_sink->vao);
+  else
+    _bind_buffer (ca_sink);
+
+  gl->ActiveTexture (GL_TEXTURE0);
+  gl->BindTexture (GL_TEXTURE_2D, ca_sink->redisplay_texture);
+  gst_gl_shader_set_uniform_1i (ca_sink->redisplay_shader, "tex", 0);
+
+  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (0);
+  else
+    _unbind_buffer (ca_sink);
+
+  /* end default opengl scene */
+  GST_CA_OPENGL_LAYER_SINK_UNLOCK (ca_sink);
+}
diff --git a/ext/gl/effects/gstgleffectbulge.c b/ext/gl/effects/gstgleffectbulge.c
index a59f276..75b9e2f 100644
--- a/ext/gl/effects/gstgleffectbulge.c
+++ b/ext/gl/effects/gstgleffectbulge.c
@@ -30,7 +30,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "bulge0");
diff --git a/ext/gl/effects/gstgleffectfisheye.c b/ext/gl/effects/gstgleffectfisheye.c
index 80456ff..524b659 100644
--- a/ext/gl/effects/gstgleffectfisheye.c
+++ b/ext/gl/effects/gstgleffectfisheye.c
@@ -30,7 +30,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "fisheye0");
diff --git a/ext/gl/effects/gstgleffectglow.c b/ext/gl/effects/gstgleffectglow.c
index c3adeeb..4853fd9 100644
--- a/ext/gl/effects/gstgleffectglow.c
+++ b/ext/gl/effects/gstgleffectglow.c
@@ -33,7 +33,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "glow0");
@@ -73,7 +73,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "glow1");
@@ -120,7 +120,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "glow2");
@@ -162,7 +162,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "glow3");
diff --git a/ext/gl/effects/gstgleffectidentity.c b/ext/gl/effects/gstgleffectidentity.c
index 5cf06e0..eec357e 100644
--- a/ext/gl/effects/gstgleffectidentity.c
+++ b/ext/gl/effects/gstgleffectidentity.c
@@ -35,7 +35,7 @@
 {
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
 #if GST_GL_HAVE_OPENGL
@@ -44,8 +44,7 @@
     gl->LoadIdentity ();
   }
 #endif
-#if GST_GL_HAVE_GLES2
-  if (USING_GLES2 (context)) {
+  if (USING_GLES2 (context) || USING_OPENGL3 (context)) {
     GstGLShader *shader =
         g_hash_table_lookup (effects->shaderstable, "identity0");
 
@@ -67,12 +66,10 @@
     gst_gl_shader_use (shader);
 
     gl->ActiveTexture (GL_TEXTURE0);
-    gl->Enable (GL_TEXTURE_2D);
     gl->BindTexture (GL_TEXTURE_2D, texture);
 
     gst_gl_shader_set_uniform_1i (shader, "tex", 0);
   }
-#endif
 
   gst_gl_filter_draw_texture (filter, texture, width, height);
 }
diff --git a/ext/gl/effects/gstgleffectlumatocurve.c b/ext/gl/effects/gstgleffectlumatocurve.c
index 643e34b..2ce1de3 100644
--- a/ext/gl/effects/gstgleffectlumatocurve.c
+++ b/ext/gl/effects/gstgleffectlumatocurve.c
@@ -31,7 +31,7 @@
 {
   GstGLShader *shader;
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "lumamap0");
diff --git a/ext/gl/effects/gstgleffectmirror.c b/ext/gl/effects/gstgleffectmirror.c
index 35f87e1..1713d54 100644
--- a/ext/gl/effects/gstgleffectmirror.c
+++ b/ext/gl/effects/gstgleffectmirror.c
@@ -36,7 +36,7 @@
   GstGLShader *shader;
   GstGLFilter *filter = GST_GL_FILTER (data);
   GstGLEffects *effects = GST_GL_EFFECTS (filter);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "mirror0");
@@ -45,8 +45,7 @@
     shader = gst_gl_shader_new (context);
     g_hash_table_insert (effects->shaderstable, (gchar *) "mirror0", shader);
 
-#if GST_GL_HAVE_GLES2
-    if (USING_GLES2 (context)) {
+    if (USING_GLES2 (context) || USING_OPENGL3 (context)) {
       if (!gst_gl_shader_compile_with_default_v_and_check (shader,
               mirror_fragment_source_gles2, &filter->draw_attr_position_loc,
               &filter->draw_attr_texture_loc)) {
@@ -57,7 +56,6 @@
         return;
       }
     }
-#endif
 #if GST_GL_HAVE_OPENGL
     if (USING_OPENGL (context)) {
       if (!gst_gl_shader_compile_and_check (shader,
@@ -82,18 +80,12 @@
   gst_gl_shader_use (shader);
 
   gl->ActiveTexture (GL_TEXTURE0);
-  gl->Enable (GL_TEXTURE_2D);
+  if (USING_OPENGL (context))
+    gl->Enable (GL_TEXTURE_2D);
   gl->BindTexture (GL_TEXTURE_2D, texture);
 
   gst_gl_shader_set_uniform_1i (shader, "tex", 0);
 
-#if GST_GL_HAVE_OPENGL
-  if (USING_OPENGL (filter->context)) {
-    gst_gl_shader_set_uniform_1f (shader, "width", (gfloat) width / 2.0f);
-    gst_gl_shader_set_uniform_1f (shader, "height", (gfloat) height / 2.0f);
-  }
-#endif
-
   gst_gl_filter_draw_texture (filter, texture, width, height);
 }
 
diff --git a/ext/gl/effects/gstgleffectrgbtocurve.c b/ext/gl/effects/gstgleffectrgbtocurve.c
index 3e4dda6..18b0905 100644
--- a/ext/gl/effects/gstgleffectrgbtocurve.c
+++ b/ext/gl/effects/gstgleffectrgbtocurve.c
@@ -31,7 +31,7 @@
 {
   GstGLShader *shader;
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "rgbmap0");
diff --git a/ext/gl/effects/gstgleffectsin.c b/ext/gl/effects/gstgleffectsin.c
index 2a6c051..8d6be54 100644
--- a/ext/gl/effects/gstgleffectsin.c
+++ b/ext/gl/effects/gstgleffectsin.c
@@ -30,7 +30,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "sin0");
diff --git a/ext/gl/effects/gstgleffectsquare.c b/ext/gl/effects/gstgleffectsquare.c
index 7b4271e..b1619c0 100644
--- a/ext/gl/effects/gstgleffectsquare.c
+++ b/ext/gl/effects/gstgleffectsquare.c
@@ -30,7 +30,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "square0");
diff --git a/ext/gl/effects/gstgleffectsqueeze.c b/ext/gl/effects/gstgleffectsqueeze.c
index 421ef27..863157a 100644
--- a/ext/gl/effects/gstgleffectsqueeze.c
+++ b/ext/gl/effects/gstgleffectsqueeze.c
@@ -36,7 +36,7 @@
   GstGLShader *shader;
   GstGLFilter *filter = GST_GL_FILTER (data);
   GstGLEffects *effects = GST_GL_EFFECTS (data);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "squeeze0");
@@ -45,8 +45,7 @@
     shader = gst_gl_shader_new (context);
     g_hash_table_insert (effects->shaderstable, (gchar *) "squeeze0", shader);
 
-#if GST_GL_HAVE_GLES2
-    if (USING_GLES2 (context)) {
+    if (USING_GLES2 (context) || USING_OPENGL3 (context)) {
       if (!gst_gl_shader_compile_with_default_v_and_check (shader,
               squeeze_fragment_source_gles2, &filter->draw_attr_position_loc,
               &filter->draw_attr_texture_loc)) {
@@ -57,7 +56,6 @@
         return;
       }
     }
-#endif
 #if GST_GL_HAVE_OPENGL
     if (USING_OPENGL (context)) {
       if (!gst_gl_shader_compile_and_check (shader,
@@ -81,18 +79,12 @@
   gst_gl_shader_use (shader);
 
   gl->ActiveTexture (GL_TEXTURE0);
-  gl->Enable (GL_TEXTURE_2D);
+  if (USING_OPENGL (context))
+    gl->Enable (GL_TEXTURE_2D);
   gl->BindTexture (GL_TEXTURE_2D, texture);
 
   gst_gl_shader_set_uniform_1i (shader, "tex", 0);
 
-#if GST_GL_HAVE_OPENGL
-  if (USING_OPENGL (filter->context)) {
-    gst_gl_shader_set_uniform_1f (shader, "width", (gfloat) width / 2.0f);
-    gst_gl_shader_set_uniform_1f (shader, "height", (gfloat) height / 2.0f);
-  }
-#endif
-
   gst_gl_filter_draw_texture (filter, texture, width, height);
 }
 
diff --git a/ext/gl/effects/gstgleffectssources.c b/ext/gl/effects/gstgleffectssources.c
index 0b4d2d6..3786503 100644
--- a/ext/gl/effects/gstgleffectssources.c
+++ b/ext/gl/effects/gstgleffectssources.c
@@ -78,19 +78,19 @@
   "  gl_FragColor = color * gl_Color;"
   "}";
 #endif
-#if GST_GL_HAVE_GLES2
 const gchar *mirror_fragment_source_gles2 =
-  "precision mediump float;"
-  "varying vec2 v_texCoord;"
+  "#ifdef GL_ES\n"
+  "precision mediump float;\n"
+  "#endif\n"
+  "varying vec2 v_texcoord;"
   "uniform sampler2D tex;"
   "void main () {"
-  "  vec2 texturecoord = v_texCoord.xy;"
+  "  vec2 texturecoord = v_texcoord.xy;"
   "  float normcoord = texturecoord.x - 0.5;"
   "  normcoord *= sign (normcoord);"
   "  texturecoord.x = normcoord + 0.5;"
   "  gl_FragColor = texture2D (tex, texturecoord);"
   "}";
-#endif
 
 /* Squeeze effect */
 #if GST_GL_HAVE_OPENGL
@@ -106,13 +106,14 @@
   "  gl_FragColor = texture2D (tex, texturecoord);"
   "}";
 #endif
-#if GST_GL_HAVE_GLES2
 const gchar *squeeze_fragment_source_gles2 =
-  "precision mediump float;"
-  "varying vec2 v_texCoord;"
+  "#ifdef GL_ES\n"
+  "precision mediump float;\n"
+  "#endif\n"
+  "varying vec2 v_texcoord;"
   "uniform sampler2D tex;"
   "void main () {"
-  "  vec2 texturecoord = v_texCoord.xy;"
+  "  vec2 texturecoord = v_texcoord.xy;"
   "  vec2 normcoord = texturecoord - 0.5;"
   "  float r = length (normcoord);"
   "  r = pow(r, 0.40)*1.3;"
@@ -120,7 +121,6 @@
   "  texturecoord = (normcoord + 0.5);"
   "  gl_FragColor = texture2D (tex, texturecoord);"
   "}";
-#endif
 
 /* Stretch Effect */
 const gchar *stretch_fragment_source =
diff --git a/ext/gl/effects/gstgleffectssources.h b/ext/gl/effects/gstgleffectssources.h
index 68a6f57..76f0b5e 100644
--- a/ext/gl/effects/gstgleffectssources.h
+++ b/ext/gl/effects/gstgleffectssources.h
@@ -25,10 +25,10 @@
 extern const gchar *mirror_fragment_source_opengl;
 extern const gchar *squeeze_fragment_source_opengl;
 #endif
-#if GST_GL_HAVE_GLES2
+
 extern const gchar *mirror_fragment_source_gles2;
 extern const gchar *squeeze_fragment_source_gles2;
-#endif
+
 extern const gchar *stretch_fragment_source;
 extern const gchar *tunnel_fragment_source;
 extern const gchar *fisheye_fragment_source;
diff --git a/ext/gl/effects/gstgleffectstretch.c b/ext/gl/effects/gstgleffectstretch.c
index 859f64e..206a097 100644
--- a/ext/gl/effects/gstgleffectstretch.c
+++ b/ext/gl/effects/gstgleffectstretch.c
@@ -30,7 +30,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "stretch0");
diff --git a/ext/gl/effects/gstgleffecttunnel.c b/ext/gl/effects/gstgleffecttunnel.c
index 479434a..b547436 100644
--- a/ext/gl/effects/gstgleffecttunnel.c
+++ b/ext/gl/effects/gstgleffecttunnel.c
@@ -30,7 +30,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "tunnel0");
diff --git a/ext/gl/effects/gstgleffecttwirl.c b/ext/gl/effects/gstgleffecttwirl.c
index 4a6d749..3a9b374 100644
--- a/ext/gl/effects/gstgleffecttwirl.c
+++ b/ext/gl/effects/gstgleffecttwirl.c
@@ -30,13 +30,13 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "twirl0");
 
   if (!shader) {
-    shader = gst_gl_shader_new (GST_GL_FILTER (effects)->context);
+    shader = gst_gl_shader_new (context);
     g_hash_table_insert (effects->shaderstable, (gchar *) "twirl0", shader);
   }
 
diff --git a/ext/gl/effects/gstgleffectxray.c b/ext/gl/effects/gstgleffectxray.c
index 6657a9b..79aeca1 100644
--- a/ext/gl/effects/gstgleffectxray.c
+++ b/ext/gl/effects/gstgleffectxray.c
@@ -45,7 +45,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "xray1");
@@ -92,7 +92,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "xray2");
@@ -135,7 +135,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "xray_desat");
@@ -175,7 +175,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_hconv");
@@ -218,7 +218,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_vconv");
@@ -261,7 +261,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_len");
@@ -305,7 +305,7 @@
   GstGLShader *shader;
   GstGLEffects *effects = GST_GL_EFFECTS (data);
   GstGLFilter *filter = GST_GL_FILTER (effects);
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   shader = g_hash_table_lookup (effects->shaderstable, "xray4");
diff --git a/ext/gl/gltestsrc.c b/ext/gl/gltestsrc.c
index db28017..d5e75aa 100644
--- a/ext/gl/gltestsrc.c
+++ b/ext/gl/gltestsrc.c
@@ -188,30 +188,81 @@
 #endif
 }
 
+/* *INDENT-OFF* */
+
+static const GLfloat positions[] = {
+     -1.0,  1.0,  0.0, 1.0,
+      1.0,  1.0,  0.0, 1.0,
+      1.0, -1.0,  0.0, 1.0,
+     -1.0, -1.0,  0.0, 1.0,
+  };
+static const GLfloat identitiy_matrix[] = {
+      1.0,  0.0,  0.0, 0.0,
+      0.0,  1.0,  0.0, 0.0,
+      0.0,  0.0,  1.0, 0.0,
+      0.0,  0.0,  0.0, 1.0,
+  };
+
+/* *INDENT-ON* */
+
 void
-gst_gl_test_src_snow (GstGLTestSrc * v, GstBuffer * buffer, int w, int h)
+gst_gl_test_src_shader (GstGLTestSrc * v, GstBuffer * buffer, int w, int h)
 {
-#if GST_GL_HAVE_OPENGL
-  if (gst_gl_context_get_gl_api (v->context) & GST_GL_API_OPENGL) {
-    glClearColor (0.0, 0.0, 0.0, 1.0);
-    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-    glMatrixMode (GL_PROJECTION);
-    glLoadIdentity ();
+  GstGLFuncs *gl = v->context->gl_vtable;
 
-    glMatrixMode (GL_MODELVIEW);
-    glLoadIdentity ();
+/* *INDENT-OFF* */
+  const GLfloat uvs[] = {
+     0.0,  1.0,
+     1.0,  1.0,
+     1.0,  0.0,
+     0.0,  0.0,
+  };
+/* *INDENT-ON* */
 
-    /* FIXME snow requires a fragment shader.  Please write. */
-    glColor4f (0.5, 0.5, 0.5, 1.0);
-    glBegin (GL_QUADS);
-    glVertex3f (-1.0 + 2.0 * (0.0), -1.0 + 2.0 * 1, 0);
-    glVertex3f (-1.0 + 2.0 * (1.0), -1.0 + 2.0 * 1, 0);
-    glVertex3f (-1.0 + 2.0 * (1.0), -1.0 + 2.0 * (0.0), 0);
-    glVertex3f (-1.0 + 2.0 * (0.0), -1.0 + 2.0 * (0.0), 0);
-    glEnd ();
+  GLushort indices[] = { 0, 1, 2, 3, 0 };
+
+  GLint attr_position_loc = -1;
+  GLint attr_uv_loc = -1;
+
+  if (gst_gl_context_get_gl_api (v->context)) {
+
+    gst_gl_context_clear_shader (v->context);
+    gl->BindTexture (GL_TEXTURE_2D, 0);
+    gl->Disable (GL_TEXTURE_2D);
+
+    gst_gl_shader_use (v->shader);
+
+    attr_position_loc =
+        gst_gl_shader_get_attribute_location (v->shader, "position");
+
+    attr_uv_loc = gst_gl_shader_get_attribute_location (v->shader, "uv");
+
+    /* Load the vertex position */
+    gl->VertexAttribPointer (attr_position_loc, 4, GL_FLOAT,
+        GL_FALSE, 0, positions);
+    /* Load the texture coordinate */
+    gl->VertexAttribPointer (attr_uv_loc, 2, GL_FLOAT, GL_FALSE, 0, uvs);
+
+    gl->EnableVertexAttribArray (attr_position_loc);
+    gl->EnableVertexAttribArray (attr_uv_loc);
+
+    gst_gl_shader_set_uniform_matrix_4fv (v->shader, "mvp",
+        1, GL_FALSE, identitiy_matrix);
+
+    gst_gl_shader_set_uniform_1f (v->shader, "time",
+        (gfloat) v->running_time / GST_SECOND);
+
+    gst_gl_shader_set_uniform_1f (v->shader, "aspect_ratio",
+        (gfloat) w / (gfloat) h);
+
+    gl->DrawElements (GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, indices);
+
+    gl->DisableVertexAttribArray (attr_position_loc);
+    gl->DisableVertexAttribArray (attr_uv_loc);
+
+    gst_gl_context_clear_shader (v->context);
   }
-#endif
 }
 
 static void
@@ -257,168 +308,71 @@
   gst_gl_test_src_unicolor (v, buffer, w, h, vts_colors + COLOR_BLUE);
 }
 
+static void
+gst_gl_test_src_checkers (GstGLTestSrc * v, gint checker_width)
+{
+
+  GstGLFuncs *gl = v->context->gl_vtable;
+
+  GLushort indices[] = { 0, 1, 2, 3, 0 };
+
+  GLint attr_position_loc = -1;
+
+  if (gst_gl_context_get_gl_api (v->context)) {
+
+    gst_gl_context_clear_shader (v->context);
+    gl->BindTexture (GL_TEXTURE_2D, 0);
+    gl->Disable (GL_TEXTURE_2D);
+
+    gst_gl_shader_use (v->shader);
+
+    attr_position_loc =
+        gst_gl_shader_get_attribute_location (v->shader, "position");
+
+    /* Load the vertex position */
+    gl->VertexAttribPointer (attr_position_loc, 4, GL_FLOAT,
+        GL_FALSE, 0, positions);
+
+    gl->EnableVertexAttribArray (attr_position_loc);
+
+    gst_gl_shader_set_uniform_matrix_4fv (v->shader, "mvp",
+        1, GL_FALSE, identitiy_matrix);
+
+    gst_gl_shader_set_uniform_1f (v->shader, "checker_width", checker_width);
+
+    gl->DrawElements (GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, indices);
+
+    gl->DisableVertexAttribArray (attr_position_loc);
+
+    gst_gl_context_clear_shader (v->context);
+  }
+}
+
+
 void
 gst_gl_test_src_checkers1 (GstGLTestSrc * v, GstBuffer * buffer, int w, int h)
 {
-#if 0
-  int x, y;
-  paintinfo pi = { NULL, };
-  paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
-
-  p->width = w;
-  p->height = h;
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
-    return;
-
-  fourcc->paint_setup (p, dest);
-  p->paint_hline = fourcc->paint_hline;
-
-  for (y = 0; y < h; y++) {
-    p->color = vts_colors + COLOR_GREEN;
-    p->paint_hline (p, 0, y, w);
-    for (x = (y % 2); x < w; x += 2) {
-      p->color = vts_colors + COLOR_RED;
-      p->paint_hline (p, x, y, 1);
-    }
-  }
-#endif
+  gst_gl_test_src_checkers (v, 1);
 }
 
+
 void
 gst_gl_test_src_checkers2 (GstGLTestSrc * v, GstBuffer * buffer, int w, int h)
 {
-#if 0
-  int x, y;
-  paintinfo pi = { NULL, };
-  paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
-
-  p->width = w;
-  p->height = h;
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
-    return;
-
-  fourcc->paint_setup (p, dest);
-  p->paint_hline = fourcc->paint_hline;
-
-  p->color = vts_colors + COLOR_GREEN;
-  for (y = 0; y < h; y++) {
-    p->paint_hline (p, 0, y, w);
-  }
-
-  for (y = 0; y < h; y += 2) {
-    for (x = ((y % 4) == 0) ? 0 : 2; x < w; x += 4) {
-      guint len = (x < (w - 1)) ? 2 : (w - x);
-
-      p->color = vts_colors + COLOR_RED;
-      p->paint_hline (p, x, y + 0, len);
-      if (G_LIKELY ((y + 1) < h)) {
-        p->paint_hline (p, x, y + 1, len);
-      }
-    }
-  }
-#endif
+  gst_gl_test_src_checkers (v, 2);
 }
 
 void
 gst_gl_test_src_checkers4 (GstGLTestSrc * v, GstBuffer * buffer, int w, int h)
 {
-#if 0
-  int x, y;
-  paintinfo pi = { NULL, };
-  paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
+  gst_gl_test_src_checkers (v, 4);
 
-  p->width = w;
-  p->height = h;
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
-    return;
-
-  fourcc->paint_setup (p, dest);
-  p->paint_hline = fourcc->paint_hline;
-
-  p->color = vts_colors + COLOR_GREEN;
-  for (y = 0; y < h; y++) {
-    p->paint_hline (p, 0, y, w);
-  }
-
-  for (y = 0; y < h; y += 4) {
-    for (x = ((y % 8) == 0) ? 0 : 4; x < w; x += 8) {
-      guint len = (x < (w - 3)) ? 4 : (w - x);
-
-      p->color = vts_colors + COLOR_RED;
-      p->paint_hline (p, x, y + 0, len);
-      if (G_LIKELY ((y + 1) < h)) {
-        p->paint_hline (p, x, y + 1, len);
-        if (G_LIKELY ((y + 2) < h)) {
-          p->paint_hline (p, x, y + 2, len);
-          if (G_LIKELY ((y + 3) < h)) {
-            p->paint_hline (p, x, y + 3, len);
-          }
-        }
-      }
-    }
-  }
-#endif
 }
 
 void
 gst_gl_test_src_checkers8 (GstGLTestSrc * v, GstBuffer * buffer, int w, int h)
 {
-#if 0
-  int x, y;
-  paintinfo pi = { NULL, };
-  paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
-
-  p->width = w;
-  p->height = h;
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
-    return;
-
-  fourcc->paint_setup (p, dest);
-  p->paint_hline = fourcc->paint_hline;
-
-  p->color = vts_colors + COLOR_GREEN;
-  for (y = 0; y < h; y++) {
-    p->paint_hline (p, 0, y, w);
-  }
-
-  for (y = 0; y < h; y += 8) {
-    for (x = ((GST_ROUND_UP_8 (y) % 16) == 0) ? 0 : 8; x < w; x += 16) {
-      guint len = (x < (w - 7)) ? 8 : (w - x);
-
-      p->color = vts_colors + COLOR_RED;
-      p->paint_hline (p, x, y + 0, len);
-      if (G_LIKELY ((y + 1) < h)) {
-        p->paint_hline (p, x, y + 1, len);
-        if (G_LIKELY ((y + 2) < h)) {
-          p->paint_hline (p, x, y + 2, len);
-          if (G_LIKELY ((y + 3) < h)) {
-            p->paint_hline (p, x, y + 3, len);
-            if (G_LIKELY ((y + 4) < h)) {
-              p->paint_hline (p, x, y + 4, len);
-              if (G_LIKELY ((y + 5) < h)) {
-                p->paint_hline (p, x, y + 5, len);
-                if (G_LIKELY ((y + 6) < h)) {
-                  p->paint_hline (p, x, y + 6, len);
-                  if (G_LIKELY ((y + 7) < h)) {
-                    p->paint_hline (p, x, y + 7, len);
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-#endif
+  gst_gl_test_src_checkers (v, 8);
 }
 
 void
diff --git a/ext/gl/gltestsrc.h b/ext/gl/gltestsrc.h
index f79ffee..102109e 100644
--- a/ext/gl/gltestsrc.h
+++ b/ext/gl/gltestsrc.h
@@ -32,7 +32,7 @@
 
 void    gst_gl_test_src_smpte        (GstGLTestSrc * v,
                                          GstBuffer *buffer, int w, int h);
-void    gst_gl_test_src_snow         (GstGLTestSrc * v,
+void    gst_gl_test_src_shader       (GstGLTestSrc * v,
                                          GstBuffer *buffer, int w, int h);
 void    gst_gl_test_src_black        (GstGLTestSrc * v,
                                          GstBuffer *buffer, int w, int h);
diff --git a/ext/gl/gstglbasemixer.c b/ext/gl/gstglbasemixer.c
new file mode 100644
index 0000000..f2eaa2f
--- /dev/null
+++ b/ext/gl/gstglbasemixer.c
@@ -0,0 +1,732 @@
+/* Generic video mixer plugin
+ *
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+#include "gstglbasemixer.h"
+
+#define gst_gl_base_mixer_parent_class parent_class
+G_DEFINE_ABSTRACT_TYPE (GstGLBaseMixer, gst_gl_base_mixer,
+    GST_TYPE_VIDEO_AGGREGATOR);
+static gboolean gst_gl_base_mixer_do_bufferpool (GstGLBaseMixer * mix,
+    GstCaps * outcaps);
+
+#define GST_CAT_DEFAULT gst_gl_base_mixer_debug
+GST_DEBUG_CATEGORY (gst_gl_base_mixer_debug);
+
+static void gst_gl_base_mixer_pad_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void gst_gl_base_mixer_pad_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_gl_base_mixer_pad_finalize (GObject * object);
+
+static void gst_gl_base_mixer_set_context (GstElement * element,
+    GstContext * context);
+static GstStateChangeReturn gst_gl_base_mixer_change_state (GstElement *
+    element, GstStateChange transition);
+
+enum
+{
+  PROP_PAD_0
+};
+
+#define GST_GL_BASE_MIXER_GET_PRIVATE(obj)  \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_GL_BASE_MIXER, GstGLBaseMixerPrivate))
+
+struct _GstGLBaseMixerPrivate
+{
+  gboolean negotiated;
+
+  GstGLContext *other_context;
+
+  GstBufferPool *pool;
+  GstAllocator *allocator;
+  GstAllocationParams params;
+  GstQuery *query;
+};
+
+G_DEFINE_TYPE (GstGLBaseMixerPad, gst_gl_base_mixer_pad,
+    GST_TYPE_VIDEO_AGGREGATOR_PAD);
+
+static void
+gst_gl_base_mixer_pad_class_init (GstGLBaseMixerPadClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstVideoAggregatorPadClass *vaggpad_class =
+      (GstVideoAggregatorPadClass *) klass;
+
+  gobject_class->set_property = gst_gl_base_mixer_pad_set_property;
+  gobject_class->get_property = gst_gl_base_mixer_pad_get_property;
+
+  gobject_class->finalize = gst_gl_base_mixer_pad_finalize;
+
+  vaggpad_class->set_info = NULL;
+  vaggpad_class->prepare_frame = NULL;
+  vaggpad_class->clean_frame = NULL;
+}
+
+static void
+gst_gl_base_mixer_pad_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (gst_gl_base_mixer_pad_parent_class)->finalize (object);
+}
+
+static void
+gst_gl_base_mixer_pad_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  switch (prop_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_gl_base_mixer_pad_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  switch (prop_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+_negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps)
+{
+  GstGLBaseMixer *mix = GST_GL_BASE_MIXER (vagg);
+
+  return gst_gl_base_mixer_do_bufferpool (mix, caps);
+}
+
+static gboolean
+_default_propose_allocation (GstGLBaseMixer * mix, GstGLBaseMixerPad * pad,
+    GstQuery * decide_query, GstQuery * query)
+{
+  return TRUE;
+}
+
+static gboolean
+gst_gl_base_mixer_sink_query (GstAggregator * agg, GstAggregatorPad * bpad,
+    GstQuery * query)
+{
+  gboolean ret = FALSE;
+  GstGLBaseMixer *mix = GST_GL_BASE_MIXER (agg);
+  GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
+  GstGLBaseMixerPad *pad = GST_GL_BASE_MIXER_PAD (bpad);
+
+  GST_TRACE ("QUERY %" GST_PTR_FORMAT, query);
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_ALLOCATION:
+    {
+      GstQuery *decide_query = NULL;
+
+      GST_OBJECT_LOCK (mix);
+      if (G_UNLIKELY (!mix->priv->negotiated)) {
+        GST_DEBUG_OBJECT (mix,
+            "not negotiated yet, can't answer ALLOCATION query");
+        GST_OBJECT_UNLOCK (mix);
+        return FALSE;
+      }
+      if ((decide_query = mix->priv->query))
+        gst_query_ref (decide_query);
+      GST_OBJECT_UNLOCK (mix);
+
+      GST_DEBUG_OBJECT (mix,
+          "calling propose allocation with query %" GST_PTR_FORMAT,
+          decide_query);
+
+      /* pass the query to the propose_allocation vmethod if any */
+      if (mix_class->propose_allocation)
+        ret = mix_class->propose_allocation (mix, pad, decide_query, query);
+      else
+        ret = FALSE;
+
+      if (decide_query)
+        gst_query_unref (decide_query);
+
+      GST_DEBUG_OBJECT (mix, "ALLOCATION ret %d, %" GST_PTR_FORMAT, ret, query);
+      return ret;
+    }
+    case GST_QUERY_CONTEXT:
+    {
+      const gchar *context_type;
+      GstContext *context, *old_context;
+
+      ret = gst_gl_handle_context_query ((GstElement *) mix, query,
+          &mix->display, &mix->priv->other_context);
+      if (mix->display)
+        gst_gl_display_filter_gl_api (mix->display,
+            mix_class->supported_gl_api);
+      gst_query_parse_context_type (query, &context_type);
+
+      if (g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
+        GstStructure *s;
+
+        gst_query_parse_context (query, &old_context);
+
+        if (old_context)
+          context = gst_context_copy (old_context);
+        else
+          context = gst_context_new ("gst.gl.local_context", FALSE);
+
+        s = gst_context_writable_structure (context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, mix->context,
+            NULL);
+        gst_query_set_context (query, context);
+        gst_context_unref (context);
+
+        ret = mix->context != NULL;
+      }
+      GST_LOG_OBJECT (mix, "context query of type %s %i", context_type, ret);
+
+      if (ret)
+        return ret;
+
+      break;
+    }
+    default:
+      break;
+  }
+
+  return GST_AGGREGATOR_CLASS (parent_class)->sink_query (agg, bpad, query);;
+}
+
+static void
+gst_gl_base_mixer_pad_init (GstGLBaseMixerPad * mixerpad)
+{
+}
+
+/* GLBaseMixer signals and args */
+enum
+{
+  /* FILL ME */
+  LAST_SIGNAL
+};
+
+enum
+{
+  PROP_0,
+  PROP_CONTEXT
+};
+
+static gboolean gst_gl_base_mixer_src_query (GstAggregator * agg,
+    GstQuery * query);
+
+static gboolean
+gst_gl_base_mixer_src_activate_mode (GstAggregator * aggregator,
+    GstPadMode mode, gboolean active);
+static gboolean gst_gl_base_mixer_stop (GstAggregator * agg);
+static gboolean gst_gl_base_mixer_start (GstAggregator * agg);
+
+static void gst_gl_base_mixer_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_gl_base_mixer_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+static gboolean gst_gl_base_mixer_decide_allocation (GstGLBaseMixer * mix,
+    GstQuery * query);
+static gboolean gst_gl_base_mixer_set_allocation (GstGLBaseMixer * mix,
+    GstBufferPool * pool, GstAllocator * allocator,
+    GstAllocationParams * params, GstQuery * query);
+
+static void gst_gl_base_mixer_finalize (GObject * object);
+
+static void
+gst_gl_base_mixer_class_init (GstGLBaseMixerClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+
+  GstVideoAggregatorClass *videoaggregator_class =
+      (GstVideoAggregatorClass *) klass;
+  GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
+
+  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glmixer", 0, "opengl mixer");
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = GST_ELEMENT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstGLBaseMixerPrivate));
+
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_gl_base_mixer_finalize);
+
+  gobject_class->get_property = gst_gl_base_mixer_get_property;
+  gobject_class->set_property = gst_gl_base_mixer_set_property;
+
+  element_class->set_context =
+      GST_DEBUG_FUNCPTR (gst_gl_base_mixer_set_context);
+  element_class->change_state = gst_gl_base_mixer_change_state;
+
+  agg_class->sinkpads_type = GST_TYPE_GL_BASE_MIXER_PAD;
+  agg_class->sink_query = gst_gl_base_mixer_sink_query;
+  agg_class->src_query = gst_gl_base_mixer_src_query;
+  agg_class->src_activate = gst_gl_base_mixer_src_activate_mode;
+  agg_class->stop = gst_gl_base_mixer_stop;
+  agg_class->start = gst_gl_base_mixer_start;
+
+  videoaggregator_class->negotiated_caps = _negotiated_caps;
+
+  klass->propose_allocation = _default_propose_allocation;
+
+  g_object_class_install_property (gobject_class, PROP_CONTEXT,
+      g_param_spec_object ("context",
+          "OpenGL context",
+          "Get OpenGL context",
+          GST_GL_TYPE_CONTEXT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  /* Register the pad class */
+  g_type_class_ref (GST_TYPE_GL_BASE_MIXER_PAD);
+
+  klass->supported_gl_api = GST_GL_API_ANY;
+}
+
+static void
+gst_gl_base_mixer_reset (GstGLBaseMixer * mix)
+{
+  /* clean up collect data */
+  mix->priv->negotiated = FALSE;
+}
+
+static void
+gst_gl_base_mixer_init (GstGLBaseMixer * mix)
+{
+  mix->priv = GST_GL_BASE_MIXER_GET_PRIVATE (mix);
+
+  gst_gl_base_mixer_reset (mix);
+}
+
+static void
+gst_gl_base_mixer_finalize (GObject * object)
+{
+  GstGLBaseMixer *mix = GST_GL_BASE_MIXER (object);
+
+  if (mix->priv->other_context) {
+    gst_object_unref (mix->priv->other_context);
+    mix->priv->other_context = NULL;
+  }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_gl_base_mixer_set_context (GstElement * element, GstContext * context)
+{
+  GstGLBaseMixer *mix = GST_GL_BASE_MIXER (element);
+  GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
+
+  gst_gl_handle_set_context (element, context, &mix->display,
+      &mix->priv->other_context);
+
+  if (mix->display)
+    gst_gl_display_filter_gl_api (mix->display, mix_class->supported_gl_api);
+}
+
+static gboolean
+gst_gl_base_mixer_activate (GstGLBaseMixer * mix, gboolean active)
+{
+  GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
+  gboolean result = TRUE;
+
+  if (active) {
+    if (!gst_gl_ensure_element_data (mix, &mix->display,
+            &mix->priv->other_context))
+      return FALSE;
+
+    gst_gl_display_filter_gl_api (mix->display, mix_class->supported_gl_api);
+  }
+
+  return result;
+}
+
+static gboolean
+gst_gl_base_mixer_src_activate_mode (GstAggregator * aggregator,
+    GstPadMode mode, gboolean active)
+{
+  GstGLBaseMixer *mix;
+  gboolean result = FALSE;
+
+  mix = GST_GL_BASE_MIXER (aggregator);
+
+  switch (mode) {
+    case GST_PAD_MODE_PUSH:
+    case GST_PAD_MODE_PULL:
+      result = gst_gl_base_mixer_activate (mix, active);
+      break;
+    default:
+      result = TRUE;
+      break;
+  }
+  return result;
+}
+
+static gboolean
+gst_gl_base_mixer_src_query (GstAggregator * agg, GstQuery * query)
+{
+  gboolean res = FALSE;
+  GstGLBaseMixer *mix = GST_GL_BASE_MIXER (agg);
+  GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_CONTEXT:
+    {
+      const gchar *context_type;
+      GstContext *context, *old_context;
+
+      res = gst_gl_handle_context_query ((GstElement *) mix, query,
+          &mix->display, &mix->priv->other_context);
+      if (mix->display)
+        gst_gl_display_filter_gl_api (mix->display,
+            mix_class->supported_gl_api);
+      gst_query_parse_context_type (query, &context_type);
+
+      if (g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
+        GstStructure *s;
+
+        gst_query_parse_context (query, &old_context);
+
+        if (old_context)
+          context = gst_context_copy (old_context);
+        else
+          context = gst_context_new ("gst.gl.local_context", FALSE);
+
+        s = gst_context_writable_structure (context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, mix->context,
+            NULL);
+        gst_query_set_context (query, context);
+        gst_context_unref (context);
+
+        res = mix->context != NULL;
+      }
+      GST_LOG_OBJECT (mix, "context query of type %s %i", context_type, res);
+
+      if (res)
+        return res;
+
+      break;
+    }
+    default:
+      break;
+  }
+
+  return GST_AGGREGATOR_CLASS (parent_class)->src_query (agg, query);
+}
+
+static gboolean
+_find_local_gl_context (GstGLBaseMixer * mix)
+{
+  GstQuery *query;
+  GstContext *context;
+  const GstStructure *s;
+
+  if (mix->context)
+    return TRUE;
+
+  query = gst_query_new_context ("gst.gl.local_context");
+  if (!mix->context && gst_gl_run_query (GST_ELEMENT (mix), query, GST_PAD_SRC)) {
+    gst_query_parse_context (query, &context);
+    if (context) {
+      s = gst_context_get_structure (context);
+      gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &mix->context,
+          NULL);
+    }
+  }
+  if (!mix->context
+      && gst_gl_run_query (GST_ELEMENT (mix), query, GST_PAD_SINK)) {
+    gst_query_parse_context (query, &context);
+    if (context) {
+      s = gst_context_get_structure (context);
+      gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &mix->context,
+          NULL);
+    }
+  }
+
+  GST_DEBUG_OBJECT (mix, "found local context %p", mix->context);
+
+  gst_query_unref (query);
+
+  if (mix->context)
+    return TRUE;
+
+  return FALSE;
+}
+
+static gboolean
+gst_gl_base_mixer_decide_allocation (GstGLBaseMixer * mix, GstQuery * query)
+{
+  GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
+  GError *error = NULL;
+  gboolean ret = TRUE;
+
+  if (!gst_gl_ensure_element_data (mix, &mix->display,
+          &mix->priv->other_context))
+    return FALSE;
+
+  gst_gl_display_filter_gl_api (mix->display, mix_class->supported_gl_api);
+
+  _find_local_gl_context (mix);
+
+  if (!mix->context) {
+    do {
+      if (mix->context)
+        gst_object_unref (mix->context);
+      /* just get a GL context.  we don't care */
+      mix->context =
+          gst_gl_display_get_gl_context_for_thread (mix->display, NULL);
+      if (!mix->context) {
+        mix->context = gst_gl_context_new (mix->display);
+        if (!gst_gl_context_create (mix->context, mix->priv->other_context,
+                &error))
+          goto context_error;
+      }
+    } while (!gst_gl_display_add_context (mix->display, mix->context));
+  }
+
+  if (mix_class->decide_allocation)
+    ret = mix_class->decide_allocation (mix, query);
+
+  return ret;
+
+context_error:
+  {
+    GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s", error->message),
+        (NULL));
+    return FALSE;
+  }
+}
+
+/* takes ownership of the pool, allocator and query */
+static gboolean
+gst_gl_base_mixer_set_allocation (GstGLBaseMixer * mix,
+    GstBufferPool * pool, GstAllocator * allocator,
+    GstAllocationParams * params, GstQuery * query)
+{
+  GstAllocator *oldalloc;
+  GstBufferPool *oldpool;
+  GstQuery *oldquery;
+  GstGLBaseMixerPrivate *priv = mix->priv;
+
+  GST_DEBUG ("storing allocation query");
+
+  GST_OBJECT_LOCK (mix);
+  oldpool = priv->pool;
+  priv->pool = pool;
+
+  oldalloc = priv->allocator;
+  priv->allocator = allocator;
+
+  oldquery = priv->query;
+  priv->query = query;
+
+  if (params)
+    priv->params = *params;
+  else
+    gst_allocation_params_init (&priv->params);
+  GST_OBJECT_UNLOCK (mix);
+
+  if (oldpool) {
+    GST_DEBUG_OBJECT (mix, "deactivating old pool %p", oldpool);
+    gst_buffer_pool_set_active (oldpool, FALSE);
+    gst_object_unref (oldpool);
+  }
+  if (oldalloc) {
+    gst_object_unref (oldalloc);
+  }
+  if (oldquery) {
+    gst_query_unref (oldquery);
+  }
+  return TRUE;
+}
+
+static gboolean
+gst_gl_base_mixer_do_bufferpool (GstGLBaseMixer * mix, GstCaps * outcaps)
+{
+  GstQuery *query;
+  gboolean result = TRUE;
+  GstBufferPool *pool = NULL;
+  GstAllocator *allocator;
+  GstAllocationParams params;
+  GstAggregator *agg = GST_AGGREGATOR (mix);
+
+  /* find a pool for the negotiated caps now */
+  GST_DEBUG_OBJECT (mix, "doing allocation query");
+  query = gst_query_new_allocation (outcaps, TRUE);
+  if (!gst_pad_peer_query (agg->srcpad, query)) {
+    /* not a problem, just debug a little */
+    GST_DEBUG_OBJECT (mix, "peer ALLOCATION query failed");
+  }
+
+  GST_DEBUG_OBJECT (mix, "calling decide_allocation");
+  result = gst_gl_base_mixer_decide_allocation (mix, query);
+
+  GST_DEBUG_OBJECT (mix, "ALLOCATION (%d) params: %" GST_PTR_FORMAT, result,
+      query);
+
+  if (!result)
+    goto no_decide_allocation;
+
+  /* we got configuration from our peer or the decide_allocation method,
+   * parse them */
+  if (gst_query_get_n_allocation_params (query) > 0) {
+    gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
+  } else {
+    allocator = NULL;
+    gst_allocation_params_init (&params);
+  }
+
+  if (gst_query_get_n_allocation_pools (query) > 0)
+    gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
+
+  /* now store */
+  result =
+      gst_gl_base_mixer_set_allocation (mix, pool, allocator, &params, query);
+
+  return result;
+
+  /* Errors */
+no_decide_allocation:
+  {
+    GST_WARNING_OBJECT (mix, "Failed to decide allocation");
+    gst_query_unref (query);
+
+    return result;
+  }
+}
+
+GstBufferPool *
+gst_gl_base_mixer_get_buffer_pool (GstGLBaseMixer * mix)
+{
+  GstBufferPool *pool;
+
+  GST_OBJECT_LOCK (mix);
+  pool = mix->priv->pool;
+  if (pool)
+    gst_object_ref (pool);
+  GST_OBJECT_UNLOCK (mix);
+
+  return pool;
+}
+
+static void
+gst_gl_base_mixer_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec)
+{
+  GstGLBaseMixer *mixer = GST_GL_BASE_MIXER (object);
+
+  switch (prop_id) {
+    case PROP_CONTEXT:
+      g_value_set_object (value, mixer->context);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_gl_base_mixer_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+  switch (prop_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_gl_base_mixer_start (GstAggregator * agg)
+{
+  return TRUE;
+}
+
+static gboolean
+gst_gl_base_mixer_stop (GstAggregator * agg)
+{
+  GstGLBaseMixer *mix = GST_GL_BASE_MIXER (agg);
+
+  if (mix->priv->query) {
+    gst_query_unref (mix->priv->query);
+    mix->priv->query = NULL;
+  }
+
+  if (mix->priv->pool) {
+    gst_object_unref (mix->priv->pool);
+    mix->priv->pool = NULL;
+  }
+
+  if (mix->display) {
+    gst_object_unref (mix->display);
+    mix->display = NULL;
+  }
+
+  if (mix->context) {
+    gst_object_unref (mix->context);
+    mix->context = NULL;
+  }
+
+  gst_gl_base_mixer_reset (mix);
+
+  return TRUE;
+}
+
+static GstStateChangeReturn
+gst_gl_base_mixer_change_state (GstElement * element, GstStateChange transition)
+{
+  GstGLBaseMixer *mix = GST_GL_BASE_MIXER (element);
+  GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
+  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+
+  GST_DEBUG_OBJECT (mix, "changing state: %s => %s",
+      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
+      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!gst_gl_ensure_element_data (element, &mix->display,
+              &mix->priv->other_context))
+        return GST_STATE_CHANGE_FAILURE;
+
+      gst_gl_display_filter_gl_api (mix->display, mix_class->supported_gl_api);
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    default:
+      break;
+  }
+
+  return ret;
+}
diff --git a/ext/gl/gstglbasemixer.h b/ext/gl/gstglbasemixer.h
new file mode 100644
index 0000000..6282ccb
--- /dev/null
+++ b/ext/gl/gstglbasemixer.h
@@ -0,0 +1,103 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_BASE_MIXER_H__
+#define __GST_GL_BASE_MIXER_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/gl/gl.h>
+#include <gst/video/gstvideoaggregator.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_GL_BASE_MIXER_PAD (gst_gl_base_mixer_pad_get_type())
+#define GST_GL_BASE_MIXER_PAD(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BASE_MIXER_PAD, GstGLBaseMixerPad))
+#define GST_GL_BASE_MIXER_PAD_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_BASE_MIXER_PAD, GstGLBaseMixerPadClass))
+#define GST_IS_GL_BASE_MIXER_PAD(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BASE_MIXER_PAD))
+#define GST_IS_GL_BASE_MIXER_PAD_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_BASE_MIXER_PAD))
+#define GST_GL_BASE_MIXER_PAD_GET_CLASS(obj) \
+        (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_BASE_MIXER_PAD,GstGLBaseMixerPadClass))
+
+typedef struct _GstGLBaseMixerPad GstGLBaseMixerPad;
+typedef struct _GstGLBaseMixerPadClass GstGLBaseMixerPadClass;
+
+/* all information needed for one video stream */
+struct _GstGLBaseMixerPad
+{
+  GstVideoAggregatorPad parent;                /* subclass the pad */
+};
+
+struct _GstGLBaseMixerPadClass
+{
+  GstVideoAggregatorPadClass parent_class;
+};
+
+GType gst_gl_base_mixer_pad_get_type (void);
+
+#define GST_TYPE_GL_BASE_MIXER (gst_gl_base_mixer_get_type())
+#define GST_GL_BASE_MIXER(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BASE_MIXER, GstGLBaseMixer))
+#define GST_GL_BASE_MIXER_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_BASE_MIXER, GstGLBaseMixerClass))
+#define GST_IS_GL_BASE_MIXER(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BASE_MIXER))
+#define GST_IS_GL_BASE_MIXER_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_BASE_MIXER))
+#define GST_GL_BASE_MIXER_GET_CLASS(obj) \
+        (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_BASE_MIXER,GstGLBaseMixerClass))
+
+typedef struct _GstGLBaseMixer GstGLBaseMixer;
+typedef struct _GstGLBaseMixerClass GstGLBaseMixerClass;
+typedef struct _GstGLBaseMixerPrivate GstGLBaseMixerPrivate;
+
+struct _GstGLBaseMixer
+{
+  GstVideoAggregator     vaggregator;
+
+  GstGLDisplay          *display;
+  GstGLContext          *context;
+
+  gpointer _padding[GST_PADDING];
+
+  GstGLBaseMixerPrivate *priv;
+};
+
+struct _GstGLBaseMixerClass
+{
+  GstVideoAggregatorClass parent_class;
+  GstGLAPI supported_gl_api;
+
+  gboolean (*propose_allocation) (GstGLBaseMixer * mix, GstGLBaseMixerPad * pad, GstQuery * decide_query, GstQuery *query);
+  gboolean (*decide_allocation) (GstGLBaseMixer * mix, GstQuery * decide_query);
+
+  gpointer _padding[GST_PADDING];
+};
+
+GType gst_gl_base_mixer_get_type(void);
+
+GstBufferPool *gst_gl_base_mixer_get_buffer_pool (GstGLBaseMixer * mix);
+
+G_END_DECLS
+#endif /* __GST_GL_BASE_MIXER_H__ */
diff --git a/ext/gl/gstglbumper.c b/ext/gl/gstglbumper.c
deleted file mode 100644
index 5303427..0000000
--- a/ext/gl/gstglbumper.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Cyril Comparon <cyril.comparon@gmail.com>
- * Copyright (C) 2008 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-glbumper
- *
- * Bump mapping using the normal method.
- *
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch -v videotestsrc ! glupload ! glbumper location=normalmap.bmp ! glimagesink
- * ]| A pipeline to test normal mapping.
- * FBO (Frame Buffer Object) and GLSL (OpenGL Shading Language) are required.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <png.h>
-#include "gstglbumper.h"
-
-#if PNG_LIBPNG_VER >= 10400
-#define int_p_NULL         NULL
-#define png_infopp_NULL    NULL
-#endif
-
-#define GST_CAT_DEFAULT gst_gl_bumper_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-enum
-{
-  PROP_0,
-  PROP_LOCATION
-};
-
-#define DEBUG_INIT \
-  GST_DEBUG_CATEGORY_INIT (gst_gl_bumper_debug, "glbumper", 0, "glbumper element");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLBumper, gst_gl_bumper, GST_TYPE_GL_FILTER,
-    DEBUG_INIT);
-
-static void gst_gl_bumper_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_gl_bumper_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-static void gst_gl_bumper_reset (GstGLFilter * filter);
-static gboolean gst_gl_bumper_init_shader (GstGLFilter * filter);
-static gboolean gst_gl_bumper_filter_texture (GstGLFilter * filter,
-    guint in_tex, guint out_tex);
-static void gst_gl_bumper_callback (gint width, gint height, guint texture,
-    gpointer stuff);
-
-//vertex source
-static const gchar *bumper_v_src =
-    "attribute vec3 aTangent;\n"
-    "\n"
-    "varying vec3 vNormal;\n"
-    "varying vec3 vTangent;\n"
-    "varying vec3 vVertexToLight0;\n"
-    "varying vec3 vVertexToLight1;\n"
-    "\n"
-    "void main()\n"
-    "{\n"
-    "  // transform the vertex\n"
-    "  gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n"
-    "\n"
-    "  // transform the normal and the tangent to scene coords\n"
-    "  vNormal = normalize(gl_NormalMatrix * gl_Normal);\n"
-    "  vTangent = normalize(gl_NormalMatrix * aTangent);\n"
-    "\n"
-    "  // transforming the vertex position to modelview-space\n"
-    "  //const vec4 vertexInSceneCoords = gl_ModelViewMatrix * gl_Vertex;\n"
-    "\n"
-    "  // calculate the vector from the vertex position to the light position\n"
-    "  vVertexToLight0 = normalize(gl_LightSource[0].position).xyz;\n"
-    "  vVertexToLight1 = normalize(gl_LightSource[1].position).xyz;\n"
-    "\n"
-    "  // transit vertex color\n"
-    "  gl_FrontColor = gl_BackColor = gl_Color;\n"
-    "\n"
-    "  // use the two first sets of texture coordinates in the fragment shader\n"
-    "  gl_TexCoord[0] = gl_MultiTexCoord0;\n"
-    "  gl_TexCoord[1] = gl_MultiTexCoord1;\n" "}\n";
-
-//fragment source
-static const gchar *bumper_f_src =
-    "uniform sampler2D texture0;\n"
-    "uniform sampler2D texture1;\n"
-    "\n"
-    "varying vec3 vNormal;\n"
-    "varying vec3 vTangent;\n"
-    "varying vec3 vVertexToLight0;\n"
-    "varying vec3 vVertexToLight1;\n"
-    "\n"
-    "void main()\n"
-    "{\n"
-    "  // get the color of the textures\n"
-    "  vec4 textureColor = texture2D(texture0, gl_TexCoord[0].st);\n"
-    "  vec3 normalmapItem = texture2D(texture1, gl_TexCoord[1].st).xyz * 2.0 - 1.0;\n"
-    "\n"
-    "  // calculate matrix that transform from tangent space to normalmap space (contrary of intuition)\n"
-    "  vec3 binormal = cross(vNormal, vTangent);\n"
-    "  mat3 tangentSpace2normalmapSpaceMat = mat3(vTangent, binormal, vNormal);\n"
-    "\n"
-    "  // disturb the normal\n"
-    "  vec3 disturbedNormal = tangentSpace2normalmapSpaceMat * normalmapItem;\n"
-    "\n"
-    "  // calculate the diffuse term and clamping it to [0;1]\n"
-    "  float diffuseTerm0 = clamp(dot(disturbedNormal, vVertexToLight0), 0.0, 1.0);\n"
-    "  float diffuseTerm1 = clamp(dot(disturbedNormal, vVertexToLight1), 0.0, 1.0);\n"
-    "\n"
-    "  vec3 irradiance = (diffuseTerm0 * gl_LightSource[0].diffuse.rgb + diffuseTerm1 * gl_LightSource[1].diffuse.rgb);\n"
-    "\n"
-    "  // calculate the final color\n"
-    "  gl_FragColor = vec4(irradiance * textureColor.rgb, textureColor.w);\n"
-    "}\n";
-
-#define LOAD_ERROR(context, msg) { gst_gl_context_set_error (context, "unable to load %s: %s", bumper->location, msg); return; }
-
-//png reading error handler
-static void
-user_warning_fn (png_structp png_ptr, png_const_charp warning_msg)
-{
-  g_warning ("%s\n", warning_msg);
-}
-
-//Called in the gl thread
-static void
-gst_gl_bumper_init_resources (GstGLFilter * filter)
-{
-  GstGLBumper *bumper = GST_GL_BUMPER (filter);
-  GstGLContext *context = filter->context;
-  const GstGLFuncs *gl = context->gl_vtable;
-
-  png_structp png_ptr;
-  png_infop info_ptr;
-  png_uint_32 width = 0;
-  png_uint_32 height = 0;
-  gint bit_depth = 0;
-  gint color_type = 0;
-  gint interlace_type = 0;
-  png_FILE_p fp = NULL;
-  guint y = 0;
-  guchar *raw_data = NULL;
-  guchar **rows = NULL;
-  png_byte magic[8];
-  gint n_read;
-
-  if (!bumper->location) {
-    gst_gl_context_set_error (context, "A filename is required");
-    return;
-  }
-
-  /* BEGIN load png image file */
-
-  if ((fp = fopen (bumper->location, "rb")) == NULL)
-    LOAD_ERROR (context, "file not found");
-
-  /* Read magic number */
-  n_read = fread (magic, 1, sizeof (magic), fp);
-  if (n_read != sizeof (magic)) {
-    fclose (fp);
-    LOAD_ERROR (context, "can't read PNG magic number");
-  }
-
-  /* Check for valid magic number */
-  if (png_sig_cmp (magic, 0, sizeof (magic))) {
-    fclose (fp);
-    LOAD_ERROR (context, "not a valid PNG image");
-  }
-
-  png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-
-  if (png_ptr == NULL) {
-    fclose (fp);
-    LOAD_ERROR (context, "failed to initialize the png_struct");
-  }
-
-  png_set_error_fn (png_ptr, NULL, NULL, user_warning_fn);
-
-  info_ptr = png_create_info_struct (png_ptr);
-  if (info_ptr == NULL) {
-    fclose (fp);
-    png_destroy_read_struct (&png_ptr, png_infopp_NULL, png_infopp_NULL);
-    LOAD_ERROR (context,
-        "failed to initialize the memory for image information");
-  }
-
-  png_init_io (png_ptr, fp);
-
-  png_set_sig_bytes (png_ptr, sizeof (magic));
-
-  png_read_info (png_ptr, info_ptr);
-
-  png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
-      &interlace_type, int_p_NULL, int_p_NULL);
-
-  if (color_type != PNG_COLOR_TYPE_RGB) {
-    fclose (fp);
-    png_destroy_read_struct (&png_ptr, png_infopp_NULL, png_infopp_NULL);
-    LOAD_ERROR (context, "color type is not rgb");
-  }
-
-  raw_data = (guchar *) malloc (sizeof (guchar) * width * height * 3);
-
-  rows = (guchar **) malloc (sizeof (guchar *) * height);
-
-  for (y = 0; y < height; ++y)
-    rows[y] = (guchar *) (raw_data + y * width * 3);
-
-  png_read_image (png_ptr, rows);
-
-  free (rows);
-
-  png_read_end (png_ptr, info_ptr);
-  png_destroy_read_struct (&png_ptr, &info_ptr, png_infopp_NULL);
-  fclose (fp);
-
-  /* END load png image file */
-
-  bumper->bumpmap_width = width;
-  bumper->bumpmap_height = height;
-
-  gl->GenTextures (1, &bumper->bumpmap);
-  gl->BindTexture (GL_TEXTURE_2D, bumper->bumpmap);
-  gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
-      bumper->bumpmap_width, bumper->bumpmap_height, 0,
-      GL_RGB, GL_UNSIGNED_BYTE, raw_data);
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
-  free (raw_data);
-}
-
-//Called in the gl thread
-static void
-gst_gl_bumper_reset_resources (GstGLFilter * filter)
-{
-  GstGLBumper *bumper = GST_GL_BUMPER (filter);
-
-  if (bumper->bumpmap) {
-    glDeleteTextures (1, &bumper->bumpmap);
-    bumper->bumpmap = 0;
-  }
-}
-
-static void
-gst_gl_bumper_class_init (GstGLBumperClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *element_class;
-
-  gobject_class = (GObjectClass *) klass;
-  element_class = GST_ELEMENT_CLASS (klass);
-  gobject_class->set_property = gst_gl_bumper_set_property;
-  gobject_class->get_property = gst_gl_bumper_get_property;
-
-  GST_GL_FILTER_CLASS (klass)->filter_texture = gst_gl_bumper_filter_texture;
-  GST_GL_FILTER_CLASS (klass)->display_init_cb = gst_gl_bumper_init_resources;
-  GST_GL_FILTER_CLASS (klass)->display_reset_cb = gst_gl_bumper_reset_resources;
-  GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_bumper_init_shader;
-  GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_bumper_reset;
-
-  g_object_class_install_property (gobject_class,
-      PROP_LOCATION, g_param_spec_string ("location",
-          "Normal map location",
-          "Normal map location", NULL,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  gst_element_class_set_metadata (element_class, "OpenGL bumper filter",
-      "Filter/Effect/Video", "Bump mapping filter",
-      "Cyril Comparon <cyril.comparon@gmail.com>, "
-      "Julien Isorce <julien.isorce@gmail.com>");
-}
-
-static void
-gst_gl_bumper_init (GstGLBumper * bumper)
-{
-  bumper->shader = NULL;
-  bumper->bumpmap = 0;
-  bumper->bumpmap_width = 0;
-  bumper->bumpmap_height = 0;
-  bumper->location = NULL;
-}
-
-static void
-gst_gl_bumper_reset (GstGLFilter * filter)
-{
-  GstGLBumper *bumper_filter = GST_GL_BUMPER (filter);
-
-  //blocking call, wait the opengl thread has destroyed the shader
-  if (bumper_filter->shader)
-    gst_gl_context_del_shader (filter->context, bumper_filter->shader);
-  bumper_filter->shader = NULL;
-}
-
-static void
-gst_gl_bumper_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstGLBumper *bumper = GST_GL_BUMPER (object);
-
-  switch (prop_id) {
-    case PROP_LOCATION:
-      if (bumper->location != NULL)
-        g_free (bumper->location);
-      bumper->location = g_value_dup_string (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_gl_bumper_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstGLBumper *bumper = GST_GL_BUMPER (object);
-
-  switch (prop_id) {
-    case PROP_LOCATION:
-      g_value_set_string (value, bumper->location);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static gboolean
-gst_gl_bumper_init_shader (GstGLFilter * filter)
-{
-  GstGLBumper *bumper = GST_GL_BUMPER (filter);
-
-  //blocking call, wait the opengl thread has compiled the shader
-  return gst_gl_context_gen_shader (filter->context, bumper_v_src, bumper_f_src,
-      &bumper->shader);
-}
-
-static gboolean
-gst_gl_bumper_filter_texture (GstGLFilter * filter, guint in_tex, guint out_tex)
-{
-  gpointer bumper_filter = GST_GL_BUMPER (filter);
-
-  //blocking call, use a FBO
-  gst_gl_context_use_fbo (filter->context,
-      GST_VIDEO_INFO_WIDTH (&filter->out_info),
-      GST_VIDEO_INFO_HEIGHT (&filter->out_info),
-      filter->fbo, filter->depthbuffer, out_tex, gst_gl_bumper_callback,
-      GST_VIDEO_INFO_WIDTH (&filter->in_info),
-      GST_VIDEO_INFO_HEIGHT (&filter->in_info),
-      in_tex, 45,
-      (gdouble) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
-      (gdouble) GST_VIDEO_INFO_HEIGHT (&filter->out_info), 0.1, 50,
-      GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, bumper_filter);
-
-  return TRUE;
-}
-
-typedef struct _MeshData
-{
-  float x, y, z;                /* Vertex */
-  float nx, ny, nz;             /* Normal */
-  float s0, t0;                 /* TexCoord0 */
-  float s1, t1;                 /* TexCoord1 */
-  float va0, vb0, vc0;          /* VertexAttrib */
-} MeshData;
-
-//opengl scene, params: input texture (not the output filter->texture)
-static void
-gst_gl_bumper_callback (gint width, gint height, guint texture, gpointer stuff)
-{
-  static GLfloat xrot = 0;
-  static GLfloat yrot = 0;
-  static GLfloat zrot = 0;
-
-  GstGLFuncs *gl;
-  GstGLBumper *bumper = GST_GL_BUMPER (stuff);
-  GstGLContext *context = GST_GL_FILTER (bumper)->context;
-  GLint locTangent = 0;
-
-  //choose the lights
-  GLfloat light_direction0[] = { 1.0, 0.0, -1.0, 0.0 }; // light goes along -x
-  GLfloat light_direction1[] = { -1.0, 0.0, -1.0, 0.0 };        // light goes along x
-  GLfloat light_diffuse0[] = { 1.0, 1.0, 1.0, 1.0 };
-  GLfloat light_diffuse1[] = { 1.0, 1.0, 1.0, 1.0 };
-  GLfloat mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
-
-/* *INDENT-OFF* */
-  MeshData mesh[] = {
-   /* |     Vertex      |     Normal      |TexCoord0|TexCoord1|  VertexAttrib  | */
-/*F*/ { 1.0,  1.0, -1.0,  0.0,  0.0, -1.0, 0.0, 0.0, 0.0, 0.0,  0.0,  1.0,  0.0},
-/*r*/ { 1.0, -1.0, -1.0,  0.0,  0.0, -1.0, 1.0, 0.0, 1.0, 0.0,  0.0,  1.0,  0.0},
-/*o*/ {-1.0, -1.0, -1.0,  0.0,  0.0, -1.0, 1.0, 1.0, 1.0, 1.0,  0.0,  1.0,  0.0},
-      {-1.0,  1.0, -1.0,  0.0,  0.0, -1.0, 0.0, 1.0, 0.0, 1.0,  0.0,  1.0,  0.0},
-/*R*/ {-1.0,  1.0, -1.0, -1.0,  0.0,  0.0, 0.0, 0.0, 0.0, 0.0,  0.0,  1.0,  0.0},
-/*i*/ {-1.0, -1.0, -1.0, -1.0,  0.0,  0.0, 1.0, 0.0, 1.0, 0.0,  0.0,  1.0,  0.0},
-/*g*/ {-1.0, -1.0,  1.0, -1.0,  0.0,  0.0, 1.0, 1.0, 1.0, 1.0,  0.0,  1.0,  0.0},
-      {-1.0,  1.0,  1.0, -1.0,  0.0,  0.0, 0.0, 1.0, 0.0, 1.0,  0.0,  1.0,  0.0},
-/*B*/ {-1.0,  1.0,  1.0,  0.0,  0.0,  1.0, 0.0, 0.0, 0.0, 0.0,  0.0,  1.0,  0.0},
-/*a*/ {-1.0, -1.0,  1.0,  0.0,  0.0,  1.0, 1.0, 0.0, 1.0, 0.0,  0.0,  1.0,  0.0},
-/*c*/ { 1.0, -1.0,  1.0,  0.0,  0.0,  1.0, 1.0, 1.0, 1.0, 1.0,  0.0,  1.0,  0.0},
-      { 1.0,  1.0,  1.0,  0.0,  0.0,  1.0, 0.0, 1.0, 0.0, 1.0,  0.0,  1.0,  0.0},
-/*L*/ { 1.0,  1.0,  1.0,  1.0,  0.0,  0.0, 0.0, 0.0, 0.0, 0.0,  0.0,  1.0,  0.0},
-/*e*/ { 1.0, -1.0,  1.0,  1.0,  0.0,  0.0, 1.0, 0.0, 1.0, 0.0,  0.0,  1.0,  0.0},
-/*f*/ { 1.0, -1.0, -1.0,  1.0,  0.0,  0.0, 1.0, 1.0, 1.0, 1.0,  0.0,  1.0,  0.0},
-      { 1.0,  1.0, -1.0,  1.0,  0.0,  0.0, 0.0, 1.0, 0.0, 1.0,  0.0,  1.0,  0.0},
-/*T*/ { 1.0,  1.0,  1.0,  0.0,  1.0,  0.0, 0.0, 0.0, 0.0, 0.0,  0.0,  0.0,  1.0},
-/*o*/ { 1.0,  1.0, -1.0,  0.0,  1.0,  0.0, 1.0, 0.0, 1.0, 0.0,  0.0,  0.0,  1.0},
-/*p*/ {-1.0,  1.0, -1.0,  0.0,  1.0,  0.0, 1.0, 1.0, 1.0, 1.0,  0.0,  0.0,  1.0},
-      {-1.0,  1.0,  1.0,  0.0,  1.0,  0.0, 0.0, 1.0, 0.0, 1.0,  0.0,  0.0,  1.0},
-/*B*/ { 1.0, -1.0, -1.0,  0.0, -1.0,  0.0, 0.0, 0.0, 0.0, 0.0,  0.0,  0.0, -1.0},
-/*o*/ { 1.0, -1.0,  1.0,  0.0, -1.0,  0.0, 1.0, 0.0, 1.0, 0.0,  0.0,  0.0, -1.0},
-/*t*/ {-1.0, -1.0,  1.0,  0.0, -1.0,  0.0, 1.0, 1.0, 1.0, 1.0,  0.0,  0.0, -1.0},
-      {-1.0, -1.0, -1.0,  0.0, -1.0,  0.0, 0.0, 1.0, 0.0, 1.0,  0.0,  0.0, -1.0},
-  };
-
-  GLushort indices[] = {
-    0, 1, 2,
-    0, 2, 3,
-    4, 5, 6,
-    4, 6, 7,
-    8, 9, 10,
-    8, 10, 11,
-    12, 13, 14,
-    12, 14, 15,
-    16, 17, 18,
-    16, 18, 19,
-    20, 21, 22,
-    20, 22, 23
-  };
-
-/* *INDENT-ON* */
-
-  gl = GST_GL_FILTER (bumper)->context->gl_vtable;
-
-  //eye point
-  gl->MatrixMode (GL_PROJECTION);
-  gluLookAt (0.0, 0.0, -6.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
-  gl->MatrixMode (GL_MODELVIEW);
-
-  //scene conf
-  gl->Enable (GL_DEPTH_TEST);
-  gl->DepthFunc (GL_LEQUAL);
-  gl->Hint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
-
-  gl->ShadeModel (GL_SMOOTH);
-
-  //set the lights
-  gl->Lightfv (GL_LIGHT0, GL_POSITION, light_direction0);
-  gl->Lightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse0);
-  gl->Lightfv (GL_LIGHT1, GL_POSITION, light_direction1);
-  gl->Lightfv (GL_LIGHT1, GL_DIFFUSE, light_diffuse1);
-  gl->Materialfv (GL_FRONT, GL_DIFFUSE, mat_diffuse);
-  gl->ColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE);
-  gl->Enable (GL_COLOR_MATERIAL);
-  gl->Enable (GL_LIGHTING);
-  gl->Enable (GL_LIGHT0);
-  gl->Enable (GL_LIGHT1);
-  //configure shader
-  gst_gl_shader_use (bumper->shader);
-  locTangent =
-      gst_gl_shader_get_attribute_location (bumper->shader, "aTangent");
-
-  //set the normal map
-  gl->ActiveTexture (GL_TEXTURE1);
-  gst_gl_shader_set_uniform_1i (bumper->shader, "texture1", 1);
-  gl->BindTexture (GL_TEXTURE_2D, bumper->bumpmap);
-
-  //set the video texture
-  gl->ActiveTexture (GL_TEXTURE0);
-  gst_gl_shader_set_uniform_1i (bumper->shader, "texture0", 0);
-  gl->BindTexture (GL_TEXTURE_2D, texture);
-
-  gl->Rotatef (xrot, 1.0f, 0.0f, 0.0f);
-  gl->Rotatef (yrot, 0.0f, 1.0f, 0.0f);
-  gl->Rotatef (zrot, 0.0f, 0.0f, 1.0f);
-
-  gl->EnableVertexAttribArray (locTangent);
-
-  gl->ClientActiveTexture (GL_TEXTURE0);
-  gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
-  gl->EnableClientState (GL_VERTEX_ARRAY);
-  gl->EnableClientState (GL_NORMAL_ARRAY);
-
-  gl->VertexAttribPointer (locTangent, 3, GL_FLOAT, 0, sizeof (MeshData),
-      &mesh[0].va0);
-  gl->VertexPointer (3, GL_FLOAT, sizeof (MeshData), &mesh[0].x);
-  gl->NormalPointer (GL_FLOAT, sizeof (MeshData), &mesh[0].nx);
-  gl->TexCoordPointer (2, GL_FLOAT, sizeof (MeshData), &mesh[0].s0);
-
-  gl->ClientActiveTexture (GL_TEXTURE1);
-  gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
-  gl->TexCoordPointer (2, GL_FLOAT, sizeof (MeshData), &mesh[0].s1);
-
-  gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, indices);
-
-  gl->DisableClientState (GL_VERTEX_ARRAY);
-  gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
-  gl->DisableClientState (GL_NORMAL_ARRAY);
-
-  gl->ClientActiveTexture (GL_TEXTURE0);
-  gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
-
-  gl->DisableVertexAttribArray (locTangent);
-
-  gst_gl_context_clear_shader (context);
-
-  gl->Disable (GL_LIGHT0);
-  gl->Disable (GL_LIGHT1);
-  gl->Disable (GL_LIGHTING);
-  gl->Disable (GL_COLOR_MATERIAL);
-
-  xrot += 1.0f;
-  yrot += 0.9f;
-  zrot += 0.6f;
-}
diff --git a/ext/gl/gstglbumper.h b/ext/gl/gstglbumper.h
deleted file mode 100644
index b1a1dc0..0000000
--- a/ext/gl/gstglbumper.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_GL_BUMPER_H_
-#define _GST_GL_BUMPER_H_
-
-#include <gst/gl/gstglfilter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_BUMPER            (gst_gl_bumper_get_type())
-#define GST_GL_BUMPER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BUMPER,GstGLBumper))
-#define GST_IS_GL_BUMPER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BUMPER))
-#define GST_GL_BUMPER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_BUMPER,GstGLBumperClass))
-#define GST_IS_GL_BUMPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_BUMPER))
-#define GST_GL_BUMPER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_BUMPER,GstGLBumperClass))
-
-typedef struct _GstGLBumper GstGLBumper;
-typedef struct _GstGLBumperClass GstGLBumperClass;
-
-struct _GstGLBumper
-{
-  GstGLFilter filter;
-  GstGLShader *shader;
-  GLuint bumpmap;
-  gint bumpmap_width;
-  gint bumpmap_height;
-  gchar *location;
-};
-
-struct _GstGLBumperClass
-{
-  GstGLFilterClass filter_class;
-};
-
-GType gst_gl_bumper_get_type (void);
-
-G_END_DECLS
-
-#endif /* _GST_GLBUMPER_H_ */
diff --git a/ext/gl/gstglcolorconvertelement.c b/ext/gl/gstglcolorconvertelement.c
new file mode 100644
index 0000000..a3118f8
--- /dev/null
+++ b/ext/gl/gstglcolorconvertelement.c
@@ -0,0 +1,208 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012-2014 Matthew Waters <ystree00@gmail.com>
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gl/gl.h>
+#include "gstglcolorconvertelement.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_gl_color_convert_element_debug);
+#define GST_CAT_DEFAULT gst_gl_color_convert_element_debug
+
+G_DEFINE_TYPE_WITH_CODE (GstGLColorConvertElement, gst_gl_color_convert_element,
+    GST_TYPE_GL_BASE_FILTER,
+    GST_DEBUG_CATEGORY_INIT (gst_gl_color_convert_element_debug,
+        "glconvertelement", 0, "convert");
+    );
+
+static void gst_gl_color_convert_element_finalize (GObject * object);
+static gboolean gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
+    GstCaps * in_caps, GstCaps * out_caps);
+static GstCaps *gst_gl_color_convert_element_transform_caps (GstBaseTransform *
+    bt, GstPadDirection direction, GstCaps * caps, GstCaps * filter);
+static gboolean gst_gl_color_convert_element_get_unit_size (GstBaseTransform *
+    trans, GstCaps * caps, gsize * size);
+static gboolean gst_gl_color_convert_element_decide_allocation (GstBaseTransform
+    * trans, GstQuery * query);
+static GstFlowReturn
+gst_gl_color_convert_element_prepare_output_buffer (GstBaseTransform * bt,
+    GstBuffer * inbuf, GstBuffer ** outbuf);
+static GstFlowReturn gst_gl_color_convert_element_transform (GstBaseTransform *
+    bt, GstBuffer * inbuf, GstBuffer * outbuf);
+
+static GstStaticPadTemplate gst_gl_color_convert_element_src_pad_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_GL_COLOR_CONVERT_VIDEO_CAPS));
+
+static GstStaticPadTemplate gst_gl_color_convert_element_sink_pad_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_GL_COLOR_CONVERT_VIDEO_CAPS));
+
+static void
+gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass)
+{
+  GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  bt_class->transform_caps = gst_gl_color_convert_element_transform_caps;
+  bt_class->set_caps = gst_gl_color_convert_element_set_caps;
+  bt_class->get_unit_size = gst_gl_color_convert_element_get_unit_size;
+  bt_class->decide_allocation = gst_gl_color_convert_element_decide_allocation;
+  bt_class->prepare_output_buffer =
+      gst_gl_color_convert_element_prepare_output_buffer;
+  bt_class->transform = gst_gl_color_convert_element_transform;
+
+  bt_class->passthrough_on_same_caps = TRUE;
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get
+      (&gst_gl_color_convert_element_src_pad_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get
+      (&gst_gl_color_convert_element_sink_pad_template));
+
+  gst_element_class_set_metadata (element_class,
+      "OpenGL color converter", "Filter/Converter/Video",
+      "Converts between color spaces using OpenGL shaders",
+      "Matthew Waters <matthew@centricular.com>");
+
+  G_OBJECT_CLASS (klass)->finalize = gst_gl_color_convert_element_finalize;
+}
+
+static void
+gst_gl_color_convert_element_init (GstGLColorConvertElement * convert)
+{
+  gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (convert),
+      TRUE);
+}
+
+static void
+gst_gl_color_convert_element_finalize (GObject * object)
+{
+  GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object);
+
+  gst_caps_replace (&convert->in_caps, NULL);
+  gst_caps_replace (&convert->out_caps, NULL);
+
+  G_OBJECT_CLASS (gst_gl_color_convert_element_parent_class)->finalize (object);
+}
+
+static gboolean
+gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
+    GstCaps * in_caps, GstCaps * out_caps)
+{
+  GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (bt);
+
+  gst_caps_replace (&convert->in_caps, in_caps);
+  gst_caps_replace (&convert->out_caps, out_caps);
+
+  if (convert->convert)
+    gst_gl_color_convert_set_caps (convert->convert, in_caps, out_caps);
+
+  return TRUE;
+}
+
+static GstCaps *
+gst_gl_color_convert_element_transform_caps (GstBaseTransform * bt,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
+{
+  GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
+
+  return gst_gl_color_convert_transform_caps (context, direction, caps, filter);
+}
+
+static gboolean
+gst_gl_color_convert_element_get_unit_size (GstBaseTransform * trans,
+    GstCaps * caps, gsize * size)
+{
+  gboolean ret = FALSE;
+  GstVideoInfo info;
+
+  ret = gst_video_info_from_caps (&info, caps);
+  if (ret)
+    *size = GST_VIDEO_INFO_SIZE (&info);
+
+  return TRUE;
+}
+
+static gboolean
+gst_gl_color_convert_element_decide_allocation (GstBaseTransform * trans,
+    GstQuery * query)
+{
+  GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (trans);
+  GstGLContext *context;
+
+  /* get gl context */
+  if (!GST_BASE_TRANSFORM_CLASS
+      (gst_gl_color_convert_element_parent_class)->decide_allocation (trans,
+          query))
+    return FALSE;
+
+  context = GST_GL_BASE_FILTER (trans)->context;
+
+  if (!convert->convert)
+    convert->convert = gst_gl_color_convert_new (context);
+
+  if (!gst_gl_color_convert_set_caps (convert->convert, convert->in_caps,
+          convert->out_caps))
+    return FALSE;
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_gl_color_convert_element_prepare_output_buffer (GstBaseTransform * bt,
+    GstBuffer * inbuf, GstBuffer ** outbuf)
+{
+  GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (bt);
+
+  if (gst_base_transform_is_passthrough (bt)) {
+    *outbuf = inbuf;
+    return GST_FLOW_OK;
+  }
+
+  if (!convert->convert)
+    return GST_FLOW_NOT_NEGOTIATED;
+
+  *outbuf = gst_gl_color_convert_perform (convert->convert, inbuf);
+
+  /* basetransform doesn't unref if they're the same */
+  if (inbuf == *outbuf)
+    gst_buffer_unref (*outbuf);
+  if (*outbuf)
+    gst_buffer_copy_into (*outbuf, inbuf,
+        GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
+
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+gst_gl_color_convert_element_transform (GstBaseTransform * bt,
+    GstBuffer * inbuf, GstBuffer * outbuf)
+{
+  return GST_FLOW_OK;
+}
diff --git a/ext/gl/gstglcolorconvertelement.h b/ext/gl/gstglcolorconvertelement.h
new file mode 100644
index 0000000..2a0dd1d
--- /dev/null
+++ b/ext/gl/gstglcolorconvertelement.h
@@ -0,0 +1,59 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystree00@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_COLOR_CONVERT_ELEMENT_H__
+#define __GST_GL_COLOR_CONVERT_ELEMENT_H__
+
+#include <gst/video/video.h>
+#include <gst/gstmemory.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_color_convert_element_get_type (void);
+#define GST_TYPE_GL_COLOR_CONVERT_ELEMENT (gst_gl_color_convert_element_get_type())
+#define GST_GL_COLOR_CONVERT_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_COLOR_CONVERT_ELEMENT,GstGLColorConvertElement))
+#define GST_GL_COLOR_CONVERT_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_DISPLAY,GstGLColorConvertElementClass))
+#define GST_IS_GL_COLOR_CONVERT_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_COLOR_CONVERT_ELEMENT))
+#define GST_IS_GL_COLOR_CONVERT_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_COLOR_CONVERT_ELEMENT))
+#define GST_GL_COLOR_CONVERT_ELEMENT_CAST(obj) ((GstGLColorConvertElement*)(obj))
+
+typedef struct _GstGLColorConvertElement GstGLColorConvertElement;
+typedef struct _GstGLColorConvertElementClass GstGLColorConvertElementClass;
+typedef struct _GstGLColorConvertElementPrivate GstGLColorConvertElementPrivate;
+
+struct _GstGLColorConvertElement
+{
+  GstGLBaseFilter        parent;
+
+  GstGLColorConvert *convert;
+  GstCaps *in_caps;
+  GstCaps *out_caps;
+};
+
+struct _GstGLColorConvertElementClass
+{
+  GstGLBaseFilterClass object_class;
+};
+
+G_END_DECLS
+
+#endif /* __GST_GL_COLOR_CONVERT_ELEMENT_H__ */
diff --git a/ext/gl/gstglcolorscale.c b/ext/gl/gstglcolorscale.c
index e56da5b..fa22bf9 100644
--- a/ext/gl/gstglcolorscale.c
+++ b/ext/gl/gstglcolorscale.c
@@ -32,12 +32,12 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch -v videotestsrc ! "video/x-raw-yuv" ! glcolorscale ! ximagesink
+ * gst-launch-1.0 -v videotestsrc ! video/x-raw ! glcolorscale ! ximagesink
  * ]| A pipeline to test colorspace conversion.
  * FBO is required.
   |[
- * gst-launch -v videotestsrc ! "video/x-raw-yuv, width=640, height=480, format=(fourcc)AYUV" ! glcolorscale ! \
- *   "video/x-raw-yuv, width=320, height=240, format=(fourcc)YV12" ! autovideosink
+ * gst-launch-1.0 -v videotestsrc ! video/x-raw, width=640, height=480, format=AYUV ! glcolorscale ! \
+ *   video/x-raw, width=320, height=240, format=YV12 ! videoconvert ! autovideosink
  * ]| A pipeline to test hardware scaling and colorspace conversion.
  * FBO and GLSL are required.
  * </refsect2>
@@ -70,17 +70,13 @@
 static void gst_gl_colorscale_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-#if GST_GL_HAVE_GLES2
 static gboolean gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter);
 static void gst_gl_colorscale_del_gl_resources (GstGLFilter * filter);
-#endif
 
 static gboolean gst_gl_colorscale_filter_texture (GstGLFilter * filter,
     guint in_tex, guint out_tex);
-#if GST_GL_HAVE_OPENGL
 static void gst_gl_colorscale_callback (gint width, gint height,
     guint texture, gpointer stuff);
-#endif
 
 static void
 gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
@@ -101,23 +97,21 @@
       "Filter/Effect/Video", "Colorspace converter and video scaler",
       "Julien Isorce <julien.isorce@gmail.com>");
 
-#if GST_GL_HAVE_GLES2
   filter_class->onInitFBO =
       GST_DEBUG_FUNCPTR (gst_gl_colorscale_gen_gl_resources);
   filter_class->onStop = GST_DEBUG_FUNCPTR (gst_gl_colorscale_del_gl_resources);
-#endif
 
   filter_class->filter_texture = gst_gl_colorscale_filter_texture;
 
   basetransform_class->passthrough_on_same_caps = TRUE;
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
 }
 
 static void
 gst_gl_colorscale_init (GstGLColorscale * colorscale)
 {
-#if GST_GL_HAVE_GLES2
   colorscale->shader = NULL;
-#endif
 }
 
 static void
@@ -142,7 +136,6 @@
   }
 }
 
-#if GST_GL_HAVE_GLES2
 static void
 _compile_identity_shader (GstGLContext * context, GstGLColorscale * colorscale)
 {
@@ -163,12 +156,13 @@
 {
   GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
 
-  if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_GLES2) {
-    gst_gl_context_thread_add (filter->context,
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
+      (GST_GL_API_GLES2 | GST_GL_API_OPENGL3)) {
+    gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
         (GstGLContextThreadFunc) _compile_identity_shader, colorscale);
 
     if (!colorscale->shader) {
-      gst_gl_context_set_error (filter->context,
+      gst_gl_context_set_error (GST_GL_BASE_FILTER (filter)->context,
           "Failed to initialize identity shader");
       GST_ELEMENT_ERROR (colorscale, RESOURCE, NOT_FOUND, ("%s",
               gst_gl_context_get_error ()), (NULL));
@@ -185,11 +179,11 @@
   GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
 
   if (colorscale->shader) {
-    gst_gl_context_del_shader (filter->context, colorscale->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        colorscale->shader);
     colorscale->shader = NULL;
   }
 }
-#endif
 
 static gboolean
 gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex,
@@ -199,35 +193,34 @@
 
   colorscale = GST_GL_COLORSCALE (filter);
 
-#if GST_GL_HAVE_GLES2
-  if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_GLES2)
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
+      (GST_GL_API_GLES2 | GST_GL_API_OPENGL3))
     gst_gl_filter_render_to_target_with_shader (filter, TRUE, in_tex, out_tex,
         colorscale->shader);
-#endif
 
-#if GST_GL_HAVE_OPENGL
-  if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL)
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
+      GST_GL_API_OPENGL)
     gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
         gst_gl_colorscale_callback, colorscale);
-#endif
 
   return TRUE;
 }
 
-#if GST_GL_HAVE_OPENGL
 static void
 gst_gl_colorscale_callback (gint width, gint height, guint texture,
     gpointer stuff)
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
 
-  if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
-    const GstGLFuncs *gl = filter->context->gl_vtable;
+#if GST_GL_HAVE_OPENGL
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
+      GST_GL_API_OPENGL) {
+    const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
     gl->MatrixMode (GL_PROJECTION);
     gl->LoadIdentity ();
   }
+#endif
 
   gst_gl_filter_draw_texture (filter, texture, width, height);
 }
-#endif
diff --git a/ext/gl/gstglcolorscale.h b/ext/gl/gstglcolorscale.h
index 101b905..9335996 100644
--- a/ext/gl/gstglcolorscale.h
+++ b/ext/gl/gstglcolorscale.h
@@ -43,9 +43,7 @@
 {
     GstGLFilter filter;
 
-#if GST_GL_HAVE_GLES2
     GstGLShader *shader;
-#endif
 };
 
 struct _GstGLColorscaleClass
diff --git a/ext/gl/gstgldeinterlace.c b/ext/gl/gstgldeinterlace.c
index b420fa6..bf969f2 100644
--- a/ext/gl/gstgldeinterlace.c
+++ b/ext/gl/gstgldeinterlace.c
@@ -168,6 +168,8 @@
       gst_gl_deinterlace_filter_texture;
   GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_deinterlace_init_shader;
   GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_deinterlace_reset;
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
 }
 
 static void
@@ -183,13 +185,12 @@
 {
   GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
 
-  if (deinterlace_filter->prev_buffer) {
-    gst_buffer_unref (deinterlace_filter->prev_buffer);
-    deinterlace_filter->prev_buffer = NULL;
-  }
+  gst_buffer_replace (&deinterlace_filter->prev_buffer, NULL);
+
   //blocking call, wait the opengl thread has destroyed the shader
   if (deinterlace_filter->shader)
-    gst_gl_context_del_shader (filter->context, deinterlace_filter->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        deinterlace_filter->shader);
   deinterlace_filter->shader = NULL;
 }
 
@@ -225,8 +226,8 @@
   GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
 
   //blocking call, wait the opengl thread has compiled the shader
-  return gst_gl_context_gen_shader (filter->context, 0, greedyh_fragment_source,
-      &deinterlace_filter->shader);
+  return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
+      greedyh_fragment_source, &deinterlace_filter->shader);
 }
 
 static gboolean
@@ -250,10 +251,7 @@
 
   gst_gl_filter_filter_texture (filter, inbuf, outbuf);
 
-  if (deinterlace_filter->prev_buffer) {
-    gst_buffer_unref (deinterlace_filter->prev_buffer);
-  }
-  deinterlace_filter->prev_buffer = gst_buffer_ref (inbuf);
+  gst_buffer_replace (&deinterlace_filter->prev_buffer, inbuf);
 
   return TRUE;
 }
@@ -265,7 +263,7 @@
 {
   GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (stuff);
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   guint temp;
 
   GLfloat verts[] = { -1.0, -1.0,
@@ -292,7 +290,7 @@
   gl->Enable (GL_TEXTURE_2D);
 
   if (G_UNLIKELY (deinterlace_filter->prev_tex == 0)) {
-    gst_gl_context_gen_texture (filter->context,
+    gst_gl_context_gen_texture (GST_GL_BASE_FILTER (filter)->context,
         &deinterlace_filter->prev_tex,
         GST_VIDEO_INFO_FORMAT (&filter->out_info),
         GST_VIDEO_INFO_WIDTH (&filter->out_info),
diff --git a/ext/gl/gstgldifferencematte.c b/ext/gl/gstgldifferencematte.c
index f04c4c4..ce1b513 100644
--- a/ext/gl/gstgldifferencematte.c
+++ b/ext/gl/gstgldifferencematte.c
@@ -81,7 +81,7 @@
 gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   gint i;
 
   for (i = 0; i < 4; i++) {
@@ -95,12 +95,13 @@
     gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-    differencematte->shader[i] = gst_gl_shader_new (filter->context);
+    differencematte->shader[i] =
+        gst_gl_shader_new (GST_GL_BASE_FILTER (filter)->context);
   }
 
   if (!gst_gl_shader_compile_and_check (differencematte->shader[0],
           difference_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
-    gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
+    gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
         "Failed to initialize difference shader");
     GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
         ("%s", gst_gl_context_get_error ()), (NULL));
@@ -109,7 +110,7 @@
 
   if (!gst_gl_shader_compile_and_check (differencematte->shader[1],
           hconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
-    gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
+    gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
         "Failed to initialize hconv7 shader");
     GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
         ("%s", gst_gl_context_get_error ()), (NULL));
@@ -118,7 +119,7 @@
 
   if (!gst_gl_shader_compile_and_check (differencematte->shader[2],
           vconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
-    gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
+    gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
         "Failed to initialize vconv7 shader");
     GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
         ("%s", gst_gl_context_get_error ()), (NULL));
@@ -127,7 +128,7 @@
 
   if (!gst_gl_shader_compile_and_check (differencematte->shader[3],
           texture_interp_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
-    gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
+    gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
         "Failed to initialize interp shader");
     GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
         ("%s", gst_gl_context_get_error ()), (NULL));
@@ -140,7 +141,7 @@
 gst_gl_differencematte_reset_gl_resources (GstGLFilter * filter)
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   gint i;
 
   gl->DeleteTextures (1, &differencematte->savedbgtexture);
@@ -193,6 +194,8 @@
       "Gstreamer OpenGL DifferenceMatte", "Filter/Effect/Video",
       "Saves a background frame and replace it with a pixbuf",
       "Filippo Argiolas <filippo.argiolas@gmail.com>");
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
 }
 
 static void
@@ -263,7 +266,7 @@
     gpointer stuff)
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   gl->LoadIdentity ();
@@ -276,7 +279,7 @@
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (data);
   GstGLFilter *filter = GST_GL_FILTER (data);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->DeleteTextures (1, &differencematte->newbgtexture);
   gl->GenTextures (1, &differencematte->newbgtexture);
@@ -309,7 +312,7 @@
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   gl->LoadIdentity ();
@@ -339,7 +342,7 @@
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   gl->LoadIdentity ();
@@ -366,7 +369,7 @@
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   gl->LoadIdentity ();
@@ -393,7 +396,7 @@
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   glLoadIdentity ();
@@ -430,7 +433,7 @@
 {
   GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
   GstGLFilter *filter = GST_GL_FILTER (differencematte);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   gl->LoadIdentity ();
@@ -452,8 +455,8 @@
       differencematte->pixbuf = NULL;
 
     /* if loader failed then context is turned off */
-    gst_gl_context_thread_add (filter->context, init_pixbuf_texture,
-        differencematte);
+    gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
+        init_pixbuf_texture, differencematte);
 
     /* save current frame, needed to calculate difference between
      * this frame and next ones */
@@ -515,7 +518,7 @@
   guchar **rows = NULL;
   gint filler;
 
-  if (!filter->context)
+  if (!GST_GL_BASE_FILTER (filter)->context)
     return TRUE;
 
   if ((fp = fopen (differencematte->location, "rb")) == NULL)
diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c
new file mode 100644
index 0000000..dfe0856
--- /dev/null
+++ b/ext/gl/gstgldownloadelement.c
@@ -0,0 +1,183 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystree00@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gl/gl.h>
+#include "gstgldownloadelement.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug);
+#define GST_CAT_DEFAULT gst_gl_download_element_debug
+
+#define gst_gl_download_element_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGLDownloadElement, gst_gl_download_element,
+    GST_TYPE_GL_BASE_FILTER,
+    GST_DEBUG_CATEGORY_INIT (gst_gl_download_element_debug, "gldownloadelement",
+        0, "download element");
+    );
+static void gst_gl_download_element_finalize (GObject * object);
+
+static gboolean gst_gl_download_element_get_unit_size (GstBaseTransform * trans,
+    GstCaps * caps, gsize * size);
+static GstCaps *gst_gl_download_element_transform_caps (GstBaseTransform * bt,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter);
+static gboolean gst_gl_download_element_set_caps (GstBaseTransform * bt,
+    GstCaps * in_caps, GstCaps * out_caps);
+static GstFlowReturn
+gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
+    GstBuffer * buffer, GstBuffer ** outbuf);
+static GstFlowReturn gst_gl_download_element_transform (GstBaseTransform * bt,
+    GstBuffer * buffer, GstBuffer * outbuf);
+
+static GstStaticPadTemplate gst_gl_download_element_src_pad_template =
+    GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw; video/x-raw(memory:GLMemory)"));
+
+static GstStaticPadTemplate gst_gl_download_element_sink_pad_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(memory:GLMemory)"));
+
+static void
+gst_gl_download_element_class_init (GstGLDownloadElementClass * klass)
+{
+  GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  bt_class->transform_caps = gst_gl_download_element_transform_caps;
+  bt_class->set_caps = gst_gl_download_element_set_caps;
+  bt_class->get_unit_size = gst_gl_download_element_get_unit_size;
+  bt_class->prepare_output_buffer =
+      gst_gl_download_element_prepare_output_buffer;
+  bt_class->transform = gst_gl_download_element_transform;
+
+  bt_class->passthrough_on_same_caps = TRUE;
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_gl_download_element_src_pad_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_gl_download_element_sink_pad_template));
+
+  gst_element_class_set_metadata (element_class,
+      "OpenGL uploader", "Filter/Video",
+      "Uploads data into OpenGL", "Matthew Waters <matthew@centricular.com>");
+
+  G_OBJECT_CLASS (klass)->finalize = gst_gl_download_element_finalize;
+}
+
+static void
+gst_gl_download_element_init (GstGLDownloadElement * download)
+{
+  gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (download),
+      TRUE);
+}
+
+static void
+gst_gl_download_element_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (gst_gl_download_element_parent_class)->finalize (object);
+}
+
+static gboolean
+gst_gl_download_element_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
+    GstCaps * out_caps)
+{
+  GstVideoInfo out_info;
+
+  if (!gst_video_info_from_caps (&out_info, out_caps))
+    return FALSE;
+
+  return TRUE;
+}
+
+static GstCaps *
+_set_caps_features (const GstCaps * caps, const gchar * feature_name)
+{
+  GstCaps *tmp = gst_caps_copy (caps);
+  guint n = gst_caps_get_size (tmp);
+  guint i = 0;
+
+  for (i = 0; i < n; i++)
+    gst_caps_set_features (tmp, i,
+        gst_caps_features_from_string (feature_name));
+
+  return tmp;
+}
+
+static GstCaps *
+gst_gl_download_element_transform_caps (GstBaseTransform * bt,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
+{
+  GstCaps *result, *tmp;
+
+  if (direction == GST_PAD_SRC) {
+    tmp = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+    tmp = gst_caps_merge (gst_caps_ref (caps), tmp);
+  } else {
+    tmp = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
+    tmp = gst_caps_merge (gst_caps_ref (caps), tmp);
+  }
+
+  if (filter) {
+    result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+  } else {
+    result = tmp;
+  }
+
+  GST_DEBUG_OBJECT (bt, "returning caps %" GST_PTR_FORMAT, result);
+
+  return result;
+}
+
+static gboolean
+gst_gl_download_element_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
+    gsize * size)
+{
+  gboolean ret = FALSE;
+  GstVideoInfo info;
+
+  ret = gst_video_info_from_caps (&info, caps);
+  if (ret)
+    *size = GST_VIDEO_INFO_SIZE (&info);
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
+    GstBuffer * inbuf, GstBuffer ** outbuf)
+{
+  *outbuf = inbuf;
+
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+gst_gl_download_element_transform (GstBaseTransform * bt,
+    GstBuffer * inbuf, GstBuffer * outbuf)
+{
+  return GST_FLOW_OK;
+}
diff --git a/ext/gl/gstgldownloadelement.h b/ext/gl/gstgldownloadelement.h
new file mode 100644
index 0000000..eabfeec
--- /dev/null
+++ b/ext/gl/gstgldownloadelement.h
@@ -0,0 +1,56 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystree00@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_DOWNLOAD_ELEMENT_H__
+#define __GST_GL_DOWNLOAD_ELEMENT_H__
+
+#include <gst/video/video.h>
+#include <gst/gstmemory.h>
+
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_download_element_get_type (void);
+#define GST_TYPE_GL_DOWNLOAD_ELEMENT (gst_gl_download_element_get_type())
+#define GST_GL_DOWNLOAD_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DOWNLOAD_ELEMENT,GstGLDownloadElement))
+#define GST_GL_DOWNLOAD_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_DISPLAY,GstGLDownloadElementClass))
+#define GST_IS_GL_DOWNLOAD_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DOWNLOAD_ELEMENT))
+#define GST_IS_GL_DOWNLOAD_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_DOWNLOAD_ELEMENT))
+#define GST_GL_DOWNLOAD_ELEMENT_CAST(obj) ((GstGLDownloadElement*)(obj))
+
+typedef struct _GstGLDownloadElement GstGLDownloadElement;
+typedef struct _GstGLDownloadElementClass GstGLDownloadElementClass;
+
+struct _GstGLDownloadElement
+{
+  /* <private> */
+  GstGLBaseFilter  parent;
+};
+
+struct _GstGLDownloadElementClass
+{
+  /* <private> */
+  GstGLBaseFilterClass object_class;
+};
+
+G_END_DECLS
+
+#endif /* __GST_GL_DOWNLOAD_ELEMENT_H__ */
diff --git a/ext/gl/gstgleffects.c b/ext/gl/gstgleffects.c
index c142821..a85e624 100644
--- a/ext/gl/gstgleffects.c
+++ b/ext/gl/gstgleffects.c
@@ -130,61 +130,100 @@
 static void
 gst_gl_effects_set_effect (GstGLEffects * effects, gint effect_type)
 {
+  GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (effects);
+  GstGLContext *context = GST_GL_BASE_FILTER (effects)->context;
 
   switch (effect_type) {
     case GST_GL_EFFECT_IDENTITY:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_identity;
+      filter_class->supported_gl_api =
+          GST_GL_API_GLES2 | GST_GL_API_OPENGL | GST_GL_API_OPENGL3;
+      effects->current_effect = effect_type;
       break;
     case GST_GL_EFFECT_MIRROR:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_mirror;
+      filter_class->supported_gl_api =
+          GST_GL_API_GLES2 | GST_GL_API_OPENGL | GST_GL_API_OPENGL3;
+      effects->current_effect = effect_type;
       break;
     case GST_GL_EFFECT_SQUEEZE:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_squeeze;
+      filter_class->supported_gl_api =
+          GST_GL_API_GLES2 | GST_GL_API_OPENGL | GST_GL_API_OPENGL3;
+      effects->current_effect = effect_type;
       break;
+  }
+
+  if (context
+      && (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL) ==
+      GST_GL_API_NONE) {
+    GST_ELEMENT_WARNING (effects, RESOURCE, SETTINGS, ("%s",
+            "cannot change effect type"), ("%s",
+            "the current OpenGL context does not support the GL API required"));
+    return;
+  }
 #if GST_GL_HAVE_OPENGL
+  switch (effect_type) {
+    case GST_GL_EFFECT_IDENTITY:
+    case GST_GL_EFFECT_MIRROR:
+    case GST_GL_EFFECT_SQUEEZE:
+      break;
     case GST_GL_EFFECT_STRETCH:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_stretch;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_TUNNEL:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_tunnel;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_FISHEYE:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_fisheye;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_TWIRL:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_twirl;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_BULGE:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_bulge;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_SQUARE:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_square;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_HEAT:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_heat;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_SEPIA:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_sepia;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_XPRO:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_xpro;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_LUMA_XPRO:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_luma_xpro;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_XRAY:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_xray;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_SIN:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_sin;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
     case GST_GL_EFFECT_GLOW:
       effects->effect = (GstGLEffectProcessFunc) gst_gl_effects_glow;
+      filter_class->supported_gl_api = GST_GL_API_OPENGL;
       break;
-#endif
     default:
       g_assert_not_reached ();
   }
+#endif
   effects->current_effect = effect_type;
 }
 
@@ -193,7 +232,7 @@
 gst_gl_effects_init_gl_resources (GstGLFilter * filter)
 {
   GstGLEffects *effects = GST_GL_EFFECTS (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   gint i = 0;
 
   for (i = 0; i < NEEDED_TEXTURES; i++) {
@@ -221,7 +260,7 @@
 gst_gl_effects_reset_gl_resources (GstGLFilter * filter)
 {
   GstGLEffects *effects = GST_GL_EFFECTS (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   gint i = 0;
 
   for (i = 0; i < NEEDED_TEXTURES; i++) {
@@ -273,6 +312,9 @@
       "Gstreamer OpenGL Effects", "Filter/Effect/Video",
       "GL Shading Language effects",
       "Filippo Argiolas <filippo.argiolas@gmail.com>");
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
 }
 
 static void
@@ -307,7 +349,7 @@
   GstGLFilter *filter = (GstGLFilter *) data;
 
   //blocking call, wait the opengl thread has destroyed the shader
-  gst_gl_context_del_shader (filter->context, shader);
+  gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context, shader);
 
   value = NULL;
 }
@@ -398,7 +440,8 @@
   effects->outtexture = out_tex;
 
   if (effects->horizontal_swap == TRUE)
-    gst_gl_context_thread_add (filter->context, set_horizontal_swap, effects);
+    gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
+        set_horizontal_swap, effects);
 
   effects->effect (effects);
 
diff --git a/ext/gl/gstglfilterapp.c b/ext/gl/gstglfilterapp.c
index d7dbd88..e347e28 100644
--- a/ext/gl/gstglfilterapp.c
+++ b/ext/gl/gstglfilterapp.c
@@ -111,6 +111,9 @@
       "OpenGL application filter", "Filter/Effect",
       "Use client callbacks to define the scene",
       "Julien Isorce <julien.isorce@gmail.com>");
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
 }
 
 static void
@@ -161,23 +164,42 @@
   app_filter->default_draw = !drawn;
 }
 
+struct glcb2
+{
+  GLCB func;
+  gpointer data;
+  guint texture;
+  guint width;
+  guint height;
+};
+
+/* convenience functions to simplify filter development */
+static void
+_glcb2 (gpointer data)
+{
+  struct glcb2 *cb = data;
+
+  cb->func (cb->width, cb->height, cb->texture, cb->data);
+}
+
 static gboolean
 gst_gl_filter_app_filter_texture (GstGLFilter * filter, guint in_tex,
     guint out_tex)
 {
   GstGLFilterApp *app_filter = GST_GL_FILTER_APP (filter);
+  struct glcb2 cb;
+
+  cb.func = (GLCB) _emit_draw_signal;
+  cb.data = filter;
+  cb.texture = in_tex;
+  cb.width = GST_VIDEO_INFO_WIDTH (&filter->in_info);
+  cb.height = GST_VIDEO_INFO_HEIGHT (&filter->in_info);
 
   //blocking call, use a FBO
-  gst_gl_context_use_fbo (filter->context,
+  gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (filter)->context,
       GST_VIDEO_INFO_WIDTH (&filter->out_info),
       GST_VIDEO_INFO_HEIGHT (&filter->out_info),
-      filter->fbo, filter->depthbuffer, out_tex, (GLCB) _emit_draw_signal,
-      GST_VIDEO_INFO_WIDTH (&filter->in_info),
-      GST_VIDEO_INFO_HEIGHT (&filter->in_info),
-      in_tex, 45,
-      (gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
-      (gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info),
-      0.1, 100, GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, filter);
+      filter->fbo, filter->depthbuffer, out_tex, _glcb2, &cb);
 
   if (app_filter->default_draw) {
     gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
@@ -193,10 +215,16 @@
     gpointer stuff)
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
 
-  gl->MatrixMode (GL_PROJECTION);
-  gl->LoadIdentity ();
+#if GST_GL_HAVE_OPENGL
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
+      GST_GL_API_OPENGL) {
+    GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
+
+    gl->MatrixMode (GL_PROJECTION);
+    gl->LoadIdentity ();
+  }
+#endif
 
   gst_gl_filter_draw_texture (filter, texture, width, height);
 }
diff --git a/ext/gl/gstglfilterbin.c b/ext/gl/gstglfilterbin.c
new file mode 100644
index 0000000..9bab3d3
--- /dev/null
+++ b/ext/gl/gstglfilterbin.c
@@ -0,0 +1,285 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstglfilterbin.h"
+
+#define GST_CAT_DEFAULT gst_gl_filter_bin_debug
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
+
+/* Properties */
+enum
+{
+  PROP_0,
+  PROP_FILTER,
+};
+
+enum
+{
+  SIGNAL_0,
+  SIGNAL_CREATE_ELEMENT,
+  LAST_SIGNAL
+};
+
+static guint gst_gl_filter_bin_signals[LAST_SIGNAL] = { 0 };
+
+#define gst_gl_filter_bin_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGLFilterBin, gst_gl_filter_bin,
+    GST_TYPE_BIN, GST_DEBUG_CATEGORY_INIT (gst_gl_filter_bin_debug,
+        "glfilterbin", 0, "glfilterbin element"););
+
+static void gst_gl_filter_bin_finalize (GObject * object);
+static void gst_gl_filter_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void gst_gl_filter_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+
+static GstStateChangeReturn gst_gl_filter_bin_change_state (GstElement *
+    element, GstStateChange transition);
+
+static GstStaticPadTemplate _src_pad_template = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(ANY)"));
+
+static GstStaticPadTemplate _sink_pad_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(ANY)"));
+
+static void
+gst_gl_filter_bin_class_init (GstGLFilterBinClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  element_class->change_state = gst_gl_filter_bin_change_state;
+
+  gobject_class->set_property = gst_gl_filter_bin_set_property;
+  gobject_class->get_property = gst_gl_filter_bin_get_property;
+  gobject_class->finalize = gst_gl_filter_bin_finalize;
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&_src_pad_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&_sink_pad_template));
+
+  g_object_class_install_property (gobject_class, PROP_FILTER,
+      g_param_spec_object ("filter",
+          "GL filter element",
+          "The GL filter chain to use",
+          GST_TYPE_ELEMENT,
+          GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
+          G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstFilterBin::create-element:
+   * @object: the #GstGLFilterBin
+   *
+   * Will be emitted when we need the processing element/s that this bin will use
+   *
+   * Returns: a new #GstElement
+   */
+  gst_gl_filter_bin_signals[SIGNAL_CREATE_ELEMENT] =
+      g_signal_new ("create-element", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      GST_TYPE_ELEMENT, 0);
+
+  gst_element_class_set_metadata (element_class,
+      "GL Filter Bin", "Filter/Video",
+      "Infrastructure to process GL textures",
+      "Matthew Waters <matthew@centricular.com>");
+}
+
+static void
+gst_gl_filter_bin_init (GstGLFilterBin * self)
+{
+  gboolean res = TRUE;
+  GstPad *pad;
+
+  self->upload = gst_element_factory_make ("glupload", NULL);
+  self->in_convert = gst_element_factory_make ("glcolorconvert", NULL);
+  self->out_convert = gst_element_factory_make ("glcolorconvert", NULL);
+  self->download = gst_element_factory_make ("gldownload", NULL);
+
+  res &= gst_bin_add (GST_BIN (self), self->upload);
+  res &= gst_bin_add (GST_BIN (self), self->in_convert);
+  res &= gst_bin_add (GST_BIN (self), self->out_convert);
+  res &= gst_bin_add (GST_BIN (self), self->download);
+
+  res &= gst_element_link_pads (self->upload, "src", self->in_convert, "sink");
+  res &=
+      gst_element_link_pads (self->out_convert, "src", self->download, "sink");
+
+  pad = gst_element_get_static_pad (self->download, "src");
+  if (!pad) {
+    res = FALSE;
+  } else {
+    GST_DEBUG_OBJECT (self, "setting target src pad %" GST_PTR_FORMAT, pad);
+    self->srcpad = gst_ghost_pad_new ("src", pad);
+    gst_element_add_pad (GST_ELEMENT_CAST (self), self->srcpad);
+    gst_object_unref (pad);
+  }
+
+  pad = gst_element_get_static_pad (self->upload, "sink");
+  if (!pad) {
+    res = FALSE;
+  } else {
+    GST_DEBUG_OBJECT (self, "setting target sink pad %" GST_PTR_FORMAT, pad);
+    self->sinkpad = gst_ghost_pad_new ("sink", pad);
+    gst_element_add_pad (GST_ELEMENT_CAST (self), self->sinkpad);
+    gst_object_unref (pad);
+  }
+}
+
+static gboolean
+_connect_filter_element (GstGLFilterBin * self)
+{
+  gboolean res = TRUE;
+
+  gst_object_set_name (GST_OBJECT (self->filter), "filter");
+  res &= gst_bin_add (GST_BIN (self), self->filter);
+
+  res &= gst_element_link_pads (self->in_convert, "src", self->filter, "sink");
+  res &= gst_element_link_pads (self->filter, "src", self->out_convert, "sink");
+
+  if (!res)
+    GST_ERROR_OBJECT (self, "Failed to link filter element into the pipeline");
+
+  return res;
+}
+
+void
+gst_gl_filter_bin_finish_init_with_element (GstGLFilterBin * self,
+    GstElement * element)
+{
+  g_return_if_fail (GST_IS_ELEMENT (element));
+
+  self->filter = element;
+
+  if (!_connect_filter_element (self)) {
+    gst_object_unref (self->filter);
+    self->filter = NULL;
+  }
+}
+
+void
+gst_gl_filter_bin_finish_init (GstGLFilterBin * self)
+{
+  GstGLFilterBinClass *klass = GST_GL_FILTER_BIN_GET_CLASS (self);
+  GstElement *element = NULL;
+
+  if (klass->create_element)
+    element = klass->create_element ();
+
+  if (element)
+    gst_gl_filter_bin_finish_init_with_element (self, element);
+}
+
+static void
+gst_gl_filter_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstGLFilterBin *self = GST_GL_FILTER_BIN (object);
+
+  switch (prop_id) {
+    case PROP_FILTER:
+      g_value_set_object (value, self->filter);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_gl_filter_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstGLFilterBin *self = GST_GL_FILTER_BIN (object);
+
+  switch (prop_id) {
+    case PROP_FILTER:
+    {
+      GstElement *filter = g_value_get_object (value);
+      if (self->filter)
+        gst_bin_remove (GST_BIN (self), self->filter);
+      self->filter = filter;
+      if (filter)
+        _connect_filter_element (self);
+      break;
+    }
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_gl_filter_bin_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static GstStateChangeReturn
+gst_gl_filter_bin_change_state (GstElement * element, GstStateChange transition)
+{
+  GstGLFilterBin *self = GST_GL_FILTER_BIN (element);
+  GstGLFilterBinClass *klass = GST_GL_FILTER_BIN_GET_CLASS (self);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!self->filter) {
+        if (klass->create_element)
+          self->filter = klass->create_element ();
+
+        if (!self->filter)
+          g_signal_emit (element,
+              gst_gl_filter_bin_signals[SIGNAL_CREATE_ELEMENT], 0,
+              &self->filter);
+
+        if (!self->filter) {
+          GST_ERROR_OBJECT (element, "Failed to retreive element");
+          return GST_STATE_CHANGE_FAILURE;
+        }
+        if (!_connect_filter_element (self))
+          return GST_STATE_CHANGE_FAILURE;
+      }
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    default:
+      break;
+  }
+
+  return ret;
+}
diff --git a/ext/gl/gstglfilterbin.h b/ext/gl/gstglfilterbin.h
new file mode 100644
index 0000000..4a77c6c
--- /dev/null
+++ b/ext/gl/gstglfilterbin.h
@@ -0,0 +1,80 @@
+/*
+ * GStreamer
+ * Copyright (C) 2007 David Schleef <ds@schleef.org>
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2008 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_FILTER_BIN_H_
+#define _GST_GL_FILTER_BIN_H_
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+#include <gst/video/video.h>
+
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_filter_bin_get_type(void);
+#define GST_TYPE_GL_FILTER_BIN            (gst_gl_filter_bin_get_type())
+#define GST_GL_FILTER_BIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_FILTER_BIN,GstGLFilterBin))
+#define GST_IS_GL_FILTER_BIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_FILTER_BIN))
+#define GST_GL_FILTER_BIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER_BIN,GstGLFilterBinClass))
+#define GST_IS_GL_FILTER_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER_BIN))
+#define GST_GL_FILTER_BIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER_BIN,GstGLFilterBinClass))
+
+typedef struct _GstGLFilterBin GstGLFilterBin;
+typedef struct _GstGLFilterBinClass GstGLFilterBinClass;
+
+/**
+ * GstGLFilterBin:
+ * @parent: parent #GstBin
+ */
+struct _GstGLFilterBin
+{
+  GstBin   parent;
+
+  GstPad *srcpad;
+  GstPad *sinkpad;
+
+  GstElement *upload;
+  GstElement *in_convert;
+  GstElement *filter;
+  GstElement *out_convert;
+  GstElement *download;
+};
+
+/**
+ * GstGLFilterBinClass:
+ * @parent_class: parent class
+ */
+struct _GstGLFilterBinClass
+{
+  GstBinClass parent_class;
+
+  GstElement * (*create_element) (void);
+};
+
+void gst_gl_filter_bin_finish_init (GstGLFilterBin * self);
+void gst_gl_filter_bin_finish_init_with_element (GstGLFilterBin * self,
+    GstElement * element);
+
+G_END_DECLS
+
+#endif /* _GST_GL_FILTER_BIN_H_ */
diff --git a/ext/gl/gstglfilterblur.c b/ext/gl/gstglfilterblur.c
index fd275ec..842a014 100644
--- a/ext/gl/gstglfilterblur.c
+++ b/ext/gl/gstglfilterblur.c
@@ -67,7 +67,7 @@
 gst_gl_filterblur_init_resources (GstGLFilter * filter)
 {
   GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->GenTextures (1, &filterblur->midtexture);
   gl->BindTexture (GL_TEXTURE_2D, filterblur->midtexture);
@@ -85,7 +85,7 @@
 gst_gl_filterblur_reset_resources (GstGLFilter * filter)
 {
   GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->DeleteTextures (1, &filterblur->midtexture);
 }
@@ -114,6 +114,8 @@
       gst_gl_filterblur_reset_resources;
   GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filterblur_init_shader;
   GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_filterblur_reset;
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
 }
 
 static void
@@ -135,12 +137,14 @@
 
   //blocking call, wait the opengl thread has destroyed the shader
   if (filterblur->shader0)
-    gst_gl_context_del_shader (filter->context, filterblur->shader0);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        filterblur->shader0);
   filterblur->shader0 = NULL;
 
   //blocking call, wait the opengl thread has destroyed the shader
   if (filterblur->shader1)
-    gst_gl_context_del_shader (filter->context, filterblur->shader1);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        filterblur->shader1);
   filterblur->shader1 = NULL;
 }
 
@@ -176,13 +180,13 @@
   GstGLFilterBlur *blur_filter = GST_GL_FILTERBLUR (filter);
 
   //blocking call, wait the opengl thread has compiled the shader
-  if (!gst_gl_context_gen_shader (filter->context, 0, hconv7_fragment_source,
-          &blur_filter->shader0))
+  if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
+          hconv7_fragment_source, &blur_filter->shader0))
     return FALSE;
 
   //blocking call, wait the opengl thread has compiled the shader
-  if (!gst_gl_context_gen_shader (filter->context, 0, vconv7_fragment_source,
-          &blur_filter->shader1))
+  if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
+          vconv7_fragment_source, &blur_filter->shader1))
     return FALSE;
 
   return TRUE;
@@ -209,7 +213,7 @@
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
   GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   gl->LoadIdentity ();
@@ -236,7 +240,7 @@
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
   GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gl->MatrixMode (GL_PROJECTION);
   gl->LoadIdentity ();
diff --git a/ext/gl/gstglfiltercube.c b/ext/gl/gstglfiltercube.c
index 35bf677..518b295 100644
--- a/ext/gl/gstglfiltercube.c
+++ b/ext/gl/gstglfiltercube.c
@@ -26,15 +26,15 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch -v videotestsrc ! glupload ! glfiltercube ! glimagesink
+ * gst-launch-1.0 -v videotestsrc ! glfiltercube ! glimagesink
  * ]| A pipeline to mpa textures on the 6 cube faces..
  * FBO is required.
  * |[
- * gst-launch -v videotestsrc ! glupload ! glfiltercube ! video/x-raw-gl, width=640, height=480 ! glimagesink
+ * gst-launch-1.0 -v videotestsrc ! glfiltercube ! video/x-raw, width=640, height=480 ! glimagesink
  * ]| Resize scene after drawing the cube.
  * The scene size is greater than the input video size.
   |[
- * gst-launch -v videotestsrc ! glupload ! video/x-raw-gl, width=640, height=480  ! glfiltercube ! glimagesink
+ * gst-launch-1.0 -v videotestsrc ! video/x-raw, width=640, height=480  ! glfiltercube ! glimagesink
  * ]| Resize scene before drawing the cube.
  * The scene size is greater than the input video size.
  * </refsect2>
@@ -75,27 +75,20 @@
 
 static gboolean gst_gl_filter_cube_set_caps (GstGLFilter * filter,
     GstCaps * incaps, GstCaps * outcaps);
-#if GST_GL_HAVE_GLES2
 static void gst_gl_filter_cube_reset (GstGLFilter * filter);
+static void gst_gl_filter_cube_reset_gl (GstGLFilter * filter);
 static gboolean gst_gl_filter_cube_init_shader (GstGLFilter * filter);
-static void _callback_gles2 (gint width, gint height, guint texture,
-    gpointer stuff);
-#endif
-#if GST_GL_HAVE_OPENGL
-static void _callback_opengl (gint width, gint height, guint texture,
-    gpointer stuff);
-#endif
+static void _callback (gpointer stuff);
 static gboolean gst_gl_filter_cube_filter_texture (GstGLFilter * filter,
     guint in_tex, guint out_tex);
 
-#if GST_GL_HAVE_GLES2
 /* vertex source */
 static const gchar *cube_v_src =
     "attribute vec4 a_position;                                   \n"
-    "attribute vec2 a_texCoord;                                   \n"
+    "attribute vec2 a_texcoord;                                   \n"
     "uniform mat4 u_matrix;                                       \n"
     "uniform float xrot_degree, yrot_degree, zrot_degree;         \n"
-    "varying vec2 v_texCoord;                                     \n"
+    "varying vec2 v_texcoord;                                     \n"
     "void main()                                                  \n"
     "{                                                            \n"
     "   float PI = 3.14159265;                                    \n"
@@ -118,19 +111,20 @@
     "            0.0,        0.0,        1.0, 0.0,                \n"
     "            0.0,        0.0,        0.0, 1.0 );              \n"
     "   gl_Position = u_matrix * matZ * matY * matX * a_position; \n"
-    "   v_texCoord = a_texCoord;                                  \n"
+    "   v_texcoord = a_texcoord;                                  \n"
     "}                                                            \n";
 
 /* fragment source */
 static const gchar *cube_f_src =
-    "precision mediump float;                            \n"
-    "varying vec2 v_texCoord;                            \n"
+    "#ifdef GL_ES\n"
+    "precision mediump float;\n"
+    "#endif\n"
+    "varying vec2 v_texcoord;                            \n"
     "uniform sampler2D s_texture;                        \n"
     "void main()                                         \n"
     "{                                                   \n"
-    "  gl_FragColor = texture2D( s_texture, v_texCoord );\n"
+    "  gl_FragColor = texture2D( s_texture, v_texcoord );\n"
     "}                                                   \n";
-#endif
 
 static void
 gst_gl_filter_cube_class_init (GstGLFilterCubeClass * klass)
@@ -144,10 +138,9 @@
   gobject_class->set_property = gst_gl_filter_cube_set_property;
   gobject_class->get_property = gst_gl_filter_cube_get_property;
 
-#if GST_GL_HAVE_GLES2
   GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_cube_init_shader;
   GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_cube_reset;
-#endif
+  GST_GL_FILTER_CLASS (klass)->display_reset_cb = gst_gl_filter_cube_reset_gl;
   GST_GL_FILTER_CLASS (klass)->set_caps = gst_gl_filter_cube_set_caps;
   GST_GL_FILTER_CLASS (klass)->filter_texture =
       gst_gl_filter_cube_filter_texture;
@@ -157,7 +150,7 @@
           0.0f, 1.0f, 0.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_GREEN,
-      g_param_spec_float ("green", "Green", "Background reen color",
+      g_param_spec_float ("green", "Green", "Background green color",
           0.0f, 1.0f, 0.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_BLUE,
@@ -186,6 +179,9 @@
   gst_element_class_set_metadata (element_class, "OpenGL cube filter",
       "Filter/Effect/Video", "Map input texture on the 6 cube faces",
       "Julien Isorce <julien.isorce@gmail.com>");
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
 }
 
 static void
@@ -279,7 +275,23 @@
   return TRUE;
 }
 
-#if GST_GL_HAVE_GLES2
+static void
+gst_gl_filter_cube_reset_gl (GstGLFilter * filter)
+{
+  GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
+
+  if (cube_filter->vao) {
+    gl->DeleteVertexArrays (1, &cube_filter->vao);
+    cube_filter->vao = 0;
+  }
+
+  if (cube_filter->vertex_buffer) {
+    gl->DeleteBuffers (1, &cube_filter->vertex_buffer);
+    cube_filter->vertex_buffer = 0;
+  }
+}
+
 static void
 gst_gl_filter_cube_reset (GstGLFilter * filter)
 {
@@ -287,7 +299,8 @@
 
   /* blocking call, wait the opengl thread has destroyed the shader */
   if (cube_filter->shader)
-    gst_gl_context_del_shader (filter->context, cube_filter->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        cube_filter->shader);
   cube_filter->shader = NULL;
 }
 
@@ -296,166 +309,30 @@
 {
   GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
 
-  if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_GLES2) {
-    /* blocking call, wait the opengl thread has compiled the shader */
-    return gst_gl_context_gen_shader (filter->context, cube_v_src, cube_f_src,
-        &cube_filter->shader);
-  }
-  return TRUE;
+  /* blocking call, wait the opengl thread has compiled the shader */
+  return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+      cube_v_src, cube_f_src, &cube_filter->shader);
 }
-#endif
 
 static gboolean
 gst_gl_filter_cube_filter_texture (GstGLFilter * filter, guint in_tex,
     guint out_tex)
 {
   GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
-  GLCB cb = NULL;
-  GstGLAPI api;
 
-  api = gst_gl_context_get_gl_api (GST_GL_FILTER (cube_filter)->context);
-
-#if GST_GL_HAVE_OPENGL
-  if (api & GST_GL_API_OPENGL)
-    cb = _callback_opengl;
-#endif
-#if GST_GL_HAVE_GLES2
-  if (api & GST_GL_API_GLES2)
-    cb = _callback_gles2;
-#endif
+  cube_filter->in_tex = in_tex;
 
   /* blocking call, use a FBO */
-  gst_gl_context_use_fbo (filter->context,
+  gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (filter)->context,
       GST_VIDEO_INFO_WIDTH (&filter->out_info),
-      GST_VIDEO_INFO_HEIGHT (&filter->out_info),
-      filter->fbo, filter->depthbuffer, out_tex,
-      cb,
-      GST_VIDEO_INFO_WIDTH (&filter->in_info),
-      GST_VIDEO_INFO_HEIGHT (&filter->in_info),
-      in_tex, cube_filter->fovy, cube_filter->aspect,
-      cube_filter->znear, cube_filter->zfar,
-      GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, (gpointer) cube_filter);
+      GST_VIDEO_INFO_HEIGHT (&filter->out_info), filter->fbo,
+      filter->depthbuffer, out_tex, _callback, (gpointer) cube_filter);
 
   return TRUE;
 }
 
-/* opengl scene, params: input texture (not the output filter->texture) */
-#if GST_GL_HAVE_OPENGL
-static void
-_callback_opengl (gint width, gint height, guint texture, gpointer stuff)
-{
-  GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (stuff);
-  GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
-
-  static GLfloat xrot = 0;
-  static GLfloat yrot = 0;
-  static GLfloat zrot = 0;
-
 /* *INDENT-OFF* */
-  const GLfloat v_vertices[] = {
- /*|     Vertex     | TexCoord |*/ 
-    /* front face */
-     1.0,  1.0, -1.0, 0.0, 0.0,
-     1.0, -1.0, -1.0, 1.0, 0.0,
-    -1.0, -1.0, -1.0, 1.0, 1.0,
-    -1.0,  1.0, -1.0, 0.0, 1.0,
-    /* back face */
-    -1.0,  1.0,  1.0, 0.0, 0.0,
-    -1.0, -1.0,  1.0, 1.0, 0.0,
-     1.0, -1.0,  1.0, 1.0, 1.0,
-     1.0,  1.0,  1.0, 0.0, 1.0,
-    /* right face */
-    -1.0,  1.0, -1.0, 0.0, 0.0,
-    -1.0, -1.0, -1.0, 1.0, 0.0,
-    -1.0, -1.0,  1.0, 1.0, 1.0,
-    -1.0,  1.0,  1.0, 0.0, 1.0,
-    /* left face */
-     1.0,  1.0,  1.0, 0.0, 0.0,
-     1.0, -1.0,  1.0, 1.0, 0.0,
-     1.0, -1.0, -1.0, 1.0, 1.0,
-     1.0,  1.0, -1.0, 0.0, 1.0,
-    /* top face */
-     1.0,  1.0,  1.0, 0.0, 0.0,
-     1.0,  1.0, -1.0, 1.0, 0.0,
-    -1.0,  1.0, -1.0, 1.0, 1.0,
-    -1.0,  1.0,  1.0, 0.0, 1.0,
-    /* bottom face */
-     1.0, -1.0,  1.0, 0.0, 0.0,
-     1.0, -1.0, -1.0, 1.0, 0.0,
-    -1.0, -1.0, -1.0, 1.0, 1.0,
-    -1.0, -1.0,  1.0, 0.0, 1.0,
-  };
-/* *INDENT-ON* */
-
-  GLushort indices[] = {
-    0, 1, 2,
-    0, 2, 3,
-    4, 5, 6,
-    4, 6, 7,
-    8, 9, 10,
-    8, 10, 11,
-    12, 13, 14,
-    12, 14, 15,
-    16, 17, 18,
-    16, 18, 19,
-    20, 21, 22,
-    20, 22, 23
-  };
-
-  gl->Enable (GL_DEPTH_TEST);
-
-  gl->Enable (GL_TEXTURE_2D);
-  gl->BindTexture (GL_TEXTURE_2D, texture);
-
-  gl->ClearColor (cube_filter->red, cube_filter->green, cube_filter->blue, 0.0);
-  gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-  gl->MatrixMode (GL_PROJECTION);
-  gluLookAt (0.0, 0.0, -6.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
-  gl->MatrixMode (GL_MODELVIEW);
-  gl->LoadIdentity ();
-
-//  gl->Translatef (0.0f, 0.0f, -5.0f);
-
-  gl->Rotatef (xrot, 1.0f, 0.0f, 0.0f);
-  gl->Rotatef (yrot, 0.0f, 1.0f, 0.0f);
-  gl->Rotatef (zrot, 0.0f, 0.0f, 1.0f);
-
-  gl->ClientActiveTexture (GL_TEXTURE0);
-  gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
-  gl->EnableClientState (GL_VERTEX_ARRAY);
-
-  gl->VertexPointer (3, GL_FLOAT, 5 * sizeof (float), v_vertices);
-  gl->TexCoordPointer (2, GL_FLOAT, 5 * sizeof (float), &v_vertices[3]);
-
-  gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, indices);
-
-  gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
-  gl->DisableClientState (GL_VERTEX_ARRAY);
-
-  gl->Disable (GL_DEPTH_TEST);
-
-  xrot += 0.3f;
-  yrot += 0.2f;
-  zrot += 0.4f;
-}
-#endif
-
-#if GST_GL_HAVE_GLES2
-static void
-_callback_gles2 (gint width, gint height, guint texture, gpointer stuff)
-{
-  GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
-
-  static GLfloat xrot = 0;
-  static GLfloat yrot = 0;
-  static GLfloat zrot = 0;
-
-/* *INDENT-OFF* */
-  const GLfloat v_vertices[] = {
+static const GLfloat vertices[] = {
  /*|     Vertex     | TexCoord |*/ 
     /* front face */
      1.0,  1.0, -1.0, 1.0, 0.0,
@@ -487,9 +364,56 @@
      1.0,  1.0, -1.0, 1.0, 1.0,
     -1.0,  1.0, -1.0, 0.0, 1.0,
     -1.0,  1.0,  1.0, 0.0, 0.0
-  };
+};
 /* *INDENT-ON* */
 
+static void
+_bind_buffer (GstGLFilterCube * cube_filter)
+{
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (cube_filter)->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, cube_filter->vertex_buffer);
+
+  cube_filter->attr_position =
+      gst_gl_shader_get_attribute_location (cube_filter->shader, "a_position");
+
+  cube_filter->attr_texture =
+      gst_gl_shader_get_attribute_location (cube_filter->shader, "a_texcoord");
+
+  /* Load the vertex position */
+  gl->VertexAttribPointer (cube_filter->attr_position, 3, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) 0);
+
+  /* Load the texture coordinate */
+  gl->VertexAttribPointer (cube_filter->attr_texture, 2, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
+
+  gl->EnableVertexAttribArray (cube_filter->attr_position);
+  gl->EnableVertexAttribArray (cube_filter->attr_texture);
+}
+
+static void
+_unbind_buffer (GstGLFilterCube * cube_filter)
+{
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (cube_filter)->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  gl->DisableVertexAttribArray (cube_filter->attr_position);
+  gl->DisableVertexAttribArray (cube_filter->attr_texture);
+}
+
+static void
+_callback (gpointer stuff)
+{
+  GstGLFilter *filter = GST_GL_FILTER (stuff);
+  GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
+
+  static GLfloat xrot = 0;
+  static GLfloat yrot = 0;
+  static GLfloat zrot = 0;
+
   GLushort indices[] = {
     0, 1, 2,
     0, 2, 3,
@@ -505,9 +429,6 @@
     20, 22, 23
   };
 
-  GLint attr_position_loc = 0;
-  GLint attr_texture_loc = 0;
-
   const GLfloat matrix[] = {
     0.5f, 0.0f, 0.0f, 0.0f,
     0.0f, 0.5f, 0.0f, 0.0f,
@@ -522,24 +443,8 @@
 
   gst_gl_shader_use (cube_filter->shader);
 
-  attr_position_loc =
-      gst_gl_shader_get_attribute_location (cube_filter->shader, "a_position");
-  attr_texture_loc =
-      gst_gl_shader_get_attribute_location (cube_filter->shader, "a_texCoord");
-
-  /* Load the vertex position */
-  gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
-      GL_FALSE, 5 * sizeof (GLfloat), v_vertices);
-
-  /* Load the texture coordinate */
-  gl->VertexAttribPointer (attr_texture_loc, 2, GL_FLOAT,
-      GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[3]);
-
-  gl->EnableVertexAttribArray (attr_position_loc);
-  gl->EnableVertexAttribArray (attr_texture_loc);
-
   gl->ActiveTexture (GL_TEXTURE0);
-  gl->BindTexture (GL_TEXTURE_2D, texture);
+  gl->BindTexture (GL_TEXTURE_2D, cube_filter->in_tex);
   gst_gl_shader_set_uniform_1i (cube_filter->shader, "s_texture", 0);
   gst_gl_shader_set_uniform_1f (cube_filter->shader, "xrot_degree", xrot);
   gst_gl_shader_set_uniform_1f (cube_filter->shader, "yrot_degree", yrot);
@@ -547,10 +452,34 @@
   gst_gl_shader_set_uniform_matrix_4fv (cube_filter->shader, "u_matrix", 1,
       GL_FALSE, matrix);
 
+  if (!cube_filter->vertex_buffer) {
+    if (gl->GenVertexArrays) {
+      gl->GenVertexArrays (1, &cube_filter->vao);
+      gl->BindVertexArray (cube_filter->vao);
+    }
+
+    gl->GenBuffers (1, &cube_filter->vertex_buffer);
+    gl->BindBuffer (GL_ARRAY_BUFFER, cube_filter->vertex_buffer);
+    gl->BufferData (GL_ARRAY_BUFFER, 6 * 4 * 5 * sizeof (GLfloat), vertices,
+        GL_STATIC_DRAW);
+
+    if (gl->GenVertexArrays) {
+      _bind_buffer (cube_filter);
+      gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+    }
+  }
+
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (cube_filter->vao);
+  else
+    _bind_buffer (cube_filter);
+
   gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, indices);
 
-  gl->DisableVertexAttribArray (attr_position_loc);
-  gl->DisableVertexAttribArray (attr_texture_loc);
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (0);
+  else
+    _unbind_buffer (cube_filter);
 
   gl->Disable (GL_DEPTH_TEST);
 
@@ -558,4 +487,3 @@
   yrot += 0.2f;
   zrot += 0.4f;
 }
-#endif
diff --git a/ext/gl/gstglfiltercube.h b/ext/gl/gstglfiltercube.h
index c3e1488..6850f00 100644
--- a/ext/gl/gstglfiltercube.h
+++ b/ext/gl/gstglfiltercube.h
@@ -51,6 +51,12 @@
     gdouble aspect;
     gdouble znear;
     gdouble zfar;
+
+    guint              in_tex;
+    GLuint             vao;
+    GLuint             vertex_buffer;
+    GLint              attr_position;
+    GLint              attr_texture;
 };
 
 struct _GstGLFilterCubeClass
diff --git a/ext/gl/gstglfilterglass.c b/ext/gl/gstglfilterglass.c
index 4b26552..0fe109a 100644
--- a/ext/gl/gstglfilterglass.c
+++ b/ext/gl/gstglfilterglass.c
@@ -27,11 +27,11 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch -v videotestsrc ! glupload ! glfilterglass ! glimagesink
+ * gst-launch-1.0 -v videotestsrc ! glfilterglass ! glimagesink
  * ]| A pipeline inspired from http://www.mdk.org.pl/2007/11/17/gl-colorspace-conversions
  * FBO is required.
  * |[
- * gst-launch -v videotestsrc ! glupload ! glfilterglass ! "video/x-raw-gl, width=640, height=480" ! glimagesink
+ * gst-launch-1.0 -v videotestsrc ! glfilterglass ! video/x-raw, width=640, height=480 ! glimagesink
  * ]| The scene is greater than the input size.
  * </refsect2>
  */
@@ -162,6 +162,8 @@
       gst_gl_filter_glass_filter_texture;
   GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_glass_init_shader;
   GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_glass_reset;
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
 }
 
 static void
@@ -178,10 +180,11 @@
 
   //blocking call, wait the opengl thread has destroyed the shader
   if (glass_filter->shader)
-    gst_gl_context_del_shader (filter->context, glass_filter->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        glass_filter->shader);
   glass_filter->shader = NULL;
   if (glass_filter->passthrough_shader)
-    gst_gl_context_del_shader (filter->context,
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
         glass_filter->passthrough_shader);
   glass_filter->passthrough_shader = NULL;
 }
@@ -220,12 +223,13 @@
 
   //blocking call, wait the opengl thread has compiled the shader
   ret =
-      gst_gl_context_gen_shader (filter->context, glass_vertex_source,
-      glass_fragment_source, &glass_filter->shader);
+      gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+      glass_vertex_source, glass_fragment_source, &glass_filter->shader);
   if (ret)
     ret =
-        gst_gl_context_gen_shader (filter->context, passthrough_vertex,
-        passthrough_fragment, &glass_filter->passthrough_shader);
+        gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+        passthrough_vertex, passthrough_fragment,
+        &glass_filter->passthrough_shader);
 
   return ret;
 }
@@ -238,7 +242,7 @@
   glass_filter->in_tex = in_tex;
 
   //blocking call, use a FBO
-  gst_gl_context_use_fbo_v2 (filter->context,
+  gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (filter)->context,
       GST_VIDEO_INFO_WIDTH (&filter->out_info),
       GST_VIDEO_INFO_HEIGHT (&filter->out_info),
       filter->fbo, filter->depthbuffer, out_tex,
@@ -260,7 +264,7 @@
 gst_gl_filter_glass_draw_background_gradient (GstGLFilterGlass * glass)
 {
   GstGLFilter *filter = GST_GL_FILTER (glass);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
 /* *INDENT-OFF* */
   gfloat mesh[] = {
@@ -301,7 +305,7 @@
     gfloat start_alpha, gfloat stop_alpha, gboolean reversed, gfloat rotation)
 {
   GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gfloat topy = reversed ? center_y - 1.0f : center_y + 1.0f;
   gfloat bottomy = reversed ? center_y + 1.0f : center_y - 1.0f;
@@ -356,7 +360,7 @@
 
   GstGLFilter *filter = GST_GL_FILTER (stuff);
   GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gint width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
   gint height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
@@ -399,7 +403,7 @@
   gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
       0.0f, 0.0f, 1.0f, 1.0f, FALSE, rotation);
 
-  gst_gl_context_clear_shader (filter->context);
+  gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
 
   gl->Disable (GL_TEXTURE_2D);
   gl->Disable (GL_BLEND);
diff --git a/ext/gl/gstglfilterlaplacian.c b/ext/gl/gstglfilterlaplacian.c
index 6424a9c..da656bc 100644
--- a/ext/gl/gstglfilterlaplacian.c
+++ b/ext/gl/gstglfilterlaplacian.c
@@ -119,6 +119,8 @@
       gst_gl_filter_laplacian_filter_texture;
   GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_laplacian_init_shader;
   GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_laplacian_reset;
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
 }
 
 static void
@@ -134,7 +136,8 @@
 
   //blocking call, wait the opengl thread has destroyed the shader
   if (laplacian_filter->shader)
-    gst_gl_context_del_shader (filter->context, laplacian_filter->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        laplacian_filter->shader);
   laplacian_filter->shader = NULL;
 }
 
@@ -170,7 +173,7 @@
   GstGLFilterLaplacian *laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
 
   //blocking call, wait the opengl thread has compiled the shader
-  return gst_gl_context_gen_shader (filter->context, 0,
+  return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
       convolution_fragment_source, &laplacian_filter->shader);
 }
 
@@ -195,7 +198,7 @@
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
   GstGLFilterLaplacian *laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gfloat kernel[9] = { 0.0, -1.0, 0.0,
     -1.0, 4.0, -1.0,
diff --git a/ext/gl/gstglfilterreflectedscreen.c b/ext/gl/gstglfilterreflectedscreen.c
deleted file mode 100644
index c1ef34d..0000000
--- a/ext/gl/gstglfilterreflectedscreen.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2010 Pierre Pouzol<pierre.pouzol@hotmail.fr>
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-glfilterreflectedscreen
- *
- * Map Video Texture upon a screen, on a reflecting surface
- *
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch videotestsrc ! glupload ! glfilterreflectedscreen ! glimagesink
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include "gstglfilterreflectedscreen.h"
-
-#define GST_CAT_DEFAULT gst_gl_filter_reflected_screen_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-enum
-{
-  PROP_0,
-  PROP_ACTIVE_GRAPHIC_MODE,
-  PROP_SEPARATED_SCREEN,
-  PROP_SHOW_FLOOR,
-  PROP_FOVY,
-  PROP_ASPECT,
-  PROP_ZNEAR,
-  PROP_ZFAR
-};
-
-#define DEBUG_INIT \
-  GST_DEBUG_CATEGORY_INIT (gst_gl_filter_reflected_screen_debug, "glfilterreflectedscreen", 0, "glfilterreflectedscreen element");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLFilterReflectedScreen,
-    gst_gl_filter_reflected_screen, GST_TYPE_GL_FILTER, DEBUG_INIT);
-
-static void gst_gl_filter_reflected_screen_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_gl_filter_reflected_screen_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean gst_gl_filter_reflected_screen_filter_texture (GstGLFilter *
-    filter, guint in_tex, guint out_tex);
-
-static void gst_gl_filter_reflected_screen_draw_background ();
-static void gst_gl_filter_reflected_screen_draw_floor ();
-static void gst_gl_filter_reflected_screen_draw_screen (GstGLFilter * filter,
-    gint width, gint height, guint texture);
-static void gst_gl_filter_reflected_screen_draw_separated_screen (GstGLFilter *
-    filter, gint width, gint height, guint texture, gfloat alphs, gfloat alphe);
-
-static void gst_gl_filter_reflected_screen_callback (gint width, gint height,
-    guint texture, gpointer stuff);
-
-static GLfloat LightPos[] = { 4.0f, -4.0f, 6.0f, 1.0f };        // Light Position
-static GLfloat LightAmb[] = { 4.0f, 4.0f, 4.0f, 1.0f }; // Ambient Light
-static GLfloat LightDif[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light
-
-static void
-gst_gl_filter_reflected_screen_class_init (GstGLFilterReflectedScreenClass *
-    klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *element_class;
-
-  gobject_class = (GObjectClass *) klass;
-  element_class = GST_ELEMENT_CLASS (klass);
-
-  gobject_class->set_property = gst_gl_filter_reflected_screen_set_property;
-  gobject_class->get_property = gst_gl_filter_reflected_screen_get_property;
-
-  GST_GL_FILTER_CLASS (klass)->filter_texture =
-      gst_gl_filter_reflected_screen_filter_texture;
-
-  g_object_class_install_property (gobject_class, PROP_ACTIVE_GRAPHIC_MODE,
-      g_param_spec_boolean ("active-graphic-mode",
-          "Activate graphic mode",
-          "Allow user to activate stencil buffer and blending.",
-          TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_SEPARATED_SCREEN,
-      g_param_spec_boolean ("separated-screen",
-          "Create a separation space",
-          "Allow to insert a space between the two screen. Will cancel 'show floor' if active. Value are TRUE or FALSE(default)",
-          FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_SHOW_FLOOR,
-      g_param_spec_boolean ("show-floor",
-          "Show the support",
-          "Allow the user to show the supportive floor. Will cancel 'separated screen' if active. Value are TRUE(default) or FALSE",
-          TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_FOVY,
-      g_param_spec_double ("fovy", "Fovy", "Field of view angle in degrees",
-          0.0, 180.0, 60, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_ASPECT,
-      g_param_spec_double ("aspect", "Aspect",
-          "Field of view in the x direction", 1.0, 100, 1.0,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_ZNEAR,
-      g_param_spec_double ("znear", "Znear",
-          "Specifies the distance from the viewer to the near clipping plane",
-          0.0000000001, 100.0, 0.1,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_ZFAR,
-      g_param_spec_double ("zfar", "Zfar",
-          "Specifies the distance from the viewer to the far clipping plane",
-          0.0, 1000.0, 100.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  gst_element_class_set_metadata (element_class,
-      "OpenGL Reflected Screen filter", "Filter/Effect/Video",
-      "Reflected Screen Filter", "Pierre POUZOL <pierre.pouzol@hotmail.fr>");
-}
-
-static void
-gst_gl_filter_reflected_screen_init (GstGLFilterReflectedScreen * filter)
-{
-  filter->active_graphic_mode = TRUE;
-  filter->separated_screen = FALSE;
-  filter->show_floor = TRUE;
-  filter->fovy = 90;
-  filter->aspect = 1.0;
-  filter->znear = 0.1;
-  filter->zfar = 1000;
-}
-
-static void
-gst_gl_filter_reflected_screen_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstGLFilterReflectedScreen *filter = GST_GL_FILTER_REFLECTED_SCREEN (object);
-
-  switch (prop_id) {
-    case PROP_ACTIVE_GRAPHIC_MODE:
-      filter->active_graphic_mode = g_value_get_boolean (value);
-      break;
-    case PROP_SEPARATED_SCREEN:
-      filter->separated_screen = g_value_get_boolean (value);
-      break;
-    case PROP_SHOW_FLOOR:
-      filter->show_floor = g_value_get_boolean (value);
-      break;
-    case PROP_FOVY:
-      filter->fovy = g_value_get_double (value);
-      break;
-    case PROP_ASPECT:
-      filter->aspect = g_value_get_double (value);
-      break;
-    case PROP_ZNEAR:
-      filter->znear = g_value_get_double (value);
-      break;
-    case PROP_ZFAR:
-      filter->zfar = g_value_get_double (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_gl_filter_reflected_screen_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstGLFilterReflectedScreen *filter = GST_GL_FILTER_REFLECTED_SCREEN (object);
-
-  switch (prop_id) {
-    case PROP_ACTIVE_GRAPHIC_MODE:
-      g_value_set_boolean (value, filter->active_graphic_mode);
-      break;
-    case PROP_SEPARATED_SCREEN:
-      g_value_set_boolean (value, filter->separated_screen);
-      break;
-    case PROP_SHOW_FLOOR:
-      g_value_set_boolean (value, filter->show_floor);
-      break;
-    case PROP_FOVY:
-      g_value_set_double (value, filter->fovy);
-      break;
-    case PROP_ASPECT:
-      g_value_set_double (value, filter->aspect);
-      break;
-    case PROP_ZNEAR:
-      g_value_set_double (value, filter->znear);
-      break;
-    case PROP_ZFAR:
-      g_value_set_double (value, filter->zfar);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static gboolean
-gst_gl_filter_reflected_screen_filter_texture (GstGLFilter * filter,
-    guint in_tex, guint out_tex)
-{
-  GstGLFilterReflectedScreen *reflected_screen_filter =
-      GST_GL_FILTER_REFLECTED_SCREEN (filter);
-
-  //blocking call, use a FBO
-  gst_gl_context_use_fbo (filter->context,
-      GST_VIDEO_INFO_WIDTH (&filter->out_info),
-      GST_VIDEO_INFO_HEIGHT (&filter->out_info),
-      filter->fbo, filter->depthbuffer, out_tex,
-      gst_gl_filter_reflected_screen_callback,
-      GST_VIDEO_INFO_WIDTH (&filter->in_info),
-      GST_VIDEO_INFO_HEIGHT (&filter->in_info), in_tex,
-      reflected_screen_filter->fovy, reflected_screen_filter->aspect,
-      reflected_screen_filter->znear, reflected_screen_filter->zfar,
-      GST_GL_DISPLAY_PROJECTION_PERSPECTIVE,
-      (gpointer) reflected_screen_filter);
-
-  return TRUE;
-}
-
-static void
-gst_gl_filter_reflected_screen_draw_separated_screen (GstGLFilter * filter,
-    gint width, gint height, guint texture, gfloat alphs, gfloat alphe)
-{
-  //enable ARB Rectangular texturing
-  //that's necessary to have the video displayed on our screen (with gstreamer)
-  glEnable (GL_TEXTURE_2D);
-  glBindTexture (GL_TEXTURE_2D, texture);
-  //configure parameters for the texturing
-  //the two first are used to specified how the texturing will be done if the screen is greater than the texture herself
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-  //the next two specified how the texture will comport near the limits
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
-  //creating screen and setting the texture (depending on texture's height and width)
-  glBegin (GL_QUADS);
-
-  // right Face
-  glColor4f (1.0f, 1.0f, 1.0f, alphs);
-  glTexCoord2f (0.5f, 1.0f);
-  glVertex3f (-0.75f, 0.0f, -1.0f);
-  glColor4f (1.0f, 1.0f, 1.0f, alphe);
-  glTexCoord2f (0.5f, 0.0f);
-  glVertex3f (-0.75f, 1.25f, -1.0f);
-  glTexCoord2f (1.0f, 0.0f);
-  glVertex3f (1.25f, 1.25f, -1.0f);
-  glColor4f (1.0f, 1.0f, 1.0f, alphs);
-  glTexCoord2f (1.0f, 1.0f);
-  glVertex3f (1.25f, 0.0f, -1.0f);
-  // Left Face
-  glColor4f (1.0f, 1.0f, 1.0f, alphs);
-  glTexCoord2f (0.5f, 1.0f);
-  glVertex3f (-1.0f, 0.0f, -0.75f);
-  glTexCoord2f (0.0f, 1.0f);
-  glVertex3f (-1.0f, 0.0f, 1.25f);
-  glColor4f (1.0f, 1.0f, 1.0f, alphe);
-  glTexCoord2f (0.0f, 0.0f);
-  glVertex3f (-1.0f, 1.25f, 1.25f);
-  glTexCoord2f (0.5f, 0.0f);
-  glVertex3f (-1.0f, 1.25f, -0.75f);
-
-  glEnd ();
-  glDisable (GL_TEXTURE_2D);
-}
-
-static void
-gst_gl_filter_reflected_screen_draw_screen (GstGLFilter * filter,
-    gint width, gint height, guint texture)
-{
-  //enable ARB Rectangular texturing
-  //that's necessary to have the video displayed on our screen (with gstreamer)
-  glEnable (GL_TEXTURE_2D);
-  glBindTexture (GL_TEXTURE_2D, texture);
-  //configure parameters for the texturing
-  //the two first are used to specified how the texturing will be done if the screen is greater than the texture herself
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-  //the next two specified how the texture will comport near the limits
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
-  //creating screen and setting the texture (depending on texture's height and width)
-  glBegin (GL_QUADS);
-
-  glTexCoord2f (0.5f, 1.0f);
-  glVertex3f (-1.0f, 0.0f, -1.0f);
-  glTexCoord2f (0.5f, 0.0f);
-  glVertex3f (-1.0f, 1.0f, -1.0f);
-  glTexCoord2f (1.0f, 0.0f);
-  glVertex3f (1.0f, 1.0f, -1.0f);
-  glTexCoord2f (1.0f, 1.0f);
-  glVertex3f (1.0f, 0.0f, -1.0f);
-  // Left Face
-  glTexCoord2f (0.5f, 1.0f);
-  glVertex3f (-1.0f, 0.0f, -1.0f);
-  glTexCoord2f (0.0f, 1.0f);
-  glVertex3f (-1.0f, 0.0f, 1.0f);
-  glTexCoord2f (0.0f, 0.0f);
-  glVertex3f (-1.0f, 1.0f, 1.0f);
-  glTexCoord2f (0.5f, 0.0f);
-  glVertex3f (-1.0f, 1.0f, -1.0f);
-
-  glEnd ();
-
-  //disable this kind of texturing (useless for the gluDisk)
-  glDisable (GL_TEXTURE_2D);
-}
-
-static void
-gst_gl_filter_reflected_screen_draw_background (void)
-{
-  glBegin (GL_QUADS);
-
-  // right Face
-
-  glColor4f (0.0f, 0.0f, 0.0f, 1.0f);
-  glVertex3f (-10.0f, -10.0f, -1.0f);
-
-  glColor4f (0.0f, 0.0f, 0.2f, 1.0f);
-  glVertex3f (-10.0f, 10.0f, -1.0f);
-  glVertex3f (10.0f, 10.0f, -1.0f);
-  glVertex3f (10.0f, -10.0f, -1.0f);
-
-  glEnd ();
-}
-
-static void
-gst_gl_filter_reflected_screen_draw_floor (void)
-{
-  GLUquadricObj *q;
-  //create a quadric for the floor's drawing
-  q = gluNewQuadric ();
-  //configure this quadric's parameter (for lighting and texturing)
-  gluQuadricNormals (q, GL_SMOOTH);
-  gluQuadricTexture (q, GL_FALSE);
-
-  //drawing the disk. The texture are mapped thanks to the parameter we gave to the GLUquadric q
-  gluDisk (q, 0.0, 2.2, 50, 1);
-}
-
-//opengl scene, params: input texture (not the output filter->texture)
-static void
-gst_gl_filter_reflected_screen_callback (gint width, gint height, guint texture,
-    gpointer stuff)
-{
-  GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFilterReflectedScreen *reflected_screen_filter =
-      GST_GL_FILTER_REFLECTED_SCREEN (stuff);
-
-  glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
-  //load identity befor tracing
-  glLoadIdentity ();
-  //camera translation
-  glTranslatef (0.0f, 0.1f, -1.3f);
-  //camera configuration
-  if (reflected_screen_filter->separated_screen)
-    gluLookAt (0.1, -0.25, 2.0, 0.025, 0.0, 0.0, 0.0, 1.0, 0.0);
-  else
-    gluLookAt (0.1, -0.35, 2.0, 0.025, 0.0, 0.0, 0.0, 1.0, 0.0);
-
-  gst_gl_filter_reflected_screen_draw_background ();
-
-  if (reflected_screen_filter->separated_screen) {
-    glEnable (GL_BLEND);
-
-    glPushMatrix ();
-    glScalef (1.0f, -1.0f, 1.0f);
-    glTranslatef (0.0f, 0.0f, 1.2f);
-    glRotatef (-45.0f, 0.0, 1.0, 0.0);
-    gst_gl_filter_reflected_screen_draw_separated_screen (filter, width, height,
-        texture, 1.0f, 1.0f);
-    glPopMatrix ();
-
-    if (reflected_screen_filter->active_graphic_mode) {
-      //configuration of the transparency function
-      glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-      glTranslatef (0.0f, 0.0f, 1.2f);
-      glRotatef (-45.0f, 0.0, 1.0, 0.0);
-      gst_gl_filter_reflected_screen_draw_separated_screen (filter, width,
-          height, texture, 0.5f, 0.0f);
-      glDisable (GL_BLEND);
-    }
-  }
-  if (reflected_screen_filter->show_floor) {
-    glLightfv (GL_LIGHT0, GL_AMBIENT, LightAmb);
-    glLightfv (GL_LIGHT0, GL_DIFFUSE, LightDif);
-    glLightfv (GL_LIGHT0, GL_POSITION, LightPos);
-
-    //enable lighting
-    glEnable (GL_LIGHT0);
-    glEnable (GL_LIGHTING);
-
-    if (reflected_screen_filter->active_graphic_mode) {
-      glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-      //enable stencil buffer use
-      glEnable (GL_STENCIL_TEST);
-      //setting the stencil buffer. Each time a pixel will be drawn by now, this pixel value will be set to 1
-      glStencilFunc (GL_ALWAYS, 1, 1);
-      glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
-
-      //disable the zbuffer
-      glDisable (GL_DEPTH_TEST);
-      //make a rotation of 90 degree on x axis. By default, gluDisk draw a disk on z axis
-      glRotatef (-90.0f, 1.0, 0.0, 0.0);
-      //draw the floor. Each pixel representing this floor will now have a value of 1 on stencil buffer
-      gst_gl_filter_reflected_screen_draw_floor ();
-      //make an anti-rotation of 90 degree to draw the rest of the scene on the right angle
-      glRotatef (90.0f, 1.0, 0.0, 0.0);
-      //enable zbuffer again
-      glEnable (GL_DEPTH_TEST);
-      //enable the drawing to be shown
-      glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-      //say that the next object have to be drawn ONLY where the stencil buffer's pixel's value is 1
-      glStencilFunc (GL_EQUAL, 1, 1);
-      glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
-
-      //save the actual matrix
-      glPushMatrix ();
-      glLightfv (GL_LIGHT0, GL_POSITION, LightPos);
-      //translate the object on z axis
-      glTranslatef (0.0f, 0.0f, 1.4f);
-      //rotate it (because the drawing method place the user behind the left part of the screen)
-      glRotatef (-45.0f, 0.0, 1.0, 0.0);
-      //draw the reflexion
-      gst_gl_filter_reflected_screen_draw_screen (filter, width, height,
-          texture);
-      //return to the saved matrix position
-      glPopMatrix ();
-      //end of the stencil buffer uses
-      glDisable (GL_STENCIL_TEST);
-
-      //enable the blending to mix the floor and reflexion color
-      glEnable (GL_BLEND);
-      glDisable (GL_LIGHTING);
-      //specified a white color (for the floor) with 20% transparency
-      glColor4f (1.0f, 1.0f, 1.0f, 0.8f);
-      //configuration of the transparency function
-      glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    }
-    //draw the floor (which will appear this time)
-    glRotatef (-90.0f, 1.0, 0.0, 0.0);
-    gst_gl_filter_reflected_screen_draw_floor ();
-    glRotatef (90.0f, 1.0, 0.0, 0.0);
-    glDisable (GL_BLEND);
-    glEnable (GL_LIGHTING);
-    //draw the real object
-    //scale on y axis. The object must be drawn upside down (to suggest a reflexion)
-    glScalef (1.0f, -1.0f, 1.0f);
-    glTranslatef (0.0f, 0.0f, 1.4f);
-    glRotatef (-45.0f, 0.0, 1.0, 0.0);
-    gst_gl_filter_reflected_screen_draw_screen (filter, width, height, texture);
-    glDisable (GL_LIGHTING);
-  }
-}
diff --git a/ext/gl/gstglfilterreflectedscreen.h b/ext/gl/gstglfilterreflectedscreen.h
deleted file mode 100644
index a739689..0000000
--- a/ext/gl/gstglfilterreflectedscreen.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Pierre Pouzol<pierre.pouzol@hotmail.fr>
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_GL_FILTERREFLECTEDSCREEN_H_
-#define _GST_GL_FILTERREFLECTEDSCREEN_H_
-
-#include <gst/gl/gstglfilter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_FILTER_REFLECTED_SCREEN          (gst_gl_filter_reflected_screen_get_type())
-#define GST_GL_FILTER_REFLECTED_SCREEN(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_FILTER_REFLECTED_SCREEN,GstGLFilterReflectedScreen))
-#define GST_IS_GL_FILTER_REFLECTED_SCREEN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_FILTER_REFLECTED_SCREEN))
-#define GST_GL_FILTER_REFLECTED_SCREEN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER_REFLECTED_SCREEN,GstGLFilterReflectedScreenClass))
-#define GST_IS_GL_FILTER_REFLECTED_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER_REFLECTED_SCREEN))
-#define GST_GL_FILTER_REFLECTED_SCREEN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER_REFLECTED_SCREEN,GstGLFilterReflectedScreenClass))
-
-typedef struct _GstGLFilterReflectedScreen GstGLFilterReflectedScreen;
-typedef struct _GstGLFilterReflectedScreenClass GstGLFilterReflectedScreenClass;
-
-struct _GstGLFilterReflectedScreen
-{
-	GstGLFilter filter;
-	gdouble fovy;
-	gdouble aspect;
-	gdouble znear;
-	gdouble zfar;
-
-	gboolean active_graphic_mode;
-	gboolean separated_screen;
-	gboolean show_floor;
-};
-
-struct _GstGLFilterReflectedScreenClass
-{
-	GstGLFilterClass filter_class;
-};
-
-GType gst_gl_filter_reflected_screen_get_type (void);
-
-G_END_DECLS
-
-#endif /* _GST_GLFILTERREFLECTEDSCREEN_H_ */
-
diff --git a/ext/gl/gstglfiltershader.c b/ext/gl/gstglfiltershader.c
index 5da6ed4..91c4cfb 100644
--- a/ext/gl/gstglfiltershader.c
+++ b/ext/gl/gstglfiltershader.c
@@ -149,6 +149,9 @@
       gst_gl_filtershader_reset_resources;
   GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filtershader_init_shader;
   GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_filtershader_reset;
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
 }
 
 static void
@@ -164,7 +167,8 @@
 
   //blocking call, wait the opengl thread has destroyed the shader
   if (filtershader->shader0)
-    gst_gl_context_del_shader (filter->context, filtershader->shader0);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        filtershader->shader0);
   filtershader->shader0 = NULL;
 }
 
@@ -323,8 +327,8 @@
     return FALSE;
 
   //blocking call, wait the opengl thread has compiled the shader
-  if (!gst_gl_context_gen_shader (filter->context, text_vertex_shader,
-          hfilter_fragment_source, &filtershader->shader0))
+  if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+          text_vertex_shader, hfilter_fragment_source, &filtershader->shader0))
     return FALSE;
 
 
@@ -392,26 +396,11 @@
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
   GstGLFilterShader *filtershader = GST_GL_FILTERSHADER (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
-  const GLfloat vVertices[] = {
-    -1.0f, -1.0f, -1.0f, 0.0f, 0.0f,
-    1.0, -1.0f, -1.0f, 1.0f, 0.0f,
-    1.0f, 1.0f, -1.0f, 1.0f, 1.0f,
-    -1.0f, 1.0f, -1.0f, 0.0f, 1.0f
-  };
-  GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
-#if GST_GL_HAVE_OPENGL
-  if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
-    gl->MatrixMode (GL_PROJECTION);
-    gl->LoadIdentity ();
-  }
-#endif
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   gst_gl_shader_use (filtershader->shader0);
 
   gl->ActiveTexture (GL_TEXTURE0);
-  gl->Enable (GL_TEXTURE_2D);
   gl->BindTexture (GL_TEXTURE_2D, texture);
 
   gst_gl_shader_set_uniform_1i (filtershader->shader0, "tex", 0);
@@ -420,10 +409,10 @@
   gst_gl_shader_set_uniform_1f (filtershader->shader0, "time",
       filtershader->time);
 
-  filtershader->attr_position_loc =
+  filter->draw_attr_position_loc =
       gst_gl_shader_get_attribute_location (filtershader->shader0,
       "a_position");
-  filtershader->attr_texture_loc =
+  filter->draw_attr_texture_loc =
       gst_gl_shader_get_attribute_location (filtershader->shader0,
       "a_texcoord");
 
@@ -442,19 +431,5 @@
 
   gl->Clear (GL_COLOR_BUFFER_BIT);
 
-  gl->EnableVertexAttribArray (filtershader->attr_position_loc);
-  gl->EnableVertexAttribArray (filtershader->attr_texture_loc);
-
-  /* Load the vertex position */
-  gl->VertexAttribPointer (filtershader->attr_position_loc, 3, GL_FLOAT,
-      GL_FALSE, 5 * sizeof (GLfloat), vVertices);
-
-  /* Load the texture coordinate */
-  gl->VertexAttribPointer (filtershader->attr_texture_loc, 2, GL_FLOAT,
-      GL_FALSE, 5 * sizeof (GLfloat), &vVertices[3]);
-
-  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
-
-  gl->DisableVertexAttribArray (filtershader->attr_position_loc);
-  gl->DisableVertexAttribArray (filtershader->attr_texture_loc);
+  gst_gl_filter_draw_texture (filter, texture, width, height);
 }
diff --git a/ext/gl/gstglfiltersobel.c b/ext/gl/gstglfiltersobel.c
index 538f96e..f70b6d2 100644
--- a/ext/gl/gstglfiltersobel.c
+++ b/ext/gl/gstglfiltersobel.c
@@ -71,7 +71,7 @@
 gst_gl_filtersobel_init_resources (GstGLFilter * filter)
 {
   GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   int i;
 
   for (i = 0; i < 2; i++) {
@@ -92,7 +92,7 @@
 gst_gl_filtersobel_reset_resources (GstGLFilter * filter)
 {
   GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   int i;
 
   for (i = 0; i < 2; i++) {
@@ -131,6 +131,8 @@
   gst_element_class_set_metadata (element_class,
       "Gstreamer OpenGL Sobel", "Filter/Effect/Video", "Sobel edge detection",
       "Filippo Argiolas <filippo.argiolas@gmail.com>");
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
 }
 
 static void
@@ -152,19 +154,23 @@
 
   //blocking call, wait the opengl thread has destroyed the shader
   if (filtersobel->desat)
-    gst_gl_context_del_shader (filter->context, filtersobel->desat);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        filtersobel->desat);
   filtersobel->desat = NULL;
 
   if (filtersobel->hconv)
-    gst_gl_context_del_shader (filter->context, filtersobel->hconv);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        filtersobel->hconv);
   filtersobel->hconv = NULL;
 
   if (filtersobel->vconv)
-    gst_gl_context_del_shader (filter->context, filtersobel->vconv);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        filtersobel->vconv);
   filtersobel->vconv = NULL;
 
   if (filtersobel->len)
-    gst_gl_context_del_shader (filter->context, filtersobel->len);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        filtersobel->len);
   filtersobel->len = NULL;
 }
 
@@ -208,16 +214,16 @@
 
   //blocking call, wait the opengl thread has compiled the shader
   ret =
-      gst_gl_context_gen_shader (filter->context, 0, desaturate_fragment_source,
-      &filtersobel->desat);
+      gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
+      desaturate_fragment_source, &filtersobel->desat);
   ret &=
-      gst_gl_context_gen_shader (filter->context, 0,
+      gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
       sep_sobel_hconv3_fragment_source, &filtersobel->hconv);
   ret &=
-      gst_gl_context_gen_shader (filter->context, 0,
+      gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
       sep_sobel_vconv3_fragment_source, &filtersobel->vconv);
   ret &=
-      gst_gl_context_gen_shader (filter->context, 0,
+      gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
       sep_sobel_length_fragment_source, &filtersobel->len);
 
   return ret;
@@ -248,7 +254,7 @@
     gpointer stuff)
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
   GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
 
   glMatrixMode (GL_PROJECTION);
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index cd3a9ff..ae3f3df 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
  * Copyright (C) 2005,2006,2007 David A. Schleef <ds@schleef.org>
  * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -56,12 +57,12 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch -v videotestsrc ! "video/x-raw-rgb" ! glimagesink
+ * gst-launch-1.0 -v videotestsrc ! video/x-raw ! glimagesink
  * ]| A pipeline to test hardware scaling.
  * No special opengl extension is used in this pipeline, that's why it should work
  * with OpenGL >= 1.1. That's the case if you are using the MESA3D driver v1.3.
  * |[
- * gst-launch -v videotestsrc ! "video/x-raw-yuv, format=(fourcc)I420" ! glimagesink
+ * gst-launch-1.0 -v videotestsrc ! video/x-raw,format=I420 ! glimagesink
  * ]| A pipeline to test hardware scaling and hardware colorspace conversion.
  * When your driver supports GLSL (OpenGL Shading Language needs OpenGL >= 2.1),
  * the 4 following format YUY2, UYVY, I420, YV12 and AYUV are converted to RGB32
@@ -70,12 +71,12 @@
  * the you can use YUY2 and UYVY. In this case the colorspace conversion is automatically
  * made when loading the texture and therefore no framebuffer is used.
  * |[
- * gst-launch -v gltestsrc ! glimagesink
+ * gst-launch-1.0 -v gltestsrc ! glimagesink
  * ]| A pipeline 100% OpenGL.
  * No special opengl extension is used in this pipeline, that's why it should work
  * with OpenGL >= 1.1. That's the case if you are using the MESA3D driver v1.3.
  * |[
- * gst-plugins-gl/tests/examples/generic/cube
+ * gst-plugins-bas/tests/examples/gl/generic/cube
  * ]| The graphic FPS scene can be greater than the input video FPS.
  * The graphic scene can be written from a client code through the
  * two glfilterapp properties.
@@ -87,8 +88,10 @@
 #endif
 
 #include <gst/video/videooverlay.h>
+#include <gst/video/navigation.h>
 
 #include "gstglimagesink.h"
+#include "gstglsinkbin.h"
 
 #if GST_GL_HAVE_PLATFORM_EGL
 #include <gst/gl/egl/gsteglimagememory.h>
@@ -97,6 +100,202 @@
 GST_DEBUG_CATEGORY (gst_debug_glimage_sink);
 #define GST_CAT_DEFAULT gst_debug_glimage_sink
 
+#define DEFAULT_SHOW_PREROLL_FRAME  TRUE
+#define DEFAULT_SYNC                TRUE
+#define DEFAULT_MAX_LATENESS        -1
+#define DEFAULT_QOS                 FALSE
+#define DEFAULT_ASYNC               TRUE
+#define DEFAULT_TS_OFFSET           0
+#define DEFAULT_BLOCKSIZE           4096
+#define DEFAULT_RENDER_DELAY        0
+#define DEFAULT_ENABLE_LAST_SAMPLE  TRUE
+#define DEFAULT_THROTTLE_TIME       0
+#define DEFAULT_MAX_BITRATE         0
+#define DEFAULT_HANDLE_EVENTS       TRUE
+#define DEFAULT_FORCE_ASPECT_RATIO  TRUE
+
+typedef GstGLSinkBin GstGLImageSinkBin;
+typedef GstGLSinkBinClass GstGLImageSinkBinClass;
+
+G_DEFINE_TYPE (GstGLImageSinkBin, gst_gl_image_sink_bin, GST_TYPE_GL_SINK_BIN);
+
+enum
+{
+  PROP_BIN_0,
+  PROP_BIN_FORCE_ASPECT_RATIO,
+  PROP_BIN_PIXEL_ASPECT_RATIO,
+  PROP_BIN_HANDLE_EVENTS,
+  PROP_BIN_CONTEXT,
+  PROP_BIN_SHOW_PREROLL_FRAME,
+  PROP_BIN_SYNC,
+  PROP_BIN_MAX_LATENESS,
+  PROP_BIN_QOS,
+  PROP_BIN_ASYNC,
+  PROP_BIN_TS_OFFSET,
+  PROP_BIN_ENABLE_LAST_SAMPLE,
+  PROP_BIN_LAST_SAMPLE,
+  PROP_BIN_BLOCKSIZE,
+  PROP_BIN_RENDER_DELAY,
+  PROP_BIN_THROTTLE_TIME,
+  PROP_BIN_MAX_BITRATE,
+};
+
+enum
+{
+  SIGNAL_BIN_0,
+  SIGNAL_BIN_CLIENT_DRAW,
+  SIGNAL_BIN_CLIENT_RESHAPE,
+  SIGNAL_BIN_LAST,
+};
+
+static guint gst_gl_image_sink_bin_signals[SIGNAL_BIN_LAST] = { 0 };
+
+static void
+gst_gl_image_sink_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * param_spec)
+{
+  g_object_set_property (G_OBJECT (GST_GL_SINK_BIN (object)->sink),
+      param_spec->name, value);
+}
+
+static void
+gst_gl_image_sink_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * param_spec)
+{
+  g_object_get_property (G_OBJECT (GST_GL_SINK_BIN (object)->sink),
+      param_spec->name, value);
+}
+
+static gboolean
+_on_client_reshape (GstGLImageSink * sink, GstGLContext * context,
+    guint width, guint height, gpointer data)
+{
+  gboolean ret;
+
+  g_signal_emit (data, gst_gl_image_sink_bin_signals[SIGNAL_BIN_CLIENT_RESHAPE],
+      0, context, width, height, &ret);
+
+  return ret;
+}
+
+static gboolean
+_on_client_draw (GstGLImageSink * sink, GstGLContext * context,
+    GstSample * sample, gpointer data)
+{
+  gboolean ret;
+
+  g_signal_emit (data, gst_gl_image_sink_bin_signals[SIGNAL_BIN_CLIENT_DRAW], 0,
+      context, sample, &ret);
+
+  return ret;
+}
+
+static void
+gst_gl_image_sink_bin_init (GstGLImageSinkBin * self)
+{
+  GstGLImageSink *sink = g_object_new (GST_TYPE_GLIMAGE_SINK, NULL);
+
+  g_signal_connect (sink, "client-reshape", (GCallback) _on_client_reshape,
+      self);
+  g_signal_connect (sink, "client-draw", (GCallback) _on_client_draw, self);
+
+  gst_gl_sink_bin_finish_init_with_element (GST_GL_SINK_BIN (self),
+      GST_ELEMENT (sink));
+}
+
+static void
+gst_gl_image_sink_bin_class_init (GstGLImageSinkBinClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->get_property = gst_gl_image_sink_bin_get_property;
+  gobject_class->set_property = gst_gl_image_sink_bin_set_property;
+
+  /* gl sink */
+  g_object_class_install_property (gobject_class, PROP_BIN_FORCE_ASPECT_RATIO,
+      g_param_spec_boolean ("force-aspect-ratio",
+          "Force aspect ratio",
+          "When enabled, scaling will respect original aspect ratio",
+          DEFAULT_FORCE_ASPECT_RATIO,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_HANDLE_EVENTS,
+      g_param_spec_boolean ("ignore-alpha", "Ignore Alpha",
+          "When enabled, alpha will be ignored and converted to black",
+          DEFAULT_HANDLE_EVENTS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_CONTEXT,
+      g_param_spec_object ("context", "OpenGL context", "Get OpenGL context",
+          GST_GL_TYPE_CONTEXT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_PIXEL_ASPECT_RATIO,
+      gst_param_spec_fraction ("pixel-aspect-ratio", "Pixel Aspect Ratio",
+          "The pixel aspect ratio of the device", 0, 1, G_MAXINT, 1, 1, 1,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /* video sink */
+  g_object_class_install_property (gobject_class, PROP_BIN_SHOW_PREROLL_FRAME,
+      g_param_spec_boolean ("show-preroll-frame", "Show preroll frame",
+          "Whether to render video frames during preroll",
+          DEFAULT_SHOW_PREROLL_FRAME,
+          G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+
+  /* base sink */
+  g_object_class_install_property (gobject_class, PROP_BIN_SYNC,
+      g_param_spec_boolean ("sync", "Sync", "Sync on the clock", DEFAULT_SYNC,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_MAX_LATENESS,
+      g_param_spec_int64 ("max-lateness", "Max Lateness",
+          "Maximum number of nanoseconds that a buffer can be late before it "
+          "is dropped (-1 unlimited)", -1, G_MAXINT64, DEFAULT_MAX_LATENESS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_QOS,
+      g_param_spec_boolean ("qos", "Qos",
+          "Generate Quality-of-Service events upstream", DEFAULT_QOS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_ASYNC,
+      g_param_spec_boolean ("async", "Async",
+          "Go asynchronously to PAUSED", DEFAULT_ASYNC,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_TS_OFFSET,
+      g_param_spec_int64 ("ts-offset", "TS Offset",
+          "Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
+          DEFAULT_TS_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_ENABLE_LAST_SAMPLE,
+      g_param_spec_boolean ("enable-last-sample", "Enable Last Buffer",
+          "Enable the last-sample property", DEFAULT_ENABLE_LAST_SAMPLE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_LAST_SAMPLE,
+      g_param_spec_boxed ("last-sample", "Last Sample",
+          "The last sample received in the sink", GST_TYPE_SAMPLE,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_BLOCKSIZE,
+      g_param_spec_uint ("blocksize", "Block size",
+          "Size in bytes to pull per buffer (0 = default)", 0, G_MAXUINT,
+          DEFAULT_BLOCKSIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_RENDER_DELAY,
+      g_param_spec_uint64 ("render-delay", "Render Delay",
+          "Additional render delay of the sink in nanoseconds", 0, G_MAXUINT64,
+          DEFAULT_RENDER_DELAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_THROTTLE_TIME,
+      g_param_spec_uint64 ("throttle-time", "Throttle time",
+          "The time to keep between rendered buffers (0 = disabled)", 0,
+          G_MAXUINT64, DEFAULT_THROTTLE_TIME,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BIN_MAX_BITRATE,
+      g_param_spec_uint64 ("max-bitrate", "Max Bitrate",
+          "The maximum bits per second to render (0 = disabled)", 0,
+          G_MAXUINT64, DEFAULT_MAX_BITRATE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gst_gl_image_sink_bin_signals[SIGNAL_BIN_CLIENT_DRAW] =
+      g_signal_new ("client-draw", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      G_TYPE_BOOLEAN, 2, GST_GL_TYPE_CONTEXT, GST_TYPE_SAMPLE);
+
+  gst_gl_image_sink_bin_signals[SIGNAL_BIN_CLIENT_RESHAPE] =
+      g_signal_new ("client-reshape", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      G_TYPE_BOOLEAN, 3, GST_GL_TYPE_CONTEXT, G_TYPE_UINT, G_TYPE_UINT);
+}
+
 #define GST_GLIMAGE_SINK_GET_LOCK(glsink) \
   (GST_GLIMAGE_SINK(glsink)->drawing_lock)
 #define GST_GLIMAGE_SINK_LOCK(glsink) \
@@ -110,9 +309,10 @@
 #define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
 #define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
 
-#if GST_GL_HAVE_GLES2
+#define SUPPORTED_GL_APIS GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3
+
 static void gst_glimage_sink_thread_init_redisplay (GstGLImageSink * gl_sink);
-#endif
+static void gst_glimage_sink_cleanup_glthread (GstGLImageSink * gl_sink);
 static void gst_glimage_sink_on_close (GstGLImageSink * gl_sink);
 static void gst_glimage_sink_on_resize (GstGLImageSink * gl_sink,
     gint width, gint height);
@@ -137,6 +337,8 @@
 static void gst_glimage_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
     GstClockTime * start, GstClockTime * end);
 static gboolean gst_glimage_sink_set_caps (GstBaseSink * bsink, GstCaps * caps);
+static GstCaps *gst_glimage_sink_get_caps (GstBaseSink * bsink,
+    GstCaps * filter);
 static GstFlowReturn gst_glimage_sink_prepare (GstBaseSink * bsink,
     GstBuffer * buf);
 static GstFlowReturn gst_glimage_sink_show_frame (GstVideoSink * bsink,
@@ -150,20 +352,17 @@
     guintptr id);
 static void gst_glimage_sink_expose (GstVideoOverlay * overlay);
 
+static void
+gst_glimage_sink_handle_events (GstVideoOverlay * overlay,
+    gboolean handle_events);
+
 static GstStaticPadTemplate gst_glimage_sink_template =
-    GST_STATIC_PAD_TEMPLATE ("sink",
+GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
         (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
-            "RGBA") "; "
-#if GST_GL_HAVE_PLATFORM_EGL
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-        (GST_CAPS_FEATURE_MEMORY_EGL_IMAGE, "RGBA") "; "
-#endif
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-        (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META,
-            "RGBA") "; " GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS))
+            "RGBA"))
     );
 
 enum
@@ -172,7 +371,9 @@
   ARG_DISPLAY,
   PROP_FORCE_ASPECT_RATIO,
   PROP_PIXEL_ASPECT_RATIO,
-  PROP_OTHER_CONTEXT
+  PROP_CONTEXT,
+  PROP_HANDLE_EVENTS,
+  PROP_IGNORE_ALPHA,
 };
 
 enum
@@ -185,10 +386,64 @@
 
 static guint gst_glimage_sink_signals[LAST_SIGNAL] = { 0 };
 
+static void
+gst_glimage_sink_navigation_send_event (GstNavigation * navigation, GstStructure
+    * structure)
+{
+  GstGLImageSink *sink = GST_GLIMAGE_SINK (navigation);
+  GstEvent *event = NULL;
+  GstPad *pad = NULL;
+  GstGLWindow *window;
+  guint width, height;
+  gdouble x, y, xscale, yscale;
+
+  if (!sink->context)
+    return;
+
+  window = gst_gl_context_get_window (sink->context);
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+
+  width = GST_VIDEO_SINK_WIDTH (sink);
+  height = GST_VIDEO_SINK_HEIGHT (sink);
+  gst_gl_window_get_surface_dimensions (window, &width, &height);
+
+  event = gst_event_new_navigation (structure);
+
+  pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sink));
+  /* Converting pointer coordinates to the non scaled geometry */
+  if (width != GST_VIDEO_SINK_WIDTH (sink) &&
+      width != 0 && gst_structure_get_double (structure, "pointer_x", &x)) {
+    xscale = (gdouble) GST_VIDEO_SINK_WIDTH (sink) / width;
+    gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
+        (gdouble) x * xscale, NULL);
+  }
+  if (height != GST_VIDEO_SINK_HEIGHT (sink) &&
+      height != 0 && gst_structure_get_double (structure, "pointer_y", &y)) {
+    yscale = (gdouble) GST_VIDEO_SINK_HEIGHT (sink) / height;
+    gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
+        (gdouble) y * yscale, NULL);
+  }
+
+
+  if (GST_IS_PAD (pad) && GST_IS_EVENT (event))
+    gst_pad_send_event (pad, event);
+
+  gst_object_unref (pad);
+  gst_object_unref (window);
+}
+
+static void
+gst_glimage_sink_navigation_interface_init (GstNavigationInterface * iface)
+{
+  iface->send_event = gst_glimage_sink_navigation_send_event;
+}
+
 #define gst_glimage_sink_parent_class parent_class
 G_DEFINE_TYPE_WITH_CODE (GstGLImageSink, gst_glimage_sink,
     GST_TYPE_VIDEO_SINK, G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
         gst_glimage_sink_video_overlay_init);
+    G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
+        gst_glimage_sink_navigation_interface_init);
     GST_DEBUG_CATEGORY_INIT (gst_debug_glimage_sink, "glimagesink", 0,
         "OpenGL Video Sink"));
 
@@ -215,9 +470,9 @@
           NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
-      g_param_spec_boolean ("force-aspect-ratio",
-          "Force aspect ratio",
-          "When enabled, scaling will respect original aspect ratio", TRUE,
+      g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio",
+          "When enabled, scaling will respect original aspect ratio",
+          DEFAULT_FORCE_ASPECT_RATIO,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO,
@@ -225,11 +480,19 @@
           "The pixel aspect ratio of the device", 0, 1, G_MAXINT, 1, 1, 1,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  g_object_class_install_property (gobject_class, PROP_OTHER_CONTEXT,
-      g_param_spec_object ("other-context",
-          "External OpenGL context",
-          "Give an external OpenGL context with which to share textures",
-          GST_GL_TYPE_CONTEXT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_CONTEXT,
+      g_param_spec_object ("context", "OpenGL context", "Get OpenGL context",
+          GST_GL_TYPE_CONTEXT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_HANDLE_EVENTS,
+      g_param_spec_boolean ("handle-events", "Handle XEvents",
+          "When enabled, XEvents will be selected and handled", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_IGNORE_ALPHA,
+      g_param_spec_boolean ("ignore-alpha", "Ignore Alpha",
+          "When enabled, alpha will be ignored and converted to black", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   gst_element_class_set_metadata (element_class, "OpenGL video sink",
       "Sink/Video", "A videosink based on OpenGL",
@@ -252,7 +515,7 @@
   gst_glimage_sink_signals[CLIENT_DRAW_SIGNAL] =
       g_signal_new ("client-draw", G_TYPE_FROM_CLASS (klass),
       G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
-      G_TYPE_BOOLEAN, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
+      G_TYPE_BOOLEAN, 2, GST_GL_TYPE_CONTEXT, GST_TYPE_SAMPLE);
 
   /**
    * GstGLImageSink::client-reshape:
@@ -269,7 +532,7 @@
   gst_glimage_sink_signals[CLIENT_RESHAPE_SIGNAL] =
       g_signal_new ("client-reshape", G_TYPE_FROM_CLASS (klass),
       G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
-      G_TYPE_BOOLEAN, 2, G_TYPE_UINT, G_TYPE_UINT);
+      G_TYPE_BOOLEAN, 3, GST_GL_TYPE_CONTEXT, G_TYPE_UINT, G_TYPE_UINT);
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&gst_glimage_sink_template));
@@ -280,6 +543,7 @@
   gstelement_class->set_context = gst_glimage_sink_set_context;
   gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_glimage_sink_query);
   gstbasesink_class->set_caps = gst_glimage_sink_set_caps;
+  gstbasesink_class->get_caps = gst_glimage_sink_get_caps;
   gstbasesink_class->get_times = gst_glimage_sink_get_times;
   gstbasesink_class->prepare = gst_glimage_sink_prepare;
   gstbasesink_class->propose_allocation = gst_glimage_sink_propose_allocation;
@@ -302,6 +566,8 @@
   glimage_sink->pool = NULL;
   glimage_sink->stored_buffer = NULL;
   glimage_sink->redisplay_texture = 0;
+  glimage_sink->handle_events = TRUE;
+  glimage_sink->ignore_alpha = TRUE;
 
   g_mutex_init (&glimage_sink->drawing_lock);
 }
@@ -334,13 +600,13 @@
       glimage_sink->par_d = gst_value_get_fraction_denominator (value);
       break;
     }
-    case PROP_OTHER_CONTEXT:
-    {
-      if (glimage_sink->other_context)
-        gst_object_unref (glimage_sink->other_context);
-      glimage_sink->other_context = g_value_dup_object (value);
+    case PROP_HANDLE_EVENTS:
+      gst_glimage_sink_handle_events (GST_VIDEO_OVERLAY (glimage_sink),
+          g_value_get_boolean (value));
       break;
-    }
+    case PROP_IGNORE_ALPHA:
+      glimage_sink->ignore_alpha = g_value_get_boolean (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -389,8 +655,14 @@
     case PROP_PIXEL_ASPECT_RATIO:
       gst_value_set_fraction (value, glimage_sink->par_n, glimage_sink->par_d);
       break;
-    case PROP_OTHER_CONTEXT:
-      g_value_set_object (value, glimage_sink->other_context);
+    case PROP_CONTEXT:
+      g_value_set_object (value, glimage_sink->context);
+      break;
+    case PROP_HANDLE_EVENTS:
+      g_value_set_boolean (value, glimage_sink->handle_events);
+      break;
+    case PROP_IGNORE_ALPHA:
+      g_value_set_boolean (value, glimage_sink->ignore_alpha);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -398,50 +670,108 @@
   }
 }
 
+static void
+gst_glimage_sink_key_event_cb (GstGLWindow * window, char *event_name, char
+    *key_string, GstGLImageSink * gl_sink)
+{
+  GST_DEBUG_OBJECT (gl_sink, "glimagesink event %s key %s pressed", event_name,
+      key_string);
+  gst_navigation_send_key_event (GST_NAVIGATION (gl_sink),
+      event_name, key_string);
+}
+
+static void
+gst_glimage_sink_mouse_event_cb (GstGLWindow * window, char *event_name,
+    int button, double posx, double posy, GstGLImageSink * gl_sink)
+{
+  GST_DEBUG_OBJECT (gl_sink, "glimagesink event %s at %g, %g", event_name, posx,
+      posy);
+  gst_navigation_send_mouse_event (GST_NAVIGATION (gl_sink),
+      event_name, button, posx, posy);
+}
+
 static gboolean
 _ensure_gl_setup (GstGLImageSink * gl_sink)
 {
   GError *error = NULL;
 
-  if (!gst_gl_ensure_display (gl_sink, &gl_sink->display))
-    return FALSE;
+  GST_DEBUG_OBJECT (gl_sink, "Ensuring setup");
 
   if (!gl_sink->context) {
-    GstGLWindow *window;
+    do {
+      GstGLContext *other_context;
+      GstGLWindow *window;
 
-    gl_sink->context = gst_gl_context_new (gl_sink->display);
-    if (!gl_sink->context)
-      goto context_creation_error;
+      if (gl_sink->context)
+        gst_object_unref (gl_sink->context);
 
-    window = gst_gl_context_get_window (gl_sink->context);
+      GST_DEBUG_OBJECT (gl_sink,
+          "No current context, creating one for %" GST_PTR_FORMAT,
+          gl_sink->display);
 
-    if (!gl_sink->window_id && !gl_sink->new_window_id)
-      gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (gl_sink));
+      gl_sink->context = gst_gl_context_new (gl_sink->display);
+      if (!gl_sink->context)
+        goto context_creation_error;
 
-    if (gl_sink->window_id != gl_sink->new_window_id) {
-      gl_sink->window_id = gl_sink->new_window_id;
-      gst_gl_window_set_window_handle (window, gl_sink->window_id);
-    }
+      window = gst_gl_context_get_window (gl_sink->context);
 
-    if (!gst_gl_context_create (gl_sink->context, gl_sink->other_context,
-            &error)) {
+      GST_DEBUG_OBJECT (gl_sink, "got window %" GST_PTR_FORMAT, window);
+
+      if (!gl_sink->window_id && !gl_sink->new_window_id)
+        gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (gl_sink));
+
+      GST_DEBUG_OBJECT (gl_sink,
+          "window_id : %" G_GUINTPTR_FORMAT " , new_window_id : %"
+          G_GUINTPTR_FORMAT, gl_sink->window_id, gl_sink->new_window_id);
+
+      if (gl_sink->window_id != gl_sink->new_window_id) {
+        gl_sink->window_id = gl_sink->new_window_id;
+        GST_DEBUG_OBJECT (gl_sink, "Setting window handle on gl window");
+        gst_gl_window_set_window_handle (window, gl_sink->window_id);
+      }
+
+      if (gl_sink->other_context) {
+        other_context = gst_object_ref (gl_sink->other_context);
+      } else {
+        other_context =
+            gst_gl_display_get_gl_context_for_thread (gl_sink->display, NULL);
+      }
+
+      GST_DEBUG_OBJECT (gl_sink,
+          "creating context %" GST_PTR_FORMAT " from other context %"
+          GST_PTR_FORMAT, gl_sink->context, other_context);
+
+      if (!gst_gl_context_create (gl_sink->context, other_context, &error)) {
+        if (other_context)
+          gst_object_unref (other_context);
+        gst_object_unref (window);
+        goto context_error;
+      }
+
+      gst_gl_window_handle_events (window, gl_sink->handle_events);
+
+      /* setup callbacks */
+      gst_gl_window_set_resize_callback (window,
+          GST_GL_WINDOW_RESIZE_CB (gst_glimage_sink_on_resize),
+          gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
+      gst_gl_window_set_draw_callback (window,
+          GST_GL_WINDOW_CB (gst_glimage_sink_on_draw),
+          gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
+      gst_gl_window_set_close_callback (window,
+          GST_GL_WINDOW_CB (gst_glimage_sink_on_close),
+          gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
+      gl_sink->key_sig_id = g_signal_connect (window, "key-event", G_CALLBACK
+          (gst_glimage_sink_key_event_cb), gl_sink);
+      gl_sink->mouse_sig_id =
+          g_signal_connect (window, "mouse-event",
+          G_CALLBACK (gst_glimage_sink_mouse_event_cb), gl_sink);
+
+      if (other_context)
+        gst_object_unref (other_context);
       gst_object_unref (window);
-      goto context_error;
-    }
-
-    /* setup callbacks */
-    gst_gl_window_set_resize_callback (window,
-        GST_GL_WINDOW_RESIZE_CB (gst_glimage_sink_on_resize),
-        gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
-    gst_gl_window_set_draw_callback (window,
-        GST_GL_WINDOW_CB (gst_glimage_sink_on_draw),
-        gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
-    gst_gl_window_set_close_callback (window,
-        GST_GL_WINDOW_CB (gst_glimage_sink_on_close),
-        gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
-
-    gst_object_unref (window);
-  }
+    } while (!gst_gl_display_add_context (gl_sink->display, gl_sink->context));
+  } else
+    GST_DEBUG_OBJECT (gl_sink, "Already have a context");
 
   return TRUE;
 
@@ -471,8 +801,57 @@
   switch (GST_QUERY_TYPE (query)) {
     case GST_QUERY_CONTEXT:
     {
-      return gst_gl_handle_context_query ((GstElement *) glimage_sink, query,
-          &glimage_sink->display);
+      const gchar *context_type;
+      GstContext *context, *old_context;
+      gboolean ret;
+
+      ret =
+          gst_gl_handle_context_query ((GstElement *) glimage_sink, query,
+          &glimage_sink->display, &glimage_sink->other_context);
+      if (glimage_sink->display)
+        gst_gl_display_filter_gl_api (glimage_sink->display, SUPPORTED_GL_APIS);
+
+      gst_query_parse_context_type (query, &context_type);
+
+      if (g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
+        GstStructure *s;
+
+        gst_query_parse_context (query, &old_context);
+
+        if (old_context)
+          context = gst_context_copy (old_context);
+        else
+          context = gst_context_new ("gst.gl.local_context", FALSE);
+
+        s = gst_context_writable_structure (context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT,
+            glimage_sink->context, NULL);
+        gst_query_set_context (query, context);
+        gst_context_unref (context);
+
+        ret = glimage_sink->context != NULL;
+      }
+      GST_DEBUG_OBJECT (glimage_sink, "context query of type %s %i",
+          context_type, ret);
+
+      return ret;
+    }
+    case GST_QUERY_DRAIN:
+    {
+      GstBuffer *buf = NULL;
+
+      GST_GLIMAGE_SINK_LOCK (glimage_sink);
+      glimage_sink->redisplay_texture = 0;
+      buf = glimage_sink->stored_buffer;
+      glimage_sink->stored_buffer = NULL;
+      GST_GLIMAGE_SINK_UNLOCK (glimage_sink);
+
+      if (buf)
+        gst_buffer_unref (buf);
+
+      gst_buffer_replace (&glimage_sink->next_buffer, NULL);
+
+      res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
       break;
     }
     default:
@@ -483,21 +862,6 @@
   return res;
 }
 
-static void
-gst_glimage_sink_cleanup_glthread (GstGLImageSink * gl_sink)
-{
-#if GST_GL_HAVE_GLES2
-  if (gl_sink->redisplay_shader) {
-    gst_object_unref (gl_sink->redisplay_shader);
-    gl_sink->redisplay_shader = NULL;
-  }
-#endif
-}
-
-/*
- * GstElement methods
- */
-
 static gboolean
 gst_glimage_sink_stop (GstBaseSink * bsink)
 {
@@ -516,7 +880,11 @@
 {
   GstGLImageSink *gl_sink = GST_GLIMAGE_SINK (element);
 
-  gst_gl_handle_set_context (element, context, &gl_sink->display);
+  gst_gl_handle_set_context (element, context, &gl_sink->display,
+      &gl_sink->other_context);
+
+  if (gl_sink->display)
+    gst_gl_display_filter_gl_api (gl_sink->display, SUPPORTED_GL_APIS);
 }
 
 static GstStateChangeReturn
@@ -533,13 +901,14 @@
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!gst_gl_ensure_element_data (glimage_sink, &glimage_sink->display,
+              &glimage_sink->other_context))
+        return GST_STATE_CHANGE_FAILURE;
+
+      gst_gl_display_filter_gl_api (glimage_sink->display, SUPPORTED_GL_APIS);
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       g_atomic_int_set (&glimage_sink->to_quit, 0);
-      if (!glimage_sink->display) {
-        if (!gst_gl_ensure_display (glimage_sink, &glimage_sink->display))
-          return GST_STATE_CHANGE_FAILURE;
-      }
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       break;
@@ -566,20 +935,10 @@
         glimage_sink->stored_buffer = NULL;
       }
       GST_GLIMAGE_SINK_UNLOCK (glimage_sink);
-
-      if (glimage_sink->upload) {
-        gst_object_unref (glimage_sink->upload);
-        glimage_sink->upload = NULL;
-      }
+      gst_buffer_replace (&glimage_sink->next_buffer, NULL);
 
       glimage_sink->window_id = 0;
-      //but do not reset glimage_sink->new_window_id
-
-      if (glimage_sink->pool) {
-        gst_buffer_pool_set_active (glimage_sink->pool, FALSE);
-        gst_object_unref (glimage_sink->pool);
-        glimage_sink->pool = NULL;
-      }
+      /* but do not reset glimage_sink->new_window_id */
 
       GST_VIDEO_SINK_WIDTH (glimage_sink) = 1;
       GST_VIDEO_SINK_HEIGHT (glimage_sink) = 1;
@@ -636,6 +995,26 @@
   }
 }
 
+static GstCaps *
+gst_glimage_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
+{
+  GstCaps *tmp = NULL;
+  GstCaps *result = NULL;
+
+  tmp = gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA");
+
+  if (filter) {
+    result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+  } else {
+    result = tmp;
+  }
+
+  GST_DEBUG_OBJECT (bsink, "returning caps: %" GST_PTR_FORMAT, result);
+
+  return result;
+}
+
 static gboolean
 gst_glimage_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
 {
@@ -647,10 +1026,8 @@
   gint display_par_n, display_par_d;
   guint display_ratio_num, display_ratio_den;
   GstVideoInfo vinfo;
-  GstStructure *structure;
-  GstBufferPool *newpool, *oldpool;
 
-  GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps);
+  GST_DEBUG_OBJECT (bsink, "set caps with %" GST_PTR_FORMAT, caps);
 
   glimage_sink = GST_GLIMAGE_SINK (bsink);
 
@@ -711,29 +1088,6 @@
   if (!_ensure_gl_setup (glimage_sink))
     return FALSE;
 
-  newpool = gst_gl_buffer_pool_new (glimage_sink->context);
-  structure = gst_buffer_pool_get_config (newpool);
-  gst_buffer_pool_config_set_params (structure, caps, vinfo.size, 2, 0);
-  gst_buffer_pool_set_config (newpool, structure);
-
-  oldpool = glimage_sink->pool;
-  /* we don't activate the pool yet, this will be done by downstream after it
-   * has configured the pool. If downstream does not want our pool we will
-   * activate it when we render into it */
-  glimage_sink->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);
-  }
-
-  if (glimage_sink->upload)
-    gst_object_unref (glimage_sink->upload);
-  glimage_sink->upload = gst_gl_upload_new (glimage_sink->context);
-
-  gst_gl_upload_set_format (glimage_sink->upload, &vinfo);
   glimage_sink->caps_change = TRUE;
 
   return TRUE;
@@ -743,6 +1097,7 @@
 gst_glimage_sink_prepare (GstBaseSink * bsink, GstBuffer * buf)
 {
   GstGLImageSink *glimage_sink;
+  GstVideoFrame gl_frame;
 
   glimage_sink = GST_GLIMAGE_SINK (bsink);
 
@@ -756,9 +1111,16 @@
   if (!_ensure_gl_setup (glimage_sink))
     return GST_FLOW_NOT_NEGOTIATED;
 
-  if (!gst_gl_upload_perform_with_buffer (glimage_sink->upload, buf,
-          &glimage_sink->next_tex))
+  if (!gst_video_frame_map (&gl_frame, &glimage_sink->info, buf,
+          GST_MAP_READ | GST_MAP_GL)) {
     goto upload_failed;
+  }
+
+  glimage_sink->next_tex = *(guint *) gl_frame.data[0];
+
+  gst_buffer_replace (&glimage_sink->next_buffer, buf);
+
+  gst_video_frame_unmap (&gl_frame);
 
   if (glimage_sink->window_id != glimage_sink->new_window_id) {
     GstGLWindow *window = gst_gl_context_get_window (glimage_sink->context);
@@ -799,10 +1161,8 @@
   GST_GLIMAGE_SINK_LOCK (glimage_sink);
   glimage_sink->redisplay_texture = glimage_sink->next_tex;
   stored_buffer = glimage_sink->stored_buffer;
-  glimage_sink->stored_buffer = gst_buffer_ref (buf);
+  glimage_sink->stored_buffer = gst_buffer_ref (glimage_sink->next_buffer);
   GST_GLIMAGE_SINK_UNLOCK (glimage_sink);
-  if (stored_buffer)
-    gst_buffer_unref (stored_buffer);
 
   /* Ask the underlying window to redraw its content */
   if (!gst_glimage_sink_redisplay (glimage_sink))
@@ -810,10 +1170,12 @@
 
   GST_TRACE ("post redisplay");
 
+  if (stored_buffer)
+    gst_buffer_unref (stored_buffer);
+
   if (g_atomic_int_get (&glimage_sink->to_quit) != 0) {
     GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
         ("%s", gst_gl_context_get_error ()), (NULL));
-    gst_gl_upload_release_buffer (glimage_sink->upload);
     return GST_FLOW_ERROR;
   }
 
@@ -822,22 +1184,20 @@
 /* ERRORS */
 redisplay_failed:
   {
-    gst_gl_upload_release_buffer (glimage_sink->upload);
     GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
         ("%s", gst_gl_context_get_error ()), (NULL));
     return GST_FLOW_ERROR;
   }
 }
 
-
 static void
 gst_glimage_sink_video_overlay_init (GstVideoOverlayInterface * iface)
 {
   iface->set_window_handle = gst_glimage_sink_set_window_handle;
+  iface->handle_events = gst_glimage_sink_handle_events;
   iface->expose = gst_glimage_sink_expose;
 }
 
-
 static void
 gst_glimage_sink_set_window_handle (GstVideoOverlay * overlay, guintptr id)
 {
@@ -873,20 +1233,29 @@
   }
 }
 
+static void
+gst_glimage_sink_handle_events (GstVideoOverlay * overlay,
+    gboolean handle_events)
+{
+  GstGLImageSink *glimage_sink = GST_GLIMAGE_SINK (overlay);
+
+  glimage_sink->handle_events = handle_events;
+  if (G_LIKELY (glimage_sink->context)) {
+    GstGLWindow *window;
+    window = gst_gl_context_get_window (glimage_sink->context);
+    gst_gl_window_handle_events (window, handle_events);
+    gst_object_unref (window);
+  }
+}
+
 static gboolean
 gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
 {
   GstGLImageSink *glimage_sink = GST_GLIMAGE_SINK (bsink);
-  GstBufferPool *pool;
   GstStructure *config;
   GstCaps *caps;
   guint size;
   gboolean need_pool;
-  GstStructure *gl_context;
-  gchar *platform, *gl_apis;
-  gpointer handle;
-  GstAllocator *allocator = NULL;
-  GstAllocationParams params;
 
   if (!_ensure_gl_setup (glimage_sink))
     return FALSE;
@@ -896,120 +1265,155 @@
   if (caps == NULL)
     goto no_caps;
 
-  if ((pool = glimage_sink->pool))
-    gst_object_ref (pool);
-
-  if (pool != NULL) {
-    GstCaps *pcaps;
-
-    /* we had a pool, check caps */
-    GST_DEBUG_OBJECT (glimage_sink, "check existing pool caps");
-    config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
-
-    if (!gst_caps_is_equal (caps, pcaps)) {
-      GST_DEBUG_OBJECT (glimage_sink, "pool has different caps");
-      /* different caps, we can't use this pool */
-      gst_object_unref (pool);
-      pool = NULL;
-    }
-    gst_structure_free (config);
-  }
-
-  if (pool == NULL && need_pool) {
+  if (need_pool) {
     GstVideoInfo info;
 
     if (!gst_video_info_from_caps (&info, caps))
       goto invalid_caps;
 
-    GST_DEBUG_OBJECT (glimage_sink, "create new pool");
-    pool = gst_gl_buffer_pool_new (glimage_sink->context);
-
     /* the normal size of a frame */
     size = info.size;
 
-    config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_set_params (config, caps, size, 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 */
-  if (pool) {
-    gst_query_add_allocation_pool (query, pool, size, 2, 0);
-    gst_object_unref (pool);
+    if (glimage_sink->pool) {
+      GstCaps *pcaps;
+
+      /* we had a pool, check caps */
+      GST_DEBUG_OBJECT (glimage_sink, "check existing pool caps");
+      config = gst_buffer_pool_get_config (glimage_sink->pool);
+      gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
+
+      if (!gst_caps_is_equal (caps, pcaps)) {
+        GST_DEBUG_OBJECT (glimage_sink, "pool has different caps");
+        /* different caps, we can't use this pool */
+        gst_object_unref (glimage_sink->pool);
+        glimage_sink->pool = NULL;
+      }
+      gst_structure_free (config);
+    }
+
+    if (glimage_sink->pool == NULL) {
+      GST_DEBUG_OBJECT (glimage_sink, "create new pool");
+
+      glimage_sink->pool = gst_gl_buffer_pool_new (glimage_sink->context);
+      config = gst_buffer_pool_get_config (glimage_sink->pool);
+      gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
+
+      if (!gst_buffer_pool_set_config (glimage_sink->pool, config))
+        goto config_failed;
+    }
+
+    /* we need at least 2 buffer because we hold on to the last one */
+    gst_query_add_allocation_pool (query, glimage_sink->pool, size, 2, 0);
   }
 
-  /* we also support various metadata */
-  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
-
-
-  gl_apis =
-      gst_gl_api_to_string (gst_gl_context_get_gl_api (glimage_sink->context));
-  platform =
-      gst_gl_platform_to_string (gst_gl_context_get_gl_platform
-      (glimage_sink->context));
-  handle = (gpointer) gst_gl_context_get_gl_context (glimage_sink->context);
-
-  gl_context =
-      gst_structure_new ("GstVideoGLTextureUploadMeta", "gst.gl.GstGLContext",
-      GST_GL_TYPE_CONTEXT, glimage_sink->context, "gst.gl.context.handle",
-      G_TYPE_POINTER, handle, "gst.gl.context.type", G_TYPE_STRING, platform,
-      "gst.gl.context.apis", G_TYPE_STRING, gl_apis, NULL);
-  gst_query_add_allocation_meta (query,
-      GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, gl_context);
-
-  g_free (gl_apis);
-  g_free (platform);
-  gst_structure_free (gl_context);
-
-  gst_allocation_params_init (&params);
-
-  allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
-  gst_query_add_allocation_param (query, allocator, &params);
-  gst_object_unref (allocator);
-
-#if GST_GL_HAVE_PLATFORM_EGL
-  if (gst_gl_context_check_feature (glimage_sink->context,
-          "EGL_KHR_image_base")) {
-    allocator = gst_allocator_find (GST_EGL_IMAGE_MEMORY_TYPE);
-    gst_query_add_allocation_param (query, allocator, &params);
-    gst_object_unref (allocator);
-  }
-#endif
+  if (glimage_sink->context->gl_vtable->FenceSync)
+    gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
 
   return TRUE;
 
   /* ERRORS */
 no_caps:
   {
-    GST_DEBUG_OBJECT (bsink, "no caps specified");
+    GST_WARNING_OBJECT (bsink, "no caps specified");
     return FALSE;
   }
 invalid_caps:
   {
-    GST_DEBUG_OBJECT (bsink, "invalid caps specified");
+    GST_WARNING_OBJECT (bsink, "invalid caps specified");
     return FALSE;
   }
 config_failed:
   {
-    GST_DEBUG_OBJECT (bsink, "failed setting config");
+    GST_WARNING_OBJECT (bsink, "failed setting config");
     return FALSE;
   }
 }
 
-#if GST_GL_HAVE_GLES2
+/* *INDENT-OFF* */
+static const GLfloat vertices[] = {
+     1.0f,  1.0f, 0.0f, 1.0f, 0.0f,
+    -1.0f,  1.0f, 0.0f, 0.0f, 0.0f,
+    -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
+     1.0f, -1.0f, 0.0f, 1.0f, 1.0f
+};
+/* *INDENT-ON* */
+
+static void
+_bind_buffer (GstGLImageSink * gl_sink)
+{
+  const GstGLFuncs *gl = gl_sink->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, gl_sink->vertex_buffer);
+  gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
+      GL_STATIC_DRAW);
+
+  /* Load the vertex position */
+  gl->VertexAttribPointer (gl_sink->attr_position, 3, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) 0);
+
+  /* Load the texture coordinate */
+  gl->VertexAttribPointer (gl_sink->attr_texture, 2, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
+
+  gl->EnableVertexAttribArray (gl_sink->attr_position);
+  gl->EnableVertexAttribArray (gl_sink->attr_texture);
+}
+
+static void
+_unbind_buffer (GstGLImageSink * gl_sink)
+{
+  const GstGLFuncs *gl = gl_sink->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  gl->DisableVertexAttribArray (gl_sink->attr_position);
+  gl->DisableVertexAttribArray (gl_sink->attr_texture);
+}
+
 /* Called in the gl thread */
 static void
 gst_glimage_sink_thread_init_redisplay (GstGLImageSink * gl_sink)
 {
+  const GstGLFuncs *gl = gl_sink->context->gl_vtable;
+
   gl_sink->redisplay_shader = gst_gl_shader_new (gl_sink->context);
 
   if (!gst_gl_shader_compile_with_default_vf_and_check
-      (gl_sink->redisplay_shader, &gl_sink->redisplay_attr_position_loc,
-          &gl_sink->redisplay_attr_texture_loc))
+      (gl_sink->redisplay_shader, &gl_sink->attr_position,
+          &gl_sink->attr_texture))
     gst_glimage_sink_cleanup_glthread (gl_sink);
+
+  if (gl->GenVertexArrays) {
+    gl->GenVertexArrays (1, &gl_sink->vao);
+    gl->BindVertexArray (gl_sink->vao);
+  }
+
+  gl->GenBuffers (1, &gl_sink->vertex_buffer);
+  _bind_buffer (gl_sink);
+
+  if (gl->GenVertexArrays) {
+    gl->BindVertexArray (0);
+    gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+  } else {
+    _unbind_buffer (gl_sink);
+  }
 }
-#endif
+
+static void
+gst_glimage_sink_cleanup_glthread (GstGLImageSink * gl_sink)
+{
+  const GstGLFuncs *gl = gl_sink->context->gl_vtable;
+
+  if (gl_sink->redisplay_shader) {
+    gst_object_unref (gl_sink->redisplay_shader);
+    gl_sink->redisplay_shader = NULL;
+  }
+
+  if (gl_sink->vao) {
+    gl->DeleteVertexArrays (1, &gl_sink->vao);
+    gl_sink->vao = 0;
+  }
+}
 
 static void
 gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
@@ -1024,7 +1428,7 @@
 
   /* check if a client reshape callback is registered */
   g_signal_emit (gl_sink, gst_glimage_sink_signals[CLIENT_RESHAPE_SIGNAL], 0,
-      width, height, &do_reshape);
+      gl_sink->context, width, height, &do_reshape);
 
   width = MAX (1, width);
   height = MAX (1, height);
@@ -1052,18 +1456,9 @@
     } else {
       gl->Viewport (0, 0, width, height);
     }
-#if GST_GL_HAVE_OPENGL
-    if (USING_OPENGL (gl_sink->context)) {
-      gl->MatrixMode (GL_PROJECTION);
-      gl->LoadIdentity ();
-      gluOrtho2D (0, width, 0, height);
-      gl->MatrixMode (GL_MODELVIEW);
-    }
-#endif
   }
 }
 
-
 static void
 gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
 {
@@ -1075,7 +1470,9 @@
 
   const GstGLFuncs *gl = NULL;
   GstGLWindow *window = NULL;
-  gboolean do_redisplay;
+  gboolean do_redisplay = FALSE;
+  GstGLSyncMeta *sync_meta = NULL;
+  GstSample *sample = NULL;
 
   g_return_if_fail (GST_IS_GLIMAGE_SINK (gl_sink));
 
@@ -1095,7 +1492,8 @@
   /* opengl scene */
   GST_TRACE ("redrawing texture:%u", gl_sink->redisplay_texture);
 
-  if (gl_sink->caps_change) {
+  if (gl_sink->caps_change && gl_sink->window_width > 0
+      && gl_sink->window_height > 0) {
     GST_GLIMAGE_SINK_UNLOCK (gl_sink);
     gst_glimage_sink_on_resize (gl_sink, gl_sink->window_width,
         gl_sink->window_height);
@@ -1103,6 +1501,10 @@
     gl_sink->caps_change = FALSE;
   }
 
+  sync_meta = gst_buffer_get_gl_sync_meta (gl_sink->stored_buffer);
+  if (sync_meta)
+    gst_gl_sync_meta_wait (sync_meta, gl_sink->context);
+
   /* make sure that the environnement is clean */
   gst_gl_context_clear_shader (gl_sink->context);
 
@@ -1113,83 +1515,51 @@
 
   gl->BindTexture (GL_TEXTURE_2D, 0);
 
+  sample = gst_sample_new (gl_sink->stored_buffer,
+      gst_video_info_to_caps (&gl_sink->info),
+      &GST_BASE_SINK (gl_sink)->segment, NULL);
+
   g_signal_emit (gl_sink, gst_glimage_sink_signals[CLIENT_DRAW_SIGNAL], 0,
-      gl_sink->redisplay_texture, GST_VIDEO_INFO_WIDTH (&gl_sink->info),
-      GST_VIDEO_INFO_HEIGHT (&gl_sink->info), &do_redisplay);
+      gl_sink->context, sample, &do_redisplay);
+
+  gst_sample_unref (sample);
 
   if (!do_redisplay) {
-#if GST_GL_HAVE_OPENGL
-    if (USING_OPENGL (gl_sink->context)) {
-      GLfloat verts[8] = { 1.0f, 1.0f,
-        -1.0f, 1.0f,
-        -1.0f, -1.0f,
-        1.0f, -1.0f
-      };
-      GLfloat texcoords[8] = { 1.0f, 0.0f,
-        0.0f, 0.0f,
-        0.0f, 1.0f,
-        1.0f, 1.0f
-      };
+    gfloat alpha = gl_sink->ignore_alpha ? 1.0f : 0.0f;
+    GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
 
-      gl->ClearColor (0.0, 0.0, 0.0, 0.0);
-      gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    gl->ClearColor (0.0, 0.0, 0.0, alpha);
+    gl->Clear (GL_COLOR_BUFFER_BIT);
 
-      gl->MatrixMode (GL_PROJECTION);
-      gl->LoadIdentity ();
-
-      gl->Enable (GL_TEXTURE_2D);
-      gl->BindTexture (GL_TEXTURE_2D, gl_sink->redisplay_texture);
-
-      gl->EnableClientState (GL_VERTEX_ARRAY);
-      gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
-      gl->VertexPointer (2, GL_FLOAT, 0, &verts);
-      gl->TexCoordPointer (2, GL_FLOAT, 0, &texcoords);
-
-      gl->DrawArrays (GL_TRIANGLE_FAN, 0, 4);
-
-      gl->DisableClientState (GL_VERTEX_ARRAY);
-      gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
-
-      gl->Disable (GL_TEXTURE_2D);
+    if (gl_sink->ignore_alpha) {
+      gl->BlendColor (0.0, 0.0, 0.0, alpha);
+      gl->BlendFunc (GL_SRC_ALPHA, GL_CONSTANT_COLOR);
+      gl->BlendEquation (GL_FUNC_ADD);
+      gl->Enable (GL_BLEND);
     }
-#endif
-#if GST_GL_HAVE_GLES2
-    if (USING_GLES2 (gl_sink->context)) {
-      const GLfloat vVertices[] = { 1.0f, 1.0f, 0.0f,
-        1.0f, 0.0f,
-        -1.0f, 1.0f, 0.0f,
-        0.0f, 0.0f,
-        -1.0f, -1.0f, 0.0f,
-        0.0f, 1.0f,
-        1.0f, -1.0f, 0.0f,
-        1.0f, 1.0f
-      };
 
-      GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+    gst_gl_shader_use (gl_sink->redisplay_shader);
 
-      gl->ClearColor (0.0, 0.0, 0.0, 0.0);
-      gl->Clear (GL_COLOR_BUFFER_BIT);
+    if (gl->GenVertexArrays)
+      gl->BindVertexArray (gl_sink->vao);
+    else
+      _bind_buffer (gl_sink);
 
-      gst_gl_shader_use (gl_sink->redisplay_shader);
+    gl->ActiveTexture (GL_TEXTURE0);
+    gl->BindTexture (GL_TEXTURE_2D, gl_sink->redisplay_texture);
+    gst_gl_shader_set_uniform_1i (gl_sink->redisplay_shader, "tex", 0);
 
-      /* Load the vertex position */
-      gl->VertexAttribPointer (gl_sink->redisplay_attr_position_loc, 3,
-          GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), vVertices);
+    gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
 
-      /* Load the texture coordinate */
-      gl->VertexAttribPointer (gl_sink->redisplay_attr_texture_loc, 2,
-          GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), &vVertices[3]);
+    gst_gl_context_clear_shader (gl_sink->context);
 
-      gl->EnableVertexAttribArray (gl_sink->redisplay_attr_position_loc);
-      gl->EnableVertexAttribArray (gl_sink->redisplay_attr_texture_loc);
+    if (gl->GenVertexArrays)
+      gl->BindVertexArray (0);
+    else
+      _unbind_buffer (gl_sink);
 
-      gl->ActiveTexture (GL_TEXTURE0);
-      gl->BindTexture (GL_TEXTURE_2D, gl_sink->redisplay_texture);
-      gst_gl_shader_set_uniform_1i (gl_sink->redisplay_shader, "tex", 0);
-
-      gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
-    }
-#endif
+    if (gl_sink->ignore_alpha)
+      gl->Disable (GL_BLEND);
   }
   /* end default opengl scene */
   window->is_drawing = FALSE;
@@ -1201,9 +1571,18 @@
 static void
 gst_glimage_sink_on_close (GstGLImageSink * gl_sink)
 {
+  GstGLWindow *window;
+
   gst_gl_context_set_error (gl_sink->context, "Output window was closed");
 
+  window = gst_gl_context_get_window (gl_sink->context);
+
+  g_signal_handler_disconnect (window, gl_sink->key_sig_id);
+  g_signal_handler_disconnect (window, gl_sink->mouse_sig_id);
+
   g_atomic_int_set (&gl_sink->to_quit, 1);
+
+  gst_object_unref (window);
 }
 
 static gboolean
@@ -1217,27 +1596,31 @@
     return FALSE;
 
   if (gst_gl_window_is_running (window)) {
+    gulong handler_id =
+        g_signal_handler_find (GST_ELEMENT_PARENT (gl_sink), G_SIGNAL_MATCH_ID,
+        gst_gl_image_sink_bin_signals[SIGNAL_BIN_CLIENT_DRAW], 0,
+        NULL, NULL, NULL);
 
-#if GST_GL_HAVE_GLES2
-    if (USING_GLES2 (gl_sink->context)) {
+    if (G_UNLIKELY (!gl_sink->redisplay_shader) && (!handler_id
+            || !gl_sink->other_context)) {
+      gst_gl_window_send_message (window,
+          GST_GL_WINDOW_CB (gst_glimage_sink_thread_init_redisplay), gl_sink);
+
+      /* if the shader is still null it means it failed to be useable */
       if (G_UNLIKELY (!gl_sink->redisplay_shader)) {
-        gst_gl_window_send_message (window,
-            GST_GL_WINDOW_CB (gst_glimage_sink_thread_init_redisplay), gl_sink);
-
-        /* if the shader is still null it means it failed to be useable */
-        if (G_UNLIKELY (!gl_sink->redisplay_shader)) {
-          gst_object_unref (window);
-          return FALSE;
-        }
+        gst_object_unref (window);
+        return FALSE;
       }
+
+      gst_gl_window_set_preferred_size (window, GST_VIDEO_SINK_WIDTH (gl_sink),
+          GST_VIDEO_SINK_HEIGHT (gl_sink));
+      gst_gl_window_show (window);
     }
-#endif
 
     /* Drawing is asynchronous: gst_gl_window_draw is not blocking
      * It means that it does not wait for stuff to be executed in other threads
      */
-    gst_gl_window_draw (window, GST_VIDEO_SINK_WIDTH (gl_sink),
-        GST_VIDEO_SINK_HEIGHT (gl_sink));
+    gst_gl_window_draw (window);
   }
   alive = gst_gl_window_is_running (window);
   gst_object_unref (window);
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
index 25e6a13..1eed7b3 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -56,6 +56,8 @@
 
     guintptr window_id;
     guintptr new_window_id;
+    gulong mouse_sig_id;
+    gulong key_sig_id;
 
     //caps
     GstVideoInfo info;
@@ -63,9 +65,11 @@
     GstGLDisplay *display;
     GstGLContext *context;
     GstGLContext *other_context;
+    gboolean handle_events;
+    gboolean ignore_alpha;
 
-    GstGLUpload *upload;
     guint      next_tex;
+    GstBuffer *next_buffer;
 
     volatile gint to_quit;
     gboolean keep_aspect_ratio;
@@ -82,12 +86,11 @@
     guint window_width;
     guint window_height;
 
-#if GST_GL_HAVE_GLES2
-  GstGLShader *redisplay_shader;
-  GLint redisplay_attr_position_loc;
-  GLint redisplay_attr_texture_loc;
-#endif
-
+    GstGLShader *redisplay_shader;
+    GLuint vao;
+    GLuint vertex_buffer;
+    GLint  attr_position;
+    GLint  attr_texture;
 };
 
 struct _GstGLImageSinkClass
@@ -96,6 +99,7 @@
 };
 
 GType gst_glimage_sink_get_type(void);
+GType gst_gl_image_sink_bin_get_type(void);
 
 G_END_DECLS
 
diff --git a/ext/gl/gstglmixer.c b/ext/gl/gstglmixer.c
index 6a2d9a4..51bd517 100644
--- a/ext/gl/gstglmixer.c
+++ b/ext/gl/gstglmixer.c
@@ -24,23 +24,16 @@
 #endif
 
 #include <gst/gst.h>
-#include <gst/base/gstcollectpads.h>
 #include <gst/video/video.h>
 
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include "gstglmixer.h"
 
-#define gst_gl_mixer_parent_class parent_class
-G_DEFINE_ABSTRACT_TYPE (GstGLMixer, gst_gl_mixer, GST_TYPE_VIDEO_AGGREGATOR);
-static gboolean gst_gl_mixer_do_bufferpool (GstGLMixer * mix,
-    GstCaps * outcaps);
+#if GST_GL_HAVE_PLATFORM_EGL
+#include <gst/gl/egl/gsteglimagememory.h>
+#endif
 
+#define gst_gl_mixer_parent_class parent_class
+G_DEFINE_ABSTRACT_TYPE (GstGLMixer, gst_gl_mixer, GST_TYPE_GL_BASE_MIXER);
 
 #define GST_CAT_DEFAULT gst_gl_mixer_debug
 GST_DEBUG_CATEGORY (gst_gl_mixer_debug);
@@ -51,9 +44,6 @@
     const GValue * value, GParamSpec * pspec);
 static void gst_gl_mixer_pad_finalize (GObject * object);
 
-static void gst_gl_mixer_set_context (GstElement * element,
-    GstContext * context);
-
 enum
 {
   PROP_PAD_0
@@ -66,40 +56,33 @@
 {
   gboolean negotiated;
 
-  GstBufferPool *pool;
-  gboolean pool_active;
-  GstAllocator *allocator;
-  GstAllocationParams params;
-  GstQuery *query;
-
   gboolean gl_resource_ready;
   GMutex gl_resource_lock;
   GCond gl_resource_cond;
 };
 
-G_DEFINE_TYPE (GstGLMixerPad, gst_gl_mixer_pad, GST_TYPE_VIDEO_AGGREGATOR_PAD);
+G_DEFINE_TYPE (GstGLMixerPad, gst_gl_mixer_pad, GST_TYPE_GL_BASE_MIXER_PAD);
 
 static void
 gst_gl_mixer_pad_class_init (GstGLMixerPadClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstVideoAggregatorPadClass *vaggpad_class =
+      (GstVideoAggregatorPadClass *) klass;
 
   gobject_class->set_property = gst_gl_mixer_pad_set_property;
   gobject_class->get_property = gst_gl_mixer_pad_get_property;
 
   gobject_class->finalize = gst_gl_mixer_pad_finalize;
+
+  vaggpad_class->set_info = NULL;
+  vaggpad_class->prepare_frame = NULL;
+  vaggpad_class->clean_frame = NULL;
 }
 
 static void
 gst_gl_mixer_pad_finalize (GObject * object)
 {
-  GstGLMixerPad *pad = GST_GL_MIXER_PAD (object);
-
-  if (pad->upload) {
-    gst_object_unref (pad->upload);
-    pad->upload = NULL;
-  }
-
   G_OBJECT_CLASS (gst_gl_mixer_pad_parent_class)->finalize (object);
 }
 
@@ -129,73 +112,42 @@
 _negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps)
 {
   GstGLMixer *mix = GST_GL_MIXER (vagg);
-  gboolean ret = gst_gl_mixer_do_bufferpool (mix, caps);
+  gboolean ret;
 
-  mix->priv->negotiated = ret;
+  mix->priv->negotiated = TRUE;
 
   gst_caps_replace (&mix->out_caps, caps);
 
+  ret = GST_VIDEO_AGGREGATOR_CLASS (parent_class)->negotiated_caps (vagg, caps);
+
   return ret;
 }
 
 static gboolean
-gst_gl_mixer_propose_allocation (GstGLMixer * mix,
-    GstQuery * decide_query, GstQuery * query)
+gst_gl_mixer_propose_allocation (GstGLBaseMixer * base_mix,
+    GstGLBaseMixerPad * base_pad, GstQuery * decide_query, GstQuery * query)
 {
-  GstBufferPool *pool;
+  GstGLMixer *mix = GST_GL_MIXER (base_mix);
+  GstGLContext *context = base_mix->context;
+  GstBufferPool *pool = NULL;
   GstStructure *config;
   GstCaps *caps;
   guint size = 0;
   gboolean need_pool;
-  GError *error = NULL;
-  GstStructure *gl_context;
-  gchar *platform, *gl_apis;
-  gpointer handle;
-  GstAllocator *allocator = NULL;
-  GstAllocationParams params;
 
   gst_query_parse_allocation (query, &caps, &need_pool);
 
   if (caps == NULL)
     goto no_caps;
 
-  if ((pool = mix->priv->pool))
-    gst_object_ref (pool);
-
-  if (pool != NULL) {
-    GstCaps *pcaps;
-
-    /* we had a pool, check caps */
-    GST_DEBUG_OBJECT (mix, "check existing pool caps");
-    config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
-
-    if (!gst_caps_is_equal (caps, pcaps)) {
-      GST_DEBUG_OBJECT (mix, "pool has different caps");
-      /* different caps, we can't use this pool */
-      gst_object_unref (pool);
-      pool = NULL;
-    }
-    gst_structure_free (config);
-  }
-
-  if (!gst_gl_ensure_display (mix, &mix->display))
-    return FALSE;
-
-  if (!mix->context) {
-    mix->context = gst_gl_context_new (mix->display);
-    if (!gst_gl_context_create (mix->context, NULL, &error))
-      goto context_error;
-  }
-
-  if (pool == NULL && need_pool) {
+  if (need_pool) {
     GstVideoInfo info;
 
     if (!gst_video_info_from_caps (&info, caps))
       goto invalid_caps;
 
     GST_DEBUG_OBJECT (mix, "create new pool");
-    pool = gst_gl_buffer_pool_new (mix->context);
+    pool = gst_gl_buffer_pool_new (context);
 
     /* the normal size of a frame */
     size = info.size;
@@ -212,30 +164,8 @@
   }
 
   /* we also support various metadata */
-  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
-
-  gl_apis = gst_gl_api_to_string (gst_gl_context_get_gl_api (mix->context));
-  platform =
-      gst_gl_platform_to_string (gst_gl_context_get_gl_platform (mix->context));
-  handle = (gpointer) gst_gl_context_get_gl_context (mix->context);
-
-  gl_context =
-      gst_structure_new ("GstVideoGLTextureUploadMeta", "gst.gl.GstGLContext",
-      GST_GL_TYPE_CONTEXT, mix->context, "gst.gl.context.handle",
-      G_TYPE_POINTER, handle, "gst.gl.context.type", G_TYPE_STRING, platform,
-      "gst.gl.context.apis", G_TYPE_STRING, gl_apis, NULL);
-  gst_query_add_allocation_meta (query,
-      GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, gl_context);
-
-  g_free (gl_apis);
-  g_free (platform);
-  gst_structure_free (gl_context);
-
-  gst_allocation_params_init (&params);
-
-  allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
-  gst_query_add_allocation_param (query, allocator, &params);
-  gst_object_unref (allocator);
+  if (context->gl_vtable->FenceSync)
+    gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
 
   return TRUE;
 
@@ -255,12 +185,68 @@
     GST_DEBUG_OBJECT (mix, "failed setting config");
     return FALSE;
   }
-context_error:
-  {
-    GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s", error->message),
-        (NULL));
-    return FALSE;
+}
+
+static gboolean
+gst_gl_mixer_pad_sink_acceptcaps (GstPad * pad, GstGLMixer * mix,
+    GstCaps * caps)
+{
+  gboolean ret;
+  GstCaps *template_caps;
+
+  GST_DEBUG_OBJECT (pad, "try accept caps of %" GST_PTR_FORMAT, caps);
+
+  template_caps = gst_pad_get_pad_template_caps (pad);
+  template_caps = gst_caps_make_writable (template_caps);
+
+  ret = gst_caps_can_intersect (caps, template_caps);
+  GST_DEBUG_OBJECT (pad, "%saccepted caps %" GST_PTR_FORMAT,
+      (ret ? "" : "not "), caps);
+  gst_caps_unref (template_caps);
+
+  return ret;
+}
+
+/* copies the given caps */
+static GstCaps *
+_update_caps (GstVideoAggregator * vagg, GstCaps * caps)
+{
+  return gst_gl_caps_replace_all_caps_features (caps,
+      GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+}
+
+static GstCaps *
+gst_gl_mixer_pad_sink_getcaps (GstPad * pad, GstGLMixer * mix, GstCaps * filter)
+{
+  GstCaps *sinkcaps;
+  GstCaps *template_caps;
+  GstCaps *filtered_caps;
+  GstCaps *returned_caps;
+  gboolean had_current_caps = TRUE;
+
+  template_caps = gst_pad_get_pad_template_caps (pad);
+
+  sinkcaps = gst_pad_get_current_caps (pad);
+  if (sinkcaps == NULL) {
+    had_current_caps = FALSE;
+    sinkcaps = template_caps;
+  } else {
+    sinkcaps = gst_caps_merge (sinkcaps, template_caps);
   }
+
+  filtered_caps = sinkcaps;
+  if (filter)
+    filtered_caps = gst_caps_intersect (sinkcaps, filter);
+  returned_caps = gst_caps_intersect (filtered_caps, template_caps);
+
+  if (filter)
+    gst_caps_unref (filtered_caps);
+  if (had_current_caps)
+    gst_caps_unref (template_caps);
+
+  GST_DEBUG_OBJECT (pad, "returning %" GST_PTR_FORMAT, returned_caps);
+
+  return returned_caps;
 }
 
 static gboolean
@@ -273,39 +259,25 @@
   GST_TRACE ("QUERY %" GST_PTR_FORMAT, query);
 
   switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_ALLOCATION:
+    case GST_QUERY_CAPS:
     {
-      GstQuery *decide_query = NULL;
-      gboolean negotiated;
+      GstCaps *filter, *caps;
 
-      GST_OBJECT_LOCK (mix);
-      if (G_UNLIKELY (!(negotiated = mix->priv->negotiated))) {
-        GST_DEBUG_OBJECT (mix,
-            "not negotiated yet, can't answer ALLOCATION query");
-        GST_OBJECT_UNLOCK (mix);
-        return FALSE;
-      }
-      if ((decide_query = mix->priv->query))
-        gst_query_ref (decide_query);
-      GST_OBJECT_UNLOCK (mix);
-
-      GST_DEBUG_OBJECT (mix,
-          "calling propose allocation with query %" GST_PTR_FORMAT,
-          decide_query);
-
-      /* pass the query to the propose_allocation vmethod if any */
-      ret = gst_gl_mixer_propose_allocation (mix, decide_query, query);
-
-      if (decide_query)
-        gst_query_unref (decide_query);
-
-      GST_DEBUG_OBJECT (mix, "ALLOCATION ret %d, %" GST_PTR_FORMAT, ret, query);
+      gst_query_parse_caps (query, &filter);
+      caps = gst_gl_mixer_pad_sink_getcaps (GST_PAD (bpad), mix, filter);
+      gst_query_set_caps_result (query, caps);
+      gst_caps_unref (caps);
+      ret = TRUE;
       break;
     }
-    case GST_QUERY_CONTEXT:
+    case GST_QUERY_ACCEPT_CAPS:
     {
-      ret = gst_gl_handle_context_query ((GstElement *) mix, query,
-          &mix->display);
+      GstCaps *caps;
+
+      gst_query_parse_accept_caps (query, &caps);
+      ret = gst_gl_mixer_pad_sink_acceptcaps (GST_PAD (bpad), mix, caps);
+      gst_query_set_accept_caps_result (query, ret);
+      ret = TRUE;
       break;
     }
     default:
@@ -330,7 +302,7 @@
 
 enum
 {
-  PROP_0
+  PROP_0,
 };
 
 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
@@ -338,11 +310,7 @@
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
         (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
-            "RGBA") "; "
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-        (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META,
-            "RGBA")
-        "; " GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS))
+            "RGBA"))
     );
 
 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%u",
@@ -350,20 +318,12 @@
     GST_PAD_REQUEST,
     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
         (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
-            "RGBA") "; "
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-        (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META,
-            "RGBA")
-        "; " GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS))
+            "RGBA"))
     );
 
 static gboolean gst_gl_mixer_src_query (GstAggregator * agg, GstQuery * query);
-static GstFlowReturn
-gst_gl_mixer_get_output_buffer (GstVideoAggregator * videoaggregator,
-    GstBuffer ** outbuf);
-static gboolean
-gst_gl_mixer_src_activate_mode (GstAggregator * aggregator, GstPadMode mode,
-    gboolean active);
+static GstFlowReturn gst_gl_mixer_get_output_buffer (GstVideoAggregator *
+    videoaggregator, GstBuffer ** outbuf);
 static gboolean gst_gl_mixer_stop (GstAggregator * agg);
 static gboolean gst_gl_mixer_start (GstAggregator * agg);
 
@@ -376,28 +336,22 @@
 static void gst_gl_mixer_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static gboolean gst_gl_mixer_decide_allocation (GstGLMixer * mix,
+static gboolean gst_gl_mixer_decide_allocation (GstGLBaseMixer * mix,
     GstQuery * query);
-static gboolean gst_gl_mixer_set_allocation (GstGLMixer * mix,
-    GstBufferPool * pool, GstAllocator * allocator,
-    GstAllocationParams * params, GstQuery * query);
 
 static void gst_gl_mixer_finalize (GObject * object);
 
 static void
 gst_gl_mixer_class_init (GstGLMixerClass * klass)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *element_class;
-
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
   GstVideoAggregatorClass *videoaggregator_class =
       (GstVideoAggregatorClass *) klass;
   GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
+  GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_CLASS (klass);;
 
-  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glmixer", 0, "opengl mixer");
-
-  gobject_class = (GObjectClass *) klass;
-  element_class = GST_ELEMENT_CLASS (klass);
+  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glmixer", 0, "OpenGL mixer");
 
   g_type_class_add_private (klass, sizeof (GstGLMixerPrivate));
 
@@ -411,32 +365,30 @@
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&sink_factory));
 
-  element_class->set_context = GST_DEBUG_FUNCPTR (gst_gl_mixer_set_context);
-
   agg_class->sinkpads_type = GST_TYPE_GL_MIXER_PAD;
   agg_class->sink_query = gst_gl_mixer_sink_query;
   agg_class->src_query = gst_gl_mixer_src_query;
-  agg_class->src_activate = gst_gl_mixer_src_activate_mode;
   agg_class->stop = gst_gl_mixer_stop;
   agg_class->start = gst_gl_mixer_start;
 
-  videoaggregator_class->disable_frame_conversion = TRUE;
   videoaggregator_class->aggregate_frames = gst_gl_mixer_aggregate_frames;
   videoaggregator_class->get_output_buffer = gst_gl_mixer_get_output_buffer;
   videoaggregator_class->negotiated_caps = _negotiated_caps;
+  videoaggregator_class->update_caps = _update_caps;
+  videoaggregator_class->find_best_format = NULL;
 
+  mix_class->propose_allocation = gst_gl_mixer_propose_allocation;
+  mix_class->decide_allocation = gst_gl_mixer_decide_allocation;
 
   /* Register the pad class */
   g_type_class_ref (GST_TYPE_GL_MIXER_PAD);
 
   klass->set_caps = NULL;
-
 }
 
 static void
 gst_gl_mixer_reset (GstGLMixer * mix)
 {
-  /* clean up collect data */
   mix->priv->negotiated = FALSE;
 }
 
@@ -445,7 +397,6 @@
 {
   mix->priv = GST_GL_MIXER_GET_PRIVATE (mix);
   mix->array_buffers = 0;
-  mix->display = NULL;
   mix->fbo = 0;
   mix->depthbuffer = 0;
 
@@ -459,90 +410,43 @@
 static void
 gst_gl_mixer_finalize (GObject * object)
 {
-  GstGLMixerPrivate *priv = GST_GL_MIXER (object)->priv;
+  GstGLMixer *mix = GST_GL_MIXER (object);
+  GstGLMixerPrivate *priv = mix->priv;
 
   g_mutex_clear (&priv->gl_resource_lock);
   g_cond_clear (&priv->gl_resource_cond);
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-static void
-gst_gl_mixer_set_context (GstElement * element, GstContext * context)
-{
-  GstGLMixer *mix = GST_GL_MIXER (element);
-
-  gst_gl_handle_set_context (element, context, &mix->display);
-}
-
-static gboolean
-gst_gl_mixer_activate (GstGLMixer * mix, gboolean active)
-{
-  gboolean result = TRUE;
-
-  if (active) {
-    if (!gst_gl_ensure_display (mix, &mix->display))
-      result = FALSE;
-  }
-
-  return result;
-}
-
-static gboolean
-gst_gl_mixer_src_activate_mode (GstAggregator * aggregator, GstPadMode mode,
-    gboolean active)
-{
-  GstGLMixer *mix;
-  gboolean result = FALSE;
-
-  mix = GST_GL_MIXER (aggregator);
-
-  switch (mode) {
-    case GST_PAD_MODE_PUSH:
-    case GST_PAD_MODE_PULL:
-      result = gst_gl_mixer_activate (mix, active);
-      break;
-    default:
-      result = TRUE;
-      break;
-  }
-  return result;
-}
-
 static gboolean
 gst_gl_mixer_query_caps (GstPad * pad, GstAggregator * agg, GstQuery * query)
 {
-  GstCaps *filter, *caps;
-  GstStructure *s;
-  gint n;
-
-  GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (agg);
+  GstCaps *filter, *current_caps, *retcaps, *template_caps;
 
   gst_query_parse_caps (query, &filter);
 
-  if (GST_VIDEO_INFO_FORMAT (&vagg->info) != GST_VIDEO_FORMAT_UNKNOWN) {
-    caps = gst_video_info_to_caps (&vagg->info);
-  } else {
-    caps = gst_pad_get_pad_template_caps (agg->srcpad);
+  template_caps = gst_pad_get_pad_template_caps (agg->srcpad);
+
+  current_caps = gst_pad_get_current_caps (pad);
+  if (current_caps == NULL)
+    retcaps = gst_caps_ref (template_caps);
+  else {
+    retcaps = gst_caps_merge (current_caps, template_caps);
+    template_caps = NULL;
   }
 
-  caps = gst_caps_make_writable (caps);
-
-  n = gst_caps_get_size (caps) - 1;
-  for (; n >= 0; n--) {
-    s = gst_caps_get_structure (caps, n);
-    gst_structure_set (s, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-        "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-    if (GST_VIDEO_INFO_FPS_D (&vagg->info) != 0) {
-      gst_structure_set (s,
-          "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
-    }
+  if (filter) {
+    current_caps =
+        gst_caps_intersect_full (filter, retcaps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (retcaps);
+    retcaps = current_caps;
   }
 
-  if (filter)
-    caps = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+  gst_query_set_caps_result (query, retcaps);
+  gst_caps_unref (retcaps);
 
-  gst_query_set_caps_result (query, caps);
-  gst_caps_unref (caps);
+  if (template_caps)
+    gst_caps_unref (template_caps);
 
   return TRUE;
 }
@@ -551,15 +455,8 @@
 gst_gl_mixer_src_query (GstAggregator * agg, GstQuery * query)
 {
   gboolean res = FALSE;
-  GstGLMixer *mix = GST_GL_MIXER (agg);
 
   switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_CONTEXT:
-    {
-      res = gst_gl_handle_context_query ((GstElement *) mix, query,
-          &mix->display);
-      break;
-    }
     case GST_QUERY_CAPS:
       res = gst_gl_mixer_query_caps (agg->srcpad, agg, query);
       break;
@@ -576,80 +473,43 @@
     GstBuffer ** outbuf)
 {
   GstGLMixer *mix = GST_GL_MIXER (videoaggregator);
+  GstBufferPool *pool;
+  GstFlowReturn ret;
 
-  if (!mix->priv->pool_active) {
-    if (!gst_buffer_pool_set_active (mix->priv->pool, TRUE)) {
+  pool =
+      gst_gl_base_mixer_get_buffer_pool (GST_GL_BASE_MIXER (videoaggregator));
+
+  if (!pool)
+    return GST_FLOW_NOT_NEGOTIATED;
+
+  if (!gst_buffer_pool_is_active (pool)) {
+    if (!gst_buffer_pool_set_active (pool, TRUE)) {
       GST_ELEMENT_ERROR (mix, RESOURCE, SETTINGS,
           ("failed to activate bufferpool"), ("failed to activate bufferpool"));
       return GST_FLOW_ERROR;
     }
-    mix->priv->pool_active = TRUE;
   }
 
-  return gst_buffer_pool_acquire_buffer (mix->priv->pool, outbuf, NULL);
+  ret = gst_buffer_pool_acquire_buffer (pool, outbuf, NULL);
+  gst_object_unref (pool);
+
+  return ret;
 }
 
 static gboolean
-gst_gl_mixer_decide_allocation (GstGLMixer * mix, GstQuery * query)
+gst_gl_mixer_decide_allocation (GstGLBaseMixer * base_mix, GstQuery * query)
 {
+  GstGLMixer *mix = GST_GL_MIXER (base_mix);
   GstGLMixerClass *mixer_class = GST_GL_MIXER_GET_CLASS (mix);
+  GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix);
+  GstGLContext *context = base_mix->context;
   GstBufferPool *pool = NULL;
   GstStructure *config;
   GstCaps *caps;
   guint min, max, size;
   gboolean update_pool;
   GError *error = NULL;
-  guint idx;
   guint out_width, out_height;
-  GstGLContext *other_context = NULL;
-  GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix);
-
-  if (!gst_gl_ensure_display (mix, &mix->display))
-    return FALSE;
-
-  if (gst_query_find_allocation_meta (query,
-          GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx)) {
-    GstGLContext *context;
-    const GstStructure *upload_meta_params;
-    gpointer handle;
-    gchar *type;
-    gchar *apis;
-
-    gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params);
-    if (upload_meta_params) {
-      if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext",
-              GST_GL_TYPE_CONTEXT, &context, NULL) && context) {
-        GstGLContext *old = mix->context;
-
-        mix->context = context;
-        if (old)
-          gst_object_unref (old);
-      } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle",
-              G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING,
-              &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL)
-          && handle) {
-        GstGLPlatform platform = GST_GL_PLATFORM_NONE;
-        GstGLAPI gl_apis;
-
-        GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s",
-            handle, type, apis);
-
-        platform = gst_gl_platform_from_string (type);
-        gl_apis = gst_gl_api_from_string (apis);
-
-        if (gl_apis && platform)
-          other_context =
-              gst_gl_context_new_wrapped (mix->display, (guintptr) handle,
-              platform, gl_apis);
-      }
-    }
-  }
-
-  if (!mix->context) {
-    mix->context = gst_gl_context_new (mix->display);
-    if (!gst_gl_context_create (mix->context, other_context, &error))
-      goto context_error;
-  }
 
   out_width = GST_VIDEO_INFO_WIDTH (&vagg->info);
   out_height = GST_VIDEO_INFO_HEIGHT (&vagg->info);
@@ -657,23 +517,18 @@
   g_mutex_lock (&mix->priv->gl_resource_lock);
   mix->priv->gl_resource_ready = FALSE;
   if (mix->fbo) {
-    gst_gl_context_del_fbo (mix->context, mix->fbo, mix->depthbuffer);
+    gst_gl_context_del_fbo (context, mix->fbo, mix->depthbuffer);
     mix->fbo = 0;
     mix->depthbuffer = 0;
   }
 
-  if (!gst_gl_context_gen_fbo (mix->context, out_width, out_height,
+  if (!gst_gl_context_gen_fbo (context, out_width, out_height,
           &mix->fbo, &mix->depthbuffer)) {
     g_cond_signal (&mix->priv->gl_resource_cond);
     g_mutex_unlock (&mix->priv->gl_resource_lock);
     goto context_error;
   }
 
-  if (mix->out_tex_id)
-    gst_gl_context_del_texture (mix->context, &mix->out_tex_id);
-  gst_gl_context_gen_texture (mix->context, &mix->out_tex_id,
-      GST_VIDEO_FORMAT_RGBA, out_width, out_height);
-
   gst_query_parse_allocation (query, &caps, NULL);
 
   if (mixer_class->set_caps)
@@ -698,11 +553,10 @@
   }
 
   if (!pool)
-    pool = gst_gl_buffer_pool_new (mix->context);
-
+    pool = gst_gl_buffer_pool_new (context);
   config = gst_buffer_pool_get_config (pool);
-  gst_buffer_pool_config_set_params (config, caps, size, min, max);
 
+  gst_buffer_pool_config_set_params (config, caps, size, min, max);
   gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
 
   gst_buffer_pool_set_config (pool, config);
@@ -724,104 +578,6 @@
   }
 }
 
-/* takes ownership of the pool, allocator and query */
-static gboolean
-gst_gl_mixer_set_allocation (GstGLMixer * mix,
-    GstBufferPool * pool, GstAllocator * allocator,
-    GstAllocationParams * params, GstQuery * query)
-{
-  GstAllocator *oldalloc;
-  GstBufferPool *oldpool;
-  GstQuery *oldquery;
-  GstGLMixerPrivate *priv = mix->priv;
-
-  GST_DEBUG ("storing allocation query");
-
-  GST_OBJECT_LOCK (mix);
-  oldpool = priv->pool;
-  priv->pool = pool;
-  priv->pool_active = FALSE;
-
-  oldalloc = priv->allocator;
-  priv->allocator = allocator;
-
-  oldquery = priv->query;
-  priv->query = query;
-
-  if (params)
-    priv->params = *params;
-  else
-    gst_allocation_params_init (&priv->params);
-  GST_OBJECT_UNLOCK (mix);
-
-  if (oldpool) {
-    GST_DEBUG_OBJECT (mix, "deactivating old pool %p", oldpool);
-    gst_buffer_pool_set_active (oldpool, FALSE);
-    gst_object_unref (oldpool);
-  }
-  if (oldalloc) {
-    gst_object_unref (oldalloc);
-  }
-  if (oldquery) {
-    gst_query_unref (oldquery);
-  }
-  return TRUE;
-}
-
-static gboolean
-gst_gl_mixer_do_bufferpool (GstGLMixer * mix, GstCaps * outcaps)
-{
-  GstQuery *query;
-  gboolean result = TRUE;
-  GstBufferPool *pool = NULL;
-  GstAllocator *allocator;
-  GstAllocationParams params;
-  GstAggregator *agg = GST_AGGREGATOR (mix);
-
-  /* find a pool for the negotiated caps now */
-  GST_DEBUG_OBJECT (mix, "doing allocation query");
-  query = gst_query_new_allocation (outcaps, TRUE);
-  if (!gst_pad_peer_query (agg->srcpad, query)) {
-    /* not a problem, just debug a little */
-    GST_DEBUG_OBJECT (mix, "peer ALLOCATION query failed");
-  }
-
-  GST_DEBUG_OBJECT (mix, "calling decide_allocation");
-  result = gst_gl_mixer_decide_allocation (mix, query);
-
-  GST_DEBUG_OBJECT (mix, "ALLOCATION (%d) params: %" GST_PTR_FORMAT, result,
-      query);
-
-  if (!result)
-    goto no_decide_allocation;
-
-  /* we got configuration from our peer or the decide_allocation method,
-   * parse them */
-  if (gst_query_get_n_allocation_params (query) > 0) {
-    gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
-  } else {
-    allocator = NULL;
-    gst_allocation_params_init (&params);
-  }
-
-  if (gst_query_get_n_allocation_pools (query) > 0)
-    gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
-
-  /* now store */
-  result = gst_gl_mixer_set_allocation (mix, pool, allocator, &params, query);
-
-  return result;
-
-  /* Errors */
-no_decide_allocation:
-  {
-    GST_WARNING_OBJECT (mix, "Failed to decide allocation");
-    gst_query_unref (query);
-
-    return result;
-  }
-}
-
 gboolean
 gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
 {
@@ -835,34 +591,15 @@
   GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix);
   GstGLMixerClass *mix_class = GST_GL_MIXER_GET_CLASS (mix);
   GstGLMixerPrivate *priv = mix->priv;
-  gboolean to_download =
-      gst_caps_features_is_equal (GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY,
-      gst_caps_get_features (mix->out_caps, 0));
-  GstMapFlags out_map_flags = GST_MAP_WRITE;
 
   GST_TRACE ("Processing buffers");
 
-  to_download |= !gst_is_gl_memory (gst_buffer_peek_memory (outbuf, 0));
-
-  if (!to_download)
-    out_map_flags |= GST_MAP_GL;
-
-  if (!gst_video_frame_map (&out_frame, &vagg->info, outbuf, out_map_flags)) {
+  if (!gst_video_frame_map (&out_frame, &vagg->info, outbuf,
+          GST_MAP_WRITE | GST_MAP_GL)) {
     return FALSE;
   }
 
-  if (!to_download) {
-    out_tex = *(guint *) out_frame.data[0];
-  } else {
-    GST_INFO ("Output Buffer does not contain correct memory, "
-        "attempting to wrap for download");
-
-    if (!mix->download)
-      mix->download = gst_gl_download_new (mix->context);
-
-    gst_gl_download_set_format (mix->download, &out_frame.info);
-    out_tex = mix->out_tex_id;
-  }
+  out_tex = *(guint *) out_frame.data[0];
 
   GST_OBJECT_LOCK (mix);
   walk = element->sinkpads;
@@ -883,24 +620,26 @@
     walk = g_list_next (walk);
 
     if (vaggpad->buffer != NULL) {
-      guint in_tex;
+      GstVideoInfo gl_info;
+      GstVideoFrame gl_frame;
+      GstGLSyncMeta *sync_meta;
 
-      if (!pad->upload) {
-        pad->upload = gst_gl_upload_new (mix->context);
+      gst_video_info_set_format (&gl_info,
+          GST_VIDEO_FORMAT_RGBA,
+          GST_VIDEO_INFO_WIDTH (&vaggpad->info),
+          GST_VIDEO_INFO_HEIGHT (&vaggpad->info));
 
-        gst_gl_upload_set_format (pad->upload, &vaggpad->info);
+      sync_meta = gst_buffer_get_gl_sync_meta (vaggpad->buffer);
+      if (sync_meta)
+        gst_gl_sync_meta_wait (sync_meta, GST_GL_BASE_MIXER (mix)->context);
+
+      if (gst_video_frame_map (&gl_frame, &gl_info, vaggpad->buffer,
+              GST_MAP_READ | GST_MAP_GL)) {
+        frame->texture = *(guint *) gl_frame.data[0];
+        gst_video_frame_unmap (&gl_frame);
       }
-
-      if (!gst_gl_upload_perform_with_buffer (pad->upload,
-              vaggpad->buffer, &in_tex)) {
-        ++array_index;
-        pad->mapped = FALSE;
-        continue;
-      }
-      pad->mapped = TRUE;
-
-      frame->texture = in_tex;
     }
+
     ++array_index;
   }
 
@@ -920,29 +659,7 @@
 
   g_mutex_unlock (&priv->gl_resource_lock);
 
-  if (to_download) {
-    if (!gst_gl_download_perform_with_data (mix->download, out_tex,
-            out_frame.data)) {
-      GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s",
-              "Failed to download video frame"), (NULL));
-      res = FALSE;
-      goto out;
-    }
-  }
-
 out:
-  i = 0;
-  walk = GST_ELEMENT (mix)->sinkpads;
-  while (walk) {
-    GstGLMixerPad *pad = GST_GL_MIXER_PAD (walk->data);
-
-    if (pad->mapped)
-      gst_gl_upload_release_buffer (pad->upload);
-
-    pad->mapped = FALSE;
-    walk = g_list_next (walk);
-    i++;
-  }
   GST_OBJECT_UNLOCK (mix);
 
   gst_video_frame_unmap (&out_frame);
@@ -980,20 +697,24 @@
   return mix_class->process_buffers (mix, mix->array_buffers, outbuf);
 }
 
-
-
 static GstFlowReturn
 gst_gl_mixer_aggregate_frames (GstVideoAggregator * vagg, GstBuffer * outbuf)
 {
   gboolean res = FALSE;
   GstGLMixer *mix = GST_GL_MIXER (vagg);
   GstGLMixerClass *mix_class = GST_GL_MIXER_GET_CLASS (vagg);
+  GstGLContext *context = GST_GL_BASE_MIXER (mix)->context;
+  GstGLSyncMeta *sync_meta;
 
   if (mix_class->process_buffers)
     res = gst_gl_mixer_process_buffers (mix, outbuf);
   else if (mix_class->process_textures)
     res = gst_gl_mixer_process_textures (mix, outbuf);
 
+  sync_meta = gst_buffer_get_gl_sync_meta (outbuf);
+  if (sync_meta)
+    gst_gl_sync_meta_set_sync_point (sync_meta, context);
+
   return res ? GST_FLOW_OK : GST_FLOW_ERROR;
 }
 
@@ -1019,19 +740,6 @@
   }
 }
 
-static gboolean
-_clean_upload (GstAggregator * agg, GstPad * aggpad, gpointer udata)
-{
-  GstGLMixerPad *pad = GST_GL_MIXER_PAD (aggpad);
-
-  if (pad->upload) {
-    gst_object_unref (pad->upload);
-    pad->upload = NULL;
-  }
-
-  return TRUE;
-}
-
 static void
 _free_glmixer_frame_data (GstGLMixerFrameData * frame)
 {
@@ -1045,9 +753,6 @@
   GstGLMixer *mix = GST_GL_MIXER (agg);
   GstElement *element = GST_ELEMENT (agg);
 
-  if (!GST_AGGREGATOR_CLASS (parent_class)->start (agg))
-    return FALSE;
-
   GST_OBJECT_LOCK (mix);
   mix->array_buffers = g_ptr_array_new_full (element->numsinkpads,
       (GDestroyNotify) _free_glmixer_frame_data);
@@ -1061,7 +766,7 @@
 
   GST_OBJECT_UNLOCK (mix);
 
-  return TRUE;
+  return GST_AGGREGATOR_CLASS (parent_class)->start (agg);
 }
 
 static gboolean
@@ -1069,9 +774,7 @@
 {
   GstGLMixer *mix = GST_GL_MIXER (agg);
   GstGLMixerClass *mixer_class = GST_GL_MIXER_GET_CLASS (mix);
-
-  if (!GST_AGGREGATOR_CLASS (parent_class)->stop (agg))
-    return FALSE;
+  GstGLContext *context = GST_GL_BASE_MIXER (mix)->context;
 
   GST_OBJECT_LOCK (agg);
   g_ptr_array_free (mix->frames, TRUE);
@@ -1083,37 +786,12 @@
   if (mixer_class->reset)
     mixer_class->reset (mix);
   if (mix->fbo) {
-    gst_gl_context_del_fbo (mix->context, mix->fbo, mix->depthbuffer);
+    gst_gl_context_del_fbo (context, mix->fbo, mix->depthbuffer);
     mix->fbo = 0;
     mix->depthbuffer = 0;
   }
-  if (mix->download) {
-    gst_object_unref (mix->download);
-    mix->download = NULL;
-  }
 
-  gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (mix), _clean_upload, NULL);
-
-  if (mix->priv->query) {
-    gst_query_unref (mix->priv->query);
-    mix->priv->query = NULL;
-  }
-
-  if (mix->priv->pool) {
-    gst_object_unref (mix->priv->pool);
-    mix->priv->pool = NULL;
-  }
-
-  if (mix->display) {
-    gst_object_unref (mix->display);
-    mix->display = NULL;
-  }
-
-  if (mix->context) {
-    gst_object_unref (mix->context);
-    mix->context = NULL;
-  }
   gst_gl_mixer_reset (mix);
 
-  return TRUE;
+  return GST_AGGREGATOR_CLASS (parent_class)->stop (agg);
 }
diff --git a/ext/gl/gstglmixer.h b/ext/gl/gstglmixer.h
index d66ef30..01eed34 100644
--- a/ext/gl/gstglmixer.h
+++ b/ext/gl/gstglmixer.h
@@ -24,10 +24,43 @@
 #include <gst/gst.h>
 #include <gst/video/video.h>
 #include <gst/gl/gl.h>
-#include "gstglmixerpad.h"
+#include "gstglbasemixer.h"
 
 G_BEGIN_DECLS
 
+typedef struct _GstGLMixer GstGLMixer;
+typedef struct _GstGLMixerClass GstGLMixerClass;
+typedef struct _GstGLMixerPrivate GstGLMixerPrivate;
+typedef struct _GstGLMixerFrameData GstGLMixerFrameData;
+
+#define GST_TYPE_GL_MIXER_PAD (gst_gl_mixer_pad_get_type())
+#define GST_GL_MIXER_PAD(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_MIXER_PAD, GstGLMixerPad))
+#define GST_GL_MIXER_PAD_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_MIXER_PAD, GstGLMixerPadClass))
+#define GST_IS_GL_MIXER_PAD(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_MIXER_PAD))
+#define GST_IS_GL_MIXER_PAD_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_MIXER_PAD))
+#define GST_GL_MIXER_PAD_GET_CLASS(obj) \
+        (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_MIXER_PAD,GstGLMixerPadClass))
+
+typedef struct _GstGLMixerPad GstGLMixerPad;
+typedef struct _GstGLMixerPadClass GstGLMixerPadClass;
+
+/* all information needed for one video stream */
+struct _GstGLMixerPad
+{
+  GstGLBaseMixerPad parent;
+};
+
+struct _GstGLMixerPadClass
+{
+  GstGLBaseMixerPadClass parent_class;
+};
+
+GType gst_gl_mixer_pad_get_type (void);
+
 #define GST_TYPE_GL_MIXER (gst_gl_mixer_get_type())
 #define GST_GL_MIXER(obj) \
         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_MIXER, GstGLMixer))
@@ -40,11 +73,6 @@
 #define GST_GL_MIXER_GET_CLASS(obj) \
         (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_MIXER,GstGLMixerClass))
 
-typedef struct _GstGLMixer GstGLMixer;
-typedef struct _GstGLMixerClass GstGLMixerClass;
-typedef struct _GstGLMixerPrivate GstGLMixerPrivate;
-typedef struct _GstGLMixerFrameData GstGLMixerFrameData;
-
 typedef gboolean (*GstGLMixerSetCaps) (GstGLMixer* mixer,
   GstCaps* outcaps);
 typedef void (*GstGLMixerReset) (GstGLMixer *mixer);
@@ -55,27 +83,22 @@
 
 struct _GstGLMixer
 {
-  GstVideoAggregator vaggregator;
-
-  GstGLMixerPrivate *priv;
+  GstGLBaseMixer vaggregator;
 
   GPtrArray *array_buffers;
   GPtrArray *frames;
 
-  GLuint out_tex_id;
-  GstGLDownload *download;
-
-  GstGLDisplay *display;
-  GstGLContext *context;
   GLuint fbo;
   GLuint depthbuffer;
 
   GstCaps *out_caps;
+
+  GstGLMixerPrivate *priv;
 };
 
 struct _GstGLMixerClass
 {
-  GstVideoAggregatorClass parent_class;
+  GstGLBaseMixerClass parent_class;
 
   GstGLMixerSetCaps set_caps;
   GstGLMixerReset reset;
diff --git a/ext/gl/gstglmixerbin.c b/ext/gl/gstglmixerbin.c
new file mode 100644
index 0000000..2dada97
--- /dev/null
+++ b/ext/gl/gstglmixerbin.c
@@ -0,0 +1,570 @@
+/*
+ *
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstglmixerbin.h"
+
+#define GST_CAT_DEFAULT gst_gl_mixer_bin_debug
+GST_DEBUG_CATEGORY (gst_gl_mixer_bin_debug);
+
+#define DEFAULT_LATENCY        0
+
+struct input_chain
+{
+  GstGLMixerBin *self;
+  GstGhostPad *ghost_pad;
+  GstElement *upload;
+  GstElement *in_convert;
+  GstPad *mixer_pad;
+};
+
+static void
+_free_input_chain (struct input_chain *chain)
+{
+  if (!chain)
+    return;
+
+  if (chain->ghost_pad)
+    gst_object_unref (chain->ghost_pad);
+  chain->ghost_pad = NULL;
+
+  if (chain->upload) {
+    gst_bin_remove (GST_BIN (chain->self), chain->upload);
+    gst_object_unref (chain->upload);
+    chain->upload = NULL;
+  }
+
+  if (chain->in_convert) {
+    gst_bin_remove (GST_BIN (chain->self), chain->in_convert);
+    gst_object_unref (chain->in_convert);
+    chain->in_convert = NULL;
+  }
+
+  if (chain->mixer_pad) {
+    gst_element_release_request_pad (chain->self->mixer, chain->mixer_pad);
+    gst_object_unref (chain->mixer_pad);
+    chain->mixer_pad = NULL;
+  }
+
+  g_free (chain);
+}
+
+struct _GstGLMixerBinPrivate
+{
+  gboolean running;
+
+  GList *input_chains;
+};
+
+enum
+{
+  PROP_0,
+  PROP_MIXER,
+  PROP_LATENCY,
+};
+
+enum
+{
+  SIGNAL_0,
+  SIGNAL_CREATE_ELEMENT,
+  LAST_SIGNAL
+};
+
+static void gst_gl_mixer_bin_child_proxy_init (gpointer g_iface,
+    gpointer iface_data);
+
+#define GST_GL_MIXER_BIN_GET_PRIVATE(o)					\
+  (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_MIXER_BIN, GstGLMixerBinPrivate))
+G_DEFINE_TYPE_WITH_CODE (GstGLMixerBin, gst_gl_mixer_bin, GST_TYPE_BIN,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
+        gst_gl_mixer_bin_child_proxy_init));
+
+static guint gst_gl_mixer_bin_signals[LAST_SIGNAL] = { 0 };
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(ANY)")
+    );
+
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%u",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS ("video/x-raw(ANY)")
+    );
+
+static void gst_gl_mixer_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_gl_mixer_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void gst_gl_mixer_bin_dispose (GObject * object);
+
+static GstPad *gst_gl_mixer_bin_request_new_pad (GstElement * element,
+    GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps);
+static void gst_gl_mixer_bin_release_pad (GstElement * element, GstPad * pad);
+static GstStateChangeReturn gst_gl_mixer_bin_change_state (GstElement *
+    element, GstStateChange transition);
+
+static void
+gst_gl_mixer_bin_class_init (GstGLMixerBinClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstGLMixerBinPrivate));
+
+  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glmixerbin", 0,
+      "opengl mixer bin");
+
+  element_class->request_new_pad = gst_gl_mixer_bin_request_new_pad;
+  element_class->release_pad = gst_gl_mixer_bin_release_pad;
+  element_class->change_state = gst_gl_mixer_bin_change_state;
+
+  gobject_class->get_property = gst_gl_mixer_bin_get_property;
+  gobject_class->set_property = gst_gl_mixer_bin_set_property;
+  gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_gl_mixer_bin_dispose);
+
+  g_object_class_install_property (gobject_class, PROP_MIXER,
+      g_param_spec_object ("mixer",
+          "GL mixer element",
+          "The GL mixer chain to use",
+          GST_TYPE_ELEMENT,
+          GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
+          G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_LATENCY,
+      g_param_spec_int64 ("latency", "Buffer latency",
+          "Additional latency in live mode to allow upstream "
+          "to take longer to produce buffers for the current "
+          "position", 0,
+          (G_MAXLONG == G_MAXINT64) ? G_MAXINT64 : (G_MAXLONG * GST_SECOND - 1),
+          DEFAULT_LATENCY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstMixerBin::create-element:
+   * @object: the #GstGLMixerBin
+   *
+   * Will be emitted when we need the processing element/s that this bin will use
+   *
+   * Returns: a new #GstElement
+   */
+  gst_gl_mixer_bin_signals[SIGNAL_CREATE_ELEMENT] =
+      g_signal_new ("create-element", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      GST_TYPE_ELEMENT, 0);
+
+  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));
+}
+
+static void
+gst_gl_mixer_bin_init (GstGLMixerBin * self)
+{
+  gboolean res = TRUE;
+  GstPad *pad;
+
+  self->priv = GST_GL_MIXER_BIN_GET_PRIVATE (self);
+
+  self->out_convert = gst_element_factory_make ("glcolorconvert", NULL);
+  self->download = gst_element_factory_make ("gldownload", NULL);
+  res &= gst_bin_add (GST_BIN (self), self->out_convert);
+  res &= gst_bin_add (GST_BIN (self), self->download);
+
+  res &=
+      gst_element_link_pads (self->out_convert, "src", self->download, "sink");
+
+  pad = gst_element_get_static_pad (self->download, "src");
+  if (!pad) {
+    res = FALSE;
+  } else {
+    GST_DEBUG_OBJECT (self, "setting target src pad %" GST_PTR_FORMAT, pad);
+    self->srcpad = gst_ghost_pad_new ("src", pad);
+    gst_element_add_pad (GST_ELEMENT_CAST (self), self->srcpad);
+    gst_object_unref (pad);
+  }
+
+  if (!res)
+    GST_ERROR_OBJECT (self, "failed to create output chain");
+}
+
+static void
+gst_gl_mixer_bin_dispose (GObject * object)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (object);
+  GList *l = self->priv->input_chains;
+
+  while (l) {
+    struct input_chain *chain = l->data;
+
+    if (self->mixer && chain->mixer_pad) {
+      gst_element_release_request_pad (GST_ELEMENT (self->mixer),
+          chain->mixer_pad);
+      gst_object_unref (chain->mixer_pad);
+      chain->mixer_pad = NULL;
+    }
+
+    l = l->next;
+  }
+
+  g_list_free_full (self->priv->input_chains, (GDestroyNotify) g_free);
+
+  G_OBJECT_CLASS (gst_gl_mixer_bin_parent_class)->dispose (object);
+}
+
+static gboolean
+_create_input_chain (GstGLMixerBin * self, struct input_chain *chain,
+    GstPad * mixer_pad)
+{
+  GstGLMixerBinClass *klass = GST_GL_MIXER_BIN_GET_CLASS (self);
+  GstPad *pad;
+  gboolean res = TRUE;
+  gchar *name;
+
+  chain->self = self;
+  chain->mixer_pad = mixer_pad;
+
+  chain->upload = gst_element_factory_make ("glupload", NULL);
+  chain->in_convert = gst_element_factory_make ("glcolorconvert", NULL);
+
+  res &= gst_bin_add (GST_BIN (self), chain->in_convert);
+  res &= gst_bin_add (GST_BIN (self), chain->upload);
+
+  pad = gst_element_get_static_pad (chain->in_convert, "src");
+  if (gst_pad_link (pad, mixer_pad) != GST_PAD_LINK_OK) {
+    gst_object_unref (pad);
+    return FALSE;
+  }
+  gst_object_unref (pad);
+  res &=
+      gst_element_link_pads (chain->upload, "src", chain->in_convert, "sink");
+
+  pad = gst_element_get_static_pad (chain->upload, "sink");
+  if (!pad) {
+    return FALSE;
+  } else {
+    GST_DEBUG_OBJECT (self, "setting target sink pad %" GST_PTR_FORMAT, pad);
+    name = gst_object_get_name (GST_OBJECT (mixer_pad));
+    if (klass->create_input_pad) {
+      chain->ghost_pad = klass->create_input_pad (self, chain->mixer_pad);
+      gst_object_set_name (GST_OBJECT (chain->ghost_pad), name);
+      gst_ghost_pad_set_target (chain->ghost_pad, pad);
+    } else {
+      chain->ghost_pad =
+          GST_GHOST_PAD (gst_ghost_pad_new (GST_PAD_NAME (chain->mixer_pad),
+              pad));
+    }
+    g_free (name);
+
+    GST_OBJECT_LOCK (self);
+    if (self->priv->running)
+      gst_pad_set_active (GST_PAD (chain->ghost_pad), TRUE);
+    GST_OBJECT_UNLOCK (self);
+
+    gst_element_add_pad (GST_ELEMENT_CAST (self), GST_PAD (chain->ghost_pad));
+    gst_object_unref (pad);
+  }
+
+  gst_element_sync_state_with_parent (chain->upload);
+  gst_element_sync_state_with_parent (chain->in_convert);
+
+  return TRUE;
+}
+
+static GstPadTemplate *
+_find_element_pad_template (GstElement * element,
+    GstPadDirection direction, GstPadPresence presence)
+{
+  GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
+  GList *templ_list = gst_element_class_get_pad_template_list (klass);
+  GstPadTemplate *templ;
+
+  /* find suitable template */
+  while (templ_list) {
+    templ = (GstPadTemplate *) templ_list->data;
+
+    if (GST_PAD_TEMPLATE_DIRECTION (templ) != direction
+        || GST_PAD_TEMPLATE_PRESENCE (templ) != presence) {
+      templ_list = templ_list->next;
+      templ = NULL;
+      continue;
+    }
+
+    break;
+  }
+
+  return templ;
+}
+
+static gboolean
+_connect_mixer_element (GstGLMixerBin * self)
+{
+  gboolean res = TRUE;
+
+  g_return_val_if_fail (self->priv->input_chains == NULL, FALSE);
+
+  gst_object_set_name (GST_OBJECT (self->mixer), "mixer");
+  res &= gst_bin_add (GST_BIN (self), self->mixer);
+
+  res &= gst_element_link_pads (self->mixer, "src", self->out_convert, "sink");
+
+  if (!res)
+    GST_ERROR_OBJECT (self, "Failed to link mixer element into the pipeline");
+
+  gst_element_sync_state_with_parent (self->mixer);
+
+  return res;
+}
+
+void
+gst_gl_mixer_bin_finish_init_with_element (GstGLMixerBin * self,
+    GstElement * element)
+{
+  g_return_if_fail (GST_IS_ELEMENT (element));
+
+  self->mixer = element;
+
+  if (!_connect_mixer_element (self)) {
+    gst_object_unref (self->mixer);
+    self->mixer = NULL;
+  }
+}
+
+void
+gst_gl_mixer_bin_finish_init (GstGLMixerBin * self)
+{
+  GstGLMixerBinClass *klass = GST_GL_MIXER_BIN_GET_CLASS (self);
+  GstElement *element = NULL;
+
+  if (klass->create_element)
+    element = klass->create_element ();
+
+  if (element)
+    gst_gl_mixer_bin_finish_init_with_element (self, element);
+}
+
+static void
+gst_gl_mixer_bin_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (object);
+
+  switch (prop_id) {
+    case PROP_MIXER:
+      g_value_set_object (value, self->mixer);
+      break;
+    default:
+      if (self->mixer)
+        g_object_get_property (G_OBJECT (self->mixer), pspec->name, value);
+      break;
+  }
+}
+
+static void
+gst_gl_mixer_bin_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (object);
+
+  switch (prop_id) {
+    case PROP_MIXER:
+    {
+      GstElement *mixer = g_value_get_object (value);
+      /* FIXME: deal with replacing a mixer */
+      g_return_if_fail (!self->mixer || (self->mixer == mixer));
+      self->mixer = mixer;
+      if (mixer)
+        _connect_mixer_element (self);
+      break;
+    }
+    default:
+      if (self->mixer)
+        g_object_set_property (G_OBJECT (self->mixer), pspec->name, value);
+      break;
+  }
+}
+
+static GstPad *
+gst_gl_mixer_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
+    const gchar * req_name, const GstCaps * caps)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (element);
+  GstPadTemplate *mixer_templ;
+  struct input_chain *chain;
+  GstPad *mixer_pad;
+
+  chain = g_new0 (struct input_chain, 1);
+
+  mixer_templ = _find_element_pad_template (self->mixer,
+      GST_PAD_TEMPLATE_DIRECTION (templ), GST_PAD_TEMPLATE_PRESENCE (templ));
+  g_return_val_if_fail (mixer_templ, NULL);
+
+  mixer_pad =
+      gst_element_request_pad (self->mixer, mixer_templ, req_name, NULL);
+  gst_object_unref (mixer_templ);
+  g_return_val_if_fail (mixer_pad, NULL);
+
+  if (!_create_input_chain (self, chain, mixer_pad)) {
+    gst_element_release_request_pad (self->mixer, mixer_pad);
+    _free_input_chain (chain);
+    return NULL;
+  }
+
+  GST_OBJECT_LOCK (element);
+  self->priv->input_chains = g_list_prepend (self->priv->input_chains, chain);
+  GST_OBJECT_UNLOCK (element);
+
+  gst_child_proxy_child_added (GST_CHILD_PROXY (self),
+      G_OBJECT (chain->ghost_pad), GST_OBJECT_NAME (chain->ghost_pad));
+
+  return GST_PAD (chain->ghost_pad);
+}
+
+static void
+gst_gl_mixer_bin_release_pad (GstElement * element, GstPad * pad)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (element);
+  GList *l = self->priv->input_chains;
+
+  GST_OBJECT_LOCK (element);
+  while (l) {
+    struct input_chain *chain = l->data;
+    if (chain->mixer_pad == pad) {
+      _free_input_chain (chain);
+      self->priv->input_chains =
+          g_list_remove_link (self->priv->input_chains, l);
+      break;
+    }
+    l = l->next;
+  }
+  GST_OBJECT_UNLOCK (element);
+
+  gst_element_remove_pad (element, pad);
+}
+
+static GstStateChangeReturn
+gst_gl_mixer_bin_change_state (GstElement * element, GstStateChange transition)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (element);
+  GstGLMixerBinClass *klass = GST_GL_MIXER_BIN_GET_CLASS (self);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      GST_OBJECT_LOCK (element);
+      if (!self->mixer) {
+        if (klass->create_element)
+          self->mixer = klass->create_element ();
+
+        if (!self->mixer)
+          g_signal_emit (element,
+              gst_gl_mixer_bin_signals[SIGNAL_CREATE_ELEMENT], 0, &self->mixer);
+
+        if (!self->mixer) {
+          GST_ERROR_OBJECT (element, "Failed to retreive element");
+          GST_OBJECT_UNLOCK (element);
+          return GST_STATE_CHANGE_FAILURE;
+        }
+        GST_OBJECT_UNLOCK (element);
+        if (!_connect_mixer_element (self))
+          return GST_STATE_CHANGE_FAILURE;
+
+        GST_OBJECT_LOCK (element);
+      }
+      self->priv->running = TRUE;
+      GST_OBJECT_UNLOCK (element);
+      break;
+    default:
+      break;
+  }
+
+  ret =
+      GST_ELEMENT_CLASS (gst_gl_mixer_bin_parent_class)->change_state (element,
+      transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      GST_OBJECT_LOCK (self);
+      self->priv->running = FALSE;
+      GST_OBJECT_UNLOCK (self);
+    default:
+      break;
+  }
+
+  return ret;
+}
+
+static GObject *
+gst_gl_mixer_bin_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
+    guint index)
+{
+  GstGLMixerBin *mixer = GST_GL_MIXER_BIN (child_proxy);
+  GstBin *bin = GST_BIN_CAST (child_proxy);
+  GObject *res = NULL;
+
+  GST_OBJECT_LOCK (bin);
+  /* XXX: not exactly thread safe with ordering */
+  if (index < bin->numchildren) {
+    if ((res = g_list_nth_data (bin->children, index)))
+      gst_object_ref (res);
+  } else {
+    struct input_chain *chain;
+    if ((chain =
+            g_list_nth_data (mixer->priv->input_chains,
+                index - bin->numchildren))) {
+      res = gst_object_ref (chain->ghost_pad);
+    }
+  }
+  GST_OBJECT_UNLOCK (bin);
+
+  return res;
+}
+
+static guint
+gst_gl_mixer_bin_child_proxy_get_children_count (GstChildProxy * child_proxy)
+{
+  GstGLMixerBin *mixer = GST_GL_MIXER_BIN (child_proxy);
+  GstBin *bin = GST_BIN_CAST (child_proxy);
+  guint num;
+
+  GST_OBJECT_LOCK (bin);
+  num = bin->numchildren + g_list_length (mixer->priv->input_chains);
+  GST_OBJECT_UNLOCK (bin);
+
+  return num;
+}
+
+static void
+gst_gl_mixer_bin_child_proxy_init (gpointer g_iface, gpointer iface_data)
+{
+  GstChildProxyInterface *iface = g_iface;
+
+  iface->get_children_count = gst_gl_mixer_bin_child_proxy_get_children_count;
+  iface->get_child_by_index = gst_gl_mixer_bin_child_proxy_get_child_by_index;
+}
diff --git a/ext/gl/gstglmixerbin.h b/ext/gl/gstglmixerbin.h
new file mode 100644
index 0000000..5e5bb60
--- /dev/null
+++ b/ext/gl/gstglmixerbin.h
@@ -0,0 +1,72 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_MIXER_BIN_H__
+#define __GST_GL_MIXER_BIN_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_mixer_bin_get_type(void);
+#define GST_TYPE_GL_MIXER_BIN (gst_gl_mixer_bin_get_type())
+#define GST_GL_MIXER_BIN(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_MIXER_BIN, GstGLMixerBin))
+#define GST_GL_MIXER_BIN_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_MIXER_BIN, GstGLMixerBinClass))
+#define GST_IS_GL_MIXER_BIN(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_MIXER_BIN))
+#define GST_IS_GL_MIXER_BIN_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_MIXER_BIN))
+#define GST_GL_MIXER_BIN_GET_CLASS(obj) \
+        (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_MIXER_BIN,GstGLMixerBinClass))
+
+typedef struct _GstGLMixerBin GstGLMixerBin;
+typedef struct _GstGLMixerBinClass GstGLMixerBinClass;
+typedef struct _GstGLMixerBinPrivate GstGLMixerBinPrivate;
+
+struct _GstGLMixerBin
+{
+  GstBin parent;
+
+  GstElement *mixer;
+  GstElement *out_convert;
+  GstElement *download;
+  GstPad *srcpad;
+
+  GstGLMixerBinPrivate *priv;
+};
+
+struct _GstGLMixerBinClass
+{
+  GstBinClass parent_class;
+
+  GstElement * (*create_element) (void);
+  GstGhostPad * (*create_input_pad) (GstGLMixerBin * self, GstPad * mixer_pad);
+};
+
+void gst_gl_mixer_bin_finish_init (GstGLMixerBin * self);
+void gst_gl_mixer_bin_finish_init_with_element (GstGLMixerBin * self,
+    GstElement * element);
+
+G_END_DECLS
+#endif /* __GST_GL_MIXER_BIN_H__ */
diff --git a/ext/gl/gstglmixerpad.h b/ext/gl/gstglmixerpad.h
deleted file mode 100644
index d2fb829..0000000
--- a/ext/gl/gstglmixerpad.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_GL_MIXER_PAD_H__
-#define __GST_GL_MIXER_PAD_H__
-
-#include <gst/gst.h>
-#include <gst/video/gstvideoaggregator.h>
-
-#include <gst/gl/gstgldisplay.h>
-#include <gst/gl/gstglupload.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_MIXER_PAD (gst_gl_mixer_pad_get_type())
-#define GST_GL_MIXER_PAD(obj) \
-        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_MIXER_PAD, GstGLMixerPad))
-#define GST_GL_MIXER_PAD_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_MIXER_PAD, GstGLMixerPadiClass))
-#define GST_IS_GL_MIXER_PAD(obj) \
-        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_MIXER_PAD))
-#define GST_IS_GL_MIXER_PAD_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_MIXER_PAD))
-
-typedef struct _GstGLMixerPad GstGLMixerPad;
-typedef struct _GstGLMixerPadClass GstGLMixerPadClass;
-
-/* all information needed for one video stream */
-struct _GstGLMixerPad
-{
-  GstVideoAggregatorPad parent;                /* subclass the pad */
-
-  /* <private> */
-  GstGLUpload *upload;
-  guint in_tex_id;
-  gboolean mapped;
-};
-
-struct _GstGLMixerPadClass
-{
-  GstVideoAggregatorPadClass parent_class;
-};
-
-GType gst_gl_mixer_pad_get_type (void);
-
-G_END_DECLS
-#endif /* __GST_GL_MIXER_PAD_H__ */
diff --git a/ext/gl/gstglmosaic.c b/ext/gl/gstglmosaic.c
index 5a5c418..726674b 100644
--- a/ext/gl/gstglmosaic.c
+++ b/ext/gl/gstglmosaic.c
@@ -29,7 +29,12 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch-0.10 videotestsrc ! "video/x-raw-yuv, format=(fourcc)YUY2" ! glupload ! queue ! glmosaic name=m ! glimagesink videotestsrc pattern=12 ! "video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)5/1, width=100, height=200" ! glupload ! queue ! m. videotestsrc ! "video/x-raw-rgb, framerate=(fraction)15/1, width=1500, height=1500" ! glupload ! gleffects effect=3 ! queue ! m. videotestsrc ! glupload ! gleffects effect=2 ! queue ! m.  videotestsrc ! glupload ! glfiltercube ! queue ! m. videotestsrc ! glupload ! gleffects effect=6 ! queue ! m.
+ * gst-launch-1.0 videotestsrc ! video/x-raw, format=YUY2 ! queue ! glmosaic name=m ! glimagesink \
+ *     videotestsrc pattern=12 ! video/x-raw, format=I420, framerate=5/1, width=100, height=200 ! queue ! m. \
+ *     videotestsrc ! video/x-raw, framerate=15/1, width=1500, height=1500 ! gleffects effect=3 ! queue ! m. \
+ *     videotestsrc ! gleffects effect=2 ! queue ! m.  \
+ *     videotestsrc ! glfiltercube ! queue ! m. \
+ *     videotestsrc ! gleffects effect=6 ! queue ! m.
  * ]|
  * FBO (Frame Buffer Object) is required.
  * </refsect2>
@@ -129,6 +134,8 @@
   GST_GL_MIXER_CLASS (klass)->set_caps = gst_gl_mosaic_init_shader;
   GST_GL_MIXER_CLASS (klass)->reset = gst_gl_mosaic_reset;
   GST_GL_MIXER_CLASS (klass)->process_textures = gst_gl_mosaic_process_textures;
+
+  GST_GL_BASE_MIXER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
 }
 
 static void
@@ -173,7 +180,8 @@
 
   //blocking call, wait the opengl thread has destroyed the shader
   if (mosaic->shader)
-    gst_gl_context_del_shader (mixer->context, mosaic->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
+        mosaic->shader);
   mosaic->shader = NULL;
 }
 
@@ -183,8 +191,8 @@
   GstGLMosaic *mosaic = GST_GL_MOSAIC (mixer);
 
   //blocking call, wait the opengl thread has compiled the shader
-  return gst_gl_context_gen_shader (mixer->context, mosaic_v_src, mosaic_f_src,
-      &mosaic->shader);
+  return gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
+      mosaic_v_src, mosaic_f_src, &mosaic->shader);
 }
 
 static gboolean
@@ -196,7 +204,7 @@
   mosaic->input_frames = frames;
 
   //blocking call, use a FBO
-  gst_gl_context_use_fbo_v2 (mix->context,
+  gst_gl_context_use_fbo_v2 (GST_GL_BASE_MIXER (mix)->context,
       GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
       GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), mix->fbo,
       mix->depthbuffer, out_tex, gst_gl_mosaic_callback, (gpointer) mosaic);
@@ -210,7 +218,7 @@
 {
   GstGLMosaic *mosaic = GST_GL_MOSAIC (stuff);
   GstGLMixer *mixer = GST_GL_MIXER (mosaic);
-  GstGLFuncs *gl = mixer->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
 
   static GLfloat xrot = 0;
   static GLfloat yrot = 0;
@@ -232,7 +240,7 @@
 
   guint count = 0;
 
-  gst_gl_context_clear_shader (mixer->context);
+  gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
   gl->BindTexture (GL_TEXTURE_2D, 0);
   gl->Disable (GL_TEXTURE_2D);
 
@@ -337,7 +345,7 @@
 
   gl->Disable (GL_DEPTH_TEST);
 
-  gst_gl_context_clear_shader (mixer->context);
+  gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
 
   xrot += 0.6f;
   yrot += 0.4f;
diff --git a/ext/gl/gstgloverlay.c b/ext/gl/gstgloverlay.c
index ba108a9..2dd5326 100644
--- a/ext/gl/gstgloverlay.c
+++ b/ext/gl/gstgloverlay.c
@@ -26,14 +26,12 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch  videotestsrc ! "video/x-raw-rgb" ! glupload ! gloverlay location=imagefile ! glimagesink
+ * gst-launch-1.0 videotestsrc ! gloverlay location=image.jpg ! glimagesink
  * ]|
  * FBO (Frame Buffer Object) is required.
  * </refsect2>
  */
 
-/* FIXME: Redo this */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -70,9 +68,10 @@
 static void gst_gl_overlay_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static void gst_gl_overlay_init_resources (GstGLFilter * filter);
 static void gst_gl_overlay_reset_resources (GstGLFilter * filter);
 
+static void gst_gl_overlay_before_transform (GstBaseTransform * trans,
+    GstBuffer * outbuf);
 static gboolean gst_gl_overlay_filter_texture (GstGLFilter * filter,
     guint in_tex, guint out_tex);
 
@@ -83,26 +82,54 @@
 {
   PROP_0,
   PROP_LOCATION,
-  PROP_XPOS_PNG,
-  PROP_YPOS_PNG,
-  PROP_SIZE_PNG,
-  PROP_XPOS_VIDEO,
-  PROP_YPOS_VIDEO,
-  PROP_SIZE_VIDEO,
-  PROP_VIDEOTOP,
-  PROP_ROTATE_PNG,
-  PROP_ROTATE_VIDEO,
-  PROP_ANGLE_PNG,
-  PROP_ANGLE_VIDEO,
-  PROP_RATIO_VIDEO
+  PROP_OFFSET_X,
+  PROP_OFFSET_Y,
+  PROP_RELATIVE_X,
+  PROP_RELATIVE_Y,
+  PROP_OVERLAY_WIDTH,
+  PROP_OVERLAY_HEIGHT,
+  PROP_ALPHA
 };
 
+/* *INDENT-OFF* */
+/* vertex source */
+static const gchar *overlay_v_src =
+    "attribute vec4 a_position;\n"
+    "attribute vec2 a_texcoord;\n"
+    "varying vec2 v_texcoord;\n"
+    "void main()\n"
+    "{\n"
+    "   gl_Position = a_position;\n"
+    "   v_texcoord = a_texcoord;\n"
+    "}";
+
+/* fragment source */
+static const gchar *overlay_f_src =
+    "#ifdef GL_ES\n"
+    "precision mediump float;\n"
+    "#endif\n"
+    "uniform sampler2D texture;\n"
+    "uniform float alpha;\n"
+    "varying vec2 v_texcoord;\n"
+    "void main()\n"
+    "{\n"
+    "  vec4 rgba = texture2D( texture, v_texcoord );\n"
+    "  gl_FragColor = vec4(rgba.rgb, rgba.a * alpha);\n"
+    "}\n";
+/* *INDENT-ON* */
 
 /* init resources that need a gl context */
-static void
+static gboolean
 gst_gl_overlay_init_gl_resources (GstGLFilter * filter)
 {
-//  GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
+  GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
+
+  if (overlay->shader)
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        overlay->shader);
+
+  return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+      overlay_v_src, overlay_f_src, &overlay->shader);
 }
 
 /* free resources that need a gl context */
@@ -110,9 +137,38 @@
 gst_gl_overlay_reset_gl_resources (GstGLFilter * filter)
 {
   GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
-  const GstGLFuncs *gl = filter->context->gl_vtable;
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
-  gl->DeleteTextures (1, &overlay->pbuftexture);
+  if (overlay->shader) {
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        overlay->shader);
+    overlay->shader = NULL;
+  }
+
+  if (overlay->image_memory) {
+    gst_memory_unref ((GstMemory *) overlay->image_memory);
+    overlay->image_memory = NULL;
+  }
+
+  if (overlay->vao) {
+    gl->DeleteVertexArrays (1, &overlay->vao);
+    overlay->vao = 0;
+  }
+
+  if (overlay->vbo) {
+    gl->DeleteBuffers (1, &overlay->vbo);
+    overlay->vbo = 0;
+  }
+
+  if (overlay->overlay_vao) {
+    gl->DeleteVertexArrays (1, &overlay->overlay_vao);
+    overlay->overlay_vao = 0;
+  }
+
+  if (overlay->overlay_vbo) {
+    gl->DeleteBuffers (1, &overlay->overlay_vbo);
+    overlay->overlay_vbo = 0;
+  }
 }
 
 static void
@@ -129,311 +185,90 @@
 
   GST_GL_FILTER_CLASS (klass)->set_caps = gst_gl_overlay_set_caps;
   GST_GL_FILTER_CLASS (klass)->filter_texture = gst_gl_overlay_filter_texture;
-  GST_GL_FILTER_CLASS (klass)->display_init_cb =
-      gst_gl_overlay_init_gl_resources;
   GST_GL_FILTER_CLASS (klass)->display_reset_cb =
       gst_gl_overlay_reset_gl_resources;
-  GST_GL_FILTER_CLASS (klass)->onStart = gst_gl_overlay_init_resources;
   GST_GL_FILTER_CLASS (klass)->onStop = gst_gl_overlay_reset_resources;
+  GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_overlay_init_gl_resources;
 
-  g_object_class_install_property (gobject_class,
-      PROP_LOCATION,
-      g_param_spec_string ("location",
-          "Location of the image",
-          "Location of the image", NULL,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  GST_BASE_TRANSFORM_CLASS (klass)->before_transform =
+      GST_DEBUG_FUNCPTR (gst_gl_overlay_before_transform);
 
-  g_object_class_install_property (gobject_class,
-      PROP_XPOS_PNG,
-      g_param_spec_int ("xpos-png",
-          "X position of overlay image in percents",
-          "X position of overlay image in percents",
-          0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_YPOS_PNG,
-      g_param_spec_int ("ypos-png",
-          "Y position of overlay image in percents",
-          "Y position of overlay image in percents",
-          0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_SIZE_PNG,
-      g_param_spec_int ("proportion-png",
-          "Relative size of overlay image, in percents",
-          "Relative size of iverlay image, in percents",
-          0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_XPOS_VIDEO,
-      g_param_spec_int ("xpos-video",
-          "X position of overlay video in percents",
-          "X position of overlay video in percents",
-          0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_YPOS_VIDEO,
-      g_param_spec_int ("ypos-video",
-          "Y position of overlay video in percents",
-          "Y position of overlay video in percents",
-          0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_SIZE_VIDEO,
-      g_param_spec_int ("proportion-video",
-          "Relative size of overlay video, in percents",
-          "Relative size of iverlay video, in percents",
-          0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_VIDEOTOP,
-      g_param_spec_boolean ("video-top",
-          "Video-top", "Video is over png image", FALSE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_ROTATE_PNG,
-      g_param_spec_int ("rotate-png",
-          "choose rotation axis for the moment only Y axis is implemented",
-          "choose rotation axis for the moment only Y axis is implemented",
-          0, 3, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_ROTATE_VIDEO,
-      g_param_spec_int ("rotate-video",
-          "choose rotation axis for the moment only Y axis is implemented",
-          "choose rotation axis for the moment only Y axis is implemented",
-          0, 3, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_ANGLE_PNG,
-      g_param_spec_int ("angle-png",
-          "choose angle in axis to choosen between -90 and 90",
-          "choose angle in axis to choosen between -90 and 90",
-          -90, 90, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_ANGLE_VIDEO,
-      g_param_spec_int ("angle-video",
-          "choose angle in axis to choosen between -90 and 90",
-          "choose angle in axis to choosen between -90 and 90",
-          -90, 90, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class,
-      PROP_RATIO_VIDEO,
-      g_param_spec_int ("ratio-video",
-          "choose ratio video between 0 and 3\n \t\t\t0 : Default ratio\n\t\t\t1 : 4 / 3\n\t\t\t2 : 16 / 9\n\t\t\t3 : 16 / 10",
-          "choose ratio video between 0 and 3\n \t\t\t0 : Default ratio\n\t\t\t1 : 4 / 3\n\t\t\t2 : 16 / 9\n\t\t\t3 : 16 / 10",
-          0, 3, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_LOCATION,
+      g_param_spec_string ("location", "location",
+          "Location of image file to overlay", NULL, GST_PARAM_CONTROLLABLE
+          | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
+          | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_OFFSET_X,
+      g_param_spec_int ("offset-x", "X Offset",
+          "For positive value, horizontal offset of overlay image in pixels from"
+          " left of video image. For negative value, horizontal offset of overlay"
+          " image in pixels from right of video image", G_MININT, G_MAXINT, 0,
+          GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
+          | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_OFFSET_Y,
+      g_param_spec_int ("offset-y", "Y Offset",
+          "For positive value, vertical offset of overlay image in pixels from"
+          " top of video image. For negative value, vertical offset of overlay"
+          " image in pixels from bottom of video image", G_MININT, G_MAXINT, 0,
+          GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
+          | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_RELATIVE_X,
+      g_param_spec_double ("relative-x", "Relative X Offset",
+          "Horizontal offset of overlay image in fractions of video image "
+          "width, from top-left corner of video image", 0.0, 1.0, 0.0,
+          GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
+          | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_RELATIVE_Y,
+      g_param_spec_double ("relative-y", "Relative Y Offset",
+          "Vertical offset of overlay image in fractions of video image "
+          "height, from top-left corner of video image", 0.0, 1.0, 0.0,
+          GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
+          | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_OVERLAY_WIDTH,
+      g_param_spec_int ("overlay-width", "Overlay Width",
+          "Width of overlay image in pixels (0 = same as overlay image)", 0,
+          G_MAXINT, 0,
+          GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
+          | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_OVERLAY_HEIGHT,
+      g_param_spec_int ("overlay-height", "Overlay Height",
+          "Height of overlay image in pixels (0 = same as overlay image)", 0,
+          G_MAXINT, 0,
+          GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
+          | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_ALPHA,
+      g_param_spec_double ("alpha", "Alpha", "Global alpha of overlay image",
+          0.0, 1.0, 1.0, GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING
+          | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   gst_element_class_set_metadata (element_class,
       "Gstreamer OpenGL Overlay", "Filter/Effect/Video",
-      "Overlay GL video texture with a PNG image",
-      "Filippo Argiolas <filippo.argiolas@gmail.com>");
+      "Overlay GL video texture with a JPEG/PNG image",
+      "Filippo Argiolas <filippo.argiolas@gmail.com>, "
+      "Matthew Waters <matthew@centricular.com>");
 
-  /*
-     g_object_class_install_property (gobject_class,
-     PROP_STRETCH,
-     g_param_spec_boolean ("stretch",
-     "Stretch the image to texture size",
-     "Stretch the image to fit video texture size",
-     TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-   */
-}
-
-static void
-gst_gl_overlay_calc_ratio_video (GstGLOverlay * o, gfloat * video_ratio_w,
-    gfloat * video_ratio_h)
-{
-  if (o->ratio_video == 0) {
-    o->ratio_texture = (gfloat) o->ratio_window;
-    *video_ratio_w = (gfloat) o->width_window;
-    *video_ratio_h = (gfloat) o->height_window;
-  } else if (o->ratio_video == 1) {
-    o->ratio_texture = (gfloat) 1.33;
-    *video_ratio_w = 4.0;
-    *video_ratio_h = 3.0;
-  } else if (o->ratio_video == 2) {
-    o->ratio_texture = (gfloat) 1.77;
-    *video_ratio_w = 16.0;
-    *video_ratio_h = 9.0;
-  } else {
-    o->ratio_texture = (gfloat) 1.6;
-    *video_ratio_w = 16.0;
-    *video_ratio_h = 10.0;
-  }
-}
-
-static void
-gst_gl_overlay_init_texture (GstGLOverlay * o, GLuint tex, int flag)
-{
-  GstGLFilter *filter = GST_GL_FILTER (o);
-  const GstGLFuncs *gl = filter->context->gl_vtable;
-
-  if (flag == 0 && o->type_file == 2) {
-    gl->Enable (GL_TEXTURE_2D);
-    gl->BindTexture (GL_TEXTURE_2D, tex);
-  } else {
-    gl->Enable (GL_TEXTURE_2D);
-    gl->BindTexture (GL_TEXTURE_2D, tex);
-  }
-}
-
-static void
-gst_gl_overlay_draw (GstGLOverlay * o, int flag)
-{
-  GstGLFilter *filter = GST_GL_FILTER (o);
-  const GstGLFuncs *gl = filter->context->gl_vtable;
-
-  float y = 0.0f;
-  float width = 0.0f;
-  float height = 0.0f;
-
-/* *INDENT-OFF* */
-  float v_vertices[] = {
- /*|            Vertex             | TexCoord  |*/
-    -o->ratio_x + o->posx, y, 0.0f, 0.0f,  0.0f,
-     o->ratio_x + o->posx, y, 0.0f, width, 0.0f,
-     o->ratio_x + o->posx, y, 0.0f, width, height,
-    -o->ratio_x + o->posx, y, 0.0f, 0.0,   height,
-  };
-
-  GLushort indices[] = {
-    0, 1, 2,
-    0, 2, 3,
-  };
-/* *INDENT-ON* */
-
-  if (flag == 1) {
-    width = 1.0f;
-    height = 1.0f;
-  } else if (flag == 0 && o->type_file == 1) {
-    width = (gfloat) o->width;
-    height = (gfloat) o->height;
-  } else if (flag == 0 && o->type_file == 2) {
-    width = 1.0f;
-    height = 1.0f;
-  }
-
-  v_vertices[8] = width;
-  v_vertices[13] = width;
-  v_vertices[14] = height;
-  v_vertices[19] = height;
-
-  y = (o->type_file == 2 && flag == 0 ? o->ratio_y : -o->ratio_y) + o->posy;
-  v_vertices[1] = y;
-  v_vertices[6] = y;
-  y = (o->type_file == 2 && flag == 0 ? -o->ratio_y : o->ratio_y) + o->posy;
-  v_vertices[11] = y;
-  v_vertices[16] = y;
-
-  gst_gl_context_clear_shader (filter->context);
-
-  gl->ClientActiveTexture (GL_TEXTURE0);
-  gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
-  gl->EnableClientState (GL_VERTEX_ARRAY);
-
-  gl->VertexPointer (3, GL_FLOAT, 5 * sizeof (float), v_vertices);
-  gl->TexCoordPointer (2, GL_FLOAT, 5 * sizeof (float), &v_vertices[3]);
-
-  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
-
-  gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
-  gl->DisableClientState (GL_VERTEX_ARRAY);
-}
-
-static void
-gst_gl_overlay_calc_proportion (GstGLOverlay * o, int flag, float size_texture,
-    float width, float height)
-{
-  if ((1.59f < o->ratio_window && o->ratio_window < 1.61f
-          && 1.77f < o->ratio_texture && o->ratio_texture < 1.78f)
-      || (1.3f < o->ratio_window && o->ratio_window < 1.34f
-          && ((1.7f < o->ratio_texture && o->ratio_texture < 1.78f)
-              || (1.59f < o->ratio_texture && o->ratio_texture < 1.61f)))) {
-    o->ratio_x = o->ratio_window * (gfloat) size_texture / 100.0f;
-    o->ratio_y =
-        (o->ratio_window / width) * height * (gfloat) size_texture / 100.0f;
-  } else {
-    o->ratio_x = o->ratio_texture * (gfloat) size_texture / 100.0f;
-    o->ratio_y = 1.0f * size_texture / 100.0f;
-  }
-  o->posx =
-      ((o->ratio_window - o->ratio_x) * ((flag ==
-              1 ? o->pos_x_video : o->pos_x_png) - 50.0f) / 50.0f);
-  o->posy =
-      (1.0f - o->ratio_y) * (((flag ==
-              1 ? o->pos_y_video : o->pos_y_png) - 50.0f) / 50.0f);
-}
-
-static void
-gst_gl_overlay_load_texture (GstGLOverlay * o, GLuint tex, int flag)
-{
-  GstGLFilter *filter = GST_GL_FILTER (o);
-  const GstGLFuncs *gl = filter->context->gl_vtable;
-
-  gfloat video_ratio_w;
-  gfloat video_ratio_h;
-
-  o->ratio_window = (gfloat) o->width_window / (gfloat) o->height_window;
-
-  gl->MatrixMode (GL_MODELVIEW);
-  gl->ActiveTexture (GL_TEXTURE0);
-
-  gst_gl_overlay_init_texture (o, tex, flag);
-
-  gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-  gl->Enable (GL_BLEND);
-  gl->Translatef (0.0f, 0.0f, -1.43f);
-
-  if (flag == 1) {
-    if (o->rotate_video)
-      gl->Rotatef (o->angle_video, 0, 1, 0);
-    gst_gl_overlay_calc_ratio_video (o, &video_ratio_w, &video_ratio_h);
-    gst_gl_overlay_calc_proportion (o, flag, o->size_video, video_ratio_w,
-        video_ratio_h);
-  } else {
-    o->ratio_texture = (gfloat) o->width / (gfloat) o->height;
-    if (o->rotate_png == 2)
-      gl->Rotatef (o->angle_png, 0, 1, 0);
-    gst_gl_overlay_calc_proportion (o, flag, o->size_png, (gfloat) o->width,
-        (gfloat) o->height);
-  }
-
-  gst_gl_overlay_draw (o, flag);
-  if (flag == 1)
-    gl->Disable (GL_TEXTURE_2D);
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
 }
 
 static void
 gst_gl_overlay_init (GstGLOverlay * overlay)
 {
-  overlay->location = NULL;
-  overlay->pixbuf = NULL;
-  overlay->pbuftexture = 0;
-  overlay->pbuftexture = 0;
-  overlay->width = 0;
-  overlay->height = 0;
-  overlay->pos_x_png = 0;
-  overlay->pos_y_png = 0;
-  overlay->size_png = 100;
-  overlay->pos_x_video = 0;
-  overlay->pos_y_video = 0;
-  overlay->size_video = 100;
-  overlay->video_top = FALSE;
-  overlay->rotate_png = 0;
-  overlay->rotate_video = 0;
-  overlay->angle_png = 0;
-  overlay->angle_video = 0;
-  overlay->ratio_video = 0;
-  //  overlay->stretch = TRUE;
-  overlay->pbuf_has_changed = FALSE;
+  overlay->offset_x = 0;
+  overlay->offset_y = 0;
+
+  overlay->relative_x = 0.0;
+  overlay->relative_y = 0.0;
+
+  overlay->overlay_width = 0;
+  overlay->overlay_height = 0;
+
+  overlay->alpha = 1.0;
 }
 
 static void
 gst_gl_overlay_reset_resources (GstGLFilter * filter)
 {
-  // GstGLOverlay* overlay = GST_GL_OVERLAY(filter);
 }
 
 static void
@@ -446,49 +281,36 @@
     case PROP_LOCATION:
       if (overlay->location != NULL)
         g_free (overlay->location);
-      overlay->pbuf_has_changed = TRUE;
+      overlay->location_has_changed = TRUE;
       overlay->location = g_value_dup_string (value);
       break;
-    case PROP_XPOS_PNG:
-      overlay->pos_x_png = g_value_get_int (value);
+    case PROP_OFFSET_X:
+      overlay->offset_x = g_value_get_int (value);
+      overlay->geometry_change = TRUE;
       break;
-    case PROP_YPOS_PNG:
-      overlay->pos_y_png = g_value_get_int (value);
+    case PROP_OFFSET_Y:
+      overlay->offset_y = g_value_get_int (value);
+      overlay->geometry_change = TRUE;
       break;
-    case PROP_SIZE_PNG:
-      overlay->size_png = g_value_get_int (value);
+    case PROP_RELATIVE_X:
+      overlay->relative_x = g_value_get_double (value);
+      overlay->geometry_change = TRUE;
       break;
-    case PROP_XPOS_VIDEO:
-      overlay->pos_x_video = g_value_get_int (value);
+    case PROP_RELATIVE_Y:
+      overlay->relative_y = g_value_get_double (value);
+      overlay->geometry_change = TRUE;
       break;
-    case PROP_YPOS_VIDEO:
-      overlay->pos_y_video = g_value_get_int (value);
+    case PROP_OVERLAY_WIDTH:
+      overlay->overlay_width = g_value_get_int (value);
+      overlay->geometry_change = TRUE;
       break;
-    case PROP_SIZE_VIDEO:
-      overlay->size_video = g_value_get_int (value);
+    case PROP_OVERLAY_HEIGHT:
+      overlay->overlay_height = g_value_get_int (value);
+      overlay->geometry_change = TRUE;
       break;
-    case PROP_VIDEOTOP:
-      overlay->video_top = g_value_get_boolean (value);
+    case PROP_ALPHA:
+      overlay->alpha = g_value_get_double (value);
       break;
-    case PROP_ROTATE_PNG:
-      overlay->rotate_png = g_value_get_int (value);
-      break;
-    case PROP_ROTATE_VIDEO:
-      overlay->rotate_video = g_value_get_int (value);
-      break;
-    case PROP_ANGLE_PNG:
-      overlay->angle_png = g_value_get_int (value);
-      break;
-    case PROP_ANGLE_VIDEO:
-      overlay->angle_video = g_value_get_int (value);
-      break;
-    case PROP_RATIO_VIDEO:
-      overlay->ratio_video = (gfloat) g_value_get_int (value);
-      break;
-      /*  case PROP_STRETCH:
-         overlay->stretch = g_value_get_boolean (value);
-         break;
-       */
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -505,46 +327,27 @@
     case PROP_LOCATION:
       g_value_set_string (value, overlay->location);
       break;
-    case PROP_XPOS_PNG:
-      g_value_set_int (value, overlay->pos_x_png);
+    case PROP_OFFSET_X:
+      g_value_set_int (value, overlay->offset_x);
       break;
-    case PROP_YPOS_PNG:
-      g_value_set_int (value, overlay->pos_y_png);
+    case PROP_OFFSET_Y:
+      g_value_set_int (value, overlay->offset_y);
       break;
-    case PROP_SIZE_PNG:
-      g_value_set_int (value, overlay->size_png);
+    case PROP_RELATIVE_X:
+      g_value_set_double (value, overlay->relative_x);
       break;
-    case PROP_XPOS_VIDEO:
-      g_value_set_int (value, overlay->pos_x_video);
+    case PROP_RELATIVE_Y:
+      g_value_set_double (value, overlay->relative_y);
       break;
-    case PROP_YPOS_VIDEO:
-      g_value_set_int (value, overlay->pos_y_video);
+    case PROP_OVERLAY_WIDTH:
+      g_value_set_int (value, overlay->overlay_width);
       break;
-    case PROP_SIZE_VIDEO:
-      g_value_set_int (value, overlay->size_video);
+    case PROP_OVERLAY_HEIGHT:
+      g_value_set_int (value, overlay->overlay_height);
       break;
-    case PROP_VIDEOTOP:
-      g_value_set_boolean (value, overlay->video_top);
+    case PROP_ALPHA:
+      g_value_set_double (value, overlay->alpha);
       break;
-    case PROP_ROTATE_PNG:
-      g_value_set_int (value, overlay->rotate_png);
-      break;
-    case PROP_ROTATE_VIDEO:
-      g_value_set_int (value, overlay->rotate_video);
-      break;
-    case PROP_ANGLE_PNG:
-      g_value_set_int (value, overlay->angle_png);
-      break;
-    case PROP_ANGLE_VIDEO:
-      g_value_set_int (value, overlay->angle_video);
-      break;
-    case PROP_RATIO_VIDEO:
-      g_value_set_int (value, (gint) overlay->ratio_video);
-      break;
-      /*  case PROP_STRETCH:
-         g_value_set_boolean (value, overlay->stretch);
-         break;
-       */
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -563,78 +366,199 @@
   gst_structure_get_int (s, "width", &width);
   gst_structure_get_int (s, "height", &height);
 
-  overlay->width_window = (gfloat) width;
-  overlay->height_window = (gfloat) height;
+  overlay->window_width = width;
+  overlay->window_height = height;
 
   return TRUE;
 }
 
 static void
-gst_gl_overlay_init_resources (GstGLFilter * filter)
+_unbind_buffer (GstGLOverlay * overlay)
 {
-//  GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (overlay)->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  gl->DisableVertexAttribArray (overlay->attr_position);
+  gl->DisableVertexAttribArray (overlay->attr_texture);
 }
 
 static void
+_bind_buffer (GstGLOverlay * overlay, GLuint vbo)
+{
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (overlay)->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, vbo);
+
+  gl->EnableVertexAttribArray (overlay->attr_position);
+  gl->EnableVertexAttribArray (overlay->attr_texture);
+
+  gl->VertexAttribPointer (overlay->attr_position, 3, GL_FLOAT,
+      GL_FALSE, 5 * sizeof (GLfloat), (void *) 0);
+  gl->VertexAttribPointer (overlay->attr_texture, 2, GL_FLOAT,
+      GL_FALSE, 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
+}
+
+/* *INDENT-OFF* */
+float v_vertices[] = {
+/*|      Vertex     | TexCoord  |*/
+  -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
+   1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
+   1.0f,  1.0f, 0.0f, 1.0f, 1.0f,
+  -1.0f,  1.0f, 0.0f, 0.0f, 1.0f,
+};
+/* *INDENT-ON* */
+
+static void
 gst_gl_overlay_callback (gint width, gint height, guint texture, gpointer stuff)
 {
   GstGLOverlay *overlay = GST_GL_OVERLAY (stuff);
   GstGLFilter *filter = GST_GL_FILTER (overlay);
-  const GstGLFuncs *gl = filter->context->gl_vtable;
+  GstMapInfo map_info;
+  guint image_tex;
+  gboolean memory_mapped = FALSE;
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
-  gl->MatrixMode (GL_PROJECTION);
-  gl->LoadIdentity ();
-  gluPerspective (70.0f,
-      (GLfloat) overlay->width_window / (GLfloat) overlay->height_window, 1.0f,
-      1000.0f);
-  gl->Enable (GL_DEPTH_TEST);
-  gluLookAt (0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
-  if (!overlay->video_top) {
-    if (overlay->pbuftexture != 0)
-      gst_gl_overlay_load_texture (overlay, overlay->pbuftexture, 0);
-    // if (overlay->stretch) {
-    //   width = (gfloat) overlay->width;
-    //   height = (gfloat) overlay->height;
-    // }
+  GLushort indices[] = {
+    0, 1, 2,
+    0, 2, 3,
+  };
+
+#if GST_GL_HAVE_OPENGL
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
+      GST_GL_API_OPENGL) {
+
+    gl->MatrixMode (GL_PROJECTION);
     gl->LoadIdentity ();
-    gst_gl_overlay_load_texture (overlay, texture, 1);
-  } else {
-    gst_gl_overlay_load_texture (overlay, texture, 1);
-    if (overlay->pbuftexture == 0)
-      return;
-    // if (overlay->stretch) {
-    //   width = (gfloat) overlay->width;
-    //   height = (gfloat) overlay->height;
-    // }
-    gl->LoadIdentity ();
-    gst_gl_overlay_load_texture (overlay, overlay->pbuftexture, 0);
   }
-}
+#endif
 
-static void
-init_pixbuf_texture (GstGLContext * context, gpointer data)
-{
-  GstGLOverlay *overlay = GST_GL_OVERLAY (data);
-  GstGLFilter *filter = GST_GL_FILTER (overlay);
-  const GstGLFuncs *gl = filter->context->gl_vtable;
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
+      GST_GL_API_OPENGL)
+    gl->Enable (GL_TEXTURE_2D);
 
-  if (overlay->pixbuf) {
-    gl->DeleteTextures (1, &overlay->pbuftexture);
-    gl->GenTextures (1, &overlay->pbuftexture);
-    if (overlay->type_file == 1) {
-      gl->BindTexture (GL_TEXTURE_2D, overlay->pbuftexture);
-      gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
-          (gint) overlay->width, (gint) overlay->height, 0,
-          GL_RGBA, GL_UNSIGNED_BYTE, overlay->pixbuf);
-    } else if (overlay->type_file == 2) {
-      gl->BindTexture (GL_TEXTURE_2D, overlay->pbuftexture);
-      gl->TexImage2D (GL_TEXTURE_2D, 0, overlay->internalFormat,
-          overlay->width, overlay->height, 0, overlay->format,
-          GL_UNSIGNED_BYTE, overlay->pixbuf);
-      gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-      gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+  gl->ActiveTexture (GL_TEXTURE0);
+  gl->BindTexture (GL_TEXTURE_2D, texture);
+
+  gst_gl_shader_use (overlay->shader);
+
+  gst_gl_shader_set_uniform_1f (overlay->shader, "alpha", 1.0f);
+  gst_gl_shader_set_uniform_1i (overlay->shader, "texture", 0);
+
+  overlay->attr_position =
+      gst_gl_shader_get_attribute_location (overlay->shader, "a_position");
+  overlay->attr_texture =
+      gst_gl_shader_get_attribute_location (overlay->shader, "a_texcoord");
+
+  if (!overlay->vbo) {
+    if (gl->GenVertexArrays) {
+      gl->GenVertexArrays (1, &overlay->vao);
+      gl->BindVertexArray (overlay->vao);
     }
+
+    gl->GenBuffers (1, &overlay->vbo);
+    gl->BindBuffer (GL_ARRAY_BUFFER, overlay->vbo);
+    gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), v_vertices,
+        GL_STATIC_DRAW);
+
+    if (gl->GenVertexArrays)
+      _bind_buffer (overlay, overlay->vbo);
   }
+
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (overlay->vao);
+  else
+    _bind_buffer (overlay, overlay->vbo);
+
+  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+  if (!overlay->image_memory)
+    goto out;
+
+  if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
+          GST_MAP_READ | GST_MAP_GL) || map_info.data == NULL)
+    goto out;
+
+  memory_mapped = TRUE;
+  image_tex = *(guint *) map_info.data;
+
+  if (!overlay->overlay_vbo) {
+    if (gl->GenVertexArrays) {
+      gl->GenVertexArrays (1, &overlay->overlay_vao);
+      gl->BindVertexArray (overlay->overlay_vao);
+    }
+
+    gl->GenBuffers (1, &overlay->overlay_vbo);
+    gl->BindBuffer (GL_ARRAY_BUFFER, overlay->overlay_vbo);
+    overlay->geometry_change = TRUE;
+  }
+
+  if (overlay->geometry_change) {
+    gint render_width, render_height;
+    gfloat x, y, image_width, image_height;
+
+    /* *INDENT-OFF* */
+    float vertices[] = {
+     -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
+      1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
+      1.0f,  1.0f, 0.0f, 1.0f, 1.0f,
+     -1.0f,  1.0f, 0.0f, 0.0,  1.0f,
+    };
+    /* *INDENT-ON* */
+
+    /* scale from [0, 1] -> [-1, 1] */
+    x = ((gfloat) overlay->offset_x / (gfloat) overlay->window_width +
+        overlay->relative_x) * 2.0f - 1.0;
+    y = ((gfloat) overlay->offset_y / (gfloat) overlay->window_height +
+        overlay->relative_y) * 2.0f - 1.0;
+    /* scale from [0, 1] -> [0, 2] */
+    render_width =
+        overlay->overlay_width >
+        0 ? overlay->overlay_width : overlay->image_width;
+    render_height =
+        overlay->overlay_height >
+        0 ? overlay->overlay_height : overlay->image_height;
+    image_width =
+        ((gfloat) render_width / (gfloat) overlay->window_width) * 2.0f;
+    image_height =
+        ((gfloat) render_height / (gfloat) overlay->window_height) * 2.0f;
+
+    vertices[0] = vertices[15] = x;
+    vertices[5] = vertices[10] = x + image_width;
+    vertices[1] = vertices[6] = y;
+    vertices[11] = vertices[16] = y + image_height;
+
+    gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
+        GL_STATIC_DRAW);
+  }
+
+  if (gl->GenVertexArrays) {
+    if (overlay->geometry_change)
+      _bind_buffer (overlay, overlay->overlay_vbo);
+    gl->BindVertexArray (overlay->overlay_vao);
+    gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+  } else {
+    _bind_buffer (overlay, overlay->overlay_vbo);
+  }
+
+  gl->BindTexture (GL_TEXTURE_2D, image_tex);
+  gst_gl_shader_set_uniform_1f (overlay->shader, "alpha", overlay->alpha);
+
+  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+out:
+  if (gl->GenVertexArrays) {
+    gl->BindVertexArray (0);
+  } else {
+    _unbind_buffer (overlay);
+  }
+
+  gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
+
+  if (memory_mapped)
+    gst_memory_unmap ((GstMemory *) overlay->image_memory, &map_info);
+
+  overlay->geometry_change = FALSE;
 }
 
 static gboolean
@@ -643,18 +567,20 @@
 {
   GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
 
-  if (overlay->pbuf_has_changed && (overlay->location != NULL)) {
-    if ((overlay->type_file = gst_gl_overlay_load_png (filter)) == 0)
-      if ((overlay->type_file = gst_gl_overlay_load_jpeg (filter)) == 0)
-        overlay->pixbuf = NULL;
-    /* if loader failed then context is turned off */
-    gst_gl_context_thread_add (filter->context, init_pixbuf_texture, overlay);
-    if (overlay->pixbuf) {
-      free (overlay->pixbuf);
-      overlay->pixbuf = NULL;
+  if (overlay->location_has_changed) {
+    if (overlay->image_memory) {
+      gst_memory_unref ((GstMemory *) overlay->image_memory);
+      overlay->image_memory = NULL;
+    }
+    if (overlay->location != NULL) {
+      if ((overlay->type_file = gst_gl_overlay_load_png (filter)) == 0) {
+        if ((overlay->type_file = gst_gl_overlay_load_jpeg (filter)) == 0) {
+          return FALSE;
+        }
+      }
     }
 
-    overlay->pbuf_has_changed = FALSE;
+    overlay->location_has_changed = FALSE;
   }
 
   gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
@@ -664,6 +590,18 @@
 }
 
 static void
+gst_gl_overlay_before_transform (GstBaseTransform * trans, GstBuffer * outbuf)
+{
+  GstClockTime stream_time;
+
+  stream_time = gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME,
+      GST_BUFFER_TIMESTAMP (outbuf));
+
+  if (GST_CLOCK_TIME_IS_VALID (stream_time))
+    gst_object_sync_values (GST_OBJECT (trans), stream_time);
+}
+
+static void
 user_warning_fn (png_structp png_ptr, png_const_charp warning_msg)
 {
   g_warning ("%s\n", warning_msg);
@@ -675,6 +613,9 @@
 gst_gl_overlay_load_jpeg (GstGLFilter * filter)
 {
   GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
+  GstVideoInfo v_info;
+  GstVideoAlignment v_align;
+  GstMapInfo map_info;
   FILE *fp = NULL;
   struct jpeg_decompress_struct cinfo;
   struct jpeg_error_mgr jerr;
@@ -691,23 +632,36 @@
   jpeg_stdio_src (&cinfo, fp);
   jpeg_read_header (&cinfo, TRUE);
   jpeg_start_decompress (&cinfo);
-  overlay->width = cinfo.image_width;
-  overlay->height = cinfo.image_height;
-  overlay->internalFormat = cinfo.num_components;
+  overlay->image_width = cinfo.image_width;
+  overlay->image_height = cinfo.image_height;
+
   if (cinfo.num_components == 1)
-    overlay->format = GL_LUMINANCE;
+    gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_Y444,
+        overlay->image_width, overlay->image_height);
   else
-    overlay->format = GL_RGB;
-  overlay->pixbuf = (GLubyte *) malloc (sizeof (GLubyte) * overlay->width
-      * overlay->height * overlay->internalFormat);
-  for (i = 0; i < overlay->height; ++i) {
-    j = (overlay->pixbuf +
-        (((int) overlay->height - (i +
-                    1)) * (int) overlay->width * overlay->internalFormat));
+    gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGB,
+        overlay->image_width, overlay->image_height);
+
+  gst_video_alignment_reset (&v_align);
+  v_align.stride_align[0] = 32 - 1;
+  gst_video_info_align (&v_info, &v_align);
+
+  overlay->image_memory =
+      (GstGLMemory *) gst_gl_memory_alloc (GST_GL_BASE_FILTER (filter)->context,
+      NULL, &v_info, 0, &v_align);
+
+  if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
+          GST_MAP_WRITE)) {
+    LOAD_ERROR ("failed to map memory");
+  }
+
+  for (i = 0; i < overlay->image_height; ++i) {
+    j = map_info.data + v_info.stride[0] * i;
     jpeg_read_scanlines (&cinfo, &j, 1);
   }
   jpeg_finish_decompress (&cinfo);
   jpeg_destroy_decompress (&cinfo);
+  gst_memory_unmap ((GstMemory *) overlay->image_memory, &map_info);
   fclose (fp);
   return 2;
 }
@@ -716,6 +670,8 @@
 gst_gl_overlay_load_png (GstGLFilter * filter)
 {
   GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
+  GstVideoInfo v_info;
+  GstMapInfo map_info;
 
   png_structp png_ptr;
   png_infop info_ptr;
@@ -731,7 +687,7 @@
   png_byte magic[8];
   gint n_read;
 
-  if (!filter->context)
+  if (!GST_GL_BASE_FILTER (filter)->context)
     return 1;
 
   if ((fp = fopen (overlay->location, "rb")) == NULL)
@@ -787,19 +743,27 @@
     LOAD_ERROR ("color type is not rgb");
   }
 
-  overlay->width = width;
-  overlay->height = height;
+  overlay->image_width = width;
+  overlay->image_height = height;
 
-  overlay->pixbuf = (guchar *) malloc (sizeof (guchar) * width * height * 4);
+  gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, width, height);
+  overlay->image_memory =
+      (GstGLMemory *) gst_gl_memory_alloc (GST_GL_BASE_FILTER (filter)->context,
+      NULL, &v_info, 0, NULL);
 
+  if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
+          GST_MAP_WRITE)) {
+    LOAD_ERROR ("failed to map memory");
+  }
   rows = (guchar **) malloc (sizeof (guchar *) * height);
 
   for (y = 0; y < height; ++y)
-    rows[y] = (guchar *) (overlay->pixbuf + y * width * 4);
+    rows[y] = (guchar *) (map_info.data + y * width * 4);
 
   png_read_image (png_ptr, rows);
 
   free (rows);
+  gst_memory_unmap ((GstMemory *) overlay->image_memory, &map_info);
 
   png_read_end (png_ptr, info_ptr);
   png_destroy_read_struct (&png_ptr, &info_ptr, png_infopp_NULL);
diff --git a/ext/gl/gstgloverlay.h b/ext/gl/gstgloverlay.h
index 50e6ef4..d81a0a0 100644
--- a/ext/gl/gstgloverlay.h
+++ b/ext/gl/gstgloverlay.h
@@ -37,37 +37,38 @@
 
 struct _GstGLOverlay
 {
-  GstGLFilter filter;
-  gchar *location;
-  gboolean pbuf_has_changed;
-  gint8 pos_x_png;
-  gint8 pos_y_png;
-  guint8 size_png;
-  gint8 pos_x_video;
-  gint8 pos_y_video;
-  guint8 size_video;
-  gboolean video_top;
-  guint8 rotate_png;
-  guint8 rotate_video;
-  gint8 angle_png;
-  gint8 angle_video;
-  guchar *pixbuf;
-  gint width, height;
-  GLuint pbuftexture;
-  GLint internalFormat;
-  GLenum format;
-  gint type_file;               // 0 = No; 1 = PNG and 2 = JPEG
-  gfloat width_window;
-  gfloat height_window;
-  gfloat posx;
-  gfloat posy;
-  gfloat ratio_window;
-  gfloat ratio_texture;
-  gfloat ratio_x;
-  gfloat ratio_y;
-  gfloat ratio_video;
+  GstGLFilter  filter;
 
-/*  gboolean stretch; */
+  /* properties */
+  gchar        *location;
+  gint          offset_x;
+  gint          offset_y;
+
+  gdouble       relative_x;
+  gdouble       relative_y;
+
+  gint          overlay_width;
+  gint          overlay_height;
+
+  gdouble       alpha;
+
+  /* <private> */
+  GstGLShader  *shader;
+  GstGLMemory  *image_memory;
+
+  gboolean      location_has_changed;
+  gint          type_file;               // 0 = No; 1 = PNG and 2 = JPEG
+  gint          window_width, window_height;
+  gint          image_width, image_height;
+
+  gboolean      geometry_change;
+
+  GLuint        vao;
+  GLuint        overlay_vao;
+  GLuint        vbo;
+  GLuint        overlay_vbo;
+  GLuint        attr_position;
+  GLuint        attr_texture;
 };
 
 struct _GstGLOverlayClass
diff --git a/ext/gl/gstglsinkbin.c b/ext/gl/gstglsinkbin.c
new file mode 100644
index 0000000..ec6a1e2
--- /dev/null
+++ b/ext/gl/gstglsinkbin.c
@@ -0,0 +1,401 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/video/videooverlay.h>
+#include <gst/video/navigation.h>
+
+#include "gstglsinkbin.h"
+
+GST_DEBUG_CATEGORY (gst_debug_gl_sink_bin);
+#define GST_CAT_DEFAULT gst_debug_gl_sink_bin
+
+static void gst_gl_sink_bin_finalize (GObject * object);
+static void gst_gl_sink_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * param_spec);
+static void gst_gl_sink_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * param_spec);
+
+static GstStateChangeReturn gst_gl_sink_bin_change_state (GstElement * element,
+    GstStateChange transition);
+
+static void gst_gl_sink_bin_video_overlay_init (gpointer g_iface,
+    gpointer g_iface_data);
+static void gst_gl_sink_bin_navigation_interface_init (gpointer g_iface,
+    gpointer g_iface_data);
+
+static GstStaticPadTemplate gst_gl_sink_bin_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(ANY)"));
+
+enum
+{
+  PROP_0,
+  PROP_FORCE_ASPECT_RATIO,
+  PROP_SINK,
+};
+
+enum
+{
+  SIGNAL_0,
+  SIGNAL_CREATE_ELEMENT,
+  SIGNAL_LAST,
+};
+
+static guint gst_gl_sink_bin_signals[SIGNAL_LAST] = { 0, };
+
+#define gst_gl_sink_bin_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGLSinkBin, gst_gl_sink_bin,
+    GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
+        gst_gl_sink_bin_video_overlay_init);
+    G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
+        gst_gl_sink_bin_navigation_interface_init);
+    GST_DEBUG_CATEGORY_INIT (gst_debug_gl_sink_bin, "glimagesink", 0,
+        "OpenGL Video Sink Bin"));
+
+static void
+gst_gl_sink_bin_class_init (GstGLSinkBinClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = GST_ELEMENT_CLASS (klass);
+
+  element_class->change_state = gst_gl_sink_bin_change_state;
+
+  gobject_class->set_property = gst_gl_sink_bin_set_property;
+  gobject_class->get_property = gst_gl_sink_bin_get_property;
+  gobject_class->finalize = gst_gl_sink_bin_finalize;
+
+  g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
+      g_param_spec_boolean ("force-aspect-ratio",
+          "Force aspect ratio",
+          "When enabled, scaling will respect original aspect ratio", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SINK,
+      g_param_spec_object ("sink",
+          "GL sink element",
+          "The GL sink chain to use",
+          GST_TYPE_ELEMENT,
+          GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
+          G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstGLSinkBin::create-element:
+   * @object: the #GstGLSinkBin
+   *
+   * Will be emitted when we need the processing element/s that this bin will use
+   *
+   * Returns: a new #GstElement
+   */
+  gst_gl_sink_bin_signals[SIGNAL_CREATE_ELEMENT] =
+      g_signal_new ("create-element", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      GST_TYPE_ELEMENT, 0);
+
+  gst_element_class_set_metadata (element_class,
+      "GL Sink Bin", "Sink/Video",
+      "Infrastructure to process GL textures",
+      "Matthew Waters <matthew@centricular.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_gl_sink_bin_template));
+}
+
+static void
+gst_gl_sink_bin_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_gl_sink_bin_init (GstGLSinkBin * self)
+{
+  gboolean res = TRUE;
+  GstPad *pad;
+
+  self->upload = gst_element_factory_make ("glupload", NULL);
+  self->convert = gst_element_factory_make ("glcolorconvert", NULL);
+
+  res &= gst_bin_add (GST_BIN (self), self->upload);
+  res &= gst_bin_add (GST_BIN (self), self->convert);
+
+  res &= gst_element_link_pads (self->upload, "src", self->convert, "sink");
+
+  pad = gst_element_get_static_pad (self->upload, "sink");
+  if (!pad) {
+    res = FALSE;
+  } else {
+    GST_DEBUG_OBJECT (self, "setting target sink pad %" GST_PTR_FORMAT, pad);
+    self->sinkpad = gst_ghost_pad_new ("sink", pad);
+    gst_element_add_pad (GST_ELEMENT_CAST (self), self->sinkpad);
+    gst_object_unref (pad);
+  }
+
+  if (!res) {
+    GST_WARNING_OBJECT (self, "Failed to add/connect the necessary machinery");
+  }
+}
+
+static gboolean
+_connect_sink_element (GstGLSinkBin * self)
+{
+  gboolean res = TRUE;
+
+  gst_object_set_name (GST_OBJECT (self->sink), "sink");
+  res &= gst_bin_add (GST_BIN (self), self->sink);
+
+  res &= gst_element_link_pads (self->convert, "src", self->sink, "sink");
+
+  if (!res)
+    GST_ERROR_OBJECT (self, "Failed to link sink element into the pipeline");
+
+  return res;
+}
+
+void
+gst_gl_sink_bin_finish_init_with_element (GstGLSinkBin * self,
+    GstElement * element)
+{
+  g_return_if_fail (GST_IS_ELEMENT (element));
+
+  self->sink = element;
+
+  if (!_connect_sink_element (self)) {
+    gst_object_unref (self->sink);
+    self->sink = NULL;
+  }
+}
+
+void
+gst_gl_sink_bin_finish_init (GstGLSinkBin * self)
+{
+  GstGLSinkBinClass *klass = GST_GL_SINK_BIN_GET_CLASS (self);
+  GstElement *element = NULL;
+
+  if (klass->create_element)
+    element = klass->create_element ();
+
+  if (element)
+    gst_gl_sink_bin_finish_init_with_element (self, element);
+}
+
+static void
+gst_gl_sink_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (object);
+
+  switch (prop_id) {
+    case PROP_SINK:
+    {
+      GstElement *sink = g_value_get_object (value);
+      if (self->sink)
+        gst_bin_remove (GST_BIN (self), self->sink);
+      self->sink = sink;
+      if (sink)
+        _connect_sink_element (self);
+      break;
+    }
+    case PROP_FORCE_ASPECT_RATIO:
+      if (self->sink)
+        g_object_set_property (G_OBJECT (self->sink), pspec->name, value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_gl_sink_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (object);
+
+  switch (prop_id) {
+    case PROP_SINK:
+      g_value_set_object (value, self->sink);
+      break;
+    case PROP_FORCE_ASPECT_RATIO:
+      if (self->sink)
+        g_object_get_property (G_OBJECT (self->sink), pspec->name, value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static GstStateChangeReturn
+gst_gl_sink_bin_change_state (GstElement * element, GstStateChange transition)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (element);
+  GstGLSinkBinClass *klass = GST_GL_SINK_BIN_GET_CLASS (self);
+  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+
+  GST_DEBUG ("changing state: %s => %s",
+      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
+      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!self->sink) {
+        if (klass->create_element)
+          self->sink = klass->create_element ();
+
+        if (!self->sink)
+          g_signal_emit (element,
+              gst_gl_sink_bin_signals[SIGNAL_CREATE_ELEMENT], 0, &self->sink);
+
+        if (!self->sink) {
+          GST_ERROR_OBJECT (element, "Failed to retreive element");
+          return GST_STATE_CHANGE_FAILURE;
+        }
+        if (!_connect_sink_element (self))
+          return GST_STATE_CHANGE_FAILURE;
+      }
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    default:
+      break;
+  }
+
+  return ret;
+}
+
+static void
+gst_gl_sink_bin_navigation_send_event (GstNavigation * navigation, GstStructure
+    * structure)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (navigation);
+  GstElement *nav =
+      gst_bin_get_by_interface (GST_BIN (self), GST_TYPE_NAVIGATION);
+
+  if (nav) {
+    gst_navigation_send_event (GST_NAVIGATION (nav), structure);
+    structure = NULL;
+    gst_object_unref (nav);
+  } else {
+    GstEvent *event = gst_event_new_navigation (structure);
+    structure = NULL;
+    gst_element_send_event (GST_ELEMENT (self), event);
+  }
+}
+
+static void
+gst_gl_sink_bin_navigation_interface_init (gpointer g_iface,
+    gpointer g_iface_data)
+{
+  GstNavigationInterface *iface = (GstNavigationInterface *) g_iface;
+  iface->send_event = gst_gl_sink_bin_navigation_send_event;
+}
+
+static void
+gst_gl_sink_bin_overlay_expose (GstVideoOverlay * overlay)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (overlay);
+  GstVideoOverlay *overlay_element = NULL;
+
+  overlay_element =
+      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (self),
+          GST_TYPE_VIDEO_OVERLAY));
+
+  if (overlay_element) {
+    gst_video_overlay_expose (overlay_element);
+    gst_object_unref (overlay_element);
+  }
+}
+
+static void
+gst_gl_sink_bin_overlay_handle_events (GstVideoOverlay * overlay,
+    gboolean handle_events)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (overlay);
+  GstVideoOverlay *overlay_element = NULL;
+
+  overlay_element =
+      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (self),
+          GST_TYPE_VIDEO_OVERLAY));
+
+  if (overlay_element) {
+    gst_video_overlay_handle_events (overlay_element, handle_events);
+    gst_object_unref (overlay_element);
+  }
+}
+
+static void
+gst_gl_sink_bin_overlay_set_render_rectangle (GstVideoOverlay * overlay, gint x,
+    gint y, gint width, gint height)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (overlay);
+  GstVideoOverlay *overlay_element = NULL;
+
+  overlay_element =
+      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (self),
+          GST_TYPE_VIDEO_OVERLAY));
+
+  if (overlay_element) {
+    gst_video_overlay_set_render_rectangle (overlay_element, x, y, width,
+        height);
+    gst_object_unref (overlay_element);
+  }
+}
+
+static void
+gst_gl_sink_bin_overlay_set_window_handle (GstVideoOverlay * overlay,
+    guintptr handle)
+{
+  GstGLSinkBin *self = GST_GL_SINK_BIN (overlay);
+  GstVideoOverlay *overlay_element = NULL;
+
+  overlay_element =
+      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (self),
+          GST_TYPE_VIDEO_OVERLAY));
+
+  if (overlay_element) {
+    gst_video_overlay_set_window_handle (overlay_element, handle);
+    gst_object_unref (overlay_element);
+  }
+}
+
+static void
+gst_gl_sink_bin_video_overlay_init (gpointer g_iface, gpointer g_iface_data)
+{
+  GstVideoOverlayInterface *iface = (GstVideoOverlayInterface *) g_iface;
+  iface->expose = gst_gl_sink_bin_overlay_expose;
+  iface->handle_events = gst_gl_sink_bin_overlay_handle_events;
+  iface->set_render_rectangle = gst_gl_sink_bin_overlay_set_render_rectangle;
+  iface->set_window_handle = gst_gl_sink_bin_overlay_set_window_handle;
+}
diff --git a/ext/gl/gstglsinkbin.h b/ext/gl/gstglsinkbin.h
new file mode 100644
index 0000000..1dbb40d
--- /dev/null
+++ b/ext/gl/gstglsinkbin.h
@@ -0,0 +1,75 @@
+/*
+ * GStreamer
+ * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
+ * Copyright (C) 2005,2006,2007 David A. Schleef <ds@schleef.org>
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_SINK_BIN_H_
+#define _GST_GL_SINK_BIN_H_
+
+#include <gst/gst.h>
+#include <gst/video/gstvideosink.h>
+#include <gst/video/video.h>
+
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_sink_bin_get_type(void);
+#define GST_TYPE_GL_SINK_BIN \
+    (gst_gl_sink_bin_get_type())
+#define GST_GL_SINK_BIN(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_SINK_BIN,GstGLSinkBin))
+#define GST_GL_SINK_BIN_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_SINK_BIN,GstGLSinkBinClass))
+#define GST_IS_GL_SINK_BIN(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_SINK_BIN))
+#define GST_IS_GL_SINK_BIN_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_SINK_BIN))
+#define GST_GL_SINK_BIN_GET_CLASS(obj) \
+    (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_SINK_BIN,GstGLSinkBinClass))
+
+typedef struct _GstGLSinkBin GstGLSinkBin;
+typedef struct _GstGLSinkBinClass GstGLSinkBinClass;
+
+struct _GstGLSinkBin
+{
+  GstBin parent;
+
+  GstPad *sinkpad;
+
+  GstElement *upload;
+  GstElement *convert;
+  GstElement *sink;
+};
+
+struct _GstGLSinkBinClass
+{
+  GstBinClass parent_class;
+
+  GstElement * (*create_element) (void);
+};
+
+void gst_gl_sink_bin_finish_init (GstGLSinkBin * self);
+void gst_gl_sink_bin_finish_init_with_element (GstGLSinkBin * self,
+    GstElement * element);
+
+G_END_DECLS
+
+#endif
diff --git a/ext/gl/gstglsrcbin.c b/ext/gl/gstglsrcbin.c
new file mode 100644
index 0000000..58d34c6
--- /dev/null
+++ b/ext/gl/gstglsrcbin.c
@@ -0,0 +1,273 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstglsrcbin.h"
+
+GST_DEBUG_CATEGORY (gst_debug_gl_src_bin);
+#define GST_CAT_DEFAULT gst_debug_gl_src_bin
+
+static void gst_gl_src_bin_finalize (GObject * object);
+static void gst_gl_src_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * param_spec);
+static void gst_gl_src_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * param_spec);
+
+static GstStateChangeReturn gst_gl_src_bin_change_state (GstElement * element,
+    GstStateChange transition);
+
+static GstStaticPadTemplate gst_gl_src_bin_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(ANY)"));
+
+enum
+{
+  PROP_0,
+  PROP_SRC,
+};
+
+enum
+{
+  SIGNAL_0,
+  SIGNAL_CREATE_ELEMENT,
+  SIGNAL_LAST,
+};
+
+static guint gst_gl_src_bin_signals[SIGNAL_LAST] = { 0, };
+
+#define gst_gl_src_bin_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGLSrcBin, gst_gl_src_bin,
+    GST_TYPE_BIN,
+    GST_DEBUG_CATEGORY_INIT (gst_debug_gl_src_bin, "glsrcbin", 0,
+        "OpenGL Video Src Bin"));
+
+static void
+gst_gl_src_bin_class_init (GstGLSrcBinClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = GST_ELEMENT_CLASS (klass);
+
+  element_class->change_state = gst_gl_src_bin_change_state;
+
+  gobject_class->set_property = gst_gl_src_bin_set_property;
+  gobject_class->get_property = gst_gl_src_bin_get_property;
+  gobject_class->finalize = gst_gl_src_bin_finalize;
+
+  g_object_class_install_property (gobject_class, PROP_SRC,
+      g_param_spec_object ("src",
+          "GL src element",
+          "The GL src chain to use",
+          GST_TYPE_ELEMENT,
+          GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
+          G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstGLSrcBin::create-element:
+   * @object: the #GstGLSrcBin
+   *
+   * Will be emitted when we need the processing element/s that this bin will use
+   *
+   * Returns: a new #GstElement
+   */
+  gst_gl_src_bin_signals[SIGNAL_CREATE_ELEMENT] =
+      g_signal_new ("create-element", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      GST_TYPE_ELEMENT, 0);
+
+  gst_element_class_set_metadata (element_class,
+      "GL Src Bin", "Src/Video",
+      "Infrastructure to process GL textures",
+      "Matthew Waters <matthew@centricular.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_gl_src_bin_template));
+}
+
+static void
+gst_gl_src_bin_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_gl_src_bin_init (GstGLSrcBin * self)
+{
+  gboolean res = TRUE;
+  GstPad *pad;
+
+  self->download = gst_element_factory_make ("gldownload", NULL);
+  self->convert = gst_element_factory_make ("glcolorconvert", NULL);
+
+  res &= gst_bin_add (GST_BIN (self), self->download);
+  res &= gst_bin_add (GST_BIN (self), self->convert);
+
+  res &= gst_element_link_pads (self->convert, "src", self->download, "sink");
+
+  pad = gst_element_get_static_pad (self->download, "src");
+  if (!pad) {
+    res = FALSE;
+  } else {
+    GST_DEBUG_OBJECT (self, "setting target src pad %" GST_PTR_FORMAT, pad);
+    self->srcpad = gst_ghost_pad_new ("src", pad);
+    gst_element_add_pad (GST_ELEMENT_CAST (self), self->srcpad);
+    gst_object_unref (pad);
+  }
+
+  if (!res) {
+    GST_WARNING_OBJECT (self, "Failed to add/connect the necessary machinery");
+  }
+}
+
+static gboolean
+_connect_src_element (GstGLSrcBin * self)
+{
+  gboolean res = TRUE;
+
+  gst_object_set_name (GST_OBJECT (self->src), "src");
+  res &= gst_bin_add (GST_BIN (self), self->src);
+
+  res &= gst_element_link_pads (self->src, "src", self->convert, "sink");
+
+  if (!res)
+    GST_ERROR_OBJECT (self, "Failed to link src element into the pipeline");
+
+  return res;
+}
+
+void
+gst_gl_src_bin_finish_init_with_element (GstGLSrcBin * self,
+    GstElement * element)
+{
+  g_return_if_fail (GST_IS_ELEMENT (element));
+
+  self->src = element;
+
+  if (!_connect_src_element (self)) {
+    gst_object_unref (self->src);
+    self->src = NULL;
+  }
+}
+
+void
+gst_gl_src_bin_finish_init (GstGLSrcBin * self)
+{
+  GstGLSrcBinClass *klass = GST_GL_SRC_BIN_GET_CLASS (self);
+  GstElement *element = NULL;
+
+  if (klass->create_element)
+    element = klass->create_element ();
+
+  if (element)
+    gst_gl_src_bin_finish_init_with_element (self, element);
+}
+
+static void
+gst_gl_src_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstGLSrcBin *self = GST_GL_SRC_BIN (object);
+
+  switch (prop_id) {
+    case PROP_SRC:
+    {
+      GstElement *src = g_value_get_object (value);
+      if (self->src)
+        gst_bin_remove (GST_BIN (self), self->src);
+      self->src = src;
+      if (src)
+        _connect_src_element (self);
+      break;
+    }
+    default:
+      if (self->src)
+        g_object_set_property (G_OBJECT (self->src), pspec->name, value);
+      break;
+  }
+}
+
+static void
+gst_gl_src_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstGLSrcBin *self = GST_GL_SRC_BIN (object);
+
+  switch (prop_id) {
+    case PROP_SRC:
+      g_value_set_object (value, self->src);
+      break;
+    default:
+      if (self->src)
+        g_object_get_property (G_OBJECT (self->src), pspec->name, value);
+      break;
+  }
+}
+
+static GstStateChangeReturn
+gst_gl_src_bin_change_state (GstElement * element, GstStateChange transition)
+{
+  GstGLSrcBin *self = GST_GL_SRC_BIN (element);
+  GstGLSrcBinClass *klass = GST_GL_SRC_BIN_GET_CLASS (self);
+  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+
+  GST_DEBUG ("changing state: %s => %s",
+      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
+      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!self->src) {
+        if (klass->create_element)
+          self->src = klass->create_element ();
+
+        if (!self->src)
+          g_signal_emit (element,
+              gst_gl_src_bin_signals[SIGNAL_CREATE_ELEMENT], 0, &self->src);
+
+        if (!self->src) {
+          GST_ERROR_OBJECT (element, "Failed to retreive element");
+          return GST_STATE_CHANGE_FAILURE;
+        }
+        if (!_connect_src_element (self))
+          return GST_STATE_CHANGE_FAILURE;
+      }
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    default:
+      break;
+  }
+
+  return ret;
+}
diff --git a/ext/gl/gstglsrcbin.h b/ext/gl/gstglsrcbin.h
new file mode 100644
index 0000000..4230168
--- /dev/null
+++ b/ext/gl/gstglsrcbin.h
@@ -0,0 +1,71 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_SRC_BIN_H_
+#define _GST_GL_SRC_BIN_H_
+
+#include <gst/gst.h>
+
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_src_bin_get_type(void);
+#define GST_TYPE_GL_SRC_BIN \
+    (gst_gl_src_bin_get_type())
+#define GST_GL_SRC_BIN(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_SRC_BIN,GstGLSrcBin))
+#define GST_GL_SRC_BIN_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_SRC_BIN,GstGLSrcBinClass))
+#define GST_IS_GL_SRC_BIN(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_SRC_BIN))
+#define GST_IS_GL_SRC_BIN_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_SRC_BIN))
+#define GST_GL_SRC_BIN_GET_CLASS(obj) \
+    (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_SRC_BIN,GstGLSrcBinClass))
+
+typedef struct _GstGLSrcBin GstGLSrcBin;
+typedef struct _GstGLSrcBinClass GstGLSrcBinClass;
+
+struct _GstGLSrcBin
+{
+  GstBin parent;
+
+  GstPad *srcpad;
+
+  GstElement *src;
+  GstElement *convert;
+  GstElement *download;
+};
+
+struct _GstGLSrcBinClass
+{
+  GstBinClass parent_class;
+
+  GstElement * (*create_element) (void);
+};
+
+void gst_gl_src_bin_finish_init (GstGLSrcBin * self);
+void gst_gl_src_bin_finish_init_with_element (GstGLSrcBin * self,
+    GstElement * element);
+
+G_END_DECLS
+
+#endif
diff --git a/ext/gl/gstgltestsrc.c b/ext/gl/gstgltestsrc.c
index e443df0..dbd5610 100644
--- a/ext/gl/gstgltestsrc.c
+++ b/ext/gl/gstgltestsrc.c
@@ -3,6 +3,7 @@
  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
  * Copyright (C) 2002,2007 David A. Schleef <ds@schleef.org>
  * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -47,11 +48,8 @@
 #include "gltestsrc.h"
 #include <gst/gst-i18n-plugin.h>
 
-#if GST_GL_HAVE_PLATFORM_EGL
-#include <gst/gl/egl/gsteglimagememory.h>
-#endif
-
 #define USE_PEER_BUFFERALLOC
+#define SUPPORTED_GL_APIS GST_GL_API_OPENGL
 
 GST_DEBUG_CATEGORY_STATIC (gl_test_src_debug);
 #define GST_CAT_DEFAULT gl_test_src_debug
@@ -70,14 +68,7 @@
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
         (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
-            "RGBA") "; "
-#if GST_GL_HAVE_PLATFORM_EGL
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_EGL_IMAGE,
-            "RGBA") "; "
-#endif
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-        (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META,
-            "RGBA") "; " GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS))
+            "RGBA"))
     );
 
 #define gst_gl_test_src_parent_class parent_class
@@ -89,8 +80,10 @@
     const GValue * value, GParamSpec * pspec);
 static void gst_gl_test_src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
+static void gst_gl_test_src_dispose (GObject * object);
 
 static gboolean gst_gl_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
+static GstCaps *gst_gl_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter);
 static GstCaps *gst_gl_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
 
 static gboolean gst_gl_test_src_is_seekable (GstBaseSrc * psrc);
@@ -99,6 +92,8 @@
 static gboolean gst_gl_test_src_query (GstBaseSrc * bsrc, GstQuery * query);
 static void gst_gl_test_src_set_context (GstElement * element,
     GstContext * context);
+static GstStateChangeReturn gst_gl_test_src_change_state (GstElement * element,
+    GstStateChange transition);
 
 static void gst_gl_test_src_get_times (GstBaseSrc * basesrc,
     GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
@@ -111,6 +106,8 @@
 
 static void gst_gl_test_src_callback (gpointer stuff);
 
+static gboolean gst_gl_test_src_init_shader (GstGLTestSrc * gltestsrc);
+
 #define GST_TYPE_GL_TEST_SRC_PATTERN (gst_gl_test_src_pattern_get_type ())
 static GType
 gst_gl_test_src_pattern_get_type (void)
@@ -130,6 +127,7 @@
     {GST_GL_TEST_SRC_CHECKERS8, "Checkers 8px", "checkers-8"},
     {GST_GL_TEST_SRC_CIRCULAR, "Circular", "circular"},
     {GST_GL_TEST_SRC_BLINK, "Blink", "blink"},
+    {GST_GL_TEST_SRC_MANDELBROT, "Mandelbrot Fractal", "mandelbrot"},
     {0, NULL, NULL}
   };
 
@@ -158,6 +156,7 @@
 
   gobject_class->set_property = gst_gl_test_src_set_property;
   gobject_class->get_property = gst_gl_test_src_get_property;
+  gobject_class->dispose = gst_gl_test_src_dispose;
 
   g_object_class_install_property (gobject_class, PROP_PATTERN,
       g_param_spec_enum ("pattern", "Pattern",
@@ -181,8 +180,10 @@
       gst_static_pad_template_get (&src_factory));
 
   element_class->set_context = gst_gl_test_src_set_context;
+  element_class->change_state = gst_gl_test_src_change_state;
 
   gstbasesrc_class->set_caps = gst_gl_test_src_setcaps;
+  gstbasesrc_class->get_caps = gst_gl_test_src_getcaps;
   gstbasesrc_class->is_seekable = gst_gl_test_src_is_seekable;
   gstbasesrc_class->do_seek = gst_gl_test_src_do_seek;
   gstbasesrc_class->query = gst_gl_test_src_query;
@@ -227,6 +228,97 @@
   return caps;
 }
 
+const gchar *snow_vertex_src = "attribute vec4 position; \
+    attribute vec2 uv; \
+    uniform mat4 mvp; \
+    varying vec2 out_uv; \
+    void main() \
+    { \
+       gl_Position = mvp * position; \
+       out_uv = uv; \
+    }";
+
+const gchar *snow_fragment_src = "uniform float time; \
+    varying vec2 out_uv; \
+    \
+    float rand(vec2 co){ \
+        return fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453); \
+    } \
+    void main() \
+    { \
+      gl_FragColor = rand(time * out_uv) * vec4(1); \
+    }";
+
+const gchar *mandelbrot_vertex_src = "attribute vec4 position; \
+    attribute vec2 uv; \
+    uniform mat4 mvp; \
+    uniform float aspect_ratio; \
+    varying vec2 fractal_position; \
+    \
+    void main() \
+    { \
+       gl_Position = mvp * position; \
+       fractal_position = vec2(uv.y - 0.8, aspect_ratio * (uv.x - 0.5)); \
+       fractal_position *= 2.5; \
+    }";
+
+const gchar *mandelbrot_fragment_src = "uniform float time; \
+    varying vec2 fractal_position; \
+    \
+    const vec4 K = vec4(1.0, 0.66, 0.33, 3.0); \
+    \
+    vec4 hsv_to_rgb(float hue, float saturation, float value) { \
+      vec4 p = abs(fract(vec4(hue) + K) * 6.0 - K.wwww); \
+      return value * mix(K.xxxx, clamp(p - K.xxxx, 0.0, 1.0), saturation); \
+    } \
+    \
+    vec4 i_to_rgb(int i) { \
+      float hue = float(i) / 100.0 + sin(time); \
+      return hsv_to_rgb(hue, 0.5, 0.8); \
+    } \
+    \
+    vec2 pow_2_complex(vec2 c) { \
+      return vec2(c.x*c.x - c.y*c.y, 2.0 * c.x * c.y); \
+    } \
+    \
+    vec2 mandelbrot(vec2 c, vec2 c0) { \
+      return pow_2_complex(c) + c0; \
+    } \
+    \
+    vec4 iterate_pixel(vec2 position) { \
+      vec2 c = vec2(0); \
+      for (int i=0; i < 100; i++) { \
+        if (c.x*c.x + c.y*c.y > 2.0*2.0) \
+          return i_to_rgb(i); \
+        c = mandelbrot(c, position); \
+      } \
+      return vec4(0, 0, 0, 1); \
+    } \
+    \
+    void main() { \
+      gl_FragColor = iterate_pixel(fractal_position); \
+    }";
+
+
+const gchar *checkers_vertex_src = "attribute vec4 position; \
+    uniform mat4 mvp; \
+    void main() \
+    { \
+       gl_Position = mvp * position; \
+    }";
+
+const gchar *checkers_fragment_src = "uniform float checker_width; \
+    void main() \
+    { \
+      vec2 xy_index= floor((gl_FragCoord.xy-vec2(0.5,0.5))/checker_width); \
+      vec2 xy_mod=mod(xy_index,vec2(2.0,2.0)); \
+      float result=mod(xy_mod.x+xy_mod.y,2.0); \
+      gl_FragColor.r=step(result,0.5); \
+      gl_FragColor.g=1.0-gl_FragColor.r; \
+      gl_FragColor.ba=vec2(0,1); \
+    }";
+
+
 static void
 gst_gl_test_src_set_pattern (GstGLTestSrc * gltestsrc, gint pattern_type)
 {
@@ -239,7 +331,9 @@
       gltestsrc->make_image = gst_gl_test_src_smpte;
       break;
     case GST_GL_TEST_SRC_SNOW:
-      gltestsrc->make_image = gst_gl_test_src_snow;
+      gltestsrc->vertex_src = snow_vertex_src;
+      gltestsrc->fragment_src = snow_fragment_src;
+      gltestsrc->make_image = gst_gl_test_src_shader;
       break;
     case GST_GL_TEST_SRC_BLACK:
       gltestsrc->make_image = gst_gl_test_src_black;
@@ -257,15 +351,23 @@
       gltestsrc->make_image = gst_gl_test_src_blue;
       break;
     case GST_GL_TEST_SRC_CHECKERS1:
+      gltestsrc->vertex_src = checkers_vertex_src;
+      gltestsrc->fragment_src = checkers_fragment_src;
       gltestsrc->make_image = gst_gl_test_src_checkers1;
       break;
     case GST_GL_TEST_SRC_CHECKERS2:
+      gltestsrc->vertex_src = checkers_vertex_src;
+      gltestsrc->fragment_src = checkers_fragment_src;
       gltestsrc->make_image = gst_gl_test_src_checkers2;
       break;
     case GST_GL_TEST_SRC_CHECKERS4:
+      gltestsrc->vertex_src = checkers_vertex_src;
+      gltestsrc->fragment_src = checkers_fragment_src;
       gltestsrc->make_image = gst_gl_test_src_checkers4;
       break;
     case GST_GL_TEST_SRC_CHECKERS8:
+      gltestsrc->vertex_src = checkers_vertex_src;
+      gltestsrc->fragment_src = checkers_fragment_src;
       gltestsrc->make_image = gst_gl_test_src_checkers8;
       break;
     case GST_GL_TEST_SRC_CIRCULAR:
@@ -274,12 +376,29 @@
     case GST_GL_TEST_SRC_BLINK:
       gltestsrc->make_image = gst_gl_test_src_black;
       break;
+    case GST_GL_TEST_SRC_MANDELBROT:
+      gltestsrc->vertex_src = mandelbrot_vertex_src;
+      gltestsrc->fragment_src = mandelbrot_fragment_src;
+      gltestsrc->make_image = gst_gl_test_src_shader;
+      break;
     default:
       g_assert_not_reached ();
   }
 }
 
 static void
+gst_gl_test_src_dispose (GObject * object)
+{
+  GstGLTestSrc *src = GST_GL_TEST_SRC (object);
+
+  if (src->other_context)
+    gst_object_unref (src->other_context);
+  src->other_context = NULL;
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
 gst_gl_test_src_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
@@ -346,12 +465,34 @@
   }
 }
 
+static GstCaps *
+gst_gl_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
+{
+  GstCaps *tmp = NULL;
+  GstCaps *result =
+      gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA");
+
+  if (filter) {
+    tmp = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (result);
+    result = tmp;
+  }
+
+  GST_DEBUG_OBJECT (bsrc, "returning caps: %" GST_PTR_FORMAT, result);
+
+  return result;
+}
+
 static void
 gst_gl_test_src_set_context (GstElement * element, GstContext * context)
 {
   GstGLTestSrc *src = GST_GL_TEST_SRC (element);
 
-  gst_gl_handle_set_context (element, context, &src->display);
+  gst_gl_handle_set_context (element, context, &src->display,
+      &src->other_context);
+
+  if (src->display)
+    gst_gl_display_filter_gl_api (src->display, SUPPORTED_GL_APIS);
 }
 
 static gboolean
@@ -365,8 +506,39 @@
   switch (GST_QUERY_TYPE (query)) {
     case GST_QUERY_CONTEXT:
     {
+      const gchar *context_type;
+      GstContext *context, *old_context;
+
       res = gst_gl_handle_context_query ((GstElement *) src, query,
-          &src->display);
+          &src->display, &src->other_context);
+      if (src->display)
+        gst_gl_display_filter_gl_api (src->display, SUPPORTED_GL_APIS);
+
+      gst_query_parse_context_type (query, &context_type);
+
+      if (g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
+        GstStructure *s;
+
+        gst_query_parse_context (query, &old_context);
+
+        if (old_context)
+          context = gst_context_copy (old_context);
+        else
+          context = gst_context_new ("gst.gl.local_context", FALSE);
+
+        s = gst_context_writable_structure (context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, src->context,
+            NULL);
+        gst_query_set_context (query, context);
+        gst_context_unref (context);
+
+        res = src->context != NULL;
+      }
+      GST_LOG_OBJECT (src, "context query of type %s %i", context_type, res);
+
+      if (res)
+        return res;
+
       break;
     }
     case GST_QUERY_CONVERT:
@@ -379,13 +551,14 @@
           gst_video_info_convert (&src->out_info, src_fmt, src_val, dest_fmt,
           &dest_val);
       gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
-      break;
+
+      return res;
     }
     default:
-      res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
+      break;
   }
 
-  return res;
+  return GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
 }
 
 static void
@@ -448,6 +621,19 @@
   return TRUE;
 }
 
+static gboolean
+gst_gl_test_src_init_shader (GstGLTestSrc * gltestsrc)
+{
+  if (gst_gl_context_get_gl_api (gltestsrc->context)) {
+    /* blocking call, wait until the opengl thread has compiled the shader */
+    if (gltestsrc->vertex_src == NULL)
+      return FALSE;
+    return gst_gl_context_gen_shader (gltestsrc->context, gltestsrc->vertex_src,
+        gltestsrc->fragment_src, &gltestsrc->shader);
+  }
+  return TRUE;
+}
+
 static GstFlowReturn
 gst_gl_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
 {
@@ -455,16 +641,8 @@
   GstClockTime next_time;
   gint width, height;
   GstVideoFrame out_frame;
+  GstGLSyncMeta *sync_meta;
   guint out_tex;
-  gboolean to_download =
-      gst_caps_features_is_equal (GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY,
-      gst_caps_get_features (src->out_caps, 0));
-  GstMapFlags out_map_flags = GST_MAP_WRITE;
-
-  to_download |= !gst_is_gl_memory (gst_buffer_peek_memory (buffer, 0));
-
-  if (!to_download)
-    out_map_flags |= GST_MAP_GL;
 
   if (G_UNLIKELY (!src->negotiated || !src->context))
     goto not_negotiated;
@@ -484,48 +662,27 @@
       src->make_image = gst_gl_test_src_black;
   }
 
-  if (!gst_video_frame_map (&out_frame, &src->out_info, buffer, out_map_flags)) {
+  if (!gst_video_frame_map (&out_frame, &src->out_info, buffer,
+          GST_MAP_WRITE | GST_MAP_GL)) {
     return GST_FLOW_NOT_NEGOTIATED;
   }
 
-  if (!to_download) {
-    out_tex = *(guint *) out_frame.data[0];
-  } else {
-    GST_INFO ("Output Buffer does not contain correct meta, "
-        "attempting to wrap for download");
-
-    if (!src->download)
-      src->download = gst_gl_download_new (src->context);
-
-    gst_gl_download_set_format (src->download, &out_frame.info);
-
-    if (!src->out_tex_id) {
-      gst_gl_context_gen_texture (src->context, &src->out_tex_id,
-          GST_VIDEO_FORMAT_RGBA, GST_VIDEO_FRAME_WIDTH (&out_frame),
-          GST_VIDEO_FRAME_HEIGHT (&out_frame));
-    }
-    out_tex = src->out_tex_id;
-  }
+  out_tex = *(guint *) out_frame.data[0];
 
   gst_buffer_replace (&src->buffer, buffer);
 
-  //blocking call, generate a FBO
   if (!gst_gl_context_use_fbo_v2 (src->context, width, height, src->fbo,
           src->depthbuffer, out_tex, gst_gl_test_src_callback,
           (gpointer) src)) {
     goto not_negotiated;
   }
 
-  if (to_download) {
-    if (!gst_gl_download_perform_with_data (src->download, out_tex,
-            out_frame.data)) {
-      GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("%s",
-              "Failed to init upload format"), (NULL));
-      return FALSE;
-    }
-  }
   gst_video_frame_unmap (&out_frame);
 
+  sync_meta = gst_buffer_get_gl_sync_meta (buffer);
+  if (sync_meta)
+    gst_gl_sync_meta_set_sync_point (sync_meta, src->context);
+
   GST_BUFFER_TIMESTAMP (buffer) = src->timestamp_offset + src->running_time;
   GST_BUFFER_OFFSET (buffer) = src->n_frames;
   src->n_frames++;
@@ -562,9 +719,11 @@
 {
   GstGLTestSrc *src = GST_GL_TEST_SRC (basesrc);
 
-  if (!gst_gl_ensure_display (src, &src->display))
+  if (!gst_gl_ensure_element_data (src, &src->display, &src->other_context))
     return FALSE;
 
+  gst_gl_display_filter_gl_api (src->display, SUPPORTED_GL_APIS);
+
   src->running_time = 0;
   src->n_frames = 0;
   src->negotiated = FALSE;
@@ -580,13 +739,9 @@
   gst_caps_replace (&src->out_caps, NULL);
 
   if (src->context) {
-    if (src->out_tex_id) {
-      gst_gl_context_del_texture (src->context, &src->out_tex_id);
-    }
-
-    if (src->download) {
-      gst_object_unref (src->download);
-      src->download = NULL;
+    if (src->shader) {
+      gst_object_unref (src->shader);
+      src->shader = NULL;
     }
     //blocking call, delete the FBO
     gst_gl_context_del_fbo (src->context, src->fbo, src->depthbuffer);
@@ -603,6 +758,45 @@
 }
 
 static gboolean
+_find_local_gl_context (GstGLTestSrc * src)
+{
+  GstQuery *query;
+  GstContext *context;
+  const GstStructure *s;
+
+  if (src->context)
+    return TRUE;
+
+  query = gst_query_new_context ("gst.gl.local_context");
+  if (!src->context && gst_gl_run_query (GST_ELEMENT (src), query, GST_PAD_SRC)) {
+    gst_query_parse_context (query, &context);
+    if (context) {
+      s = gst_context_get_structure (context);
+      gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &src->context,
+          NULL);
+    }
+  }
+  if (!src->context
+      && gst_gl_run_query (GST_ELEMENT (src), query, GST_PAD_SINK)) {
+    gst_query_parse_context (query, &context);
+    if (context) {
+      s = gst_context_get_structure (context);
+      gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &src->context,
+          NULL);
+    }
+  }
+
+  GST_DEBUG_OBJECT (src, "found local context %p", src->context);
+
+  gst_query_unref (query);
+
+  if (src->context)
+    return TRUE;
+
+  return FALSE;
+}
+
+static gboolean
 gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query)
 {
   GstGLTestSrc *src = GST_GL_TEST_SRC (basesrc);
@@ -612,55 +806,28 @@
   guint min, max, size;
   gboolean update_pool;
   GError *error = NULL;
-  guint idx;
   guint out_width, out_height;
-  GstGLContext *other_context = NULL;
 
-  if (!gst_gl_ensure_display (src, &src->display))
+  if (!gst_gl_ensure_element_data (src, &src->display, &src->other_context))
     return FALSE;
 
-  if (gst_query_find_allocation_meta (query,
-          GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx)) {
-    GstGLContext *context;
-    const GstStructure *upload_meta_params;
-    gpointer handle;
-    gchar *type;
-    gchar *apis;
+  gst_gl_display_filter_gl_api (src->display, SUPPORTED_GL_APIS);
 
-    gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params);
-    if (upload_meta_params) {
-      if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext",
-              GST_GL_TYPE_CONTEXT, &context, NULL) && context) {
-        GstGLContext *old = src->context;
-
-        src->context = context;
-        if (old)
-          gst_object_unref (old);
-      } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle",
-              G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING,
-              &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL)
-          && handle) {
-        GstGLPlatform platform = GST_GL_PLATFORM_NONE;
-        GstGLAPI gl_apis;
-
-        GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s",
-            handle, type, apis);
-
-        platform = gst_gl_platform_from_string (type);
-        gl_apis = gst_gl_api_from_string (apis);
-
-        if (gl_apis && platform)
-          other_context =
-              gst_gl_context_new_wrapped (src->display, (guintptr) handle,
-              platform, gl_apis);
-      }
-    }
-  }
+  _find_local_gl_context (src);
 
   if (!src->context) {
-    src->context = gst_gl_context_new (src->display);
-    if (!gst_gl_context_create (src->context, other_context, &error))
-      goto context_error;
+    do {
+      if (src->context)
+        gst_object_unref (src->context);
+      /* just get a GL context.  we don't care */
+      src->context =
+          gst_gl_display_get_gl_context_for_thread (src->display, NULL);
+      if (!src->context) {
+        src->context = gst_gl_context_new (src->display);
+        if (!gst_gl_context_create (src->context, src->other_context, &error))
+          goto context_error;
+      }
+    } while (!gst_gl_display_add_context (src->display, src->context));
   }
 
   out_width = GST_VIDEO_INFO_WIDTH (&src->out_info);
@@ -686,12 +853,22 @@
     update_pool = FALSE;
   }
 
-  if (!pool)
+  if (!pool || !GST_IS_GL_BUFFER_POOL (pool)) {
+    /* can't use this pool */
+    if (pool)
+      gst_object_unref (pool);
     pool = gst_gl_buffer_pool_new (src->context);
-
+  }
   config = gst_buffer_pool_get_config (pool);
+
   gst_buffer_pool_config_set_params (config, caps, size, min, max);
   gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
+  if (gst_query_find_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL))
+    gst_buffer_pool_config_add_option (config,
+        GST_BUFFER_POOL_OPTION_GL_SYNC_META);
+  gst_buffer_pool_config_add_option (config,
+      GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META);
+
   gst_buffer_pool_set_config (pool, config);
 
   if (update_pool)
@@ -699,6 +876,8 @@
   else
     gst_query_add_allocation_pool (query, pool, size, min, max);
 
+  gst_gl_test_src_init_shader (src);
+
   gst_object_unref (pool);
 
   return TRUE;
@@ -725,3 +904,37 @@
   gst_buffer_unref (src->buffer);
   src->buffer = NULL;
 }
+
+static GstStateChangeReturn
+gst_gl_test_src_change_state (GstElement * element, GstStateChange transition)
+{
+  GstGLTestSrc *src = GST_GL_TEST_SRC (element);
+  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+
+  GST_DEBUG_OBJECT (src, "changing state: %s => %s",
+      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
+      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!gst_gl_ensure_element_data (element, &src->display,
+              &src->other_context))
+        return GST_STATE_CHANGE_FAILURE;
+
+      gst_gl_display_filter_gl_api (src->display, SUPPORTED_GL_APIS);
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    default:
+      break;
+  }
+
+  return ret;
+}
diff --git a/ext/gl/gstgltestsrc.h b/ext/gl/gstgltestsrc.h
index 73f9f34..1c045c7 100644
--- a/ext/gl/gstgltestsrc.h
+++ b/ext/gl/gstgltestsrc.h
@@ -72,7 +72,8 @@
     GST_GL_TEST_SRC_CHECKERS4,
     GST_GL_TEST_SRC_CHECKERS8,
     GST_GL_TEST_SRC_CIRCULAR,
-    GST_GL_TEST_SRC_BLINK
+    GST_GL_TEST_SRC_BLINK,
+    GST_GL_TEST_SRC_MANDELBROT
 } GstGLTestSrcPattern;
 
 typedef struct _GstGLTestSrc GstGLTestSrc;
@@ -98,19 +99,21 @@
     GLuint fbo;
     GLuint depthbuffer;
 
+    GstGLShader *shader;
+
     GstBuffer* buffer;
     GstBufferPool *pool;
 
-    guint out_tex_id;
-    GstGLDownload *download;
-
     GstGLDisplay *display;
-    GstGLContext *context;
+    GstGLContext *context, *other_context;
     gint64 timestamp_offset;              /* base offset */
     GstClockTime running_time;            /* total running time */
     gint64 n_frames;                      /* total frames sent */
     gboolean negotiated;
 
+    const gchar *vertex_src;
+    const gchar *fragment_src;
+
     void (*make_image) (GstGLTestSrc* v, GstBuffer* buffer, gint w, gint h);
 
     GstCaps *out_caps;
diff --git a/ext/gl/gstgltransformation.c b/ext/gl/gstgltransformation.c
index 0da8860..f9273c7 100644
--- a/ext/gl/gstgltransformation.c
+++ b/ext/gl/gstgltransformation.c
@@ -44,16 +44,18 @@
 #include "config.h"
 #endif
 
-#include <gst/gl/gstglapi.h>
 #include "gstgltransformation.h"
 
+#include <gst/gl/gstglapi.h>
+#include <graphene-gobject.h>
+
 #define GST_CAT_DEFAULT gst_gl_transformation_debug
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
 
 enum
 {
   PROP_0,
-  PROP_FOVY,
+  PROP_FOV,
   PROP_ORTHO,
   PROP_TRANSLATION_X,
   PROP_TRANSLATION_Y,
@@ -62,7 +64,8 @@
   PROP_ROTATION_Y,
   PROP_ROTATION_Z,
   PROP_SCALE_X,
-  PROP_SCALE_Y
+  PROP_SCALE_Y,
+  PROP_MVP
 };
 
 #define DEBUG_INIT \
@@ -79,6 +82,7 @@
 static gboolean gst_gl_transformation_set_caps (GstGLFilter * filter,
     GstCaps * incaps, GstCaps * outcaps);
 
+static void gst_gl_transformation_reset_gl (GstGLFilter * filter);
 static void gst_gl_transformation_reset (GstGLFilter * filter);
 static gboolean gst_gl_transformation_init_shader (GstGLFilter * filter);
 static void gst_gl_transformation_callback (gpointer stuff);
@@ -125,13 +129,15 @@
   gobject_class->get_property = gst_gl_transformation_get_property;
 
   GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_transformation_init_shader;
+  GST_GL_FILTER_CLASS (klass)->display_reset_cb =
+      gst_gl_transformation_reset_gl;
   GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_transformation_reset;
   GST_GL_FILTER_CLASS (klass)->set_caps = gst_gl_transformation_set_caps;
   GST_GL_FILTER_CLASS (klass)->filter_texture =
       gst_gl_transformation_filter_texture;
 
-  g_object_class_install_property (gobject_class, PROP_FOVY,
-      g_param_spec_float ("fovy", "Fovy", "Field of view angle in degrees",
+  g_object_class_install_property (gobject_class, PROP_FOV,
+      g_param_spec_float ("fov", "Fov", "Field of view angle in degrees",
           0.0, G_MAXFLOAT, 90.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_ORTHO,
@@ -161,44 +167,54 @@
   /* Translation */
   g_object_class_install_property (gobject_class, PROP_TRANSLATION_X,
       g_param_spec_float ("translation-x", "X Translation",
-          "Translates the video at the X-Axis.",
+          "Translates the video at the X-Axis, in universal [0-1] coordinate.",
           -G_MAXFLOAT, G_MAXFLOAT, 0.0,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_TRANSLATION_Y,
       g_param_spec_float ("translation-y", "Y Translation",
-          "Translates the video at the Y-Axis.",
+          "Translates the video at the Y-Axis, in universal [0-1] coordinate.",
           -G_MAXFLOAT, G_MAXFLOAT, 0.0,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_TRANSLATION_Z,
       g_param_spec_float ("translation-z", "Z Translation",
-          "Translates the video at the Z-Axis.",
+          "Translates the video at the Z-Axis, in universal [0-1] coordinate.",
           -G_MAXFLOAT, G_MAXFLOAT, 0.0,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /* Scale */
   g_object_class_install_property (gobject_class, PROP_SCALE_X,
       g_param_spec_float ("scale-x", "X Scale",
-          "Scale multiplierer for the X-Axis.",
+          "Scale multiplier for the X-Axis.",
           0.0, G_MAXFLOAT, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_SCALE_Y,
       g_param_spec_float ("scale-y", "Y Scale",
-          "Scale multiplierer for the Y-Axis.",
+          "Scale multiplier for the Y-Axis.",
           0.0, G_MAXFLOAT, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  /* MVP */
+  g_object_class_install_property (gobject_class, PROP_MVP,
+      g_param_spec_boxed ("mvp-matrix",
+          "Modelview Projection Matrix",
+          "The final Graphene 4x4 Matrix for transformation",
+          GRAPHENE_TYPE_MATRIX, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
   gst_element_class_set_metadata (element_class, "OpenGL transformation filter",
       "Filter/Effect/Video", "Transform video on the GPU",
       "Lubosz Sarnecki <lubosz@gmail.com>");
+
+  GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
 }
 
 static void
 gst_gl_transformation_init (GstGLTransformation * filter)
 {
   filter->shader = NULL;
-  filter->fovy = 90;
-  filter->aspect = 0;
+  filter->fov = 90;
+  filter->aspect = 1.0;
   filter->znear = 0.1;
   filter->zfar = 100;
 
@@ -214,9 +230,10 @@
 gst_gl_transformation_build_mvp (GstGLTransformation * transformation)
 {
   graphene_point3d_t translation_vector =
-      GRAPHENE_POINT3D_INIT (transformation->xtranslation,
-      transformation->ytranslation,
-      transformation->ztranslation);
+      GRAPHENE_POINT3D_INIT (transformation->xtranslation * 2.0 *
+      transformation->aspect,
+      transformation->ytranslation * 2.0,
+      transformation->ztranslation * 2.0);
 
   graphene_matrix_t model_matrix;
   graphene_matrix_t projection_matrix;
@@ -231,14 +248,16 @@
   graphene_vec3_init (&center, 0.f, 0.f, 0.f);
   graphene_vec3_init (&up, 0.f, 1.f, 0.f);
 
-  graphene_matrix_init_rotate (&model_matrix,
+  graphene_matrix_init_scale (&model_matrix,
+      transformation->xscale, transformation->yscale, 1.0f);
+
+  graphene_matrix_rotate (&model_matrix,
       transformation->xrotation, graphene_vec3_x_axis ());
   graphene_matrix_rotate (&model_matrix,
       transformation->yrotation, graphene_vec3_y_axis ());
   graphene_matrix_rotate (&model_matrix,
       transformation->zrotation, graphene_vec3_z_axis ());
-  graphene_matrix_scale (&model_matrix,
-      transformation->xscale, transformation->yscale, 1.0f);
+
   graphene_matrix_translate (&model_matrix, &translation_vector);
 
   if (transformation->ortho) {
@@ -247,7 +266,7 @@
         -1, 1, transformation->znear, transformation->zfar);
   } else {
     graphene_matrix_init_perspective (&projection_matrix,
-        transformation->fovy,
+        transformation->fov,
         transformation->aspect, transformation->znear, transformation->zfar);
   }
 
@@ -265,8 +284,8 @@
   GstGLTransformation *filter = GST_GL_TRANSFORMATION (object);
 
   switch (prop_id) {
-    case PROP_FOVY:
-      filter->fovy = g_value_get_float (value);
+    case PROP_FOV:
+      filter->fov = g_value_get_float (value);
       break;
     case PROP_ORTHO:
       filter->ortho = g_value_get_boolean (value);
@@ -295,6 +314,11 @@
     case PROP_SCALE_Y:
       filter->yscale = g_value_get_float (value);
       break;
+    case PROP_MVP:
+      if (g_value_get_boxed (value) != NULL)
+        filter->mvp_matrix = *((graphene_matrix_t *) g_value_get_boxed (value));
+      return;
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -309,8 +333,8 @@
   GstGLTransformation *filter = GST_GL_TRANSFORMATION (object);
 
   switch (prop_id) {
-    case PROP_FOVY:
-      g_value_set_float (value, filter->fovy);
+    case PROP_FOV:
+      g_value_set_float (value, filter->fov);
       break;
     case PROP_ORTHO:
       g_value_set_boolean (value, filter->ortho);
@@ -339,6 +363,9 @@
     case PROP_SCALE_Y:
       g_value_set_float (value, filter->yscale);
       break;
+    case PROP_MVP:
+      g_value_set_boxed (value, (gconstpointer) & filter->mvp_matrix);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -355,19 +382,39 @@
       (gdouble) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
       (gdouble) GST_VIDEO_INFO_HEIGHT (&filter->out_info);
 
+  transformation->caps_change = TRUE;
+
   gst_gl_transformation_build_mvp (transformation);
 
   return TRUE;
 }
 
 static void
+gst_gl_transformation_reset_gl (GstGLFilter * filter)
+{
+  GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
+  const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
+
+  if (transformation->vao) {
+    gl->DeleteVertexArrays (1, &transformation->vao);
+    transformation->vao = 0;
+  }
+
+  if (transformation->vertex_buffer) {
+    gl->DeleteBuffers (1, &transformation->vertex_buffer);
+    transformation->vertex_buffer = 0;
+  }
+}
+
+static void
 gst_gl_transformation_reset (GstGLFilter * filter)
 {
   GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
 
   /* blocking call, wait until the opengl thread has destroyed the shader */
   if (transformation->shader)
-    gst_gl_context_del_shader (filter->context, transformation->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
+        transformation->shader);
   transformation->shader = NULL;
 }
 
@@ -376,10 +423,10 @@
 {
   GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
 
-  if (gst_gl_context_get_gl_api (filter->context)) {
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context)) {
     /* blocking call, wait until the opengl thread has compiled the shader */
-    return gst_gl_context_gen_shader (filter->context, cube_v_src, cube_f_src,
-        &transformation->shader);
+    return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+        cube_v_src, cube_f_src, &transformation->shader);
   }
   return TRUE;
 }
@@ -393,7 +440,7 @@
   transformation->in_tex = in_tex;
 
   /* blocking call, use a FBO */
-  gst_gl_context_use_fbo_v2 (filter->context,
+  gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (filter)->context,
       GST_VIDEO_INFO_WIDTH (&filter->out_info),
       GST_VIDEO_INFO_HEIGHT (&filter->out_info),
       filter->fbo, filter->depthbuffer,
@@ -402,63 +449,79 @@
   return TRUE;
 }
 
+
+static void
+_upload_vertices (GstGLTransformation * transformation)
+{
+  const GstGLFuncs *gl =
+      GST_GL_BASE_FILTER (transformation)->context->gl_vtable;
+
+/* *INDENT-OFF* */
+  GLfloat vertices[] = {
+     -transformation->aspect,  1.0,  0.0, 1.0, 0.0, 1.0,
+      transformation->aspect,  1.0,  0.0, 1.0, 1.0, 1.0,
+      transformation->aspect, -1.0,  0.0, 1.0, 1.0, 0.0,
+     -transformation->aspect, -1.0,  0.0, 1.0, 0.0, 0.0
+  };
+  /* *INDENT-ON* */
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, transformation->vertex_buffer);
+
+  gl->BufferData (GL_ARRAY_BUFFER, 4 * 6 * sizeof (GLfloat), vertices,
+      GL_STATIC_DRAW);
+}
+
+static void
+_bind_buffer (GstGLTransformation * transformation)
+{
+  const GstGLFuncs *gl =
+      GST_GL_BASE_FILTER (transformation)->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, transformation->vertex_buffer);
+
+  /* Load the vertex position */
+  gl->VertexAttribPointer (transformation->attr_position, 4, GL_FLOAT,
+      GL_FALSE, 6 * sizeof (GLfloat), (void *) 0);
+
+  /* Load the texture coordinate */
+  gl->VertexAttribPointer (transformation->attr_texture, 2, GL_FLOAT, GL_FALSE,
+      6 * sizeof (GLfloat), (void *) (4 * sizeof (GLfloat)));
+
+  gl->EnableVertexAttribArray (transformation->attr_position);
+  gl->EnableVertexAttribArray (transformation->attr_texture);
+}
+
+static void
+_unbind_buffer (GstGLTransformation * transformation)
+{
+  const GstGLFuncs *gl =
+      GST_GL_BASE_FILTER (transformation)->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  gl->DisableVertexAttribArray (transformation->attr_position);
+  gl->DisableVertexAttribArray (transformation->attr_texture);
+}
+
 static void
 gst_gl_transformation_callback (gpointer stuff)
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
   GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
-  GstGLFuncs *gl = filter->context->gl_vtable;
-
-/* *INDENT-OFF* */
-
-  const GLfloat positions[] = {
-     -transformation->aspect,  1.0,  0.0, 1.0,
-      transformation->aspect,  1.0,  0.0, 1.0,
-      transformation->aspect, -1.0,  0.0, 1.0,
-     -transformation->aspect, -1.0,  0.0, 1.0,
-  };
-
-  const GLfloat texture_coordinates[] = {
-     0.0,  1.0,
-     1.0,  1.0,
-     1.0,  0.0,
-     0.0,  0.0,
-  };
-
-/* *INDENT-ON* */
+  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
 
   GLushort indices[] = { 0, 1, 2, 3, 0 };
 
   GLfloat temp_matrix[16];
 
-  GLint attr_position_loc = 0;
-  GLint attr_texture_loc = 0;
-
-  gst_gl_context_clear_shader (filter->context);
+  gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
   gl->BindTexture (GL_TEXTURE_2D, 0);
 
-  gl->ClearColor (0.f, 0.f, 0.f, 0.f);
+  gl->ClearColor (0.f, 0.f, 0.f, 1.f);
   gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
   gst_gl_shader_use (transformation->shader);
 
-  attr_position_loc =
-      gst_gl_shader_get_attribute_location (transformation->shader, "position");
-
-  attr_texture_loc =
-      gst_gl_shader_get_attribute_location (transformation->shader, "uv");
-
-  /* Load the vertex position */
-  gl->VertexAttribPointer (attr_position_loc, 4, GL_FLOAT,
-      GL_FALSE, 0, positions);
-
-  /* Load the texture coordinate */
-  gl->VertexAttribPointer (attr_texture_loc, 2, GL_FLOAT,
-      GL_FALSE, 0, texture_coordinates);
-
-  gl->EnableVertexAttribArray (attr_position_loc);
-  gl->EnableVertexAttribArray (attr_texture_loc);
-
   gl->ActiveTexture (GL_TEXTURE0);
   gl->BindTexture (GL_TEXTURE_2D, transformation->in_tex);
   gst_gl_shader_set_uniform_1i (transformation->shader, "texture", 0);
@@ -467,10 +530,43 @@
   gst_gl_shader_set_uniform_matrix_4fv (transformation->shader, "mvp",
       1, GL_FALSE, temp_matrix);
 
+  if (!transformation->vertex_buffer) {
+    transformation->attr_position =
+        gst_gl_shader_get_attribute_location (transformation->shader,
+        "position");
+
+    transformation->attr_texture =
+        gst_gl_shader_get_attribute_location (transformation->shader, "uv");
+
+    if (gl->GenVertexArrays) {
+      gl->GenVertexArrays (1, &transformation->vao);
+      gl->BindVertexArray (transformation->vao);
+    }
+
+    gl->GenBuffers (1, &transformation->vertex_buffer);
+    transformation->caps_change = TRUE;
+  }
+
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (transformation->vao);
+
+  if (transformation->caps_change) {
+    _upload_vertices (transformation);
+    _bind_buffer (transformation);
+
+    if (gl->GenVertexArrays)
+      gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+  } else if (!gl->GenVertexArrays) {
+    _bind_buffer (transformation);
+  }
+
   gl->DrawElements (GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, indices);
 
-  gl->DisableVertexAttribArray (attr_position_loc);
-  gl->DisableVertexAttribArray (attr_texture_loc);
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (0);
+  else
+    _unbind_buffer (transformation);
 
-  gst_gl_context_clear_shader (filter->context);
+  gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
+  transformation->caps_change = FALSE;
 }
diff --git a/ext/gl/gstgltransformation.h b/ext/gl/gstgltransformation.h
index 05145fb..5b02014 100644
--- a/ext/gl/gstgltransformation.h
+++ b/ext/gl/gstgltransformation.h
@@ -22,7 +22,7 @@
 #define _GST_GL_TRANSFORMATION_H_
 
 #include <gst/gl/gstglfilter.h>
-#include <graphene-1.0/graphene.h>
+#include <graphene.h>
 
 G_BEGIN_DECLS
 
@@ -41,6 +41,10 @@
     GstGLFilter filter;
 
     GstGLShader *shader;
+    GLuint       vao;
+    GLuint       vertex_buffer;
+    GLint        attr_position;
+    GLint        attr_texture;
 
     guint in_tex;
 
@@ -56,13 +60,15 @@
     gfloat ztranslation;
 
     /* perspective */
-    gfloat fovy;
+    gfloat fov;
     gfloat aspect;
     gfloat znear;
     gfloat zfar;
     gboolean ortho;
 
     graphene_matrix_t mvp_matrix;
+
+    gboolean caps_change;
 };
 
 struct _GstGLTransformationClass
diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c
new file mode 100644
index 0000000..a8971d8
--- /dev/null
+++ b/ext/gl/gstgluploadelement.c
@@ -0,0 +1,251 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+
+#include <gst/gl/gl.h>
+#include "gstgluploadelement.h"
+
+#if GST_GL_HAVE_PLATFORM_EGL
+#include <gst/gl/egl/gsteglimagememory.h>
+#endif
+
+#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
+#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
+#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
+#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
+#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
+
+GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_element_debug);
+#define GST_CAT_DEFAULT gst_gl_upload_element_debug
+
+#define gst_gl_upload_element_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGLUploadElement, gst_gl_upload_element,
+    GST_TYPE_GL_BASE_FILTER,
+    GST_DEBUG_CATEGORY_INIT (gst_gl_upload_element_debug, "gluploadelement", 0,
+        "glupload Element");
+    );
+static void gst_gl_upload_element_finalize (GObject * object);
+
+static gboolean gst_gl_upload_element_get_unit_size (GstBaseTransform * trans,
+    GstCaps * caps, gsize * size);
+static gboolean gst_gl_upload_element_query (GstBaseTransform * bt,
+    GstPadDirection direction, GstQuery * query);
+static GstCaps *_gst_gl_upload_element_transform_caps (GstBaseTransform * bt,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter);
+static gboolean _gst_gl_upload_element_set_caps (GstBaseTransform * bt,
+    GstCaps * in_caps, GstCaps * out_caps);
+static gboolean _gst_gl_upload_element_propose_allocation (GstBaseTransform *
+    bt, GstQuery * decide_query, GstQuery * query);
+static gboolean _gst_gl_upload_element_decide_allocation (GstBaseTransform *
+    trans, GstQuery * query);
+static GstFlowReturn
+gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
+    GstBuffer * buffer, GstBuffer ** outbuf);
+static GstFlowReturn gst_gl_upload_element_transform (GstBaseTransform * bt,
+    GstBuffer * buffer, GstBuffer * outbuf);
+
+static GstStaticPadTemplate gst_gl_upload_element_src_pad_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(ANY)"));
+
+static GstStaticPadTemplate gst_gl_upload_element_sink_pad_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw(ANY)"));
+
+static void
+gst_gl_upload_element_class_init (GstGLUploadElementClass * klass)
+{
+  GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  bt_class->query = gst_gl_upload_element_query;
+  bt_class->transform_caps = _gst_gl_upload_element_transform_caps;
+  bt_class->set_caps = _gst_gl_upload_element_set_caps;
+  bt_class->propose_allocation = _gst_gl_upload_element_propose_allocation;
+  bt_class->decide_allocation = _gst_gl_upload_element_decide_allocation;
+  bt_class->get_unit_size = gst_gl_upload_element_get_unit_size;
+  bt_class->prepare_output_buffer = gst_gl_upload_element_prepare_output_buffer;
+  bt_class->transform = gst_gl_upload_element_transform;
+
+  bt_class->passthrough_on_same_caps = TRUE;
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_gl_upload_element_src_pad_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_gl_upload_element_sink_pad_template));
+
+  gst_element_class_set_metadata (element_class,
+      "OpenGL uploader", "Filter/Video",
+      "Uploads data into OpenGL", "Matthew Waters <matthew@centricular.com>");
+
+  G_OBJECT_CLASS (klass)->finalize = gst_gl_upload_element_finalize;
+}
+
+static void
+gst_gl_upload_element_init (GstGLUploadElement * upload)
+{
+  gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (upload), TRUE);
+}
+
+static void
+gst_gl_upload_element_finalize (GObject * object)
+{
+  GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (object);
+
+  if (upload->upload) {
+    gst_object_unref (upload->upload);
+    upload->upload = NULL;
+  }
+
+  gst_caps_replace (&upload->in_caps, NULL);
+  gst_caps_replace (&upload->out_caps, NULL);
+
+  G_OBJECT_CLASS (gst_gl_upload_element_parent_class)->finalize (object);
+}
+
+static gboolean
+gst_gl_upload_element_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
+    gsize * size)
+{
+  gboolean ret = FALSE;
+  GstVideoInfo info;
+
+  ret = gst_video_info_from_caps (&info, caps);
+  if (ret)
+    *size = GST_VIDEO_INFO_SIZE (&info);
+
+  return TRUE;
+}
+
+static GstCaps *
+_gst_gl_upload_element_transform_caps (GstBaseTransform * bt,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
+{
+  GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
+
+  return gst_gl_upload_transform_caps (context, direction, caps, filter);
+}
+
+static gboolean
+_gst_gl_upload_element_propose_allocation (GstBaseTransform * bt,
+    GstQuery * decide_query, GstQuery * query)
+{
+  GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt);
+
+  gst_gl_upload_propose_allocation (upload->upload, decide_query, query);
+
+  return TRUE;
+}
+
+static gboolean
+_gst_gl_upload_element_decide_allocation (GstBaseTransform * trans,
+    GstQuery * query)
+{
+  GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (trans);
+  GstGLContext *context;
+  gboolean ret;
+
+  ret =
+      GST_BASE_TRANSFORM_CLASS
+      (gst_gl_upload_element_parent_class)->decide_allocation (trans, query);
+  if (!ret)
+    return FALSE;
+
+  context = GST_GL_BASE_FILTER (trans)->context;
+
+  if (!upload->upload)
+    upload->upload = gst_gl_upload_new (context);
+
+  return gst_gl_upload_set_caps (upload->upload, upload->in_caps,
+      upload->out_caps);
+}
+
+static gboolean
+_gst_gl_upload_element_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
+    GstCaps * out_caps)
+{
+  GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt);
+
+  gst_caps_replace (&upload->in_caps, in_caps);
+  gst_caps_replace (&upload->out_caps, out_caps);
+
+  if (upload->upload)
+    return gst_gl_upload_set_caps (upload->upload, in_caps, out_caps);
+
+  return TRUE;
+}
+
+static gboolean
+gst_gl_upload_element_query (GstBaseTransform * bt, GstPadDirection direction,
+    GstQuery * query)
+{
+  GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt);
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_DRAIN:
+      if (upload->upload)
+        gst_gl_upload_release_buffer (upload->upload);
+      break;
+    default:
+      break;
+  }
+
+  return GST_BASE_TRANSFORM_CLASS (parent_class)->query (bt, direction, query);
+}
+
+GstFlowReturn
+gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
+    GstBuffer * buffer, GstBuffer ** outbuf)
+{
+  GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt);
+  GstGLUploadReturn ret;
+
+  if (gst_base_transform_is_passthrough (bt)) {
+    *outbuf = buffer;
+    return GST_FLOW_OK;
+  }
+
+  if (!upload->upload)
+    return GST_FLOW_NOT_NEGOTIATED;
+
+  ret = gst_gl_upload_perform_with_buffer (upload->upload, buffer, outbuf);
+
+  /* basetransform doesn't unref if they're the same */
+  if (buffer == *outbuf)
+    gst_buffer_unref (*outbuf);
+
+  return ret == GST_GL_UPLOAD_DONE ? GST_FLOW_OK : GST_FLOW_ERROR;
+}
+
+static GstFlowReturn
+gst_gl_upload_element_transform (GstBaseTransform * bt, GstBuffer * buffer,
+    GstBuffer * outbuf)
+{
+  return GST_FLOW_OK;
+}
diff --git a/ext/gl/gstgluploadelement.h b/ext/gl/gstgluploadelement.h
new file mode 100644
index 0000000..615773c
--- /dev/null
+++ b/ext/gl/gstgluploadelement.h
@@ -0,0 +1,69 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_UPLOAD_ELEMENT_H__
+#define __GST_GL_UPLOAD_ELEMENT_H__
+
+#include <gst/video/video.h>
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_upload_element_get_type (void);
+#define GST_TYPE_GL_UPLOAD_ELEMENT (gst_gl_upload_element_get_type())
+#define GST_GL_UPLOAD_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_UPLOAD_ELEMENT,GstGLUploadElement))
+#define GST_GL_UPLOAD_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_UPLOAD_ELEMENT,GstGLUploadElementClass))
+#define GST_IS_GL_UPLOAD_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_UPLOAD_ELEMENT))
+#define GST_IS_GL_UPLOAD_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_UPLOAD_ELEMENT))
+#define GST_GL_UPLOAD_ELEMENT_CAST(obj) ((GstGLUploadElement*)(obj))
+
+typedef struct _GstGLUploadElement GstGLUploadElement;
+typedef struct _GstGLUploadElementClass GstGLUploadElementClass;
+typedef struct _GstGLUploadElementPrivate GstGLUploadElementPrivate;
+
+/**
+ * GstGLUploadElement
+ *
+ * Opaque #GstGLUploadElement object
+ */
+struct _GstGLUploadElement
+{
+  /* <private> */
+  GstGLBaseFilter     parent;
+
+  GstGLUpload *upload;
+  GstCaps *in_caps;
+  GstCaps *out_caps;
+};
+
+/**
+ * GstGLUploadElementClass:
+ *
+ * The #GstGLUploadElementClass struct only contains private data
+ */
+struct _GstGLUploadElementClass
+{
+  GstGLBaseFilterClass object_class;
+};
+
+G_END_DECLS
+
+#endif /* __GST_GL_UPLOAD_ELEMENT_H__ */
diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c
index 22e9b7f..c399e92 100644
--- a/ext/gl/gstglvideomixer.c
+++ b/ext/gl/gstglvideomixer.c
@@ -21,17 +21,21 @@
 /**
  * SECTION:element-glvideomixer
  *
- * glmixer sub element. N gl sink pads to 1 source pad.
- * N + 1 OpenGL contexts shared together.
- * N <= 6 because the rendering is more a like a cube than a video_mixer
- * Each opengl input stream is rendered on a cube face
+ * Composites a number of streams into a single output scene using OpenGL in
+ * a similar fashion to compositor and videomixer. See the compositor plugin
+ * for documentation about the #GstGLVideoMixerPad properties.
  *
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch-0.10 videotestsrc ! "video/x-raw-yuv, format=(fourcc)YUY2" ! glupload ! queue ! glvideomixer name=m ! glimagesink videotestsrc pattern=12 ! "video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)5/1, width=100, height=200" ! glupload ! queue ! m. videotestsrc ! "video/x-raw-rgb, framerate=(fraction)15/1, width=1500, height=1500" ! glupload ! gleffects effect=3 ! queue ! m. videotestsrc ! glupload ! gleffects effect=2 ! queue ! m.  videotestsrc ! glupload ! glfiltercube ! queue ! m. videotestsrc ! glupload ! gleffects effect=6 ! queue ! m.
+ * gst-launch-1.0  glvideomixer name=m ! glimagesink \
+ *     videotestsrc ! video/x-raw, format=YUY2 ! m. \
+ *     videotestsrc pattern=12 ! video/x-raw, format=I420, framerate=5/1, width=100, height=200 ! queue ! m. \
+ *     videotestsrc ! video/x-raw, format=RGB, framerate=15/1, width=1500, height=1500 ! gleffects effect=3 ! queue ! m. \
+ *     videotestsrc ! gleffects effect=2 ! queue ! m.  \
+ *     videotestsrc ! glfiltercube ! queue ! m. \
+ *     videotestsrc ! gleffects effect=6 ! queue ! m.
  * ]|
- * FBO (Frame Buffer Object) is required.
  * </refsect2>
  */
 
@@ -40,13 +44,272 @@
 #endif
 
 #include "gstglvideomixer.h"
+#include "gstglmixerbin.h"
 
 #define GST_CAT_DEFAULT gst_gl_video_mixer_debug
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
 
+#define GST_GL_TYPE_VIDEO_MIXER_BACKGROUND (gst_gl_video_mixer_background_get_type())
+static GType
+gst_gl_video_mixer_background_get_type (void)
+{
+  static GType mixer_background_type = 0;
+
+  static const GEnumValue mixer_background[] = {
+    {GST_GL_VIDEO_MIXER_BACKGROUND_CHECKER, "Checker pattern", "checker"},
+    {GST_GL_VIDEO_MIXER_BACKGROUND_BLACK, "Black", "black"},
+    {GST_GL_VIDEO_MIXER_BACKGROUND_WHITE, "White", "white"},
+    {GST_GL_VIDEO_MIXER_BACKGROUND_TRANSPARENT,
+        "Transparent Background to enable further compositing", "transparent"},
+    {0, NULL, NULL},
+  };
+
+  if (!mixer_background_type) {
+    mixer_background_type =
+        g_enum_register_static ("GstGLVideoMixerBackground", mixer_background);
+  }
+  return mixer_background_type;
+}
+
+#define DEFAULT_PAD_XPOS   0
+#define DEFAULT_PAD_YPOS   0
+#define DEFAULT_PAD_WIDTH  0
+#define DEFAULT_PAD_HEIGHT 0
+#define DEFAULT_PAD_ALPHA  1.0
+#define DEFAULT_PAD_ZORDER 0
+
+enum
+{
+  PROP_INPUT_0,
+  PROP_INPUT_XPOS,
+  PROP_INPUT_YPOS,
+  PROP_INPUT_WIDTH,
+  PROP_INPUT_HEIGHT,
+  PROP_INPUT_ALPHA,
+  PROP_INPUT_ZORDER,
+};
+
+static void gst_gl_video_mixer_input_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec);
+static void gst_gl_video_mixer_input_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec);
+
+static GstFlowReturn gst_gl_video_mixer_input_chain (GstPad * pad,
+    GstObject * parent, GstBuffer * buffer);
+static GstFlowReturn gst_gl_video_mixer_input_event (GstPad * pad,
+    GstObject * parent, GstEvent * event);
+
+typedef struct _GstGLVideoMixerInput GstGLVideoMixerInput;
+typedef GstGhostPadClass GstGLVideoMixerInputClass;
+
+struct _GstGLVideoMixerInput
+{
+  GstGhostPad parent;
+
+  GstSegment segment;
+
+  GstPad *mixer_pad;
+};
+
+GType gst_gl_video_mixer_input_get_type (void);
+G_DEFINE_TYPE (GstGLVideoMixerInput, gst_gl_video_mixer_input,
+    GST_TYPE_GHOST_PAD);
+
+static void
+gst_gl_video_mixer_input_init (GstGLVideoMixerInput * self)
+{
+  GstPad *pad = GST_PAD (self);
+
+  gst_pad_set_event_function (pad, gst_gl_video_mixer_input_event);
+}
+
+static void
+gst_gl_video_mixer_input_class_init (GstGLVideoMixerInputClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->set_property = gst_gl_video_mixer_input_set_property;
+  gobject_class->get_property = gst_gl_video_mixer_input_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_INPUT_ZORDER,
+      g_param_spec_uint ("zorder", "Z-Order", "Z Order of the picture",
+          0, 10000, DEFAULT_PAD_ZORDER,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_INPUT_XPOS,
+      g_param_spec_int ("xpos", "X Position", "X Position of the picture",
+          G_MININT, G_MAXINT, DEFAULT_PAD_XPOS,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_INPUT_YPOS,
+      g_param_spec_int ("ypos", "Y Position", "Y Position of the picture",
+          G_MININT, G_MAXINT, DEFAULT_PAD_YPOS,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_INPUT_WIDTH,
+      g_param_spec_int ("width", "Width", "Width of the picture",
+          G_MININT, G_MAXINT, DEFAULT_PAD_WIDTH,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_INPUT_HEIGHT,
+      g_param_spec_int ("height", "Height", "Height of the picture",
+          G_MININT, G_MAXINT, DEFAULT_PAD_HEIGHT,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_INPUT_ALPHA,
+      g_param_spec_double ("alpha", "Alpha", "Alpha of the picture", 0.0, 1.0,
+          DEFAULT_PAD_ALPHA,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_gl_video_mixer_input_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstGLVideoMixerInput *self = (GstGLVideoMixerInput *) object;
+
+  if (self->mixer_pad)
+    g_object_get_property (G_OBJECT (self->mixer_pad), pspec->name, value);
+}
+
+static void
+gst_gl_video_mixer_input_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstGLVideoMixerInput *self = (GstGLVideoMixerInput *) object;
+
+  if (self->mixer_pad)
+    g_object_set_property (G_OBJECT (self->mixer_pad), pspec->name, value);
+}
+
+static GstFlowReturn
+gst_gl_video_mixer_input_chain (GstPad * pad, GstObject * parent,
+    GstBuffer * buffer)
+{
+  GstGLVideoMixerInput *self = (GstGLVideoMixerInput *) pad;
+  GstClockTime timestamp, stream_time;
+//  gdouble alpha;
+
+  timestamp = GST_BUFFER_TIMESTAMP (buffer);
+
+  stream_time =
+      gst_segment_to_stream_time (&self->segment, GST_FORMAT_TIME, timestamp);
+
+  gst_object_sync_values (GST_OBJECT (self), stream_time);
+#if 0
+  /* FIXME: implement no-upload on alpha = 0 */
+  g_object_get (self, "alpha", &alpha, NULL);
+
+  if (alpha <= 0.0) {
+    GST_DEBUG_OBJECT (self, "dropping buffer %" GST_PTR_FORMAT
+        " due to alpha value %f", buffer, alpha);
+    gst_buffer_unref (buffer);
+    return GST_FLOW_OK;
+  }
+#endif
+  return gst_proxy_pad_chain_default (pad, parent, buffer);
+}
+
+static GstFlowReturn
+gst_gl_video_mixer_input_event (GstPad * pad, GstObject * parent,
+    GstEvent * event)
+{
+  GstGLVideoMixerInput *self = (GstGLVideoMixerInput *) pad;
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_SEGMENT:
+      gst_event_copy_segment (event, &self->segment);
+      break;
+    default:
+      break;
+  }
+
+  return gst_pad_event_default (pad, parent, event);
+}
+
+static GstGhostPad *
+_create_video_mixer_input (GstGLMixerBin * self, GstPad * mixer_pad)
+{
+  GstGLVideoMixerInput *input =
+      g_object_new (gst_gl_video_mixer_input_get_type (), "name",
+      GST_OBJECT_NAME (mixer_pad), "direction", GST_PAD_DIRECTION (mixer_pad),
+      NULL);
+
+  if (!gst_ghost_pad_construct (GST_GHOST_PAD (input))) {
+    gst_object_unref (input);
+    return NULL;
+  }
+
+  gst_pad_set_chain_function (GST_PAD (input), gst_gl_video_mixer_input_chain);
+
+  input->mixer_pad = mixer_pad;
+
+  return GST_GHOST_PAD (input);
+}
+
+enum
+{
+  PROP_BIN_0,
+  PROP_BIN_BACKGROUND,
+};
+#define DEFAULT_BACKGROUND GST_GL_VIDEO_MIXER_BACKGROUND_CHECKER
+
+static void gst_gl_video_mixer_bin_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec);
+static void gst_gl_video_mixer_bin_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec);
+
+typedef GstGLMixerBin GstGLVideoMixerBin;
+typedef GstGLMixerBinClass GstGLVideoMixerBinClass;
+
+G_DEFINE_TYPE (GstGLVideoMixerBin, gst_gl_video_mixer_bin,
+    GST_TYPE_GL_MIXER_BIN);
+
+static void
+gst_gl_video_mixer_bin_init (GstGLVideoMixerBin * self)
+{
+  GstGLMixerBin *mix_bin = GST_GL_MIXER_BIN (self);
+
+  gst_gl_mixer_bin_finish_init_with_element (mix_bin,
+      g_object_new (GST_TYPE_GL_VIDEO_MIXER, NULL));
+}
+
+static void
+gst_gl_video_mixer_bin_class_init (GstGLVideoMixerBinClass * klass)
+{
+  GstGLMixerBinClass *mixer_class = GST_GL_MIXER_BIN_CLASS (klass);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  mixer_class->create_input_pad = _create_video_mixer_input;
+
+  gobject_class->set_property = gst_gl_video_mixer_bin_set_property;
+  gobject_class->get_property = gst_gl_video_mixer_bin_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_BIN_BACKGROUND,
+      g_param_spec_enum ("background", "Background", "Background type",
+          GST_GL_TYPE_VIDEO_MIXER_BACKGROUND,
+          DEFAULT_BACKGROUND, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_gl_video_mixer_bin_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (object);
+
+  if (self->mixer)
+    g_object_get_property (G_OBJECT (self->mixer), pspec->name, value);
+}
+
+static void
+gst_gl_video_mixer_bin_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstGLMixerBin *self = GST_GL_MIXER_BIN (object);
+
+  if (self->mixer)
+    g_object_set_property (G_OBJECT (self->mixer), pspec->name, value);
+}
+
 enum
 {
   PROP_0,
+  PROP_BACKGROUND,
 };
 
 #define DEBUG_INIT \
@@ -60,7 +323,7 @@
 static void gst_gl_video_mixer_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static gboolean _update_info (GstVideoAggregator * vagg, GstVideoInfo * info);
+static GstCaps *_update_caps (GstVideoAggregator * vagg, GstCaps * caps);
 static void gst_gl_video_mixer_reset (GstGLMixer * mixer);
 static gboolean gst_gl_video_mixer_init_shader (GstGLMixer * mixer,
     GstCaps * outcaps);
@@ -69,6 +332,7 @@
     GPtrArray * in_frames, guint out_tex);
 static void gst_gl_video_mixer_callback (gpointer stuff);
 
+/* *INDENT-OFF* */
 /* vertex source */
 static const gchar *video_mixer_v_src =
     "attribute vec4 a_position;                                   \n"
@@ -93,6 +357,38 @@
     "  gl_FragColor = vec4(rgba.rgb, rgba.a * alpha);\n"
     "}                                                   \n";
 
+/* checker vertex source */
+static const gchar *checker_v_src =
+    "attribute vec4 a_position;\n"
+    "void main()\n"
+    "{\n"
+    "   gl_Position = a_position;\n"
+    "}\n";
+
+/* checker fragment source */
+static const gchar *checker_f_src =
+    "#ifdef GL_ES\n"
+    "precision mediump float;\n"
+    "#endif\n"
+    "const float blocksize = 8.0;\n"
+    "void main ()\n"
+    "{\n"
+    "  vec4 high = vec4(0.667, 0.667, 0.667, 1.0);\n"
+    "  vec4 low = vec4(0.333, 0.333, 0.333, 1.0);\n"
+    "  if (mod(gl_FragCoord.x, blocksize * 2.0) >= blocksize) {\n"
+    "    if (mod(gl_FragCoord.y, blocksize * 2.0) >= blocksize)\n"
+    "      gl_FragColor = low;\n"
+    "    else\n"
+    "      gl_FragColor = high;\n"
+    "  } else {\n"
+    "    if (mod(gl_FragCoord.y, blocksize * 2.0) < blocksize)\n"
+    "      gl_FragColor = low;\n"
+    "    else\n"
+    "      gl_FragColor = high;\n"
+    "  }\n"
+    "}\n";
+/* *INDENT-ON* */
+
 #define GST_TYPE_GL_VIDEO_MIXER_PAD (gst_gl_video_mixer_pad_get_type())
 #define GST_GL_VIDEO_MIXER_PAD(obj) \
         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_VIDEO_MIXER_PAD, GstGLVideoMixerPad))
@@ -121,6 +417,9 @@
   gint xpos, ypos;
   gint width, height;
   gdouble alpha;
+
+  gboolean geometry_change;
+  GLuint vertex_buffer;
 };
 
 struct _GstGLVideoMixerPadClass
@@ -137,11 +436,6 @@
 static void gst_gl_video_mixer_pad_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
-#define DEFAULT_PAD_XPOS   0
-#define DEFAULT_PAD_YPOS   0
-#define DEFAULT_PAD_WIDTH  0
-#define DEFAULT_PAD_HEIGHT 0
-#define DEFAULT_PAD_ALPHA  1.0
 enum
 {
   PROP_PAD_0,
@@ -226,15 +520,19 @@
   switch (prop_id) {
     case PROP_PAD_XPOS:
       pad->xpos = g_value_get_int (value);
+      pad->geometry_change = TRUE;
       break;
     case PROP_PAD_YPOS:
       pad->ypos = g_value_get_int (value);
+      pad->geometry_change = TRUE;
       break;
     case PROP_PAD_WIDTH:
       pad->width = g_value_get_int (value);
+      pad->geometry_change = TRUE;
       break;
     case PROP_PAD_HEIGHT:
       pad->height = g_value_get_int (value);
+      pad->geometry_change = TRUE;
       break;
     case PROP_PAD_ALPHA:
       pad->alpha = g_value_get_double (value);
@@ -263,21 +561,30 @@
 
   gst_element_class_set_metadata (element_class, "OpenGL video_mixer",
       "Filter/Effect/Video/Compositor", "OpenGL video_mixer",
-      "Julien Isorce <julien.isorce@gmail.com>");
+      "Matthew Waters <matthew@centricular.com>");
+
+  g_object_class_install_property (gobject_class, PROP_BACKGROUND,
+      g_param_spec_enum ("background", "Background", "Background type",
+          GST_GL_TYPE_VIDEO_MIXER_BACKGROUND,
+          DEFAULT_BACKGROUND, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   GST_GL_MIXER_CLASS (klass)->set_caps = gst_gl_video_mixer_init_shader;
   GST_GL_MIXER_CLASS (klass)->reset = gst_gl_video_mixer_reset;
   GST_GL_MIXER_CLASS (klass)->process_textures =
       gst_gl_video_mixer_process_textures;
 
-  vagg_class->update_info = _update_info;
+  vagg_class->update_caps = _update_caps;
 
   agg_class->sinkpads_type = GST_TYPE_GL_VIDEO_MIXER_PAD;
+
+  GST_GL_BASE_MIXER_CLASS (klass)->supported_gl_api =
+      GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
 }
 
 static void
 gst_gl_video_mixer_init (GstGLVideoMixer * video_mixer)
 {
+  video_mixer->background = DEFAULT_BACKGROUND;
   video_mixer->shader = NULL;
   video_mixer->input_frames = NULL;
 }
@@ -286,7 +593,12 @@
 gst_gl_video_mixer_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
+  GstGLVideoMixer *mixer = GST_GL_VIDEO_MIXER (object);
+
   switch (prop_id) {
+    case PROP_BACKGROUND:
+      mixer->background = g_value_get_enum (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -297,19 +609,29 @@
 gst_gl_video_mixer_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec)
 {
+  GstGLVideoMixer *mixer = GST_GL_VIDEO_MIXER (object);
+
   switch (prop_id) {
+    case PROP_BACKGROUND:
+      g_value_set_enum (value, mixer->background);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
   }
 }
 
-static gboolean
-_update_info (GstVideoAggregator * vagg, GstVideoInfo * info)
+static GstCaps *
+_update_caps (GstVideoAggregator * vagg, GstCaps * caps)
 {
   GList *l;
   gint best_width = -1, best_height = -1;
-  gboolean ret = FALSE;
+  GstVideoInfo info;
+  GstCaps *ret = NULL;
+  int i;
+
+  caps = gst_caps_make_writable (caps);
+  gst_video_info_from_caps (&info, caps);
 
   GST_OBJECT_LOCK (vagg);
   for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
@@ -341,15 +663,48 @@
   }
   GST_OBJECT_UNLOCK (vagg);
 
-  if (best_width > 0 && best_height > 0) {
-    info->width = best_width;
-    info->height = best_height;
-    ret = TRUE;
+  ret =
+      GST_VIDEO_AGGREGATOR_CLASS (gst_gl_video_mixer_parent_class)->update_caps
+      (vagg, caps);
+
+  for (i = 0; i < gst_caps_get_size (ret); i++) {
+    GstStructure *s = gst_caps_get_structure (ret, i);
+
+    gst_structure_set (s, "width", G_TYPE_INT, best_width, "height", G_TYPE_INT,
+        best_height, NULL);
   }
 
   return ret;
 }
 
+static gboolean
+_reset_pad_gl (GstAggregator * agg, GstAggregatorPad * aggpad, gpointer udata)
+{
+  const GstGLFuncs *gl = GST_GL_BASE_MIXER (agg)->context->gl_vtable;
+  GstGLVideoMixerPad *pad = GST_GL_VIDEO_MIXER_PAD (aggpad);
+
+  if (pad->vertex_buffer) {
+    gl->DeleteBuffers (1, &pad->vertex_buffer);
+    pad->vertex_buffer = 0;
+  }
+
+  return FALSE;
+}
+
+static void
+_reset_gl (GstGLContext * context, GstGLVideoMixer * video_mixer)
+{
+  const GstGLFuncs *gl = GST_GL_BASE_MIXER (video_mixer)->context->gl_vtable;
+
+  if (video_mixer->vao) {
+    gl->DeleteVertexArrays (1, &video_mixer->vao);
+    video_mixer->vao = 0;
+  }
+
+  gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (video_mixer), _reset_pad_gl,
+      NULL);
+}
+
 static void
 gst_gl_video_mixer_reset (GstGLMixer * mixer)
 {
@@ -358,8 +713,17 @@
   video_mixer->input_frames = NULL;
 
   if (video_mixer->shader)
-    gst_gl_context_del_shader (mixer->context, video_mixer->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
+        video_mixer->shader);
   video_mixer->shader = NULL;
+
+  if (video_mixer->checker)
+    gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
+        video_mixer->checker);
+  video_mixer->checker = NULL;
+
+  gst_gl_context_thread_add (GST_GL_BASE_MIXER (mixer)->context,
+      (GstGLContextThreadFunc) _reset_gl, mixer);
 }
 
 static gboolean
@@ -368,10 +732,11 @@
   GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (mixer);
 
   if (video_mixer->shader)
-    gst_gl_context_del_shader (mixer->context, video_mixer->shader);
+    gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
+        video_mixer->shader);
 
-  return gst_gl_context_gen_shader (mixer->context, video_mixer_v_src,
-      video_mixer_f_src, &video_mixer->shader);
+  return gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
+      video_mixer_v_src, video_mixer_f_src, &video_mixer->shader);
 }
 
 static gboolean
@@ -382,7 +747,7 @@
 
   video_mixer->input_frames = frames;
 
-  gst_gl_context_use_fbo_v2 (mix->context,
+  gst_gl_context_use_fbo_v2 (GST_GL_BASE_MIXER (mix)->context,
       GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
       GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info),
       mix->fbo, mix->depthbuffer,
@@ -391,13 +756,94 @@
   return TRUE;
 }
 
+static gboolean
+_draw_checker_background (GstGLVideoMixer * video_mixer)
+{
+  GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
+  const GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
+  gint attr_position_loc = 0;
+
+  const GLushort indices[] = {
+    0, 1, 2,
+    0, 2, 3
+  };
+  /* *INDENT-OFF* */
+  gfloat v_vertices[] = {
+    -1.0,-1.0,-1.0f,
+     1.0,-1.0,-1.0f,
+     1.0, 1.0,-1.0f,
+    -1.0, 1.0,-1.0f,
+  };
+  /* *INDENT-ON* */
+
+  if (!video_mixer->checker) {
+    if (!gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
+            checker_v_src, checker_f_src, &video_mixer->checker))
+      return FALSE;
+  }
+
+  gst_gl_shader_use (video_mixer->checker);
+  attr_position_loc =
+      gst_gl_shader_get_attribute_location (video_mixer->checker, "a_position");
+
+  if (!video_mixer->checker_vbo) {
+    gl->GenBuffers (1, &video_mixer->checker_vbo);
+    gl->BindBuffer (GL_ARRAY_BUFFER, video_mixer->checker_vbo);
+    gl->BufferData (GL_ARRAY_BUFFER, 4 * 3 * sizeof (GLfloat), v_vertices,
+        GL_STATIC_DRAW);
+  } else {
+    gl->BindBuffer (GL_ARRAY_BUFFER, video_mixer->checker_vbo);
+  }
+
+  gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
+      GL_FALSE, 3 * sizeof (GLfloat), (void *) 0);
+
+  gl->EnableVertexAttribArray (attr_position_loc);
+
+  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+  gl->DisableVertexAttribArray (attr_position_loc);
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  return TRUE;
+}
+
+static gboolean
+_draw_background (GstGLVideoMixer * video_mixer)
+{
+  GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
+  const GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
+
+  switch (video_mixer->background) {
+    case GST_GL_VIDEO_MIXER_BACKGROUND_BLACK:
+      gl->ClearColor (0.0, 0.0, 0.0, 1.0);
+      gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+      break;
+    case GST_GL_VIDEO_MIXER_BACKGROUND_WHITE:
+      gl->ClearColor (1.0, 1.0, 1.0, 1.0);
+      gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+      break;
+    case GST_GL_VIDEO_MIXER_BACKGROUND_TRANSPARENT:
+      gl->ClearColor (0.0, 0.0, 0.0, 0.0);
+      gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+      break;
+    case GST_GL_VIDEO_MIXER_BACKGROUND_CHECKER:
+      return _draw_checker_background (video_mixer);
+      break;
+    default:
+      break;
+  }
+
+  return TRUE;
+}
+
 /* opengl scene, params: input texture (not the output mixer->texture) */
 static void
 gst_gl_video_mixer_callback (gpointer stuff)
 {
   GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (stuff);
   GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
-  GstGLFuncs *gl = mixer->context->gl_vtable;
+  GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
 
   GLint attr_position_loc = 0;
   GLint attr_texture_loc = 0;
@@ -413,15 +859,23 @@
   out_width = GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (stuff)->info);
   out_height = GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (stuff)->info);
 
-  gst_gl_context_clear_shader (mixer->context);
+  gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
   gl->BindTexture (GL_TEXTURE_2D, 0);
-  gl->Disable (GL_TEXTURE_2D);
+  if (gst_gl_context_get_gl_api (GST_GL_BASE_MIXER (mixer)->context) &
+      GST_GL_API_OPENGL)
+    gl->Disable (GL_TEXTURE_2D);
 
   gl->Disable (GL_DEPTH_TEST);
   gl->Disable (GL_CULL_FACE);
 
-  gl->ClearColor (0.0, 0.0, 0.0, 0.0);
-  gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+  if (gl->GenVertexArrays) {
+    if (!video_mixer->vao)
+      gl->GenVertexArrays (1, &video_mixer->vao);
+    gl->BindVertexArray (video_mixer->vao);
+  }
+
+  if (!_draw_background (video_mixer))
+    return;
 
   gst_gl_shader_use (video_mixer->shader);
 
@@ -435,19 +889,17 @@
   while (count < video_mixer->input_frames->len) {
     GstGLMixerFrameData *frame;
     GstGLVideoMixerPad *pad;
+    guint in_tex;
+    guint in_width, in_height;
+
     /* *INDENT-OFF* */
     gfloat v_vertices[] = {
-      /* front face */
       -1.0,-1.0,-1.0f, 0.0f, 0.0f,
        1.0,-1.0,-1.0f, 1.0f, 0.0f,
        1.0, 1.0,-1.0f, 1.0f, 1.0f,
       -1.0, 1.0,-1.0f, 0.0f, 1.0f,
     };
     /* *INDENT-ON* */
-    guint in_tex;
-    guint in_width, in_height;
-    guint pad_width, pad_height;
-    gfloat w, h;
 
     frame = g_ptr_array_index (video_mixer->input_frames, count);
     if (!frame) {
@@ -468,34 +920,41 @@
     }
 
     in_tex = frame->texture;
-    pad_width = pad->width <= 0 ? in_width : pad->width;
-    pad_height = pad->height <= 0 ? in_height : pad->height;
 
-    w = ((gfloat) pad_width / (gfloat) out_width);
-    h = ((gfloat) pad_height / (gfloat) out_height);
+    if (pad->geometry_change || !pad->vertex_buffer) {
+      guint pad_width, pad_height;
+      gfloat w, h;
 
-    /* top-left */
-    v_vertices[0] = v_vertices[15] =
-        2.0f * (gfloat) pad->xpos / (gfloat) out_width - 1.0f;
-    /* bottom-left */
-    v_vertices[1] = v_vertices[6] =
-        2.0f * (gfloat) pad->ypos / (gfloat) out_height - 1.0f;
-    /* top-right */
-    v_vertices[5] = v_vertices[10] = v_vertices[0] + 2.0f * w;
-    /* bottom-right */
-    v_vertices[11] = v_vertices[16] = v_vertices[1] + 2.0f * h;
-    GST_TRACE ("processing texture:%u dimensions:%ux%u, at %f,%f %fx%f with "
-        "alpha:%f", in_tex, in_width, in_height, v_vertices[0], v_vertices[1],
-        v_vertices[5], v_vertices[11], pad->alpha);
+      pad_width = pad->width <= 0 ? in_width : pad->width;
+      pad_height = pad->height <= 0 ? in_height : pad->height;
 
-    gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
-        GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[0]);
+      w = ((gfloat) pad_width / (gfloat) out_width);
+      h = ((gfloat) pad_height / (gfloat) out_height);
 
-    gl->VertexAttribPointer (attr_texture_loc, 2, GL_FLOAT,
-        GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[3]);
+      /* top-left */
+      v_vertices[0] = v_vertices[15] =
+          2.0f * (gfloat) pad->xpos / (gfloat) out_width - 1.0f;
+      /* bottom-left */
+      v_vertices[1] = v_vertices[6] =
+          2.0f * (gfloat) pad->ypos / (gfloat) out_height - 1.0f;
+      /* top-right */
+      v_vertices[5] = v_vertices[10] = v_vertices[0] + 2.0f * w;
+      /* bottom-right */
+      v_vertices[11] = v_vertices[16] = v_vertices[1] + 2.0f * h;
+      GST_TRACE ("processing texture:%u dimensions:%ux%u, at %f,%f %fx%f with "
+          "alpha:%f", in_tex, in_width, in_height, v_vertices[0], v_vertices[1],
+          v_vertices[5], v_vertices[11], pad->alpha);
 
-    gl->EnableVertexAttribArray (attr_position_loc);
-    gl->EnableVertexAttribArray (attr_texture_loc);
+      if (!pad->vertex_buffer)
+        gl->GenBuffers (1, &pad->vertex_buffer);
+
+      gl->BindBuffer (GL_ARRAY_BUFFER, pad->vertex_buffer);
+
+      gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), v_vertices,
+          GL_STATIC_DRAW);
+    } else {
+      gl->BindBuffer (GL_ARRAY_BUFFER, pad->vertex_buffer);
+    }
 
     gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     gl->BlendEquation (GL_FUNC_ADD);
@@ -505,6 +964,15 @@
     gst_gl_shader_set_uniform_1i (video_mixer->shader, "texture", 0);
     gst_gl_shader_set_uniform_1f (video_mixer->shader, "alpha", pad->alpha);
 
+    gl->EnableVertexAttribArray (attr_position_loc);
+    gl->EnableVertexAttribArray (attr_texture_loc);
+
+    gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
+        GL_FALSE, 5 * sizeof (GLfloat), (void *) 0);
+
+    gl->VertexAttribPointer (attr_texture_loc, 2, GL_FLOAT,
+        GL_FALSE, 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
+
     gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
 
     ++count;
@@ -513,9 +981,13 @@
   gl->DisableVertexAttribArray (attr_position_loc);
   gl->DisableVertexAttribArray (attr_texture_loc);
 
+  if (gl->GenVertexArrays)
+    gl->BindVertexArray (0);
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
   gl->BindTexture (GL_TEXTURE_2D, 0);
 
   gl->Disable (GL_BLEND);
 
-  gst_gl_context_clear_shader (mixer->context);
+  gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
 }
diff --git a/ext/gl/gstglvideomixer.h b/ext/gl/gstglvideomixer.h
index ae2f367..967358b 100644
--- a/ext/gl/gstglvideomixer.h
+++ b/ext/gl/gstglvideomixer.h
@@ -22,7 +22,6 @@
 #define _GST_GL_VIDEO_MIXER_H_
 
 #include "gstglmixer.h"
-#include "gstglmixerpad.h"
 
 G_BEGIN_DECLS
 
@@ -36,12 +35,36 @@
 typedef struct _GstGLVideoMixer GstGLVideoMixer;
 typedef struct _GstGLVideoMixerClass GstGLVideoMixerClass;
 
+/**
+ * GstGLVideoMixerBackground:
+ * @GST_GL_VIDEO_MIXER_BACKGROUND_CHECKER: checker pattern background
+ * @GST_GL_VIDEO_MIXER_BACKGROUND_BLACK: solid color black background
+ * @GST_GL_VIDEO_MIXER_BACKGROUND_WHITE: solid color white background
+ * @GST_GL_VIDEO_MIXER_BACKGROUND_TRANSPARENT: background is left transparent and layers are composited using "A OVER B" composition rules. This is only applicable to AYUV and ARGB (and variants) as it preserves the alpha channel and allows for further mixing.
+ *
+ * The different backgrounds compositor can blend over.
+ */
+typedef enum
+{
+  GST_GL_VIDEO_MIXER_BACKGROUND_CHECKER,
+  GST_GL_VIDEO_MIXER_BACKGROUND_BLACK,
+  GST_GL_VIDEO_MIXER_BACKGROUND_WHITE,
+  GST_GL_VIDEO_MIXER_BACKGROUND_TRANSPARENT,
+}
+GstGLVideoMixerBackground;
+
 struct _GstGLVideoMixer
 {
     GstGLMixer mixer;
 
+    GstGLVideoMixerBackground background;
+
     GstGLShader *shader;
+    GstGLShader *checker;
     GPtrArray *input_frames;
+
+    GLuint vao;
+    GLuint checker_vbo;
 };
 
 struct _GstGLVideoMixerClass
@@ -50,6 +73,7 @@
 };
 
 GType gst_gl_video_mixer_get_type (void);
+GType gst_gl_video_mixer_bin_get_type (void);
 
 G_END_DECLS
 
diff --git a/ext/gl/gstopengl.c b/ext/gl/gstopengl.c
index a4b2540..452efdd 100644
--- a/ext/gl/gstopengl.c
+++ b/ext/gl/gstopengl.c
@@ -31,10 +31,10 @@
  * <refsect2>
  * <title>Examples</title>
  * |[
- * gst-launch-0.10 --gst-debug=gldisplay:3 videotestsrc ! glimagesink
+ * gst-launch-1.0 --gst-debug=gldisplay:3 videotestsrc ! glimagesink
  * ]| A debugging pipeline.
   |[
- * GST_GL_SHADER_DEBUG=1 gst-launch-0.10 videotestsrc ! glimagesink
+ * GST_DEBUG=gl*:6 gst-launch-1.0 videotestsrc ! glimagesink
  * ]| A debugging pipelines related to shaders.
  * </refsect2>
  */
@@ -44,35 +44,49 @@
 #endif
 
 #include "gstglimagesink.h"
+#include "gstgluploadelement.h"
+#include "gstgldownloadelement.h"
+#include "gstglcolorconvertelement.h"
+#include "gstglfilterbin.h"
+#include "gstglsinkbin.h"
+#include "gstglsrcbin.h"
+#include "gstglmixerbin.h"
 
 #include "gstglfiltercube.h"
 #include "gstgleffects.h"
 #include "gstglcolorscale.h"
 #include "gstglvideomixer.h"
 #include "gstglfiltershader.h"
+#include "gstglfilterapp.h"
 #if HAVE_GRAPHENE
 #include "gstgltransformation.h"
 #endif
+#if HAVE_JPEG
+#if HAVE_PNG
+#include "gstgloverlay.h"
+#endif /* HAVE_PNG */
+#endif /* HAVE_JPEG */
 
 #if GST_GL_HAVE_OPENGL
 #include "gstgltestsrc.h"
 #include "gstglfilterlaplacian.h"
 #include "gstglfilterglass.h"
-#include "gstglfilterapp.h"
 #include "gstglfilterblur.h"
-#include "gstglfilterreflectedscreen.h"
+/* #include "gstglfilterreflectedscreen.h" */
 #include "gstglfiltersobel.h"
 #include "gstgldeinterlace.h"
 #include "gstglmosaic.h"
 #if HAVE_PNG
 #include "gstgldifferencematte.h"
-#include "gstglbumper.h"
-#if HAVE_JPEG
-#include "gstgloverlay.h"
-#endif /* HAVE_JPEG */
+/* #include "gstglbumper.h" */
 #endif /* HAVE_PNG */
 #endif /* GST_GL_HAVE_OPENGL */
 
+#if GST_GL_HAVE_WINDOW_COCOA
+/* avoid including Cocoa/CoreFoundation from a C file... */
+extern GType gst_ca_opengl_layer_sink_bin_get_type (void);
+#endif
+
 #ifdef USE_EGL_RPI
 #include <bcm_host.h>
 #endif
@@ -101,7 +115,42 @@
 #endif
 
   if (!gst_element_register (plugin, "glimagesink",
-          GST_RANK_SECONDARY, GST_TYPE_GLIMAGE_SINK)) {
+          GST_RANK_SECONDARY, gst_gl_image_sink_bin_get_type ())) {
+    return FALSE;
+  }
+
+  if (!gst_element_register (plugin, "glupload",
+          GST_RANK_SECONDARY, GST_TYPE_GL_UPLOAD_ELEMENT)) {
+    return FALSE;
+  }
+
+  if (!gst_element_register (plugin, "gldownload",
+          GST_RANK_SECONDARY, GST_TYPE_GL_DOWNLOAD_ELEMENT)) {
+    return FALSE;
+  }
+
+  if (!gst_element_register (plugin, "glcolorconvert",
+          GST_RANK_SECONDARY, GST_TYPE_GL_COLOR_CONVERT_ELEMENT)) {
+    return FALSE;
+  }
+
+  if (!gst_element_register (plugin, "glfilterbin",
+          GST_RANK_NONE, GST_TYPE_GL_FILTER_BIN)) {
+    return FALSE;
+  }
+
+  if (!gst_element_register (plugin, "glsinkbin",
+          GST_RANK_NONE, GST_TYPE_GL_SINK_BIN)) {
+    return FALSE;
+  }
+
+  if (!gst_element_register (plugin, "glsrcbin",
+          GST_RANK_NONE, GST_TYPE_GL_SRC_BIN)) {
+    return FALSE;
+  }
+
+  if (!gst_element_register (plugin, "glmixerbin",
+          GST_RANK_NONE, GST_TYPE_GL_MIXER_BIN)) {
     return FALSE;
   }
 
@@ -126,13 +175,27 @@
   }
 
   if (!gst_element_register (plugin, "glvideomixer",
-          GST_RANK_NONE, GST_TYPE_GL_VIDEO_MIXER)) {
+          GST_RANK_NONE, gst_gl_video_mixer_bin_get_type ())) {
     return FALSE;
   }
+
   if (!gst_element_register (plugin, "glshader",
           GST_RANK_NONE, gst_gl_filtershader_get_type ())) {
     return FALSE;
   }
+
+  if (!gst_element_register (plugin, "glfilterapp",
+          GST_RANK_NONE, GST_TYPE_GL_FILTER_APP)) {
+    return FALSE;
+  }
+#if HAVE_JPEG
+#if HAVE_PNG
+  if (!gst_element_register (plugin, "gloverlay",
+          GST_RANK_NONE, gst_gl_overlay_get_type ())) {
+    return FALSE;
+  }
+#endif /* HAVE_PNG */
+#endif /* HAVE_JPEG */
 #if GST_GL_HAVE_OPENGL
   if (!gst_element_register (plugin, "gltestsrc",
           GST_RANK_NONE, GST_TYPE_GL_TEST_SRC)) {
@@ -158,17 +221,12 @@
           GST_RANK_NONE, GST_TYPE_GL_FILTER_GLASS)) {
     return FALSE;
   }
-
-  if (!gst_element_register (plugin, "glfilterapp",
-          GST_RANK_NONE, GST_TYPE_GL_FILTER_APP)) {
-    return FALSE;
-  }
-
+#if 0
   if (!gst_element_register (plugin, "glfilterreflectedscreen",
           GST_RANK_NONE, GST_TYPE_GL_FILTER_REFLECTED_SCREEN)) {
     return FALSE;
   }
-
+#endif
   if (!gst_element_register (plugin, "gldeinterlace",
           GST_RANK_NONE, GST_TYPE_GL_DEINTERLACE)) {
     return FALSE;
@@ -183,19 +241,20 @@
           GST_RANK_NONE, gst_gl_differencematte_get_type ())) {
     return FALSE;
   }
-
+#if 0
   if (!gst_element_register (plugin, "glbumper",
           GST_RANK_NONE, gst_gl_bumper_get_type ())) {
     return FALSE;
   }
-#if HAVE_JPEG
-  if (!gst_element_register (plugin, "gloverlay",
-          GST_RANK_NONE, gst_gl_overlay_get_type ())) {
-    return FALSE;
-  }
-#endif /* HAVE_JPEG */
+#endif
 #endif /* HAVE_PNG */
 #endif /* GST_GL_HAVE_OPENGL */
+#if GST_GL_HAVE_WINDOW_COCOA
+  if (!gst_element_register (plugin, "caopengllayersink",
+          GST_RANK_NONE, gst_ca_opengl_layer_sink_bin_get_type ())) {
+    return FALSE;
+  }
+#endif
 
   return TRUE;
 }
diff --git a/ext/gme/Makefile.in b/ext/gme/Makefile.in
index 1215bcf..01bad02 100644
--- a/ext/gme/Makefile.in
+++ b/ext/gme/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/gsettings/Makefile.in b/ext/gsettings/Makefile.in
index 0d637a8..09f86cd 100644
--- a/ext/gsettings/Makefile.in
+++ b/ext/gsettings/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -255,8 +255,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -295,7 +299,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -303,6 +306,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -352,8 +357,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -432,7 +435,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -441,7 +443,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -454,7 +455,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -479,6 +479,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -552,10 +554,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -581,6 +587,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -617,6 +626,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -657,17 +667,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -684,6 +693,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml b/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml
index e3c9a6e..ed0c4ce 100644
--- a/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml
+++ b/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml
@@ -5,7 +5,7 @@
       <summary>default GStreamer sound events audiosink</summary>
       <description>GStreamer can play audio using any number of
       output elements. Some possible choices are osssink, pulsesink
-      and alsasink. The audiosink can be a partial pipeline instea
+      and alsasink. The audiosink can be a partial pipeline instead
       of just one element.</description>
     </key>
     <key name="sounds-audiosink-description" type="s">
@@ -18,7 +18,7 @@
       <summary>default GStreamer audiosink for Audio/Video Conferencing</summary>
       <description>GStreamer can play audio using any number of
       output elements. Some possible choices are osssink, pulsesink
-      and alsasink. The audiosink can be a partial pipeline instea
+      and alsasink. The audiosink can be a partial pipeline instead
       of just one element.</description>
     </key>
     <key name="chat-audiosink-description" type="s">
@@ -31,7 +31,7 @@
       <summary>default GStreamer audiosink for Music and Movies</summary>
       <description>GStreamer can play audio using any number of
       output elements. Some possible choices are osssink, pulsesink
-      and alsasink. The audiosink can be a partial pipeline instea
+      and alsasink. The audiosink can be a partial pipeline instead
       of just one element.</description>
     </key>
     <key name="music-audiosink-description" type="s">
diff --git a/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml.in b/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml.in
index 58f1b33..1a13b3a 100644
--- a/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml.in
+++ b/ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml.in
@@ -5,7 +5,7 @@
       <summary>default GStreamer sound events audiosink</summary>
       <description>GStreamer can play audio using any number of
       output elements. Some possible choices are osssink, pulsesink
-      and alsasink. The audiosink can be a partial pipeline instea
+      and alsasink. The audiosink can be a partial pipeline instead
       of just one element.</description>
     </key>
     <key name="sounds-audiosink-description" type="s">
@@ -18,7 +18,7 @@
       <summary>default GStreamer audiosink for Audio/Video Conferencing</summary>
       <description>GStreamer can play audio using any number of
       output elements. Some possible choices are osssink, pulsesink
-      and alsasink. The audiosink can be a partial pipeline instea
+      and alsasink. The audiosink can be a partial pipeline instead
       of just one element.</description>
     </key>
     <key name="chat-audiosink-description" type="s">
@@ -31,7 +31,7 @@
       <summary>default GStreamer audiosink for Music and Movies</summary>
       <description>GStreamer can play audio using any number of
       output elements. Some possible choices are osssink, pulsesink
-      and alsasink. The audiosink can be a partial pipeline instea
+      and alsasink. The audiosink can be a partial pipeline instead
       of just one element.</description>
     </key>
     <key name="music-audiosink-description" type="s">
diff --git a/ext/gsm/Makefile.in b/ext/gsm/Makefile.in
index 0a3369c..21f8eb1 100644
--- a/ext/gsm/Makefile.in
+++ b/ext/gsm/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/hls/Makefile.am b/ext/hls/Makefile.am
index cedf183..6ef163b 100644
--- a/ext/hls/Makefile.am
+++ b/ext/hls/Makefile.am
@@ -11,8 +11,9 @@
 libgstfragmented_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS) $(LIBGCRYPT_CFLAGS) $(NETTLE_CFLAGS)
 libgstfragmented_la_LIBADD = \
 	$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la \
+        $(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
 	$(GST_PLUGINS_BASE_LIBS) -lgstpbutils-$(GST_API_VERSION) -lgstvideo-$(GST_API_VERSION) \
-	$(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS) $(LIBM) $(LIBGCRYPT_LIBS) $(NETTLE_LIBS)
+	$(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS) $(LIBM) $(LIBGCRYPT_LIBS) $(NETTLE_LIBS) $(OPENSSL_LIBS)
 libgstfragmented_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -no-undefined
 libgstfragmented_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
 
diff --git a/ext/hls/Makefile.in b/ext/hls/Makefile.in
index 02c0432..140ce07 100644
--- a/ext/hls/Makefile.in
+++ b/ext/hls/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -155,10 +155,11 @@
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libgstfragmented_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la \
+	$(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_libgstfragmented_la_OBJECTS = libgstfragmented_la-m3u8.lo \
 	libgstfragmented_la-gsthlsdemux.lo \
 	libgstfragmented_la-gstfragmentedplugin.lo \
@@ -251,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -291,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -299,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -348,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -428,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -437,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -450,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -475,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -548,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -577,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -613,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -653,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -680,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -742,8 +753,9 @@
 libgstfragmented_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS) $(LIBGCRYPT_CFLAGS) $(NETTLE_CFLAGS)
 libgstfragmented_la_LIBADD = \
 	$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la \
+        $(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
 	$(GST_PLUGINS_BASE_LIBS) -lgstpbutils-$(GST_API_VERSION) -lgstvideo-$(GST_API_VERSION) \
-	$(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS) $(LIBM) $(LIBGCRYPT_LIBS) $(NETTLE_LIBS)
+	$(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS) $(LIBM) $(LIBGCRYPT_LIBS) $(NETTLE_LIBS) $(OPENSSL_LIBS)
 
 libgstfragmented_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -no-undefined
 libgstfragmented_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c
index b11d07e..fad5a7b 100644
--- a/ext/hls/gsthlsdemux.c
+++ b/ext/hls/gsthlsdemux.c
@@ -44,15 +44,6 @@
 #include <gst/base/gsttypefindhelper.h>
 #include "gsthlsdemux.h"
 
-#define GST_ELEMENT_ERROR_FROM_ERROR(el, msg, err) G_STMT_START { \
-  gchar *__dbg = g_strdup_printf ("%s: %s", msg, err->message);         \
-  GST_WARNING_OBJECT (el, "error: %s", __dbg);                          \
-  gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_ERROR,         \
-    err->domain, err->code,                                             \
-    NULL, __dbg, __FILE__, GST_FUNCTION, __LINE__);                     \
-  g_clear_error (&err); \
-} G_STMT_END
-
 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u",
     GST_PAD_SRC,
     GST_PAD_SOMETIMES,
@@ -71,15 +62,10 @@
   PROP_0,
 
   PROP_FRAGMENTS_CACHE,
-  PROP_BITRATE_LIMIT,
-  PROP_CONNECTION_SPEED,
   PROP_LAST
 };
 
 #define DEFAULT_FRAGMENTS_CACHE 1
-#define DEFAULT_FAILED_COUNT 3
-#define DEFAULT_BITRATE_LIMIT 0.8
-#define DEFAULT_CONNECTION_SPEED    0
 
 /* GObject */
 static void gst_hls_demux_set_property (GObject * object, guint prop_id,
@@ -92,33 +78,15 @@
 static GstStateChangeReturn
 gst_hls_demux_change_state (GstElement * element, GstStateChange transition);
 
-static void gst_hls_demux_handle_message (GstBin * bin, GstMessage * msg);
-
 /* GstHLSDemux */
-static GstFlowReturn gst_hls_demux_chain (GstPad * pad, GstObject * parent,
-    GstBuffer * buf);
-static gboolean gst_hls_demux_sink_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static gboolean gst_hls_demux_src_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static gboolean gst_hls_demux_src_query (GstPad * pad, GstObject * parent,
-    GstQuery * query);
-static void gst_hls_demux_stream_loop (GstHLSDemux * demux);
-static void gst_hls_demux_updates_loop (GstHLSDemux * demux);
-static void gst_hls_demux_stop (GstHLSDemux * demux);
-static void gst_hls_demux_pause_tasks (GstHLSDemux * demux);
-static gboolean gst_hls_demux_switch_playlist (GstHLSDemux * demux);
-static gboolean gst_hls_demux_get_next_fragment (GstHLSDemux * demux,
-    gboolean * end_of_playlist, GError ** err);
 static gboolean gst_hls_demux_update_playlist (GstHLSDemux * demux,
     gboolean update, GError ** err);
-static void gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose);
 static gboolean gst_hls_demux_set_location (GstHLSDemux * demux,
     const gchar * uri, const gchar * base_uri);
 static gchar *gst_hls_src_buf_to_utf8_playlist (GstBuffer * buf);
 
 static gboolean gst_hls_demux_change_playlist (GstHLSDemux * demux,
-    guint max_bitrate);
+    guint max_bitrate, gboolean * changed);
 static GstBuffer *gst_hls_demux_decrypt_fragment (GstHLSDemux * demux,
     GstBuffer * encrypted_buffer, GError ** err);
 static gboolean
@@ -126,44 +94,49 @@
     const guint8 * iv_data);
 static void gst_hls_demux_decrypt_end (GstHLSDemux * demux);
 
+static gboolean gst_hls_demux_is_live (GstAdaptiveDemux * demux);
+static GstClockTime gst_hls_demux_get_duration (GstAdaptiveDemux * demux);
+static gint64 gst_hls_demux_get_manifest_update_interval (GstAdaptiveDemux *
+    demux);
+static gboolean gst_hls_demux_process_manifest (GstAdaptiveDemux * demux,
+    GstBuffer * buf);
+static GstFlowReturn gst_hls_demux_update_manifest (GstAdaptiveDemux * demux,
+    GstBuffer * buf);
+static gboolean gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek);
+static gboolean
+gst_hls_demux_start_fragment (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+static GstFlowReturn gst_hls_demux_finish_fragment (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+static GstFlowReturn gst_hls_demux_data_received (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+static gboolean gst_hls_demux_stream_has_next_fragment (GstAdaptiveDemuxStream *
+    stream);
+static GstFlowReturn gst_hls_demux_advance_fragment (GstAdaptiveDemuxStream *
+    stream);
+static GstFlowReturn gst_hls_demux_update_fragment_info (GstAdaptiveDemuxStream
+    * stream);
+static gboolean gst_hls_demux_select_bitrate (GstAdaptiveDemuxStream * stream,
+    guint64 bitrate);
+static void gst_hls_demux_reset (GstAdaptiveDemux * demux);
+static gboolean gst_hls_demux_get_live_seek_range (GstAdaptiveDemux * demux,
+    gint64 * start, gint64 * stop);
+
 #define gst_hls_demux_parent_class parent_class
-G_DEFINE_TYPE (GstHLSDemux, gst_hls_demux, GST_TYPE_BIN);
+G_DEFINE_TYPE (GstHLSDemux, gst_hls_demux, GST_TYPE_ADAPTIVE_DEMUX);
 
 static void
 gst_hls_demux_dispose (GObject * obj)
 {
   GstHLSDemux *demux = GST_HLS_DEMUX (obj);
 
-  if (demux->stream_task) {
-    gst_object_unref (demux->stream_task);
-    g_rec_mutex_clear (&demux->stream_lock);
-    demux->stream_task = NULL;
-  }
-
-  if (demux->updates_task) {
-    gst_object_unref (demux->updates_task);
-    g_rec_mutex_clear (&demux->updates_lock);
-    demux->updates_task = NULL;
-  }
-
   if (demux->downloader != NULL) {
     g_object_unref (demux->downloader);
     demux->downloader = NULL;
   }
 
-  gst_hls_demux_reset (demux, TRUE);
-
-  if (demux->src_srcpad) {
-    gst_object_unref (demux->src_srcpad);
-    demux->src_srcpad = NULL;
-  }
-
-  g_mutex_clear (&demux->download_lock);
-  g_cond_clear (&demux->download_cond);
-  g_mutex_clear (&demux->updates_timed_lock);
-  g_cond_clear (&demux->updates_timed_cond);
-  g_mutex_clear (&demux->fragment_download_lock);
-  g_cond_clear (&demux->fragment_download_cond);
+  gst_hls_demux_reset (GST_ADAPTIVE_DEMUX_CAST (demux));
+  gst_m3u8_client_free (demux->client);
 
   G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
@@ -173,35 +146,24 @@
 {
   GObjectClass *gobject_class;
   GstElementClass *element_class;
-  GstBinClass *bin_class;
+  GstAdaptiveDemuxClass *adaptivedemux_class;
 
   gobject_class = (GObjectClass *) klass;
   element_class = (GstElementClass *) klass;
-  bin_class = (GstBinClass *) klass;
+  adaptivedemux_class = (GstAdaptiveDemuxClass *) klass;
 
   gobject_class->set_property = gst_hls_demux_set_property;
   gobject_class->get_property = gst_hls_demux_get_property;
   gobject_class->dispose = gst_hls_demux_dispose;
 
+#ifndef GST_REMOVE_DEPRECATED
   g_object_class_install_property (gobject_class, PROP_FRAGMENTS_CACHE,
       g_param_spec_uint ("fragments-cache", "Fragments cache",
           "Number of fragments needed to be cached to start playing "
           "(DEPRECATED: Has no effect since 1.3.1)",
           1, G_MAXUINT, DEFAULT_FRAGMENTS_CACHE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_BITRATE_LIMIT,
-      g_param_spec_float ("bitrate-limit",
-          "Bitrate limit in %",
-          "Limit of the available bitrate to use when switching to alternates.",
-          0, 1, DEFAULT_BITRATE_LIMIT,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_CONNECTION_SPEED,
-      g_param_spec_uint ("connection-speed", "Connection Speed",
-          "Network connection speed in kbps (0 = unknown)",
-          0, G_MAXUINT / 1000, DEFAULT_CONNECTION_SPEED,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
+#endif
 
   element_class->change_state = GST_DEBUG_FUNCPTR (gst_hls_demux_change_state);
 
@@ -218,7 +180,25 @@
       "Marc-Andre Lureau <marcandre.lureau@gmail.com>\n"
       "Andoni Morales Alastruey <ylatuya@gmail.com>");
 
-  bin_class->handle_message = gst_hls_demux_handle_message;
+  adaptivedemux_class->is_live = gst_hls_demux_is_live;
+  adaptivedemux_class->get_live_seek_range = gst_hls_demux_get_live_seek_range;
+  adaptivedemux_class->get_duration = gst_hls_demux_get_duration;
+  adaptivedemux_class->get_manifest_update_interval =
+      gst_hls_demux_get_manifest_update_interval;
+  adaptivedemux_class->process_manifest = gst_hls_demux_process_manifest;
+  adaptivedemux_class->update_manifest = gst_hls_demux_update_manifest;
+  adaptivedemux_class->reset = gst_hls_demux_reset;
+  adaptivedemux_class->seek = gst_hls_demux_seek;
+  adaptivedemux_class->stream_has_next_fragment =
+      gst_hls_demux_stream_has_next_fragment;
+  adaptivedemux_class->stream_advance_fragment = gst_hls_demux_advance_fragment;
+  adaptivedemux_class->stream_update_fragment_info =
+      gst_hls_demux_update_fragment_info;
+  adaptivedemux_class->stream_select_bitrate = gst_hls_demux_select_bitrate;
+
+  adaptivedemux_class->start_fragment = gst_hls_demux_start_fragment;
+  adaptivedemux_class->finish_fragment = gst_hls_demux_finish_fragment;
+  adaptivedemux_class->data_received = gst_hls_demux_data_received;
 
   GST_DEBUG_CATEGORY_INIT (gst_hls_demux_debug, "hlsdemux", 0,
       "hlsdemux element");
@@ -227,61 +207,20 @@
 static void
 gst_hls_demux_init (GstHLSDemux * demux)
 {
-  /* sink pad */
-  demux->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
-  gst_pad_set_chain_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_hls_demux_chain));
-  gst_pad_set_event_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_hls_demux_sink_event));
-  gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
-
   /* Downloader */
   demux->downloader = gst_uri_downloader_new ();
 
   demux->do_typefind = TRUE;
 
-  /* Properties */
-  demux->bitrate_limit = DEFAULT_BITRATE_LIMIT;
-  demux->connection_speed = DEFAULT_CONNECTION_SPEED;
-
-  g_mutex_init (&demux->download_lock);
-  g_cond_init (&demux->download_cond);
-  g_mutex_init (&demux->updates_timed_lock);
-  g_cond_init (&demux->updates_timed_cond);
-  g_mutex_init (&demux->fragment_download_lock);
-  g_cond_init (&demux->fragment_download_cond);
-
-  /* Updates task */
-  g_rec_mutex_init (&demux->updates_lock);
-  demux->updates_task =
-      gst_task_new ((GstTaskFunction) gst_hls_demux_updates_loop, demux, NULL);
-  gst_task_set_lock (demux->updates_task, &demux->updates_lock);
-
-  /* Streaming task */
-  g_rec_mutex_init (&demux->stream_lock);
-  demux->stream_task =
-      gst_task_new ((GstTaskFunction) gst_hls_demux_stream_loop, demux, NULL);
-  gst_task_set_lock (demux->stream_task, &demux->stream_lock);
-
-  demux->have_group_id = FALSE;
-  demux->group_id = G_MAXUINT;
 }
 
 static void
 gst_hls_demux_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
-  GstHLSDemux *demux = GST_HLS_DEMUX (object);
-
   switch (prop_id) {
     case PROP_FRAGMENTS_CACHE:
       break;
-    case PROP_BITRATE_LIMIT:
-      demux->bitrate_limit = g_value_get_float (value);
-      break;
-    case PROP_CONNECTION_SPEED:
-      demux->connection_speed = g_value_get_uint (value) * 1000;
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -292,18 +231,10 @@
 gst_hls_demux_get_property (GObject * object, guint prop_id, GValue * value,
     GParamSpec * pspec)
 {
-  GstHLSDemux *demux = GST_HLS_DEMUX (object);
-
   switch (prop_id) {
     case PROP_FRAGMENTS_CACHE:
       g_value_set_uint (value, 1);
       break;
-    case PROP_BITRATE_LIMIT:
-      g_value_set_float (value, demux->bitrate_limit);
-      break;
-    case PROP_CONNECTION_SPEED:
-      g_value_set_uint (value, demux->connection_speed / 1000);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -318,12 +249,9 @@
 
   switch (transition) {
     case GST_STATE_CHANGE_READY_TO_PAUSED:
-      gst_hls_demux_reset (demux, FALSE);
+      gst_hls_demux_reset (GST_ADAPTIVE_DEMUX_CAST (demux));
       gst_uri_downloader_reset (demux->downloader);
       break;
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      demux->adapter = gst_adapter_new ();
-      break;
     default:
       break;
   }
@@ -332,14 +260,7 @@
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
-      gst_hls_demux_stop (demux);
-      gst_task_join (demux->updates_task);
-      gst_task_join (demux->stream_task);
-      gst_hls_demux_reset (demux, FALSE);
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      gst_object_unref (demux->adapter);
-      demux->adapter = NULL;
+      gst_hls_demux_reset (GST_ADAPTIVE_DEMUX_CAST (demux));
       break;
     default:
       break;
@@ -347,950 +268,513 @@
   return ret;
 }
 
-static void
-gst_hls_demux_handle_message (GstBin * bin, GstMessage * msg)
+static GstPad *
+gst_hls_demux_create_pad (GstHLSDemux * hlsdemux)
 {
-  GstHLSDemux *demux = GST_HLS_DEMUX_CAST (bin);
+  gchar *name;
+  GstPadTemplate *tmpl;
+  GstPad *pad;
 
-  switch (GST_MESSAGE_TYPE (msg)) {
-    case GST_MESSAGE_ERROR:{
-      GError *err = NULL;
-      gchar *debug = NULL;
-      gchar *new_error = NULL;
+  name = g_strdup_printf ("src_%u", hlsdemux->srcpad_counter++);
+  tmpl = gst_static_pad_template_get (&srctemplate);
+  pad = gst_ghost_pad_new_no_target_from_template (name, tmpl);
+  gst_object_unref (tmpl);
+  g_free (name);
 
-      gst_message_parse_error (msg, &err, &debug);
+  return pad;
+}
 
-      GST_WARNING_OBJECT (demux, "Source posted error: %d:%d %s (%s)",
-          err->domain, err->code, err->message, debug);
+static guint64
+gst_hls_demux_get_bitrate (GstHLSDemux * hlsdemux)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (hlsdemux);
 
-      if (debug)
-        new_error = g_strdup_printf ("%s: %s\n", err->message, debug);
-      if (new_error) {
-        g_free (err->message);
-        err->message = new_error;
-      }
-
-      /* error, but ask to retry */
-      g_mutex_lock (&demux->fragment_download_lock);
-      demux->last_ret = GST_FLOW_CUSTOM_ERROR;
-      g_clear_error (&demux->last_error);
-      demux->last_error = g_error_copy (err);
-      g_cond_signal (&demux->fragment_download_cond);
-      g_mutex_unlock (&demux->fragment_download_lock);
-
-      g_error_free (err);
-      g_free (debug);
-      gst_message_unref (msg);
-      msg = NULL;
-    }
-      break;
-    default:
-      break;
+  /* Valid because hlsdemux only has a single output */
+  if (demux->streams) {
+    GstAdaptiveDemuxStream *stream = demux->streams->data;
+    return stream->current_download_rate;
   }
 
-  if (msg)
-    GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
+  return 0;
 }
 
 static gboolean
-gst_hls_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
 {
-  GstHLSDemux *demux;
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+  GstFormat format;
+  GstSeekFlags flags;
+  GstSeekType start_type, stop_type;
+  gint64 start, stop;
+  gdouble rate;
+  GList *walk;
+  GstClockTime current_pos, target_pos;
+  gint64 current_sequence;
+  GstM3U8MediaFile *file;
+  guint64 bitrate;
 
-  demux = GST_HLS_DEMUX (parent);
+  gst_event_parse_seek (seek, &rate, &format, &flags, &start_type, &start,
+      &stop_type, &stop);
 
-  switch (event->type) {
-    case GST_EVENT_SEEK:
-    {
-      gdouble rate;
-      GstFormat format;
-      GstSeekFlags flags;
-      GstSeekType start_type, stop_type;
-      gint64 start, stop;
-      GList *walk;
-      GstClockTime current_pos, target_pos;
-      gint64 current_sequence;
-      GstM3U8MediaFile *file;
+  bitrate = gst_hls_demux_get_bitrate (hlsdemux);
 
-      GST_INFO_OBJECT (demux, "Received GST_EVENT_SEEK");
-
-      if (gst_m3u8_client_is_live (demux->client)) {
-        GST_WARNING_OBJECT (demux, "Received seek event for live stream");
-        gst_event_unref (event);
-        return FALSE;
-      }
-
-      gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
-          &stop_type, &stop);
-
-      if (format != GST_FORMAT_TIME) {
-        gst_event_unref (event);
-        return FALSE;
-      }
-
-      if ((rate > 1.0 || rate < -1.0) && (!demux->client->main
-              || !demux->client->main->iframe_lists)) {
-        GST_ERROR_OBJECT (demux,
-            "Trick modes only allowed for streams with I-frame lists");
-        gst_event_unref (event);
-        return FALSE;
-      }
-
-      GST_DEBUG_OBJECT (demux, "seek event, rate: %f start: %" GST_TIME_FORMAT
-          " stop: %" GST_TIME_FORMAT, rate, GST_TIME_ARGS (start),
-          GST_TIME_ARGS (stop));
-
-      if (flags & GST_SEEK_FLAG_FLUSH) {
-        GST_DEBUG_OBJECT (demux, "sending flush start");
-        gst_pad_push_event (demux->srcpad, gst_event_new_flush_start ());
-      }
-
-      gst_hls_demux_pause_tasks (demux);
-
-      /* wait for streaming to finish */
-      g_rec_mutex_lock (&demux->updates_lock);
-      g_rec_mutex_unlock (&demux->updates_lock);
-
-      g_rec_mutex_lock (&demux->stream_lock);
-
-      /* properly cleanup pending decryption status */
-      if (flags & GST_SEEK_FLAG_FLUSH) {
-        if (demux->adapter)
-          gst_adapter_clear (demux->adapter);
-        if (demux->pending_buffer)
-          gst_buffer_unref (demux->pending_buffer);
-        demux->pending_buffer = NULL;
-        gst_hls_demux_decrypt_end (demux);
-      }
-
-      /* Use I-frame variants for trick modes */
-      if ((rate > 1.0 || rate < -1.0) && demux->segment.rate >= -1.0
-          && demux->segment.rate <= 1.0) {
-        GError *err = NULL;
-
-        GST_M3U8_CLIENT_LOCK (demux->client);
-        /* Switch to I-frame variant */
-        demux->client->main->current_variant =
-            demux->client->main->iframe_lists;
-        GST_M3U8_CLIENT_UNLOCK (demux->client);
-        gst_m3u8_client_set_current (demux->client,
-            demux->client->main->iframe_lists->data);
-        gst_uri_downloader_reset (demux->downloader);
-        if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
-          g_rec_mutex_unlock (&demux->stream_lock);
-          GST_ELEMENT_ERROR_FROM_ERROR (demux, "Could not switch playlist",
-              err);
-          gst_event_unref (event);
-          return FALSE;
-        }
-        demux->discont = TRUE;
-        demux->new_playlist = TRUE;
-        demux->do_typefind = TRUE;
-        demux->end_of_playlist = FALSE;
-
-        gst_hls_demux_change_playlist (demux,
-            demux->current_download_rate * demux->bitrate_limit / ABS (rate));
-      } else if (rate > -1.0 && rate <= 1.0 && (demux->segment.rate < -1.0
-              || demux->segment.rate > 1.0)) {
-        GError *err = NULL;
-
-        GST_M3U8_CLIENT_LOCK (demux->client);
-        /* Switch to normal variant */
-        demux->client->main->current_variant = demux->client->main->lists;
-        GST_M3U8_CLIENT_UNLOCK (demux->client);
-        gst_m3u8_client_set_current (demux->client,
-            demux->client->main->lists->data);
-
-        gst_uri_downloader_reset (demux->downloader);
-
-        if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
-          g_rec_mutex_unlock (&demux->stream_lock);
-
-          GST_ELEMENT_ERROR_FROM_ERROR (demux, "Could not switch playlist",
-              err);
-          gst_event_unref (event);
-          return FALSE;
-        }
-        demux->discont = TRUE;
-        demux->new_playlist = TRUE;
-        demux->do_typefind = TRUE;
-        demux->end_of_playlist = FALSE;
-
-        gst_hls_demux_change_playlist (demux,
-            demux->current_download_rate * demux->bitrate_limit);
-      }
-
-      GST_M3U8_CLIENT_LOCK (demux->client);
-      file = GST_M3U8_MEDIA_FILE (demux->client->current->files->data);
-      current_sequence = file->sequence;
-      current_pos = 0;
-      target_pos = rate > 0 ? start : stop;
-      /* FIXME: Here we need proper discont handling */
-      for (walk = demux->client->current->files; walk; walk = walk->next) {
-        file = walk->data;
-
-        current_sequence = file->sequence;
-        if (current_pos <= target_pos
-            && target_pos < current_pos + file->duration) {
-          break;
-        }
-        current_pos += file->duration;
-      }
-      GST_M3U8_CLIENT_UNLOCK (demux->client);
-
-      if (walk == NULL) {
-        GST_DEBUG_OBJECT (demux, "seeking further than track duration");
-        current_sequence++;
-      }
-
-      GST_M3U8_CLIENT_LOCK (demux->client);
-      GST_DEBUG_OBJECT (demux, "seeking to sequence %u",
-          (guint) current_sequence);
-      demux->client->sequence = current_sequence;
-      demux->client->sequence_position = current_pos;
-      GST_M3U8_CLIENT_UNLOCK (demux->client);
-
-      gst_segment_do_seek (&demux->segment, rate, format, flags, start_type,
-          start, stop_type, stop, NULL);
-      demux->need_segment = TRUE;
-
-      if (flags & GST_SEEK_FLAG_FLUSH) {
-        GST_DEBUG_OBJECT (demux, "sending flush stop");
-        gst_pad_push_event (demux->srcpad, gst_event_new_flush_stop (TRUE));
-      }
-
-      demux->stop_updates_task = FALSE;
-      gst_uri_downloader_reset (demux->downloader);
-      demux->stop_stream_task = FALSE;
-
-      gst_task_start (demux->updates_task);
-      g_rec_mutex_unlock (&demux->stream_lock);
-
-      gst_event_unref (event);
-      return TRUE;
-    }
-    case GST_EVENT_LATENCY:{
-      /* Upstream and our internal source are irrelevant
-       * for latency, and we should not fail here to
-       * configure the latency */
-      gst_event_unref (event);
-      return TRUE;
-    }
-    default:
-      break;
+  /* properly cleanup pending decryption status */
+  if (flags & GST_SEEK_FLAG_FLUSH) {
+    gst_hls_demux_decrypt_end (hlsdemux);
   }
 
-  return gst_pad_event_default (pad, parent, event);
-}
+  /* Use I-frame variants for trick modes */
+  if (hlsdemux->client->main->iframe_lists && rate < -1.0
+      && demux->segment.rate >= -1.0 && demux->segment.rate <= 1.0) {
+    GError *err = NULL;
 
-static gboolean
-gst_hls_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  GstHLSDemux *demux;
-  GstQuery *query;
-  gboolean ret;
-
-  demux = GST_HLS_DEMUX (parent);
-
-  switch (event->type) {
-    case GST_EVENT_EOS:{
-      gchar *playlist = NULL;
-
-      if (demux->playlist == NULL) {
-        GST_WARNING_OBJECT (demux, "Received EOS without a playlist.");
-        break;
-      }
-
-      GST_DEBUG_OBJECT (demux,
-          "Got EOS on the sink pad: main playlist fetched");
-
-      query = gst_query_new_uri ();
-      ret = gst_pad_peer_query (demux->sinkpad, query);
-      if (ret) {
-        gboolean permanent;
-        gchar *uri, *redirect_uri;
-
-        gst_query_parse_uri (query, &uri);
-        gst_query_parse_uri_redirection (query, &redirect_uri);
-        gst_query_parse_uri_redirection_permanent (query, &permanent);
-
-        if (permanent && redirect_uri) {
-          gst_hls_demux_set_location (demux, redirect_uri, NULL);
-        } else {
-          gst_hls_demux_set_location (demux, uri, redirect_uri);
-        }
-        g_free (uri);
-        g_free (redirect_uri);
-      }
-      gst_query_unref (query);
-
-      playlist = gst_hls_src_buf_to_utf8_playlist (demux->playlist);
-      demux->playlist = NULL;
-      if (playlist == NULL) {
-        GST_WARNING_OBJECT (demux, "Error validating first playlist.");
-      } else if (!gst_m3u8_client_update (demux->client, playlist)) {
-        /* In most cases, this will happen if we set a wrong url in the
-         * source element and we have received the 404 HTML response instead of
-         * the playlist */
-        GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid playlist."),
-            (NULL));
-        return FALSE;
-      }
-
-      if (!ret && gst_m3u8_client_is_live (demux->client)) {
-        GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
-            ("Failed querying the playlist uri, "
-                "required for live sources."), (NULL));
-        return FALSE;
-      }
-
-      gst_task_start (demux->updates_task);
-      gst_event_unref (event);
-      return TRUE;
+    GST_M3U8_CLIENT_LOCK (hlsdemux->client);
+    /* Switch to I-frame variant */
+    hlsdemux->client->main->current_variant =
+        hlsdemux->client->main->iframe_lists;
+    GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
+    gst_m3u8_client_set_current (hlsdemux->client,
+        hlsdemux->client->main->iframe_lists->data);
+    gst_uri_downloader_reset (hlsdemux->downloader);
+    if (!gst_hls_demux_update_playlist (hlsdemux, FALSE, &err)) {
+      GST_ELEMENT_ERROR_FROM_ERROR (hlsdemux, "Could not switch playlist", err);
+      return FALSE;
     }
-    case GST_EVENT_SEGMENT:
-      /* Swallow newsegments, we'll push our own */
-      gst_event_unref (event);
-      return TRUE;
-    default:
-      break;
+    //hlsdemux->discont = TRUE;
+    hlsdemux->new_playlist = TRUE;
+    hlsdemux->do_typefind = TRUE;
+
+    gst_hls_demux_change_playlist (hlsdemux, bitrate / ABS (rate), NULL);
+  } else if (rate > -1.0 && rate <= 1.0 && (demux->segment.rate < -1.0
+          || demux->segment.rate > 1.0)) {
+    GError *err = NULL;
+    GST_M3U8_CLIENT_LOCK (hlsdemux->client);
+    /* Switch to normal variant */
+    hlsdemux->client->main->current_variant = hlsdemux->client->main->lists;
+    GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
+    gst_m3u8_client_set_current (hlsdemux->client,
+        hlsdemux->client->main->lists->data);
+    gst_uri_downloader_reset (hlsdemux->downloader);
+    if (!gst_hls_demux_update_playlist (hlsdemux, FALSE, &err)) {
+      GST_ELEMENT_ERROR_FROM_ERROR (hlsdemux, "Could not switch playlist", err);
+      return FALSE;
+    }
+    //hlsdemux->discont = TRUE;
+    hlsdemux->new_playlist = TRUE;
+    hlsdemux->do_typefind = TRUE;
+    /* TODO why not continue using the same? that was being used up to now? */
+    gst_hls_demux_change_playlist (hlsdemux, bitrate, NULL);
   }
 
-  return gst_pad_event_default (pad, parent, event);
-}
+  GST_M3U8_CLIENT_LOCK (hlsdemux->client);
+  file = GST_M3U8_MEDIA_FILE (hlsdemux->client->current->files->data);
+  current_sequence = file->sequence;
+  current_pos = 0;
+  target_pos = rate > 0 ? start : stop;
+  /* FIXME: Here we need proper discont handling */
+  for (walk = hlsdemux->client->current->files; walk; walk = walk->next) {
+    file = walk->data;
 
-static gboolean
-gst_hls_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
-{
-  GstHLSDemux *hlsdemux;
-  gboolean ret = FALSE;
-
-  if (query == NULL)
-    return FALSE;
-
-  hlsdemux = GST_HLS_DEMUX (parent);
-
-  switch (query->type) {
-    case GST_QUERY_DURATION:{
-      GstClockTime duration = -1;
-      GstFormat fmt;
-
-      gst_query_parse_duration (query, &fmt, NULL);
-      if (fmt == GST_FORMAT_TIME) {
-        duration = gst_m3u8_client_get_duration (hlsdemux->client);
-        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) {
-          gst_query_set_duration (query, GST_FORMAT_TIME, duration);
-          ret = TRUE;
-        }
-      }
-      GST_INFO_OBJECT (hlsdemux, "GST_QUERY_DURATION returns %s with duration %"
-          GST_TIME_FORMAT, ret ? "TRUE" : "FALSE", GST_TIME_ARGS (duration));
+    current_sequence = file->sequence;
+    if (current_pos <= target_pos && target_pos < current_pos + file->duration) {
       break;
     }
-    case GST_QUERY_URI:
-      if (hlsdemux->client) {
-        /* FIXME: Do we answer with the variant playlist, with the current
-         * playlist or the the uri of the least downlowaded fragment? */
-        gst_query_set_uri (query, gst_m3u8_client_get_uri (hlsdemux->client));
-        ret = TRUE;
-      }
-      break;
-    case GST_QUERY_SEEKING:{
-      GstFormat fmt;
-      gint64 stop = -1;
+    current_pos += file->duration;
+  }
+  GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
 
-      gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
-      GST_INFO_OBJECT (hlsdemux, "Received GST_QUERY_SEEKING with format %d",
-          fmt);
-      if (fmt == GST_FORMAT_TIME) {
-        GstClockTime duration;
-
-        duration = gst_m3u8_client_get_duration (hlsdemux->client);
-        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0)
-          stop = duration;
-
-        gst_query_set_seeking (query, fmt,
-            !gst_m3u8_client_is_live (hlsdemux->client), 0, stop);
-        ret = TRUE;
-        GST_INFO_OBJECT (hlsdemux, "GST_QUERY_SEEKING returning with stop : %"
-            GST_TIME_FORMAT, GST_TIME_ARGS (stop));
-      }
-      break;
-    }
-    default:
-      /* Don't fordward queries upstream because of the special nature of this
-       * "demuxer", which relies on the upstream element only to be fed with the
-       * first playlist */
-      break;
+  if (walk == NULL) {
+    GST_DEBUG_OBJECT (demux, "seeking further than track duration");
+    current_sequence++;
   }
 
-  return ret;
+  GST_M3U8_CLIENT_LOCK (hlsdemux->client);
+  GST_DEBUG_OBJECT (demux, "seeking to sequence %u", (guint) current_sequence);
+  hlsdemux->reset_pts = TRUE;
+  hlsdemux->client->sequence = current_sequence;
+  hlsdemux->client->sequence_position = current_pos;
+  GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
+
+  return TRUE;
 }
 
 static GstFlowReturn
-gst_hls_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
+gst_hls_demux_update_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
 {
-  GstHLSDemux *demux = GST_HLS_DEMUX (parent);
-
-  if (demux->playlist == NULL)
-    demux->playlist = buf;
-  else
-    demux->playlist = gst_buffer_append (demux->playlist, buf);
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+  if (!gst_hls_demux_update_playlist (hlsdemux, TRUE, NULL))
+    return GST_FLOW_ERROR;
 
   return GST_FLOW_OK;
 }
 
-static void
-gst_hls_demux_pause_tasks (GstHLSDemux * demux)
+static gboolean
+gst_hls_demux_setup_streams (GstAdaptiveDemux * demux)
 {
-  if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) {
-    g_mutex_lock (&demux->updates_timed_lock);
-    demux->stop_updates_task = TRUE;
-    g_cond_signal (&demux->updates_timed_cond);
-    g_mutex_unlock (&demux->updates_timed_lock);
-    gst_uri_downloader_cancel (demux->downloader);
-    gst_task_pause (demux->updates_task);
-  }
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
 
-  if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) {
-    g_mutex_lock (&demux->download_lock);
-    demux->stop_stream_task = TRUE;
-    g_cond_signal (&demux->download_cond);
-    g_mutex_unlock (&demux->download_lock);
-    g_mutex_lock (&demux->fragment_download_lock);
-    g_cond_signal (&demux->fragment_download_cond);
-    g_mutex_unlock (&demux->fragment_download_lock);
-    gst_task_pause (demux->stream_task);
-  }
+  /* only 1 output supported */
+  gst_adaptive_demux_stream_new (demux, gst_hls_demux_create_pad (hlsdemux));
+
+  hlsdemux->reset_pts = TRUE;
+
+  return TRUE;
 }
 
-static void
-gst_hls_demux_stop (GstHLSDemux * demux)
+
+static gboolean
+gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
 {
-  if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) {
-    g_mutex_lock (&demux->updates_timed_lock);
-    demux->stop_updates_task = TRUE;
-    g_cond_signal (&demux->updates_timed_cond);
-    g_mutex_unlock (&demux->updates_timed_lock);
-    gst_uri_downloader_cancel (demux->downloader);
-    gst_task_stop (demux->updates_task);
-    g_rec_mutex_lock (&demux->updates_lock);
-    g_rec_mutex_unlock (&demux->updates_lock);
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+  gchar *playlist = NULL;
+
+  gst_hls_demux_set_location (hlsdemux, demux->manifest_uri,
+      demux->manifest_base_uri);
+
+  playlist = gst_hls_src_buf_to_utf8_playlist (buf);
+  if (playlist == NULL) {
+    GST_WARNING_OBJECT (demux, "Error validating first playlist.");
+    return FALSE;
+  } else if (!gst_m3u8_client_update (hlsdemux->client, playlist)) {
+    /* In most cases, this will happen if we set a wrong url in the
+     * source element and we have received the 404 HTML response instead of
+     * the playlist */
+    GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid playlist."), (NULL));
+    return FALSE;
   }
 
-  if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) {
-    g_mutex_lock (&demux->download_lock);
-    demux->stop_stream_task = TRUE;
-    g_cond_signal (&demux->download_cond);
-    g_mutex_unlock (&demux->download_lock);
-    g_mutex_lock (&demux->fragment_download_lock);
-    g_cond_signal (&demux->fragment_download_cond);
-    g_mutex_unlock (&demux->fragment_download_lock);
-    gst_task_stop (demux->stream_task);
-    g_rec_mutex_lock (&demux->stream_lock);
-    g_rec_mutex_unlock (&demux->stream_lock);
+  /* If this playlist is a variant playlist, select the first one
+   * and update it */
+  if (gst_m3u8_client_has_variant_playlist (hlsdemux->client)) {
+    GstM3U8 *child = NULL;
+    GError *err = NULL;
+
+    /* TODO seems like something that could be simplified */
+    if (demux->connection_speed == 0) {
+      GST_M3U8_CLIENT_LOCK (hlsdemux->client);
+      child = hlsdemux->client->main->current_variant->data;
+      GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
+    } else {
+      GList *tmp = gst_m3u8_client_get_playlist_for_bitrate (hlsdemux->client,
+          demux->connection_speed);
+
+      child = GST_M3U8 (tmp->data);
+    }
+
+    gst_m3u8_client_set_current (hlsdemux->client, child);
+    if (!gst_hls_demux_update_playlist (hlsdemux, FALSE, &err)) {
+      GST_ELEMENT_ERROR_FROM_ERROR (demux, "Could not fetch the child playlist",
+          err);
+      return FALSE;
+    }
   }
+
+  return gst_hls_demux_setup_streams (demux);
+}
+
+static GstClockTime
+gst_hls_demux_get_duration (GstAdaptiveDemux * demux)
+{
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+
+  return gst_m3u8_client_get_duration (hlsdemux->client);
+}
+
+static gboolean
+gst_hls_demux_is_live (GstAdaptiveDemux * demux)
+{
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+
+  return gst_m3u8_client_is_live (hlsdemux->client);
+}
+
+static gboolean
+gst_hls_demux_start_fragment (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+
+  if (hlsdemux->current_key) {
+    GError *err = NULL;
+    GstFragment *key_fragment;
+    GstBuffer *key_buffer;
+    GstMapInfo key_info;
+
+    /* new key? */
+    if (hlsdemux->key_url
+        && strcmp (hlsdemux->key_url, hlsdemux->current_key) == 0) {
+      key_fragment = g_object_ref (hlsdemux->key_fragment);
+    } else {
+      g_free (hlsdemux->key_url);
+      hlsdemux->key_url = NULL;
+
+      if (hlsdemux->key_fragment)
+        g_object_unref (hlsdemux->key_fragment);
+      hlsdemux->key_fragment = NULL;
+
+      GST_INFO_OBJECT (demux, "Fetching key %s", hlsdemux->current_key);
+      key_fragment =
+          gst_uri_downloader_fetch_uri (hlsdemux->downloader,
+          hlsdemux->current_key, hlsdemux->client->main ?
+          hlsdemux->client->main->uri : NULL, FALSE, FALSE,
+          hlsdemux->client->current ? hlsdemux->client->current->
+          allowcache : TRUE, &err);
+      if (key_fragment == NULL)
+        goto key_failed;
+      hlsdemux->key_url = g_strdup (hlsdemux->current_key);
+      hlsdemux->key_fragment = g_object_ref (key_fragment);
+    }
+
+    key_buffer = gst_fragment_get_buffer (key_fragment);
+    gst_buffer_map (key_buffer, &key_info, GST_MAP_READ);
+
+    gst_hls_demux_decrypt_start (hlsdemux, key_info.data, hlsdemux->current_iv);
+
+    gst_buffer_unmap (key_buffer, &key_info);
+    gst_buffer_unref (key_buffer);
+    g_object_unref (key_fragment);
+  }
+
+  return TRUE;
+
+key_failed:
+  /* TODO Raise this error to the user */
+  GST_WARNING_OBJECT (demux, "Failed to decrypt data");
+  return FALSE;
 }
 
 static GstFlowReturn
-_src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+gst_hls_demux_finish_fragment (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
 {
-  GstPad *srcpad = (GstPad *) parent;
-  GstHLSDemux *demux = (GstHLSDemux *) GST_PAD_PARENT (srcpad);
-  GstFlowReturn ret;
-  GstCaps *caps;
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+
+  if (hlsdemux->current_key)
+    gst_hls_demux_decrypt_end (hlsdemux);
+
+  /* ideally this should be empty, but this eos might have been
+   * caused by an error on the source element */
+  GST_DEBUG_OBJECT (demux, "Data still on the adapter when EOS was received"
+      ": %" G_GSIZE_FORMAT, gst_adapter_available (stream->adapter));
+  gst_adapter_clear (stream->adapter);
+
+  /* pending buffer is only used for encrypted streams */
+  if (stream->last_ret == GST_FLOW_OK) {
+    if (hlsdemux->pending_buffer) {
+      GstMapInfo info;
+      gsize unpadded_size;
+
+      /* Handle pkcs7 unpadding here */
+      gst_buffer_map (hlsdemux->pending_buffer, &info, GST_MAP_READ);
+      unpadded_size = info.size - info.data[info.size - 1];
+      gst_buffer_unmap (hlsdemux->pending_buffer, &info);
+
+      gst_buffer_resize (hlsdemux->pending_buffer, 0, unpadded_size);
+
+      gst_adaptive_demux_stream_push_buffer (stream, hlsdemux->pending_buffer);
+    }
+  } else {
+    if (hlsdemux->pending_buffer)
+      gst_buffer_unref (hlsdemux->pending_buffer);
+    hlsdemux->pending_buffer = NULL;
+  }
+
+  return gst_adaptive_demux_stream_advance_fragment (demux, stream,
+      stream->fragment.duration);
+}
+
+static GstFlowReturn
+gst_hls_demux_data_received (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
+  gsize available;
+  GstBuffer *buffer = NULL;
+
+  available = gst_adapter_available (stream->adapter);
 
   /* Is it encrypted? */
-  if (demux->current_key) {
+  if (hlsdemux->current_key) {
     GError *err = NULL;
     GstBuffer *tmp_buffer;
-    gsize available;
-
-    /* restart the decrypting lib for a new fragment */
-    if (demux->reset_crypto) {
-      GstFragment *key_fragment;
-      GstBuffer *key_buffer;
-      GstMapInfo key_info;
-
-      /* new key? */
-      if (demux->key_url && strcmp (demux->key_url, demux->current_key) == 0) {
-        key_fragment = g_object_ref (demux->key_fragment);
-      } else {
-        g_free (demux->key_url);
-        demux->key_url = NULL;
-
-        if (demux->key_fragment)
-          g_object_unref (demux->key_fragment);
-        demux->key_fragment = NULL;
-
-        GST_INFO_OBJECT (demux, "Fetching key %s", demux->current_key);
-        key_fragment =
-            gst_uri_downloader_fetch_uri (demux->downloader,
-            demux->current_key, demux->client->main ?
-            demux->client->main->uri : NULL, FALSE, FALSE,
-            demux->client->current ? demux->client->current->allowcache : TRUE,
-            &err);
-        if (key_fragment == NULL)
-          goto key_failed;
-        demux->key_url = g_strdup (demux->current_key);
-        demux->key_fragment = g_object_ref (key_fragment);
-      }
-
-      key_buffer = gst_fragment_get_buffer (key_fragment);
-      gst_buffer_map (key_buffer, &key_info, GST_MAP_READ);
-
-      gst_hls_demux_decrypt_start (demux, key_info.data, demux->current_iv);
-
-      gst_buffer_unmap (key_buffer, &key_info);
-      gst_buffer_unref (key_buffer);
-      g_object_unref (key_fragment);
-
-      demux->reset_crypto = FALSE;
-    }
-
-    gst_adapter_push (demux->adapter, buffer);
 
     /* must be a multiple of 16 */
-    available = gst_adapter_available (demux->adapter) & (~0xF);
+    available = available & (~0xF);
 
     if (available == 0) {
       return GST_FLOW_OK;
     }
 
-    buffer = gst_adapter_take_buffer (demux->adapter, available);
-    buffer = gst_hls_demux_decrypt_fragment (demux, buffer, &err);
+    buffer = gst_adapter_take_buffer (stream->adapter, available);
+    buffer = gst_hls_demux_decrypt_fragment (hlsdemux, buffer, &err);
     if (buffer == NULL) {
       GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Failed to decrypt buffer"),
           ("decryption failed %s", err->message));
       g_error_free (err);
-
-      demux->last_ret = GST_FLOW_ERROR;
       return GST_FLOW_ERROR;
     }
 
-    tmp_buffer = demux->pending_buffer;
-    demux->pending_buffer = buffer;
+    tmp_buffer = hlsdemux->pending_buffer;
+    hlsdemux->pending_buffer = buffer;
     buffer = tmp_buffer;
-  }
-
-  if (!buffer) {
-    return GST_FLOW_OK;
-  }
-
-  if (demux->starting_fragment) {
-    GST_LOG_OBJECT (demux, "set buffer pts=%" GST_TIME_FORMAT,
-        GST_TIME_ARGS (demux->current_timestamp));
-    GST_BUFFER_PTS (buffer) = demux->current_timestamp;
-
-    if (demux->segment.rate < 0)
-      /* Set DISCONT flag for every first buffer in reverse playback mode
-       * as each fragment for its own has to be reversed */
-      demux->discont = TRUE;
-    demux->starting_fragment = FALSE;
-    demux->segment.position = GST_BUFFER_PTS (buffer);
   } else {
-    GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
+    buffer = gst_adapter_take_buffer (stream->adapter, available);
+    if (hlsdemux->pending_buffer) {
+      buffer = gst_buffer_append (hlsdemux->pending_buffer, buffer);
+      hlsdemux->pending_buffer = NULL;
+    }
   }
 
-  GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
-  GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
+  if (G_UNLIKELY (hlsdemux->do_typefind && buffer != NULL)) {
+    GstCaps *caps = NULL;
+    GstMapInfo info;
+    guint buffer_size;
+    GstTypeFindProbability prob = GST_TYPE_FIND_NONE;
 
-  /* We actually need to do this every time we switch bitrate */
-  if (G_UNLIKELY (demux->do_typefind)) {
-    caps = gst_type_find_helper_for_buffer (NULL, buffer, NULL);
+    gst_buffer_map (buffer, &info, GST_MAP_READ);
+    buffer_size = info.size;
+
+    /* Typefind could miss if buffer is too small. In this case we
+     * will retry later */
+    if (buffer_size >= (2 * 1024)) {
+      caps =
+          gst_type_find_helper_for_data (GST_OBJECT_CAST (hlsdemux), info.data,
+          info.size, &prob);
+    }
+    gst_buffer_unmap (buffer, &info);
+
     if (G_UNLIKELY (!caps)) {
-      GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND,
-          ("Could not determine type of stream"), (NULL));
-      gst_buffer_unref (buffer);
-      demux->last_ret = GST_FLOW_NOT_NEGOTIATED;
-      return GST_FLOW_NOT_NEGOTIATED;
+      /* Only fail typefinding if we already a good amount of data
+       * and we still don't know the type */
+      if (buffer_size > (2 * 1024 * 1024)) {
+        GST_ELEMENT_ERROR (hlsdemux, STREAM, TYPE_NOT_FOUND,
+            ("Could not determine type of stream"), (NULL));
+        gst_buffer_unref (buffer);
+        return GST_FLOW_NOT_NEGOTIATED;
+      } else {
+        if (hlsdemux->pending_buffer)
+          hlsdemux->pending_buffer =
+              gst_buffer_append (buffer, hlsdemux->pending_buffer);
+        else
+          hlsdemux->pending_buffer = buffer;
+        return GST_FLOW_OK;
+      }
     }
 
-    if (!demux->input_caps || !gst_caps_is_equal (caps, demux->input_caps)) {
-      gst_caps_replace (&demux->input_caps, caps);
+    GST_DEBUG_OBJECT (hlsdemux, "Typefind result: %" GST_PTR_FORMAT " prob:%d",
+        caps, prob);
+
+    if (!hlsdemux->input_caps
+        || !gst_caps_is_equal (caps, hlsdemux->input_caps)) {
+      gst_caps_replace (&hlsdemux->input_caps, caps);
       GST_INFO_OBJECT (demux, "Input source caps: %" GST_PTR_FORMAT,
-          demux->input_caps);
+          hlsdemux->input_caps);
     }
-    gst_pad_set_caps (srcpad, caps);
-    demux->do_typefind = FALSE;
-    gst_caps_unref (caps);
+    gst_adaptive_demux_stream_set_caps (stream, caps);
+    hlsdemux->do_typefind = FALSE;
   }
 
-  if (demux->discont) {
-    GST_DEBUG_OBJECT (demux, "Marking fragment as discontinuous");
-    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
-    demux->discont = FALSE;
-  } else {
-    GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
+  if (buffer) {
+    return gst_adaptive_demux_stream_push_buffer (stream, buffer);
   }
-
-  demux->starting_fragment = FALSE;
-
-  if (demux->need_segment) {
-    /* And send a newsegment */
-    GST_DEBUG_OBJECT (demux, "Sending segment event: %"
-        GST_SEGMENT_FORMAT, &demux->segment);
-    gst_pad_push_event (demux->srcpad, gst_event_new_segment (&demux->segment));
-    demux->need_segment = FALSE;
-  }
-
-  /* accumulate time and size to get this chunk */
-  demux->download_total_time +=
-      g_get_monotonic_time () - demux->download_start_time;
-  demux->download_total_bytes += gst_buffer_get_size (buffer);
-
-  ret = gst_proxy_pad_chain_default (pad, parent, buffer);
-  demux->download_start_time = g_get_monotonic_time ();
-
-  if (ret != GST_FLOW_OK) {
-    if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) {
-      GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL),
-          ("stream stopped, reason %s", gst_flow_get_name (ret)));
-      gst_pad_push_event (demux->srcpad, gst_event_new_eos ());
-    } else {
-      GST_DEBUG_OBJECT (demux, "stream stopped, reason %s",
-          gst_flow_get_name (ret));
-    }
-    gst_hls_demux_pause_tasks (demux);
-  }
-
-  /* avoid having the source handle the same error again */
-  demux->last_ret = ret;
-  ret = GST_FLOW_OK;
-
-  return ret;
-
-key_failed:
-  /* TODO Raise this error to the user */
-  GST_WARNING_OBJECT (demux, "Failed to decrypt data");
-  demux->last_ret = GST_FLOW_ERROR;
-  return GST_FLOW_ERROR;
+  return GST_FLOW_OK;
 }
 
 static gboolean
-_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_hls_demux_stream_has_next_fragment (GstAdaptiveDemuxStream * stream)
 {
-  GstPad *srcpad = GST_PAD_CAST (parent);
-  GstHLSDemux *demux = (GstHLSDemux *) GST_PAD_PARENT (srcpad);;
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (stream->demux);
 
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_EOS:
-      if (demux->current_key)
-        gst_hls_demux_decrypt_end (demux);
+  return gst_m3u8_client_has_next_fragment (hlsdemux->client,
+      stream->demux->segment.rate > 0);
+}
 
-      /* ideally this should be empty, but this eos might have been
-       * caused by an error on the source element */
-      GST_DEBUG_OBJECT (demux, "Data still on the adapter when EOS was received"
-          ": %" G_GSIZE_FORMAT, gst_adapter_available (demux->adapter));
-      gst_adapter_clear (demux->adapter);
+static GstFlowReturn
+gst_hls_demux_advance_fragment (GstAdaptiveDemuxStream * stream)
+{
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (stream->demux);
 
-      /* pending buffer is only used for encrypted streams */
-      if (demux->last_ret == GST_FLOW_OK) {
-        if (demux->pending_buffer) {
-          GstMapInfo info;
-          gsize unpadded_size;
+  gst_m3u8_client_advance_fragment (hlsdemux->client,
+      stream->demux->segment.rate > 0);
+  hlsdemux->reset_pts = FALSE;
+  return GST_FLOW_OK;
+}
 
-          /* Handle pkcs7 unpadding here */
-          gst_buffer_map (demux->pending_buffer, &info, GST_MAP_READ);
-          unpadded_size = info.size - info.data[info.size - 1];
-          gst_buffer_unmap (demux->pending_buffer, &info);
+static GstFlowReturn
+gst_hls_demux_update_fragment_info (GstAdaptiveDemuxStream * stream)
+{
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (stream->demux);
+  gchar *next_fragment_uri;
+  GstClockTime duration;
+  GstClockTime timestamp;
+  gboolean discont;
+  gint64 range_start, range_end;
+  gchar *key = NULL;
+  guint8 *iv = NULL;
 
-          gst_buffer_resize (demux->pending_buffer, 0, unpadded_size);
-
-          demux->download_total_time +=
-              g_get_monotonic_time () - demux->download_start_time;
-          demux->download_total_bytes +=
-              gst_buffer_get_size (demux->pending_buffer);
-          demux->last_ret = gst_pad_push (demux->srcpad, demux->pending_buffer);
-
-          demux->pending_buffer = NULL;
-        }
-      } else {
-        if (demux->pending_buffer)
-          gst_buffer_unref (demux->pending_buffer);
-        demux->pending_buffer = NULL;
-      }
-
-      GST_DEBUG_OBJECT (demux, "Fragment download finished");
-
-      g_mutex_lock (&demux->fragment_download_lock);
-      g_cond_signal (&demux->fragment_download_cond);
-      g_mutex_unlock (&demux->fragment_download_lock);
-      break;
-    default:
-      break;
+  if (!gst_m3u8_client_get_next_fragment (hlsdemux->client, &discont,
+          &next_fragment_uri, &duration, &timestamp, &range_start, &range_end,
+          &key, &iv, stream->demux->segment.rate > 0)) {
+    GST_INFO_OBJECT (hlsdemux, "This playlist doesn't contain more fragments");
+    return GST_FLOW_EOS;
   }
 
-  gst_event_unref (event);
+  /* set up our source for download */
+  if (hlsdemux->reset_pts || discont) {
+    stream->fragment.timestamp = timestamp;
+  } else {
+    stream->fragment.timestamp = GST_CLOCK_TIME_NONE;
+  }
 
-  return TRUE;
+  if (hlsdemux->current_key)
+    g_free (hlsdemux->current_key);
+  hlsdemux->current_key = key;
+  if (hlsdemux->current_iv)
+    g_free (hlsdemux->current_iv);
+  hlsdemux->current_iv = iv;
+  g_free (stream->fragment.uri);
+  stream->fragment.uri = next_fragment_uri;
+  stream->fragment.range_start = range_start;
+  stream->fragment.range_end = range_end;
+  if (discont)
+    stream->discont = discont;
+
+  return GST_FLOW_OK;
 }
 
 static gboolean
-_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
+gst_hls_demux_select_bitrate (GstAdaptiveDemuxStream * stream, guint64 bitrate)
 {
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_ALLOCATION:
-      return FALSE;
-      break;
-    default:
-      break;
-  }
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (stream->demux);
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (stream->demux);
+  gboolean changed = FALSE;
 
-  return gst_pad_query_default (pad, parent, query);
+  GST_M3U8_CLIENT_LOCK (hlsdemux->client);
+  if (!hlsdemux->client->main->lists) {
+    GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
+    return FALSE;
+  }
+  GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
+
+  /* FIXME: Currently several issues have be found when letting bitrate adaptation
+   * happen using trick modes (such as 'All streams finished without buffers') and
+   * the adaptive algorithm does not properly behave. */
+  if (demux->segment.rate != 1.0)
+    return FALSE;
+
+  gst_hls_demux_change_playlist (hlsdemux, bitrate, &changed);
+  if (changed)
+    gst_hls_demux_setup_streams (GST_ADAPTIVE_DEMUX_CAST (hlsdemux));
+  return changed;
 }
 
 static void
-switch_pads (GstHLSDemux * demux)
+gst_hls_demux_reset (GstAdaptiveDemux * ademux)
 {
-  GstPad *oldpad = demux->srcpad;
-  GstEvent *event;
-  gchar *stream_id;
-  gchar *name;
-  GstPadTemplate *tmpl;
-  GstProxyPad *internal_pad;
+  GstHLSDemux *demux = GST_HLS_DEMUX_CAST (ademux);
 
-  GST_DEBUG_OBJECT (demux, "Switching pad (oldpad:%p)", oldpad);
-
-  if (oldpad) {
-    gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (oldpad), NULL);
-  }
-
-  /* First create and activate new pad */
-  name = g_strdup_printf ("src_%u", demux->srcpad_counter++);
-  tmpl = gst_static_pad_template_get (&srctemplate);
-  demux->srcpad =
-      gst_ghost_pad_new_from_template (name, demux->src_srcpad, tmpl);
-  gst_object_unref (tmpl);
-  g_free (name);
-
-  /* set up our internal pad to drop all events from
-   * the http src we don't care about. On the chain function
-   * we just push the buffer forward, but this way hls can get
-   * the flow return from downstream */
-  internal_pad = gst_proxy_pad_get_internal (GST_PROXY_PAD (demux->srcpad));
-  gst_pad_set_chain_function (GST_PAD_CAST (internal_pad), _src_chain);
-  gst_pad_set_event_function (GST_PAD_CAST (internal_pad), _src_event);
-  /* need to set query otherwise deadlocks happen with allocation queries */
-  gst_pad_set_query_function (GST_PAD_CAST (internal_pad), _src_query);
-  gst_object_unref (internal_pad);
-
-  gst_pad_set_event_function (demux->srcpad,
-      GST_DEBUG_FUNCPTR (gst_hls_demux_src_event));
-  gst_pad_set_query_function (demux->srcpad,
-      GST_DEBUG_FUNCPTR (gst_hls_demux_src_query));
-  gst_pad_use_fixed_caps (demux->srcpad);
-  gst_pad_set_active (demux->srcpad, TRUE);
-
-  stream_id =
-      gst_pad_create_stream_id (demux->srcpad, GST_ELEMENT_CAST (demux), NULL);
-
-  event = gst_pad_get_sticky_event (demux->sinkpad, GST_EVENT_STREAM_START, 0);
-  if (event) {
-    if (gst_event_parse_group_id (event, &demux->group_id))
-      demux->have_group_id = TRUE;
-    else
-      demux->have_group_id = FALSE;
-    gst_event_unref (event);
-  } else if (!demux->have_group_id) {
-    demux->have_group_id = TRUE;
-    demux->group_id = gst_util_group_id_next ();
-  }
-  event = gst_event_new_stream_start (stream_id);
-  if (demux->have_group_id)
-    gst_event_set_group_id (event, demux->group_id);
-
-  gst_pad_push_event (demux->srcpad, event);
-  g_free (stream_id);
-
-  gst_element_add_pad (GST_ELEMENT (demux), demux->srcpad);
-
-  gst_element_no_more_pads (GST_ELEMENT (demux));
-
-  demux->new_playlist = FALSE;
-
-  if (oldpad) {
-    /* Push out EOS */
-    gst_pad_push_event (oldpad, gst_event_new_eos ());
-    gst_pad_set_active (oldpad, FALSE);
-    gst_element_remove_pad (GST_ELEMENT (demux), oldpad);
-  }
-}
-
-static void
-gst_hls_demux_configure_src_pad (GstHLSDemux * demux)
-{
-  if (G_UNLIKELY (!demux->srcpad || demux->new_playlist)) {
-    switch_pads (demux);
-    demux->need_segment = TRUE;
-  }
-}
-
-static void
-gst_hls_demux_stream_loop (GstHLSDemux * demux)
-{
-  gboolean end_of_playlist;
-  GError *err = NULL;
-
-  /* This task will download fragments as fast as possible, sends
-   * SEGMENT and CAPS events and switches pads if necessary.
-   * If downloading a fragment fails we try again up to 3 times
-   * after waiting a bit. If we're at the end of the playlist
-   * we wait for the playlist to update before getting the next
-   * fragment.
-   */
-  GST_DEBUG_OBJECT (demux, "Enter task");
-
-  if (demux->stop_stream_task)
-    goto pause_task;
-
-  /* Check if we're done with our segment */
-  if (demux->segment.rate > 0) {
-    if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop)
-        && demux->segment.position >= demux->segment.stop)
-      goto end_of_playlist;
-  } else {
-    if (GST_CLOCK_TIME_IS_VALID (demux->segment.start)
-        && demux->segment.position < demux->segment.start)
-      goto end_of_playlist;
-  }
-
-  demux->next_download = g_get_monotonic_time ();
-  if (!gst_hls_demux_get_next_fragment (demux, &end_of_playlist, &err)) {
-    if (demux->stop_stream_task) {
-      g_clear_error (&err);
-      goto pause_task;
-    }
-
-    if (end_of_playlist) {
-      if (!gst_m3u8_client_is_live (demux->client)) {
-        GST_DEBUG_OBJECT (demux, "End of playlist");
-        demux->end_of_playlist = TRUE;
-        goto end_of_playlist;
-      } else {
-        g_mutex_lock (&demux->download_lock);
-
-        /* Wait until we're cancelled or there's something for
-         * us to download in the playlist or the playlist
-         * became non-live */
-        while (TRUE) {
-          if (demux->stop_stream_task) {
-            g_mutex_unlock (&demux->download_lock);
-            goto pause_task;
-          }
-
-          /* Got a new fragment or not live anymore? */
-          if (gst_m3u8_client_get_next_fragment (demux->client, NULL, NULL,
-                  NULL, NULL, NULL, NULL, NULL, NULL, demux->segment.rate > 0)
-              || !gst_m3u8_client_is_live (demux->client))
-            break;
-
-          GST_DEBUG_OBJECT (demux,
-              "No fragment left but live playlist, wait a bit");
-          g_cond_wait (&demux->download_cond, &demux->download_lock);
-        }
-        g_mutex_unlock (&demux->download_lock);
-        GST_DEBUG_OBJECT (demux, "Retrying now");
-        return;
-      }
-    } else {
-      demux->download_failed_count++;
-      if (demux->download_failed_count <= DEFAULT_FAILED_COUNT) {
-        GST_WARNING_OBJECT (demux, "Could not fetch the next fragment");
-        g_clear_error (&err);
-
-        /* First try to update the playlist for non-live playlists
-         * in case the URIs have changed in the meantime. But only
-         * try it the first time, after that we're going to wait a
-         * a bit to not flood the server */
-        if (demux->download_failed_count == 1
-            && !gst_m3u8_client_is_live (demux->client)
-            && gst_hls_demux_update_playlist (demux, FALSE, &err)) {
-          /* Retry immediately, the playlist actually has changed */
-          GST_DEBUG_OBJECT (demux, "Updated the playlist");
-          return;
-        } else {
-          /* Wait half the fragment duration before retrying */
-          demux->next_download +=
-              gst_util_uint64_scale
-              (gst_m3u8_client_get_current_fragment_duration (demux->client),
-              G_USEC_PER_SEC, 2 * GST_SECOND);
-        }
-
-        g_clear_error (&err);
-
-        g_mutex_lock (&demux->download_lock);
-        if (demux->stop_stream_task) {
-          g_mutex_unlock (&demux->download_lock);
-          goto pause_task;
-        }
-        g_cond_wait_until (&demux->download_cond, &demux->download_lock,
-            demux->next_download);
-        g_mutex_unlock (&demux->download_lock);
-        GST_DEBUG_OBJECT (demux, "Retrying now");
-
-        /* Refetch the playlist now after we waited */
-        if (!gst_m3u8_client_is_live (demux->client)
-            && gst_hls_demux_update_playlist (demux, FALSE, &err)) {
-          GST_DEBUG_OBJECT (demux, "Updated the playlist");
-        }
-        return;
-      } else {
-        GST_ELEMENT_ERROR_FROM_ERROR (demux,
-            "Could not fetch the next fragment", err);
-        goto pause_task;
-      }
-    }
-  } else {
-    demux->download_failed_count = 0;
-    gst_m3u8_client_advance_fragment (demux->client, demux->segment.rate > 0);
-
-    if (demux->stop_updates_task) {
-      goto pause_task;
-    }
-  }
-
-  if (demux->stop_updates_task) {
-    goto pause_task;
-  }
-
-  /* try to switch to another bitrate if needed */
-  gst_hls_demux_switch_playlist (demux);
-  demux->download_total_bytes = 0;
-  demux->download_total_time = 0;
-
-  GST_DEBUG_OBJECT (demux, "Finished pushing fragment");
-
-  return;
-
-end_of_playlist:
-  {
-    GST_DEBUG_OBJECT (demux, "Reached end of playlist, sending EOS");
-
-    gst_hls_demux_configure_src_pad (demux);
-
-    gst_pad_push_event (demux->srcpad, gst_event_new_eos ());
-    gst_hls_demux_pause_tasks (demux);
-    return;
-  }
-
-pause_task:
-  {
-    GST_DEBUG_OBJECT (demux, "Pause task");
-    /* Pausing a stopped task will start it */
-    gst_hls_demux_pause_tasks (demux);
-    return;
-  }
-}
-
-static void
-gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose)
-{
-  demux->end_of_playlist = FALSE;
-  demux->stop_updates_task = FALSE;
   demux->do_typefind = TRUE;
-
-  demux->download_failed_count = 0;
+  demux->reset_pts = TRUE;
 
   g_free (demux->key_url);
   demux->key_url = NULL;
@@ -1304,49 +788,27 @@
     demux->input_caps = NULL;
   }
 
-  if (demux->playlist) {
-    gst_buffer_unref (demux->playlist);
-    demux->playlist = NULL;
-  }
-
   if (demux->client) {
     gst_m3u8_client_free (demux->client);
     demux->client = NULL;
   }
-
-  if (!dispose) {
-    demux->client = gst_m3u8_client_new ("", NULL);
-  }
-
-  gst_segment_init (&demux->segment, GST_FORMAT_TIME);
-  demux->need_segment = TRUE;
-  demux->discont = TRUE;
-
-  demux->have_group_id = FALSE;
-  demux->group_id = G_MAXUINT;
+  /* TODO recreated on hls only if reset was not for disposing */
+  demux->client = gst_m3u8_client_new ("", NULL);
 
   demux->srcpad_counter = 0;
-  if (demux->srcpad) {
-    gst_element_remove_pad (GST_ELEMENT_CAST (demux), demux->srcpad);
-    demux->srcpad = NULL;
-  }
-
-  if (demux->src) {
-    gst_element_set_state (demux->src, GST_STATE_NULL);
-  }
-
-  g_clear_error (&demux->last_error);
-
-  if (demux->adapter)
-    gst_adapter_clear (demux->adapter);
   if (demux->pending_buffer)
     gst_buffer_unref (demux->pending_buffer);
   demux->pending_buffer = NULL;
-  demux->current_key = NULL;
-  demux->current_iv = NULL;
-  gst_hls_demux_decrypt_end (demux);
+  if (demux->current_key) {
+    g_free (demux->current_key);
+    demux->current_key = NULL;
+  }
+  if (demux->current_iv) {
+    g_free (demux->current_iv);
+    demux->current_iv = NULL;
+  }
 
-  demux->current_download_rate = -1;
+  gst_hls_demux_decrypt_end (demux);
 }
 
 static gboolean
@@ -1361,122 +823,6 @@
   return TRUE;
 }
 
-void
-gst_hls_demux_updates_loop (GstHLSDemux * demux)
-{
-  /* Loop for updating of the playlist. This periodically checks if
-   * the playlist is updated and does so, then signals the streaming
-   * thread in case it can continue downloading now.
-   * For non-live playlists this thread is not doing much else than
-   * setting up the initial playlist and then stopping. */
-
-  /* block until the next scheduled update or the signal to quit this thread */
-  GST_DEBUG_OBJECT (demux, "Started updates task");
-
-  /* If this playlist is a variant playlist, select the first one
-   * and update it */
-  if (gst_m3u8_client_has_variant_playlist (demux->client)) {
-    GstM3U8 *child = NULL;
-    GError *err = NULL;
-
-    if (demux->connection_speed == 0) {
-      GST_M3U8_CLIENT_LOCK (demux->client);
-      child = demux->client->main->current_variant->data;
-      GST_M3U8_CLIENT_UNLOCK (demux->client);
-    } else {
-      GList *tmp = gst_m3u8_client_get_playlist_for_bitrate (demux->client,
-          demux->connection_speed);
-
-      child = GST_M3U8 (tmp->data);
-    }
-
-    gst_m3u8_client_set_current (demux->client, child);
-    if (!gst_hls_demux_update_playlist (demux, FALSE, &err)) {
-      GST_ELEMENT_ERROR_FROM_ERROR (demux, "Could not fetch the child playlist",
-          err);
-      goto error;
-    }
-  }
-
-  if (!gst_m3u8_client_is_live (demux->client)) {
-    GstClockTime duration = gst_m3u8_client_get_duration (demux->client);
-
-    GST_DEBUG_OBJECT (demux, "Sending duration message : %" GST_TIME_FORMAT,
-        GST_TIME_ARGS (duration));
-    if (duration != GST_CLOCK_TIME_NONE)
-      gst_element_post_message (GST_ELEMENT (demux),
-          gst_message_new_duration_changed (GST_OBJECT (demux)));
-  }
-
-  /* Now start stream task */
-  gst_task_start (demux->stream_task);
-
-  demux->next_update =
-      g_get_monotonic_time () +
-      gst_util_uint64_scale (gst_m3u8_client_get_target_duration
-      (demux->client), G_USEC_PER_SEC, GST_SECOND);
-
-  /* Updating playlist only needed for live playlists */
-  while (gst_m3u8_client_is_live (demux->client)) {
-    GError *err = NULL;
-
-    /* Wait here until we should do the next update or we're cancelled */
-    GST_DEBUG_OBJECT (demux, "Wait for next playlist update");
-    g_mutex_lock (&demux->updates_timed_lock);
-    if (demux->stop_updates_task) {
-      g_mutex_unlock (&demux->updates_timed_lock);
-      goto quit;
-    }
-    g_cond_wait_until (&demux->updates_timed_cond, &demux->updates_timed_lock,
-        demux->next_update);
-    if (demux->stop_updates_task) {
-      g_mutex_unlock (&demux->updates_timed_lock);
-      goto quit;
-    }
-    g_mutex_unlock (&demux->updates_timed_lock);
-
-    GST_DEBUG_OBJECT (demux, "Updating playlist");
-    if (!gst_hls_demux_update_playlist (demux, TRUE, &err)) {
-      if (demux->stop_updates_task)
-        goto quit;
-      demux->client->update_failed_count++;
-      if (demux->client->update_failed_count <= DEFAULT_FAILED_COUNT) {
-        GST_WARNING_OBJECT (demux, "Could not update the playlist");
-        demux->next_update =
-            g_get_monotonic_time () +
-            gst_util_uint64_scale (gst_m3u8_client_get_target_duration
-            (demux->client), G_USEC_PER_SEC, 2 * GST_SECOND);
-      } else {
-        GST_ELEMENT_ERROR_FROM_ERROR (demux, "Could not update playlist", err);
-        goto error;
-      }
-    } else {
-      GST_DEBUG_OBJECT (demux, "Updated playlist successfully");
-      demux->next_update =
-          g_get_monotonic_time () +
-          gst_util_uint64_scale (gst_m3u8_client_get_target_duration
-          (demux->client), G_USEC_PER_SEC, GST_SECOND);
-      /* Wake up download task */
-      g_mutex_lock (&demux->download_lock);
-      g_cond_signal (&demux->download_cond);
-      g_mutex_unlock (&demux->download_lock);
-    }
-  }
-
-quit:
-  {
-    GST_DEBUG_OBJECT (demux, "Stopped updates task");
-    gst_task_pause (demux->updates_task);
-    return;
-  }
-
-error:
-  {
-    GST_DEBUG_OBJECT (demux, "Stopped updates task because of error");
-    gst_hls_demux_pause_tasks (demux);
-  }
-}
-
 static gchar *
 gst_hls_src_buf_to_utf8_playlist (GstBuffer * buf)
 {
@@ -1494,13 +840,11 @@
   memcpy (playlist, info.data, info.size);
 
   gst_buffer_unmap (buf, &info);
-  gst_buffer_unref (buf);
   return playlist;
 
 validate_error:
   gst_buffer_unmap (buf, &info);
 map_error:
-  gst_buffer_unref (buf);
   return NULL;
 }
 
@@ -1512,38 +856,45 @@
   GstBuffer *buf;
   gchar *playlist;
   gboolean main_checked = FALSE, updated = FALSE;
-  const gchar *uri;
+  gchar *uri, *main_uri;
 
 retry:
   uri = gst_m3u8_client_get_current_uri (demux->client);
+  main_uri = gst_m3u8_client_get_uri (demux->client);
   download =
-      gst_uri_downloader_fetch_uri (demux->downloader, uri,
-      demux->client->main ? demux->client->main->uri : NULL, TRUE, TRUE, TRUE,
-      err);
+      gst_uri_downloader_fetch_uri (demux->downloader, uri, main_uri,
+      TRUE, TRUE, TRUE, err);
+  g_free (main_uri);
   if (download == NULL) {
     if (update && !main_checked
         && gst_m3u8_client_has_variant_playlist (demux->client)
-        && demux->client->main) {
+        && gst_m3u8_client_has_main (demux->client)) {
       GError *err2 = NULL;
+      main_uri = gst_m3u8_client_get_uri (demux->client);
       GST_INFO_OBJECT (demux,
           "Updating playlist %s failed, attempt to refresh variant playlist %s",
-          uri, demux->client->main->uri);
+          uri, main_uri);
       download =
           gst_uri_downloader_fetch_uri (demux->downloader,
-          demux->client->main->uri, NULL, TRUE, TRUE, TRUE, &err2);
+          main_uri, NULL, TRUE, TRUE, TRUE, &err2);
+      g_free (main_uri);
       g_clear_error (&err2);
       if (download != NULL) {
         gchar *base_uri;
 
         buf = gst_fragment_get_buffer (download);
         playlist = gst_hls_src_buf_to_utf8_playlist (buf);
+        gst_buffer_unref (buf);
 
         if (playlist == NULL) {
           GST_WARNING_OBJECT (demux,
               "Failed to validate variant playlist encoding");
+          g_free (uri);
+          g_object_unref (download);
           return FALSE;
         }
 
+        g_free (uri);
         if (download->redirect_permanent && download->redirect_uri) {
           uri = download->redirect_uri;
           base_uri = NULL;
@@ -1555,6 +906,7 @@
         if (!gst_m3u8_client_update_variant_playlist (demux->client, playlist,
                 uri, base_uri)) {
           GST_WARNING_OBJECT (demux, "Failed to update the variant playlist");
+          g_object_unref (download);
           return FALSE;
         }
 
@@ -1564,12 +916,15 @@
         main_checked = TRUE;
         goto retry;
       } else {
+        g_free (uri);
         return FALSE;
       }
     } else {
+      g_free (uri);
       return FALSE;
     }
   }
+  g_free (uri);
 
   /* Set the base URI of the playlist to the redirect target if any */
   GST_M3U8_CLIENT_LOCK (demux->client);
@@ -1586,6 +941,7 @@
 
   buf = gst_fragment_get_buffer (download);
   playlist = gst_hls_src_buf_to_utf8_playlist (buf);
+  gst_buffer_unref (buf);
   g_object_unref (download);
 
   if (playlist == NULL) {
@@ -1617,7 +973,7 @@
     if (demux->client->sequence >= last_sequence - 3) {
       GST_DEBUG_OBJECT (demux, "Sequence is beyond playlist. Moving back to %u",
           (guint) (last_sequence - 3));
-      demux->need_segment = TRUE;
+      //demux->need_segment = TRUE;
       demux->client->sequence = last_sequence - 3;
     }
     GST_M3U8_CLIENT_UNLOCK (demux->client);
@@ -1631,8 +987,20 @@
      * position
      */
     GST_M3U8_CLIENT_LOCK (demux->client);
+
+    /* Valid because hlsdemux only has a single output */
+    if (GST_ADAPTIVE_DEMUX_CAST (demux)->streams) {
+      GstAdaptiveDemuxStream *stream =
+          GST_ADAPTIVE_DEMUX_CAST (demux)->streams->data;
+      target_pos = stream->segment.position;
+    } else {
+      target_pos = 0;
+    }
+    if (GST_CLOCK_TIME_IS_VALID (demux->client->sequence_position)) {
+      target_pos = MAX (target_pos, demux->client->sequence_position);
+    }
+
     current_pos = 0;
-    target_pos = demux->segment.position;
     for (walk = demux->client->current->files; walk; walk = walk->next) {
       GstM3U8MediaFile *file = walk->data;
 
@@ -1655,15 +1023,17 @@
 }
 
 static gboolean
-gst_hls_demux_change_playlist (GstHLSDemux * demux, guint max_bitrate)
+gst_hls_demux_change_playlist (GstHLSDemux * demux, guint max_bitrate,
+    gboolean * changed)
 {
   GList *previous_variant, *current_variant;
   gint old_bandwidth, new_bandwidth;
+  GstAdaptiveDemux *adaptive_demux = GST_ADAPTIVE_DEMUX_CAST (demux);
+  GstAdaptiveDemuxStream *stream;
 
-  /* If user specifies a connection speed never use a playlist with a bandwidth
-   * superior than it */
-  if (demux->connection_speed != 0 && max_bitrate > demux->connection_speed)
-    max_bitrate = demux->connection_speed;
+  g_return_val_if_fail (adaptive_demux->streams != NULL, FALSE);
+
+  stream = adaptive_demux->streams->data;
 
   previous_variant = demux->client->main->current_variant;
   current_variant = gst_m3u8_client_get_playlist_for_bitrate (demux->client,
@@ -1688,17 +1058,24 @@
 
   GST_INFO_OBJECT (demux, "Client was on %dbps, max allowed is %dbps, switching"
       " to bitrate %dbps", old_bandwidth, max_bitrate, new_bandwidth);
-  demux->discont = TRUE;
+  stream->discont = TRUE;
   demux->new_playlist = TRUE;
 
   if (gst_hls_demux_update_playlist (demux, FALSE, NULL)) {
-    GstStructure *s;
-
-    s = gst_structure_new ("playlist",
-        "uri", G_TYPE_STRING, gst_m3u8_client_get_current_uri (demux->client),
-        "bitrate", G_TYPE_INT, new_bandwidth, NULL);
+    gchar *uri;
+    gchar *main_uri;
+    uri = gst_m3u8_client_get_current_uri (demux->client);
+    main_uri = gst_m3u8_client_get_uri (demux->client);
     gst_element_post_message (GST_ELEMENT_CAST (demux),
-        gst_message_new_element (GST_OBJECT_CAST (demux), s));
+        gst_message_new_element (GST_OBJECT_CAST (demux),
+            gst_structure_new (STATISTICS_MESSAGE_NAME,
+                "manifest-uri", G_TYPE_STRING,
+                main_uri, "uri", G_TYPE_STRING,
+                uri, "bitrate", G_TYPE_INT, new_bandwidth, NULL)));
+    g_free (uri);
+    g_free (main_uri);
+    if (changed)
+      *changed = TRUE;
   } else {
     GList *failover = NULL;
 
@@ -1723,7 +1100,7 @@
         GST_M3U8 (g_list_first (demux->client->main->lists)->data)->bandwidth)
       return FALSE;
     else
-      return gst_hls_demux_change_playlist (demux, new_bandwidth - 1);
+      return gst_hls_demux_change_playlist (demux, new_bandwidth - 1, changed);
   }
 
   /* Force typefinding since we might have changed media type */
@@ -1732,42 +1109,44 @@
   return TRUE;
 }
 
+#if defined(HAVE_OPENSSL)
 static gboolean
-gst_hls_demux_switch_playlist (GstHLSDemux * demux)
+gst_hls_demux_decrypt_start (GstHLSDemux * demux, const guint8 * key_data,
+    const guint8 * iv_data)
 {
-  gint64 bitrate;
-
-  /* compare the time when the fragment was downloaded with the time when it was
-   * scheduled */
-  bitrate =
-      (demux->download_total_bytes * 8) / ((double) demux->download_total_time /
-      G_GUINT64_CONSTANT (1000000));
-
-  GST_DEBUG_OBJECT (demux,
-      "Downloaded %u bytes in %" GST_TIME_FORMAT ". Bitrate is : %d",
-      (guint) demux->download_total_bytes,
-      GST_TIME_ARGS (demux->download_total_time * GST_USECOND), (gint) bitrate);
-
-  /* Take old rate into account too */
-  if (demux->current_download_rate != -1)
-    bitrate = (demux->current_download_rate + bitrate * 3) / 4;
-  if (bitrate > G_MAXINT)
-    bitrate = G_MAXINT;
-  demux->current_download_rate = bitrate;
-
-  GST_DEBUG_OBJECT (demux, "Using current download rate: %d", (gint) bitrate);
-
-  GST_M3U8_CLIENT_LOCK (demux->client);
-  if (!demux->client->main->lists) {
-    GST_M3U8_CLIENT_UNLOCK (demux->client);
-    return TRUE;
-  }
-  GST_M3U8_CLIENT_UNLOCK (demux->client);
-
-  return gst_hls_demux_change_playlist (demux, bitrate * demux->bitrate_limit);
+  EVP_CIPHER_CTX_init (&demux->aes_ctx);
+  if (!EVP_DecryptInit_ex (&demux->aes_ctx, EVP_aes_128_cbc (), NULL, key_data,
+          iv_data))
+    return FALSE;
+  EVP_CIPHER_CTX_set_padding (&demux->aes_ctx, 0);
+  return TRUE;
 }
 
-#ifdef HAVE_NETTLE
+static gboolean
+decrypt_fragment (GstHLSDemux * demux, gsize length,
+    const guint8 * encrypted_data, guint8 * decrypted_data)
+{
+  int len, flen = 0;
+
+  if (G_UNLIKELY (length > G_MAXINT || length % 16 != 0))
+    return FALSE;
+
+  len = (int) length;
+  if (!EVP_DecryptUpdate (&demux->aes_ctx, decrypted_data, &len, encrypted_data,
+          len))
+    return FALSE;
+  EVP_DecryptFinal_ex (&demux->aes_ctx, decrypted_data + len, &flen);
+  g_return_val_if_fail (len + flen == length, FALSE);
+  return TRUE;
+}
+
+static void
+gst_hls_demux_decrypt_end (GstHLSDemux * demux)
+{
+  EVP_CIPHER_CTX_cleanup (&demux->aes_ctx);
+}
+
+#elif defined(HAVE_NETTLE)
 static gboolean
 gst_hls_demux_decrypt_start (GstHLSDemux * demux, const guint8 * key_data,
     const guint8 * iv_data)
@@ -1887,196 +1266,20 @@
   return NULL;
 }
 
-static gboolean
-gst_hls_demux_update_source (GstHLSDemux * demux, const gchar * uri,
-    const gchar * referer, gboolean refresh, gboolean allow_cache)
+static gint64
+gst_hls_demux_get_manifest_update_interval (GstAdaptiveDemux * demux)
 {
-  if (!gst_uri_is_valid (uri))
-    return FALSE;
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
 
-  if (demux->src != NULL) {
-    gchar *old_protocol, *new_protocol;
-    gchar *old_uri;
-
-    old_uri = gst_uri_handler_get_uri (GST_URI_HANDLER (demux->src));
-    old_protocol = gst_uri_get_protocol (old_uri);
-    new_protocol = gst_uri_get_protocol (uri);
-
-    if (!g_str_equal (old_protocol, new_protocol)) {
-      gst_object_unref (demux->src_srcpad);
-      gst_element_set_state (demux->src, GST_STATE_NULL);
-      gst_bin_remove (GST_BIN_CAST (demux), demux->src);
-      demux->src = NULL;
-      demux->src_srcpad = NULL;
-      GST_DEBUG_OBJECT (demux, "Can't re-use old source element");
-    } else {
-      GError *err = NULL;
-
-      GST_DEBUG_OBJECT (demux, "Re-using old source element");
-      if (!gst_uri_handler_set_uri (GST_URI_HANDLER (demux->src), uri, &err)) {
-        GST_DEBUG_OBJECT (demux, "Failed to re-use old source element: %s",
-            err->message);
-        g_clear_error (&err);
-        gst_element_set_state (demux->src, GST_STATE_NULL);
-        gst_bin_remove (GST_BIN_CAST (demux), demux->src);
-        demux->src = NULL;
-      }
-    }
-    g_free (old_uri);
-    g_free (old_protocol);
-    g_free (new_protocol);
-  }
-
-  if (demux->src == NULL) {
-    GObjectClass *gobject_class;
-
-    demux->src = gst_element_make_from_uri (GST_URI_SRC, uri, NULL, NULL);
-    if (demux->src == NULL) {
-      GST_WARNING_OBJECT (demux, "No element to handle uri: %s", uri);
-      return FALSE;
-    }
-
-    gobject_class = G_OBJECT_GET_CLASS (demux->src);
-
-    if (g_object_class_find_property (gobject_class, "compress"))
-      g_object_set (demux->src, "compress", FALSE, NULL);
-    if (g_object_class_find_property (gobject_class, "keep-alive"))
-      g_object_set (demux->src, "keep-alive", TRUE, NULL);
-    if (g_object_class_find_property (gobject_class, "extra-headers")) {
-      if (referer || refresh || !allow_cache) {
-        GstStructure *extra_headers = gst_structure_new_empty ("headers");
-
-        if (referer)
-          gst_structure_set (extra_headers, "Referer", G_TYPE_STRING, referer,
-              NULL);
-
-        if (!allow_cache)
-          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
-              "no-cache", NULL);
-        else if (refresh)
-          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
-              "max-age=0", NULL);
-
-        g_object_set (demux->src, "extra-headers", extra_headers, NULL);
-
-        gst_structure_free (extra_headers);
-      } else {
-        g_object_set (demux->src, "extra-headers", NULL, NULL);
-      }
-    }
-
-    gst_element_set_locked_state (demux->src, TRUE);
-    gst_bin_add (GST_BIN_CAST (demux), demux->src);
-    demux->src_srcpad = gst_element_get_static_pad (demux->src, "src");
-  }
-  return TRUE;
+  return gst_util_uint64_scale (gst_m3u8_client_get_target_duration
+      (hlsdemux->client), G_USEC_PER_SEC, GST_SECOND);
 }
 
 static gboolean
-gst_hls_demux_get_next_fragment (GstHLSDemux * demux,
-    gboolean * end_of_playlist, GError ** err)
+gst_hls_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start,
+    gint64 * stop)
 {
-  const gchar *next_fragment_uri;
-  GstClockTime duration;
-  GstClockTime timestamp;
-  gboolean discont;
-  gint64 range_start, range_end;
-  const gchar *key = NULL;
-  const guint8 *iv = NULL;
+  GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
 
-  *end_of_playlist = FALSE;
-  if (!gst_m3u8_client_get_next_fragment (demux->client, &discont,
-          &next_fragment_uri, &duration, &timestamp, &range_start, &range_end,
-          &key, &iv, demux->segment.rate > 0)) {
-    GST_INFO_OBJECT (demux, "This playlist doesn't contain more fragments");
-    *end_of_playlist = TRUE;
-    return FALSE;
-  }
-
-  g_mutex_lock (&demux->fragment_download_lock);
-  GST_DEBUG_OBJECT (demux,
-      "Fetching next fragment %s %" GST_TIME_FORMAT "(range=%" G_GINT64_FORMAT
-      "-%" G_GINT64_FORMAT ")", next_fragment_uri, GST_TIME_ARGS (timestamp),
-      range_start, range_end);
-
-  /* set up our source for download */
-  demux->current_timestamp = timestamp;
-  demux->current_duration = duration;
-  demux->starting_fragment = TRUE;
-  demux->reset_crypto = TRUE;
-  demux->current_key = key;
-  demux->current_iv = iv;
-
-  /* Reset last flow return */
-  demux->last_ret = GST_FLOW_OK;
-  g_clear_error (&demux->last_error);
-
-  if (!gst_hls_demux_update_source (demux, next_fragment_uri,
-          demux->client->main ? demux->client->main->uri : NULL,
-          FALSE,
-          demux->client->current ? demux->client->current->allowcache : TRUE)) {
-    *err =
-        g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_MISSING_PLUGIN,
-        "Missing plugin to handle URI: '%s'", next_fragment_uri);
-    g_mutex_unlock (&demux->fragment_download_lock);
-    return FALSE;
-  }
-
-  gst_hls_demux_configure_src_pad (demux);
-
-  if (gst_element_set_state (demux->src,
-          GST_STATE_READY) != GST_STATE_CHANGE_FAILURE) {
-    if (range_start != 0 || range_end != -1) {
-      if (!gst_element_send_event (demux->src, gst_event_new_seek (1.0,
-                  GST_FORMAT_BYTES, (GstSeekFlags) GST_SEEK_FLAG_FLUSH,
-                  GST_SEEK_TYPE_SET, range_start, GST_SEEK_TYPE_SET,
-                  range_end))) {
-
-        /* looks like the source can't handle seeks in READY */
-        *err = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_NOT_IMPLEMENTED,
-            "Source element can't handle range requests");
-        demux->last_ret = GST_FLOW_ERROR;
-      }
-    }
-
-    if (G_LIKELY (demux->last_ret == GST_FLOW_OK)) {
-      /* flush the proxypads so that the EOS state is reset */
-      gst_pad_push_event (demux->src_srcpad, gst_event_new_flush_start ());
-      gst_pad_push_event (demux->src_srcpad, gst_event_new_flush_stop (TRUE));
-
-      demux->download_start_time = g_get_monotonic_time ();
-      gst_element_sync_state_with_parent (demux->src);
-
-      /* wait for the fragment to be completely downloaded */
-      GST_DEBUG_OBJECT (demux, "Waiting for fragment download to finish: %s",
-          next_fragment_uri);
-      g_cond_wait (&demux->fragment_download_cond,
-          &demux->fragment_download_lock);
-    }
-  } else {
-    demux->last_ret = GST_FLOW_CUSTOM_ERROR;
-  }
-  g_mutex_unlock (&demux->fragment_download_lock);
-
-  if (demux->last_ret != GST_FLOW_OK) {
-    gst_element_set_state (demux->src, GST_STATE_NULL);
-    if (*err == NULL) {
-      if (demux->last_error) {
-        *err = demux->last_error;
-        demux->last_error = NULL;
-      } else {
-        *err = g_error_new (GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
-            "Failed to download fragment");
-      }
-    }
-  } else {
-    gst_element_set_state (demux->src, GST_STATE_READY);
-    if (demux->segment.rate > 0)
-      demux->segment.position += demux->current_duration;
-  }
-
-  if (demux->last_ret != GST_FLOW_OK)
-    return FALSE;
-
-  return TRUE;
+  return gst_m3u8_client_get_seek_range (hlsdemux->client, start, stop);
 }
diff --git a/ext/hls/gsthlsdemux.h b/ext/hls/gsthlsdemux.h
index 76f6f84..77f7414 100644
--- a/ext/hls/gsthlsdemux.h
+++ b/ext/hls/gsthlsdemux.h
@@ -25,11 +25,13 @@
 #define __GST_HLS_DEMUX_H__
 
 #include <gst/gst.h>
-#include <gst/base/gstadapter.h>
 #include "m3u8.h"
 #include "gstfragmented.h"
 #include <gst/uridownloader/gsturidownloader.h>
-#ifdef HAVE_NETTLE
+#include <gst/adaptivedemux/gstadaptivedemux.h>
+#if defined(HAVE_OPENSSL)
+#include <openssl/evp.h>
+#elif defined(HAVE_NETTLE)
 #include <nettle/aes.h>
 #include <nettle/cbc.h>
 #else
@@ -61,16 +63,10 @@
  */
 struct _GstHLSDemux
 {
-  GstBin parent;
+  GstAdaptiveDemux parent;
 
-  GstPad *sinkpad;
-  GstPad *srcpad;
   gint srcpad_counter;
 
-  gboolean have_group_id;
-  guint group_id;
-
-  GstBuffer *playlist;
   GstCaps *input_caps;
   GstUriDownloader *downloader;
   gchar *uri;                   /* Original playlist URI */
@@ -78,74 +74,35 @@
   gboolean do_typefind;         /* Whether we need to typefind the next buffer */
   gboolean new_playlist;        /* Whether a new playlist is about to start and pads should be switched */
 
-  /* Properties */
-  guint fragments_cache;        /* number of fragments needed to be cached to start playing */
-  gfloat bitrate_limit;         /* limit of the available bitrate to use */
-  guint connection_speed;       /* Network connection speed in kbps (0 = unknown) */
 
   /* Streaming task */
-  GstTask *stream_task;
-  GRecMutex stream_lock;
-  gboolean stop_stream_task;
-  GMutex download_lock;         /* Used for protecting queue and the two conds */
-  GCond download_cond;          /* Signalled when something is added to the queue */
-  gboolean end_of_playlist;
-  gint download_failed_count;
   gint64 next_download;
 
-  /* Updates task */
-  GstTask *updates_task;
-  GRecMutex updates_lock;
-  gint64 next_update;           /* Time of the next update */
-  gboolean stop_updates_task;
-  GMutex updates_timed_lock;
-  GCond updates_timed_cond;     /* Signalled when the playlist should be updated */
-
-  /* Position in the stream */
-  GstSegment segment;
-  gboolean need_segment;
-  gboolean discont;
-
   /* Cache for the last key */
   gchar *key_url;
   GstFragment *key_fragment;
 
-  /* Current download rate (bps) */
-  gint current_download_rate;
-
-  /* fragment download tooling */
-  GstElement *src;
-  GstPad *src_srcpad; /* handy link to src's src pad */
-  GMutex fragment_download_lock;
-  GCond fragment_download_cond;
-  GstClockTime current_timestamp;
-  GstClockTime current_duration;
-  gboolean starting_fragment;
-  gboolean reset_crypto;
-  gint64 download_start_time;
-  gint64 download_total_time;
-  gint64 download_total_bytes;
-  GstFlowReturn last_ret;
-  GError *last_error;
-
   /* decryption tooling */
-#ifdef HAVE_NETTLE
+#if defined(HAVE_OPENSSL)
+  EVP_CIPHER_CTX aes_ctx;
+#elif defined(HAVE_NETTLE)
   struct CBC_CTX (struct aes_ctx, AES_BLOCK_SIZE) aes_ctx;
 #else
   gcry_cipher_hd_t aes_ctx;
 #endif
-  const gchar *current_key;
-  const guint8 *current_iv;
-  GstAdapter *adapter; /* used to accumulate 16 bytes multiple chunks */
+  gchar *current_key;
+  guint8 *current_iv;
   GstBuffer *pending_buffer; /* decryption scenario:
                               * the last buffer can only be pushed when
                               * resized, so need to store and wait for
                               * EOS to know it is the last */
+
+  gboolean reset_pts;
 };
 
 struct _GstHLSDemuxClass
 {
-  GstBinClass parent_class;
+  GstAdaptiveDemuxClass parent_class;
 };
 
 GType gst_hls_demux_get_type (void);
diff --git a/ext/hls/gsthlssink.c b/ext/hls/gsthlssink.c
index 44093a6..ea337ea 100644
--- a/ext/hls/gsthlssink.c
+++ b/ext/hls/gsthlssink.c
@@ -51,6 +51,8 @@
 #define DEFAULT_TARGET_DURATION 15
 #define DEFAULT_PLAYLIST_LENGTH 5
 
+#define GST_M3U8_PLAYLIST_VERSION 3
+
 enum
 {
   PROP_0,
@@ -161,8 +163,9 @@
   g_object_class_install_property (gobject_class, PROP_PLAYLIST_LENGTH,
       g_param_spec_uint ("playlist-length", "Playlist length",
           "Length of HLS playlist. To allow players to conform to section 6.3.3 "
-          "of the HLS specification, this should be at least 3.",
-          1, G_MAXUINT, DEFAULT_PLAYLIST_LENGTH,
+          "of the HLS specification, this should be at least 3. If set to 0, "
+          "the playlist will be infinite.",
+          0, G_MAXUINT, DEFAULT_PLAYLIST_LENGTH,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
@@ -204,7 +207,9 @@
 
   if (sink->playlist)
     gst_m3u8_playlist_free (sink->playlist);
-  sink->playlist = gst_m3u8_playlist_new (6, sink->playlist_length, FALSE);
+  sink->playlist =
+      gst_m3u8_playlist_new (GST_M3U8_PLAYLIST_VERSION, sink->playlist_length,
+      FALSE);
 }
 
 static gboolean
@@ -252,8 +257,7 @@
   switch (message->type) {
     case GST_MESSAGE_ELEMENT:
     {
-      GFile *file;
-      const char *filename, *title;
+      const char *filename;
       char *playlist_content;
       GstClockTime running_time, duration;
       gboolean discont = FALSE;
@@ -270,8 +274,6 @@
       duration = running_time - sink->last_running_time;
       sink->last_running_time = running_time;
 
-      file = g_file_new_for_path (filename);
-      title = "ciao";
       GST_INFO_OBJECT (sink, "COUNT %d", sink->index);
       if (sink->playlist_root == NULL)
         entry_location = g_path_get_basename (filename);
@@ -281,8 +283,8 @@
         g_free (name);
       }
 
-      gst_m3u8_playlist_add_entry (sink->playlist, entry_location, file,
-          title, duration, sink->index, discont);
+      gst_m3u8_playlist_add_entry (sink->playlist, entry_location,
+          NULL, duration, sink->index, discont);
       g_free (entry_location);
       playlist_content = gst_m3u8_playlist_render (sink->playlist);
       if (!g_file_set_contents (sink->playlist_location,
diff --git a/ext/hls/gstm3u8playlist.c b/ext/hls/gstm3u8playlist.c
index f30a667..f2c556b 100644
--- a/ext/hls/gstm3u8playlist.c
+++ b/ext/hls/gstm3u8playlist.c
@@ -43,19 +43,17 @@
 };
 
 static GstM3U8Entry *
-gst_m3u8_entry_new (const gchar * url, GFile * file, const gchar * title,
+gst_m3u8_entry_new (const gchar * url, const gchar * title,
     gfloat duration, gboolean discontinuous)
 {
   GstM3U8Entry *entry;
 
   g_return_val_if_fail (url != NULL, NULL);
-  g_return_val_if_fail (title != NULL, NULL);
 
   entry = g_new0 (GstM3U8Entry, 1);
   entry->url = g_strdup (url);
   entry->title = g_strdup (title);
   entry->duration = duration;
-  entry->file = file;
   entry->discontinuous = discontinuous;
   return entry;
 }
@@ -67,8 +65,6 @@
 
   g_free (entry->url);
   g_free (entry->title);
-  if (entry->file != NULL)
-    g_object_unref (entry->file);
   g_free (entry);
 }
 
@@ -83,12 +79,12 @@
     return g_strdup_printf ("%s" M3U8_INT_INF_TAG,
         entry->discontinuous ? M3U8_DISCONTINUITY_TAG : "",
         (gint) ((entry->duration + 500 * GST_MSECOND) / GST_SECOND),
-        entry->title, entry->url);
+        entry->title ? entry->title : "", entry->url);
 
   return g_strdup_printf ("%s" M3U8_FLOAT_INF_TAG,
       entry->discontinuous ? M3U8_DISCONTINUITY_TAG : "",
       g_ascii_dtostr (buf, sizeof (buf), (entry->duration / GST_SECOND)),
-      entry->title, entry->url);
+      entry->title ? entry->title : "", entry->url);
 }
 
 GstM3U8Playlist *
@@ -120,21 +116,20 @@
 
 gboolean
 gst_m3u8_playlist_add_entry (GstM3U8Playlist * playlist,
-    const gchar * url, GFile * file, const gchar * title,
+    const gchar * url, const gchar * title,
     gfloat duration, guint index, gboolean discontinuous)
 {
   GstM3U8Entry *entry;
 
   g_return_val_if_fail (playlist != NULL, FALSE);
   g_return_val_if_fail (url != NULL, FALSE);
-  g_return_val_if_fail (title != NULL, FALSE);
 
   if (playlist->type == GST_M3U8_PLAYLIST_TYPE_VOD)
     return FALSE;
 
-  entry = gst_m3u8_entry_new (url, file, title, duration, discontinuous);
+  entry = gst_m3u8_entry_new (url, title, duration, discontinuous);
 
-  if (playlist->window_size != -1) {
+  if (playlist->window_size > 0) {
     /* Delete old entries from the playlist */
     while (playlist->entries->length >= playlist->window_size) {
       GstM3U8Entry *old_entry;
diff --git a/ext/hls/gstm3u8playlist.h b/ext/hls/gstm3u8playlist.h
index bc81aed..0e95132 100644
--- a/ext/hls/gstm3u8playlist.h
+++ b/ext/hls/gstm3u8playlist.h
@@ -36,7 +36,6 @@
   gfloat duration;
   gchar *title;
   gchar *url;
-  GFile *file;
   gboolean discontinuous;
 };
 
@@ -61,7 +60,6 @@
 void gst_m3u8_playlist_free (GstM3U8Playlist * playlist);
 gboolean gst_m3u8_playlist_add_entry (GstM3U8Playlist * playlist,
     				     const gchar * url,
-    				     GFile * file,
 				     const gchar *title,
 				     gfloat duration,
 				     guint index,
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
old mode 100644
new mode 100755
index 7fa9699..9645256
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -51,8 +51,8 @@
 
 static GstM3U8 *gst_m3u8_new (void);
 static void gst_m3u8_free (GstM3U8 * m3u8);
-static gboolean gst_m3u8_update (GstM3U8 * m3u8, gchar * data,
-    gboolean * updated);
+static gboolean gst_m3u8_update (GstM3U8Client * client, GstM3U8 * m3u8,
+    gchar * data, gboolean * updated);
 static GstM3U8MediaFile *gst_m3u8_media_file_new (gchar * uri,
     gchar * title, GstClockTime duration, guint sequence);
 static void gst_m3u8_media_file_free (GstM3U8MediaFile * self);
@@ -382,7 +382,8 @@
  * @data: a m3u8 playlist text data, taking ownership
  */
 static gboolean
-gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
+gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
+    gboolean * updated)
 {
   gint val;
   GstClockTime duration;
@@ -418,11 +419,13 @@
   g_free (self->last_data);
   self->last_data = data;
 
+  client->current_file = NULL;
   if (self->files) {
     g_list_foreach (self->files, (GFunc) gst_m3u8_media_file_free, NULL);
     g_list_free (self->files);
     self->files = NULL;
   }
+  client->duration = GST_CLOCK_TIME_NONE;
 
   /* By default, allow caching */
   self->allowcache = TRUE;
@@ -486,8 +489,7 @@
           if (offset != -1) {
             file->offset = offset;
           } else {
-            GstM3U8MediaFile *prev =
-                self->files ? g_list_last (self->files)->data : NULL;
+            GstM3U8MediaFile *prev = self->files ? self->files->data : NULL;
 
             if (!prev) {
               offset = 0;
@@ -507,156 +509,9 @@
         title = NULL;
         discontinuity = FALSE;
         size = offset = -1;
-        self->files = g_list_append (self->files, file);
+        self->files = g_list_prepend (self->files, file);
       }
 
-    } else if (g_str_has_prefix (data, "#EXT-X-ENDLIST")) {
-      self->endlist = TRUE;
-    } else if (g_str_has_prefix (data, "#EXT-X-VERSION:")) {
-      if (int_from_string (data + 15, &data, &val))
-        self->version = val;
-    } else if (g_str_has_prefix (data, "#EXT-X-STREAM-INF:") ||
-        g_str_has_prefix (data, "#EXT-X-I-FRAME-STREAM-INF:")) {
-      gchar *v, *a;
-      gboolean iframe = g_str_has_prefix (data, "#EXT-X-I-FRAME-STREAM-INF:");
-      GstM3U8 *new_list;
-
-      new_list = gst_m3u8_new ();
-      new_list->parent = self;
-      new_list->iframe = iframe;
-      data = data + (iframe ? 26 : 18);
-      while (data && parse_attributes (&data, &a, &v)) {
-        if (g_str_equal (a, "BANDWIDTH")) {
-          if (!int_from_string (v, NULL, &new_list->bandwidth))
-            GST_WARNING ("Error while reading BANDWIDTH");
-        } else if (g_str_equal (a, "PROGRAM-ID")) {
-          if (!int_from_string (v, NULL, &new_list->program_id))
-            GST_WARNING ("Error while reading PROGRAM-ID");
-        } else if (g_str_equal (a, "CODECS")) {
-          g_free (new_list->codecs);
-          new_list->codecs = g_strdup (v);
-        } else if (g_str_equal (a, "RESOLUTION")) {
-          if (!int_from_string (v, &v, &new_list->width))
-            GST_WARNING ("Error while reading RESOLUTION width");
-          if (!v || *v != 'x') {
-            GST_WARNING ("Missing height");
-          } else {
-            v = g_utf8_next_char (v);
-            if (!int_from_string (v, NULL, &new_list->height))
-              GST_WARNING ("Error while reading RESOLUTION height");
-          }
-        } else if (iframe && g_str_equal (a, "URI")) {
-          gchar *name;
-          gchar *uri = g_strdup (v);
-          gchar *urip = uri;
-
-          uri = unquote_string (uri);
-          if (uri) {
-            uri = uri_join (self->base_uri ? self->base_uri : self->uri, uri);
-
-            uri = uri_join (self->base_uri ? self->base_uri : self->uri, uri);
-            if (uri == NULL) {
-              g_free (urip);
-              continue;
-            }
-            name = g_strdup (uri);
-
-            gst_m3u8_set_uri (new_list, uri, NULL, name);
-          } else {
-            GST_WARNING
-                ("Cannot remove quotation marks from i-frame-stream URI");
-          }
-          g_free (urip);
-        }
-      }
-
-      if (iframe) {
-        if (g_list_find_custom (self->iframe_lists, new_list->uri,
-                (GCompareFunc) _m3u8_compare_uri)) {
-          GST_DEBUG ("Already have a list with this URI");
-          gst_m3u8_free (new_list);
-        } else {
-          self->iframe_lists = g_list_append (self->iframe_lists, new_list);
-        }
-      } else if (list != NULL) {
-        GST_WARNING ("Found a list without a uri..., dropping");
-        gst_m3u8_free (list);
-      } else {
-        list = new_list;
-      }
-    } else if (g_str_has_prefix (data, "#EXT-X-TARGETDURATION:")) {
-      if (int_from_string (data + 22, &data, &val))
-        self->targetduration = val * GST_SECOND;
-    } else if (g_str_has_prefix (data, "#EXT-X-MEDIA-SEQUENCE:")) {
-      if (int_from_string (data + 22, &data, &val))
-        self->mediasequence = val;
-    } else if (g_str_has_prefix (data, "#EXT-X-DISCONTINUITY")) {
-      discontinuity = TRUE;
-    } else if (g_str_has_prefix (data, "#EXT-X-PROGRAM-DATE-TIME:")) {
-      /* <YYYY-MM-DDThh:mm:ssZ> */
-      GST_DEBUG ("FIXME parse date");
-    } else if (g_str_has_prefix (data, "#EXT-X-ALLOW-CACHE:")) {
-      self->allowcache = g_ascii_strcasecmp (data + 19, "YES") == 0;
-    } else if (g_str_has_prefix (data, "#EXT-X-KEY:")) {
-      gchar *v, *a;
-
-      data = data + 11;
-
-      /* IV and KEY are only valid until the next #EXT-X-KEY */
-      have_iv = FALSE;
-      g_free (current_key);
-      current_key = NULL;
-      while (data && parse_attributes (&data, &a, &v)) {
-        if (g_str_equal (a, "URI")) {
-          gchar *key = g_strdup (v);
-          gchar *keyp = key;
-
-          key = unquote_string (key);
-          if (key) {
-            current_key =
-                uri_join (self->base_uri ? self->base_uri : self->uri, key);
-          } else {
-            GST_WARNING
-                ("Cannot remove quotation marks from decryption key URI");
-          }
-          g_free (keyp);
-        } else if (g_str_equal (a, "IV")) {
-          gchar *ivp = v;
-          gint i;
-
-          if (strlen (ivp) < 32 + 2 || (!g_str_has_prefix (ivp, "0x")
-                  && !g_str_has_prefix (ivp, "0X"))) {
-            GST_WARNING ("Can't read IV");
-            continue;
-          }
-
-          ivp += 2;
-          for (i = 0; i < 16; i++) {
-            gint h, l;
-
-            h = g_ascii_xdigit_value (*ivp);
-            ivp++;
-            l = g_ascii_xdigit_value (*ivp);
-            ivp++;
-            if (h == -1 || l == -1) {
-              i = -1;
-              break;
-            }
-            iv[i] = (h << 4) | l;
-          }
-
-          if (i == -1) {
-            GST_WARNING ("Can't read IV");
-            continue;
-          }
-          have_iv = TRUE;
-        } else if (g_str_equal (a, "METHOD")) {
-          if (!g_str_equal (v, "AES-128")) {
-            GST_WARNING ("Encryption method %s not supported", v);
-            continue;
-          }
-        }
-      }
     } else if (g_str_has_prefix (data, "#EXTINF:")) {
       gdouble fval;
       if (!double_from_string (data + 8, &data, &fval)) {
@@ -673,14 +528,166 @@
         g_free (title);
         title = g_strdup (data);
       }
-    } else if (g_str_has_prefix (data, "#EXT-X-BYTERANGE:")) {
-      gchar *v = data + 17;
+    } else if (g_str_has_prefix (data, "#EXT-X-")) {
+      gchar *data_ext_x = data + 7;
 
-      if (int64_from_string (v, &v, &size)) {
-        if (*v == '@' && !int64_from_string (v + 1, &v, &offset))
+      /* All these entries start with #EXT-X- */
+      if (g_str_has_prefix (data_ext_x, "ENDLIST")) {
+        self->endlist = TRUE;
+      } else if (g_str_has_prefix (data_ext_x, "VERSION:")) {
+        if (int_from_string (data + 15, &data, &val))
+          self->version = val;
+      } else if (g_str_has_prefix (data_ext_x, "STREAM-INF:") ||
+          g_str_has_prefix (data_ext_x, "I-FRAME-STREAM-INF:")) {
+        gchar *v, *a;
+        gboolean iframe = g_str_has_prefix (data_ext_x, "I-FRAME-STREAM-INF:");
+        GstM3U8 *new_list;
+
+        new_list = gst_m3u8_new ();
+        new_list->parent = self;
+        new_list->iframe = iframe;
+        data = data + (iframe ? 26 : 18);
+        while (data && parse_attributes (&data, &a, &v)) {
+          if (g_str_equal (a, "BANDWIDTH")) {
+            if (!int_from_string (v, NULL, &new_list->bandwidth))
+              GST_WARNING ("Error while reading BANDWIDTH");
+          } else if (g_str_equal (a, "PROGRAM-ID")) {
+            if (!int_from_string (v, NULL, &new_list->program_id))
+              GST_WARNING ("Error while reading PROGRAM-ID");
+          } else if (g_str_equal (a, "CODECS")) {
+            g_free (new_list->codecs);
+            new_list->codecs = g_strdup (v);
+          } else if (g_str_equal (a, "RESOLUTION")) {
+            if (!int_from_string (v, &v, &new_list->width))
+              GST_WARNING ("Error while reading RESOLUTION width");
+            if (!v || *v != 'x') {
+              GST_WARNING ("Missing height");
+            } else {
+              v = g_utf8_next_char (v);
+              if (!int_from_string (v, NULL, &new_list->height))
+                GST_WARNING ("Error while reading RESOLUTION height");
+            }
+          } else if (iframe && g_str_equal (a, "URI")) {
+            gchar *name;
+            gchar *uri = g_strdup (v);
+            gchar *urip = uri;
+
+            uri = unquote_string (uri);
+            if (uri) {
+              uri = uri_join (self->base_uri ? self->base_uri : self->uri, uri);
+              if (uri == NULL) {
+                g_free (urip);
+                continue;
+              }
+              name = g_strdup (uri);
+
+              gst_m3u8_set_uri (new_list, uri, NULL, name);
+            } else {
+              GST_WARNING
+                  ("Cannot remove quotation marks from i-frame-stream URI");
+            }
+            g_free (urip);
+          }
+        }
+
+        if (iframe) {
+          if (g_list_find_custom (self->iframe_lists, new_list->uri,
+                  (GCompareFunc) _m3u8_compare_uri)) {
+            GST_DEBUG ("Already have a list with this URI");
+            gst_m3u8_free (new_list);
+          } else {
+            self->iframe_lists = g_list_append (self->iframe_lists, new_list);
+          }
+        } else if (list != NULL) {
+          GST_WARNING ("Found a list without a uri..., dropping");
+          gst_m3u8_free (list);
+        } else {
+          list = new_list;
+        }
+      } else if (g_str_has_prefix (data_ext_x, "TARGETDURATION:")) {
+        if (int_from_string (data + 22, &data, &val))
+          self->targetduration = val * GST_SECOND;
+      } else if (g_str_has_prefix (data_ext_x, "MEDIA-SEQUENCE:")) {
+        if (int_from_string (data + 22, &data, &val))
+          self->mediasequence = val;
+      } else if (g_str_has_prefix (data_ext_x, "DISCONTINUITY")) {
+        discontinuity = TRUE;
+      } else if (g_str_has_prefix (data_ext_x, "PROGRAM-DATE-TIME:")) {
+        /* <YYYY-MM-DDThh:mm:ssZ> */
+        GST_DEBUG ("FIXME parse date");
+      } else if (g_str_has_prefix (data_ext_x, "ALLOW-CACHE:")) {
+        self->allowcache = g_ascii_strcasecmp (data + 19, "YES") == 0;
+      } else if (g_str_has_prefix (data_ext_x, "KEY:")) {
+        gchar *v, *a;
+
+        data = data + 11;
+
+        /* IV and KEY are only valid until the next #EXT-X-KEY */
+        have_iv = FALSE;
+        g_free (current_key);
+        current_key = NULL;
+        while (data && parse_attributes (&data, &a, &v)) {
+          if (g_str_equal (a, "URI")) {
+            gchar *key = g_strdup (v);
+            gchar *keyp = key;
+
+            key = unquote_string (key);
+            if (key) {
+              current_key =
+                  uri_join (self->base_uri ? self->base_uri : self->uri, key);
+            } else {
+              GST_WARNING
+                  ("Cannot remove quotation marks from decryption key URI");
+            }
+            g_free (keyp);
+          } else if (g_str_equal (a, "IV")) {
+            gchar *ivp = v;
+            gint i;
+
+            if (strlen (ivp) < 32 + 2 || (!g_str_has_prefix (ivp, "0x")
+                    && !g_str_has_prefix (ivp, "0X"))) {
+              GST_WARNING ("Can't read IV");
+              continue;
+            }
+
+            ivp += 2;
+            for (i = 0; i < 16; i++) {
+              gint h, l;
+
+              h = g_ascii_xdigit_value (*ivp);
+              ivp++;
+              l = g_ascii_xdigit_value (*ivp);
+              ivp++;
+              if (h == -1 || l == -1) {
+                i = -1;
+                break;
+              }
+              iv[i] = (h << 4) | l;
+            }
+
+            if (i == -1) {
+              GST_WARNING ("Can't read IV");
+              continue;
+            }
+            have_iv = TRUE;
+          } else if (g_str_equal (a, "METHOD")) {
+            if (!g_str_equal (v, "AES-128")) {
+              GST_WARNING ("Encryption method %s not supported", v);
+              continue;
+            }
+          }
+        }
+      } else if (g_str_has_prefix (data_ext_x, "BYTERANGE:")) {
+        gchar *v = data + 17;
+
+        if (int64_from_string (v, &v, &size)) {
+          if (*v == '@' && !int64_from_string (v + 1, &v, &offset))
+            goto next_line;
+        } else {
           goto next_line;
+        }
       } else {
-        goto next_line;
+        GST_LOG ("Ignored line: %s", data);
       }
     } else {
       GST_LOG ("Ignored line: %s", data);
@@ -695,6 +702,8 @@
   g_free (current_key);
   current_key = NULL;
 
+  self->files = g_list_reverse (self->files);
+
   /* reorder playlists by bitrate */
   if (self->lists) {
     gchar *top_variant_uri = NULL;
@@ -723,6 +732,38 @@
       self->current_variant = g_list_find_custom (self->lists, top_variant_uri,
           (GCompareFunc) _m3u8_compare_uri);
   }
+  /* calculate the start and end times of this media playlist. */
+  if (self->files) {
+    GList *walk;
+    GstM3U8MediaFile *file;
+    GstClockTime duration = 0;
+
+    for (walk = self->files; walk; walk = walk->next) {
+      file = walk->data;
+      duration += file->duration;
+      if (file->sequence > client->highest_sequence_number) {
+        if (client->highest_sequence_number >= 0) {
+          /* if an update of the media playlist has been missed, there
+             will be a gap between self->highest_sequence_number and the
+             first sequence number in this media playlist. In this situation
+             assume that the missing fragments had a duration of
+             targetduration each */
+          client->last_file_end +=
+              (file->sequence - client->highest_sequence_number -
+              1) * self->targetduration;
+        }
+        client->last_file_end += file->duration;
+        client->highest_sequence_number = file->sequence;
+      }
+    }
+    if (GST_M3U8_CLIENT_IS_LIVE (client)) {
+      client->first_file_start = client->last_file_end - duration;
+      GST_DEBUG ("Live playlist range %" GST_TIME_FORMAT " -> %"
+          GST_TIME_FORMAT, GST_TIME_ARGS (client->first_file_start),
+          GST_TIME_ARGS (client->last_file_end));
+    }
+    client->duration = duration;
+  }
 
   return TRUE;
 }
@@ -737,9 +778,12 @@
   client = g_new0 (GstM3U8Client, 1);
   client->main = gst_m3u8_new ();
   client->current = NULL;
+  client->current_file = NULL;
   client->sequence = -1;
   client->sequence_position = 0;
   client->update_failed_count = 0;
+  client->highest_sequence_number = -1;
+  client->duration = GST_CLOCK_TIME_NONE;
   g_mutex_init (&client->lock);
   gst_m3u8_set_uri (client->main, g_strdup (uri), g_strdup (base_uri), NULL);
 
@@ -765,6 +809,8 @@
   if (m3u8 != self->current) {
     self->current = m3u8;
     self->update_failed_count = 0;
+    self->duration = GST_CLOCK_TIME_NONE;
+    self->current_file = NULL;
   }
   GST_M3U8_CLIENT_UNLOCK (self);
 }
@@ -781,7 +827,7 @@
   GST_M3U8_CLIENT_LOCK (self);
   m3u8 = self->current ? self->current : self->main;
 
-  if (!gst_m3u8_update (m3u8, data, &updated))
+  if (!gst_m3u8_update (self, m3u8, data, &updated))
     goto out;
 
   if (!updated) {
@@ -804,8 +850,17 @@
   }
 
   if (m3u8->files && self->sequence == -1) {
-    self->sequence =
-        GST_M3U8_MEDIA_FILE (g_list_first (m3u8->files)->data)->sequence;
+    self->current_file = g_list_first (m3u8->files);
+    if (GST_M3U8_CLIENT_IS_LIVE (self)) {
+      /* for live streams, start GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE from
+         the end of the playlist. See section 6.3.3 of HLS draft */
+      gint pos =
+          g_list_length (m3u8->files) - GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE;
+      self->sequence =
+          GST_M3U8_MEDIA_FILE (g_list_nth_data (m3u8->files,
+              pos >= 0 ? pos : 0))->sequence;
+    } else
+      self->sequence = GST_M3U8_MEDIA_FILE (self->current_file->data)->sequence;
     self->sequence_position = 0;
     GST_DEBUG ("Setting first sequence at %u", (guint) self->sequence);
   }
@@ -913,30 +968,49 @@
 {
   GstM3U8MediaFile *file;
 
-  if (!forward)
+  if (forward) {
+    while (l) {
+      file = l->data;
+
+      if (file->sequence >= client->sequence)
+        break;
+
+      l = l->next;
+    }
+  } else {
     l = g_list_last (l);
 
-  while (l) {
-    file = l->data;
+    while (l) {
+      file = l->data;
 
-    if (forward && file->sequence >= client->sequence)
-      break;
-    else if (!forward && file->sequence <= client->sequence)
-      break;
+      if (file->sequence <= client->sequence)
+        break;
 
-    l = (forward ? l->next : l->prev);
+      l = l->prev;
+    }
   }
 
   return l;
 }
 
+static gboolean
+has_next_fragment (GstM3U8Client * client, GList * l, gboolean forward)
+{
+  l = find_next_fragment (client, l, forward);
+
+  if (l) {
+    return (forward && l->next) || (!forward && l->prev);
+  }
+
+  return FALSE;
+}
+
 gboolean
 gst_m3u8_client_get_next_fragment (GstM3U8Client * client,
-    gboolean * discontinuity, const gchar ** uri, GstClockTime * duration,
+    gboolean * discontinuity, gchar ** uri, GstClockTime * duration,
     GstClockTime * timestamp, gint64 * range_start, gint64 * range_end,
-    const gchar ** key, const guint8 ** iv, gboolean forward)
+    gchar ** key, guint8 ** iv, gboolean forward)
 {
-  GList *l;
   GstM3U8MediaFile *file;
 
   g_return_val_if_fail (client != NULL, FALSE);
@@ -948,13 +1022,17 @@
     GST_M3U8_CLIENT_UNLOCK (client);
     return FALSE;
   }
-  l = find_next_fragment (client, client->current->files, forward);
-  if (!l) {
+  if (!client->current_file) {
+    client->current_file =
+        find_next_fragment (client, client->current->files, forward);
+  }
+
+  if (!client->current_file) {
     GST_M3U8_CLIENT_UNLOCK (client);
     return FALSE;
   }
 
-  file = GST_M3U8_MEDIA_FILE (l->data);
+  file = GST_M3U8_MEDIA_FILE (client->current_file->data);
   GST_DEBUG ("Got fragment with sequence %u (client sequence %u)",
       (guint) file->sequence, (guint) client->sequence);
 
@@ -964,7 +1042,7 @@
   if (discontinuity)
     *discontinuity = client->sequence != file->sequence || file->discont;
   if (uri)
-    *uri = file->uri;
+    *uri = g_strdup (file->uri);
   if (duration)
     *duration = file->duration;
   if (range_start)
@@ -972,9 +1050,11 @@
   if (range_end)
     *range_end = file->size != -1 ? file->offset + file->size - 1 : -1;
   if (key)
-    *key = file->key;
-  if (iv)
-    *iv = file->iv;
+    *key = g_strdup (file->key);
+  if (iv) {
+    *iv = g_new (guint8, sizeof (file->iv));
+    memcpy (*iv, file->iv, sizeof (file->iv));
+  }
 
   client->sequence = file->sequence;
 
@@ -982,32 +1062,72 @@
   return TRUE;
 }
 
+gboolean
+gst_m3u8_client_has_next_fragment (GstM3U8Client * client, gboolean forward)
+{
+  gboolean ret;
+
+  g_return_val_if_fail (client != NULL, FALSE);
+  g_return_val_if_fail (client->current != NULL, FALSE);
+
+  GST_M3U8_CLIENT_LOCK (client);
+  GST_DEBUG ("Checking if has next fragment %" G_GINT64_FORMAT,
+      client->sequence + (forward ? 1 : -1));
+  if (client->current_file) {
+    ret =
+        (forward ? client->current_file->next : client->current_file->prev) !=
+        NULL;
+  } else {
+    ret = has_next_fragment (client, client->current->files, forward);
+  }
+  GST_M3U8_CLIENT_UNLOCK (client);
+  return ret;
+}
+
 void
 gst_m3u8_client_advance_fragment (GstM3U8Client * client, gboolean forward)
 {
-  GList *l;
   GstM3U8MediaFile *file;
 
   g_return_if_fail (client != NULL);
   g_return_if_fail (client->current != NULL);
 
   GST_M3U8_CLIENT_LOCK (client);
-  GST_DEBUG ("Looking for fragment %" G_GINT64_FORMAT, client->sequence);
-  l = g_list_find_custom (client->current->files, client,
-      (GCompareFunc) _find_current);
-  if (l == NULL) {
-    GST_ERROR ("Could not find current fragment");
-    GST_M3U8_CLIENT_UNLOCK (client);
-    return;
+  if (!client->current_file) {
+    GList *l;
+
+    GST_DEBUG ("Looking for fragment %" G_GINT64_FORMAT, client->sequence);
+    l = g_list_find_custom (client->current->files, client,
+        (GCompareFunc) _find_current);
+    if (l == NULL) {
+      GST_ERROR ("Could not find current fragment");
+      GST_M3U8_CLIENT_UNLOCK (client);
+      return;
+    }
+    client->current_file = l;
   }
 
-  file = GST_M3U8_MEDIA_FILE (l->data);
+  file = GST_M3U8_MEDIA_FILE (client->current_file->data);
   GST_DEBUG ("Advancing from sequence %u", (guint) file->sequence);
   if (forward) {
-    client->sequence = file->sequence + 1;
+    client->current_file = client->current_file->next;
+    if (client->current_file) {
+      client->sequence =
+          GST_M3U8_MEDIA_FILE (client->current_file->data)->sequence;
+    } else {
+      client->sequence = file->sequence + 1;
+    }
+
     client->sequence_position += file->duration;
   } else {
-    client->sequence = file->sequence - 1;
+    client->current_file = client->current_file->prev;
+    if (client->current_file) {
+      client->sequence =
+          GST_M3U8_MEDIA_FILE (client->current_file->data)->sequence;
+    } else {
+      client->sequence = file->sequence - 1;
+    }
+
     if (client->sequence_position > file->duration)
       client->sequence_position -= file->duration;
     else
@@ -1025,7 +1145,7 @@
 GstClockTime
 gst_m3u8_client_get_duration (GstM3U8Client * client)
 {
-  GstClockTime duration = 0;
+  GstClockTime duration = GST_CLOCK_TIME_NONE;
 
   g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE);
 
@@ -1035,9 +1155,15 @@
     GST_M3U8_CLIENT_UNLOCK (client);
     return GST_CLOCK_TIME_NONE;
   }
-  if (client->current->files)
-    g_list_foreach (client->current->files, (GFunc) _sum_duration, &duration);
+
+  if (!GST_CLOCK_TIME_IS_VALID (client->duration) && client->current->files) {
+    client->duration = 0;
+    g_list_foreach (client->current->files, (GFunc) _sum_duration,
+        &client->duration);
+  }
+  duration = client->duration;
   GST_M3U8_CLIENT_UNLOCK (client);
+
   return duration;
 }
 
@@ -1054,33 +1180,49 @@
   return duration;
 }
 
-const gchar *
+gchar *
 gst_m3u8_client_get_uri (GstM3U8Client * client)
 {
-  const gchar *uri;
+  gchar *uri;
 
   g_return_val_if_fail (client != NULL, NULL);
 
   GST_M3U8_CLIENT_LOCK (client);
-  uri = client->main->uri;
+  uri = client->main ? g_strdup (client->main->uri) : NULL;
   GST_M3U8_CLIENT_UNLOCK (client);
   return uri;
 }
 
-const gchar *
+gchar *
 gst_m3u8_client_get_current_uri (GstM3U8Client * client)
 {
-  const gchar *uri;
+  gchar *uri;
 
   g_return_val_if_fail (client != NULL, NULL);
 
   GST_M3U8_CLIENT_LOCK (client);
-  uri = client->current->uri;
+  uri = g_strdup (client->current->uri);
   GST_M3U8_CLIENT_UNLOCK (client);
   return uri;
 }
 
 gboolean
+gst_m3u8_client_has_main (GstM3U8Client * client)
+{
+  gboolean ret;
+
+  g_return_val_if_fail (client != NULL, FALSE);
+
+  GST_M3U8_CLIENT_LOCK (client);
+  if (client->main)
+    ret = TRUE;
+  else
+    ret = FALSE;
+  GST_M3U8_CLIENT_UNLOCK (client);
+  return ret;
+}
+
+gboolean
 gst_m3u8_client_has_variant_playlist (GstM3U8Client * client)
 {
   gboolean ret;
@@ -1101,10 +1243,7 @@
   g_return_val_if_fail (client != NULL, FALSE);
 
   GST_M3U8_CLIENT_LOCK (client);
-  if (!client->current || client->current->endlist)
-    ret = FALSE;
-  else
-    ret = TRUE;
+  ret = GST_M3U8_CLIENT_IS_LIVE (client);
   GST_M3U8_CLIENT_UNLOCK (client);
   return ret;
 }
@@ -1213,3 +1352,43 @@
   GST_M3U8_CLIENT_UNLOCK (client);
   return dur;
 }
+
+gboolean
+gst_m3u8_client_get_seek_range (GstM3U8Client * client, gint64 * start,
+    gint64 * stop)
+{
+  GstClockTime duration = 0;
+  GList *walk;
+  GstM3U8MediaFile *file;
+  guint count;
+
+  g_return_val_if_fail (client != NULL, FALSE);
+
+  GST_M3U8_CLIENT_LOCK (client);
+
+  if (client->current == NULL || client->current->files == NULL) {
+    GST_M3U8_CLIENT_UNLOCK (client);
+    return FALSE;
+  }
+
+  count = g_list_length (client->current->files);
+
+  /* count is used to make sure the seek range is never closer than
+     GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments from the end of the
+     playlist - see 6.3.3. "Playing the Playlist file" of the HLS draft */
+  for (walk = client->current->files;
+      walk && count >= GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE; walk = walk->next) {
+    file = walk->data;
+    --count;
+    duration += file->duration;
+  }
+
+  if (duration <= 0) {
+    GST_M3U8_CLIENT_UNLOCK (client);
+    return FALSE;
+  }
+  *start = client->first_file_start;
+  *stop = *start + duration;
+  GST_M3U8_CLIENT_UNLOCK (client);
+  return TRUE;
+}
diff --git a/ext/hls/m3u8.h b/ext/hls/m3u8.h
old mode 100644
new mode 100755
index 2344b22..6c4b6c6
--- a/ext/hls/m3u8.h
+++ b/ext/hls/m3u8.h
@@ -35,6 +35,19 @@
 #define GST_M3U8_CLIENT_LOCK(c) g_mutex_lock (&c->lock);
 #define GST_M3U8_CLIENT_UNLOCK(c) g_mutex_unlock (&c->lock);
 
+#define GST_M3U8_CLIENT_IS_LIVE(c) ((!(c)->current || (c)->current->endlist) ? FALSE : TRUE)
+/* hlsdemux must not get closer to the end of a live stream than
+   GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments. Section 6.3.3
+   "Playing the Playlist file" of the HLS draft states that this
+   value is three fragments */
+#define GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE 3
+
+/* hlsdemux must not get closer to the end of a live stream than
+   GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments. Section 6.3.3
+   "Playing the Playlist file" of the HLS draft states that this
+   value is three fragments */
+#define GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE 3
+
 struct _GstM3U8
 {
   gchar *uri;                   /* actually downloaded URI */
@@ -82,8 +95,13 @@
   GstM3U8 *main;                /* main playlist */
   GstM3U8 *current;
   guint update_failed_count;
+  GList *current_file;
   gint64 sequence;              /* the next sequence for this client */
   GstClockTime sequence_position; /* position of this sequence */
+  gint64 highest_sequence_number; /* largest seen sequence number */
+  GstClockTime first_file_start; /* timecode of the start of the first fragment in the current media playlist */
+  GstClockTime last_file_end; /* timecode of the end of the last fragment in the current media playlist */
+  GstClockTime duration; /* cached total duration */
   GMutex lock;
 };
 
@@ -94,14 +112,16 @@
 gboolean gst_m3u8_client_update_variant_playlist (GstM3U8Client * client, gchar * data, const gchar * uri, const gchar * base_uri);
 void gst_m3u8_client_set_current (GstM3U8Client * client, GstM3U8 * m3u8);
 gboolean gst_m3u8_client_get_next_fragment (GstM3U8Client * client,
-    gboolean * discontinuity, const gchar ** uri, GstClockTime * duration,
+    gboolean * discontinuity, gchar ** uri, GstClockTime * duration,
     GstClockTime * timestamp, gint64 * range_start, gint64 * range_end,
-    const gchar ** key, const guint8 ** iv, gboolean forward);
+    gchar ** key, guint8 ** iv, gboolean forward);
+gboolean gst_m3u8_client_has_next_fragment (GstM3U8Client * client, gboolean forward);
 void gst_m3u8_client_advance_fragment (GstM3U8Client * client, gboolean forward);
 GstClockTime gst_m3u8_client_get_duration (GstM3U8Client * client);
 GstClockTime gst_m3u8_client_get_target_duration (GstM3U8Client * client);
-const gchar *gst_m3u8_client_get_uri(GstM3U8Client * client);
-const gchar *gst_m3u8_client_get_current_uri(GstM3U8Client * client);
+gchar *gst_m3u8_client_get_uri(GstM3U8Client * client);
+gchar *gst_m3u8_client_get_current_uri(GstM3U8Client * client);
+gboolean gst_m3u8_client_has_main(GstM3U8Client * client);
 gboolean gst_m3u8_client_has_variant_playlist(GstM3U8Client * client);
 gboolean gst_m3u8_client_is_live(GstM3U8Client * client);
 GList * gst_m3u8_client_get_playlist_for_bitrate (GstM3U8Client * client,
@@ -109,5 +129,7 @@
 
 guint64 gst_m3u8_client_get_current_fragment_duration (GstM3U8Client * client);
 
+gboolean gst_m3u8_client_get_seek_range(GstM3U8Client * client, gint64 * start, gint64 * stop);
+
 G_END_DECLS
 #endif /* __M3U8_H__ */
diff --git a/ext/kate/Makefile.in b/ext/kate/Makefile.in
index 02809b3..77bd242 100644
--- a/ext/kate/Makefile.in
+++ b/ext/kate/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -250,8 +250,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -290,7 +294,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -298,6 +301,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -347,8 +352,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -427,7 +430,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -436,7 +438,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -449,7 +450,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -474,6 +474,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -547,10 +549,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -576,6 +582,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -612,6 +621,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -652,17 +662,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -679,6 +688,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/kate/gstkatedec.c b/ext/kate/gstkatedec.c
index cb89e0c..8748498 100644
--- a/ext/kate/gstkatedec.c
+++ b/ext/kate/gstkatedec.c
@@ -237,6 +237,114 @@
   }
 }
 
+static GstFlowReturn
+gst_kate_dec_handle_kate_event (GstKateDec * kd, const kate_event * ev)
+{
+  GstFlowReturn rflow = GST_FLOW_OK;
+  GstKateFormat format = GST_KATE_FORMAT_UNDEFINED;
+  gchar *escaped;
+  GstBuffer *buffer;
+  size_t len;
+  gboolean plain = TRUE;
+
+  if (kd->remove_markup && ev->text_markup_type != kate_markup_none) {
+    size_t len0 = ev->len + 1;
+    escaped = g_strdup (ev->text);
+    if (escaped) {
+      kate_text_remove_markup (ev->text_encoding, escaped, &len0);
+    }
+    plain = TRUE;
+  } else if (ev->text_markup_type == kate_markup_none) {
+    /* no pango markup yet, escape text */
+    /* TODO: actually do the pango thing */
+    escaped = g_strdup (ev->text);
+    plain = TRUE;
+  } else {
+    escaped = g_strdup (ev->text);
+    plain = FALSE;
+  }
+
+  if (G_LIKELY (escaped)) {
+    len = strlen (escaped);
+    if (len > 0) {
+      GST_DEBUG_OBJECT (kd, "kate event: %s, escaped %s", ev->text, escaped);
+      buffer = gst_buffer_new_and_alloc (len + 1);
+      if (G_LIKELY (buffer)) {
+        GstCaps *caps;
+        if (plain)
+          format = GST_KATE_FORMAT_TEXT_UTF8;
+        else
+          format = GST_KATE_FORMAT_TEXT_PANGO_MARKUP;
+        if (format != kd->output_format) {
+          caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING,
+              (format == GST_KATE_FORMAT_TEXT_UTF8) ? "utf8" : "pango-markup",
+              NULL);
+          gst_pad_push_event (kd->srcpad, gst_event_new_caps (caps));
+          gst_caps_unref (caps);
+          kd->output_format = format;
+        }
+        /* allocate and copy the NULs, but don't include them in passed size */
+        gst_buffer_fill (buffer, 0, escaped, len + 1);
+        gst_buffer_resize (buffer, 0, len);
+        GST_BUFFER_TIMESTAMP (buffer) = ev->start_time * GST_SECOND;
+        GST_BUFFER_DURATION (buffer) =
+            (ev->end_time - ev->start_time) * GST_SECOND;
+        rflow = gst_pad_push (kd->srcpad, buffer);
+        if (rflow == GST_FLOW_NOT_LINKED) {
+          GST_DEBUG_OBJECT (kd, "source pad not linked, ignored");
+        } else if (rflow != GST_FLOW_OK) {
+          GST_WARNING_OBJECT (kd, "failed to push buffer: %s",
+              gst_flow_get_name (rflow));
+        }
+      } else {
+        GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
+            ("Failed to create buffer"));
+        rflow = GST_FLOW_ERROR;
+      }
+    } else {
+      GST_WARNING_OBJECT (kd, "Empty string, nothing to do");
+      rflow = GST_FLOW_OK;
+    }
+    g_free (escaped);
+  } else {
+    GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
+        ("Failed to allocate string"));
+    rflow = GST_FLOW_ERROR;
+  }
+
+  /* if there's a background paletted bitmap, construct a DVD SPU for it */
+  if (ev->bitmap && ev->palette) {
+    GstBuffer *buffer = gst_kate_spu_encode_spu (kd, ev);
+    if (buffer) {
+      GstCaps *caps;
+
+      GST_BUFFER_TIMESTAMP (buffer) = ev->start_time * GST_SECOND;
+      GST_BUFFER_DURATION (buffer) =
+          (ev->end_time - ev->start_time) * GST_SECOND;
+
+      if (kd->output_format != GST_KATE_FORMAT_SPU) {
+        caps = gst_caps_new_empty_simple (GST_KATE_SPU_MIME_TYPE);
+        gst_pad_push_event (kd->srcpad, gst_event_new_caps (caps));
+        gst_caps_unref (caps);
+        kd->output_format = GST_KATE_FORMAT_SPU;
+      }
+
+      rflow = gst_pad_push (kd->srcpad, buffer);
+      if (rflow == GST_FLOW_NOT_LINKED) {
+        GST_DEBUG_OBJECT (kd, "source pad not linked, ignored");
+      } else if (rflow != GST_FLOW_OK) {
+        GST_WARNING_OBJECT (kd, "failed to push buffer: %s",
+            gst_flow_get_name (rflow));
+      }
+    } else {
+      GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
+          ("failed to create SPU from paletted bitmap"));
+      rflow = GST_FLOW_ERROR;
+    }
+  }
+  return rflow;
+}
+
 /* GstElement vmethod implementations */
 
 /* chain function
@@ -246,7 +354,6 @@
 static GstFlowReturn
 gst_kate_dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
 {
-  GstKateFormat format = GST_KATE_FORMAT_UNDEFINED;
   GstKateDec *kd = GST_KATE_DEC (parent);
   const kate_event *ev = NULL;
   GstFlowReturn rflow = GST_FLOW_OK;
@@ -267,106 +374,7 @@
   }
 
   if (ev) {
-    gchar *escaped;
-    GstBuffer *buffer;
-    size_t len;
-    gboolean plain = TRUE;
-
-    if (kd->remove_markup && ev->text_markup_type != kate_markup_none) {
-      size_t len0 = ev->len + 1;
-      escaped = g_strdup (ev->text);
-      if (escaped) {
-        kate_text_remove_markup (ev->text_encoding, escaped, &len0);
-      }
-      plain = TRUE;
-    } else if (ev->text_markup_type == kate_markup_none) {
-      /* no pango markup yet, escape text */
-      /* TODO: actually do the pango thing */
-      escaped = g_strdup (ev->text);
-      plain = TRUE;
-    } else {
-      escaped = g_strdup (ev->text);
-      plain = FALSE;
-    }
-
-    if (G_LIKELY (escaped)) {
-      len = strlen (escaped);
-      if (len > 0) {
-        GST_DEBUG_OBJECT (kd, "kate event: %s, escaped %s", ev->text, escaped);
-        buffer = gst_buffer_new_and_alloc (len + 1);
-        if (G_LIKELY (buffer)) {
-          GstCaps *caps;
-          if (plain)
-            format = GST_KATE_FORMAT_TEXT_UTF8;
-          else
-            format = GST_KATE_FORMAT_TEXT_PANGO_MARKUP;
-          if (format != kd->output_format) {
-            caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING,
-                (format == GST_KATE_FORMAT_TEXT_UTF8) ? "utf8" : "pango-markup",
-                NULL);
-            gst_pad_push_event (kd->srcpad, gst_event_new_caps (caps));
-            gst_caps_unref (caps);
-            kd->output_format = format;
-          }
-          /* allocate and copy the NULs, but don't include them in passed size */
-          gst_buffer_fill (buffer, 0, escaped, len + 1);
-          gst_buffer_resize (buffer, 0, len);
-          GST_BUFFER_TIMESTAMP (buffer) = ev->start_time * GST_SECOND;
-          GST_BUFFER_DURATION (buffer) =
-              (ev->end_time - ev->start_time) * GST_SECOND;
-          rflow = gst_pad_push (kd->srcpad, buffer);
-          if (rflow == GST_FLOW_NOT_LINKED) {
-            GST_DEBUG_OBJECT (kd, "source pad not linked, ignored");
-          } else if (rflow != GST_FLOW_OK) {
-            GST_WARNING_OBJECT (kd, "failed to push buffer: %s",
-                gst_flow_get_name (rflow));
-          }
-        } else {
-          GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
-              ("Failed to create buffer"));
-          rflow = GST_FLOW_ERROR;
-        }
-      } else {
-        GST_WARNING_OBJECT (kd, "Empty string, nothing to do");
-        rflow = GST_FLOW_OK;
-      }
-      g_free (escaped);
-    } else {
-      GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
-          ("Failed to allocate string"));
-      rflow = GST_FLOW_ERROR;
-    }
-
-    /* if there's a background paletted bitmap, construct a DVD SPU for it */
-    if (ev->bitmap && ev->palette) {
-      GstBuffer *buffer = gst_kate_spu_encode_spu (kd, ev);
-      if (buffer) {
-        GstCaps *caps;
-
-        GST_BUFFER_TIMESTAMP (buffer) = ev->start_time * GST_SECOND;
-        GST_BUFFER_DURATION (buffer) =
-            (ev->end_time - ev->start_time) * GST_SECOND;
-
-        if (kd->output_format != GST_KATE_FORMAT_SPU) {
-          caps = gst_caps_new_empty_simple (GST_KATE_SPU_MIME_TYPE);
-          gst_pad_push_event (kd->srcpad, gst_event_new_caps (caps));
-          gst_caps_unref (caps);
-          kd->output_format = GST_KATE_FORMAT_SPU;
-        }
-
-        rflow = gst_pad_push (kd->srcpad, buffer);
-        if (rflow == GST_FLOW_NOT_LINKED) {
-          GST_DEBUG_OBJECT (kd, "source pad not linked, ignored");
-        } else if (rflow != GST_FLOW_OK) {
-          GST_WARNING_OBJECT (kd, "failed to push buffer: %s",
-              gst_flow_get_name (rflow));
-        }
-      } else {
-        GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
-            ("failed to create SPU from paletted bitmap"));
-        rflow = GST_FLOW_ERROR;
-      }
-    }
+    rflow = gst_kate_dec_handle_kate_event (kd, ev);
   }
 
 not_in_seg:
@@ -401,12 +409,73 @@
 }
 
 static gboolean
+gst_kate_dec_set_caps (GstKateDec * kd, GstCaps * caps)
+{
+  GstStructure *structure = gst_caps_get_structure (caps, 0);
+  GstFlowReturn rflow = GST_FLOW_OK;
+
+  if (gst_structure_has_field (structure, "streamheader")) {
+    const GValue *value;
+    GstBuffer *buf;
+    const kate_event *ev;
+
+    value = gst_structure_get_value (structure, "streamheader");
+
+    if (GST_VALUE_HOLDS_BUFFER (value)) {
+      buf = gst_value_get_buffer (value);
+
+      gst_kate_util_decoder_base_chain_kate_packet (&kd->decoder,
+          GST_ELEMENT_CAST (kd), kd->sinkpad, buf, kd->srcpad, kd->srcpad,
+          &kd->src_caps, &ev);
+
+      if (ev) {
+        rflow = gst_kate_dec_handle_kate_event (kd, ev);
+      }
+    } else if (GST_VALUE_HOLDS_ARRAY (value)) {
+      gint i, size = gst_value_array_get_size (value);
+
+      for (i = 0; i < size; i++) {
+        const GValue *v = gst_value_array_get_value (value, i);
+
+        buf = gst_value_get_buffer (v);
+        gst_kate_util_decoder_base_chain_kate_packet (&kd->decoder,
+            GST_ELEMENT_CAST (kd), kd->sinkpad, buf, kd->srcpad, kd->srcpad,
+            &kd->src_caps, &ev);
+
+        if (ev) {
+          rflow = gst_kate_dec_handle_kate_event (kd, ev);
+          if (rflow != GST_FLOW_OK && rflow != GST_FLOW_NOT_LINKED)
+            break;
+        }
+      }
+    } else {
+      GST_WARNING_OBJECT (kd, "Unhandled streamheader type: %s",
+          G_VALUE_TYPE_NAME (value));
+    }
+  }
+
+  return rflow == GST_FLOW_OK || rflow == GST_FLOW_NOT_LINKED;
+}
+
+static gboolean
 gst_kate_dec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
 {
   GstKateDec *kd = GST_KATE_DEC (parent);
   gboolean res = TRUE;
 
-  GST_LOG_OBJECT (pad, "Event on sink pad: %s", GST_EVENT_TYPE_NAME (event));
+  GST_LOG_OBJECT (pad, "Event on sink pad: %" GST_PTR_FORMAT, event);
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:{
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      gst_kate_dec_set_caps (kd, caps);
+      break;
+    }
+    default:
+      break;
+  }
 
   /* Delay events till we've set caps */
   if (gst_kate_util_decoder_base_queue_event (&kd->decoder, event,
@@ -430,7 +499,6 @@
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_SEGMENT:
-      gst_kate_util_decoder_base_segment_event (&kd->decoder, event);
       break;
 
     case GST_EVENT_FLUSH_START:
diff --git a/ext/kate/gstkateutil.c b/ext/kate/gstkateutil.c
index e5b519b..93777ab 100644
--- a/ext/kate/gstkateutil.c
+++ b/ext/kate/gstkateutil.c
@@ -153,6 +153,10 @@
     case GST_EVENT_EOS:
       can_be_queued = FALSE;
       break;
+    case GST_EVENT_SEGMENT:
+      gst_kate_util_decoder_base_segment_event (decoder, event);
+      can_be_queued = TRUE;
+      break;
     default:
       can_be_queued = TRUE;
       break;
diff --git a/ext/ladspa/Makefile.in b/ext/ladspa/Makefile.in
index ba7dd1f..4d36e6b 100644
--- a/ext/ladspa/Makefile.in
+++ b/ext/ladspa/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -249,8 +249,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -289,7 +293,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -297,6 +300,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -346,8 +351,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -426,7 +429,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -435,7 +437,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -448,7 +449,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -473,6 +473,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -546,10 +548,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -575,6 +581,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -611,6 +620,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -651,17 +661,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -678,6 +687,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/libde265/Makefile.am b/ext/libde265/Makefile.am
new file mode 100644
index 0000000..e90096c
--- /dev/null
+++ b/ext/libde265/Makefile.am
@@ -0,0 +1,15 @@
+plugin_LTLIBRARIES = libgstlibde265.la
+
+libgstlibde265_la_SOURCES = \
+	gstlibde265.c \
+	libde265-dec.c
+
+libgstlibde265_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
+	$(LIBDE265_CFLAGS)
+libgstlibde265_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_BASE_LIBS) $(GST_LIBS) \
+	$(LIBDE265_LIBS)
+libgstlibde265_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstlibde265_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS = \
+	libde265-dec.h
diff --git a/sys/osxvideo/Makefile.in b/ext/libde265/Makefile.in
similarity index 88%
rename from sys/osxvideo/Makefile.in
rename to ext/libde265/Makefile.in
index a756e27..3a11920 100644
--- a/sys/osxvideo/Makefile.in
+++ b/ext/libde265/Makefile.in
@@ -80,7 +80,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = sys/osxvideo
+subdir = ext/libde265
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -154,20 +154,20 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstosxvideosrc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+libgstlibde265_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
-am_libgstosxvideosrc_la_OBJECTS =  \
-	libgstosxvideosrc_la-osxvideoplugin.lo \
-	libgstosxvideosrc_la-osxvideosrc.lo
-libgstosxvideosrc_la_OBJECTS = $(am_libgstosxvideosrc_la_OBJECTS)
+am_libgstlibde265_la_OBJECTS = libgstlibde265_la-gstlibde265.lo \
+	libgstlibde265_la-libde265-dec.lo
+libgstlibde265_la_OBJECTS = $(am_libgstlibde265_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstosxvideosrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) \
-	$(libgstosxvideosrc_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstlibde265_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(libgstlibde265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CCLD) $(libgstlibde265_la_CFLAGS) $(CFLAGS) \
+	$(libgstlibde265_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -202,8 +202,8 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstosxvideosrc_la_SOURCES)
-DIST_SOURCES = $(libgstosxvideosrc_la_SOURCES)
+SOURCES = $(libgstlibde265_la_SOURCES)
+DIST_SOURCES = $(libgstlibde265_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -726,20 +736,22 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstosxvideosrc.la
-libgstosxvideosrc_la_SOURCES = osxvideoplugin.c osxvideosrc.c
-libgstosxvideosrc_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
-	$(GST_PLUGINS_BASE_CFLAGS) -Wno-deprecated-declarations
+plugin_LTLIBRARIES = libgstlibde265.la
+libgstlibde265_la_SOURCES = \
+	gstlibde265.c \
+	libde265-dec.c
 
-libgstosxvideosrc_la_LIBADD = \
-	$(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
-	-lgstinterfaces-$(GST_API_VERSION)
+libgstlibde265_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
+	$(LIBDE265_CFLAGS)
 
-libgstosxvideosrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-libgstosxvideosrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \
-	-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,QuickTime
+libgstlibde265_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_BASE_LIBS) $(GST_LIBS) \
+	$(LIBDE265_LIBS)
 
-noinst_HEADERS = osxvideosrc.h
+libgstlibde265_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstlibde265_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+noinst_HEADERS = \
+	libde265-dec.h
+
 all: all-am
 
 .SUFFIXES:
@@ -753,9 +765,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sys/osxvideo/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/libde265/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu sys/osxvideo/Makefile
+	  $(AUTOMAKE) --gnu ext/libde265/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -810,8 +822,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstosxvideosrc.la: $(libgstosxvideosrc_la_OBJECTS) $(libgstosxvideosrc_la_DEPENDENCIES) $(EXTRA_libgstosxvideosrc_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstosxvideosrc_la_LINK) -rpath $(plugindir) $(libgstosxvideosrc_la_OBJECTS) $(libgstosxvideosrc_la_LIBADD) $(LIBS)
+libgstlibde265.la: $(libgstlibde265_la_OBJECTS) $(libgstlibde265_la_DEPENDENCIES) $(EXTRA_libgstlibde265_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libgstlibde265_la_LINK) -rpath $(plugindir) $(libgstlibde265_la_OBJECTS) $(libgstlibde265_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -819,8 +831,8 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibde265_la-gstlibde265.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibde265_la-libde265-dec.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -846,19 +858,19 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstosxvideosrc_la-osxvideoplugin.lo: osxvideoplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -MT libgstosxvideosrc_la-osxvideoplugin.lo -MD -MP -MF $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Tpo -c -o libgstosxvideosrc_la-osxvideoplugin.lo `test -f 'osxvideoplugin.c' || echo '$(srcdir)/'`osxvideoplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Tpo $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='osxvideoplugin.c' object='libgstosxvideosrc_la-osxvideoplugin.lo' libtool=yes @AMDEPBACKSLASH@
+libgstlibde265_la-gstlibde265.lo: gstlibde265.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibde265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibde265_la_CFLAGS) $(CFLAGS) -MT libgstlibde265_la-gstlibde265.lo -MD -MP -MF $(DEPDIR)/libgstlibde265_la-gstlibde265.Tpo -c -o libgstlibde265_la-gstlibde265.lo `test -f 'gstlibde265.c' || echo '$(srcdir)/'`gstlibde265.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstlibde265_la-gstlibde265.Tpo $(DEPDIR)/libgstlibde265_la-gstlibde265.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstlibde265.c' object='libgstlibde265_la-gstlibde265.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -c -o libgstosxvideosrc_la-osxvideoplugin.lo `test -f 'osxvideoplugin.c' || echo '$(srcdir)/'`osxvideoplugin.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibde265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibde265_la_CFLAGS) $(CFLAGS) -c -o libgstlibde265_la-gstlibde265.lo `test -f 'gstlibde265.c' || echo '$(srcdir)/'`gstlibde265.c
 
-libgstosxvideosrc_la-osxvideosrc.lo: osxvideosrc.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -MT libgstosxvideosrc_la-osxvideosrc.lo -MD -MP -MF $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Tpo -c -o libgstosxvideosrc_la-osxvideosrc.lo `test -f 'osxvideosrc.c' || echo '$(srcdir)/'`osxvideosrc.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Tpo $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='osxvideosrc.c' object='libgstosxvideosrc_la-osxvideosrc.lo' libtool=yes @AMDEPBACKSLASH@
+libgstlibde265_la-libde265-dec.lo: libde265-dec.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibde265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibde265_la_CFLAGS) $(CFLAGS) -MT libgstlibde265_la-libde265-dec.lo -MD -MP -MF $(DEPDIR)/libgstlibde265_la-libde265-dec.Tpo -c -o libgstlibde265_la-libde265-dec.lo `test -f 'libde265-dec.c' || echo '$(srcdir)/'`libde265-dec.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstlibde265_la-libde265-dec.Tpo $(DEPDIR)/libgstlibde265_la-libde265-dec.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libde265-dec.c' object='libgstlibde265_la-libde265-dec.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -c -o libgstosxvideosrc_la-osxvideosrc.lo `test -f 'osxvideosrc.c' || echo '$(srcdir)/'`osxvideosrc.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibde265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibde265_la_CFLAGS) $(CFLAGS) -c -o libgstlibde265_la-libde265-dec.lo `test -f 'libde265-dec.c' || echo '$(srcdir)/'`libde265-dec.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
diff --git a/ext/libde265/gstlibde265.c b/ext/libde265/gstlibde265.c
new file mode 100644
index 0000000..2ee7ffe
--- /dev/null
+++ b/ext/libde265/gstlibde265.c
@@ -0,0 +1,41 @@
+/*
+ * GStreamer HEVC/H.265 video codec.
+ *
+ * Copyright (c) 2014 struktur AG, Joachim Bauch <bauch@struktur.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "libde265-dec.h"
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  gboolean ret;
+
+  ret = gst_libde265_dec_plugin_init (plugin);
+  return ret;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    gstlibde265,
+    "HEVC/H.265 decoder using libde265",
+    plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/libde265/libde265-dec.c b/ext/libde265/libde265-dec.c
new file mode 100644
index 0000000..0c530ae
--- /dev/null
+++ b/ext/libde265/libde265-dec.c
@@ -0,0 +1,895 @@
+/*
+ * GStreamer HEVC/H.265 video codec.
+ *
+ * Copyright (c) 2014 struktur AG, Joachim Bauch <bauch@struktur.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:element-libde265dec
+ *
+ * Decodes HEVC/H.265 video.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch-1.0 filesrc location=bitstream.hevc ! 'video/x-hevc,stream-format=byte-stream,framerate=25/1' ! libde265dec ! autovideosink
+ * ]| The above pipeline decodes the HEVC/H.265 bitstream and renders it to the screen.
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "libde265-dec.h"
+
+/* use two decoder threads if no information about
+ * available CPU cores can be retrieved */
+#define DEFAULT_THREAD_COUNT        2
+
+#define parent_class gst_libde265_dec_parent_class
+G_DEFINE_TYPE (GstLibde265Dec, gst_libde265_dec, GST_TYPE_VIDEO_DECODER);
+
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS
+    ("video/x-h265, stream-format=(string) { hvc1, hev1, byte-stream }, "
+        "alignment=(string) { au, nal }")
+    );
+
+static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
+    );
+
+enum
+{
+  PROP_0,
+  PROP_MAX_THREADS,
+  PROP_LAST
+};
+
+#define DEFAULT_FORMAT      GST_TYPE_LIBDE265_FORMAT_PACKETIZED
+#define DEFAULT_MAX_THREADS 0
+
+static void gst_libde265_dec_finalize (GObject * object);
+
+static void gst_libde265_dec_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_libde265_dec_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+static gboolean gst_libde265_dec_start (GstVideoDecoder * decoder);
+static gboolean gst_libde265_dec_stop (GstVideoDecoder * decoder);
+static gboolean gst_libde265_dec_set_format (GstVideoDecoder * decoder,
+    GstVideoCodecState * state);
+static gboolean gst_libde265_dec_flush (GstVideoDecoder * decoder);
+static GstFlowReturn gst_libde265_dec_finish (GstVideoDecoder * decoder);
+static GstFlowReturn _gst_libde265_return_image (GstVideoDecoder * decoder,
+    GstVideoCodecFrame * frame, const struct de265_image *img);
+static GstFlowReturn gst_libde265_dec_handle_frame (GstVideoDecoder * decoder,
+    GstVideoCodecFrame * frame);
+static GstFlowReturn _gst_libde265_image_available (GstVideoDecoder * decoder,
+    int width, int height);
+
+static void
+gst_libde265_dec_class_init (GstLibde265DecClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstVideoDecoderClass *decoder_class = GST_VIDEO_DECODER_CLASS (klass);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+
+  gobject_class->finalize = gst_libde265_dec_finalize;
+  gobject_class->set_property = gst_libde265_dec_set_property;
+  gobject_class->get_property = gst_libde265_dec_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_MAX_THREADS,
+      g_param_spec_int ("max-threads", "Maximum decode threads",
+          "Maximum number of worker threads to spawn. (0 = auto)",
+          0, G_MAXINT, DEFAULT_MAX_THREADS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  decoder_class->start = GST_DEBUG_FUNCPTR (gst_libde265_dec_start);
+  decoder_class->stop = GST_DEBUG_FUNCPTR (gst_libde265_dec_stop);
+  decoder_class->set_format = GST_DEBUG_FUNCPTR (gst_libde265_dec_set_format);
+  decoder_class->flush = GST_DEBUG_FUNCPTR (gst_libde265_dec_flush);
+  decoder_class->finish = GST_DEBUG_FUNCPTR (gst_libde265_dec_finish);
+  decoder_class->handle_frame =
+      GST_DEBUG_FUNCPTR (gst_libde265_dec_handle_frame);
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sink_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_template));
+
+  gst_element_class_set_static_metadata (gstelement_class,
+      "HEVC/H.265 parser",
+      "Codec/Parser/Converter/Video",
+      "Decodes HEVC/H.265 video streams using libde265",
+      "struktur AG <opensource@struktur.de>");
+}
+
+static inline void
+_gst_libde265_dec_reset_decoder (GstLibde265Dec * dec)
+{
+  dec->ctx = NULL;
+  dec->buffer_full = 0;
+  dec->codec_data = NULL;
+  dec->codec_data_size = 0;
+  dec->input_state = NULL;
+  dec->output_state = NULL;
+}
+
+static void
+gst_libde265_dec_init (GstLibde265Dec * dec)
+{
+  dec->format = DEFAULT_FORMAT;
+  dec->max_threads = DEFAULT_MAX_THREADS;
+  dec->length_size = 4;
+  _gst_libde265_dec_reset_decoder (dec);
+  gst_video_decoder_set_packetized (GST_VIDEO_DECODER (dec), TRUE);
+}
+
+static inline void
+_gst_libde265_dec_free_decoder (GstLibde265Dec * dec)
+{
+  if (dec->ctx != NULL) {
+    de265_free_decoder (dec->ctx);
+  }
+  free (dec->codec_data);
+  if (dec->input_state != NULL) {
+    gst_video_codec_state_unref (dec->input_state);
+  }
+  if (dec->output_state != NULL) {
+    gst_video_codec_state_unref (dec->output_state);
+  }
+  _gst_libde265_dec_reset_decoder (dec);
+}
+
+static void
+gst_libde265_dec_finalize (GObject * object)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (object);
+
+  _gst_libde265_dec_free_decoder (dec);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_libde265_dec_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (object);
+
+  switch (prop_id) {
+    case PROP_MAX_THREADS:
+      dec->max_threads = g_value_get_int (value);
+      if (dec->max_threads) {
+        GST_DEBUG_OBJECT (dec, "Max. threads set to %d", dec->max_threads);
+      } else {
+        GST_DEBUG_OBJECT (dec, "Max. threads set to auto");
+      }
+      break;
+    default:
+      break;
+  }
+}
+
+static void
+gst_libde265_dec_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (object);
+
+  switch (prop_id) {
+    case PROP_MAX_THREADS:
+      g_value_set_int (value, dec->max_threads);
+      break;
+    default:
+      break;
+  }
+}
+
+struct GstLibde265FrameRef
+{
+  GstVideoDecoder *decoder;
+  GstVideoCodecFrame *frame;
+  GstVideoFrame vframe;
+  GstBuffer *buffer;
+  gboolean mapped;
+};
+
+static void
+gst_libde265_dec_release_frame_ref (struct GstLibde265FrameRef *ref)
+{
+  if (ref->mapped) {
+    gst_video_frame_unmap (&ref->vframe);
+  }
+  gst_video_codec_frame_unref (ref->frame);
+  gst_buffer_replace (&ref->buffer, NULL);
+  g_free (ref);
+}
+
+static int
+gst_libde265_dec_get_buffer (de265_decoder_context * ctx,
+    struct de265_image_spec *spec, struct de265_image *img, void *userdata)
+{
+  GstVideoDecoder *base = (GstVideoDecoder *) userdata;
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (base);
+  GstVideoCodecFrame *frame = NULL;
+  int i;
+  int width = spec->width;
+  int height = spec->height;
+  GstFlowReturn ret;
+  struct GstLibde265FrameRef *ref;
+  GstVideoInfo *info;
+  int frame_number;
+
+  frame_number = (uintptr_t) de265_get_image_user_data (img) - 1;
+  if (G_UNLIKELY (frame_number == -1)) {
+    /* should not happen... */
+    GST_WARNING_OBJECT (base, "Frame has no number assigned!");
+    goto fallback;
+  }
+
+  frame = gst_video_decoder_get_frame (base, frame_number);
+  if (G_UNLIKELY (frame == NULL)) {
+    /* should not happen... */
+    GST_WARNING_OBJECT (base, "Couldn't get codec frame!");
+    goto fallback;
+  }
+
+  if (width % spec->alignment) {
+    width += spec->alignment - (width % spec->alignment);
+  }
+  if (width != spec->visible_width || height != spec->visible_height) {
+    /* clipping not supported for now */
+    goto fallback;
+  }
+
+  ret = _gst_libde265_image_available (base, width, height);
+  if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+    GST_ERROR_OBJECT (dec, "Failed to notify about available image");
+    goto fallback;
+  }
+
+  ret =
+      gst_video_decoder_allocate_output_frame (GST_VIDEO_DECODER (dec), frame);
+  if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+    GST_ERROR_OBJECT (dec, "Failed to allocate output buffer");
+    goto fallback;
+  }
+
+  ref = (struct GstLibde265FrameRef *) g_malloc0 (sizeof (*ref));
+  g_assert (ref != NULL);
+  ref->decoder = base;
+  ref->frame = frame;
+
+  gst_buffer_replace (&ref->buffer, frame->output_buffer);
+  gst_buffer_replace (&frame->output_buffer, NULL);
+
+  info = &dec->output_state->info;
+  if (!gst_video_frame_map (&ref->vframe, info, ref->buffer, GST_MAP_READWRITE)) {
+    GST_ERROR_OBJECT (dec, "Failed to map frame output buffer");
+    goto error;
+  }
+
+  ref->mapped = TRUE;
+  if (GST_VIDEO_FRAME_PLANE_STRIDE (&ref->vframe,
+          0) < width * GST_VIDEO_FRAME_COMP_PSTRIDE (&ref->vframe, 0)) {
+    GST_DEBUG_OBJECT (dec, "plane 0: pitch too small (%d/%d*%d)",
+        GST_VIDEO_FRAME_PLANE_STRIDE (&ref->vframe, 0), width,
+        GST_VIDEO_FRAME_COMP_PSTRIDE (&ref->vframe, 0));
+    goto error;
+  }
+
+  if (GST_VIDEO_FRAME_COMP_HEIGHT (&ref->vframe, 0) < height) {
+    GST_DEBUG_OBJECT (dec, "plane 0: lines too few (%d/%d)",
+        GST_VIDEO_FRAME_COMP_HEIGHT (&ref->vframe, 0), height);
+    goto error;
+  }
+
+  for (i = 0; i < 3; i++) {
+    uint8_t *data;
+    int stride = GST_VIDEO_FRAME_PLANE_STRIDE (&ref->vframe, i);
+    if (stride % spec->alignment) {
+      GST_DEBUG_OBJECT (dec, "plane %d: pitch not aligned (%d%%%d)",
+          i, stride, spec->alignment);
+      goto error;
+    }
+
+    data = GST_VIDEO_FRAME_PLANE_DATA (&ref->vframe, i);
+    if ((uintptr_t) (data) % spec->alignment) {
+      GST_DEBUG_OBJECT (dec, "plane %d not aligned", i);
+      goto error;
+    }
+
+    de265_set_image_plane (img, i, data, stride, ref);
+  }
+  return 1;
+
+error:
+  gst_libde265_dec_release_frame_ref (ref);
+  frame = NULL;
+
+fallback:
+  if (frame != NULL) {
+    gst_video_codec_frame_unref (frame);
+  }
+  return de265_get_default_image_allocation_functions ()->get_buffer (ctx,
+      spec, img, userdata);
+}
+
+static void
+gst_libde265_dec_release_buffer (de265_decoder_context * ctx,
+    struct de265_image *img, void *userdata)
+{
+  GstVideoDecoder *base = (GstVideoDecoder *) userdata;
+  struct GstLibde265FrameRef *ref =
+      (struct GstLibde265FrameRef *) de265_get_image_plane_user_data (img, 0);
+  if (ref == NULL) {
+    de265_get_default_image_allocation_functions ()->release_buffer (ctx, img,
+        userdata);
+    return;
+  }
+  gst_libde265_dec_release_frame_ref (ref);
+  (void) base;                  /* unused */
+}
+
+static gboolean
+gst_libde265_dec_start (GstVideoDecoder * decoder)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+  int threads = dec->max_threads;
+  struct de265_image_allocation allocation;
+
+  _gst_libde265_dec_free_decoder (dec);
+  dec->ctx = de265_new_decoder ();
+  if (dec->ctx == NULL) {
+    return FALSE;
+  }
+  if (threads == 0) {
+#if defined(_SC_NPROC_ONLN)
+    threads = sysconf (_SC_NPROC_ONLN);
+#elif defined(_SC_NPROCESSORS_ONLN)
+    threads = sysconf (_SC_NPROCESSORS_ONLN);
+#else
+#warning "Don't know how to get number of CPU cores, will use the default thread count"
+    threads = DEFAULT_THREAD_COUNT;
+#endif
+    if (threads <= 0) {
+      threads = DEFAULT_THREAD_COUNT;
+    }
+    /* NOTE: We start more threads than cores for now, as some threads
+     * might get blocked while waiting for dependent data. Having more
+     * threads increases decoding speed by about 10% */
+    threads *= 2;
+  }
+  if (threads > 1) {
+    if (threads > 32) {
+      /* TODO: this limit should come from the libde265 headers */
+      threads = 32;
+    }
+    de265_start_worker_threads (dec->ctx, threads);
+  }
+  GST_INFO_OBJECT (dec, "Using libde265 %s with %d worker threads",
+      de265_get_version (), threads);
+
+  allocation.get_buffer = gst_libde265_dec_get_buffer;
+  allocation.release_buffer = gst_libde265_dec_release_buffer;
+  de265_set_image_allocation_functions (dec->ctx, &allocation, decoder);
+  /* NOTE: we explicitly disable hash checks for now */
+  de265_set_parameter_bool (dec->ctx, DE265_DECODER_PARAM_BOOL_SEI_CHECK_HASH,
+      0);
+  return TRUE;
+}
+
+static gboolean
+gst_libde265_dec_stop (GstVideoDecoder * decoder)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+
+  _gst_libde265_dec_free_decoder (dec);
+
+  return TRUE;
+}
+
+static gboolean
+gst_libde265_dec_flush (GstVideoDecoder * decoder)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+
+  de265_reset (dec->ctx);
+  dec->buffer_full = 0;
+  if (dec->codec_data != NULL
+      && dec->format == GST_TYPE_LIBDE265_FORMAT_BYTESTREAM) {
+    int more;
+    de265_error err =
+        de265_push_data (dec->ctx, dec->codec_data, dec->codec_data_size, 0,
+        NULL);
+    if (!de265_isOK (err)) {
+      GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+          ("Failed to push codec data: %s (code=%d)",
+              de265_get_error_text (err), err), (NULL));
+      return FALSE;
+    }
+    de265_push_end_of_NAL (dec->ctx);
+    do {
+      err = de265_decode (dec->ctx, &more);
+      switch (err) {
+        case DE265_OK:
+          break;
+
+        case DE265_ERROR_IMAGE_BUFFER_FULL:
+        case DE265_ERROR_WAITING_FOR_INPUT_DATA:
+          /* not really an error */
+          more = 0;
+          break;
+
+        default:
+          if (!de265_isOK (err)) {
+            GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+                ("Failed to decode codec data: %s (code=%d)",
+                    de265_get_error_text (err), err), (NULL));
+            return FALSE;
+          }
+      }
+    } while (more);
+  }
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_libde265_dec_finish (GstVideoDecoder * decoder)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+  de265_error err;
+  const struct de265_image *img;
+  int more;
+  GstFlowReturn result;
+
+  err = de265_flush_data (dec->ctx);
+  if (!de265_isOK (err)) {
+    GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+        ("Failed to flush decoder: %s (code=%d)",
+            de265_get_error_text (err), err), (NULL));
+    return GST_FLOW_ERROR;
+  }
+
+  do {
+    err = de265_decode (dec->ctx, &more);
+    switch (err) {
+      case DE265_OK:
+      case DE265_ERROR_IMAGE_BUFFER_FULL:
+        img = de265_get_next_picture (dec->ctx);
+        if (img != NULL) {
+          result = _gst_libde265_return_image (decoder, NULL, img);
+          if (result != GST_FLOW_OK) {
+            return result;
+          }
+        }
+        break;
+
+      case DE265_ERROR_WAITING_FOR_INPUT_DATA:
+        /* not really an error */
+        more = 0;
+        break;
+
+      default:
+        if (!de265_isOK (err)) {
+          GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+              ("Failed to decode codec data: %s (code=%d)",
+                  de265_get_error_text (err), err), (NULL));
+          return FALSE;
+        }
+    }
+  } while (more);
+
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+_gst_libde265_image_available (GstVideoDecoder * decoder, int width, int height)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+
+  if (G_UNLIKELY (dec->output_state == NULL
+          || width != dec->output_state->info.width
+          || height != dec->output_state->info.height)) {
+    GstVideoCodecState *state =
+        gst_video_decoder_set_output_state (decoder, GST_VIDEO_FORMAT_I420,
+        width, height, dec->input_state);
+    if (state == NULL) {
+      GST_ERROR_OBJECT (dec, "Failed to set output state");
+      return GST_FLOW_ERROR;
+    }
+    if (!gst_video_decoder_negotiate (decoder)) {
+      GST_ERROR_OBJECT (dec, "Failed to negotiate format");
+      return GST_FLOW_ERROR;
+    }
+    if (dec->output_state != NULL) {
+      gst_video_codec_state_unref (dec->output_state);
+    }
+    dec->output_state = state;
+    GST_DEBUG_OBJECT (dec, "Frame dimensions are %d x %d", width, height);
+  }
+
+  return GST_FLOW_OK;
+}
+
+static gboolean
+gst_libde265_dec_set_format (GstVideoDecoder * decoder,
+    GstVideoCodecState * state)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+
+  if (dec->input_state != NULL) {
+    gst_video_codec_state_unref (dec->input_state);
+  }
+  dec->input_state = state;
+  if (state != NULL) {
+    gst_video_codec_state_ref (state);
+  }
+  if (state != NULL && state->caps != NULL) {
+    GstStructure *str;
+    const GValue *value;
+    str = gst_caps_get_structure (state->caps, 0);
+    if ((value = gst_structure_get_value (str, "codec_data"))) {
+      GstMapInfo info;
+      guint8 *data;
+      gsize size;
+      GstBuffer *buf;
+      de265_error err;
+      int more;
+
+      buf = gst_value_get_buffer (value);
+      if (!gst_buffer_map (buf, &info, GST_MAP_READ)) {
+        GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+            ("Failed to map codec data"), (NULL));
+        return FALSE;
+      }
+      data = info.data;
+      size = info.size;
+      free (dec->codec_data);
+      dec->codec_data = malloc (size);
+      g_assert (dec->codec_data != NULL);
+      dec->codec_data_size = size;
+      memcpy (dec->codec_data, data, size);
+      if (size > 3 && (data[0] || data[1] || data[2] > 1)) {
+        /* encoded in "hvcC" format (assume version 0) */
+        dec->format = GST_TYPE_LIBDE265_FORMAT_PACKETIZED;
+        if (size > 22) {
+          int i;
+          int num_param_sets;
+          int pos;
+          if (data[0] != 0) {
+            GST_ELEMENT_WARNING (decoder, STREAM,
+                DECODE, ("Unsupported extra data version %d, decoding may fail",
+                    data[0]), (NULL));
+          }
+          dec->length_size = (data[21] & 3) + 1;
+          num_param_sets = data[22];
+          pos = 23;
+          for (i = 0; i < num_param_sets; i++) {
+            int j;
+            int nal_count;
+            if (pos + 3 > size) {
+              GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+                  ("Buffer underrun in extra header (%d >= %ld)", pos + 3,
+                      size), (NULL));
+              return FALSE;
+            }
+            /* ignore flags + NAL type (1 byte) */
+            nal_count = data[pos + 1] << 8 | data[pos + 2];
+            pos += 3;
+            for (j = 0; j < nal_count; j++) {
+              int nal_size;
+              if (pos + 2 > size) {
+                GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+                    ("Buffer underrun in extra nal header (%d >= %ld)", pos + 2,
+                        size), (NULL));
+                return FALSE;
+              }
+              nal_size = data[pos] << 8 | data[pos + 1];
+              if (pos + 2 + nal_size > size) {
+                GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+                    ("Buffer underrun in extra nal (%d >= %ld)",
+                        pos + 2 + nal_size, size), (NULL));
+                return FALSE;
+              }
+              err =
+                  de265_push_NAL (dec->ctx, data + pos + 2, nal_size, 0, NULL);
+              if (!de265_isOK (err)) {
+                GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+                    ("Failed to push data: %s (%d)", de265_get_error_text (err),
+                        err), (NULL));
+                return FALSE;
+              }
+              pos += 2 + nal_size;
+            }
+          }
+        }
+        GST_DEBUG ("Assuming packetized data (%d bytes length)",
+            dec->length_size);
+      } else {
+        dec->format = GST_TYPE_LIBDE265_FORMAT_BYTESTREAM;
+        GST_DEBUG_OBJECT (dec, "Assuming non-packetized data");
+        err = de265_push_data (dec->ctx, data, size, 0, NULL);
+        if (!de265_isOK (err)) {
+          gst_buffer_unmap (buf, &info);
+          GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+              ("Failed to push codec data: %s (code=%d)",
+                  de265_get_error_text (err), err), (NULL));
+          return FALSE;
+        }
+      }
+      gst_buffer_unmap (buf, &info);
+      de265_push_end_of_NAL (dec->ctx);
+      do {
+        err = de265_decode (dec->ctx, &more);
+        switch (err) {
+          case DE265_OK:
+            break;
+
+          case DE265_ERROR_IMAGE_BUFFER_FULL:
+          case DE265_ERROR_WAITING_FOR_INPUT_DATA:
+            /* not really an error */
+            more = 0;
+            break;
+
+          default:
+            if (!de265_isOK (err)) {
+              GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+                  ("Failed to decode codec data: %s (code=%d)",
+                      de265_get_error_text (err), err), (NULL));
+              return FALSE;
+            }
+        }
+      } while (more);
+    } else if ((value = gst_structure_get_value (str, "stream-format"))) {
+      const gchar *str = g_value_get_string (value);
+      if (strcmp (str, "byte-stream") == 0) {
+        dec->format = GST_TYPE_LIBDE265_FORMAT_BYTESTREAM;
+        GST_DEBUG_OBJECT (dec, "Assuming raw byte-stream");
+      }
+    }
+  }
+
+  return TRUE;
+}
+
+static GstFlowReturn
+_gst_libde265_return_image (GstVideoDecoder * decoder,
+    GstVideoCodecFrame * frame, const struct de265_image *img)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+  struct GstLibde265FrameRef *ref;
+  GstFlowReturn result;
+  GstVideoFrame outframe;
+  GstVideoCodecFrame *out_frame;
+  int frame_number;
+
+  ref = (struct GstLibde265FrameRef *) de265_get_image_plane_user_data (img, 0);
+  if (ref != NULL) {
+    /* decoder is using direct rendering */
+    out_frame = gst_video_codec_frame_ref (ref->frame);
+    if (frame != NULL) {
+      gst_video_codec_frame_unref (frame);
+    }
+    gst_buffer_replace (&out_frame->output_buffer, ref->buffer);
+    gst_buffer_replace (&ref->buffer, NULL);
+    return gst_video_decoder_finish_frame (decoder, out_frame);
+  }
+
+  result =
+      _gst_libde265_image_available (decoder, de265_get_image_width (img, 0),
+      de265_get_image_height (img, 0));
+  if (result != GST_FLOW_OK) {
+    GST_ERROR_OBJECT (dec, "Failed to notify about available image");
+    return result;
+  }
+
+  frame_number = (uintptr_t) de265_get_image_user_data (img) - 1;
+  if (frame_number != -1) {
+    out_frame = gst_video_decoder_get_frame (decoder, frame_number);
+  } else {
+    out_frame = NULL;
+  }
+  if (frame != NULL) {
+    gst_video_codec_frame_unref (frame);
+  }
+
+  if (out_frame == NULL) {
+    GST_ERROR_OBJECT (dec, "No frame available to return");
+    return GST_FLOW_ERROR;
+  }
+
+  result = gst_video_decoder_allocate_output_frame (decoder, out_frame);
+  if (result != GST_FLOW_OK) {
+    GST_ERROR_OBJECT (dec, "Failed to allocate output frame");
+    return result;
+  }
+
+  g_assert (dec->output_state != NULL);
+  if (!gst_video_frame_map (&outframe, &dec->output_state->info,
+          out_frame->output_buffer, GST_MAP_WRITE)) {
+    GST_ERROR_OBJECT (dec, "Failed to map output buffer");
+    return GST_FLOW_ERROR;
+  }
+
+  for (int plane = 0; plane < 3; plane++) {
+    int width = de265_get_image_width (img, plane);
+    int height = de265_get_image_height (img, plane);
+    int srcstride = width;
+    int dststride = GST_VIDEO_FRAME_COMP_STRIDE (&outframe, plane);
+    const uint8_t *src = de265_get_image_plane (img, plane, &srcstride);
+    uint8_t *dest = GST_VIDEO_FRAME_COMP_DATA (&outframe, plane);
+    if (srcstride == width && dststride == width) {
+      memcpy (dest, src, height * width);
+    } else {
+      while (height--) {
+        memcpy (dest, src, width);
+        src += srcstride;
+        dest += dststride;
+      }
+    }
+  }
+  gst_video_frame_unmap (&outframe);
+  return gst_video_decoder_finish_frame (decoder, out_frame);
+}
+
+static GstFlowReturn
+gst_libde265_dec_handle_frame (GstVideoDecoder * decoder,
+    GstVideoCodecFrame * frame)
+{
+  GstLibde265Dec *dec = GST_LIBDE265_DEC (decoder);
+  uint8_t *frame_data;
+  uint8_t *end_data;
+  const struct de265_image *img;
+  de265_error ret = DE265_OK;
+  int more = 0;
+  GstClockTime pts;
+  gsize size;
+  GstMapInfo info;
+
+  pts = frame->pts;
+  if (pts == GST_CLOCK_TIME_NONE) {
+    pts = frame->dts;
+  }
+
+  if (!gst_buffer_map (frame->input_buffer, &info, GST_MAP_READ)) {
+    GST_ERROR_OBJECT (dec, "Failed to map input buffer");
+    return GST_FLOW_ERROR;
+  }
+
+  frame_data = info.data;
+  size = info.size;
+  end_data = frame_data + size;
+
+  if (size > 0) {
+    if (dec->format == GST_TYPE_LIBDE265_FORMAT_PACKETIZED) {
+      /* stream contains length fields and NALs */
+      uint8_t *start_data = frame_data;
+      while (start_data + dec->length_size <= end_data) {
+        int nal_size = 0;
+        int i;
+        for (i = 0; i < dec->length_size; i++) {
+          nal_size = (nal_size << 8) | start_data[i];
+        }
+        if (start_data + dec->length_size + nal_size > end_data) {
+          GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+              ("Overflow in input data, check stream format"), (NULL));
+          goto error_input;
+        }
+        ret =
+            de265_push_NAL (dec->ctx, start_data + dec->length_size, nal_size,
+            (de265_PTS) pts,
+            (void *) (uintptr_t) (frame->system_frame_number + 1));
+        if (ret != DE265_OK) {
+          GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+              ("Error while pushing data: %s (code=%d)",
+                  de265_get_error_text (ret), ret), (NULL));
+          goto error_input;
+        }
+        start_data += dec->length_size + nal_size;
+      }
+    } else {
+      ret =
+          de265_push_data (dec->ctx, frame_data, size, (de265_PTS) pts,
+          (void *) (uintptr_t) (frame->system_frame_number + 1));
+      if (ret != DE265_OK) {
+        GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+            ("Error while pushing data: %s (code=%d)",
+                de265_get_error_text (ret), ret), (NULL));
+        goto error_input;
+      }
+    }
+  } else {
+    ret = de265_flush_data (dec->ctx);
+    if (ret != DE265_OK) {
+      GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+          ("Error while flushing data: %s (code=%d)",
+              de265_get_error_text (ret), ret), (NULL));
+      goto error_input;
+    }
+  }
+  gst_buffer_unmap (frame->input_buffer, &info);
+
+  /* decode as much as possible */
+  do {
+    ret = de265_decode (dec->ctx, &more);
+  } while (more && ret == DE265_OK);
+
+  switch (ret) {
+    case DE265_OK:
+    case DE265_ERROR_WAITING_FOR_INPUT_DATA:
+      break;
+
+    case DE265_ERROR_IMAGE_BUFFER_FULL:
+      dec->buffer_full = 1;
+      if ((img = de265_peek_next_picture (dec->ctx)) == NULL) {
+        return GST_FLOW_OK;
+      }
+      break;
+
+    default:
+      GST_ELEMENT_ERROR (decoder, STREAM, DECODE,
+          ("Error while decoding: %s (code=%d)", de265_get_error_text (ret),
+              ret), (NULL));
+      return GST_FLOW_ERROR;
+  }
+
+  while ((ret = de265_get_warning (dec->ctx)) != DE265_OK) {
+    GST_ELEMENT_WARNING (decoder, STREAM, DECODE,
+        ("%s (code=%d)", de265_get_error_text (ret), ret), (NULL));
+  }
+
+  img = de265_get_next_picture (dec->ctx);
+  if (img == NULL) {
+    /* need more data */
+    return GST_FLOW_OK;
+  }
+
+  return _gst_libde265_return_image (decoder, frame, img);
+
+error_input:
+  gst_buffer_unmap (frame->input_buffer, &info);
+  return GST_FLOW_ERROR;
+}
+
+gboolean
+gst_libde265_dec_plugin_init (GstPlugin * plugin)
+{
+  /* create an elementfactory for the libde265 decoder element */
+  if (!gst_element_register (plugin, "libde265dec",
+          GST_RANK_SECONDARY, GST_TYPE_LIBDE265_DEC))
+    return FALSE;
+
+  return TRUE;
+}
diff --git a/ext/libde265/libde265-dec.h b/ext/libde265/libde265-dec.h
new file mode 100644
index 0000000..03b76bd
--- /dev/null
+++ b/ext/libde265/libde265-dec.h
@@ -0,0 +1,71 @@
+/*
+ * GStreamer HEVC/H.265 video codec.
+ *
+ * Copyright (c) 2014 struktur AG, Joachim Bauch <bauch@struktur.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_LIBDE265_DEC_H__
+#define __GST_LIBDE265_DEC_H__
+
+#include <gst/gst.h>
+#include <gst/video/gstvideodecoder.h>
+
+#include <libde265/de265.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_LIBDE265_DEC \
+    (gst_libde265_dec_get_type())
+#define GST_LIBDE265_DEC(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LIBDE265_DEC,GstLibde265Dec))
+#define GST_LIBDE265_DEC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LIBDE265_DEC,GstLibde265DecClass))
+
+typedef enum
+{
+  GST_TYPE_LIBDE265_FORMAT_PACKETIZED,
+  GST_TYPE_LIBDE265_FORMAT_BYTESTREAM
+} GstLibde265DecFormat;
+
+typedef struct _GstLibde265Dec
+{
+  GstVideoDecoder parent;
+
+  /* private */
+  de265_decoder_context *ctx;
+  GstLibde265DecFormat format;
+  int length_size;
+  int max_threads;
+  int buffer_full;
+  void *codec_data;
+  int codec_data_size;
+  GstVideoCodecState *input_state;
+  GstVideoCodecState *output_state;
+} GstLibde265Dec;
+
+typedef struct _GstLibde265DecClass
+{
+  GstVideoDecoderClass parent;
+} GstLibde265DecClass;
+
+GType gst_libde265_dec_get_type (void);
+
+G_END_DECLS
+
+gboolean gst_libde265_dec_plugin_init (GstPlugin * plugin);
+
+#endif /* __GST_LIBDE265_DEC_H__ */
diff --git a/ext/libmms/Makefile.in b/ext/libmms/Makefile.in
index 0820cdc..ab92a6e 100644
--- a/ext/libmms/Makefile.in
+++ b/ext/libmms/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/libvisual/Makefile.in b/ext/libvisual/Makefile.in
index 1cd7d32..1f8c712 100644
--- a/ext/libvisual/Makefile.in
+++ b/ext/libvisual/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -243,8 +243,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -283,7 +287,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -291,6 +294,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -340,8 +345,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -420,7 +423,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -429,7 +431,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -442,7 +443,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -467,6 +467,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -540,10 +542,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -569,6 +575,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -605,6 +614,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -645,17 +655,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -672,6 +681,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/lv2/Makefile.in b/ext/lv2/Makefile.in
index 210e759..785d0f7 100644
--- a/ext/lv2/Makefile.in
+++ b/ext/lv2/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/mimic/Makefile.in b/ext/mimic/Makefile.in
index aa004f1..8dfc6a6 100644
--- a/ext/mimic/Makefile.in
+++ b/ext/mimic/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/modplug/Makefile.in b/ext/modplug/Makefile.in
index f3c565c..b3970ce 100644
--- a/ext/modplug/Makefile.in
+++ b/ext/modplug/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/modplug/gstmodplug.cc b/ext/modplug/gstmodplug.cc
index 1f7115e..683fbaa 100644
--- a/ext/modplug/gstmodplug.cc
+++ b/ext/modplug/gstmodplug.cc
@@ -34,7 +34,7 @@
  * <refsect2>
  * <title>Example pipeline</title>
  * |[
- * gst-launch -v filesrc location=1990s-nostalgia.xm ! modplug ! audioconvert ! alsasink
+ * gst-launch-1.0 -v filesrc location=1990s-nostalgia.xm ! modplug ! audioconvert ! alsasink
  * ]| Play a FastTracker xm file.
  * </refsect2>
  */
@@ -43,10 +43,6 @@
 #include "config.h"
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 /* Required to not get an undefined warning
  * https://bugzilla.gnome.org/show_bug.cgi?id=613795
  */
@@ -332,19 +328,10 @@
   gboolean flush;
   gint64 cur, stop;
   GstSegment seg;
-/* FIXME timestamp is set but not used */
-#if 0
-  guint64 timestamp;
-#endif
 
   if (modplug->frequency == 0)
     goto no_song;
 
-#if 0
-  timestamp = gst_util_uint64_scale_int (modplug->offset, GST_SECOND,
-      modplug->frequency);
-#endif
-
   gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
       &stop_type, &stop);
 
diff --git a/ext/mpeg2enc/Makefile.in b/ext/mpeg2enc/Makefile.in
index ffbad22..2edecd9 100644
--- a/ext/mpeg2enc/Makefile.in
+++ b/ext/mpeg2enc/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/mpeg2enc/gstmpeg2enc.cc b/ext/mpeg2enc/gstmpeg2enc.cc
index 539a690..9e631e3 100644
--- a/ext/mpeg2enc/gstmpeg2enc.cc
+++ b/ext/mpeg2enc/gstmpeg2enc.cc
@@ -448,7 +448,6 @@
       /* no special action as there is not much to flush;
        * neither is it possible to halt the mpeg encoding loop */
       goto done;
-      break;
     case GST_EVENT_FLUSH_STOP:
       /* forward event */
       result = gst_pad_push_event (enc->srcpad, event);
@@ -461,7 +460,6 @@
       enc->srcresult = GST_FLOW_OK;
       GST_MPEG2ENC_MUTEX_UNLOCK (enc);
       goto done;
-      break;
     case GST_EVENT_EOS:
       /* inform the encoding task that it can stop now */
       GST_MPEG2ENC_MUTEX_LOCK (enc);
@@ -472,7 +470,6 @@
       /* eat this event for now, task will send eos when finished */
       gst_event_unref (event);
       goto done;
-      break;
     case GST_EVENT_CAPS:
     {
       GstCaps *caps;
@@ -481,7 +478,6 @@
       result = gst_mpeg2enc_setcaps (enc, pad, caps);
       gst_event_unref (event);
       goto done;
-      break;
     }
     default:
       /* for a serialized event, wait until an earlier buffer is gone,
diff --git a/ext/mpg123/Makefile.in b/ext/mpg123/Makefile.in
index 0d03fff..8f13897 100644
--- a/ext/mpg123/Makefile.in
+++ b/ext/mpg123/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/mpg123/gstmpg123audiodec.c b/ext/mpg123/gstmpg123audiodec.c
index 791dba9..60d1979 100644
--- a/ext/mpg123/gstmpg123audiodec.c
+++ b/ext/mpg123/gstmpg123audiodec.c
@@ -66,7 +66,7 @@
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS ("audio/mpeg, "
-        "mpegversion = (int) { 1 }, "
+        "mpegversion = (int) 1, "
         "layer = (int) [ 1, 3 ], "
         "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
         "channels = (int) [ 1, 2 ], " "parsed = (boolean) true ")
@@ -438,44 +438,12 @@
 static gboolean
 gst_mpg123_audio_dec_set_format (GstAudioDecoder * dec, GstCaps * input_caps)
 {
-/* Using the parsed information upstream, and the list of allowed caps
- * downstream, this code tries to find a suitable audio info. It is important
- * to keep in mind that the rate and number of channels should never deviate
- * from the one the bitstream has, otherwise mpg123 has to mix channels and/or
- * resample (and as its docs say, its internal resampler is very crude). The
- * sample format, however, can be chosen freely, because the MPEG specs do not
- * mandate any special format. Therefore, rate and number of channels are taken
- * from upstream (which parsed the MPEG frames, so the input_caps contain
- * exactly the rate and number of channels the bitstream actually has), while
- * the sample format is chosen by trying out all caps that are allowed by
- * downstream. This way, the output is adjusted to what the downstream prefers.
- *
- * Also, the new output audio info is not set immediately. Instead, it is
- * considered the "next audioinfo". The code waits for mpg123 to notice the new
- * format (= when mpg123_decode_frame() returns MPG123_AUDIO_DEC_NEW_FORMAT),
- * and then sets the next audioinfo. Otherwise, the next audioinfo is set too
- * soon, which may cause problems with mp3s containing several format headers.
- * One example would be an mp3 with the first 30 seconds using 44.1 kHz, then
- * the next 30 seconds using 32 kHz. Rare, but possible.
- *
- * STEPS:
- *
- * 1. get rate and channels from input_caps
- * 2. get allowed caps from src pad
- * 3. for each structure in allowed caps:
- * 3.1. take format
- * 3.2. if the combination of format with rate and channels is unsupported by
- *      mpg123, go to (3), or exit with error if there are no more structures
- *      to try
- * 3.3. create next audioinfo out of rate,channels,format, and exit
- */
-
-
-  int rate, channels;
+  /* "encoding" is the sample format specifier for mpg123 */
+  int encoding;
+  int sample_rate, num_channels;
+  GstAudioFormat format;
   GstMpg123AudioDec *mpg123_decoder;
-  GstCaps *allowed_srccaps;
-  guint structure_nr;
-  gboolean match_found = FALSE;
+  gboolean retval = FALSE;
 
   mpg123_decoder = GST_MPG123_AUDIO_DEC (dec);
 
@@ -483,7 +451,7 @@
 
   mpg123_decoder->has_next_audioinfo = FALSE;
 
-  /* Get rate and channels from input_caps */
+  /* Get sample rate and number of channels from input_caps */
   {
     GstStructure *structure;
     gboolean err = FALSE;
@@ -492,110 +460,126 @@
      * input caps structures don't make sense */
     structure = gst_caps_get_structure (input_caps, 0);
 
-    if (!gst_structure_get_int (structure, "rate", &rate)) {
+    if (!gst_structure_get_int (structure, "rate", &sample_rate)) {
       err = TRUE;
       GST_ERROR_OBJECT (dec, "Input caps do not have a rate value");
     }
-    if (!gst_structure_get_int (structure, "channels", &channels)) {
+    if (!gst_structure_get_int (structure, "channels", &num_channels)) {
       err = TRUE;
       GST_ERROR_OBJECT (dec, "Input caps do not have a channel value");
     }
 
-    if (err)
-      return FALSE;
+    if (G_UNLIKELY (err))
+      goto done;
   }
 
-  /* Get the caps that are allowed by downstream */
+  /* Get sample format from the allowed src caps */
   {
-    GstCaps *allowed_srccaps_unnorm =
+    GstCaps *allowed_srccaps =
         gst_pad_get_allowed_caps (GST_AUDIO_DECODER_SRC_PAD (dec));
-    if (!allowed_srccaps_unnorm) {
-      GST_ERROR_OBJECT (dec, "Allowed src caps are NULL");
-      return FALSE;
-    }
-    allowed_srccaps = gst_caps_normalize (allowed_srccaps_unnorm);
-  }
 
-  /* Go through all allowed caps, pick the first one that matches */
-  for (structure_nr = 0; structure_nr < gst_caps_get_size (allowed_srccaps);
-      ++structure_nr) {
-    GstStructure *structure;
-    gchar const *format_str;
-    GstAudioFormat format;
-    int encoding;
+    if (allowed_srccaps == NULL) {
+      /* srcpad is not linked (yet), so no peer information is available;
+       * just use the default sample format (16 bit signed integer) */
+      GST_DEBUG_OBJECT (mpg123_decoder,
+          "srcpad is not linked (yet) -> using S16 sample format");
+      format = GST_AUDIO_FORMAT_S16;
+      encoding = MPG123_ENC_SIGNED_16;
+    } else if (gst_caps_is_empty (allowed_srccaps)) {
+      gst_caps_unref (allowed_srccaps);
+      goto done;
+    } else {
+      gchar const *format_str;
+      GValue const *format_value;
 
-    structure = gst_caps_get_structure (allowed_srccaps, structure_nr);
+      /* Look at the sample format values from the first structure */
+      GstStructure *structure = gst_caps_get_structure (allowed_srccaps, 0);
+      format_value = gst_structure_get_value (structure, "format");
 
-    format_str = gst_structure_get_string (structure, "format");
-    if (format_str == NULL) {
-      GST_DEBUG_OBJECT (dec, "Could not get format from src caps");
-      continue;
-    }
+      if (format_value == NULL) {
+        gst_caps_unref (allowed_srccaps);
+        goto done;
+      } else if (GST_VALUE_HOLDS_LIST (format_value)) {
+        /* if value is a format list, pick the first entry */
+        GValue const *fmt_list_value =
+            gst_value_list_get_value (format_value, 0);
+        format_str = g_value_get_string (fmt_list_value);
+      } else if (G_VALUE_HOLDS_STRING (format_value)) {
+        /* if value is a string, use it directly */
+        format_str = g_value_get_string (format_value);
+      } else {
+        GST_ERROR_OBJECT (mpg123_decoder, "unexpected type for 'format' field "
+            "in caps structure %" GST_PTR_FORMAT, structure);
+        gst_caps_unref (allowed_srccaps);
+        goto done;
+      }
 
-    format = gst_audio_format_from_string (format_str);
-    if (format == GST_AUDIO_FORMAT_UNKNOWN) {
-      GST_DEBUG_OBJECT (dec, "Unknown format %s", format_str);
-      continue;
-    }
+      /* get the format value from the string */
+      format = gst_audio_format_from_string (format_str);
+      gst_caps_unref (allowed_srccaps);
 
-    switch (format) {
-      case GST_AUDIO_FORMAT_S16:
-        encoding = MPG123_ENC_SIGNED_16;
-        break;
-      case GST_AUDIO_FORMAT_S24:
-        encoding = MPG123_ENC_SIGNED_24;
-        break;
-      case GST_AUDIO_FORMAT_S32:
-        encoding = MPG123_ENC_SIGNED_32;
-        break;
-      case GST_AUDIO_FORMAT_U16:
-        encoding = MPG123_ENC_UNSIGNED_16;
-        break;
-      case GST_AUDIO_FORMAT_U24:
-        encoding = MPG123_ENC_UNSIGNED_24;
-        break;
-      case GST_AUDIO_FORMAT_U32:
-        encoding = MPG123_ENC_UNSIGNED_32;
-        break;
-      case GST_AUDIO_FORMAT_F32:
-        encoding = MPG123_ENC_FLOAT_32;
-        break;
-      default:
-        GST_DEBUG_OBJECT (dec,
-            "Format %s in srccaps is not supported", format_str);
-        continue;
-    }
+      g_assert (format != GST_AUDIO_FORMAT_UNKNOWN);
 
-    {
-      int err;
-
-      /* Cleanup old formats & set new one */
-      mpg123_format_none (mpg123_decoder->handle);
-      err = mpg123_format (mpg123_decoder->handle, rate, channels, encoding);
-      if (err != MPG123_OK) {
-        GST_DEBUG_OBJECT (dec,
-            "mpg123 cannot use caps %" GST_PTR_FORMAT
-            " because mpg123_format() failed: %s", structure,
-            mpg123_strerror (mpg123_decoder->handle));
-        continue;
+      /* convert format to mpg123 encoding */
+      switch (format) {
+        case GST_AUDIO_FORMAT_S16:
+          encoding = MPG123_ENC_SIGNED_16;
+          break;
+        case GST_AUDIO_FORMAT_S24:
+          encoding = MPG123_ENC_SIGNED_24;
+          break;
+        case GST_AUDIO_FORMAT_S32:
+          encoding = MPG123_ENC_SIGNED_32;
+          break;
+        case GST_AUDIO_FORMAT_U16:
+          encoding = MPG123_ENC_UNSIGNED_16;
+          break;
+        case GST_AUDIO_FORMAT_U24:
+          encoding = MPG123_ENC_UNSIGNED_24;
+          break;
+        case GST_AUDIO_FORMAT_U32:
+          encoding = MPG123_ENC_UNSIGNED_32;
+          break;
+        case GST_AUDIO_FORMAT_F32:
+          encoding = MPG123_ENC_FLOAT_32;
+          break;
+        default:
+          g_assert_not_reached ();
+          goto done;
       }
     }
-
-    gst_audio_info_init (&(mpg123_decoder->next_audioinfo));
-    gst_audio_info_set_format (&(mpg123_decoder->next_audioinfo), format, rate,
-        channels, NULL);
-    GST_LOG_OBJECT (dec, "The next audio format is: %s, %u Hz, %u channels",
-        format_str, rate, channels);
-    mpg123_decoder->has_next_audioinfo = TRUE;
-
-    match_found = TRUE;
-
-    break;
   }
 
-  gst_caps_unref (allowed_srccaps);
+  /* Sample rate, number of channels, and sample format are known at this point.
+   * Set the audioinfo structure's values and the mpg123 format. */
+  {
+    int err;
 
-  return match_found;
+    /* clear all existing format settings from the mpg123 instance */
+    mpg123_format_none (mpg123_decoder->handle);
+    /* set the chosen format */
+    err =
+        mpg123_format (mpg123_decoder->handle, sample_rate, num_channels,
+        encoding);
+
+    if (err != MPG123_OK) {
+      GST_WARNING_OBJECT (dec,
+          "mpg123_format() failed: %s",
+          mpg123_strerror (mpg123_decoder->handle));
+    } else {
+      gst_audio_info_init (&(mpg123_decoder->next_audioinfo));
+      gst_audio_info_set_format (&(mpg123_decoder->next_audioinfo), format,
+          sample_rate, num_channels, NULL);
+      GST_LOG_OBJECT (dec, "The next audio format is: %s, %u Hz, %u channels",
+          gst_audio_format_to_string (format), sample_rate, num_channels);
+      mpg123_decoder->has_next_audioinfo = TRUE;
+
+      retval = TRUE;
+    }
+  }
+
+done:
+  return retval;
 }
 
 
diff --git a/ext/mplex/Makefile.in b/ext/mplex/Makefile.in
index d144ec5..73d67bf 100644
--- a/ext/mplex/Makefile.in
+++ b/ext/mplex/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/mplex/gstmplex.cc b/ext/mplex/gstmplex.cc
index 94bf948..b109d18 100644
--- a/ext/mplex/gstmplex.cc
+++ b/ext/mplex/gstmplex.cc
@@ -190,8 +190,7 @@
 {
   GstElement *element = GST_ELEMENT (mplex);
 
-  mplex->srcpad =
-      gst_pad_new_from_static_template (&src_templ, "src");
+  mplex->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
   gst_element_add_pad (element, mplex->srcpad);
   gst_pad_use_fixed_caps (mplex->srcpad);
   gst_pad_set_activatemode_function (mplex->srcpad,
@@ -507,7 +506,7 @@
       result = gst_mplex_setcaps (sinkpad, caps);
       gst_event_unref (event);
       goto done;
-      break;
+
     }
     default:
       /* for a serialized event, wait until earlier data is gone,
@@ -537,7 +536,8 @@
   if (G_UNLIKELY (mplex->srcresult == GST_FLOW_CUSTOM_SUCCESS)
       && mplex->job->video_tracks == mplex->num_vpads
       && mplex->job->audio_tracks == mplex->num_apads) {
-    gst_pad_start_task (mplex->srcpad, (GstTaskFunction) gst_mplex_loop, mplex, NULL);
+    gst_pad_start_task (mplex->srcpad, (GstTaskFunction) gst_mplex_loop, mplex,
+        NULL);
     mplex->srcresult = GST_FLOW_OK;
   }
 }
diff --git a/ext/musepack/Makefile.in b/ext/musepack/Makefile.in
index 6923541..5f9f73b 100644
--- a/ext/musepack/Makefile.in
+++ b/ext/musepack/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/mythtv/Makefile.am b/ext/mythtv/Makefile.am
deleted file mode 100644
index 0deff63..0000000
--- a/ext/mythtv/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-
-plugin_LTLIBRARIES =	libgstmythtvsrc.la
-
-libgstmythtvsrc_la_SOURCES =	\
-		gstmythtvsrc.c
-
-libgstmythtvsrc_la_CFLAGS = \
-	$(GST_CFLAGS) \
-	$(GMYTH_CFLAGS)
-
-libgstmythtvsrc_la_LDFLAGS = \
-	$(GST_PLUGIN_LDFLAGS)
-libgstmythtvsrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-libgstmythtvsrc_la_LIBADD = \
-	$(GST_BASE_LIBS) \
-	$(GMYTH_LIBS)
-
-noinst_HEADERS = \
-	gstmythtvsrc.h
-
diff --git a/ext/mythtv/gstmythtvsrc.c b/ext/mythtv/gstmythtvsrc.c
deleted file mode 100644
index 174ab86..0000000
--- a/ext/mythtv/gstmythtvsrc.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
- * GStreamer MythTV Plug-in 
- * Copyright (C) <2006> Rosfran Borges <rosfran.borges@indt.org.br>
- * Copyright (C) <2007> Renato Filho <renato.filho@indt.org.br>  
- * 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., 51 Franklin St,
- * Fifth Floor, Boston, MA 02110-1301, USA. 
- */
-
-/**
- * SECTION:element-mythtvsrc
- * @see_also: nuvdemux
- *
- * MythTVSrc allows to access a remote MythTV backend streaming Video/Audio server,
- * and to render audio and video content through a TCP/IP connection to a specific
- * port on this server, and based on a known MythTV protocol that is based on 
- * some message passing, such as REQUEST_BLOCK on a specified number of bytes, to get
- * some chunk of remote file data.
- * You should pass the information aboute the remote MythTV backend server 
- * through the #GstMythtvSrc:location property.
- * 
- * <refsect2>
- * <title>Examples</title>
- * <para>
- * If you want to get the LiveTV content (set channel, TV tuner, RemoteEncoder, 
- * Recorder), use the following URI:
- * <programlisting>
- *  myth://xxx.xxx.xxx.xxx:6543/livetv?channel=BBC
- * </programlisting>
- *
- * This URI will configure the Recorder instance (used to change the channel,
- * start the TV multimedia content transmition, etc.), using
- * the IP address (xxx.xxx.xxx.xxx) and port number (6543) of the MythTV backend 
- * server, and setting the channel name to "BBC". 
- * 
- * To get a already recorded the MythTV NUV file, put the following URI:
- * <programlisting>
- *  myth://xxx.xxx.xxx.xxx:6543/filename.nuv
- * </programlisting>
- * 
- * Another possible way to use the LiveTV content, and just in the case you want to 
- * use the mysql database, put the location URI in the following format:
- * <programlisting>
- *  myth://mythtv:mythtv@xxx.xxx.xxx.xxx:6543/?mythconverg&channel=9
- * </programlisting>
- * 
- * Where the first field is the protocol (myth), the second and third are user 
- * name (mythtv) and password (mythtv), then backend host name and port number, 
- * and the last field is the database name (mythconverg).
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstmythtvsrc.h"
-#include <gmyth/gmyth_file.h>
-#include <gmyth/gmyth_file_transfer.h>
-#include <gmyth/gmyth_file_local.h>
-#include <gmyth/gmyth_livetv.h>
-
-#include <gmyth/gmyth_socket.h>
-#include <gmyth/gmyth_tvchain.h>
-
-#include <string.h>
-#include <unistd.h>
-
-GST_DEBUG_CATEGORY_STATIC (mythtvsrc_debug);
-#define GST_GMYTHTV_ID_NUM                  1
-#define GST_GMYTHTV_CHANNEL_DEFAULT_NUM     (-1)
-#define GMYTHTV_VERSION_DEFAULT             30
-#define GMYTHTV_TRANSFER_MAX_WAITS          100
-#define GMYTHTV_TRANSFER_MAX_RESENDS        2
-#define GMYTHTV_TRANSFER_MAX_BUFFER         (128*1024)
-#define READ_SIZE                           (14*1024)
-#define READ_SIZE_LIVETV                    (80*1024)
-#define GST_FLOW_ERROR_NO_DATA              (-101)
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS_ANY);
-enum
-{
-  PROP_0,
-  PROP_LOCATION,
-  PROP_GMYTHTV_VERSION,
-  PROP_GMYTHTV_LIVE,
-  PROP_GMYTHTV_LIVEID,
-  PROP_GMYTHTV_LIVE_CHAINID,
-  PROP_GMYTHTV_ENABLE_TIMING_POSITION,
-  PROP_GMYTHTV_CHANNEL_NUM
-};
-
-static void gst_mythtv_src_clear (GstMythtvSrc * mythtv_src);
-
-static void gst_mythtv_src_finalize (GObject * gobject);
-
-static GstFlowReturn gst_mythtv_src_create (GstPushSrc * psrc,
-    GstBuffer ** outbuf);
-
-static gboolean gst_mythtv_src_start (GstBaseSrc * bsrc);
-static gboolean gst_mythtv_src_stop (GstBaseSrc * bsrc);
-static gboolean gst_mythtv_src_get_size (GstBaseSrc * bsrc, guint64 * size);
-static gboolean gst_mythtv_src_is_seekable (GstBaseSrc * push_src);
-
-static GstFlowReturn gst_mythtv_src_do_seek (GstBaseSrc * base,
-    GstSegment * segment);
-
-static GstStateChangeReturn
-gst_mythtv_src_change_state (GstElement * element, GstStateChange transition);
-
-static void gst_mythtv_src_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_mythtv_src_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-
-static void gst_mythtv_src_uri_handler_init (gpointer g_iface,
-    gpointer iface_data);
-
-#if 0
-static gboolean gst_mythtv_src_handle_query (GstPad * pad, GstQuery * query);
-static gboolean gst_mythtv_src_handle_event (GstPad * pad, GstEvent * event);
-#endif
-
-static GMythFileReadResult do_read_request_response (GstMythtvSrc * src,
-    guint size, GByteArray * data_ptr);
-
-static void
-_urihandler_init (GType type)
-{
-  static const GInterfaceInfo urihandler_info = {
-    gst_mythtv_src_uri_handler_init,
-    NULL,
-    NULL
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
-
-  GST_DEBUG_CATEGORY_INIT (mythtvsrc_debug, "mythtvsrc", 0, "MythTV src");
-}
-
-GST_BOILERPLATE_FULL (GstMythtvSrc, gst_mythtv_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, _urihandler_init)
-     static void gst_mythtv_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_static_metadata (element_class, "MythTV client source",
-      "Source/Network",
-      "Control and receive data as a client over the network "
-      "via raw socket connections using the MythTV protocol",
-      "Rosfran Borges <rosfran.borges@indt.org.br>, "
-      "Renato Filho <renato.filho@indt.org.br>");
-
-  element_class->change_state = gst_mythtv_src_change_state;
-
-}
-
-static void
-gst_mythtv_src_class_init (GstMythtvSrcClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstPushSrcClass *gstpushsrc_class;
-  GstBaseSrcClass *gstbasesrc_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstbasesrc_class = (GstBaseSrcClass *) klass;
-  gstpushsrc_class = (GstPushSrcClass *) klass;
-
-  gobject_class->set_property = gst_mythtv_src_set_property;
-  gobject_class->get_property = gst_mythtv_src_get_property;
-  gobject_class->finalize = gst_mythtv_src_finalize;
-
-  g_object_class_install_property
-      (gobject_class, PROP_LOCATION,
-      g_param_spec_string ("location", "Location",
-          "The location. In the form:"
-          "\n\t\t\tmyth://a.com/file.nuv"
-          "\n\t\t\tmyth://a.com:23223/file.nuv"
-          "\n\t\t\tmyth://a.com/?channel=123"
-          "\n\t\t\tmyth://a.com/?channel=Channel%203"
-          "\n\t\t\ta.com/file.nuv - default scheme 'myth'",
-          "", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property
-      (gobject_class, PROP_GMYTHTV_VERSION,
-      g_param_spec_int ("mythtv-version", "mythtv-version",
-          "Change MythTV version", 26, 30, 26,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property
-      (gobject_class, PROP_GMYTHTV_LIVEID,
-      g_param_spec_int ("mythtv-live-id", "mythtv-live-id",
-          "Change MythTV version",
-          0, 200, GST_GMYTHTV_ID_NUM,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property
-      (gobject_class, PROP_GMYTHTV_LIVE_CHAINID,
-      g_param_spec_string ("mythtv-live-chainid", "mythtv-live-chainid",
-          "Sets the MythTV chain ID (from TV Chain)", "",
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property
-      (gobject_class, PROP_GMYTHTV_LIVE,
-      g_param_spec_boolean ("mythtv-live", "mythtv-live",
-          "Enable MythTV Live TV content streaming", FALSE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property
-      (gobject_class, PROP_GMYTHTV_ENABLE_TIMING_POSITION,
-      g_param_spec_boolean ("mythtv-enable-timing-position",
-          "mythtv-enable-timing-position",
-          "Enable MythTV Live TV content size continuous updating",
-          FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property
-      (gobject_class, PROP_GMYTHTV_CHANNEL_NUM,
-      g_param_spec_string ("mythtv-channel", "mythtv-channel",
-          "Change MythTV channel number", "",
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_mythtv_src_start);
-  gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_mythtv_src_stop);
-  gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_mythtv_src_get_size);
-  gstbasesrc_class->is_seekable =
-      GST_DEBUG_FUNCPTR (gst_mythtv_src_is_seekable);
-  gstbasesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_mythtv_src_do_seek);
-  gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_mythtv_src_create);
-
-  GST_DEBUG_CATEGORY_INIT (mythtvsrc_debug, "mythtvsrc", 0,
-      "MythTV Client Source");
-}
-
-static void
-gst_mythtv_src_init (GstMythtvSrc * this, GstMythtvSrcClass * g_class)
-{
-  this->file = NULL;
-  this->unique_setup = FALSE;
-  this->mythtv_version = GMYTHTV_VERSION_DEFAULT;
-  this->state = GST_MYTHTV_SRC_FILE_TRANSFER;
-  this->bytes_read = 0;
-  this->prev_content_size = 0;
-  this->content_size = 0;
-  this->read_offset = 0;
-  this->content_size_last = 0;
-  this->live_tv = FALSE;
-  this->enable_timing_position = FALSE;
-  this->update_prog_chain = FALSE;
-  this->user_agent = g_strdup ("mythtvsrc");
-  this->update_prog_chain = FALSE;
-  this->channel_name = NULL;
-  this->eos = FALSE;
-  this->wait_to_transfer = 0;
-  this->spawn_livetv = NULL;
-  gst_base_src_set_format (GST_BASE_SRC (this), GST_FORMAT_BYTES);
-#if 0
-  gst_pad_set_event_function (GST_BASE_SRC_PAD (GST_BASE_SRC (this)),
-      gst_mythtv_src_handle_event);
-#endif
-#if 0
-  gst_pad_set_query_function (GST_BASE_SRC_PAD (GST_BASE_SRC (this)),
-      gst_mythtv_src_handle_query);
-#endif
-
-}
-
-static void
-gst_mythtv_src_clear (GstMythtvSrc * mythtv_src)
-{
-  mythtv_src->unique_setup = FALSE;
-
-#if 0
-  if (mythtv_src->spawn_livetv) {
-    g_object_unref (mythtv_src->spawn_livetv);
-    mythtv_src->spawn_livetv = NULL;
-  }
-
-  if (mythtv_src->file) {
-    g_object_unref (mythtv_src->file);
-    mythtv_src->file = NULL;
-  }
-
-  if (mythtv_src->backend_info) {
-    g_object_unref (mythtv_src->backend_info);
-    mythtv_src->backend_info = NULL;
-  }
-#endif
-}
-
-static void
-gst_mythtv_src_finalize (GObject * gobject)
-{
-  GstMythtvSrc *this = GST_MYTHTV_SRC (gobject);
-
-  gst_mythtv_src_clear (this);
-
-  if (this->uri_name) {
-    g_free (this->uri_name);
-    this->uri_name = NULL;
-  }
-
-  if (this->user_agent) {
-    g_free (this->user_agent);
-    this->user_agent = NULL;
-  }
-
-  G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-static GMythFileReadResult
-do_read_request_response (GstMythtvSrc * src, guint size, GByteArray * data_ptr)
-{
-  gint read = 0;
-  guint sizetoread = size;
-  gint max_iters = GMYTHTV_TRANSFER_MAX_RESENDS;
-  GMythFileReadResult result;
-
-  GST_LOG_OBJECT (src, "Starting: Reading %d bytes...", sizetoread);
-
-  result = GMYTH_FILE_READ_OK;
-  /*
-   * Loop sending the Myth File Transfer request: Retry whilst
-   * authentication fails and we supply it. 
-   */
-
-  while (sizetoread == size && --max_iters > 0) {
-    /*
-     * if ( gmyth_backend_info_is_local_file(src->backend_info) ) 
-     */
-    if (IS_GMYTH_FILE_LOCAL (src->file))
-      result = gmyth_file_local_read (GMYTH_FILE_LOCAL (src->file),
-          data_ptr, sizetoread, src->live_tv);
-    else if (IS_GMYTH_FILE_TRANSFER (src->file))
-      result = gmyth_file_transfer_read (GMYTH_FILE_TRANSFER (src->file),
-          data_ptr, sizetoread, src->live_tv);
-
-    if (data_ptr->len > 0) {
-      read += data_ptr->len;
-      sizetoread -= data_ptr->len;
-    } else if (data_ptr->len <= 0) {
-      if (src->live_tv == FALSE) {
-        result = GMYTH_FILE_READ_EOF;
-        goto eos;
-      } else {
-        if (result == GMYTH_FILE_READ_ERROR) {  /* -314 */
-          GST_INFO_OBJECT (src, "[LiveTV] FileTransfer READ_ERROR!");
-        }
-        goto done;
-      }
-    }
-    /*
-     * else if (data_ptr->len == 0) goto done; 
-     */
-    if (read == sizetoread)
-      goto done;
-  }
-
-  if ((read < 0 && !src->live_tv) || max_iters == 0) {
-    result = GMYTH_FILE_READ_EOF;
-    goto eos;
-  }
-  goto done;
-
-eos:
-  src->eos = TRUE;
-
-done:
-  GST_LOG_OBJECT (src, "Finished read: result %d", result);
-  return result;
-}
-
-static GstFlowReturn
-gst_mythtv_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
-{
-  GstMythtvSrc *src;
-  GstFlowReturn ret = GST_FLOW_OK;
-  GByteArray *buffer;
-  GMythFileReadResult result = GMYTH_FILE_READ_OK;
-
-  src = GST_MYTHTV_SRC (psrc);
-
-  buffer = g_byte_array_new ();
-  if (src->live_tv)
-    result = do_read_request_response (src, READ_SIZE_LIVETV, buffer);
-  else
-    result = do_read_request_response (src, READ_SIZE, buffer);
-
-  if (result == GMYTH_FILE_READ_ERROR)
-    goto read_error;
-
-  *outbuf = gst_buffer_new ();
-  GST_BUFFER_SIZE (*outbuf) = buffer->len;
-  GST_BUFFER_MALLOCDATA (*outbuf) = buffer->data;
-  GST_BUFFER_DATA (*outbuf) = GST_BUFFER_MALLOCDATA (*outbuf);
-  GST_BUFFER_OFFSET (*outbuf) = src->read_offset;
-  GST_BUFFER_OFFSET_END (*outbuf) =
-      src->read_offset + GST_BUFFER_SIZE (*outbuf);
-
-  src->read_offset += GST_BUFFER_SIZE (*outbuf);
-  src->bytes_read += GST_BUFFER_SIZE (*outbuf);
-
-  g_byte_array_free (buffer, FALSE);
-
-  if (result == GMYTH_FILE_READ_NEXT_PROG_CHAIN) {
-    GstPad *peer;
-
-    peer = gst_pad_get_peer (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)));
-    gst_pad_send_event (peer,
-        gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0));
-
-    gst_object_unref (peer);
-  }
-
-  if (src->eos || (!src->live_tv && (src->bytes_read >= src->content_size)))
-    ret = GST_FLOW_UNEXPECTED;
-
-  GST_LOG_OBJECT (src, "Create finished: %d", ret);
-  return ret;
-
-read_error:
-  GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
-      ("Could not read any bytes (%d, %s)", result, src->uri_name));
-  return GST_FLOW_ERROR;
-}
-
-static gboolean
-gst_mythtv_src_do_seek (GstBaseSrc * base, GstSegment * segment)
-{
-  GstMythtvSrc *src = GST_MYTHTV_SRC (base);
-  gint64 new_offset = -1;
-  gint64 actual_seek = segment->start;
-  gboolean ret = TRUE;
-
-  GST_LOG_OBJECT (src, "seek, segment: %" GST_SEGMENT_FORMAT, segment);
-
-  if (segment->format != GST_FORMAT_BYTES) {
-    ret = FALSE;
-    goto done;
-  }
-  GST_LOG_OBJECT (src, "actual_seek = %" G_GINT64_FORMAT ", read_offset = "
-      "%" G_GINT64_FORMAT, actual_seek, src->read_offset);
-  /*
-   * verify if it needs to seek 
-   */
-  if (src->read_offset != actual_seek) {
-    if (IS_GMYTH_FILE_LOCAL (src->file))
-      new_offset = gmyth_file_local_seek (GMYTH_FILE_LOCAL (src->file),
-          segment->start, G_SEEK_SET);
-    else if (IS_GMYTH_FILE_TRANSFER (src->file))
-      new_offset = gmyth_file_transfer_seek (GMYTH_FILE_TRANSFER (src->file),
-          segment->start, G_SEEK_SET);
-    if (G_UNLIKELY (new_offset < 0)) {
-      ret = FALSE;
-      if (!src->live_tv)
-        goto eos;
-    }
-
-    src->read_offset = new_offset;
-
-    if (ret == FALSE) {
-      GST_INFO_OBJECT (src, "Failed to set the SEEK on segment!");
-    }
-  }
-
-done:
-  return ret;
-
-eos:
-  GST_DEBUG_OBJECT (src, "EOS found on seeking!!!");
-  return FALSE;
-}
-
-/*
- * create a socket for connecting to remote server 
- */
-static gboolean
-gst_mythtv_src_start (GstBaseSrc * bsrc)
-{
-  GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
-
-  GString *chain_id_local = NULL;
-  GMythURI *gmyth_uri = NULL;
-  gboolean ret = TRUE;
-  GstBaseSrc *basesrc;
-  GstMessage *msg;
-
-  if (src->unique_setup == FALSE) {
-    src->unique_setup = TRUE;
-  } else {
-    goto done;
-  }
-
-  gmyth_uri = gmyth_uri_new_with_value (src->uri_name);
-  src->backend_info = gmyth_backend_info_new_with_uri (src->uri_name);
-  src->live_tv = gmyth_uri_is_livetv (gmyth_uri);
-
-  if (src->live_tv) {
-    gchar *ch = gmyth_uri_get_channel_name (gmyth_uri);
-    src->spawn_livetv = gmyth_livetv_new (src->backend_info);
-
-    if (ch != NULL)
-      src->channel_name = ch;
-
-    if (src->channel_name != NULL) {
-      gboolean result;
-
-      result = gmyth_livetv_channel_name_setup (src->spawn_livetv,
-          src->channel_name);
-      if (result == FALSE) {
-        GST_INFO_OBJECT (src, "LiveTV setup felt down on error");
-        ret = FALSE;
-        goto init_failed;
-      }
-    } else {
-      if (gmyth_livetv_setup (src->spawn_livetv) == FALSE) {
-        GST_INFO_OBJECT (src, "LiveTV setup felt down on error");
-        ret = FALSE;
-        goto init_failed;
-      }
-    }
-
-    src->file =
-        GMYTH_FILE (gmyth_livetv_create_file_transfer (src->spawn_livetv));
-    if (NULL == src->file) {
-      GST_INFO_OBJECT (src, "[LiveTV] FileTransfer equals to NULL");
-      ret = FALSE;
-      goto init_failed;
-    }
-
-    /*
-     * Check if the file is local to this specific client renderer 
-     */
-    if (gmyth_uri_is_local_file (gmyth_uri))
-      ret = gmyth_file_local_open (GMYTH_FILE_LOCAL (src->file));
-    else
-      ret = gmyth_file_transfer_open (GMYTH_FILE_TRANSFER (src->file),
-          (src->spawn_livetv->uri != NULL ?
-              gmyth_uri_get_path (src->spawn_livetv->uri) :
-              src->spawn_livetv->proginfo->pathname->str));
-    /*
-     * sets the mythtvsrc "location" property 
-     */
-    g_object_set (src, "location", gmyth_file_get_uri (src->file), NULL);
-
-    if (!ret) {
-      GST_INFO_OBJECT (src,
-          "Error: couldn't open the FileTransfer from LiveTV source!");
-      g_object_unref (src->file);
-      src->file = NULL;
-      goto init_failed;
-    }
-  } /* If live-tv */
-  else {
-    /*
-     * Check if the file is local to this specific client renderer,
-     * and tries to open a local connection 
-     */
-    if (gmyth_uri_is_local_file (gmyth_uri)) {
-      src->file = GMYTH_FILE (gmyth_file_local_new (src->backend_info));
-      ret = gmyth_file_local_open (GMYTH_FILE_LOCAL (src->file));
-    } else {
-      src->file = GMYTH_FILE (gmyth_file_transfer_new (src->backend_info));
-      ret =
-          gmyth_file_transfer_open (GMYTH_FILE_TRANSFER (src->file),
-          src->uri_name);
-    }
-  }
-
-  if (NULL == src->file) {
-    GST_INFO_OBJECT (src, "FileTransfer is NULL");
-    goto init_failed;
-  }
-
-  if (ret == FALSE) {
-    GST_INFO_OBJECT (src,
-        "MythTV FileTransfer request failed when setting up socket connection!");
-    goto begin_req_failed;
-  }
-
-  GST_INFO_OBJECT (src, "MythTV FileTransfer filesize = %" G_GINT64_FORMAT ", "
-      "content_size = %" G_GINT64_FORMAT, gmyth_file_get_filesize (src->file),
-      src->content_size);
-
-  src->content_size = gmyth_file_get_filesize (src->file);
-
-  msg = gst_message_new_duration_changed (GST_OBJECT (src));
-  gst_element_post_message (GST_ELEMENT (src), msg);
-
-  src->do_start = FALSE;
-
-  basesrc = GST_BASE_SRC_CAST (src);
-  gst_segment_set_duration (&basesrc->segment, GST_FORMAT_BYTES,
-      src->content_size);
-  gst_element_post_message (GST_ELEMENT (src),
-      gst_message_new_duration_changed (GST_OBJECT (src)));
-#if 0
-  gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
-      gst_event_new_new_segment (TRUE, 1.0,
-          GST_FORMAT_BYTES, 0, src->content_size, 0));
-#endif
-done:
-  if (gmyth_uri != NULL) {
-    g_object_unref (gmyth_uri);
-    gmyth_uri = NULL;
-  }
-
-  if (chain_id_local != NULL) {
-    g_string_free (chain_id_local, TRUE);
-    chain_id_local = NULL;
-  }
-
-  return TRUE;
-
-  /*
-   * ERRORS
-   */
-init_failed:
-  if (gmyth_uri != NULL) {
-    g_object_unref (gmyth_uri);
-    gmyth_uri = NULL;
-  }
-
-  if (src->spawn_livetv != NULL) {
-    g_object_unref (src->spawn_livetv);
-    src->spawn_livetv = NULL;
-  }
-
-  GST_ELEMENT_ERROR (src, LIBRARY, INIT,
-      (NULL),
-      ("Could not initialize MythTV library (%i, %s)", ret, src->uri_name));
-
-
-  gst_mythtv_src_clear (src);
-
-  return FALSE;
-begin_req_failed:
-  if (gmyth_uri != NULL) {
-    g_object_unref (gmyth_uri);
-    gmyth_uri = NULL;
-  }
-
-  GST_ELEMENT_ERROR (src, LIBRARY, INIT,
-      (NULL),
-      ("Could not begin request sent to MythTV server (%i, %s)",
-          ret, src->uri_name));
-  return FALSE;
-}
-
-static gboolean
-gst_mythtv_src_get_size (GstBaseSrc * bsrc, guint64 * size)
-{
-  GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
-  gboolean ret = TRUE;
-
-  GST_LOG_OBJECT (src,
-      "Differs from previous content size: %d (max.: %d)",
-      abs (src->content_size - src->prev_content_size),
-      GMYTHTV_TRANSFER_MAX_BUFFER);
-
-  if (src->live_tv) {
-    ret = FALSE;
-  } else if (src->live_tv && src->enable_timing_position
-      && (abs (src->content_size - src->bytes_read) <
-          GMYTHTV_TRANSFER_MAX_BUFFER)) {
-    gint64 new_offset;
-
-    new_offset = gmyth_recorder_get_file_position (src->spawn_livetv->recorder);
-    if (new_offset > 0 && new_offset > src->content_size) {
-      src->content_size = new_offset;
-    } else if (new_offset < src->content_size) {
-      src->update_prog_chain = TRUE;
-    }
-  }
-
-  *size = src->content_size;
-  GST_LOG_OBJECT (src, "Content size = %" G_GINT64_FORMAT, src->content_size);
-  return ret;
-}
-
-/*
- * close the socket and associated resources used both to recover from
- * errors and go to NULL state 
- */
-static gboolean
-gst_mythtv_src_stop (GstBaseSrc * bsrc)
-{
-  GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
-
-  gst_mythtv_src_clear (src);
-  return TRUE;
-}
-
-#if 0
-static gint64
-gst_mythtv_src_get_position (GstMythtvSrc * src)
-{
-  gint64 size_tmp = 0;
-  guint max_tries = 2;
-
-  if (src->live_tv == TRUE &&
-      (abs (src->content_size - src->bytes_read) <
-          GMYTHTV_TRANSFER_MAX_BUFFER)) {
-
-  get_file_pos:
-    g_usleep (10);
-    size_tmp = gmyth_recorder_get_file_position (src->spawn_livetv->recorder);
-    if (size_tmp > (src->content_size + GMYTHTV_TRANSFER_MAX_BUFFER))
-      src->content_size = size_tmp;
-    else if (size_tmp > 0 && --max_tries > 0)
-      goto get_file_pos;
-    GST_LOG_OBJECT (src, "file_position = %" G_GINT64_FORMAT, size_tmp);
-    /*
-     * sets the last content size amount before it can be updated 
-     */
-    src->prev_content_size = src->content_size;
-  }
-  return src->content_size;
-}
-
-static gboolean
-gst_mythtv_src_handle_event (GstPad * pad, GstEvent * event)
-{
-  GstMythtvSrc *src = GST_MYTHTV_SRC (GST_PAD_PARENT (pad));
-  gint64 cont_size = 0;
-  gboolean ret = TRUE;
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_EOS:
-      if (src->live_tv) {
-        cont_size = gst_mythtv_src_get_position (src);
-        if (cont_size > src->content_size) {
-          src->content_size = cont_size;
-          src->eos = FALSE;
-        } else {
-          src->eos = TRUE;
-          gst_element_set_state (GST_ELEMENT (src), GST_STATE_NULL);
-          gst_element_set_locked_state (GST_ELEMENT (src), FALSE);
-        }
-      }
-      break;
-    default:
-      ret = gst_pad_event_default (pad, event);
-  }
-  GST_DEBUG_OBJECT (src, "HANDLE EVENT %d", ret);
-  return ret;
-}
-#endif
-static gboolean
-gst_mythtv_src_is_seekable (GstBaseSrc * push_src)
-{
-  return TRUE;
-}
-
-#if 0
-static gboolean
-gst_mythtv_src_handle_query (GstPad * pad, GstQuery * query)
-{
-  gboolean res = FALSE;
-  GstMythtvSrc *myth = GST_MYTHTV_SRC (gst_pad_get_parent (pad));
-  GstFormat formt;
-
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_POSITION:
-      gst_query_parse_position (query, &formt, NULL);
-      if (formt == GST_FORMAT_BYTES) {
-        gst_query_set_position (query, formt, myth->read_offset);
-        GST_DEBUG_OBJECT (myth, "POS %" G_GINT64_FORMAT, myth->read_offset);
-        res = TRUE;
-      } else if (formt == GST_FORMAT_TIME) {
-        res = gst_pad_query_default (pad, query);
-      }
-      break;
-    case GST_QUERY_DURATION:
-      gst_query_parse_duration (query, &formt, NULL);
-      if (formt == GST_FORMAT_BYTES) {
-        gint64 size = myth->content_size;
-
-        gst_query_set_duration (query, GST_FORMAT_BYTES, 10);
-        GST_DEBUG_OBJECT (myth, "SIZE %" G_GINT64_FORMAT, size);
-        res = TRUE;
-      } else if (formt == GST_FORMAT_TIME) {
-        res = gst_pad_query_default (pad, query);
-      }
-      break;
-    default:
-      res = gst_pad_query_default (pad, query);
-      break;
-  }
-
-  gst_object_unref (myth);
-
-  return res;
-}
-#endif
-static GstStateChangeReturn
-gst_mythtv_src_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
-  GstMythtvSrc *src = GST_MYTHTV_SRC (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      break;
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      if (!src->uri_name) {
-        GST_WARNING_OBJECT (src, "Invalid location");
-        return ret;
-      }
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      if (src->live_tv) {
-        if (!gmyth_recorder_send_frontend_ready_command
-            (src->spawn_livetv->recorder))
-          GST_WARNING_OBJECT (src,
-              "Couldn't send the FRONTEND_READY message to the backend!");
-        else
-          GST_DEBUG_OBJECT (src, "FRONTEND_READY was sent to the backend");
-      }
-      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_NULL:
-      gst_mythtv_src_clear (src);
-      break;
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      break;
-    default:
-      break;
-  }
-
-  return ret;
-}
-
-static void
-gst_mythtv_src_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstMythtvSrc *mythtvsrc = GST_MYTHTV_SRC (object);
-
-  GST_OBJECT_LOCK (mythtvsrc);
-  switch (prop_id) {
-    case PROP_LOCATION:
-      if (!g_value_get_string (value)) {
-        GST_WARNING ("location property cannot be NULL");
-        break;
-      }
-
-      if (mythtvsrc->uri_name != NULL) {
-        g_free (mythtvsrc->uri_name);
-        mythtvsrc->uri_name = NULL;
-      }
-      mythtvsrc->uri_name = g_value_dup_string (value);
-      break;
-    case PROP_GMYTHTV_VERSION:
-      mythtvsrc->mythtv_version = g_value_get_int (value);
-      break;
-    case PROP_GMYTHTV_LIVEID:
-      mythtvsrc->live_tv_id = g_value_get_int (value);
-      break;
-    case PROP_GMYTHTV_LIVE:
-      mythtvsrc->live_tv = g_value_get_boolean (value);
-      break;
-    case PROP_GMYTHTV_ENABLE_TIMING_POSITION:
-      mythtvsrc->enable_timing_position = g_value_get_boolean (value);
-      break;
-    case PROP_GMYTHTV_LIVE_CHAINID:
-      if (!g_value_get_string (value)) {
-        GST_WARNING_OBJECT (object,
-            "MythTV Live chainid property cannot be NULL");
-        break;
-      }
-
-      if (mythtvsrc->live_chain_id != NULL) {
-        g_free (mythtvsrc->live_chain_id);
-        mythtvsrc->live_chain_id = NULL;
-      }
-      mythtvsrc->live_chain_id = g_value_dup_string (value);
-      break;
-    case PROP_GMYTHTV_CHANNEL_NUM:
-      mythtvsrc->channel_name = g_value_dup_string (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-
-  GST_OBJECT_UNLOCK (mythtvsrc);
-}
-
-static void
-gst_mythtv_src_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstMythtvSrc *mythtvsrc = GST_MYTHTV_SRC (object);
-
-  GST_OBJECT_LOCK (mythtvsrc);
-  switch (prop_id) {
-    case PROP_LOCATION:
-      g_value_set_string (value, mythtvsrc->uri_name);
-      break;
-    case PROP_GMYTHTV_VERSION:
-      g_value_set_int (value, mythtvsrc->mythtv_version);
-      break;
-    case PROP_GMYTHTV_LIVEID:
-      g_value_set_int (value, mythtvsrc->live_tv_id);
-      break;
-    case PROP_GMYTHTV_LIVE:
-      g_value_set_boolean (value, mythtvsrc->live_tv);
-      break;
-    case PROP_GMYTHTV_ENABLE_TIMING_POSITION:
-      g_value_set_boolean (value, mythtvsrc->enable_timing_position);
-      break;
-    case PROP_GMYTHTV_LIVE_CHAINID:
-      g_value_set_string (value, mythtvsrc->live_chain_id);
-      break;
-    case PROP_GMYTHTV_CHANNEL_NUM:
-      g_value_set_string (value, mythtvsrc->channel_name);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-  GST_OBJECT_UNLOCK (mythtvsrc);
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  return gst_element_register (plugin, "mythtvsrc", GST_RANK_NONE,
-      GST_TYPE_MYTHTV_SRC);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    mythtv,
-    "lib MythTV src",
-    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
-
-
-/*** GSTURIHANDLER INTERFACE *************************************************/
-static guint
-gst_mythtv_src_uri_get_type (void)
-{
-  return GST_URI_SRC;
-}
-
-static gchar **
-gst_mythtv_src_uri_get_protocols (void)
-{
-  static const gchar *protocols[] = { "myth", "myths", NULL };
-
-  return (gchar **) protocols;
-}
-
-static const gchar *
-gst_mythtv_src_uri_get_uri (GstURIHandler * handler)
-{
-  GstMythtvSrc *src = GST_MYTHTV_SRC (handler);
-
-  return src->uri_name;
-}
-
-static gboolean
-gst_mythtv_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
-  GstMythtvSrc *src = GST_MYTHTV_SRC (handler);
-
-  gchar *protocol;
-
-  protocol = gst_uri_get_protocol (uri);
-  if ((strcmp (protocol, "myth") != 0)
-      && (strcmp (protocol, "myths") != 0)) {
-    g_free (protocol);
-    return FALSE;
-  }
-  g_free (protocol);
-  g_object_set (src, "location", uri, NULL);
-
-  return TRUE;
-}
-
-static void
-gst_mythtv_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
-  GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
-  iface->get_type = gst_mythtv_src_uri_get_type;
-  iface->get_protocols = gst_mythtv_src_uri_get_protocols;
-  iface->get_uri = gst_mythtv_src_uri_get_uri;
-  iface->set_uri = gst_mythtv_src_uri_set_uri;
-}
diff --git a/ext/mythtv/gstmythtvsrc.h b/ext/mythtv/gstmythtvsrc.h
deleted file mode 100644
index 1f5536d..0000000
--- a/ext/mythtv/gstmythtvsrc.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) <2006> INdT - Rosfran Borges <rosfran.borges@indt.org.br>
- * Copyright (C) <2007> INdT - Rentao Filho <renato.filho@indt.org.br>
- *
- * 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., 51 Franklin St,
- * Fifth Floor, Boston, MA 02110-1301, USA. 
- */
-
-#ifndef __GST_MYTHTV_SRC_H__
-#define __GST_MYTHTV_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesrc.h>
-#include <gst/base/gstpushsrc.h>
-#include <stdio.h>
-
-#include <gmyth/gmyth_socket.h>
-#include <gmyth/gmyth_file.h>
-#include <gmyth/gmyth_file_transfer.h>
-#include <gmyth/gmyth_file_local.h>
-#include <gmyth/gmyth_livetv.h>
-#include <gmyth/gmyth_backendinfo.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_MYTHTV_SRC \
-  (gst_mythtv_src_get_type())
-#define GST_MYTHTV_SRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MYTHTV_SRC,GstMythtvSrc))
-#define GST_MYTHTV_SRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MYTHTV_SRC,GstMythtvSrcClass))
-#define GST_IS_MYTHTV_SRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MYTHTV_SRC))
-#define GST_IS_MYTHTV_SRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MYTHTV_SRC))
-typedef struct _GstMythtvSrc GstMythtvSrc;
-typedef struct _GstMythtvSrcClass GstMythtvSrcClass;
-
-typedef enum {
-  GST_MYTHTV_SRC_FILE_TRANSFER,
-  GST_MYTHTV_SRC_NEXT_PROGRAM_CHAIN,
-  GST_MYTHTV_SRC_INVALID_DATA
-} GstMythtvState;
-
-struct _GstMythtvSrc {
-  GstPushSrc      element;
-
-  /*
-   * MythFileTransfer 
-   */
-  GMythFile      *file;
-  GMythLiveTV    *spawn_livetv;
-  GMythBackendInfo *backend_info;
-  GstMythtvState  state;
-  gchar          *uri_name;
-  gchar          *user_agent;
-  gchar          *live_chain_id;
-  gint            mythtv_version;
-  gint64          content_size;
-  gint64          prev_content_size;
-  gint64          content_size_last;
-  guint64         bytes_read;
-  gint64          read_offset;
-  gboolean        eos;
-  gboolean        do_start;
-  gboolean        unique_setup;
-  gboolean        live_tv;
-  gboolean        enable_timing_position;
-  gint            live_tv_id;
-  gchar          *channel_name;
-  guint           mode;
-
-  /*
-   * MythTV capabilities 
-   */
-  GstCaps        *mythtv_caps;
-  gboolean        update_prog_chain;
-
-  /*
-   * stablish a maximum iteration value to the IS_RECORDING message 
-   */
-  guint           wait_to_transfer;
-};
-
-struct _GstMythtvSrcClass {
-  GstPushSrcClass parent_class;
-};
-
-GType           gst_mythtv_src_get_type(void);
-
-G_END_DECLS
-#endif /* __GST_MYTHTV_SRC_H__ */
diff --git a/ext/nas/Makefile.in b/ext/nas/Makefile.in
index dcbf3df..b88d65f 100644
--- a/ext/nas/Makefile.in
+++ b/ext/nas/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/neon/Makefile.in b/ext/neon/Makefile.in
index 6296d26..384b33a 100644
--- a/ext/neon/Makefile.in
+++ b/ext/neon/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/ofa/Makefile.in b/ext/ofa/Makefile.in
index e45577c..6405e19 100644
--- a/ext/ofa/Makefile.in
+++ b/ext/ofa/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/openal/Makefile.in b/ext/openal/Makefile.in
index 5153da1..5df33fd 100644
--- a/ext/openal/Makefile.in
+++ b/ext/openal/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -249,8 +249,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -289,7 +293,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -297,6 +300,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -346,8 +351,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -426,7 +429,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -435,7 +437,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -448,7 +449,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -473,6 +473,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -546,10 +548,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -575,6 +581,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -611,6 +620,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -651,17 +661,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -678,6 +687,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/opencv/Makefile.in b/ext/opencv/Makefile.in
index 5f62a08..9992fbc 100644
--- a/ext/opencv/Makefile.in
+++ b/ext/opencv/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -285,8 +285,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -325,7 +329,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -333,6 +336,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -382,8 +387,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -462,7 +465,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -471,7 +473,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -484,7 +485,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -509,6 +509,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -582,10 +584,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -611,6 +617,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -647,6 +656,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -687,17 +697,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -714,6 +723,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/opencv/MotionCells.cpp b/ext/opencv/MotionCells.cpp
index 5eaa67f..449fe24 100644
--- a/ext/opencv/MotionCells.cpp
+++ b/ext/opencv/MotionCells.cpp
@@ -75,7 +75,12 @@
   m_beta = 0.5;
   m_useAlpha = false;
   m_isVisible = false;
-
+  m_pCells = NULL;
+  m_gridx = 0;
+  m_gridy = 0;
+  m_cellwidth = 0;
+  m_cellheight = 0;
+  m_sensitivity = 0;
 }
 
 MotionCells::~MotionCells ()
diff --git a/ext/opencv/gstfaceblur.c b/ext/opencv/gstfaceblur.c
index fbf39e5..cadeaed 100644
--- a/ext/opencv/gstfaceblur.c
+++ b/ext/opencv/gstfaceblur.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
  * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
  * Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
+ * Copyright (C) 2011 Robert Jobbagy <jobbagy.robert@gmail.com>
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -51,7 +52,7 @@
  * <refsect2>
  * <title>Example launch line</title>
  * |[
- * gst-launch-0.10 videotestsrc ! decodebin ! videoconvert ! faceblur ! videoconvert ! xvimagesink
+ * gst-launch-1.0 autovideosrc ! videoconvert ! faceblur ! videoconvert ! autovideosink
  * ]|
  * </refsect2>
  */
@@ -71,13 +72,58 @@
 #define DEFAULT_PROFILE OPENCV_PREFIX G_DIR_SEPARATOR_S "share" \
     G_DIR_SEPARATOR_S "opencv" G_DIR_SEPARATOR_S "haarcascades" \
     G_DIR_SEPARATOR_S "haarcascade_frontalface_default.xml"
+#define DEFAULT_SCALE_FACTOR 1.25
+#define DEFAULT_FLAGS CV_HAAR_DO_CANNY_PRUNING
+#define DEFAULT_MIN_NEIGHBORS 3
+#define DEFAULT_MIN_SIZE_WIDTH 30
+#define DEFAULT_MIN_SIZE_HEIGHT 30
 
 enum
 {
   PROP_0,
-  PROP_PROFILE
+  PROP_PROFILE,
+  PROP_SCALE_FACTOR,
+  PROP_MIN_NEIGHBORS,
+  PROP_FLAGS,
+  PROP_MIN_SIZE_WIDTH,
+  PROP_MIN_SIZE_HEIGHT
 };
 
+/**
+ * GstOpencvFaceDetectFlags:
+ * @GST_CAMERABIN_FLAG_SOURCE_RESIZE: enable video crop and scale
+ *   after capture
+ *
+ * Flags parameter to OpenCV's cvHaarDetectObjects function.
+ */
+typedef enum
+{
+  GST_OPENCV_FACE_BLUR_HAAR_DO_CANNY_PRUNING = (1 << 0)
+} GstOpencvFaceBlurFlags;
+
+#define GST_TYPE_OPENCV_FACE_BLUR_FLAGS (gst_opencv_face_blur_flags_get_type())
+
+static void
+register_gst_opencv_face_blur_flags (GType * id)
+{
+  static const GFlagsValue values[] = {
+    {(guint) GST_OPENCV_FACE_BLUR_HAAR_DO_CANNY_PRUNING,
+        "Do Canny edge detection to discard some regions", "do-canny-pruning"},
+    {0, NULL, NULL}
+  };
+  *id = g_flags_register_static ("GstOpencvFaceBlurFlags", values);
+}
+
+static GType
+gst_opencv_face_blur_flags_get_type (void)
+{
+  static GType id;
+  static GOnce once = G_ONCE_INIT;
+
+  g_once (&once, (GThreadFunc) register_gst_opencv_face_blur_flags, &id);
+  return id;
+}
+
 /* the capabilities of the inputs and outputs.
  */
 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
@@ -151,12 +197,34 @@
       g_param_spec_string ("profile", "Profile",
           "Location of Haar cascade file to use for face blurion",
           DEFAULT_PROFILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_FLAGS,
+      g_param_spec_flags ("flags", "Flags", "Flags to cvHaarDetectObjects",
+          GST_TYPE_OPENCV_FACE_BLUR_FLAGS, DEFAULT_FLAGS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SCALE_FACTOR,
+      g_param_spec_double ("scale-factor", "Scale factor",
+          "Factor by which the windows is scaled after each scan",
+          1.1, 10.0, DEFAULT_SCALE_FACTOR,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_MIN_NEIGHBORS,
+      g_param_spec_int ("min-neighbors", "Mininum neighbors",
+          "Minimum number (minus 1) of neighbor rectangles that makes up "
+          "an object", 0, G_MAXINT, DEFAULT_MIN_NEIGHBORS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_MIN_SIZE_WIDTH,
+      g_param_spec_int ("min-size-width", "Minimum size width",
+          "Minimum window width size", 0, G_MAXINT, DEFAULT_MIN_SIZE_WIDTH,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_MIN_SIZE_HEIGHT,
+      g_param_spec_int ("min-size-height", "Minimum size height",
+          "Minimum window height size", 0, G_MAXINT, DEFAULT_MIN_SIZE_HEIGHT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   gst_element_class_set_static_metadata (element_class,
       "faceblur",
       "Filter/Effect/Video",
       "Blurs faces in images and videos",
-      "Michael Sheldon <mike@mikeasoft.com>");
+      "Michael Sheldon <mike@mikeasoft.com>,Robert Jobbagy <jobbagy.robert@gmail.com>");
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&src_factory));
@@ -174,6 +242,12 @@
 {
   filter->profile = g_strdup (DEFAULT_PROFILE);
   gst_face_blur_load_profile (filter);
+  filter->sent_profile_load_failed_msg = FALSE;
+  filter->scale_factor = DEFAULT_SCALE_FACTOR;
+  filter->min_neighbors = DEFAULT_MIN_NEIGHBORS;
+  filter->flags = DEFAULT_FLAGS;
+  filter->min_size_width = DEFAULT_MIN_SIZE_WIDTH;
+  filter->min_size_height = DEFAULT_MIN_SIZE_HEIGHT;
 
   gst_opencv_video_filter_set_in_place (GST_OPENCV_VIDEO_FILTER_CAST (filter),
       TRUE);
@@ -190,6 +264,22 @@
       g_free (filter->profile);
       filter->profile = g_value_dup_string (value);
       gst_face_blur_load_profile (filter);
+      filter->sent_profile_load_failed_msg = FALSE;
+      break;
+    case PROP_SCALE_FACTOR:
+      filter->scale_factor = g_value_get_double (value);
+      break;
+    case PROP_MIN_NEIGHBORS:
+      filter->min_neighbors = g_value_get_int (value);
+      break;
+    case PROP_MIN_SIZE_WIDTH:
+      filter->min_size_width = g_value_get_int (value);
+      break;
+    case PROP_MIN_SIZE_HEIGHT:
+      filter->min_size_height = g_value_get_int (value);
+      break;
+    case PROP_FLAGS:
+      filter->flags = g_value_get_flags (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -207,6 +297,21 @@
     case PROP_PROFILE:
       g_value_set_string (value, filter->profile);
       break;
+    case PROP_SCALE_FACTOR:
+      g_value_set_double (value, filter->scale_factor);
+      break;
+    case PROP_MIN_NEIGHBORS:
+      g_value_set_int (value, filter->min_neighbors);
+      break;
+    case PROP_MIN_SIZE_WIDTH:
+      g_value_set_int (value, filter->min_size_width);
+      break;
+    case PROP_MIN_SIZE_HEIGHT:
+      g_value_set_int (value, filter->min_size_height);
+      break;
+    case PROP_FLAGS:
+      g_value_set_flags (value, filter->flags);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -241,17 +346,27 @@
   CvSeq *faces;
   int i;
 
-  if (!filter->cvCascade)
+  if (!filter->cvCascade) {
+    if (filter->profile != NULL
+        && filter->sent_profile_load_failed_msg == FALSE) {
+      GST_ELEMENT_WARNING (filter, RESOURCE, NOT_FOUND,
+          ("Profile %s is missing.", filter->profile),
+          ("missing faceblur profile file %s", filter->profile));
+      filter->sent_profile_load_failed_msg = TRUE;
+    }
+
     return GST_FLOW_OK;
+  }
 
   cvCvtColor (img, filter->cvGray, CV_RGB2GRAY);
   cvClearMemStorage (filter->cvStorage);
 
   faces =
       cvHaarDetectObjects (filter->cvGray, filter->cvCascade,
-      filter->cvStorage, 1.1, 2, 0, cvSize (30, 30)
+      filter->cvStorage, filter->scale_factor, filter->min_neighbors,
+      filter->flags, cvSize (filter->min_size_width, filter->min_size_height)
 #if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2)
-      , cvSize (0, 0)
+      , cvSize (filter->min_size_width + 2, filter->min_size_height + 2)
 #endif
       );
 
diff --git a/ext/opencv/gstfaceblur.h b/ext/opencv/gstfaceblur.h
index f3547ce..a6ee28e 100644
--- a/ext/opencv/gstfaceblur.h
+++ b/ext/opencv/gstfaceblur.h
@@ -3,6 +3,7 @@
  * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
  * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
  * Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
+ * Copyright (C) 2011 Robert Jobbagy <jobbagy.robert@gmail.com>
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -74,9 +75,15 @@
 {
   GstOpencvVideoFilter element;
 
-  gboolean display;
+  gboolean sent_profile_load_failed_msg;
 
   gchar *profile;
+  gboolean display;
+  gdouble scale_factor;
+  gint min_neighbors;
+  gint flags;
+  gint min_size_width;
+  gint min_size_height;
 
   IplImage *cvGray;
   CvHaarClassifierCascade *cvCascade;
diff --git a/ext/opencv/gstfacedetect.c b/ext/opencv/gstfacedetect.c
index d921647..fa01268 100644
--- a/ext/opencv/gstfacedetect.c
+++ b/ext/opencv/gstfacedetect.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
  * Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
  * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
+ * Copyright (C) 2014 Robert Jobbagy <jobbagy.robert@gmail.com>
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -48,6 +49,7 @@
  * SECTION:element-facedetect
  *
  * Performs face detection on videos and images.
+ * If you have high cpu load you need to use videoscale with capsfilter and reduce the video resolution.
  *
  * The image is scaled down multiple times using the GstFaceDetect::scale-factor
  * until the size is &lt;= GstFaceDetect::min-size-width or 
@@ -56,10 +58,10 @@
  * <refsect2>
  * <title>Example launch line</title>
  * |[
- * gst-launch-0.10 autovideosrc ! decodebin2 ! colorspace ! facedetect ! videoconvert ! xvimagesink
+ * gst-launch-1.0 autovideosrc ! decodebin2 ! colorspace ! facedetect ! videoconvert ! xvimagesink
  * ]| Detect and show faces
  * |[
- * gst-launch-0.10 autovideosrc ! video/x-raw,width=320,height=240 ! videoconvert ! facedetect min-size-width=60 min-size-height=60 ! colorspace ! xvimagesink
+ * gst-launch-1.0 autovideosrc ! video/x-raw,width=320,height=240 ! videoconvert ! facedetect min-size-width=60 min-size-height=60 ! colorspace ! xvimagesink
  * ]| Detect large faces on a smaller image 
  *
  * </refsect2>
@@ -90,11 +92,12 @@
 #define DEFAULT_NOSE_PROFILE HAAR_CASCADES_DIR "haarcascade_mcs_nose.xml"
 #define DEFAULT_MOUTH_PROFILE HAAR_CASCADES_DIR "haarcascade_mcs_mouth.xml"
 #define DEFAULT_EYES_PROFILE HAAR_CASCADES_DIR "haarcascade_mcs_eyepair_small.xml"
-#define DEFAULT_SCALE_FACTOR 1.1
-#define DEFAULT_FLAGS 0
+#define DEFAULT_SCALE_FACTOR 1.25
+#define DEFAULT_FLAGS CV_HAAR_DO_CANNY_PRUNING
 #define DEFAULT_MIN_NEIGHBORS 3
-#define DEFAULT_MIN_SIZE_WIDTH 0
-#define DEFAULT_MIN_SIZE_HEIGHT 0
+#define DEFAULT_MIN_SIZE_WIDTH 30
+#define DEFAULT_MIN_SIZE_HEIGHT 30
+#define DEFAULT_MIN_STDDEV 0
 
 /* Filter signals and args */
 enum
@@ -116,7 +119,8 @@
   PROP_FLAGS,
   PROP_MIN_SIZE_WIDTH,
   PROP_MIN_SIZE_HEIGHT,
-  PROP_UPDATES
+  PROP_UPDATES,
+  PROP_MIN_STDDEV
 };
 
 
@@ -304,6 +308,14 @@
           "When send update bus messages, if at all",
           GST_TYPE_FACE_DETECT_UPDATES, GST_FACEDETECT_UPDATES_EVERY_FRAME,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_MIN_STDDEV,
+      g_param_spec_int ("min-stddev", "Minimum image standard deviation",
+          "Minimum image average standard deviation: on images with standard "
+          "deviation lesser than this value facedetection will not be "
+          "performed. Setting this property help to save cpu and reduce "
+          "false positives not performing face detection on images with "
+          "little changes", 0,
+          255, DEFAULT_MIN_STDDEV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   gst_element_class_set_static_metadata (element_class,
       "facedetect",
@@ -334,6 +346,7 @@
   filter->flags = DEFAULT_FLAGS;
   filter->min_size_width = DEFAULT_MIN_SIZE_WIDTH;
   filter->min_size_height = DEFAULT_MIN_SIZE_HEIGHT;
+  filter->min_stddev = DEFAULT_MIN_STDDEV;
   filter->cvFaceDetect =
       gst_face_detect_load_profile (filter, filter->face_profile);
   filter->cvNoseDetect =
@@ -402,6 +415,9 @@
     case PROP_MIN_SIZE_HEIGHT:
       filter->min_size_height = g_value_get_int (value);
       break;
+    case PROP_MIN_STDDEV:
+      filter->min_stddev = g_value_get_int (value);
+      break;
     case PROP_FLAGS:
       filter->flags = g_value_get_flags (value);
       break;
@@ -448,6 +464,9 @@
     case PROP_MIN_SIZE_HEIGHT:
       g_value_set_int (value, filter->min_size_height);
       break;
+    case PROP_MIN_STDDEV:
+      g_value_set_int (value, filter->min_stddev);
+      break;
     case PROP_FLAGS:
       g_value_set_flags (value, filter->flags);
       break;
@@ -512,13 +531,26 @@
     CvHaarClassifierCascade * detector, gint min_size_width,
     gint min_size_height)
 {
-  return cvHaarDetectObjects (filter->cvGray, detector,
-      filter->cvStorage, filter->scale_factor, filter->min_neighbors,
-      filter->flags, cvSize (min_size_width, min_size_height)
+  double img_stddev = 0;
+  if (filter->min_stddev > 0) {
+    CvScalar mean, stddev;
+    cvAvgSdv (filter->cvGray, &mean, &stddev, NULL);
+    img_stddev = stddev.val[0];
+  }
+  if (img_stddev >= filter->min_stddev) {
+    return cvHaarDetectObjects (filter->cvGray, detector,
+        filter->cvStorage, filter->scale_factor, filter->min_neighbors,
+        filter->flags, cvSize (min_size_width, min_size_height)
 #if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2)
-      , cvSize (0, 0)
+        , cvSize (0, 0)
 #endif
-      );
+        );
+  } else {
+    GST_LOG_OBJECT (filter,
+        "Calculated stddev %f lesser than min_stddev %d, detection not performed",
+        img_stddev, filter->min_stddev);
+    return cvCreateSeq (0, sizeof (CvSeq), sizeof (CvPoint), filter->cvStorage);
+  }
 }
 
 /* 
@@ -768,6 +800,8 @@
 {
   CvHaarClassifierCascade *cascade;
 
+  if (profile == NULL)
+    return NULL;
   if (!(cascade = (CvHaarClassifierCascade *) cvLoad (profile, 0, 0, 0))) {
     GST_WARNING_OBJECT (filter, "Couldn't load Haar classifier cascade: %s.",
         profile);
diff --git a/ext/opencv/gstfacedetect.h b/ext/opencv/gstfacedetect.h
index ac51c52..090fb79 100644
--- a/ext/opencv/gstfacedetect.h
+++ b/ext/opencv/gstfacedetect.h
@@ -4,6 +4,7 @@
  * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
  * Copyright (C) 2008 Michael Sheldon <mike@mikeasoft.com>
  * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
+ * Copyright (C) 2011 Robert Jobbagy <jobbagy.robert@gmail.com>
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -102,6 +103,7 @@
   gint flags;
   gint min_size_width;
   gint min_size_height;
+  gint min_stddev;
   gint updates;
 
   IplImage *cvGray;
diff --git a/ext/opencv/gsthanddetect.c b/ext/opencv/gsthanddetect.c
index 1ec29aa..d01a42e 100644
--- a/ext/opencv/gsthanddetect.c
+++ b/ext/opencv/gsthanddetect.c
@@ -522,7 +522,7 @@
       if (filter->prev_r == NULL)
         filter->prev_r = &temp_r;
       /* Get the best PALM gesture */
-      for (i = 0; i < (hands ? hands->total : 0); i++) {
+      for (i = 0; i < hands->total; i++) {
         r = (CvRect *) cvGetSeqElem (hands, i);
         distance = (int) sqrt (pow ((r->x - filter->prev_r->x),
                 2) + pow ((r->y - filter->prev_r->y), 2));
diff --git a/ext/opencv/gsttemplatematch.c b/ext/opencv/gsttemplatematch.c
index 507b218..602dd8e 100644
--- a/ext/opencv/gsttemplatematch.c
+++ b/ext/opencv/gsttemplatematch.c
@@ -63,6 +63,7 @@
 
 #include <gst/gst.h>
 
+#include "../../gst-libs/gst/gst-i18n-plugin.h"
 #include "gstopencvutils.h"
 #include "gsttemplatematch.h"
 
@@ -113,7 +114,8 @@
 static GstFlowReturn gst_template_match_chain (GstPad * pad, GstObject * parent,
     GstBuffer * buf);
 
-static void gst_template_match_load_template (GstTemplateMatch * filter);
+static void gst_template_match_load_template (GstTemplateMatch * filter,
+    gchar * template);
 static void gst_template_match_match (IplImage * input, IplImage * template,
     IplImage * dist_image, double *best_res, CvPoint * best_pos, int method);
 
@@ -182,7 +184,6 @@
   filter->cvDistImage = NULL;
   filter->cvImage = NULL;
   filter->method = DEFAULT_METHOD;
-  gst_template_match_load_template (filter);
 }
 
 static void
@@ -193,6 +194,7 @@
 
   switch (prop_id) {
     case PROP_METHOD:
+      GST_OBJECT_LOCK (filter);
       switch (g_value_get_int (value)) {
         case 0:
           filter->method = CV_TM_SQDIFF;
@@ -213,13 +215,15 @@
           filter->method = CV_TM_CCOEFF_NORMED;
           break;
       }
+      GST_OBJECT_UNLOCK (filter);
       break;
     case PROP_TEMPLATE:
-      filter->template = (char *) g_value_get_string (value);
-      gst_template_match_load_template (filter);
+      gst_template_match_load_template (filter, g_value_dup_string (value));
       break;
     case PROP_DISPLAY:
+      GST_OBJECT_LOCK (filter);
       filter->display = g_value_get_boolean (value);
+      GST_OBJECT_UNLOCK (filter);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -293,6 +297,7 @@
   GstTemplateMatch *filter;
   filter = GST_TEMPLATE_MATCH (object);
 
+  g_free (filter->template);
   if (filter->cvImage) {
     cvReleaseImageHeader (&filter->cvImage);
   }
@@ -316,12 +321,11 @@
   CvPoint best_pos;
   double best_res;
   GstMapInfo info;
+  GstMessage *m = NULL;
 
   filter = GST_TEMPLATE_MATCH (parent);
 
-  /* FIXME Why template == NULL returns OK?
-   * shouldn't it be a passthrough instead? */
-  if ((!filter) || (!buf) || filter->template == NULL) {
+  if ((!filter) || (!buf)) {
     return GST_FLOW_OK;
   }
   GST_LOG_OBJECT (filter, "Buffer size %u", (guint) gst_buffer_get_size (buf));
@@ -330,7 +334,8 @@
   gst_buffer_map (buf, &info, GST_MAP_READWRITE);
   filter->cvImage->imageData = (char *) info.data;
 
-  if (!filter->cvDistImage) {
+  GST_OBJECT_LOCK (filter);
+  if (filter->cvTemplateImage && !filter->cvDistImage) {
     if (filter->cvTemplateImage->width > filter->cvImage->width) {
       GST_WARNING ("Template Image is wider than input image");
     } else if (filter->cvTemplateImage->height > filter->cvImage->height) {
@@ -351,9 +356,8 @@
       }
     }
   }
-  if (filter->cvTemplateImage && filter->cvImage && filter->cvDistImage) {
+  if (filter->cvTemplateImage && filter->cvDistImage) {
     GstStructure *s;
-    GstMessage *m;
 
     gst_template_match_match (filter->cvImage, filter->cvTemplateImage,
         filter->cvDistImage, &best_res, &best_pos, filter->method);
@@ -366,21 +370,34 @@
         "result", G_TYPE_DOUBLE, best_res, NULL);
 
     m = gst_message_new_element (GST_OBJECT (filter), s);
-    gst_element_post_message (GST_ELEMENT (filter), m);
 
     if (filter->display) {
       CvPoint corner = best_pos;
+      CvScalar color;
+      if (filter->method == CV_TM_SQDIFF_NORMED
+          || filter->method == CV_TM_CCORR_NORMED
+          || filter->method == CV_TM_CCOEFF_NORMED) {
+        /* Yellow growing redder as match certainty approaches 1.0.  This can
+           only be applied with method == *_NORMED as the other match methods
+           aren't normalized to be in range 0.0 - 1.0 */
+        color = CV_RGB (255, 255 - pow (255, best_res), 32);
+      } else {
+        color = CV_RGB (255, 32, 32);
+      }
 
       buf = gst_buffer_make_writable (buf);
 
       corner.x += filter->cvTemplateImage->width;
       corner.y += filter->cvTemplateImage->height;
-      cvRectangle (filter->cvImage, best_pos, corner, CV_RGB (255, 32, 32), 3,
-          8, 0);
+      cvRectangle (filter->cvImage, best_pos, corner, color, 3, 8, 0);
     }
 
   }
+  GST_OBJECT_UNLOCK (filter);
 
+  if (m) {
+    gst_element_post_message (GST_ELEMENT (filter), m);
+  }
   return gst_pad_push (filter->srcpad, buf);
 }
 
@@ -407,22 +424,40 @@
 }
 
 
+/* We take ownership of template here */
 static void
-gst_template_match_load_template (GstTemplateMatch * filter)
+gst_template_match_load_template (GstTemplateMatch * filter, gchar * template)
 {
-  if (filter->template) {
+  gchar *oldTemplateFilename = NULL;
+  IplImage *oldTemplateImage = NULL, *newTemplateImage = NULL, *oldDistImage =
+      NULL;
 
-    if (filter->cvTemplateImage) {
-      cvReleaseImage (&filter->cvTemplateImage);
-    }
-    filter->cvTemplateImage =
-        cvLoadImage (filter->template, CV_LOAD_IMAGE_COLOR);
-
-    if (!filter->cvTemplateImage) {
-      GST_WARNING ("Couldn't load template image: %s. error: %s",
-          filter->template, g_strerror (errno));
+  if (template) {
+    newTemplateImage = cvLoadImage (template, CV_LOAD_IMAGE_COLOR);
+    if (!newTemplateImage) {
+      /* Unfortunately OpenCV doesn't seem to provide any way of finding out
+         why the image load failed, so we can't be more specific than FAILED: */
+      GST_ELEMENT_WARNING (filter, RESOURCE, FAILED,
+          (_("OpenCV failed to load template image")),
+          ("While attempting to load template '%s'", template));
+      g_free (template);
+      template = NULL;
     }
   }
+
+  GST_OBJECT_LOCK (filter);
+  oldTemplateFilename = filter->template;
+  filter->template = template;
+  oldTemplateImage = filter->cvTemplateImage;
+  filter->cvTemplateImage = newTemplateImage;
+  oldDistImage = filter->cvDistImage;
+  /* This will be recreated in the chain function as required: */
+  filter->cvDistImage = NULL;
+  GST_OBJECT_UNLOCK (filter);
+
+  cvReleaseImage (&oldDistImage);
+  cvReleaseImage (&oldTemplateImage);
+  g_free (oldTemplateFilename);
 }
 
 
diff --git a/ext/opencv/motioncells_wrapper.cpp b/ext/opencv/motioncells_wrapper.cpp
index dc52443..e9794cf 100644
--- a/ext/opencv/motioncells_wrapper.cpp
+++ b/ext/opencv/motioncells_wrapper.cpp
@@ -89,12 +89,15 @@
 {
   int idx = 0;
   idx = searchIdx (p_id);
-  return motioncellsvector.at (idx).mc->performDetectionMotionCells (p_image,
-      p_sensitivity, p_framerate, p_gridx, p_gridy, p_timestamp_millisec,
-      p_isVisible, p_useAlpha, motionmaskcoord_count, motionmaskcoords,
-      motionmaskcells_count, motionmaskcellsidx, motioncellscolor,
-      motioncells_count, motioncellsidx, starttime, p_datafile,
-      p_changed_datafile, p_thickness);
+  if (idx > -1)
+    return motioncellsvector.at (idx).mc->performDetectionMotionCells (p_image,
+        p_sensitivity, p_framerate, p_gridx, p_gridy, p_timestamp_millisec,
+        p_isVisible, p_useAlpha, motionmaskcoord_count, motionmaskcoords,
+        motionmaskcells_count, motionmaskcellsidx, motioncellscolor,
+        motioncells_count, motioncellsidx, starttime, p_datafile,
+        p_changed_datafile, p_thickness);
+  else
+    return -1;
 }
 
 
@@ -103,7 +106,8 @@
 {
   int idx = 0;
   idx = searchIdx (p_id);
-  motioncellsvector.at (idx).mc->setPrevFrame (p_prevFrame);
+  if (idx > -1)
+    motioncellsvector.at (idx).mc->setPrevFrame (p_prevFrame);
 }
 
 char *
@@ -113,10 +117,8 @@
   idx = searchIdx (p_id);
   if (idx > -1)
     return motioncellsvector.at (idx).mc->getMotionCellsIdx ();
-  else {
+  else
     return p_str;
-  }
-
 }
 
 int
@@ -161,9 +163,8 @@
   idx = searchIdx (p_id);
   if (idx > -1)
     return motioncellsvector.at (idx).mc->getDatafileInitFailed ();
-  else {
+  else
     return p_str;
-  }
 }
 
 char *
@@ -173,9 +174,8 @@
   idx = searchIdx (p_id);
   if (idx > -1)
     return motioncellsvector.at (idx).mc->getDatafileSaveFailed ();
-  else {
+  else
     return p_str;
-  }
 }
 
 int
diff --git a/ext/openexr/Makefile.in b/ext/openexr/Makefile.in
index 8c78ecc..42a1249 100644
--- a/ext/openexr/Makefile.in
+++ b/ext/openexr/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -264,8 +264,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -304,7 +308,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -312,6 +315,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -361,8 +366,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -441,7 +444,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -450,7 +452,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -463,7 +464,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -488,6 +488,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -561,10 +563,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -590,6 +596,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -626,6 +635,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -666,17 +676,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -693,6 +702,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/openh264/Makefile.am b/ext/openh264/Makefile.am
new file mode 100644
index 0000000..69ab459
--- /dev/null
+++ b/ext/openh264/Makefile.am
@@ -0,0 +1,16 @@
+plugin_LTLIBRARIES = libgstopenh264.la
+
+libgstopenh264_la_SOURCES = \
+    gstopenh264plugin.c \
+    gstopenh264enc.cpp \
+    gstopenh264dec.cpp
+
+libgstopenh264_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(OPENH264_CFLAGS)
+libgstopenh264_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(OPENH264_CFLAGS)
+libgstopenh264_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-1.0 $(GST_LIBS) $(OPENH264_LIBS)
+libgstopenh264_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstopenh264_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS = \
+    gstopenh264dec.h \
+    gstopenh264enc.h
diff --git a/sys/osxvideo/Makefile.in b/ext/openh264/Makefile.in
similarity index 79%
copy from sys/osxvideo/Makefile.in
copy to ext/openh264/Makefile.in
index a756e27..52ceb9b 100644
--- a/sys/osxvideo/Makefile.in
+++ b/ext/openh264/Makefile.in
@@ -80,7 +80,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = sys/osxvideo
+subdir = ext/openh264
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -154,20 +154,20 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstosxvideosrc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
-am_libgstosxvideosrc_la_OBJECTS =  \
-	libgstosxvideosrc_la-osxvideoplugin.lo \
-	libgstosxvideosrc_la-osxvideosrc.lo
-libgstosxvideosrc_la_OBJECTS = $(am_libgstosxvideosrc_la_OBJECTS)
+libgstopenh264_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libgstopenh264_la_OBJECTS = libgstopenh264_la-gstopenh264plugin.lo \
+	libgstopenh264_la-gstopenh264enc.lo \
+	libgstopenh264_la-gstopenh264dec.lo
+libgstopenh264_la_OBJECTS = $(am_libgstopenh264_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstosxvideosrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) \
-	$(libgstosxvideosrc_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstopenh264_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+	$(libgstopenh264_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CXXLD) $(libgstopenh264_la_CXXFLAGS) $(CXXFLAGS) \
+	$(libgstopenh264_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -202,8 +202,26 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstosxvideosrc_la_SOURCES)
-DIST_SOURCES = $(libgstosxvideosrc_la_SOURCES)
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
+SOURCES = $(libgstopenh264_la_SOURCES)
+DIST_SOURCES = $(libgstopenh264_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -246,8 +264,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +308,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +315,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +366,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +444,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +452,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +464,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +488,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +563,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +596,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +635,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +676,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +702,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -726,24 +754,25 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstosxvideosrc.la
-libgstosxvideosrc_la_SOURCES = osxvideoplugin.c osxvideosrc.c
-libgstosxvideosrc_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
-	$(GST_PLUGINS_BASE_CFLAGS) -Wno-deprecated-declarations
+plugin_LTLIBRARIES = libgstopenh264.la
+libgstopenh264_la_SOURCES = \
+    gstopenh264plugin.c \
+    gstopenh264enc.cpp \
+    gstopenh264dec.cpp
 
-libgstosxvideosrc_la_LIBADD = \
-	$(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
-	-lgstinterfaces-$(GST_API_VERSION)
+libgstopenh264_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(OPENH264_CFLAGS)
+libgstopenh264_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(OPENH264_CFLAGS)
+libgstopenh264_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-1.0 $(GST_LIBS) $(OPENH264_LIBS)
+libgstopenh264_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstopenh264_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+noinst_HEADERS = \
+    gstopenh264dec.h \
+    gstopenh264enc.h
 
-libgstosxvideosrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-libgstosxvideosrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \
-	-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,QuickTime
-
-noinst_HEADERS = osxvideosrc.h
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+.SUFFIXES: .c .cpp .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -753,9 +782,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sys/osxvideo/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/openh264/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu sys/osxvideo/Makefile
+	  $(AUTOMAKE) --gnu ext/openh264/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -810,8 +839,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstosxvideosrc.la: $(libgstosxvideosrc_la_OBJECTS) $(libgstosxvideosrc_la_DEPENDENCIES) $(EXTRA_libgstosxvideosrc_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstosxvideosrc_la_LINK) -rpath $(plugindir) $(libgstosxvideosrc_la_OBJECTS) $(libgstosxvideosrc_la_LIBADD) $(LIBS)
+libgstopenh264.la: $(libgstopenh264_la_OBJECTS) $(libgstopenh264_la_DEPENDENCIES) $(EXTRA_libgstopenh264_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(libgstopenh264_la_LINK) -rpath $(plugindir) $(libgstopenh264_la_OBJECTS) $(libgstopenh264_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -819,8 +848,9 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopenh264_la-gstopenh264dec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopenh264_la-gstopenh264enc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstopenh264_la-gstopenh264plugin.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -846,19 +876,50 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstosxvideosrc_la-osxvideoplugin.lo: osxvideoplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -MT libgstosxvideosrc_la-osxvideoplugin.lo -MD -MP -MF $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Tpo -c -o libgstosxvideosrc_la-osxvideoplugin.lo `test -f 'osxvideoplugin.c' || echo '$(srcdir)/'`osxvideoplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Tpo $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='osxvideoplugin.c' object='libgstosxvideosrc_la-osxvideoplugin.lo' libtool=yes @AMDEPBACKSLASH@
+libgstopenh264_la-gstopenh264plugin.lo: gstopenh264plugin.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopenh264_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopenh264_la_CFLAGS) $(CFLAGS) -MT libgstopenh264_la-gstopenh264plugin.lo -MD -MP -MF $(DEPDIR)/libgstopenh264_la-gstopenh264plugin.Tpo -c -o libgstopenh264_la-gstopenh264plugin.lo `test -f 'gstopenh264plugin.c' || echo '$(srcdir)/'`gstopenh264plugin.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopenh264_la-gstopenh264plugin.Tpo $(DEPDIR)/libgstopenh264_la-gstopenh264plugin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstopenh264plugin.c' object='libgstopenh264_la-gstopenh264plugin.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -c -o libgstosxvideosrc_la-osxvideoplugin.lo `test -f 'osxvideoplugin.c' || echo '$(srcdir)/'`osxvideoplugin.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstopenh264_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopenh264_la_CFLAGS) $(CFLAGS) -c -o libgstopenh264_la-gstopenh264plugin.lo `test -f 'gstopenh264plugin.c' || echo '$(srcdir)/'`gstopenh264plugin.c
 
-libgstosxvideosrc_la-osxvideosrc.lo: osxvideosrc.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -MT libgstosxvideosrc_la-osxvideosrc.lo -MD -MP -MF $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Tpo -c -o libgstosxvideosrc_la-osxvideosrc.lo `test -f 'osxvideosrc.c' || echo '$(srcdir)/'`osxvideosrc.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Tpo $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='osxvideosrc.c' object='libgstosxvideosrc_la-osxvideosrc.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -c -o libgstosxvideosrc_la-osxvideosrc.lo `test -f 'osxvideosrc.c' || echo '$(srcdir)/'`osxvideosrc.c
+.cpp.o:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+libgstopenh264_la-gstopenh264enc.lo: gstopenh264enc.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstopenh264_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopenh264_la_CXXFLAGS) $(CXXFLAGS) -MT libgstopenh264_la-gstopenh264enc.lo -MD -MP -MF $(DEPDIR)/libgstopenh264_la-gstopenh264enc.Tpo -c -o libgstopenh264_la-gstopenh264enc.lo `test -f 'gstopenh264enc.cpp' || echo '$(srcdir)/'`gstopenh264enc.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopenh264_la-gstopenh264enc.Tpo $(DEPDIR)/libgstopenh264_la-gstopenh264enc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstopenh264enc.cpp' object='libgstopenh264_la-gstopenh264enc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstopenh264_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopenh264_la_CXXFLAGS) $(CXXFLAGS) -c -o libgstopenh264_la-gstopenh264enc.lo `test -f 'gstopenh264enc.cpp' || echo '$(srcdir)/'`gstopenh264enc.cpp
+
+libgstopenh264_la-gstopenh264dec.lo: gstopenh264dec.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstopenh264_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopenh264_la_CXXFLAGS) $(CXXFLAGS) -MT libgstopenh264_la-gstopenh264dec.lo -MD -MP -MF $(DEPDIR)/libgstopenh264_la-gstopenh264dec.Tpo -c -o libgstopenh264_la-gstopenh264dec.lo `test -f 'gstopenh264dec.cpp' || echo '$(srcdir)/'`gstopenh264dec.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstopenh264_la-gstopenh264dec.Tpo $(DEPDIR)/libgstopenh264_la-gstopenh264dec.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstopenh264dec.cpp' object='libgstopenh264_la-gstopenh264dec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstopenh264_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstopenh264_la_CXXFLAGS) $(CXXFLAGS) -c -o libgstopenh264_la-gstopenh264dec.lo `test -f 'gstopenh264dec.cpp' || echo '$(srcdir)/'`gstopenh264dec.cpp
 
 mostlyclean-libtool:
 	-rm -f *.lo
diff --git a/ext/openh264/gstopenh264dec.cpp b/ext/openh264/gstopenh264dec.cpp
new file mode 100644
index 0000000..e8fb3d2
--- /dev/null
+++ b/ext/openh264/gstopenh264dec.cpp
@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <wels/codec_api.h>
+#include <wels/codec_app_def.h>
+#include <wels/codec_def.h>
+
+#include "gstopenh264dec.h"
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/video/gstvideodecoder.h>
+#include <string.h>             /* for memcpy */
+
+
+#define GST_OPENH264DEC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ( \
+                                     (obj), GST_TYPE_OPENH264DEC, \
+                                     GstOpenh264DecPrivate))
+
+GST_DEBUG_CATEGORY_STATIC (gst_openh264dec_debug_category);
+#define GST_CAT_DEFAULT gst_openh264dec_debug_category
+
+/* prototypes */
+
+
+static void gst_openh264dec_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec);
+static void gst_openh264dec_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec);
+
+static gboolean gst_openh264dec_start (GstVideoDecoder * decoder);
+static gboolean gst_openh264dec_stop (GstVideoDecoder * decoder);
+
+static gboolean gst_openh264dec_set_format (GstVideoDecoder * decoder,
+    GstVideoCodecState * state);
+static gboolean gst_openh264dec_reset (GstVideoDecoder * decoder,
+    gboolean hard);
+static GstFlowReturn gst_openh264dec_finish (GstVideoDecoder * decoder);
+static GstFlowReturn gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
+    GstVideoCodecFrame * frame);
+static gboolean gst_openh264dec_decide_allocation (GstVideoDecoder * decoder,
+    GstQuery * query);
+
+enum
+{
+  PROP_0,
+  N_PROPERTIES
+};
+
+struct _GstOpenh264DecPrivate
+{
+  ISVCDecoder *decoder;
+  GstVideoCodecState *input_state;
+  guint width, height;
+};
+
+/* pad templates */
+
+static GstStaticPadTemplate gst_openh264dec_sink_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS
+    ("video/x-h264, stream-format=(string)byte-stream, alignment=(string)au,profile=(string){constrained-baseline,baseline}"));
+
+static GstStaticPadTemplate gst_openh264dec_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420")));
+
+/* class initialization */
+
+G_DEFINE_TYPE_WITH_CODE (GstOpenh264Dec, gst_openh264dec,
+    GST_TYPE_VIDEO_DECODER,
+    GST_DEBUG_CATEGORY_INIT (gst_openh264dec_debug_category, "openh264dec", 0,
+        "debug category for openh264dec element"));
+
+static void
+gst_openh264dec_class_init (GstOpenh264DecClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstVideoDecoderClass *video_decoder_class = GST_VIDEO_DECODER_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstOpenh264DecPrivate));
+
+  /* Setting up pads and setting metadata should be moved to
+     base_class_init if you intend to subclass this class. */
+  gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass),
+      gst_static_pad_template_get (&gst_openh264dec_sink_template));
+  gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass),
+      gst_static_pad_template_get (&gst_openh264dec_src_template));
+
+  gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (klass),
+      "OpenH264 video decoder", "Decoder/Video", "OpenH264 video decoder",
+      "Ericsson AB, http://www.ericsson.com");
+  gobject_class->set_property = gst_openh264dec_set_property;
+  gobject_class->get_property = gst_openh264dec_get_property;
+
+  video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_openh264dec_start);
+  video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_openh264dec_stop);
+
+  video_decoder_class->set_format =
+      GST_DEBUG_FUNCPTR (gst_openh264dec_set_format);
+  video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_openh264dec_reset);
+  video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_openh264dec_finish);
+  video_decoder_class->handle_frame =
+      GST_DEBUG_FUNCPTR (gst_openh264dec_handle_frame);
+  video_decoder_class->decide_allocation =
+      GST_DEBUG_FUNCPTR (gst_openh264dec_decide_allocation);
+}
+
+static void
+gst_openh264dec_init (GstOpenh264Dec * openh264dec)
+{
+  openh264dec->priv = GST_OPENH264DEC_GET_PRIVATE (openh264dec);
+  openh264dec->priv->decoder = NULL;
+
+  gst_video_decoder_set_packetized (GST_VIDEO_DECODER (openh264dec), TRUE);
+  gst_video_decoder_set_needs_format (GST_VIDEO_DECODER (openh264dec), TRUE);
+}
+
+void
+gst_openh264dec_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (object);
+
+  GST_DEBUG_OBJECT (openh264dec, "set_property");
+
+  switch (property_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_openh264dec_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (object);
+
+  GST_DEBUG_OBJECT (openh264dec, "get_property");
+
+  switch (property_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_openh264dec_start (GstVideoDecoder * decoder)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (decoder);
+  gint ret;
+  SDecodingParam dec_param = { 0 };
+
+  if (openh264dec->priv->decoder != NULL) {
+    openh264dec->priv->decoder->Uninitialize ();
+    WelsDestroyDecoder (openh264dec->priv->decoder);
+    openh264dec->priv->decoder = NULL;
+  }
+  WelsCreateDecoder (&(openh264dec->priv->decoder));
+
+  dec_param.uiTargetDqLayer = 255;
+  dec_param.eEcActiveIdc = ERROR_CON_FRAME_COPY;
+  dec_param.eOutputColorFormat = videoFormatI420;
+  dec_param.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_AVC;
+
+  ret = openh264dec->priv->decoder->Initialize (&dec_param);
+
+  GST_DEBUG_OBJECT (openh264dec,
+      "openh264_dec_start called, openh264dec %sinitialized OK!",
+      (ret != cmResultSuccess) ? "NOT " : "");
+
+  return (ret == cmResultSuccess);
+}
+
+static gboolean
+gst_openh264dec_stop (GstVideoDecoder * decoder)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (decoder);
+  gint ret = TRUE;
+
+  if (openh264dec->priv->decoder) {
+    ret = openh264dec->priv->decoder->Uninitialize ();
+    WelsDestroyDecoder (openh264dec->priv->decoder);
+    openh264dec->priv->decoder = NULL;
+  }
+
+  if (openh264dec->priv->input_state) {
+    gst_video_codec_state_unref (openh264dec->priv->input_state);
+    openh264dec->priv->input_state = NULL;
+  }
+  openh264dec->priv->width = openh264dec->priv->height = 0;
+
+  return ret;
+}
+
+static gboolean
+gst_openh264dec_set_format (GstVideoDecoder * decoder,
+    GstVideoCodecState * state)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (decoder);
+
+  GST_DEBUG_OBJECT (openh264dec,
+      "openh264_dec_set_format called, caps: %" GST_PTR_FORMAT, state->caps);
+
+  if (openh264dec->priv->input_state) {
+    gst_video_codec_state_unref (openh264dec->priv->input_state);
+    openh264dec->priv->input_state = NULL;
+  }
+  openh264dec->priv->input_state = gst_video_codec_state_ref (state);
+
+  return TRUE;
+}
+
+static gboolean
+gst_openh264dec_reset (GstVideoDecoder * decoder, gboolean hard)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (decoder);
+
+  GST_DEBUG_OBJECT (openh264dec, "reset");
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
+    GstVideoCodecFrame * frame)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (decoder);
+  GstMapInfo map_info;
+  GstVideoCodecState *state;
+  SBufferInfo dst_buf_info;
+  DECODING_STATE ret;
+  guint8 *yuvdata[3];
+  GstFlowReturn flow_status;
+  GstVideoFrame video_frame;
+  guint actual_width, actual_height;
+  guint i;
+  guint8 *p;
+  guint row_stride, component_width, component_height, src_width, row;
+
+  if (frame) {
+    if (!gst_buffer_map (frame->input_buffer, &map_info, GST_MAP_READ)) {
+      GST_ERROR_OBJECT (openh264dec, "Cannot map input buffer!");
+      return GST_FLOW_ERROR;
+    }
+
+    GST_LOG_OBJECT (openh264dec, "handle frame, %d",
+        map_info.size > 4 ? map_info.data[4] & 0x1f : -1);
+
+    memset (&dst_buf_info, 0, sizeof (SBufferInfo));
+    ret =
+        openh264dec->priv->decoder->DecodeFrame2 (map_info.data, map_info.size,
+        yuvdata, &dst_buf_info);
+
+    if (ret == dsNoParamSets) {
+      GST_DEBUG_OBJECT (openh264dec, "Requesting a key unit");
+      gst_pad_push_event (GST_VIDEO_DECODER_SINK_PAD (decoder),
+          gst_video_event_new_upstream_force_key_unit (GST_CLOCK_TIME_NONE,
+              FALSE, 0));
+    }
+
+    if (ret != dsErrorFree && ret != dsNoParamSets) {
+      GST_DEBUG_OBJECT (openh264dec, "Requesting a key unit");
+      gst_pad_push_event (GST_VIDEO_DECODER_SINK_PAD (decoder),
+          gst_video_event_new_upstream_force_key_unit (GST_CLOCK_TIME_NONE,
+              FALSE, 0));
+      GST_LOG_OBJECT (openh264dec, "error decoding nal, return code: %d", ret);
+    }
+
+    gst_buffer_unmap (frame->input_buffer, &map_info);
+    gst_video_codec_frame_unref (frame);
+    frame = NULL;
+  } else {
+    memset (&dst_buf_info, 0, sizeof (SBufferInfo));
+    ret =
+        openh264dec->priv->decoder->DecodeFrame2 (NULL, 0, yuvdata,
+        &dst_buf_info);
+    if (ret != dsErrorFree)
+      return GST_FLOW_EOS;
+  }
+
+  /* FIXME: openh264 has no way for us to get a connection
+   * between the input and output frames, we just have to
+   * guess based on the input. Fortunately openh264 can
+   * only do baseline profile. */
+  frame = gst_video_decoder_get_oldest_frame (decoder);
+  if (!frame) {
+    /* Can only happen in finish() */
+    return GST_FLOW_EOS;
+  }
+
+  /* No output available yet */
+  if (dst_buf_info.iBufferStatus != 1) {
+    return (frame ? GST_FLOW_OK : GST_FLOW_EOS);
+  }
+
+  actual_width = dst_buf_info.UsrData.sSystemBuffer.iWidth;
+  actual_height = dst_buf_info.UsrData.sSystemBuffer.iHeight;
+
+  if (!gst_pad_has_current_caps (GST_VIDEO_DECODER_SRC_PAD (openh264dec))
+      || actual_width != openh264dec->priv->width
+      || actual_height != openh264dec->priv->height) {
+    state =
+        gst_video_decoder_set_output_state (decoder, GST_VIDEO_FORMAT_I420,
+        actual_width, actual_height, openh264dec->priv->input_state);
+    openh264dec->priv->width = actual_width;
+    openh264dec->priv->height = actual_height;
+
+    if (!gst_video_decoder_negotiate (decoder)) {
+      GST_ERROR_OBJECT (openh264dec,
+          "Failed to negotiate with downstream elements");
+      return GST_FLOW_NOT_NEGOTIATED;
+    }
+  } else {
+    state = gst_video_decoder_get_output_state (decoder);
+  }
+
+  flow_status = gst_video_decoder_allocate_output_frame (decoder, frame);
+  if (flow_status != GST_FLOW_OK) {
+    gst_video_codec_state_unref (state);
+    return flow_status;
+  }
+
+  if (!gst_video_frame_map (&video_frame, &state->info, frame->output_buffer,
+          GST_MAP_WRITE)) {
+    GST_ERROR_OBJECT (openh264dec, "Cannot map output buffer!");
+    gst_video_codec_state_unref (state);
+    return GST_FLOW_ERROR;
+  }
+
+  for (i = 0; i < 3; i++) {
+    p = GST_VIDEO_FRAME_COMP_DATA (&video_frame, i);
+    row_stride = GST_VIDEO_FRAME_COMP_STRIDE (&video_frame, i);
+    component_width = GST_VIDEO_FRAME_COMP_WIDTH (&video_frame, i);
+    component_height = GST_VIDEO_FRAME_COMP_HEIGHT (&video_frame, i);
+    src_width =
+        i <
+        1 ? dst_buf_info.UsrData.sSystemBuffer.
+        iStride[0] : dst_buf_info.UsrData.sSystemBuffer.iStride[1];
+    for (row = 0; row < component_height; row++) {
+      memcpy (p, yuvdata[i], component_width);
+      p += row_stride;
+      yuvdata[i] += src_width;
+    }
+  }
+  gst_video_codec_state_unref (state);
+  gst_video_frame_unmap (&video_frame);
+
+  return gst_video_decoder_finish_frame (decoder, frame);
+}
+
+static GstFlowReturn
+gst_openh264dec_finish (GstVideoDecoder * decoder)
+{
+  GstOpenh264Dec *openh264dec = GST_OPENH264DEC (decoder);
+
+  GST_DEBUG_OBJECT (openh264dec, "finish");
+
+  /* Decoder not negotiated yet */
+  if (openh264dec->priv->width == 0)
+    return GST_FLOW_OK;
+
+  /* Drain all pending frames */
+  while ((gst_openh264dec_handle_frame (decoder, NULL)) == GST_FLOW_OK);
+
+  return GST_FLOW_OK;
+}
+
+static gboolean
+gst_openh264dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
+{
+  GstVideoCodecState *state;
+  GstBufferPool *pool;
+  guint size, min, max;
+  GstStructure *config;
+
+  if (!GST_VIDEO_DECODER_CLASS (gst_openh264dec_parent_class)->decide_allocation
+      (decoder, query))
+    return FALSE;
+
+  state = gst_video_decoder_get_output_state (decoder);
+
+  gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
+
+  config = gst_buffer_pool_get_config (pool);
+  if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
+    gst_buffer_pool_config_add_option (config,
+        GST_BUFFER_POOL_OPTION_VIDEO_META);
+  }
+
+  gst_buffer_pool_set_config (pool, config);
+
+  gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
+
+  gst_object_unref (pool);
+  gst_video_codec_state_unref (state);
+
+  return TRUE;
+}
diff --git a/ext/openh264/gstopenh264dec.h b/ext/openh264/gstopenh264dec.h
new file mode 100644
index 0000000..3d56ab4
--- /dev/null
+++ b/ext/openh264/gstopenh264dec.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+/*/
+\*\ GstOPENH264Dec
+/*/
+
+#ifndef _GST_OPENH264DEC_H_
+#define _GST_OPENH264DEC_H_
+
+#include <gst/video/video.h>
+#include <gst/video/gstvideodecoder.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_OPENH264DEC          (gst_openh264dec_get_type())
+#define GST_OPENH264DEC(obj)          (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENH264DEC,GstOpenh264Dec))
+#define GST_OPENH264DEC_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENH264DEC,GstOpenh264DecClass))
+#define GST_IS_OPENH264DEC(obj)       (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENH264DEC))
+#define GST_IS_OPENH264DEC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENH264DEC))
+
+typedef struct _GstOpenh264Dec GstOpenh264Dec;
+typedef struct _GstOpenh264DecClass GstOpenh264DecClass;
+typedef struct _GstOpenh264DecPrivate GstOpenh264DecPrivate;
+
+struct _GstOpenh264Dec
+{
+    GstVideoDecoder base_openh264dec;
+
+    /*< private >*/
+    GstOpenh264DecPrivate *priv;
+};
+
+struct _GstOpenh264DecClass
+{
+    GstVideoDecoderClass base_openh264dec_class;
+};
+
+GType gst_openh264dec_get_type(void);
+
+G_END_DECLS
+#endif
diff --git a/ext/openh264/gstopenh264enc.cpp b/ext/openh264/gstopenh264enc.cpp
new file mode 100644
index 0000000..ebbe9b4
--- /dev/null
+++ b/ext/openh264/gstopenh264enc.cpp
@@ -0,0 +1,965 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstopenh264enc.h"
+
+#include <gst/gst.h>
+#include <gst/base/base.h>
+#include <gst/video/video.h>
+#include <gst/video/gstvideoencoder.h>
+#include <string.h>
+
+#include <wels/codec_api.h>
+#include <wels/codec_app_def.h>
+#include <wels/codec_def.h>
+
+#define GST_OPENH264ENC_GET_PRIVATE(obj) \
+    (G_TYPE_INSTANCE_GET_PRIVATE((obj), GST_TYPE_OPENH264ENC, GstOpenh264EncPrivate))
+
+GST_DEBUG_CATEGORY_STATIC (gst_openh264enc_debug_category);
+#define GST_CAT_DEFAULT gst_openh264enc_debug_category
+
+#define GST_TYPE_USAGE_TYPE (gst_openh264enc_usage_type_get_type ())
+static GType
+gst_openh264enc_usage_type_get_type (void)
+{
+  static GType usage_type = 0;
+
+  if (!usage_type) {
+    static const GEnumValue usage_types[] = {
+      {CAMERA_VIDEO_REAL_TIME, "video from camera", "camera"},
+      {SCREEN_CONTENT_REAL_TIME, "screen content", "screen"},
+      {0, NULL, NULL},
+    };
+
+    usage_type = g_enum_register_static ("EUsageType", usage_types);
+  }
+
+  return usage_type;
+}
+
+#define GST_TYPE_RC_MODES (gst_openh264enc_rc_modes_get_type ())
+static GType
+gst_openh264enc_rc_modes_get_type (void)
+{
+  static GType rc_modes_type = 0;
+
+  if (!rc_modes_type) {
+    static const GEnumValue rc_modes_types[] = {
+      {RC_QUALITY_MODE, "Quality mode", "quality"},
+      {RC_BITRATE_MODE, "Bitrate mode", "bitrate"},
+      {RC_BUFFERBASED_MODE, "No bitrate control, just using buffer status", "buffer"},
+      {RC_OFF_MODE, "Rate control off mode", "off"},
+      {0, NULL, NULL},
+    };
+
+    rc_modes_type = g_enum_register_static ("RC_MODES", rc_modes_types);
+  }
+
+  return rc_modes_type;
+}
+
+typedef enum _GstOpenh264encDeblockingMode
+{
+  GST_OPENH264_DEBLOCKING_ON = 0,
+  GST_OPENH264_DEBLOCKING_OFF = 1,
+  GST_OPENH264_DEBLOCKING_NOT_SLICE_BOUNDARIES = 2
+} GstOpenh264encDeblockingMode;
+
+#define GST_TYPE_OPENH264ENC_DEBLOCKING_MODE (gst_openh264enc_deblocking_mode_get_type ())
+static GType
+gst_openh264enc_deblocking_mode_get_type (void)
+{
+  static const GEnumValue types[] = {
+    {GST_OPENH264_DEBLOCKING_ON, "Deblocking on", "on"},
+    {GST_OPENH264_DEBLOCKING_OFF, "Deblocking off", "off"},
+    {GST_OPENH264_DEBLOCKING_NOT_SLICE_BOUNDARIES,
+        "Deblocking on, except for slice boundaries", "not-slice-boundaries"},
+    {0, NULL, NULL},
+  };
+  static volatile GType id = 0;
+
+  if (g_once_init_enter ((gsize *) & id)) {
+    GType _id = g_enum_register_static ("GstOpenh264encDeblockingModes", types);
+    g_once_init_leave ((gsize *) & id, _id);
+  }
+
+  return id;
+}
+
+#define GST_TYPE_OPENH264ENC_SLICE_MODE (gst_openh264enc_slice_mode_get_type ())
+static GType
+gst_openh264enc_slice_mode_get_type (void)
+{
+  static const GEnumValue types[] = {
+    {SM_FIXEDSLCNUM_SLICE, "num-slices slices", "n-slices"},
+    {SM_AUTO_SLICE, "Number of slices equal to number of threads", "auto"},
+    {0, NULL, NULL},
+  };
+  static volatile GType id = 0;
+
+  if (g_once_init_enter ((gsize *) & id)) {
+    GType _id = g_enum_register_static ("GstOpenh264encSliceModes", types);
+    g_once_init_leave ((gsize *) & id, _id);
+  }
+
+  return id;
+}
+
+/* prototypes */
+
+static void gst_openh264enc_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec);
+static void gst_openh264enc_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec);
+static void gst_openh264enc_finalize (GObject * object);
+static gboolean gst_openh264enc_start (GstVideoEncoder * encoder);
+static gboolean gst_openh264enc_stop (GstVideoEncoder * encoder);
+static gboolean gst_openh264enc_set_format (GstVideoEncoder * encoder,
+    GstVideoCodecState * state);
+static GstFlowReturn gst_openh264enc_handle_frame (GstVideoEncoder * encoder,
+    GstVideoCodecFrame * frame);
+static GstFlowReturn gst_openh264enc_finish (GstVideoEncoder * encoder);
+static gboolean gst_openh264enc_propose_allocation (GstVideoEncoder * encoder,
+    GstQuery * query);
+static void gst_openh264enc_set_usage_type (GstOpenh264Enc * openh264enc,
+    gint usage_type);
+static void gst_openh264enc_set_rate_control (GstOpenh264Enc * openh264enc,
+    gint rc_mode);
+
+
+#define DEFAULT_BITRATE            (128000)
+#define DEFAULT_GOP_SIZE           (90)
+#define DEFAULT_MAX_SLICE_SIZE     (1500000)
+#define DROP_BITRATE               20000
+#define START_FRAMERATE            30
+#define DEFAULT_USAGE_TYPE         CAMERA_VIDEO_REAL_TIME
+#define DEFAULT_RATE_CONTROL       RC_QUALITY_MODE
+#define DEFAULT_MULTI_THREAD       0
+#define DEFAULT_ENABLE_DENOISE     FALSE
+#define DEFAULT_ENABLE_FRAME_SKIP  FALSE
+#define DEFAULT_DEBLOCKING_MODE GST_OPENH264_DEBLOCKING_ON
+#define DEFAULT_BACKGROUND_DETECTION TRUE
+#define DEFAULT_ADAPTIVE_QUANTIZATION TRUE
+#define DEFAULT_SCENE_CHANGE_DETECTION TRUE
+#define DEFAULT_SLICE_MODE      SM_FIXEDSLCNUM_SLICE
+#define DEFAULT_NUM_SLICES      1
+
+enum
+{
+  PROP_0,
+  PROP_USAGE_TYPE,
+  PROP_BITRATE,
+  PROP_GOP_SIZE,
+  PROP_MAX_SLICE_SIZE,
+  PROP_RATE_CONTROL,
+  PROP_MULTI_THREAD,
+  PROP_ENABLE_DENOISE,
+  PROP_ENABLE_FRAME_SKIP,
+  PROP_DEBLOCKING_MODE,
+  PROP_BACKGROUND_DETECTION,
+  PROP_ADAPTIVE_QUANTIZATION,
+  PROP_SCENE_CHANGE_DETECTION,
+  PROP_SLICE_MODE,
+  PROP_NUM_SLICES,
+  N_PROPERTIES
+};
+
+struct _GstOpenh264EncPrivate
+{
+  ISVCEncoder *encoder;
+  EUsageType usage_type;
+  guint gop_size;
+  RC_MODES rate_control;
+  guint max_slice_size;
+  guint bitrate;
+  guint framerate;
+  guint multi_thread;
+  gboolean enable_denoise;
+  gboolean enable_frame_skip;
+  GstVideoCodecState *input_state;
+  guint32 drop_bitrate;
+  guint64 time_per_frame;
+  guint64 frame_count;
+  guint64 previous_timestamp;
+  GstOpenh264encDeblockingMode deblocking_mode;
+  gboolean background_detection;
+  gboolean adaptive_quantization;
+  gboolean scene_change_detection;
+  SliceModeEnum slice_mode;
+  guint num_slices;
+};
+
+/* pad templates */
+
+static GstStaticPadTemplate gst_openh264enc_sink_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
+    );
+
+static GstStaticPadTemplate gst_openh264enc_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS
+    ("video/x-h264, stream-format=(string)\"avc\", alignment=(string)\"au\", profile=(string)\"baseline\"")
+    );
+
+/* class initialization */
+
+G_DEFINE_TYPE_WITH_CODE (GstOpenh264Enc, gst_openh264enc,
+    GST_TYPE_VIDEO_ENCODER,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL);
+    GST_DEBUG_CATEGORY_INIT (gst_openh264enc_debug_category, "openh264enc", 0,
+        "debug category for openh264enc element"));
+
+static void
+gst_openh264enc_class_init (GstOpenh264EncClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstVideoEncoderClass *video_encoder_class = GST_VIDEO_ENCODER_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstOpenh264EncPrivate));
+
+  /* Setting up pads and setting metadata should be moved to
+     base_class_init if you intend to subclass this class. */
+  gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass),
+      gst_static_pad_template_get (&gst_openh264enc_src_template));
+  gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass),
+      gst_static_pad_template_get (&gst_openh264enc_sink_template));
+
+  gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (klass),
+      "OpenH264 video encoder", "Encoder/Video", "OpenH264 video encoder",
+      "Ericsson AB, http://www.ericsson.com");
+
+  gobject_class->set_property = gst_openh264enc_set_property;
+  gobject_class->get_property = gst_openh264enc_get_property;
+  gobject_class->finalize = gst_openh264enc_finalize;
+  video_encoder_class->start = GST_DEBUG_FUNCPTR (gst_openh264enc_start);
+  video_encoder_class->stop = GST_DEBUG_FUNCPTR (gst_openh264enc_stop);
+  video_encoder_class->set_format =
+      GST_DEBUG_FUNCPTR (gst_openh264enc_set_format);
+  video_encoder_class->handle_frame =
+      GST_DEBUG_FUNCPTR (gst_openh264enc_handle_frame);
+  video_encoder_class->propose_allocation =
+      GST_DEBUG_FUNCPTR (gst_openh264enc_propose_allocation);
+  video_encoder_class->finish = GST_DEBUG_FUNCPTR (gst_openh264enc_finish);
+
+  /* define properties */
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_USAGE_TYPE,
+      g_param_spec_enum ("usage-type", "Usage type",
+          "Type of video content",
+          GST_TYPE_USAGE_TYPE, CAMERA_VIDEO_REAL_TIME,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_RATE_CONTROL,
+      g_param_spec_enum ("rate-control", "Rate control",
+          "Rate control mode",
+          GST_TYPE_RC_MODES, RC_QUALITY_MODE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MULTI_THREAD,
+      g_param_spec_uint ("multi-thread", "Number of threads",
+          "The number of threads.",
+          0, G_MAXUINT, DEFAULT_MULTI_THREAD,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_ENABLE_DENOISE,
+      g_param_spec_boolean ("enable-denoise", "Denoise Control",
+          "Denoise control",
+          FALSE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_ENABLE_FRAME_SKIP,
+      g_param_spec_boolean ("enable-frame-skip", "Skip Frames",
+          "Skip frames to reach target bitrate",
+          FALSE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_BITRATE,
+      g_param_spec_uint ("bitrate", "Bitrate",
+          "Bitrate (in bits per second)",
+          0, G_MAXUINT, DEFAULT_BITRATE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_GOP_SIZE,
+      g_param_spec_uint ("gop-size", "GOP size",
+          "Number of frames between intra frames",
+          0, G_MAXUINT, DEFAULT_GOP_SIZE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_MAX_SLICE_SIZE,
+      g_param_spec_uint ("max-slice-size", "Max slice size",
+          "The maximum size of one slice (in bytes).",
+          0, G_MAXUINT, DEFAULT_MAX_SLICE_SIZE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass),
+      PROP_DEBLOCKING_MODE, g_param_spec_enum ("deblocking",
+          "Deblocking mode", "Deblocking mode",
+          GST_TYPE_OPENH264ENC_DEBLOCKING_MODE, DEFAULT_DEBLOCKING_MODE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_BACKGROUND_DETECTION,
+      g_param_spec_boolean ("background-detection", "Background detection",
+          "Background detection", DEFAULT_BACKGROUND_DETECTION,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_ADAPTIVE_QUANTIZATION,
+      g_param_spec_boolean ("adaptive-quantization", "Adaptive quantization",
+          "Adaptive quantization", DEFAULT_ADAPTIVE_QUANTIZATION,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_SCENE_CHANGE_DETECTION,
+      g_param_spec_boolean ("scene-change-detection",
+          "Scene change detection", "Scene change detection",
+          DEFAULT_SCENE_CHANGE_DETECTION,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SLICE_MODE,
+      g_param_spec_enum ("slice-mode", "Slice mode", "Slice mode",
+          GST_TYPE_OPENH264ENC_SLICE_MODE, DEFAULT_SLICE_MODE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_NUM_SLICES,
+      g_param_spec_uint ("num-slices", "Number of slices",
+          "The number of slices (needs slice-mode=n-slices)",
+          0, G_MAXUINT, DEFAULT_NUM_SLICES,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+}
+
+static void
+gst_openh264enc_init (GstOpenh264Enc * openh264enc)
+{
+  openh264enc->priv = GST_OPENH264ENC_GET_PRIVATE (openh264enc);
+  openh264enc->priv->gop_size = DEFAULT_GOP_SIZE;
+  openh264enc->priv->usage_type = DEFAULT_USAGE_TYPE;
+  openh264enc->priv->rate_control = DEFAULT_RATE_CONTROL;
+  openh264enc->priv->multi_thread = DEFAULT_MULTI_THREAD;
+  openh264enc->priv->max_slice_size = DEFAULT_MAX_SLICE_SIZE;
+  openh264enc->priv->bitrate = DEFAULT_BITRATE;
+  openh264enc->priv->framerate = START_FRAMERATE;
+  openh264enc->priv->input_state = NULL;
+  openh264enc->priv->time_per_frame = GST_SECOND / openh264enc->priv->framerate;
+  openh264enc->priv->frame_count = 0;
+  openh264enc->priv->previous_timestamp = 0;
+  openh264enc->priv->drop_bitrate = DROP_BITRATE;
+  openh264enc->priv->enable_denoise = DEFAULT_ENABLE_DENOISE;
+  openh264enc->priv->enable_frame_skip = DEFAULT_ENABLE_FRAME_SKIP;
+  openh264enc->priv->deblocking_mode = DEFAULT_DEBLOCKING_MODE;
+  openh264enc->priv->background_detection = DEFAULT_BACKGROUND_DETECTION;
+  openh264enc->priv->adaptive_quantization = DEFAULT_ADAPTIVE_QUANTIZATION;
+  openh264enc->priv->scene_change_detection = DEFAULT_SCENE_CHANGE_DETECTION;
+  openh264enc->priv->slice_mode = DEFAULT_SLICE_MODE;
+  openh264enc->priv->num_slices = DEFAULT_NUM_SLICES;
+  openh264enc->priv->encoder = NULL;
+  gst_openh264enc_set_usage_type (openh264enc, CAMERA_VIDEO_REAL_TIME);
+  gst_openh264enc_set_rate_control (openh264enc, RC_QUALITY_MODE);
+}
+
+static void
+gst_openh264enc_set_usage_type (GstOpenh264Enc * openh264enc, gint usage_type)
+{
+  switch (usage_type) {
+    case CAMERA_VIDEO_REAL_TIME:
+      openh264enc->priv->usage_type = CAMERA_VIDEO_REAL_TIME;
+      break;
+    case SCREEN_CONTENT_REAL_TIME:
+      openh264enc->priv->usage_type = SCREEN_CONTENT_REAL_TIME;
+      break;
+    default:
+      g_assert_not_reached ();
+  }
+}
+
+static void
+gst_openh264enc_set_rate_control (GstOpenh264Enc * openh264enc, gint rc_mode)
+{
+  switch (rc_mode) {
+    case RC_QUALITY_MODE:
+      openh264enc->priv->rate_control = RC_QUALITY_MODE;
+      break;
+    case RC_BITRATE_MODE:
+      openh264enc->priv->rate_control = RC_BITRATE_MODE;
+      break;
+    case RC_BUFFERBASED_MODE:
+      openh264enc->priv->rate_control = RC_BUFFERBASED_MODE;
+      break;
+    case RC_OFF_MODE:
+      openh264enc->priv->rate_control = RC_OFF_MODE;
+      break;
+    default:
+      g_assert_not_reached ();
+  }
+}
+
+void
+gst_openh264enc_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstOpenh264Enc *openh264enc = GST_OPENH264ENC (object);
+
+  GST_DEBUG_OBJECT (openh264enc, "set_property");
+
+  switch (property_id) {
+    case PROP_BITRATE:
+      openh264enc->priv->bitrate = g_value_get_uint (value);
+      break;
+
+    case PROP_MULTI_THREAD:
+      openh264enc->priv->multi_thread = g_value_get_uint (value);
+      break;
+
+    case PROP_USAGE_TYPE:
+      gst_openh264enc_set_usage_type (openh264enc, g_value_get_enum (value));
+      break;
+
+    case PROP_ENABLE_DENOISE:
+      openh264enc->priv->enable_denoise = g_value_get_boolean (value);
+      break;
+
+    case PROP_ENABLE_FRAME_SKIP:
+      openh264enc->priv->enable_frame_skip = g_value_get_boolean (value);
+      break;
+
+    case PROP_RATE_CONTROL:
+      gst_openh264enc_set_rate_control (openh264enc, g_value_get_enum (value));
+      break;
+
+    case PROP_GOP_SIZE:
+      openh264enc->priv->gop_size = g_value_get_uint (value);
+      break;
+
+    case PROP_MAX_SLICE_SIZE:
+      openh264enc->priv->max_slice_size = g_value_get_uint (value);
+      break;
+
+    case PROP_DEBLOCKING_MODE:
+      openh264enc->priv->deblocking_mode =
+          (GstOpenh264encDeblockingMode) g_value_get_enum (value);
+      break;
+
+    case PROP_BACKGROUND_DETECTION:
+      openh264enc->priv->background_detection = g_value_get_boolean (value);
+      break;
+
+    case PROP_ADAPTIVE_QUANTIZATION:
+      openh264enc->priv->adaptive_quantization = g_value_get_boolean (value);
+      break;
+
+    case PROP_SCENE_CHANGE_DETECTION:
+      openh264enc->priv->scene_change_detection = g_value_get_boolean (value);
+      break;
+
+    case PROP_SLICE_MODE:
+      openh264enc->priv->slice_mode = (SliceModeEnum) g_value_get_enum (value);
+      break;
+
+    case PROP_NUM_SLICES:
+      openh264enc->priv->num_slices = g_value_get_uint (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_openh264enc_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstOpenh264Enc *openh264enc = GST_OPENH264ENC (object);
+
+  GST_DEBUG_OBJECT (openh264enc, "get_property");
+
+  switch (property_id) {
+    case PROP_USAGE_TYPE:
+      g_value_set_enum (value, openh264enc->priv->usage_type);
+      break;
+
+    case PROP_RATE_CONTROL:
+      g_value_set_enum (value, openh264enc->priv->rate_control);
+      break;
+
+    case PROP_BITRATE:
+      g_value_set_uint (value, openh264enc->priv->bitrate);
+      break;
+
+    case PROP_ENABLE_DENOISE:
+      g_value_set_boolean (value, openh264enc->priv->enable_denoise);
+      break;
+
+    case PROP_ENABLE_FRAME_SKIP:
+      g_value_set_boolean (value, openh264enc->priv->enable_frame_skip);
+      break;
+
+    case PROP_MULTI_THREAD:
+      g_value_set_uint (value, openh264enc->priv->multi_thread);
+      break;
+
+    case PROP_GOP_SIZE:
+      g_value_set_uint (value, openh264enc->priv->gop_size);
+      break;
+
+    case PROP_MAX_SLICE_SIZE:
+      g_value_set_uint (value, openh264enc->priv->max_slice_size);
+      break;
+
+    case PROP_DEBLOCKING_MODE:
+      g_value_set_enum (value, openh264enc->priv->deblocking_mode);
+      break;
+
+    case PROP_BACKGROUND_DETECTION:
+      g_value_set_boolean (value, openh264enc->priv->background_detection);
+      break;
+
+    case PROP_ADAPTIVE_QUANTIZATION:
+      g_value_set_boolean (value, openh264enc->priv->adaptive_quantization);
+      break;
+
+    case PROP_SCENE_CHANGE_DETECTION:
+      g_value_set_boolean (value, openh264enc->priv->scene_change_detection);
+      break;
+
+    case PROP_SLICE_MODE:
+      g_value_set_enum (value, openh264enc->priv->slice_mode);
+      break;
+
+    case PROP_NUM_SLICES:
+      g_value_set_uint (value, openh264enc->priv->num_slices);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_openh264enc_finalize (GObject * object)
+{
+  GstOpenh264Enc *openh264enc = GST_OPENH264ENC (object);
+
+  GST_DEBUG_OBJECT (openh264enc, "finalize");
+
+  /* clean up object here */
+
+  if (openh264enc->priv->input_state) {
+    gst_video_codec_state_unref (openh264enc->priv->input_state);
+  }
+  openh264enc->priv->input_state = NULL;
+
+  G_OBJECT_CLASS (gst_openh264enc_parent_class)->finalize (object);
+}
+
+static gboolean
+gst_openh264enc_start (GstVideoEncoder * encoder)
+{
+  GstOpenh264Enc *openh264enc = GST_OPENH264ENC (encoder);
+  GST_DEBUG_OBJECT (openh264enc, "start");
+
+  return TRUE;
+}
+
+static gboolean
+gst_openh264enc_stop (GstVideoEncoder * encoder)
+{
+  GstOpenh264Enc *openh264enc;
+
+  openh264enc = GST_OPENH264ENC (encoder);
+
+  if (openh264enc->priv->encoder != NULL) {
+    openh264enc->priv->encoder->Uninitialize ();
+    WelsDestroySVCEncoder (openh264enc->priv->encoder);
+    openh264enc->priv->encoder = NULL;
+  }
+  openh264enc->priv->encoder = NULL;
+
+  if (openh264enc->priv->input_state) {
+    gst_video_codec_state_unref (openh264enc->priv->input_state);
+  }
+  openh264enc->priv->input_state = NULL;
+
+  GST_DEBUG_OBJECT (openh264enc, "openh264_enc_stop called");
+
+  return TRUE;
+}
+
+
+static gboolean
+gst_openh264enc_set_format (GstVideoEncoder * encoder,
+    GstVideoCodecState * state)
+{
+  GstOpenh264Enc *openh264enc = GST_OPENH264ENC (encoder);
+  GstOpenh264EncPrivate *priv = openh264enc->priv;
+  gchar *debug_caps;
+  SFrameBSInfo bsInfo;
+  guint width, height, fps_n, fps_d;
+  SEncParamExt enc_params;
+  gint ret;
+  guchar *nal_sps_data = NULL;
+  gint nal_sps_length = 0;
+  guchar *nal_pps_data = NULL;
+  gint nal_pps_length = 0;
+  guchar *sps_tmp_buf;
+  guchar *codec_data_tmp_buf;
+  GstBuffer *codec_data;
+  GstCaps *outcaps;
+  GstVideoCodecState *output_state;
+  openh264enc->priv->frame_count = 0;
+  int video_format = videoFormatI420;
+
+  debug_caps = gst_caps_to_string (state->caps);
+  GST_DEBUG_OBJECT (openh264enc, "gst_e26d4_enc_set_format called, caps: %s",
+      debug_caps);
+  g_free (debug_caps);
+
+  gst_openh264enc_stop (encoder);
+
+  if (priv->input_state) {
+    gst_video_codec_state_unref (priv->input_state);
+  }
+  priv->input_state = gst_video_codec_state_ref (state);
+
+  width = GST_VIDEO_INFO_WIDTH (&state->info);
+  height = GST_VIDEO_INFO_HEIGHT (&state->info);
+  fps_n = GST_VIDEO_INFO_FPS_N (&state->info);
+  fps_d = GST_VIDEO_INFO_FPS_D (&state->info);
+
+  if (priv->encoder != NULL) {
+    priv->encoder->Uninitialize ();
+    WelsDestroySVCEncoder (priv->encoder);
+    priv->encoder = NULL;
+  }
+  WelsCreateSVCEncoder (&(priv->encoder));
+  unsigned int uiTraceLevel = WELS_LOG_ERROR;
+  priv->encoder->SetOption(ENCODER_OPTION_TRACE_LEVEL, &uiTraceLevel);
+
+  priv->encoder->GetDefaultParams (&enc_params);
+
+  enc_params.iUsageType = openh264enc->priv->usage_type;
+  enc_params.iPicWidth = width;
+  enc_params.iPicHeight = height;
+  enc_params.iTargetBitrate = openh264enc->priv->bitrate;
+  enc_params.iRCMode = RC_QUALITY_MODE;
+  enc_params.iTemporalLayerNum = 1;
+  enc_params.iSpatialLayerNum = 1;
+  enc_params.iLtrMarkPeriod = 30;
+  enc_params.iMultipleThreadIdc = openh264enc->priv->multi_thread;
+  enc_params.bEnableDenoise = openh264enc->priv->enable_denoise;
+  enc_params.uiIntraPeriod = priv->gop_size;
+  enc_params.bEnableBackgroundDetection =
+      openh264enc->priv->background_detection;
+  enc_params.bEnableAdaptiveQuant = openh264enc->priv->adaptive_quantization;
+  enc_params.bEnableSceneChangeDetect =
+      openh264enc->priv->scene_change_detection;
+  enc_params.bEnableFrameSkip = openh264enc->priv->enable_frame_skip;
+  enc_params.bEnableLongTermReference = 0;
+  enc_params.bEnableSpsPpsIdAddition = 1;
+  enc_params.bPrefixNalAddingCtrl = 0;
+  enc_params.fMaxFrameRate = fps_n * 1.0 / fps_d;
+  enc_params.iLoopFilterDisableIdc = openh264enc->priv->deblocking_mode;
+  enc_params.sSpatialLayers[0].uiProfileIdc = PRO_BASELINE;
+  enc_params.sSpatialLayers[0].iVideoWidth = width;
+  enc_params.sSpatialLayers[0].iVideoHeight = height;
+  enc_params.sSpatialLayers[0].fFrameRate = fps_n * 1.0 / fps_d;
+  enc_params.sSpatialLayers[0].iSpatialBitrate = openh264enc->priv->bitrate;
+  enc_params.sSpatialLayers[0].sSliceCfg.uiSliceMode =
+      openh264enc->priv->slice_mode;
+  enc_params.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum =
+      openh264enc->priv->num_slices;
+
+  priv->framerate = (1 + fps_n / fps_d);
+
+  ret = priv->encoder->InitializeExt (&enc_params);
+
+  if (ret != cmResultSuccess) {
+    GST_ERROR_OBJECT (openh264enc, "failed to initialize encoder");
+    return FALSE;
+  }
+
+  priv->encoder->SetOption(ENCODER_OPTION_DATAFORMAT, &video_format);
+
+  memset (&bsInfo, 0, sizeof (SFrameBSInfo));
+
+  ret = priv->encoder->EncodeParameterSets (&bsInfo);
+
+  nal_sps_data = bsInfo.sLayerInfo[0].pBsBuf + 4;
+  nal_sps_length = bsInfo.sLayerInfo[0].pNalLengthInByte[0] - 4;
+
+  nal_pps_data = bsInfo.sLayerInfo[0].pBsBuf + nal_sps_length + 8;
+  nal_pps_length = bsInfo.sLayerInfo[0].pNalLengthInByte[1] - 4;
+
+  if (ret != cmResultSuccess) {
+    GST_ELEMENT_ERROR (openh264enc, STREAM, ENCODE,
+        ("Could not create headers"), ("Could not create SPS"));
+    return FALSE;
+  }
+
+  sps_tmp_buf = (guchar *) (g_memdup (nal_sps_data, nal_sps_length));
+
+  codec_data_tmp_buf =
+      (guchar *) g_malloc (5 + 3 + nal_sps_length + 3 + nal_pps_length);
+  codec_data_tmp_buf[0] = 1; /* version 1 */ ;
+  codec_data_tmp_buf[1] = sps_tmp_buf[1];       /* profile */
+  codec_data_tmp_buf[2] = sps_tmp_buf[2];       /* profile constraints */
+  codec_data_tmp_buf[3] = sps_tmp_buf[3];       /* level */
+  codec_data_tmp_buf[4] = 1;    /* NAL length marker length minus one */
+  codec_data_tmp_buf[5] = 1;    /* Number of SPS */
+  GST_WRITE_UINT16_BE (codec_data_tmp_buf + 6, nal_sps_length);
+  memcpy (codec_data_tmp_buf + 8, sps_tmp_buf, nal_sps_length);
+
+  g_free (sps_tmp_buf);
+
+  codec_data_tmp_buf[8 + nal_sps_length] = 1;   /* Number of PPS */
+  GST_WRITE_UINT16_BE (codec_data_tmp_buf + 8 + nal_sps_length + 1,
+      nal_pps_length);
+  memcpy (codec_data_tmp_buf + 8 + nal_sps_length + 3, nal_pps_data,
+      nal_pps_length);
+
+  GST_DEBUG_OBJECT (openh264enc, "Got SPS of size %d and PPS of size %d",
+      nal_sps_length, nal_pps_length);
+
+  codec_data =
+      gst_buffer_new_wrapped (codec_data_tmp_buf,
+      5 + 3 + nal_sps_length + 3 + nal_pps_length);
+
+  outcaps =
+      gst_caps_copy (gst_static_pad_template_get_caps
+      (&gst_openh264enc_src_template));
+  gst_caps_set_simple (outcaps, "codec_data", GST_TYPE_BUFFER, codec_data,
+      NULL);
+  gst_buffer_unref (codec_data);
+
+  output_state = gst_video_encoder_set_output_state (encoder, outcaps, state);
+  gst_video_codec_state_unref (output_state);
+
+  return gst_video_encoder_negotiate (encoder);
+}
+
+static gboolean
+gst_openh264enc_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
+{
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
+
+  return
+      GST_VIDEO_ENCODER_CLASS
+      (gst_openh264enc_parent_class)->propose_allocation (encoder, query);
+}
+
+static GstFlowReturn
+gst_openh264enc_handle_frame (GstVideoEncoder * encoder,
+    GstVideoCodecFrame * frame)
+{
+  GstOpenh264Enc *openh264enc = GST_OPENH264ENC (encoder);
+  SSourcePicture *src_pic = NULL;
+  GstVideoFrame video_frame;
+  gboolean force_keyframe;
+  gint ret;
+  SFrameBSInfo frame_info;
+  gfloat fps;
+  GstVideoEncoder *base_encoder = GST_VIDEO_ENCODER (openh264enc);
+
+  if (frame) {
+    src_pic = new SSourcePicture;
+
+    if (src_pic == NULL) {
+      if (frame)
+        gst_video_codec_frame_unref (frame);
+      return GST_FLOW_ERROR;
+    }
+    //fill default src_pic
+    src_pic->iColorFormat = videoFormatI420;
+    src_pic->uiTimeStamp = 0;
+  }
+
+  openh264enc->priv->frame_count++;
+  if (frame) {
+    if (G_UNLIKELY (openh264enc->priv->frame_count == 1)) {
+      openh264enc->priv->time_per_frame =
+          (GST_NSECOND / openh264enc->priv->framerate);
+      openh264enc->priv->previous_timestamp = frame->pts;
+    } else {
+      openh264enc->priv->time_per_frame =
+          openh264enc->priv->time_per_frame * 0.8 + (frame->pts -
+          openh264enc->priv->previous_timestamp) * 0.2;
+      openh264enc->priv->previous_timestamp = frame->pts;
+      if (openh264enc->priv->frame_count % 10 == 0) {
+        fps = GST_SECOND / (gdouble) openh264enc->priv->time_per_frame;
+        openh264enc->priv->encoder->SetOption (ENCODER_OPTION_FRAME_RATE, &fps);
+      }
+    }
+  }
+
+  if (openh264enc->priv->bitrate <= openh264enc->priv->drop_bitrate) {
+    GST_LOG_OBJECT (openh264enc, "Dropped frame due to too low bitrate");
+    if (frame) {
+      gst_video_encoder_finish_frame (encoder, frame);
+      delete src_pic;
+    }
+    return GST_FLOW_OK;
+  }
+
+  if (frame) {
+    gst_video_frame_map (&video_frame, &openh264enc->priv->input_state->info,
+        frame->input_buffer, GST_MAP_READ);
+    src_pic->iPicWidth = GST_VIDEO_FRAME_WIDTH (&video_frame);
+    src_pic->iPicHeight = GST_VIDEO_FRAME_HEIGHT (&video_frame);
+    src_pic->iStride[0] = GST_VIDEO_FRAME_COMP_STRIDE (&video_frame, 0);
+    src_pic->iStride[1] = GST_VIDEO_FRAME_COMP_STRIDE (&video_frame, 1);
+    src_pic->iStride[2] = GST_VIDEO_FRAME_COMP_STRIDE (&video_frame, 2);
+    src_pic->pData[0] = GST_VIDEO_FRAME_COMP_DATA (&video_frame, 0);
+    src_pic->pData[1] = GST_VIDEO_FRAME_COMP_DATA (&video_frame, 1);
+    src_pic->pData[2] = GST_VIDEO_FRAME_COMP_DATA (&video_frame, 2);
+
+    force_keyframe = GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (frame);
+    if (force_keyframe) {
+      openh264enc->priv->encoder->ForceIntraFrame (true);
+      GST_DEBUG_OBJECT (openh264enc,
+          "Got force key unit event, next frame coded as intra picture");
+    }
+  }
+
+  memset (&frame_info, 0, sizeof (SFrameBSInfo));
+  ret = openh264enc->priv->encoder->EncodeFrame (src_pic, &frame_info);
+  if (ret != cmResultSuccess) {
+    if (frame) {
+      gst_video_frame_unmap (&video_frame);
+      gst_video_codec_frame_unref (frame);
+      delete src_pic;
+      GST_ELEMENT_ERROR (openh264enc, STREAM, ENCODE,
+          ("Could not encode frame"), ("Openh264 returned %d", ret));
+      return GST_FLOW_ERROR;
+    } else {
+      return GST_FLOW_EOS;
+    }
+  }
+
+  if (videoFrameTypeSkip == frame_info.eFrameType) {
+    if (frame) {
+      gst_video_frame_unmap (&video_frame);
+      gst_video_encoder_finish_frame (base_encoder, frame);
+      delete src_pic;
+    }
+
+    return GST_FLOW_OK;
+  }
+
+  if (frame) {
+    gst_video_frame_unmap (&video_frame);
+    gst_video_codec_frame_unref (frame);
+    delete src_pic;
+    src_pic = NULL;
+    frame = NULL;
+  }
+
+  /* FIXME: openh264 has no way for us to get a connection
+   * between the input and output frames, we just have to
+   * guess based on the input */
+  frame = gst_video_encoder_get_oldest_frame (base_encoder);
+  if (!frame) {
+    GST_ELEMENT_ERROR (openh264enc, STREAM, ENCODE,
+        ("Could not encode frame"), ("openh264enc returned %d", ret));
+    gst_video_codec_frame_unref (frame);
+    return GST_FLOW_ERROR;
+  }
+
+  SLayerBSInfo *bs_info = &frame_info.sLayerInfo[0];
+  gint nal_size = bs_info->pNalLengthInByte[0] - 4;
+  guchar *nal_sps_data, *nal_pps_data;
+  gint nal_sps_length, nal_pps_length, idr_length, tmp_buf_length;
+
+  if (videoFrameTypeIDR == frame_info.eFrameType) {
+    GstMapInfo map;
+
+    /* sps */
+    nal_sps_data = frame_info.sLayerInfo[0].pBsBuf + 4;
+    nal_sps_length = frame_info.sLayerInfo[0].pNalLengthInByte[0] - 4;
+    /* pps */
+    nal_pps_data = nal_sps_data + frame_info.sLayerInfo[0].pNalLengthInByte[0];
+    nal_pps_length = frame_info.sLayerInfo[0].pNalLengthInByte[1] - 4;
+    /* idr */
+    bs_info = &frame_info.sLayerInfo[1];
+    idr_length = bs_info->pNalLengthInByte[0] - 4;
+
+    tmp_buf_length = nal_sps_length + 2 + nal_pps_length + 2 + idr_length + 2;
+    frame->output_buffer =
+        gst_video_encoder_allocate_output_buffer (encoder, tmp_buf_length);
+    gst_buffer_map (frame->output_buffer, &map, GST_MAP_WRITE);
+
+    GST_WRITE_UINT16_BE (map.data, nal_sps_length);
+    memcpy (map.data + 2, nal_sps_data, nal_sps_length);
+
+    GST_WRITE_UINT16_BE (map.data + nal_sps_length + 2, nal_pps_length);
+    memcpy (map.data + nal_sps_length + 2 + 2, nal_pps_data, nal_pps_length);
+
+    GST_WRITE_UINT16_BE (map.data + nal_sps_length + 2 + nal_pps_length + 2,
+        idr_length);
+    memcpy (map.data + nal_sps_length + 2 + nal_pps_length + 2 + 2,
+        bs_info->pBsBuf + 4, idr_length);
+
+    gst_buffer_unmap (frame->output_buffer, &map);
+
+    GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
+  } else {
+    GstMapInfo map;
+
+    tmp_buf_length = nal_size + 2;
+    frame->output_buffer =
+        gst_video_encoder_allocate_output_buffer (encoder, tmp_buf_length);
+    gst_buffer_map (frame->output_buffer, &map, GST_MAP_WRITE);
+
+    GST_WRITE_UINT16_BE (map.data, nal_size);
+    memcpy (map.data + 2, bs_info->pBsBuf + 4, nal_size);
+
+    gst_buffer_unmap (frame->output_buffer, &map);
+
+    GST_VIDEO_CODEC_FRAME_UNSET_SYNC_POINT (frame);
+  }
+
+  GST_LOG_OBJECT (openh264enc, "openh264 picture %scoded OK!",
+      (ret != cmResultSuccess) ? "NOT " : "");
+
+  return gst_video_encoder_finish_frame (encoder, frame);
+}
+
+static GstFlowReturn
+gst_openh264enc_finish (GstVideoEncoder * encoder)
+{
+  GstOpenh264Enc *openh264enc = GST_OPENH264ENC (encoder);
+
+  if (openh264enc->priv->frame_count == 0)
+    return GST_FLOW_OK;
+
+  /* Drain encoder */
+  while ((gst_openh264enc_handle_frame (encoder, NULL)) == GST_FLOW_OK);
+
+  return GST_FLOW_OK;
+}
diff --git a/ext/openh264/gstopenh264enc.h b/ext/openh264/gstopenh264enc.h
new file mode 100644
index 0000000..009210a
--- /dev/null
+++ b/ext/openh264/gstopenh264enc.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+/*/
+\*\ GstOpenh264Enc
+/*/
+
+#ifndef _GST_OPENH264ENC_H_
+#define _GST_OPENH264ENC_H_
+
+#include <gst/video/video.h>
+#include <gst/video/gstvideoencoder.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_OPENH264ENC          (gst_openh264enc_get_type())
+#define GST_OPENH264ENC(obj)          (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENH264ENC,GstOpenh264Enc))
+#define GST_OPENH264ENC_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENH264ENC,GstOpenh264EncClass))
+#define GST_IS_OPENH264ENC(obj)       (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENH264ENC))
+#define GST_IS_OPENH264ENC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENH264ENC))
+
+typedef struct _GstOpenh264Enc GstOpenh264Enc;
+typedef struct _GstOpenh264EncClass GstOpenh264EncClass;
+typedef struct _GstOpenh264EncPrivate GstOpenh264EncPrivate;
+
+struct _GstOpenh264Enc
+{
+    GstVideoEncoder base_openh264enc;
+
+    /*< private >*/
+    GstOpenh264EncPrivate *priv;
+};
+
+struct _GstOpenh264EncClass
+{
+    GstVideoEncoderClass base_openh264enc_class;
+};
+
+GType gst_openh264enc_get_type(void);
+
+G_END_DECLS
+#endif
diff --git a/ext/openh264/gstopenh264plugin.c b/ext/openh264/gstopenh264plugin.c
new file mode 100644
index 0000000..15957d7
--- /dev/null
+++ b/ext/openh264/gstopenh264plugin.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Ericsson AB. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+/*
+ * Openh264 GStreamer plugin
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gst/gst.h>
+#include "gstopenh264dec.h"
+#include "gstopenh264enc.h"
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  gst_element_register (plugin, "openh264dec", GST_RANK_MARGINAL,
+      GST_TYPE_OPENH264DEC);
+  gst_element_register (plugin, "openh264enc", GST_RANK_MARGINAL,
+      GST_TYPE_OPENH264ENC);
+
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    openh264,
+    "OpenH264 encoder/decoder plugin",
+    plugin_init,
+    VERSION, "BSD", "OpenWebRTC GStreamer plugins", "http://www.ericsson.com")
diff --git a/ext/openjpeg/Makefile.in b/ext/openjpeg/Makefile.in
index 4f5464b..06a203c 100644
--- a/ext/openjpeg/Makefile.in
+++ b/ext/openjpeg/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/openjpeg/gstopenjpegenc.c b/ext/openjpeg/gstopenjpegenc.c
index 7c138be..aee074a 100644
--- a/ext/openjpeg/gstopenjpegenc.c
+++ b/ext/openjpeg/gstopenjpegenc.c
@@ -369,7 +369,7 @@
       data_out[2]++;
       data_out[3]++;
     }
-    data_in += sstride;;
+    data_in += sstride;
   }
 }
 
@@ -406,7 +406,7 @@
       data_out[2]++;
       data_out[3]++;
     }
-    data_in += sstride;;
+    data_in += sstride;
   }
 }
 
diff --git a/ext/openni2/Makefile.in b/ext/openni2/Makefile.in
index b578da0..df112bf 100644
--- a/ext/openni2/Makefile.in
+++ b/ext/openni2/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/opus/Makefile.in b/ext/opus/Makefile.in
index efe4d18..8ee3e34 100644
--- a/ext/opus/Makefile.in
+++ b/ext/opus/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -249,8 +249,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -289,7 +293,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -297,6 +300,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -346,8 +351,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -426,7 +429,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -435,7 +437,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -448,7 +449,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -473,6 +473,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -546,10 +548,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -575,6 +581,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -611,6 +620,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -651,17 +661,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -678,6 +687,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c
index d2fc646..cfa711a 100644
--- a/ext/opus/gstopusdec.c
+++ b/ext/opus/gstopusdec.c
@@ -56,7 +56,7 @@
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS ("audio/x-raw, "
-        "format = (string) { " GST_AUDIO_NE (S16) " }, "
+        "format = (string) " GST_AUDIO_NE (S16) ", "
         "layout = (string) interleaved, "
         "rate = (int) { 48000, 24000, 16000, 12000, 8000 }, "
         "channels = (int) [ 1, 8 ] ")
@@ -181,8 +181,11 @@
   gst_audio_decoder_set_plc_aware (dec, TRUE);
 
   if (odec->use_inband_fec) {
-    gst_audio_decoder_set_latency (dec, 2 * GST_MSECOND + GST_MSECOND / 2,
-        120 * GST_MSECOND);
+    /* opusdec outputs samples directly from an input buffer, except if
+     * FEC is on, in which case it buffers one buffer in case one buffer
+     * goes missing.
+     */
+    gst_audio_decoder_set_latency (dec, 120 * GST_MSECOND, 120 * GST_MSECOND);
   }
 
   return TRUE;
diff --git a/ext/opus/gstopusenc.c b/ext/opus/gstopusenc.c
index f9cf624..cb3f276 100644
--- a/ext/opus/gstopusenc.c
+++ b/ext/opus/gstopusenc.c
@@ -114,6 +114,51 @@
   return id;
 }
 
+#define GST_OPUS_ENC_TYPE_AUDIO_TYPE (gst_opus_enc_audio_type_get_type())
+static GType
+gst_opus_enc_audio_type_get_type (void)
+{
+  static const GEnumValue values[] = {
+    {OPUS_APPLICATION_AUDIO, "Generic audio", "generic"},
+    {OPUS_APPLICATION_VOIP, "Voice", "voice"},
+    {0, NULL, NULL}
+  };
+  static volatile GType id = 0;
+
+  if (g_once_init_enter ((gsize *) & id)) {
+    GType _id;
+
+    _id = g_enum_register_static ("GstOpusEncAudioType", values);
+
+    g_once_init_leave ((gsize *) & id, _id);
+  }
+
+  return id;
+}
+
+#define GST_OPUS_ENC_TYPE_BITRATE_TYPE (gst_opus_enc_bitrate_type_get_type())
+static GType
+gst_opus_enc_bitrate_type_get_type (void)
+{
+  static const GEnumValue values[] = {
+    {BITRATE_TYPE_CBR, "CBR", "cbr"},
+    {BITRATE_TYPE_VBR, "VBR", "vbr"},
+    {BITRATE_TYPE_CONSTRAINED_VBR, "Constrained VBR", "constrained-vbr"},
+    {0, NULL, NULL}
+  };
+  static volatile GType id = 0;
+
+  if (g_once_init_enter ((gsize *) & id)) {
+    GType _id;
+
+    _id = g_enum_register_static ("GstOpusEncBitrateType", values);
+
+    g_once_init_leave ((gsize *) & id, _id);
+  }
+
+  return id;
+}
+
 #define FORMAT_STR GST_AUDIO_NE(S16)
 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
@@ -132,11 +177,13 @@
     );
 
 #define DEFAULT_AUDIO           TRUE
+#define DEFAULT_AUDIO_TYPE      OPUS_APPLICATION_AUDIO
 #define DEFAULT_BITRATE         64000
 #define DEFAULT_BANDWIDTH       OPUS_BANDWIDTH_FULLBAND
 #define DEFAULT_FRAMESIZE       20
 #define DEFAULT_CBR             TRUE
 #define DEFAULT_CONSTRAINED_VBR TRUE
+#define DEFAULT_BITRATE_TYPE    BITRATE_TYPE_CBR
 #define DEFAULT_COMPLEXITY      10
 #define DEFAULT_INBAND_FEC      FALSE
 #define DEFAULT_DTX             FALSE
@@ -147,11 +194,13 @@
 {
   PROP_0,
   PROP_AUDIO,
+  PROP_AUDIO_TYPE,
   PROP_BITRATE,
   PROP_BANDWIDTH,
   PROP_FRAME_SIZE,
   PROP_CBR,
   PROP_CONSTRAINED_VBR,
+  PROP_BITRATE_TYPE,
   PROP_COMPLEXITY,
   PROP_INBAND_FEC,
   PROP_DTX,
@@ -218,13 +267,18 @@
   base_class->getcaps = GST_DEBUG_FUNCPTR (gst_opus_enc_sink_getcaps);
 
   g_object_class_install_property (gobject_class, PROP_AUDIO,
-      g_param_spec_boolean ("audio", "Audio or voice",
-          "Audio or voice", DEFAULT_AUDIO,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+      g_param_spec_boolean ("audio",
+          "Audio or voice (obsolete, use audio-type)",
+          "Audio or voice (obsolete, use audio-type)", DEFAULT_AUDIO,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
+  g_object_class_install_property (gobject_class, PROP_AUDIO_TYPE,
+      g_param_spec_enum ("audio-type", "What type of audio to optimize for",
+          "What type of audio to optimize for", GST_OPUS_ENC_TYPE_AUDIO_TYPE,
+          DEFAULT_AUDIO_TYPE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BITRATE,
       g_param_spec_int ("bitrate", "Encoding Bit-rate",
-          "Specify an encoding bit-rate (in bps).",
-          LOWEST_BITRATE, HIGHEST_BITRATE, DEFAULT_BITRATE,
+          "Specify an encoding bit-rate (in bps).", LOWEST_BITRATE,
+          HIGHEST_BITRATE, DEFAULT_BITRATE,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
           GST_PARAM_MUTABLE_PLAYING));
   g_object_class_install_property (gobject_class, PROP_BANDWIDTH,
@@ -242,11 +296,17 @@
       g_param_spec_boolean ("cbr", "Constant bit rate", "Constant bit rate",
           DEFAULT_CBR,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-          GST_PARAM_MUTABLE_PLAYING));
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_DEPRECATED));
   g_object_class_install_property (gobject_class, PROP_CONSTRAINED_VBR,
       g_param_spec_boolean ("constrained-vbr", "Constrained VBR",
           "Constrained VBR", DEFAULT_CONSTRAINED_VBR,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_DEPRECATED));
+  g_object_class_install_property (gobject_class, PROP_BITRATE_TYPE,
+      g_param_spec_enum ("bitrate-type", "Bitrate type",
+          "Bitrate type", GST_OPUS_ENC_TYPE_BITRATE_TYPE,
+          DEFAULT_BITRATE_TYPE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
           GST_PARAM_MUTABLE_PLAYING));
   g_object_class_install_property (gobject_class, PROP_COMPLEXITY,
       g_param_spec_int ("complexity", "Complexity", "Complexity", 0, 10,
@@ -308,13 +368,13 @@
   enc->bitrate = DEFAULT_BITRATE;
   enc->bandwidth = DEFAULT_BANDWIDTH;
   enc->frame_size = DEFAULT_FRAMESIZE;
-  enc->cbr = DEFAULT_CBR;
-  enc->constrained_vbr = DEFAULT_CONSTRAINED_VBR;
+  enc->bitrate_type = DEFAULT_BITRATE_TYPE;
   enc->complexity = DEFAULT_COMPLEXITY;
   enc->inband_fec = DEFAULT_INBAND_FEC;
   enc->dtx = DEFAULT_DTX;
   enc->packet_loss_percentage = DEFAULT_PACKET_LOSS_PERCENT;
   enc->max_payload_size = DEFAULT_MAX_PAYLOAD_SIZE;
+  enc->audio_type = DEFAULT_AUDIO_TYPE;
 
   /* arrange granulepos marking (and required perfect ts) */
   gst_audio_encoder_set_mark_granule (benc, TRUE);
@@ -329,6 +389,7 @@
   GST_DEBUG_OBJECT (enc, "start");
   enc->tags = gst_tag_list_new_empty ();
   enc->header_sent = FALSE;
+  enc->encoded_samples = 0;
 
   return TRUE;
 }
@@ -657,17 +718,18 @@
   enc->state = opus_multistream_encoder_create (enc->sample_rate,
       enc->n_channels, enc->n_channels - enc->n_stereo_streams,
       enc->n_stereo_streams, enc->encoding_channel_mapping,
-      enc->audio_or_voip ? OPUS_APPLICATION_AUDIO : OPUS_APPLICATION_VOIP,
-      &error);
+      enc->audio_type, &error);
   if (!enc->state || error != OPUS_OK)
     goto encoder_creation_failed;
 
   opus_multistream_encoder_ctl (enc->state, OPUS_SET_BITRATE (enc->bitrate), 0);
   opus_multistream_encoder_ctl (enc->state, OPUS_SET_BANDWIDTH (enc->bandwidth),
       0);
-  opus_multistream_encoder_ctl (enc->state, OPUS_SET_VBR (!enc->cbr), 0);
   opus_multistream_encoder_ctl (enc->state,
-      OPUS_SET_VBR_CONSTRAINT (enc->constrained_vbr), 0);
+      OPUS_SET_VBR (enc->bitrate_type != BITRATE_TYPE_CBR), 0);
+  opus_multistream_encoder_ctl (enc->state,
+      OPUS_SET_VBR_CONSTRAINT (enc->bitrate_type ==
+          BITRATE_TYPE_CONSTRAINED_VBR), 0);
   opus_multistream_encoder_ctl (enc->state,
       OPUS_SET_COMPLEXITY (enc->complexity), 0);
   opus_multistream_encoder_ctl (enc->state,
@@ -704,6 +766,9 @@
       gst_tag_setter_merge_tags (setter, list, mode);
       break;
     }
+    case GST_EVENT_SEGMENT:
+      enc->encoded_samples = 0;
+      break;
 
     default:
       break;
@@ -730,9 +795,7 @@
   peercaps = gst_pad_peer_query_caps (GST_AUDIO_ENCODER_SRC_PAD (benc), NULL);
   if (!peercaps) {
     GST_DEBUG_OBJECT (benc, "No peercaps, returning template sink caps");
-    return
-        gst_caps_copy (gst_pad_get_pad_template_caps
-        (GST_AUDIO_ENCODER_SINK_PAD (benc)));
+    return gst_pad_get_pad_template_caps (GST_AUDIO_ENCODER_SINK_PAD (benc));
   }
 
   tcaps = gst_pad_get_pad_template_caps (GST_AUDIO_ENCODER_SRC_PAD (benc));
@@ -793,6 +856,8 @@
   GstMapInfo omap;
   gint outsize;
   GstBuffer *outbuf;
+  GstSegment *segment;
+  GstClockTime duration;
 
   guint max_payload_size;
   gint frame_samples;
@@ -813,6 +878,26 @@
     if (G_UNLIKELY (bsize % bytes)) {
       GST_DEBUG_OBJECT (enc, "draining; adding silence samples");
 
+      /* If encoding part of a frame, and we have no set stop time on
+       * the output segment, we update the segment stop time to reflect
+       * the last sample. This will let oggmux set the last page's
+       * granpos to tell a decoder the dummy samples should be clipped.
+       */
+      segment = &GST_AUDIO_ENCODER_OUTPUT_SEGMENT (enc);
+      if (!GST_CLOCK_TIME_IS_VALID (segment->stop)) {
+        int input_samples = bsize / (enc->n_channels * 2);
+        GST_DEBUG_OBJECT (enc,
+            "No stop time and partial frame, updating segment");
+        duration =
+            gst_util_uint64_scale (enc->encoded_samples + input_samples,
+            GST_SECOND, enc->sample_rate);
+        segment->stop = segment->start + duration;
+        GST_DEBUG_OBJECT (enc, "new output segment %" GST_SEGMENT_FORMAT,
+            segment);
+        gst_pad_push_event (GST_AUDIO_ENCODER_SRC_PAD (enc),
+            gst_event_new_segment (segment));
+      }
+
       size = ((bsize / bytes) + 1) * bytes;
       mdata = g_malloc0 (size);
       memcpy (mdata, bdata, bsize);
@@ -864,6 +949,7 @@
   ret =
       gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (enc), outbuf,
       frame_samples);
+  enc->encoded_samples += frame_samples;
 
 done:
 
@@ -927,7 +1013,11 @@
 
   switch (prop_id) {
     case PROP_AUDIO:
-      g_value_set_boolean (value, enc->audio_or_voip);
+      g_value_set_boolean (value,
+          enc->audio_type == OPUS_APPLICATION_AUDIO ? TRUE : FALSE);
+      break;
+    case PROP_AUDIO_TYPE:
+      g_value_set_enum (value, enc->audio_type);
       break;
     case PROP_BITRATE:
       g_value_set_int (value, enc->bitrate);
@@ -939,10 +1029,16 @@
       g_value_set_enum (value, enc->frame_size);
       break;
     case PROP_CBR:
-      g_value_set_boolean (value, enc->cbr);
+      g_warning ("cbr property is deprecated; use bitrate-type instead");
+      g_value_set_boolean (value, enc->bitrate_type == BITRATE_TYPE_CBR);
       break;
     case PROP_CONSTRAINED_VBR:
-      g_value_set_boolean (value, enc->constrained_vbr);
+      g_warning
+          ("constrained-vbr property is deprecated; use bitrate-type instead");
+      g_value_set_boolean (value,
+          enc->bitrate_type == BITRATE_TYPE_CONSTRAINED_VBR);
+    case PROP_BITRATE_TYPE:
+      g_value_set_enum (value, enc->bitrate_type);
       break;
     case PROP_COMPLEXITY:
       g_value_set_int (value, enc->complexity);
@@ -986,7 +1082,12 @@
 
   switch (prop_id) {
     case PROP_AUDIO:
-      enc->audio_or_voip = g_value_get_boolean (value);
+      enc->audio_type =
+          g_value_get_boolean (value) ? OPUS_APPLICATION_AUDIO :
+          OPUS_APPLICATION_VOIP;
+      break;
+    case PROP_AUDIO_TYPE:
+      enc->audio_type = g_value_get_enum (value);
       break;
     case PROP_BITRATE:
       GST_OPUS_UPDATE_PROPERTY (bitrate, int, BITRATE);
@@ -1002,15 +1103,40 @@
       g_mutex_unlock (&enc->property_lock);
       break;
     case PROP_CBR:
-      /* this one has an opposite meaning to the opus ctl... */
+      g_warning ("cbr property is deprecated; use bitrate-type instead");
       g_mutex_lock (&enc->property_lock);
-      enc->cbr = g_value_get_boolean (value);
-      if (enc->state)
-        opus_multistream_encoder_ctl (enc->state, OPUS_SET_VBR (!enc->cbr));
+      enc->bitrate_type = BITRATE_TYPE_CBR;
+      if (enc->state) {
+        opus_multistream_encoder_ctl (enc->state, OPUS_SET_VBR (FALSE));
+        opus_multistream_encoder_ctl (enc->state,
+            OPUS_SET_VBR_CONSTRAINT (FALSE), 0);
+      }
       g_mutex_unlock (&enc->property_lock);
       break;
     case PROP_CONSTRAINED_VBR:
-      GST_OPUS_UPDATE_PROPERTY (constrained_vbr, boolean, VBR_CONSTRAINT);
+      g_warning
+          ("constrained-vbr property is deprecated; use bitrate-type instead");
+      g_mutex_lock (&enc->property_lock);
+      enc->bitrate_type = BITRATE_TYPE_CONSTRAINED_VBR;
+      if (enc->state) {
+        opus_multistream_encoder_ctl (enc->state, OPUS_SET_VBR (TRUE));
+        opus_multistream_encoder_ctl (enc->state,
+            OPUS_SET_VBR_CONSTRAINT (TRUE), 0);
+      }
+      g_mutex_unlock (&enc->property_lock);
+      break;
+    case PROP_BITRATE_TYPE:
+      /* this one has an opposite meaning to the opus ctl... */
+      g_mutex_lock (&enc->property_lock);
+      enc->bitrate_type = g_value_get_enum (value);
+      if (enc->state) {
+        opus_multistream_encoder_ctl (enc->state,
+            OPUS_SET_VBR (enc->bitrate_type != BITRATE_TYPE_CBR));
+        opus_multistream_encoder_ctl (enc->state,
+            OPUS_SET_VBR_CONSTRAINT (enc->bitrate_type ==
+                BITRATE_TYPE_CONSTRAINED_VBR), 0);
+      }
+      g_mutex_unlock (&enc->property_lock);
       break;
     case PROP_COMPLEXITY:
       GST_OPUS_UPDATE_PROPERTY (complexity, int, COMPLEXITY);
diff --git a/ext/opus/gstopusenc.h b/ext/opus/gstopusenc.h
index 64f95e3..4ff9610 100644
--- a/ext/opus/gstopusenc.h
+++ b/ext/opus/gstopusenc.h
@@ -45,6 +45,13 @@
 #define MAX_FRAME_SIZE 2000*2
 #define MAX_FRAME_BYTES 2000
 
+typedef enum
+{
+  BITRATE_TYPE_CBR,
+  BITRATE_TYPE_VBR,
+  BITRATE_TYPE_CONSTRAINED_VBR,
+} GstOpusEncBitrateType;
+
 typedef struct _GstOpusEnc GstOpusEnc;
 typedef struct _GstOpusEncClass GstOpusEncClass;
 
@@ -57,12 +64,11 @@
   GMutex                property_lock;
 
   /* properties */
-  gboolean              audio_or_voip;
+  gint                  audio_type;
   gint                  bitrate;
   gint                  bandwidth;
   gint                  frame_size;
-  gboolean              cbr;
-  gboolean              constrained_vbr;
+  GstOpusEncBitrateType bitrate_type;
   gint                  complexity;
   gboolean              inband_fec;
   gboolean              dtx;
@@ -74,6 +80,7 @@
   gint                  sample_rate;
 
   gboolean              header_sent;
+  guint64               encoded_samples;
 
   GSList                *headers;
 
diff --git a/ext/opus/gstopusheader.c b/ext/opus/gstopusheader.c
index 3011716..d190cc2 100644
--- a/ext/opus/gstopusheader.c
+++ b/ext/opus/gstopusheader.c
@@ -96,16 +96,17 @@
 /*
  * (really really) FIXME: move into core (dixit tpm)
  */
-/**
+/*
  * _gst_caps_set_buffer_array:
- * @caps: a #GstCaps
+ * @caps: (transfer full): a #GstCaps
  * @field: field in caps to set
  * @buf: header buffers
  *
  * Adds given buffers to an array of buffers set as the given @field
  * on the given @caps.  List of buffer arguments must be NULL-terminated.
  *
- * Returns: input caps with a streamheader field added, or NULL if some error
+ * Returns: (transfer full): input caps with a streamheader field added, or NULL
+ *     if some error occurred
  */
 static GstCaps *
 _gst_caps_set_buffer_array (GstCaps * caps, const gchar * field,
diff --git a/ext/opus/gstrtpopusdepay.c b/ext/opus/gstrtpopusdepay.c
index da6d51e..6bcdd12 100644
--- a/ext/opus/gstrtpopusdepay.c
+++ b/ext/opus/gstrtpopusdepay.c
@@ -39,7 +39,7 @@
         "media = (string) \"audio\", "
         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ","
         "clock-rate = (int) 48000, "
-        "encoding-name = (string) \"X-GST-OPUS-DRAFT-SPITTKA-00\"")
+        "encoding-name = (string) { \"OPUS\", \"X-GST-OPUS-DRAFT-SPITTKA-00\" }")
     );
 
 static GstStaticPadTemplate gst_rtp_opus_depay_src_template =
diff --git a/ext/opus/gstrtpopuspay.c b/ext/opus/gstrtpopuspay.c
index 69ad51e..d0f7b10 100644
--- a/ext/opus/gstrtpopuspay.c
+++ b/ext/opus/gstrtpopuspay.c
@@ -48,7 +48,7 @@
         "media = (string) \"audio\", "
         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
         "clock-rate = (int) 48000, "
-        "encoding-name = (string) \"X-GST-OPUS-DRAFT-SPITTKA-00\"")
+        "encoding-name = (string) { \"OPUS\", \"X-GST-OPUS-DRAFT-SPITTKA-00\" }")
     );
 
 static gboolean gst_rtp_opus_pay_setcaps (GstRTPBasePayload * payload,
@@ -94,9 +94,25 @@
 gst_rtp_opus_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
 {
   gboolean res;
+  GstCaps *src_caps;
+  GstStructure *s;
+  char *encoding_name;
+
+  src_caps = gst_pad_get_allowed_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload));
+  if (src_caps) {
+    src_caps = gst_caps_make_writable (src_caps);
+    src_caps = gst_caps_truncate (src_caps);
+    s = gst_caps_get_structure (src_caps, 0);
+    gst_structure_fixate_field_string (s, "encoding-name", "OPUS");
+    encoding_name = g_strdup (gst_structure_get_string (s, "encoding-name"));
+    gst_caps_unref (src_caps);
+  } else {
+    encoding_name = g_strdup ("X-GST-OPUS-DRAFT-SPITTKA-00");
+  }
 
   gst_rtp_base_payload_set_options (payload, "audio", FALSE,
-      "X-GST-OPUS-DRAFT-SPITTKA-00", 48000);
+      encoding_name, 48000);
+  g_free (encoding_name);
   res = gst_rtp_base_payload_set_outcaps (payload, NULL);
 
   return res;
diff --git a/ext/resindvd/Makefile.in b/ext/resindvd/Makefile.in
index 2d9f4af..d58eaf5 100644
--- a/ext/resindvd/Makefile.in
+++ b/ext/resindvd/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -254,8 +254,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -294,7 +298,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -302,6 +305,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -351,8 +356,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -431,7 +434,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -440,7 +442,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -453,7 +454,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -478,6 +478,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -551,10 +553,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -580,6 +586,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -616,6 +625,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -656,17 +666,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -683,6 +692,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/resindvd/gstmpegdemux.c b/ext/resindvd/gstmpegdemux.c
index fcf9d75..7753514 100644
--- a/ext/resindvd/gstmpegdemux.c
+++ b/ext/resindvd/gstmpegdemux.c
@@ -942,22 +942,20 @@
       demux->bytes_since_scr = 0;
 
       GST_DEBUG_OBJECT (demux,
-          "demux: received new segment start %" G_GINT64_FORMAT " stop %"
-          G_GINT64_FORMAT " time %" G_GINT64_FORMAT
-          " base %" G_GINT64_FORMAT, start, stop, time, base);
+          "demux: received new segment %" GST_SEGMENT_FORMAT,
+          &demux->sink_segment);
 #if 0
       g_print ("demux: received new segment start %" G_GINT64_FORMAT " stop %"
           G_GINT64_FORMAT " time %" G_GINT64_FORMAT
           " base %" G_GINT64_FORMAT "\n", start, stop, time, base);
 #endif
-      position = base - start;
-      adjust = position + SCR_MUNGE;
+      adjust = base - start + SCR_MUNGE;
       if (adjust >= 0)
         demux->scr_adjust = GSTTIME_TO_MPEGTIME (adjust);
       else
         demux->scr_adjust = -GSTTIME_TO_MPEGTIME (-adjust);
 
-      start = SCR_MUNGE;
+      position = start = SCR_MUNGE;
       base = 0;
 
       if (stop != -1)
@@ -973,12 +971,9 @@
       demux->src_segment.position = position;
 
       GST_DEBUG_OBJECT (demux,
-          "sending new segment: rate %g format %d, start: %"
-          G_GINT64_FORMAT ", stop: %" G_GINT64_FORMAT ", time: %"
-          G_GINT64_FORMAT ", base: %" G_GINT64_FORMAT
+          "sending new segment %" GST_SEGMENT_FORMAT
           ", scr_adjust: %" G_GINT64_FORMAT "(%" GST_TIME_FORMAT ")",
-          segment->rate, segment->format, start, stop, time, base,
-          demux->scr_adjust,
+          &demux->src_segment, demux->scr_adjust,
           GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->scr_adjust)));
 #if 0
       g_print ("sending new segment: rate %g format %d, start: %"
diff --git a/ext/resindvd/gstmpegdesc.c b/ext/resindvd/gstmpegdesc.c
index 598a3b7..42dc5fb 100644
--- a/ext/resindvd/gstmpegdesc.c
+++ b/ext/resindvd/gstmpegdesc.c
@@ -57,7 +57,7 @@
   if (length > size)
     return 0;
 
-  return length + 2;;
+  return length + 2;
 }
 
 GstMPEGDescriptor *
diff --git a/ext/resindvd/rsninputselector.c b/ext/resindvd/rsninputselector.c
index df3537f..75d8724 100644
--- a/ext/resindvd/rsninputselector.c
+++ b/ext/resindvd/rsninputselector.c
@@ -1535,6 +1535,7 @@
 
       /* perform the query on all sinkpads and combine the results. We take the
        * max of min and the min of max for the result latency. */
+      res = TRUE;
       GST_INPUT_SELECTOR_LOCK (sel);
       for (walk = GST_ELEMENT_CAST (sel)->sinkpads; walk;
           walk = g_list_next (walk)) {
@@ -1544,9 +1545,6 @@
           GstClockTime min, max;
           gboolean live;
 
-          /* one query succeeded, we succeed too */
-          res = TRUE;
-
           gst_query_parse_latency (query, &live, &min, &max);
 
           GST_DEBUG_OBJECT (sinkpad,
@@ -1560,9 +1558,11 @@
               resmax = max;
             else if (max < resmax)
               resmax = max;
-            if (reslive == FALSE)
-              reslive = live;
+            reslive = TRUE;
           }
+        } else {
+          GST_LOG_OBJECT (sinkpad, "latency query failed");
+          res = FALSE;
         }
       }
       GST_INPUT_SELECTOR_UNLOCK (sel);
diff --git a/ext/rsvg/Makefile.in b/ext/rsvg/Makefile.in
index 83f9120..41cea47 100644
--- a/ext/rsvg/Makefile.in
+++ b/ext/rsvg/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/rtmp/Makefile.in b/ext/rtmp/Makefile.in
index 2a8c11b..a16941f 100644
--- a/ext/rtmp/Makefile.in
+++ b/ext/rtmp/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/sbc/Makefile.in b/ext/sbc/Makefile.in
index 606a741..93ba57b 100644
--- a/ext/sbc/Makefile.in
+++ b/ext/sbc/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/schroedinger/Makefile.in b/ext/schroedinger/Makefile.in
index e51d7ff..1059015 100644
--- a/ext/schroedinger/Makefile.in
+++ b/ext/schroedinger/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/schroedinger/gstschrodec.c b/ext/schroedinger/gstschrodec.c
index 0a273fa..15065af 100644
--- a/ext/schroedinger/gstschrodec.c
+++ b/ext/schroedinger/gstschrodec.c
@@ -58,6 +58,10 @@
   SchroDecoder *decoder;
 
   gboolean seq_header_buffer_seen;
+  gint next;
+  gint prev;
+  gint parse_code;
+  gboolean header_read;
 };
 
 struct _GstSchroDecClass
@@ -151,6 +155,7 @@
 
   schro_dec->decoder = schro_decoder_new ();
   gst_video_decoder_set_packetized (GST_VIDEO_DECODER (schro_dec), FALSE);
+  schro_dec->header_read = FALSE;
 }
 
 static gboolean
@@ -163,7 +168,11 @@
 static gboolean
 gst_schro_dec_stop (GstVideoDecoder * dec)
 {
+  GstSchroDec *schro_dec;
 
+  schro_dec = GST_SCHRO_DEC (dec);
+
+  schro_dec->header_read = FALSE;
   return TRUE;
 }
 
@@ -178,7 +187,7 @@
 
   if (schro_dec->decoder)
     schro_decoder_reset (schro_dec->decoder);
-
+  schro_dec->header_read = FALSE;
   return TRUE;
 }
 
@@ -278,9 +287,6 @@
 {
   GstSchroDec *schro_decoder;
   unsigned char header[SCHRO_PARSE_HEADER_SIZE];
-  int next;
-  int prev;
-  int parse_code;
   int av, loc;
 
   GST_DEBUG_OBJECT (base_video_decoder, "parse");
@@ -295,58 +301,65 @@
   GST_DEBUG ("available %d", av);
 
   /* Check for header */
-  loc =
-      gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x42424344, 0,
-      av - 3);
-  if (G_UNLIKELY (loc == -1)) {
-    GST_DEBUG_OBJECT (schro_decoder, "No header");
-    gst_adapter_flush (adapter, av - 3);
-    return GST_VIDEO_DECODER_FLOW_NEED_DATA;
+  if (schro_decoder->header_read == FALSE) {
+    /* Check for header */
+    loc =
+        gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x42424344, 0,
+        av - (SCHRO_PARSE_HEADER_SIZE - 1));
+    if (G_UNLIKELY (loc == -1)) {
+      GST_DEBUG_OBJECT (schro_decoder, "No header");
+      gst_adapter_flush (adapter, av - (SCHRO_PARSE_HEADER_SIZE - 1));
+      return GST_VIDEO_DECODER_FLOW_NEED_DATA;
+    }
+
+    /* Skip data until header */
+    if (loc > 0)
+      gst_adapter_flush (adapter, loc);
+
+    gst_adapter_copy (adapter, header, 0, SCHRO_PARSE_HEADER_SIZE);
+
+    schro_decoder->parse_code = header[4];
+    schro_decoder->next = GST_READ_UINT32_BE (header + 5);
+    schro_decoder->prev = GST_READ_UINT32_BE (header + 9);
+
+    GST_DEBUG ("%08x %02x %08x %08x",
+        GST_READ_UINT32_BE (header), schro_decoder->parse_code,
+        schro_decoder->next, schro_decoder->prev);
+
+    if (memcmp (header, "BBCD", 4) != 0 || (schro_decoder->next & 0xf0000000)
+        || (schro_decoder->prev & 0xf0000000)) {
+      gst_adapter_flush (adapter, 1);
+      return GST_VIDEO_DECODER_FLOW_NEED_DATA;
+    }
+    schro_decoder->header_read = TRUE;
   }
-
-  /* Skip data until header */
-  if (loc > 0)
-    gst_adapter_flush (adapter, loc);
-
-  gst_adapter_copy (adapter, header, 0, SCHRO_PARSE_HEADER_SIZE);
-
-  parse_code = header[4];
-  next = GST_READ_UINT32_BE (header + 5);
-  prev = GST_READ_UINT32_BE (header + 9);
-
-  GST_DEBUG ("%08x %02x %08x %08x",
-      GST_READ_UINT32_BE (header), parse_code, next, prev);
-
-  if (memcmp (header, "BBCD", 4) != 0 ||
-      (next & 0xf0000000) || (prev & 0xf0000000)) {
-    gst_adapter_flush (adapter, 1);
-    return GST_VIDEO_DECODER_FLOW_NEED_DATA;
-  }
-
-  if (SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE (parse_code)) {
-    if (next != 0 && next != SCHRO_PARSE_HEADER_SIZE) {
-      GST_WARNING ("next is not 0 or 13 in EOS packet (%d)", next);
+  if (SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE (schro_decoder->parse_code)) {
+    if (schro_decoder->next != 0
+        && schro_decoder->next != SCHRO_PARSE_HEADER_SIZE) {
+      GST_WARNING ("next is not 0 or 13 in EOS packet (%d)",
+          schro_decoder->next);
     }
 
     gst_video_decoder_add_to_frame (base_video_decoder,
         SCHRO_PARSE_HEADER_SIZE);
 
     SCHRO_DEBUG ("eos");
-
+    schro_decoder->header_read = FALSE;
     return gst_video_decoder_have_frame (base_video_decoder);
   }
 
-  if (gst_adapter_available (adapter) < next) {
+  if (gst_adapter_available (adapter) < schro_decoder->next) {
     return GST_VIDEO_DECODER_FLOW_NEED_DATA;
-  }
+  } else
+    schro_decoder->header_read = FALSE;
 
-  if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (parse_code)) {
+  if (SCHRO_PARSE_CODE_IS_SEQ_HEADER (schro_decoder->parse_code)) {
     guint8 *data;
 
-    data = g_malloc (next);
+    data = g_malloc (schro_decoder->next);
 
-    gst_adapter_copy (adapter, data, 0, next);
-    parse_sequence_header (schro_decoder, data, next);
+    gst_adapter_copy (adapter, data, 0, schro_decoder->next);
+    parse_sequence_header (schro_decoder, data, schro_decoder->next);
 
     GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
 
@@ -395,11 +408,11 @@
   }
 
   if (!schro_decoder->seq_header_buffer_seen) {
-    gst_adapter_flush (adapter, next);
+    gst_adapter_flush (adapter, schro_decoder->next);
     return GST_FLOW_OK;
   }
 
-  if (SCHRO_PARSE_CODE_IS_PICTURE (parse_code)) {
+  if (SCHRO_PARSE_CODE_IS_PICTURE (schro_decoder->parse_code)) {
     guint8 tmp[4];
 
     gst_adapter_copy (adapter, tmp, SCHRO_PARSE_HEADER_SIZE, 4);
@@ -408,11 +421,10 @@
      * do anything with presentation_frame_number */
     frame->presentation_frame_number = GST_READ_UINT32_BE (tmp);
 
-    gst_video_decoder_add_to_frame (base_video_decoder, next);
-
+    gst_video_decoder_add_to_frame (base_video_decoder, schro_decoder->next);
     return gst_video_decoder_have_frame (base_video_decoder);
   } else {
-    gst_video_decoder_add_to_frame (base_video_decoder, next);
+    gst_video_decoder_add_to_frame (base_video_decoder, schro_decoder->next);
   }
 
   return GST_FLOW_OK;
diff --git a/ext/sdl/Makefile.in b/ext/sdl/Makefile.in
index a74159c..ea296d7 100644
--- a/ext/sdl/Makefile.in
+++ b/ext/sdl/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/smoothstreaming/Makefile.am b/ext/smoothstreaming/Makefile.am
index a683f75..06c6796 100644
--- a/ext/smoothstreaming/Makefile.am
+++ b/ext/smoothstreaming/Makefile.am
@@ -7,6 +7,7 @@
 libgstsmoothstreaming_la_LIBADD = \
     $(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-$(GST_API_VERSION).la \
     $(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-$(GST_API_VERSION).la \
+    $(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
     $(GST_PLUGINS_BASE_LIBS) \
     -lgsttag-$(GST_API_VERSION) \
     $(GST_BASE_LIBS) $(GST_LIBS) $(ZLIB_LIBS) $(LIBXML2_LIBS)
diff --git a/ext/smoothstreaming/Makefile.in b/ext/smoothstreaming/Makefile.in
index 406f452..1bf70fe 100644
--- a/ext/smoothstreaming/Makefile.in
+++ b/ext/smoothstreaming/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -156,6 +156,7 @@
 am__DEPENDENCIES_1 =
 libgstsmoothstreaming_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-$(GST_API_VERSION).la \
 	$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-$(GST_API_VERSION).la \
+	$(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_libgstsmoothstreaming_la_OBJECTS =  \
@@ -250,8 +251,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -290,7 +295,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -298,6 +302,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -347,8 +353,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -427,7 +431,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -436,7 +439,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -449,7 +451,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -474,6 +475,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -547,10 +550,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -576,6 +583,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -612,6 +622,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -652,17 +663,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -679,6 +689,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -738,6 +749,7 @@
 libgstsmoothstreaming_la_LIBADD = \
     $(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-$(GST_API_VERSION).la \
     $(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-$(GST_API_VERSION).la \
+    $(top_builddir)/gst-libs/gst/adaptivedemux/libgstadaptivedemux-@GST_API_VERSION@.la \
     $(GST_PLUGINS_BASE_LIBS) \
     -lgsttag-$(GST_API_VERSION) \
     $(GST_BASE_LIBS) $(GST_LIBS) $(ZLIB_LIBS) $(LIBXML2_LIBS)
diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c
index d76654e..90cfac1 100644
--- a/ext/smoothstreaming/gstmssdemux.c
+++ b/ext/smoothstreaming/gstmssdemux.c
@@ -77,19 +77,14 @@
 
 GST_DEBUG_CATEGORY (mssdemux_debug);
 
-#define DEFAULT_CONNECTION_SPEED 0
 #define DEFAULT_MAX_QUEUE_SIZE_BUFFERS 0
 #define DEFAULT_BITRATE_LIMIT 0.8
 
-#define MAX_DOWNLOAD_ERROR_COUNT 3
-
 enum
 {
   PROP_0,
 
-  PROP_CONNECTION_SPEED,
   PROP_MAX_QUEUE_SIZE_BUFFERS,
-  PROP_BITRATE_LIMIT,
   PROP_LAST
 };
 
@@ -113,42 +108,45 @@
     GST_STATIC_CAPS_ANY);
 
 #define gst_mss_demux_parent_class parent_class
-G_DEFINE_TYPE (GstMssDemux, gst_mss_demux, GST_TYPE_BIN);
+G_DEFINE_TYPE (GstMssDemux, gst_mss_demux, GST_TYPE_ADAPTIVE_DEMUX);
 
 static void gst_mss_demux_dispose (GObject * object);
 static void gst_mss_demux_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_mss_demux_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
-static GstStateChangeReturn gst_mss_demux_change_state (GstElement * element,
-    GstStateChange transition);
-static void gst_mss_demux_handle_message (GstBin * bin, GstMessage * msg);
-static GstFlowReturn gst_mss_demux_chain (GstPad * pad, GstObject * parent,
+
+static gboolean gst_mss_demux_is_live (GstAdaptiveDemux * demux);
+static gboolean gst_mss_demux_process_manifest (GstAdaptiveDemux * demux,
     GstBuffer * buffer);
-static GstFlowReturn gst_mss_demux_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static gboolean gst_mss_demux_src_query (GstPad * pad, GstObject * parent,
-    GstQuery * query);
-
-static void gst_mss_demux_download_loop (GstMssDemuxStream * stream);
-static GstFlowReturn gst_mss_demux_stream_push_event (GstMssDemuxStream *
-    stream, GstEvent * event);
-static GstFlowReturn gst_mss_demux_combine_flows (GstMssDemux * mssdemux);
-
-static gboolean gst_mss_demux_process_manifest (GstMssDemux * mssdemux);
-static void
-gst_mss_demux_stop_tasks (GstMssDemux * mssdemux, gboolean immediate);
+static GstClockTime gst_mss_demux_get_duration (GstAdaptiveDemux * demux);
+static void gst_mss_demux_reset (GstAdaptiveDemux * demux);
+static GstFlowReturn gst_mss_demux_stream_seek (GstAdaptiveDemuxStream * stream,
+    GstClockTime ts);
+static gboolean
+gst_mss_demux_stream_has_next_fragment (GstAdaptiveDemuxStream * stream);
+static GstFlowReturn
+gst_mss_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream);
+static gboolean gst_mss_demux_stream_select_bitrate (GstAdaptiveDemuxStream *
+    stream, guint64 bitrate);
+static GstFlowReturn
+gst_mss_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream);
+static gboolean gst_mss_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek);
+static gint64
+gst_mss_demux_get_manifest_update_interval (GstAdaptiveDemux * demux);
+static GstFlowReturn
+gst_mss_demux_update_manifest (GstAdaptiveDemux * demux, GstBuffer * buffer);
 
 static void
 gst_mss_demux_class_init (GstMssDemuxClass * klass)
 {
   GObjectClass *gobject_class;
   GstElementClass *gstelement_class;
-  GstBinClass *gstbin_class;
+  GstAdaptiveDemuxClass *gstadaptivedemux_class;
 
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
-  gstbin_class = (GstBinClass *) klass;
+  gstadaptivedemux_class = (GstAdaptiveDemuxClass *) klass;
 
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&gst_mss_demux_sink_template));
@@ -165,30 +163,32 @@
   gobject_class->set_property = gst_mss_demux_set_property;
   gobject_class->get_property = gst_mss_demux_get_property;
 
-  g_object_class_install_property (gobject_class, PROP_CONNECTION_SPEED,
-      g_param_spec_uint ("connection-speed", "Connection Speed",
-          "Network connection speed in kbps (0 = unknown)",
-          0, G_MAXUINT / 1000, DEFAULT_CONNECTION_SPEED,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
+#ifndef GST_REMOVE_DEPRECATED
   g_object_class_install_property (gobject_class, PROP_MAX_QUEUE_SIZE_BUFFERS,
       g_param_spec_uint ("max-queue-size-buffers", "Max queue size in buffers",
           "Maximum buffers that can be stored in each internal stream queue "
           "(0 = infinite) (deprecated)", 0, G_MAXUINT,
           DEFAULT_MAX_QUEUE_SIZE_BUFFERS,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
+#endif
 
-  g_object_class_install_property (gobject_class, PROP_BITRATE_LIMIT,
-      g_param_spec_float ("bitrate-limit",
-          "Bitrate limit in %",
-          "Limit of the available bitrate to use when switching to alternates.",
-          0, 1, DEFAULT_BITRATE_LIMIT,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  gstelement_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_mss_demux_change_state);
-
-  gstbin_class->handle_message = gst_mss_demux_handle_message;
+  gstadaptivedemux_class->process_manifest = gst_mss_demux_process_manifest;
+  gstadaptivedemux_class->is_live = gst_mss_demux_is_live;
+  gstadaptivedemux_class->get_duration = gst_mss_demux_get_duration;
+  gstadaptivedemux_class->get_manifest_update_interval =
+      gst_mss_demux_get_manifest_update_interval;
+  gstadaptivedemux_class->reset = gst_mss_demux_reset;
+  gstadaptivedemux_class->seek = gst_mss_demux_seek;
+  gstadaptivedemux_class->stream_seek = gst_mss_demux_stream_seek;
+  gstadaptivedemux_class->stream_advance_fragment =
+      gst_mss_demux_stream_advance_fragment;
+  gstadaptivedemux_class->stream_has_next_fragment =
+      gst_mss_demux_stream_has_next_fragment;
+  gstadaptivedemux_class->stream_select_bitrate =
+      gst_mss_demux_stream_select_bitrate;
+  gstadaptivedemux_class->stream_update_fragment_info =
+      gst_mss_demux_stream_update_fragment_info;
+  gstadaptivedemux_class->update_manifest = gst_mss_demux_update_manifest;
 
   GST_DEBUG_CATEGORY_INIT (mssdemux_debug, "mssdemux", 0, "mssdemux plugin");
 }
@@ -196,135 +196,32 @@
 static void
 gst_mss_demux_init (GstMssDemux * mssdemux)
 {
-  mssdemux->sinkpad =
-      gst_pad_new_from_static_template (&gst_mss_demux_sink_template, "sink");
-  gst_pad_set_chain_function (mssdemux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_mss_demux_chain));
-  gst_pad_set_event_function (mssdemux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_mss_demux_event));
-  gst_element_add_pad (GST_ELEMENT_CAST (mssdemux), mssdemux->sinkpad);
-
   mssdemux->data_queue_max_size = DEFAULT_MAX_QUEUE_SIZE_BUFFERS;
-  mssdemux->bitrate_limit = DEFAULT_BITRATE_LIMIT;
 
-  mssdemux->have_group_id = FALSE;
-  mssdemux->group_id = G_MAXUINT;
-}
-
-static GstMssDemuxStream *
-gst_mss_demux_stream_new (GstMssDemux * mssdemux,
-    GstMssStream * manifeststream, GstPad * srcpad)
-{
-  GstMssDemuxStream *stream;
-
-  stream = g_new0 (GstMssDemuxStream, 1);
-
-  /* Downloading task */
-  g_rec_mutex_init (&stream->download_lock);
-  stream->download_task =
-      gst_task_new ((GstTaskFunction) gst_mss_demux_download_loop, stream,
-      NULL);
-  gst_task_set_lock (stream->download_task, &stream->download_lock);
-
-  stream->pad = srcpad;
-  stream->manifest_stream = manifeststream;
-  stream->parent = mssdemux;
-
-  gst_segment_init (&stream->segment, GST_FORMAT_TIME);
-  g_cond_init (&stream->fragment_download_cond);
-  g_mutex_init (&stream->fragment_download_lock);
-
-  return stream;
+  gst_adaptive_demux_set_stream_struct_size (GST_ADAPTIVE_DEMUX_CAST (mssdemux),
+      sizeof (GstMssDemuxStream));
 }
 
 static void
-gst_mss_demux_stream_free (GstMssDemuxStream * stream)
+gst_mss_demux_reset (GstAdaptiveDemux * demux)
 {
-  if (stream->download_task) {
-    if (GST_TASK_STATE (stream->download_task) != GST_TASK_STOPPED) {
-      GST_DEBUG_OBJECT (stream->parent, "Leaving streaming task %s:%s",
-          GST_DEBUG_PAD_NAME (stream->pad));
-      g_cond_signal (&stream->fragment_download_cond);
-      gst_task_stop (stream->download_task);
-      GST_LOG_OBJECT (stream->parent, "Waiting for task to finish");
-      gst_task_join (stream->download_task);
-      GST_LOG_OBJECT (stream->parent, "Finished");
-    }
-    gst_object_unref (stream->download_task);
-    g_rec_mutex_clear (&stream->download_lock);
-    stream->download_task = NULL;
-  }
-
-  if (stream->pending_segment) {
-    gst_event_unref (stream->pending_segment);
-    stream->pending_segment = NULL;
-  }
-
-  if (stream->src_srcpad) {
-    gst_object_unref (stream->src_srcpad);
-    stream->src_srcpad = NULL;
-  }
-
-  if (stream->src) {
-    gst_element_set_state (stream->src, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (stream->parent), stream->src);
-    stream->src = NULL;
-  }
-
-  g_cond_clear (&stream->fragment_download_cond);
-  g_mutex_clear (&stream->fragment_download_lock);
-
-  if (stream->pad) {
-    gst_object_unref (stream->pad);
-    stream->pad = NULL;
-  }
-  if (stream->caps)
-    gst_caps_unref (stream->caps);
-  g_free (stream);
-}
-
-static void
-gst_mss_demux_reset (GstMssDemux * mssdemux)
-{
-  GSList *iter;
-
-  gst_mss_demux_stop_tasks (mssdemux, TRUE);
-
-  if (mssdemux->manifest_buffer) {
-    gst_buffer_unref (mssdemux->manifest_buffer);
-    mssdemux->manifest_buffer = NULL;
-  }
-
-  for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-    GstMssDemuxStream *stream = iter->data;
-    if (stream->pad)
-      gst_element_remove_pad (GST_ELEMENT_CAST (mssdemux), stream->pad);
-    gst_mss_demux_stream_free (stream);
-  }
-  g_slist_free (mssdemux->streams);
-  mssdemux->streams = NULL;
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
 
   if (mssdemux->manifest) {
     gst_mss_manifest_free (mssdemux->manifest);
     mssdemux->manifest = NULL;
   }
-
-  mssdemux->n_videos = mssdemux->n_audios = 0;
   g_free (mssdemux->base_url);
   mssdemux->base_url = NULL;
-  g_free (mssdemux->manifest_uri);
-  mssdemux->manifest_uri = NULL;
 
-  mssdemux->have_group_id = FALSE;
-  mssdemux->group_id = G_MAXUINT;
+  mssdemux->n_videos = mssdemux->n_audios = 0;
+
 }
 
 static void
 gst_mss_demux_dispose (GObject * object)
 {
-  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (object);
-
-  gst_mss_demux_reset (mssdemux);
+  gst_mss_demux_reset (GST_ADAPTIVE_DEMUX_CAST (object));
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
@@ -336,20 +233,9 @@
   GstMssDemux *mssdemux = GST_MSS_DEMUX (object);
 
   switch (prop_id) {
-    case PROP_CONNECTION_SPEED:
-      GST_OBJECT_LOCK (mssdemux);
-      mssdemux->connection_speed = g_value_get_uint (value) * 1000;
-      mssdemux->update_bitrates = TRUE;
-      GST_DEBUG_OBJECT (mssdemux, "Connection speed set to %" G_GUINT64_FORMAT,
-          mssdemux->connection_speed);
-      GST_OBJECT_UNLOCK (mssdemux);
-      break;
     case PROP_MAX_QUEUE_SIZE_BUFFERS:
       mssdemux->data_queue_max_size = g_value_get_uint (value);
       break;
-    case PROP_BITRATE_LIMIT:
-      mssdemux->bitrate_limit = g_value_get_float (value);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -363,395 +249,85 @@
   GstMssDemux *mssdemux = GST_MSS_DEMUX (object);
 
   switch (prop_id) {
-    case PROP_CONNECTION_SPEED:
-      g_value_set_uint (value, mssdemux->connection_speed / 1000);
-      break;
     case PROP_MAX_QUEUE_SIZE_BUFFERS:
       g_value_set_uint (value, mssdemux->data_queue_max_size);
       break;
-    case PROP_BITRATE_LIMIT:
-      g_value_set_float (value, mssdemux->bitrate_limit);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
   }
 }
 
-static GstStateChangeReturn
-gst_mss_demux_change_state (GstElement * element, GstStateChange transition)
+static gboolean
+gst_mss_demux_is_live (GstAdaptiveDemux * demux)
 {
-  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (element);
-  GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
 
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      gst_mss_demux_reset (mssdemux);
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      break;
-    default:
-      break;
-  }
+  g_return_val_if_fail (mssdemux->manifest != NULL, FALSE);
 
-  result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  return result;
+  return gst_mss_manifest_is_live (mssdemux->manifest);
 }
 
-static void
-gst_mss_demux_handle_message (GstBin * bin, GstMessage * msg)
+static GstClockTime
+gst_mss_demux_get_duration (GstAdaptiveDemux * demux)
 {
-  GstMssDemux *demux = GST_MSS_DEMUX_CAST (bin);
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
 
-  switch (GST_MESSAGE_TYPE (msg)) {
-    case GST_MESSAGE_ERROR:{
-      GSList *iter;
-      GstMssDemuxStream *stream;
-      GError *err = NULL;
-      gchar *debug = NULL;
+  g_return_val_if_fail (mssdemux->manifest != NULL, FALSE);
 
-      for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
-        stream = iter->data;
-        if (GST_OBJECT_CAST (stream->src) == GST_MESSAGE_SRC (msg)) {
-          gst_message_parse_error (msg, &err, &debug);
-
-          GST_WARNING_OBJECT (stream->pad, "Source posted error: %d:%d %s (%s)",
-              err->domain, err->code, err->message, debug);
-
-          /* error, but ask to retry */
-          stream->last_ret = GST_FLOW_CUSTOM_ERROR;
-          g_cond_signal (&stream->fragment_download_cond);
-
-          g_error_free (err);
-          g_free (debug);
-          break;
-        }
-      }
-
-      gst_message_unref (msg);
-      msg = NULL;
-    }
-      break;
-    default:
-      break;
-  }
-
-  if (msg)
-    GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
+  return gst_mss_manifest_get_gst_duration (mssdemux->manifest);
 }
 
-
 static GstFlowReturn
-gst_mss_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+gst_mss_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream)
 {
-  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (parent);
-  if (mssdemux->manifest_buffer == NULL)
-    mssdemux->manifest_buffer = buffer;
-  else
-    mssdemux->manifest_buffer =
-        gst_buffer_append (mssdemux->manifest_buffer, buffer);
+  GstMssDemuxStream *mssstream = (GstMssDemuxStream *) stream;
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (stream->demux);
+  GstFlowReturn ret;
+  gchar *path = NULL;
 
-  GST_INFO_OBJECT (mssdemux, "Received manifest buffer, total size is %i bytes",
-      (gint) gst_buffer_get_size (mssdemux->manifest_buffer));
+  gst_adaptive_demux_stream_fragment_clear (&stream->fragment);
+  ret = gst_mss_stream_get_fragment_url (mssstream->manifest_stream, &path);
 
+  if (ret == GST_FLOW_OK) {
+    stream->fragment.uri = g_strdup_printf ("%s/%s", mssdemux->base_url, path);
+    stream->fragment.timestamp =
+        gst_mss_stream_get_fragment_gst_timestamp (mssstream->manifest_stream);
+    stream->fragment.duration =
+        gst_mss_stream_get_fragment_gst_duration (mssstream->manifest_stream);
+  }
+  g_free (path);
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_mss_demux_stream_seek (GstAdaptiveDemuxStream * stream, GstClockTime ts)
+{
+  GstMssDemuxStream *mssstream = (GstMssDemuxStream *) stream;
+
+  gst_mss_stream_seek (mssstream->manifest_stream, ts);
   return GST_FLOW_OK;
 }
 
-static void
-gst_mss_demux_start (GstMssDemux * mssdemux)
+static GstFlowReturn
+gst_mss_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream)
 {
-  GSList *iter;
+  GstMssDemuxStream *mssstream = (GstMssDemuxStream *) stream;
 
-  GST_INFO_OBJECT (mssdemux, "Starting streams' tasks");
-  for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-    GstMssDemuxStream *stream = iter->data;
-    gst_task_start (stream->download_task);
-  }
+  if (stream->demux->segment.rate >= 0)
+    return gst_mss_stream_advance_fragment (mssstream->manifest_stream);
+  else
+    return gst_mss_stream_regress_fragment (mssstream->manifest_stream);
 }
 
-static gboolean
-gst_mss_demux_push_src_event (GstMssDemux * mssdemux, GstEvent * event)
+static GstCaps *
+create_mss_caps (GstMssDemuxStream * stream, GstCaps * caps)
 {
-  GSList *iter;
-  gboolean ret = TRUE;
-
-  for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-    GstMssDemuxStream *stream = iter->data;
-    gst_event_ref (event);
-    ret = ret & gst_pad_push_event (stream->pad, event);
-  }
-  gst_event_unref (event);
-  return ret;
-}
-
-static gboolean
-gst_mss_demux_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (parent);
-  gboolean forward = TRUE;
-  gboolean ret = TRUE;
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_FLUSH_STOP:
-      gst_mss_demux_reset (mssdemux);
-      break;
-    case GST_EVENT_EOS:
-      if (mssdemux->manifest_buffer == NULL) {
-        GST_WARNING_OBJECT (mssdemux, "Received EOS without a manifest.");
-        break;
-      }
-      GST_INFO_OBJECT (mssdemux, "Received EOS");
-
-      if (gst_mss_demux_process_manifest (mssdemux))
-        gst_mss_demux_start (mssdemux);
-      forward = FALSE;
-      break;
-    default:
-      break;
-  }
-
-  if (forward) {
-    ret = gst_pad_event_default (pad, parent, event);
-  } else {
-    gst_event_unref (event);
-  }
-
-  return ret;
-}
-
-static void
-gst_mss_demux_stop_tasks (GstMssDemux * mssdemux, gboolean immediate)
-{
-  GSList *iter;
-
-  GST_OBJECT_LOCK (mssdemux);
-  for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-    GstMssDemuxStream *stream = iter->data;
-
-    gst_task_stop (stream->download_task);
-    stream->cancelled = TRUE;
-    if (immediate)
-      g_cond_signal (&stream->fragment_download_cond);
-  }
-  GST_OBJECT_UNLOCK (mssdemux);
-
-  for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-    GstMssDemuxStream *stream = iter->data;
-
-    gst_task_join (stream->download_task);
-    stream->download_error_count = 0;
-  }
-}
-
-static void
-gst_mss_demux_restart_tasks (GstMssDemux * mssdemux)
-{
-  GSList *iter;
-  for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-    GstMssDemuxStream *stream = iter->data;
-    stream->cancelled = FALSE;
-    gst_task_start (stream->download_task);
-  }
-}
-
-static gboolean
-gst_mss_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  GstMssDemux *mssdemux;
-
-  mssdemux = GST_MSS_DEMUX_CAST (parent);
-
-  switch (event->type) {
-    case GST_EVENT_SEEK:
-    {
-      gdouble rate;
-      GstFormat format;
-      GstSeekFlags flags;
-      GstSeekType start_type, stop_type;
-      gint64 start, stop;
-      GstEvent *newsegment;
-      GSList *iter;
-      gboolean update;
-
-      GST_INFO_OBJECT (mssdemux, "Received GST_EVENT_SEEK");
-
-      gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
-          &stop_type, &stop);
-
-      if (format != GST_FORMAT_TIME)
-        goto not_supported;
-
-      GST_DEBUG_OBJECT (mssdemux,
-          "seek event, rate: %f start: %" GST_TIME_FORMAT " stop: %"
-          GST_TIME_FORMAT, rate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
-
-      if (flags & GST_SEEK_FLAG_FLUSH) {
-        GstEvent *flush = gst_event_new_flush_start ();
-        GST_DEBUG_OBJECT (mssdemux, "sending flush start");
-
-        gst_event_set_seqnum (flush, gst_event_get_seqnum (event));
-        gst_mss_demux_push_src_event (mssdemux, flush);
-      }
-
-      gst_mss_demux_stop_tasks (mssdemux, TRUE);
-
-      if (!gst_mss_manifest_seek (mssdemux->manifest, start)) {;
-        GST_WARNING_OBJECT (mssdemux, "Could not find seeked fragment");
-        goto not_supported;
-      }
-
-      for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-        GstMssDemuxStream *stream = iter->data;
-
-        stream->eos = FALSE;
-        if (flags & GST_SEEK_FLAG_FLUSH) {
-          stream->last_ret = GST_FLOW_OK;
-        }
-
-        gst_segment_do_seek (&stream->segment, rate, format, flags,
-            start_type, start, stop_type, stop, &update);
-
-        newsegment = gst_event_new_segment (&stream->segment);
-        gst_event_set_seqnum (newsegment, gst_event_get_seqnum (event));
-        if (stream->pending_segment)
-          gst_event_unref (stream->pending_segment);
-        stream->pending_segment = newsegment;
-      }
-
-      if (flags & GST_SEEK_FLAG_FLUSH) {
-        GstEvent *flush = gst_event_new_flush_stop (TRUE);
-        GST_DEBUG_OBJECT (mssdemux, "sending flush stop");
-
-        gst_event_set_seqnum (flush, gst_event_get_seqnum (event));
-        gst_mss_demux_push_src_event (mssdemux, flush);
-      }
-
-      gst_mss_demux_restart_tasks (mssdemux);
-
-      gst_event_unref (event);
-      return TRUE;
-    }
-    case GST_EVENT_RECONFIGURE:{
-      GSList *iter;
-
-      for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-        GstMssDemuxStream *stream = iter->data;
-
-        if (stream->pad == pad) {
-          GST_OBJECT_LOCK (mssdemux);
-
-          if (stream->last_ret == GST_FLOW_NOT_LINKED) {
-            GST_DEBUG_OBJECT (stream->pad, "Received reconfigure");
-            stream->restart_download = TRUE;
-            gst_task_start (stream->download_task);
-          }
-          GST_OBJECT_UNLOCK (mssdemux);
-          gst_event_unref (event);
-          return TRUE;
-        }
-      }
-    }
-      break;
-    case GST_EVENT_LATENCY:{
-      /* Upstream and our internal source are irrelevant
-       * for latency, and we should not fail here to
-       * configure the latency */
-      gst_event_unref (event);
-      return TRUE;
-    }
-    default:
-      break;
-  }
-
-  return gst_pad_event_default (pad, parent, event);
-
-not_supported:
-  gst_event_unref (event);
-  return FALSE;
-}
-
-static gboolean
-gst_mss_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
-{
-  GstMssDemux *mssdemux;
-  gboolean ret = FALSE;
-
-  if (query == NULL)
-    return FALSE;
-
-  mssdemux = GST_MSS_DEMUX (parent);
-
-  switch (query->type) {
-    case GST_QUERY_DURATION:{
-      GstClockTime duration = -1;
-      GstFormat fmt;
-
-      gst_query_parse_duration (query, &fmt, NULL);
-      if (fmt == GST_FORMAT_TIME && mssdemux->manifest) {
-        /* TODO should we use the streams accumulated duration or the main manifest duration? */
-        duration = gst_mss_manifest_get_gst_duration (mssdemux->manifest);
-
-        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) {
-          gst_query_set_duration (query, GST_FORMAT_TIME, duration);
-          ret = TRUE;
-        }
-      }
-      GST_INFO_OBJECT (mssdemux, "GST_QUERY_DURATION returns %s with duration %"
-          GST_TIME_FORMAT, ret ? "TRUE" : "FALSE", GST_TIME_ARGS (duration));
-      break;
-    }
-    case GST_QUERY_LATENCY:{
-      gboolean live = FALSE;
-
-      live = mssdemux->manifest
-          && gst_mss_manifest_is_live (mssdemux->manifest);
-
-      gst_query_set_latency (query, live, 0, -1);
-      ret = TRUE;
-      break;
-    }
-    case GST_QUERY_SEEKING:{
-      GstFormat fmt;
-      gint64 stop = -1;
-
-      if (!mssdemux->manifest) {
-        return FALSE;           /* no seeking without manifest */
-      } else if (gst_mss_manifest_is_live (mssdemux->manifest)) {
-        return FALSE;           /* no live seeking */
-      }
-
-      gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
-      GST_INFO_OBJECT (mssdemux, "Received GST_QUERY_SEEKING with format %d",
-          fmt);
-      if (fmt == GST_FORMAT_TIME) {
-        GstClockTime duration;
-        duration = gst_mss_manifest_get_gst_duration (mssdemux->manifest);
-        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0)
-          stop = duration;
-        gst_query_set_seeking (query, fmt, TRUE, 0, stop);
-        ret = TRUE;
-        GST_INFO_OBJECT (mssdemux, "GST_QUERY_SEEKING returning with stop : %"
-            GST_TIME_FORMAT, GST_TIME_ARGS (stop));
-      }
-      break;
-    }
-    default:
-      /* Don't fordward queries upstream because of the special nature of this
-       *  "demuxer", which relies on the upstream element only to be fed
-       *  the Manifest
-       */
-      break;
-  }
-
-  return ret;
-}
-
-static void
-_set_src_pad_functions (GstPad * pad)
-{
-  gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_mss_demux_src_query));
-  gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_mss_demux_src_event));
+  return gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING,
+      "mss-fragmented", "timescale", G_TYPE_UINT64,
+      gst_mss_stream_get_timescale (stream->manifest_stream), "media-caps",
+      GST_TYPE_CAPS, caps, NULL);
 }
 
 static GstPad *
@@ -786,13 +362,13 @@
     return NULL;
   }
 
-  _set_src_pad_functions (srcpad);
   return srcpad;
 }
 
-static void
-gst_mss_demux_create_streams (GstMssDemux * mssdemux)
+static gboolean
+gst_mss_demux_setup_streams (GstAdaptiveDemux * demux)
 {
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
   GSList *streams = gst_mss_manifest_get_streams (mssdemux->manifest);
   GSList *iter;
 
@@ -801,13 +377,19 @@
     GST_ELEMENT_ERROR (mssdemux, STREAM, DEMUX,
         (_("This file contains no playable streams.")),
         ("no streams found at the Manifest"));
-    return;
+    return FALSE;
   }
 
+  GST_INFO_OBJECT (mssdemux, "Changing max bitrate to %u",
+      demux->connection_speed);
+  gst_mss_manifest_change_bitrate (mssdemux->manifest, demux->connection_speed);
+
   for (iter = streams; iter; iter = g_slist_next (iter)) {
     GstPad *srcpad = NULL;
     GstMssDemuxStream *stream = NULL;
     GstMssStream *manifeststream = iter->data;
+    GstCaps *caps;
+    const gchar *lang;
 
     srcpad = _create_pad (mssdemux, manifeststream);
 
@@ -815,220 +397,45 @@
       continue;
     }
 
-    stream = gst_mss_demux_stream_new (mssdemux, manifeststream, srcpad);
-    gst_pad_set_element_private (srcpad, stream);
+    stream = (GstMssDemuxStream *)
+        gst_adaptive_demux_stream_new (GST_ADAPTIVE_DEMUX_CAST (mssdemux),
+        srcpad);
+    stream->manifest_stream = manifeststream;
     gst_mss_stream_set_active (manifeststream, TRUE);
-    mssdemux->streams = g_slist_append (mssdemux->streams, stream);
-  }
-
-  /* select initial bitrates */
-  GST_OBJECT_LOCK (mssdemux);
-  GST_INFO_OBJECT (mssdemux, "Changing max bitrate to %" G_GUINT64_FORMAT,
-      mssdemux->connection_speed);
-  gst_mss_manifest_change_bitrate (mssdemux->manifest,
-      mssdemux->connection_speed);
-  mssdemux->update_bitrates = FALSE;
-  GST_OBJECT_UNLOCK (mssdemux);
-}
-
-static GstCaps *
-create_mss_caps (GstMssDemuxStream * stream, GstCaps * caps)
-{
-  return gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING,
-      "mss-fragmented", "timescale", G_TYPE_UINT64,
-      gst_mss_stream_get_timescale (stream->manifest_stream), "media-caps",
-      GST_TYPE_CAPS, caps, NULL);
-}
-
-static gboolean
-gst_mss_demux_expose_stream (GstMssDemux * mssdemux, GstMssDemuxStream * stream)
-{
-  GstCaps *caps;
-  GstCaps *media_caps;
-  GstPad *pad = stream->pad;
-
-  media_caps = gst_mss_stream_get_caps (stream->manifest_stream);
-
-  if (media_caps) {
-    gchar *name = gst_pad_get_name (pad);
-    const gchar *lang;
-    GstEvent *event;
-    gchar *stream_id;
-    gst_pad_set_active (pad, TRUE);
-
-    caps = create_mss_caps (stream, media_caps);
-    gst_caps_unref (media_caps);
-
-    stream_id =
-        gst_pad_create_stream_id (pad, GST_ELEMENT_CAST (mssdemux), name);
-
-    event =
-        gst_pad_get_sticky_event (mssdemux->sinkpad, GST_EVENT_STREAM_START, 0);
-    if (event) {
-      if (gst_event_parse_group_id (event, &mssdemux->group_id))
-        mssdemux->have_group_id = TRUE;
-      else
-        mssdemux->have_group_id = FALSE;
-      gst_event_unref (event);
-    } else if (!mssdemux->have_group_id) {
-      mssdemux->have_group_id = TRUE;
-      mssdemux->group_id = gst_util_group_id_next ();
-    }
-    event = gst_event_new_stream_start (stream_id);
-    if (mssdemux->have_group_id)
-      gst_event_set_group_id (event, mssdemux->group_id);
-
-    gst_pad_push_event (pad, event);
-    g_free (stream_id);
-    g_free (name);
-
-    gst_pad_set_caps (pad, caps);
-    if (stream->caps)
-      gst_caps_unref (stream->caps);
-    stream->caps = caps;
+    caps = gst_mss_stream_get_caps (stream->manifest_stream);
+    gst_adaptive_demux_stream_set_caps (GST_ADAPTIVE_DEMUX_STREAM_CAST (stream),
+        create_mss_caps (stream, caps));
+    gst_caps_unref (caps);
 
     lang = gst_mss_stream_get_lang (stream->manifest_stream);
     if (lang != NULL) {
       GstTagList *tags;
 
       tags = gst_tag_list_new (GST_TAG_LANGUAGE_CODE, lang, NULL);
-      gst_pad_push_event (stream->pad, gst_event_new_tag (tags));
-    }
-
-    gst_pad_push_event (stream->pad, gst_event_new_segment (&stream->segment));
-
-    GST_INFO_OBJECT (mssdemux, "Adding srcpad %s:%s with caps %" GST_PTR_FORMAT,
-        GST_DEBUG_PAD_NAME (pad), caps);
-    gst_object_ref (pad);
-
-    gst_element_add_pad (GST_ELEMENT_CAST (mssdemux), pad);
-  } else {
-    GST_WARNING_OBJECT (mssdemux,
-        "Couldn't get caps from manifest stream %p %s, not exposing it", stream,
-        GST_PAD_NAME (stream->pad));
-    return FALSE;
-  }
-  return TRUE;
-}
-
-static gboolean
-gst_mss_demux_process_manifest (GstMssDemux * mssdemux)
-{
-  GstQuery *query;
-  gboolean ret;
-  GSList *iter;
-
-  g_return_val_if_fail (mssdemux->manifest_buffer != NULL, FALSE);
-  g_return_val_if_fail (mssdemux->manifest == NULL, FALSE);
-
-  query = gst_query_new_uri ();
-  ret = gst_pad_peer_query (mssdemux->sinkpad, query);
-  if (ret) {
-    gchar *uri, *redirect_uri;
-    gboolean permanent;
-    gchar *baseurl_end;
-
-    gst_query_parse_uri (query, &uri);
-    gst_query_parse_uri_redirection (query, &redirect_uri);
-    gst_query_parse_uri_redirection_permanent (query, &permanent);
-
-    GST_INFO_OBJECT (mssdemux, "Upstream is using URI: %s (redirect: %s)", uri,
-        GST_STR_NULL (redirect_uri));
-
-    mssdemux->manifest_uri = g_strdup ((permanent
-            && redirect_uri) ? redirect_uri : uri);
-    mssdemux->base_url = g_strdup (redirect_uri ? redirect_uri : uri);
-    baseurl_end = g_strrstr (mssdemux->base_url, "/Manifest");
-    if (baseurl_end == NULL) {
-      /* second try */
-      baseurl_end = g_strrstr (mssdemux->base_url, "/manifest");
-    }
-
-    if (baseurl_end) {
-      /* set the new end of the string */
-      baseurl_end[0] = '\0';
-    } else {
-      GST_WARNING_OBJECT (mssdemux, "Stream's URI didn't end with /manifest");
-    }
-
-    g_free (uri);
-    g_free (redirect_uri);
-  }
-  gst_query_unref (query);
-
-  if (mssdemux->base_url == NULL) {
-    GST_ELEMENT_ERROR (mssdemux, RESOURCE, NOT_FOUND,
-        (_("Couldn't get the Manifest's URI")),
-        ("need to get the manifest's URI from upstream elements"));
-    return FALSE;
-  }
-
-  GST_INFO_OBJECT (mssdemux, "Received manifest: %i bytes",
-      (gint) gst_buffer_get_size (mssdemux->manifest_buffer));
-
-  mssdemux->manifest = gst_mss_manifest_new (mssdemux->manifest_buffer);
-  if (!mssdemux->manifest) {
-    GST_ELEMENT_ERROR (mssdemux, STREAM, FORMAT, ("Bad manifest file"),
-        ("Xml manifest file couldn't be parsed"));
-    return FALSE;
-  }
-
-  GST_INFO_OBJECT (mssdemux, "Live stream: %d",
-      gst_mss_manifest_is_live (mssdemux->manifest));
-
-  gst_mss_demux_create_streams (mssdemux);
-  for (iter = mssdemux->streams; iter;) {
-    GSList *current = iter;
-    GstMssDemuxStream *stream = iter->data;
-    iter = g_slist_next (iter); /* do it ourselves as we want it done in the beginning of the loop */
-    if (!gst_mss_demux_expose_stream (mssdemux, stream)) {
-      gst_mss_demux_stream_free (stream);
-      mssdemux->streams = g_slist_delete_link (mssdemux->streams, current);
+      gst_adaptive_demux_stream_set_tags (GST_ADAPTIVE_DEMUX_STREAM_CAST
+          (stream), tags);
     }
   }
 
-  if (!mssdemux->streams) {
-    /* no streams */
-    GST_WARNING_OBJECT (mssdemux, "Couldn't identify the caps for any of the "
-        "streams found in the manifest");
-    GST_ELEMENT_ERROR (mssdemux, STREAM, DEMUX,
-        (_("This file contains no playable streams.")),
-        ("No known stream formats found at the Manifest"));
-    return FALSE;
-  }
-
-  gst_element_no_more_pads (GST_ELEMENT_CAST (mssdemux));
   return TRUE;
 }
 
 static void
-gst_mss_demux_reload_manifest (GstMssDemux * mssdemux)
+gst_mss_demux_update_base_url (GstMssDemux * mssdemux)
 {
-  GstUriDownloader *downloader;
-  GstFragment *manifest_data;
-  GstBuffer *manifest_buffer;
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (mssdemux);
   gchar *baseurl_end;
 
-  downloader = gst_uri_downloader_new ();
-
-  manifest_data =
-      gst_uri_downloader_fetch_uri (downloader, mssdemux->manifest_uri, NULL,
-      TRUE, TRUE, TRUE, NULL);
-
-  g_free (mssdemux->manifest_uri);
   g_free (mssdemux->base_url);
-  mssdemux->manifest_uri = g_strdup ((manifest_data->redirect_permanent
-          && manifest_data->
-          redirect_uri) ? manifest_data->redirect_uri : manifest_data->uri);
+
   mssdemux->base_url =
-      g_strdup (manifest_data->
-      redirect_uri ? manifest_data->redirect_uri : manifest_data->uri);
+      g_strdup (demux->manifest_base_uri ? demux->manifest_base_uri : demux->
+      manifest_uri);
   baseurl_end = g_strrstr (mssdemux->base_url, "/Manifest");
   if (baseurl_end == NULL) {
     /* second try */
     baseurl_end = g_strrstr (mssdemux->base_url, "/manifest");
   }
-
   if (baseurl_end) {
     /* set the new end of the string */
     baseurl_end[0] = '\0';
@@ -1036,581 +443,115 @@
     GST_WARNING_OBJECT (mssdemux, "Stream's URI didn't end with /manifest");
   }
 
-  manifest_buffer = gst_fragment_get_buffer (manifest_data);
-  g_object_unref (manifest_data);
-
-  gst_mss_manifest_reload_fragments (mssdemux->manifest, manifest_buffer);
-  gst_buffer_replace (&mssdemux->manifest_buffer, manifest_buffer);
-  gst_buffer_unref (manifest_buffer);
-
-  g_object_unref (downloader);
 }
 
-static GstEvent *
-gst_mss_demux_reconfigure_stream (GstMssDemuxStream * stream)
+static gboolean
+gst_mss_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
 {
-  GstEvent *capsevent = NULL;
-  GstMssDemux *mssdemux = stream->parent;
-  guint64 bitrate = 0;
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
 
-  if (stream->download_total_time)
-    bitrate =
-        (stream->download_total_bytes * 8) /
-        ((double) stream->download_total_time / G_GUINT64_CONSTANT (1000000));
+  gst_mss_demux_update_base_url (mssdemux);
 
-  if (stream->current_download_rate != -1)
-    bitrate = (stream->current_download_rate + bitrate * 3) / 4;
-  if (bitrate > G_MAXINT)
-    bitrate = G_MAXINT;
-  stream->current_download_rate = bitrate;
-  bitrate *= mssdemux->bitrate_limit;
-
-  if (mssdemux->connection_speed) {
-    bitrate = MIN (mssdemux->connection_speed, bitrate);
+  mssdemux->manifest = gst_mss_manifest_new (buf);
+  if (!mssdemux->manifest) {
+    GST_ELEMENT_ERROR (mssdemux, STREAM, FORMAT, ("Bad manifest file"),
+        ("Xml manifest file couldn't be parsed"));
+    return FALSE;
   }
+  return gst_mss_demux_setup_streams (demux);
+}
+
+static gboolean
+gst_mss_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream,
+    guint64 bitrate)
+{
+  GstMssDemuxStream *mssstream = (GstMssDemuxStream *) stream;
+  gboolean ret = FALSE;
 
   GST_DEBUG_OBJECT (stream->pad,
-      "Current stream download bitrate %" G_GUINT64_FORMAT, bitrate);
+      "Using stream download bitrate %" G_GUINT64_FORMAT, bitrate);
 
-  if (gst_mss_stream_select_bitrate (stream->manifest_stream, bitrate)) {
+  if (gst_mss_stream_select_bitrate (mssstream->manifest_stream, bitrate)) {
     GstCaps *caps;
-    caps = gst_mss_stream_get_caps (stream->manifest_stream);
+    GstCaps *msscaps;
+    caps = gst_mss_stream_get_caps (mssstream->manifest_stream);
 
     GST_DEBUG_OBJECT (stream->pad,
         "Starting streams reconfiguration due to bitrate changes");
-    if (stream->caps)
-      gst_caps_unref (stream->caps);
-    stream->caps = create_mss_caps (stream, caps);
+    msscaps = create_mss_caps (mssstream, caps);
 
     GST_DEBUG_OBJECT (stream->pad,
         "Stream changed bitrate to %" G_GUINT64_FORMAT " caps: %"
         GST_PTR_FORMAT,
-        gst_mss_stream_get_current_bitrate (stream->manifest_stream), caps);
+        gst_mss_stream_get_current_bitrate (mssstream->manifest_stream), caps);
 
     gst_caps_unref (caps);
 
-    capsevent = gst_event_new_caps (stream->caps);
+    gst_adaptive_demux_stream_set_caps (stream, msscaps);
+    ret = TRUE;
     GST_DEBUG_OBJECT (stream->pad, "Finished streams reconfiguration");
   }
-  return capsevent;
-}
-
-static GstFlowReturn
-_src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
-{
-  GstPad *srcpad = (GstPad *) parent;
-  GstMssDemux *demux = (GstMssDemux *) GST_PAD_PARENT (srcpad);
-  GstMssDemuxStream *stream = gst_pad_get_element_private (srcpad);
-  GstFlowReturn ret;
-  gboolean discont = FALSE;
-
-  if (stream->starting_fragment) {
-#if 0
-    if (demux->segment.rate < 0)
-      /* Set DISCONT flag for every first buffer in reverse playback mode
-       * as each fragment for its own has to be reversed */
-      discont = TRUE;
-#endif
-    stream->starting_fragment = FALSE;
-
-    GST_BUFFER_PTS (buffer) =
-        gst_mss_stream_get_fragment_gst_timestamp (stream->manifest_stream);
-
-    GST_LOG_OBJECT (stream->pad, "set fragment pts=%" GST_TIME_FORMAT,
-        GST_TIME_ARGS (GST_BUFFER_PTS (buffer)));
-
-    if (stream->pending_segment) {
-      /* And send a newsegment */
-      gst_pad_push_event (stream->pad, stream->pending_segment);
-      stream->pending_segment = NULL;
-    }
-    stream->segment.position = GST_BUFFER_PTS (buffer);
-
-  } else {
-    GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
-  }
-
-  if (discont) {
-    GST_DEBUG_OBJECT (stream->pad, "Marking fragment as discontinuous");
-    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
-  } else {
-    GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
-  }
-
-  GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
-  GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
-
-  /* accumulate time and size to get this chunk */
-  stream->download_total_time +=
-      g_get_monotonic_time () - stream->download_start_time;
-  stream->download_total_bytes += gst_buffer_get_size (buffer);
-
-  stream->have_data = TRUE;
-
-  ret = gst_proxy_pad_chain_default (pad, parent, buffer);
-  stream->download_start_time = g_get_monotonic_time ();
-  GST_LOG_OBJECT (pad, "Chain res: %d %s", ret, gst_flow_get_name (ret));
-
-  if (ret != GST_FLOW_OK) {
-    if (ret < GST_FLOW_EOS) {
-      GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL),
-          ("stream stopped, reason %s", gst_flow_get_name (ret)));
-
-      /* TODO push this on all pads */
-      gst_pad_push_event (stream->pad, gst_event_new_eos ());
-    } else {
-      GST_DEBUG_OBJECT (stream->pad, "stream stopped, reason %s",
-          gst_flow_get_name (ret));
-    }
-
-    /* TODO properly stop tasks */
-    /* gst_hls_demux_pause_tasks (demux); */
-  }
-
-  /* avoid having the source handle the same error again */
-  stream->last_ret = ret;
-  ret = GST_FLOW_OK;
-
   return ret;
 }
 
 static gboolean
-_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_mss_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
 {
-  GstPad *srcpad = GST_PAD_CAST (parent);
-  GstMssDemuxStream *stream = gst_pad_get_element_private (srcpad);
+  gdouble rate;
+  GstFormat format;
+  GstSeekFlags flags;
+  GstSeekType start_type, stop_type;
+  gint64 start, stop;
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
 
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_EOS:
-      g_cond_signal (&stream->fragment_download_cond);
-      break;
-    default:
-      break;
-  }
+  gst_event_parse_seek (seek, &rate, &format, &flags, &start_type, &start,
+      &stop_type, &stop);
 
-  gst_event_unref (event);
+  GST_DEBUG_OBJECT (mssdemux,
+      "seek event, rate: %f start: %" GST_TIME_FORMAT " stop: %"
+      GST_TIME_FORMAT, rate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
+
+  gst_mss_manifest_seek (mssdemux->manifest, start);
 
   return TRUE;
 }
 
 static gboolean
-_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
+gst_mss_demux_stream_has_next_fragment (GstAdaptiveDemuxStream * stream)
 {
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_ALLOCATION:
-      return FALSE;
-      break;
-    default:
-      break;
-  }
+  GstMssDemuxStream *mssstream = (GstMssDemuxStream *) stream;
 
-  return gst_pad_query_default (pad, parent, query);
+  return gst_mss_stream_has_next_fragment (mssstream->manifest_stream);
 }
 
-static gboolean
-gst_mss_demux_stream_update_source (GstMssDemuxStream * stream,
-    const gchar * uri, const gchar * referer, gboolean refresh,
-    gboolean allow_cache)
+static gint64
+gst_mss_demux_get_manifest_update_interval (GstAdaptiveDemux * demux)
 {
-  GstMssDemux *demux = stream->parent;
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
+  GstClockTime interval;
 
-  if (!gst_uri_is_valid (uri)) {
-    GST_WARNING_OBJECT (stream->pad, "Invalid URI: %s", uri);
-    stream->last_ret = GST_FLOW_ERROR;
-    return FALSE;
-  }
+  /* Not much information about this in the MSS spec. It seems that
+   * the fragments contain an UUID box that should tell the next
+   * fragments time and duration so one wouldn't need to fetch
+   * the Manifest again, but we need a fallback here. So use 2 times
+   * the current fragment duration */
 
-  if (stream->src != NULL) {
-    gchar *old_protocol, *new_protocol;
-    gchar *old_uri;
+  interval = gst_mss_manifest_get_min_fragment_duration (mssdemux->manifest);
+  if (!GST_CLOCK_TIME_IS_VALID (interval))
+    interval = 2 * GST_SECOND;  /* default to 2 seconds */
 
-    old_uri = gst_uri_handler_get_uri (GST_URI_HANDLER (stream->src));
-    old_protocol = gst_uri_get_protocol (old_uri);
-    new_protocol = gst_uri_get_protocol (uri);
+  interval = 2 * (interval / GST_USECOND);
 
-    if (!g_str_equal (old_protocol, new_protocol)) {
-      gst_object_unref (stream->src_srcpad);
-      gst_element_set_state (stream->src, GST_STATE_NULL);
-      gst_bin_remove (GST_BIN_CAST (demux), stream->src);
-      stream->src = NULL;
-      stream->src_srcpad = NULL;
-      GST_DEBUG_OBJECT (demux, "Can't re-use old source element");
-    } else {
-      GError *err = NULL;
-
-      GST_DEBUG_OBJECT (demux, "Re-using old source element");
-      if (!gst_uri_handler_set_uri (GST_URI_HANDLER (stream->src), uri, &err)) {
-        GST_DEBUG_OBJECT (demux, "Failed to re-use old source element: %s",
-            err->message);
-        g_clear_error (&err);
-        gst_element_set_state (stream->src, GST_STATE_NULL);
-        gst_bin_remove (GST_BIN_CAST (demux), stream->src);
-        stream->src = NULL;
-      }
-    }
-    g_free (old_uri);
-    g_free (old_protocol);
-    g_free (new_protocol);
-  }
-
-  if (stream->src == NULL) {
-    GObjectClass *gobject_class;
-    GstPad *internal_pad;
-
-    stream->src = gst_element_make_from_uri (GST_URI_SRC, uri, NULL, NULL);
-    if (stream->src == NULL) {
-      GST_ELEMENT_ERROR (demux, CORE, MISSING_PLUGIN,
-          ("Missing plugin to handle URI: '%s'", uri), (NULL));
-      return FALSE;
-    }
-
-    gobject_class = G_OBJECT_GET_CLASS (stream->src);
-
-    if (g_object_class_find_property (gobject_class, "compress"))
-      g_object_set (stream->src, "compress", FALSE, NULL);
-    if (g_object_class_find_property (gobject_class, "keep-alive"))
-      g_object_set (stream->src, "keep-alive", TRUE, NULL);
-    if (g_object_class_find_property (gobject_class, "extra-headers")) {
-      if (referer || refresh || !allow_cache) {
-        GstStructure *extra_headers = gst_structure_new_empty ("headers");
-
-        if (referer)
-          gst_structure_set (extra_headers, "Referer", G_TYPE_STRING, referer,
-              NULL);
-
-        if (!allow_cache)
-          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
-              "no-cache", NULL);
-        else if (refresh)
-          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
-              "max-age=0", NULL);
-
-        g_object_set (stream->src, "extra-headers", extra_headers, NULL);
-
-        gst_structure_free (extra_headers);
-      } else {
-        g_object_set (stream->src, "extra-headers", NULL, NULL);
-      }
-    }
-
-    gst_element_set_locked_state (stream->src, TRUE);
-    gst_bin_add (GST_BIN_CAST (demux), stream->src);
-    stream->src_srcpad = gst_element_get_static_pad (stream->src, "src");
-
-    gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (stream->pad),
-        stream->src_srcpad);
-
-    /* set up our internal pad to drop all events from
-     * the http src we don't care about. On the chain function
-     * we just push the buffer forward, but this way dash can get
-     * the flow return from downstream */
-    internal_pad =
-        GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (stream->pad)));
-    gst_pad_set_chain_function (GST_PAD_CAST (internal_pad), _src_chain);
-    gst_pad_set_event_function (GST_PAD_CAST (internal_pad), _src_event);
-    /* need to set query otherwise deadlocks happen with allocation queries */
-    gst_pad_set_query_function (GST_PAD_CAST (internal_pad), _src_query);
-    gst_object_unref (internal_pad);
-  }
-  return TRUE;
-}
-
-/* must be called with the stream's fragment_download_lock */
-static void
-gst_mss_demux_stream_download_uri (GstMssDemux * demux,
-    GstMssDemuxStream * stream, const gchar * uri, gint64 start, gint64 end)
-{
-  GST_DEBUG_OBJECT (stream->pad, "Downloading uri: %s, range:%" G_GINT64_FORMAT
-      " - %" G_GINT64_FORMAT, uri, start, end);
-
-  if (!gst_mss_demux_stream_update_source (stream, uri, NULL, FALSE, TRUE)) {
-    return;
-  }
-
-  if (gst_element_set_state (stream->src,
-          GST_STATE_READY) != GST_STATE_CHANGE_FAILURE) {
-    if (start != 0 || end != -1) {
-      if (!gst_element_send_event (stream->src, gst_event_new_seek (1.0,
-                  GST_FORMAT_BYTES, (GstSeekFlags) GST_SEEK_FLAG_FLUSH,
-                  GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, end))) {
-
-        /* looks like the source can't handle seeks in READY */
-/*
-        *err = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_NOT_IMPLEMENTED,
-            "Source element can't handle range requests");
-*/
-        stream->last_ret = GST_FLOW_ERROR;
-      }
-    }
-
-    if (G_LIKELY (stream->last_ret == GST_FLOW_OK)) {
-      /* flush the proxypads so that the EOS state is reset */
-      gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_start ());
-      gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_stop (TRUE));
-
-      stream->download_start_time = g_get_monotonic_time ();
-      gst_element_sync_state_with_parent (stream->src);
-
-      /* wait for the fragment to be completely downloaded */
-      GST_DEBUG_OBJECT (stream->pad,
-          "Waiting for fragment download to finish: %s", uri);
-      g_cond_wait (&stream->fragment_download_cond,
-          &stream->fragment_download_lock);
-    }
-  } else {
-    stream->last_ret = GST_FLOW_CUSTOM_ERROR;
-  }
-
-  gst_element_set_state (stream->src, GST_STATE_READY);
+  return interval;
 }
 
 static GstFlowReturn
-gst_mss_demux_stream_download_fragment (GstMssDemuxStream * stream)
+gst_mss_demux_update_manifest (GstAdaptiveDemux * demux, GstBuffer * buffer)
 {
-  GstMssDemux *mssdemux = stream->parent;
-  gchar *path = NULL;
-  gchar *url = NULL;
-  GstFlowReturn ret = GST_FLOW_OK;
+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
 
-  /* special case for not-linked streams */
-  if (stream->last_ret == GST_FLOW_NOT_LINKED) {
-    GST_DEBUG_OBJECT (stream->pad, "Skipping download for not-linked stream %p",
-        stream);
-    return GST_FLOW_NOT_LINKED;
-  }
+  gst_mss_demux_update_base_url (mssdemux);
 
-  g_mutex_lock (&stream->fragment_download_lock);
-  GST_DEBUG_OBJECT (stream->pad, "Getting url for stream");
-  ret = gst_mss_stream_get_fragment_url (stream->manifest_stream, &path);
-  switch (ret) {
-    case GST_FLOW_OK:
-      break;                    /* all is good, let's go */
-    case GST_FLOW_EOS:
-      g_free (path);
-      if (gst_mss_manifest_is_live (mssdemux->manifest)) {
-        gst_mss_demux_reload_manifest (mssdemux);
-        g_mutex_unlock (&stream->fragment_download_lock);
-        return GST_FLOW_OK;
-      }
-      g_mutex_unlock (&stream->fragment_download_lock);
-      return GST_FLOW_EOS;
-    case GST_FLOW_ERROR:
-      g_mutex_unlock (&stream->fragment_download_lock);
-      g_free (path);
-      goto error;
-    default:
-      break;
-  }
-  if (!path) {
-    goto no_url_error;
-  }
-  GST_DEBUG_OBJECT (mssdemux, "Got url path '%s' for stream %p", path, stream);
-
-  url = g_strdup_printf ("%s/%s", mssdemux->base_url, path);
-
-  GST_DEBUG_OBJECT (mssdemux, "Got url '%s' for stream %p", url, stream);
-
-  stream->starting_fragment = TRUE;
-
-  gst_mss_demux_stream_download_uri (mssdemux, stream, url, 0, -1);
-
-  g_free (path);
-  g_free (url);
-  g_mutex_unlock (&stream->fragment_download_lock);
-
-  if (stream->last_ret != GST_FLOW_OK) {
-    GST_INFO_OBJECT (mssdemux, "No fragment downloaded");
-    /* TODO check if we are truly stoping */
-    if (stream->last_ret != GST_FLOW_ERROR
-        && gst_mss_manifest_is_live (mssdemux->manifest)) {
-      /* looks like there is no way of knowing when a live stream has ended
-       * Have to assume we are falling behind and cause a manifest reload */
-      return GST_FLOW_OK;
-    }
-  }
-
-  return stream->last_ret;
-
-no_url_error:
-  {
-    GST_ELEMENT_ERROR (mssdemux, STREAM, DEMUX,
-        (_("Failed to get fragment URL.")),
-        ("An error happened when getting fragment URL"));
-    gst_task_pause (stream->download_task);
-    return GST_FLOW_ERROR;
-  }
-error:
-  {
-    GST_WARNING_OBJECT (mssdemux, "Error while pushing fragment");
-    gst_task_pause (stream->download_task);
-    return GST_FLOW_ERROR;
-  }
-}
-
-static void
-gst_mss_demux_download_loop (GstMssDemuxStream * stream)
-{
-  GstMssDemux *mssdemux = stream->parent;
-  GstFlowReturn ret;
-  GstEvent *gap = NULL;
-  GstEvent *capsevent = NULL;
-
-  GST_LOG_OBJECT (stream->pad, "download loop start");
-
-  GST_OBJECT_LOCK (mssdemux);
-  if (G_UNLIKELY (stream->restart_download)) {
-    GstClockTime cur, ts;
-    gint64 pos;
-
-    GST_DEBUG_OBJECT (stream->pad,
-        "Activating stream due to reconfigure event");
-
-    cur = stream->segment.position;
-
-    if (gst_pad_peer_query_position (stream->pad, GST_FORMAT_TIME, &pos)) {
-      ts = (GstClockTime) pos;
-      GST_DEBUG_OBJECT (mssdemux, "Downstream position: %"
-          GST_TIME_FORMAT, GST_TIME_ARGS (ts));
-    } else {
-      GST_DEBUG_OBJECT (mssdemux, "Downstream position query failed, "
-          "failling back to segment position");
-      ts = stream->segment.position;
-    }
-
-    /* we might have already pushed this data */
-    ts = MAX (ts, cur);
-
-    GST_DEBUG_OBJECT (stream->pad, "Restarting stream at "
-        "position %" GST_TIME_FORMAT, GST_TIME_ARGS (ts));
-
-    if (GST_CLOCK_TIME_IS_VALID (ts)) {
-      gst_mss_stream_seek (stream->manifest_stream, ts);
-
-      if (cur < ts) {
-        gap = gst_event_new_gap (cur, ts - cur);
-      }
-    }
-
-    stream->restart_download = FALSE;
-    stream->last_ret = GST_FLOW_OK;
-  }
-  capsevent = gst_mss_demux_reconfigure_stream (stream);
-  GST_OBJECT_UNLOCK (mssdemux);
-
-  if (G_UNLIKELY (gap != NULL))
-    gst_pad_push_event (stream->pad, gap);
-  if (G_UNLIKELY (capsevent != NULL))
-    gst_pad_push_event (stream->pad, capsevent);
-
-  ret = gst_mss_demux_stream_download_fragment (stream);
-
-  GST_OBJECT_LOCK (mssdemux);
-  if (stream->cancelled) {
-    GST_OBJECT_UNLOCK (mssdemux);
-    stream->last_ret = GST_FLOW_FLUSHING;
-    goto cancelled;
-  }
-
-  switch (ret) {
-    case GST_FLOW_OK:
-      stream->download_error_count = 0;
-      stream->segment.position +=
-          gst_mss_stream_get_fragment_gst_duration (stream->manifest_stream);
-      gst_mss_stream_advance_fragment (stream->manifest_stream);
-      break;                    /* all is good, let's go */
-
-    case GST_FLOW_EOS:
-      GST_DEBUG_OBJECT (stream->pad, "EOS, stopping download loop");
-      /* we push the EOS after releasing the object lock */
-      gst_task_pause (stream->download_task);
-      break;
-
-    case GST_FLOW_NOT_LINKED:
-      gst_task_pause (stream->download_task);
-      if (gst_mss_demux_combine_flows (mssdemux) == GST_FLOW_NOT_LINKED) {
-        GST_ELEMENT_ERROR (mssdemux, STREAM, FAILED,
-            (_("Internal data stream error.")),
-            ("stream stopped, reason %s",
-                gst_flow_get_name (GST_FLOW_NOT_LINKED)));
-      }
-      break;
-
-    case GST_FLOW_FLUSHING:{
-      GSList *iter;
-
-      for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-        GstMssDemuxStream *other;
-
-        other = iter->data;
-        gst_task_pause (other->download_task);
-      }
-    }
-      break;
-
-    default:
-      if (ret <= GST_FLOW_ERROR) {
-        GST_WARNING_OBJECT (mssdemux, "Error while downloading fragment");
-        if (++stream->download_error_count >= MAX_DOWNLOAD_ERROR_COUNT) {
-          goto download_error;
-        }
-      }
-      break;
-  }
-  GST_OBJECT_UNLOCK (mssdemux);
-
-  if (G_UNLIKELY (ret == GST_FLOW_EOS)) {
-    gst_mss_demux_stream_push_event (stream, gst_event_new_eos ());
-  }
-
-end:
-  GST_LOG_OBJECT (stream->pad, "download loop end");
-  return;
-
-cancelled:
-  {
-    GST_DEBUG_OBJECT (stream->pad, "Stream has been cancelled");
-    goto end;
-  }
-download_error:
-  {
-    GST_OBJECT_UNLOCK (mssdemux);
-    GST_ELEMENT_ERROR (mssdemux, RESOURCE, NOT_FOUND,
-        (_("Couldn't download fragments")),
-        ("fragment downloading has failed too much consecutive times"));
-    goto end;
-  }
-}
-
-static GstFlowReturn
-gst_mss_demux_combine_flows (GstMssDemux * mssdemux)
-{
-  gboolean all_notlinked = TRUE;
-  GSList *iter;
-
-  for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
-    GstMssDemuxStream *stream = iter->data;
-
-    if (stream->last_ret != GST_FLOW_NOT_LINKED)
-      all_notlinked = FALSE;
-
-    if (stream->last_ret <= GST_FLOW_NOT_NEGOTIATED
-        || stream->last_ret == GST_FLOW_FLUSHING)
-      return stream->last_ret;
-  }
-  if (all_notlinked)
-    return GST_FLOW_NOT_LINKED;
+  gst_mss_manifest_reload_fragments (mssdemux->manifest, buffer);
   return GST_FLOW_OK;
 }
-
-static gboolean
-gst_mss_demux_stream_push_event (GstMssDemuxStream * stream, GstEvent * event)
-{
-  gboolean ret;
-
-  if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
-    stream->eos = TRUE;
-  }
-  GST_DEBUG_OBJECT (stream->pad, "Pushing event %" GST_PTR_FORMAT, event);
-  ret = gst_pad_push_event (stream->pad, event);
-  return ret;
-}
diff --git a/ext/smoothstreaming/gstmssdemux.h b/ext/smoothstreaming/gstmssdemux.h
index 284c59d..cc5ff7f 100644
--- a/ext/smoothstreaming/gstmssdemux.h
+++ b/ext/smoothstreaming/gstmssdemux.h
@@ -24,6 +24,7 @@
 #define __GST_MSSDEMUX_H__
 
 #include <gst/gst.h>
+#include <gst/adaptivedemux/gstadaptivedemux.h>
 #include <gst/base/gstadapter.h>
 #include <gst/base/gstdataqueue.h>
 #include "gstmssmanifest.h"
@@ -52,75 +53,29 @@
 typedef struct _GstMssDemuxClass GstMssDemuxClass;
 
 struct _GstMssDemuxStream {
-  GstPad *pad;
-
-  GstCaps *caps;
-
-  GstMssDemux *parent;
+  GstAdaptiveDemuxStream parent;
 
   GstMssStream *manifest_stream;
-
-#if 0
-  GstUriDownloader *downloader;
-#endif
-
-  GstEvent *pending_segment;
-
-  GstSegment segment;
-
-  /* Downloading task */
-  GstTask *download_task;
-  GRecMutex download_lock;
-
-  GstFlowReturn last_ret;
-  gboolean eos;
-  gboolean have_data;
-  gboolean cancelled;
-  gboolean restart_download;
-
-  guint download_error_count;
-
-  /* download tooling */
-  GstElement *src;
-  GstPad *src_srcpad;
-  GMutex fragment_download_lock;
-  GCond fragment_download_cond;
-  gboolean starting_fragment;
-  gint64 download_start_time;
-  gint64 download_total_time;
-  gint64 download_total_bytes;
-  gint current_download_rate;
 };
 
 struct _GstMssDemux {
-  GstBin bin;
+  GstAdaptiveDemux bin;
 
   /* pads */
   GstPad *sinkpad;
 
-  gboolean have_group_id;
-  guint group_id;
-
-  GstBuffer *manifest_buffer;
-
   GstMssManifest *manifest;
   gchar *base_url;
-  gchar *manifest_uri;
 
-  GSList *streams;
   guint n_videos;
   guint n_audios;
 
-  gboolean update_bitrates;
-
   /* properties */
-  guint64 connection_speed; /* in bps */
   guint data_queue_max_size;
-  gfloat bitrate_limit;
 };
 
 struct _GstMssDemuxClass {
-  GstBinClass parent_class;
+  GstAdaptiveDemuxClass parent_class;
 };
 
 GType gst_mss_demux_get_type (void);
diff --git a/ext/smoothstreaming/gstmssmanifest.c b/ext/smoothstreaming/gstmssmanifest.c
index 5582b03..7254e4d 100644
--- a/ext/smoothstreaming/gstmssmanifest.c
+++ b/ext/smoothstreaming/gstmssmanifest.c
@@ -44,6 +44,7 @@
 #define MSS_PROP_DURATION             "d"
 #define MSS_PROP_LANGUAGE             "Language"
 #define MSS_PROP_NUMBER               "n"
+#define MSS_PROP_REPETITIONS          "r"
 #define MSS_PROP_STREAM_DURATION      "Duration"
 #define MSS_PROP_TIME                 "t"
 #define MSS_PROP_TIMESCALE            "TimeScale"
@@ -54,6 +55,7 @@
   guint number;
   guint64 time;
   guint64 duration;
+  guint repetitions;
 } GstMssStreamFragment;
 
 typedef struct _GstMssStreamQuality
@@ -77,6 +79,7 @@
   gchar *url;
   gchar *lang;
 
+  guint fragment_repetition_index;
   GList *current_fragment;
   GList *current_quality;
 
@@ -95,6 +98,93 @@
   GSList *streams;
 };
 
+/* For parsing and building a fragments list */
+typedef struct _GstMssFragmentListBuilder
+{
+  GList *fragments;
+
+  GstMssStreamFragment *previous_fragment;
+  guint fragment_number;
+  guint64 fragment_time_accum;
+} GstMssFragmentListBuilder;
+
+static void
+gst_mss_fragment_list_builder_init (GstMssFragmentListBuilder * builder)
+{
+  builder->fragments = NULL;
+  builder->previous_fragment = NULL;
+  builder->fragment_time_accum = 0;
+  builder->fragment_number = 0;
+}
+
+static void
+gst_mss_fragment_list_builder_add (GstMssFragmentListBuilder * builder,
+    xmlNodePtr node)
+{
+  gchar *duration_str;
+  gchar *time_str;
+  gchar *seqnum_str;
+  gchar *repetition_str;
+  GstMssStreamFragment *fragment = g_new (GstMssStreamFragment, 1);
+
+  duration_str = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_DURATION);
+  time_str = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_TIME);
+  seqnum_str = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_NUMBER);
+  repetition_str =
+      (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_REPETITIONS);
+
+  /* use the node's seq number or use the previous + 1 */
+  if (seqnum_str) {
+    fragment->number = g_ascii_strtoull (seqnum_str, NULL, 10);
+    xmlFree (seqnum_str);
+    builder->fragment_number = fragment->number;
+  } else {
+    fragment->number = builder->fragment_number;
+  }
+  builder->fragment_number = fragment->number + 1;
+
+  if (repetition_str) {
+    fragment->repetitions = g_ascii_strtoull (repetition_str, NULL, 10);
+    xmlFree (repetition_str);
+  } else {
+    fragment->repetitions = 1;
+  }
+
+  if (time_str) {
+    fragment->time = g_ascii_strtoull (time_str, NULL, 10);
+
+    xmlFree (time_str);
+    builder->fragment_time_accum = fragment->time;
+  } else {
+    fragment->time = builder->fragment_time_accum;
+  }
+
+  /* if we have a previous fragment, means we need to set its duration */
+  if (builder->previous_fragment)
+    builder->previous_fragment->duration =
+        (fragment->time -
+        builder->previous_fragment->time) /
+        builder->previous_fragment->repetitions;
+
+  if (duration_str) {
+    fragment->duration = g_ascii_strtoull (duration_str, NULL, 10);
+
+    builder->previous_fragment = NULL;
+    builder->fragment_time_accum += fragment->duration * fragment->repetitions;
+    xmlFree (duration_str);
+  } else {
+    /* store to set the duration at the next iteration */
+    builder->previous_fragment = fragment;
+  }
+
+  /* we reverse it later */
+  builder->fragments = g_list_prepend (builder->fragments, fragment);
+  GST_LOG ("Adding fragment number: %u, time: %" G_GUINT64_FORMAT
+      ", duration: %" G_GUINT64_FORMAT ", repetitions: %u",
+      fragment->number, fragment->time, fragment->duration,
+      fragment->repetitions);
+}
+
 static GstBuffer *gst_buffer_from_hex_string (const gchar * s);
 
 static gboolean
@@ -143,9 +233,9 @@
 _gst_mss_stream_init (GstMssStream * stream, xmlNodePtr node)
 {
   xmlNodePtr iter;
-  GstMssStreamFragment *previous_fragment = NULL;
-  guint fragment_number = 0;
-  guint64 fragment_time_accum = 0;
+  GstMssFragmentListBuilder builder;
+
+  gst_mss_fragment_list_builder_init (&builder);
 
   stream->xmlnode = node;
 
@@ -155,51 +245,7 @@
 
   for (iter = node->children; iter; iter = iter->next) {
     if (node_has_type (iter, MSS_NODE_STREAM_FRAGMENT)) {
-      gchar *duration_str;
-      gchar *time_str;
-      gchar *seqnum_str;
-      GstMssStreamFragment *fragment = g_new (GstMssStreamFragment, 1);
-
-      duration_str = (gchar *) xmlGetProp (iter, (xmlChar *) MSS_PROP_DURATION);
-      time_str = (gchar *) xmlGetProp (iter, (xmlChar *) MSS_PROP_TIME);
-      seqnum_str = (gchar *) xmlGetProp (iter, (xmlChar *) MSS_PROP_NUMBER);
-
-      /* use the node's seq number or use the previous + 1 */
-      if (seqnum_str) {
-        fragment->number = g_ascii_strtoull (seqnum_str, NULL, 10);
-        xmlFree (seqnum_str);
-        fragment_number = fragment->number;
-      } else {
-        fragment->number = fragment_number;
-      }
-      fragment_number = fragment->number + 1;
-
-      if (time_str) {
-        fragment->time = g_ascii_strtoull (time_str, NULL, 10);
-
-        xmlFree (time_str);
-        fragment_time_accum = fragment->time;
-      } else {
-        fragment->time = fragment_time_accum;
-      }
-
-      /* if we have a previous fragment, means we need to set its duration */
-      if (previous_fragment)
-        previous_fragment->duration = fragment->time - previous_fragment->time;
-
-      if (duration_str) {
-        fragment->duration = g_ascii_strtoull (duration_str, NULL, 10);
-
-        previous_fragment = NULL;
-        fragment_time_accum += fragment->duration;
-        xmlFree (duration_str);
-      } else {
-        /* store to set the duration at the next iteration */
-        previous_fragment = fragment;
-      }
-
-      /* we reverse it later */
-      stream->fragments = g_list_prepend (stream->fragments, fragment);
+      gst_mss_fragment_list_builder_add (&builder, iter);
     } else if (node_has_type (iter, MSS_NODE_STREAM_QUALITY)) {
       GstMssStreamQuality *quality = gst_mss_stream_quality_new (iter);
       stream->qualities = g_list_prepend (stream->qualities, quality);
@@ -208,7 +254,7 @@
     }
   }
 
-  stream->fragments = g_list_reverse (stream->fragments);
+  stream->fragments = g_list_reverse (builder.fragments);
 
   /* order them from smaller to bigger based on bitrates */
   stream->qualities =
@@ -304,6 +350,8 @@
     ret = MSS_STREAM_TYPE_VIDEO;
   } else if (strcmp (prop, "audio") == 0) {
     ret = MSS_STREAM_TYPE_AUDIO;
+  } else {
+    GST_DEBUG ("Unsupported stream type: %s", prop);
   }
   xmlFree (prop);
   return ret;
@@ -421,7 +469,7 @@
   GstBuffer *buffer;
   gchar *sps_str;
   gchar *pps_str;
-  GstH264NalUnit nalu;
+  GstH264NalUnit nalu = { 0, };
   GstH264SPS sps_struct;
   GstH264ParserResult parseres;
   GstMapInfo spsinfo;
@@ -455,6 +503,8 @@
   nalu.offset = 0;
   nalu.sc_offset = 0;
   nalu.valid = TRUE;
+  nalu.header_bytes = 0;
+  nalu.extension_type = GST_H264_NAL_EXTENSION_NONE;
 
   parseres = gst_h264_parse_sps (&nalu, &sps_struct, TRUE);
   if (parseres == GST_H264_PARSER_OK) {
@@ -674,7 +724,7 @@
     gst_structure_set (structure, "rate", G_TYPE_INT, rate, NULL);
 
   if (q->bitrate)
-    gst_structure_set (structure, "bitrate", G_TYPE_INT, q->bitrate, NULL);
+    gst_structure_set (structure, "bitrate", G_TYPE_INT, (int) q->bitrate, NULL);
 
   if (codec_data)
     gst_structure_set (structure, "codec_data", GST_TYPE_BUFFER, codec_data,
@@ -774,6 +824,29 @@
   return gstdur;
 }
 
+GstClockTime
+gst_mss_manifest_get_min_fragment_duration (GstMssManifest * manifest)
+{
+  GSList *iter;
+  GstClockTime dur = GST_CLOCK_TIME_NONE;
+  GstClockTime iter_dur;
+
+  for (iter = manifest->streams; iter; iter = g_slist_next (iter)) {
+    GstMssStream *stream = iter->data;
+
+    iter_dur = gst_mss_stream_get_fragment_gst_duration (stream);
+    if (iter_dur != GST_CLOCK_TIME_NONE && iter_dur != 0) {
+      if (GST_CLOCK_TIME_IS_VALID (dur)) {
+        dur = MIN (dur, iter_dur);
+      } else {
+        dur = iter_dur;
+      }
+    }
+  }
+
+  return dur;
+}
+
 GstCaps *
 gst_mss_stream_get_caps (GstMssStream * stream)
 {
@@ -794,6 +867,7 @@
 {
   gchar *tmp;
   gchar *start_time_str;
+  guint64 time;
   GstMssStreamFragment *fragment;
   GstMssStreamQuality *quality = stream->current_quality->data;
 
@@ -804,7 +878,9 @@
 
   fragment = stream->current_fragment->data;
 
-  start_time_str = g_strdup_printf ("%" G_GUINT64_FORMAT, fragment->time);
+  time =
+      fragment->time + fragment->duration * stream->fragment_repetition_index;
+  start_time_str = g_strdup_printf ("%" G_GUINT64_FORMAT, time);
 
   tmp = g_regex_replace_literal (stream->regex_bitrate, stream->url,
       strlen (stream->url), 0, quality->bitrate_str, 0, NULL);
@@ -829,12 +905,19 @@
 
   g_return_val_if_fail (stream->active, GST_FLOW_ERROR);
 
-  if (!stream->current_fragment)
-    return GST_CLOCK_TIME_NONE;
+  if (!stream->current_fragment) {
+    GList *last = g_list_last (stream->fragments);
+    if (last == NULL)
+      return GST_CLOCK_TIME_NONE;
+
+    fragment = last->data;
+    return fragment->time + (fragment->duration * fragment->repetitions);
+  }
 
   fragment = stream->current_fragment->data;
 
-  time = fragment->time;
+  time =
+      fragment->time + (fragment->duration * stream->fragment_repetition_index);
   timescale = gst_mss_stream_get_timescale (stream);
   return (GstClockTime) gst_util_uint64_scale_round (time, GST_SECOND,
       timescale);
@@ -860,20 +943,61 @@
       timescale);
 }
 
+gboolean
+gst_mss_stream_has_next_fragment (GstMssStream * stream)
+{
+  g_return_val_if_fail (stream->active, FALSE);
+
+  if (stream->current_fragment == NULL)
+    return FALSE;
+
+  return TRUE;
+}
+
 GstFlowReturn
 gst_mss_stream_advance_fragment (GstMssStream * stream)
 {
+  GstMssStreamFragment *fragment;
   g_return_val_if_fail (stream->active, GST_FLOW_ERROR);
 
   if (stream->current_fragment == NULL)
     return GST_FLOW_EOS;
 
+  fragment = stream->current_fragment->data;
+  stream->fragment_repetition_index++;
+  if (stream->fragment_repetition_index < fragment->repetitions) {
+    return GST_FLOW_OK;
+  }
+
+  stream->fragment_repetition_index = 0;
   stream->current_fragment = g_list_next (stream->current_fragment);
   if (stream->current_fragment == NULL)
     return GST_FLOW_EOS;
   return GST_FLOW_OK;
 }
 
+GstFlowReturn
+gst_mss_stream_regress_fragment (GstMssStream * stream)
+{
+  GstMssStreamFragment *fragment;
+  g_return_val_if_fail (stream->active, GST_FLOW_ERROR);
+
+  if (stream->current_fragment == NULL)
+    return GST_FLOW_EOS;
+
+  fragment = stream->current_fragment->data;
+  if (stream->fragment_repetition_index == 0) {
+    stream->current_fragment = g_list_previous (stream->current_fragment);
+    if (stream->current_fragment == NULL)
+      return GST_FLOW_EOS;
+    fragment = stream->current_fragment->data;
+    stream->fragment_repetition_index = fragment->repetitions - 1;
+  } else {
+    stream->fragment_repetition_index--;
+  }
+  return GST_FLOW_OK;
+}
+
 const gchar *
 gst_mss_stream_type_name (GstMssStreamType streamtype)
 {
@@ -893,17 +1017,14 @@
  *
  * @time: time in nanoseconds
  */
-gboolean
+void
 gst_mss_manifest_seek (GstMssManifest * manifest, guint64 time)
 {
-  gboolean ret = TRUE;
   GSList *iter;
 
   for (iter = manifest->streams; iter; iter = g_slist_next (iter)) {
-    ret = gst_mss_stream_seek (iter->data, time) & ret;
+    gst_mss_stream_seek (iter->data, time);
   }
-
-  return ret;
 }
 
 /**
@@ -911,27 +1032,30 @@
  *
  * @time: time in nanoseconds
  */
-gboolean
+void
 gst_mss_stream_seek (GstMssStream * stream, guint64 time)
 {
   GList *iter;
   guint64 timescale;
+  GstMssStreamFragment *fragment = NULL;
 
   timescale = gst_mss_stream_get_timescale (stream);
   time = gst_util_uint64_scale_round (time, timescale, GST_SECOND);
 
+  GST_DEBUG ("Stream %s seeking to %" G_GUINT64_FORMAT, stream->url, time);
+
   for (iter = stream->fragments; iter; iter = g_list_next (iter)) {
     GList *next = g_list_next (iter);
     if (next) {
-      GstMssStreamFragment *fragment = next->data;
+      fragment = next->data;
 
       if (fragment->time > time) {
         stream->current_fragment = iter;
         break;
       }
     } else {
-      GstMssStreamFragment *fragment = iter->data;
-      if (fragment->time + fragment->duration > time) {
+      fragment = iter->data;
+      if (fragment->time + fragment->repetitions * fragment->duration > time) {
         stream->current_fragment = iter;
       } else {
         stream->current_fragment = NULL;        /* EOS */
@@ -940,7 +1064,16 @@
     }
   }
 
-  return TRUE;
+  /* position inside the repetitions */
+  if (stream->current_fragment) {
+    fragment = stream->current_fragment->data;
+    stream->fragment_repetition_index =
+        (time - fragment->time) / fragment->duration;
+  }
+
+  GST_DEBUG ("Stream %s seeked to fragment time %" G_GUINT64_FORMAT
+      " repetition %u", stream->url, fragment->time,
+      stream->fragment_repetition_index);
 }
 
 guint64
@@ -972,89 +1105,28 @@
 gst_mss_stream_reload_fragments (GstMssStream * stream, xmlNodePtr streamIndex)
 {
   xmlNodePtr iter;
-  GList *new_fragments = NULL;
-  GstMssStreamFragment *previous_fragment = NULL;
-  GstMssStreamFragment *current_fragment =
-      stream->current_fragment ? stream->current_fragment->data : NULL;
-  guint64 current_time = gst_mss_stream_get_fragment_gst_timestamp (stream);
-  guint fragment_number = 0;
-  guint64 fragment_time_accum = 0;
+  guint64 current_gst_time = gst_mss_stream_get_fragment_gst_timestamp (stream);
+  GstMssFragmentListBuilder builder;
 
-  if (!current_fragment && stream->fragments) {
-    current_fragment = g_list_last (stream->fragments)->data;
-  } else if (g_list_previous (stream->current_fragment)) {
-    /* rewind one as this is the next to be pushed */
-    current_fragment = g_list_previous (stream->current_fragment)->data;
-  } else {
-    current_fragment = NULL;
-  }
+  gst_mss_fragment_list_builder_init (&builder);
 
-  if (current_fragment) {
-    current_time = current_fragment->time;
-    fragment_number = current_fragment->number;
-    fragment_time_accum = current_fragment->time;
-  }
+  GST_DEBUG ("Current position: %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (current_gst_time));
 
   for (iter = streamIndex->children; iter; iter = iter->next) {
     if (node_has_type (iter, MSS_NODE_STREAM_FRAGMENT)) {
-      gchar *duration_str;
-      gchar *time_str;
-      gchar *seqnum_str;
-      GstMssStreamFragment *fragment = g_new (GstMssStreamFragment, 1);
-
-      duration_str = (gchar *) xmlGetProp (iter, (xmlChar *) MSS_PROP_DURATION);
-      time_str = (gchar *) xmlGetProp (iter, (xmlChar *) MSS_PROP_TIME);
-      seqnum_str = (gchar *) xmlGetProp (iter, (xmlChar *) MSS_PROP_NUMBER);
-
-      /* use the node's seq number or use the previous + 1 */
-      if (seqnum_str) {
-        fragment->number = g_ascii_strtoull (seqnum_str, NULL, 10);
-        xmlFree (seqnum_str);
-      } else {
-        fragment->number = fragment_number;
-      }
-      fragment_number = fragment->number + 1;
-
-      if (time_str) {
-        fragment->time = g_ascii_strtoull (time_str, NULL, 10);
-        xmlFree (time_str);
-        fragment_time_accum = fragment->time;
-      } else {
-        fragment->time = fragment_time_accum;
-      }
-
-      /* if we have a previous fragment, means we need to set its duration */
-      if (previous_fragment)
-        previous_fragment->duration = fragment->time - previous_fragment->time;
-
-      if (duration_str) {
-        fragment->duration = g_ascii_strtoull (duration_str, NULL, 10);
-
-        previous_fragment = NULL;
-        fragment_time_accum += fragment->duration;
-        xmlFree (duration_str);
-      } else {
-        /* store to set the duration at the next iteration */
-        previous_fragment = fragment;
-      }
-
-      if (fragment->time > current_time) {
-        new_fragments = g_list_append (new_fragments, fragment);
-      } else {
-        previous_fragment = NULL;
-        g_free (fragment);
-      }
-
+      gst_mss_fragment_list_builder_add (&builder, iter);
     } else {
       /* TODO gst log this */
     }
   }
 
   /* store the new fragments list */
-  if (new_fragments) {
+  if (builder.fragments) {
     g_list_free_full (stream->fragments, g_free);
-    stream->fragments = new_fragments;
-    stream->current_fragment = new_fragments;
+    stream->fragments = g_list_reverse (builder.fragments);
+    stream->current_fragment = stream->fragments;
+    gst_mss_stream_seek (stream, current_gst_time);
   }
 }
 
diff --git a/ext/smoothstreaming/gstmssmanifest.h b/ext/smoothstreaming/gstmssmanifest.h
index 8db1e67..364f6d1 100644
--- a/ext/smoothstreaming/gstmssmanifest.h
+++ b/ext/smoothstreaming/gstmssmanifest.h
@@ -44,11 +44,14 @@
 guint64 gst_mss_manifest_get_timescale (GstMssManifest * manifest);
 guint64 gst_mss_manifest_get_duration (GstMssManifest * manifest);
 GstClockTime gst_mss_manifest_get_gst_duration (GstMssManifest * manifest);
-gboolean gst_mss_manifest_seek (GstMssManifest * manifest, guint64 time);
+void gst_mss_manifest_seek (GstMssManifest * manifest, guint64 time);
 gboolean gst_mss_manifest_change_bitrate (GstMssManifest *manifest, guint64 bitrate);
 guint64 gst_mss_manifest_get_current_bitrate (GstMssManifest * manifest);
 gboolean gst_mss_manifest_is_live (GstMssManifest * manifest);
+gint64 gst_mss_manifest_get_dvr_window_length (GstMssManifest * manifest);
+gint gst_mss_manifest_get_look_ahead_fragments_count (GstMssManifest * manifest);
 void gst_mss_manifest_reload_fragments (GstMssManifest * manifest, GstBuffer * data);
+GstClockTime gst_mss_manifest_get_min_fragment_duration (GstMssManifest * manifest);
 
 GstMssStreamType gst_mss_stream_get_type (GstMssStream *stream);
 GstCaps * gst_mss_stream_get_caps (GstMssStream * stream);
@@ -59,8 +62,10 @@
 GstFlowReturn gst_mss_stream_get_fragment_url (GstMssStream * stream, gchar ** url);
 GstClockTime gst_mss_stream_get_fragment_gst_timestamp (GstMssStream * stream);
 GstClockTime gst_mss_stream_get_fragment_gst_duration (GstMssStream * stream);
+gboolean gst_mss_stream_has_next_fragment (GstMssStream * stream);
 GstFlowReturn gst_mss_stream_advance_fragment (GstMssStream * stream);
-gboolean gst_mss_stream_seek (GstMssStream * stream, guint64 time);
+GstFlowReturn gst_mss_stream_regress_fragment (GstMssStream * stream);
+void gst_mss_stream_seek (GstMssStream * stream, guint64 time);
 const gchar * gst_mss_stream_get_lang (GstMssStream * stream);
 
 const gchar * gst_mss_stream_type_name (GstMssStreamType streamtype);
diff --git a/ext/sndfile/Makefile.in b/ext/sndfile/Makefile.in
index 176b9f6..e9fc125 100644
--- a/ext/sndfile/Makefile.in
+++ b/ext/sndfile/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/sndfile/gstsf.c b/ext/sndfile/gstsf.c
index 1370342..ab589bd 100644
--- a/ext/sndfile/gstsf.c
+++ b/ext/sndfile/gstsf.c
@@ -44,30 +44,15 @@
     sf_command (NULL, SFC_GET_FORMAT_MAJOR, &format_info, sizeof (format_info));
 
     switch (format_info.format) {
-      case SF_FORMAT_AIFF:     /* Apple/SGI AIFF format */
-        fmt = "audio/x-aiff";
-        break;
-      case SF_FORMAT_AU:       /* Sun/NeXT AU format */
-        fmt = "audio/x-au";
-        break;
-      case SF_FORMAT_FLAC:     /* FLAC lossless file format */
-        fmt = "audio/x-flac";
-        break;
       case SF_FORMAT_IRCAM:    /* Berkeley/IRCAM/CARL */
         fmt = "audio/x-ircam";
         break;
       case SF_FORMAT_NIST:     /* Sphere NIST format. */
         fmt = "audio/x-nist";
         break;
-      case SF_FORMAT_OGG:      /* Xiph OGG container */
-        fmt = "audio/ogg";
-        break;
       case SF_FORMAT_PAF:      /* Ensoniq PARIS file format. */
         fmt = "audio/x-paris";
         break;
-      case SF_FORMAT_RAW:      /* RAW PCM data. */
-        fmt = "audio/x-raw";
-        break;
       case SF_FORMAT_SDS:      /* Midi Sample Dump Standard */
         fmt = "audio/x-sds";
         break;
@@ -77,10 +62,6 @@
       case SF_FORMAT_VOC:      /* VOC files. */
         fmt = "audio/x-voc";
         break;
-      case SF_FORMAT_WAV:      /* Microsoft WAV format */
-      case SF_FORMAT_WAVEX:    /* MS WAVE with WAVEFORMATEX */
-        fmt = "audio/x-wav";
-        break;
       case SF_FORMAT_W64:      /* Sonic Foundry's 64 bit RIFF/WAV */
         fmt = "audio/x-w64";
         break;
@@ -90,6 +71,18 @@
       case SF_FORMAT_RF64:     /* RF64 WAV file */
         fmt = "audio/x-rf64";
         break;
+        /* does not make sense to expose that */
+      case SF_FORMAT_RAW:      /* RAW PCM data. */
+        /* we have other elements to handle these */
+      case SF_FORMAT_AIFF:     /* Apple/SGI AIFF format */
+      case SF_FORMAT_AU:       /* Sun/NeXT AU format */
+      case SF_FORMAT_FLAC:     /* FLAC lossless file format */
+      case SF_FORMAT_OGG:      /* Xiph OGG container */
+      case SF_FORMAT_WAV:      /* Microsoft WAV format */
+      case SF_FORMAT_WAVEX:    /* MS WAVE with WAVEFORMATEX */
+        fmt = NULL;
+        GST_LOG ("skipping format '%s'", format_info.name);
+        break;
       case SF_FORMAT_MAT4:     /* Matlab (tm) V4.2 / GNU Octave 2.0 */
       case SF_FORMAT_MAT5:     /* Matlab (tm) V5.0 / GNU Octave 2.1 */
       case SF_FORMAT_PVF:      /* Portable Voice Format */
diff --git a/ext/sndio/Makefile.in b/ext/sndio/Makefile.in
index c9e9c84..9450b9c 100644
--- a/ext/sndio/Makefile.in
+++ b/ext/sndio/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/soundtouch/Makefile.in b/ext/soundtouch/Makefile.in
index 4ba662d..3fef298 100644
--- a/ext/soundtouch/Makefile.in
+++ b/ext/soundtouch/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -265,8 +265,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -305,7 +309,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -313,6 +316,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -362,8 +367,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -442,7 +445,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -451,7 +453,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -464,7 +465,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -489,6 +489,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -562,10 +564,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -591,6 +597,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -627,6 +636,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -667,17 +677,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -694,6 +703,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/spandsp/Makefile.in b/ext/spandsp/Makefile.in
index 2906f8c..8db64e5 100644
--- a/ext/spandsp/Makefile.in
+++ b/ext/spandsp/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/spc/Makefile.in b/ext/spc/Makefile.in
index 57a58b8..57a6a4b 100644
--- a/ext/spc/Makefile.in
+++ b/ext/spc/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/srtp/Makefile.in b/ext/srtp/Makefile.in
index 6cae5c3..f189aa7 100644
--- a/ext/srtp/Makefile.in
+++ b/ext/srtp/Makefile.in
@@ -98,6 +98,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -111,7 +112,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -255,8 +255,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -295,7 +299,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -303,6 +306,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -352,8 +357,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -432,7 +435,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -441,7 +443,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -454,7 +455,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -479,6 +479,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -552,10 +554,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -581,6 +587,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -617,6 +626,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -657,17 +667,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -684,6 +693,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/srtp/gstsrtpdec.c b/ext/srtp/gstsrtpdec.c
index 18e25d1..debff15 100644
--- a/ext/srtp/gstsrtpdec.c
+++ b/ext/srtp/gstsrtpdec.c
@@ -52,7 +52,7 @@
  * packets (encryption and authentication) and out RTP and RTCP. It
  * receives packet of type 'application/x-srtp' or 'application/x-srtcp'
  * on its sink pad, and outs packets of type 'application/x-rtp' or
- * 'application/x-rtcp' on its sink pad.
+ * 'application/x-rtcp' on its source pad.
  *
  * For each packet received, it checks if the internal SSRC is in the list
  * of streams already in use. If this is not the case, it sends a signal to
@@ -560,20 +560,18 @@
     gboolean * is_rtcp)
 {
   GstSrtpDecSsrcStream *stream = NULL;
+  GstRTPBuffer rtpbuf = GST_RTP_BUFFER_INIT;
 
-  if (!(*is_rtcp)) {
-    GstRTPBuffer rtpbuf = GST_RTP_BUFFER_INIT;
+  if (gst_rtp_buffer_map (buf, GST_MAP_READ, &rtpbuf)) {
+    if (gst_rtp_buffer_get_payload_type (&rtpbuf) < 64
+        || gst_rtp_buffer_get_payload_type (&rtpbuf) > 80) {
+      *ssrc = gst_rtp_buffer_get_ssrc (&rtpbuf);
 
-    if (gst_rtp_buffer_map (buf, GST_MAP_READ, &rtpbuf)) {
-      if (gst_rtp_buffer_get_payload_type (&rtpbuf) < 64
-          || gst_rtp_buffer_get_payload_type (&rtpbuf) > 80) {
-        *ssrc = gst_rtp_buffer_get_ssrc (&rtpbuf);
-
-        gst_rtp_buffer_unmap (&rtpbuf);
-        goto have_ssrc;
-      }
       gst_rtp_buffer_unmap (&rtpbuf);
+      *is_rtcp = FALSE;
+      goto have_ssrc;
     }
+    gst_rtp_buffer_unmap (&rtpbuf);
   }
 
   if (rtcp_buffer_get_ssrc (buf, ssrc)) {
diff --git a/ext/teletextdec/Makefile.in b/ext/teletextdec/Makefile.in
index a9e57cc..c52c8a2 100644
--- a/ext/teletextdec/Makefile.in
+++ b/ext/teletextdec/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/timidity/Makefile.in b/ext/timidity/Makefile.in
index d816507..2aa84b5 100644
--- a/ext/timidity/Makefile.in
+++ b/ext/timidity/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -263,8 +263,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -303,7 +307,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -311,6 +314,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -360,8 +365,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -440,7 +443,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -449,7 +451,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -462,7 +463,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -487,6 +487,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -560,10 +562,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -589,6 +595,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -625,6 +634,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -665,17 +675,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -692,6 +701,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/voaacenc/Makefile.in b/ext/voaacenc/Makefile.in
index eeef105..ccc7d1e 100644
--- a/ext/voaacenc/Makefile.in
+++ b/ext/voaacenc/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/voamrwbenc/Makefile.in b/ext/voamrwbenc/Makefile.in
index db49b74..266beb1 100644
--- a/ext/voamrwbenc/Makefile.in
+++ b/ext/voamrwbenc/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/voamrwbenc/gstvoamrwbenc.c b/ext/voamrwbenc/gstvoamrwbenc.c
index e68565d..305f845 100644
--- a/ext/voamrwbenc/gstvoamrwbenc.c
+++ b/ext/voamrwbenc/gstvoamrwbenc.c
@@ -57,7 +57,7 @@
 gst_voamrwbenc_bandmode_get_type (void)
 {
   static GType gst_voamrwbenc_bandmode_type = 0;
-  static GEnumValue gst_voamrwbenc_bandmode[] = {
+  static const GEnumValue gst_voamrwbenc_bandmode[] = {
     {MR660, "MR660", "MR660"},
     {MR885, "MR885", "MR885"},
     {MR1265, "MR1265", "MR1265"},
diff --git a/ext/wayland/Makefile.am b/ext/wayland/Makefile.am
index 58c1e99..e12d99a 100644
--- a/ext/wayland/Makefile.am
+++ b/ext/wayland/Makefile.am
@@ -2,7 +2,8 @@
 
 libgstwaylandsink_la_SOURCES =  \
 	gstwaylandsink.c \
-	waylandpool.c \
+	wlshmallocator.c \
+	wlbuffer.c \
 	wldisplay.c \
 	wlwindow.c \
 	wlvideoformat.c \
@@ -20,7 +21,8 @@
 
 noinst_HEADERS = \
 	gstwaylandsink.h \
-	waylandpool.h \
+	wlshmallocator.h \
+	wlbuffer.h \
 	wldisplay.h \
 	wlwindow.h \
 	wlvideoformat.h \
@@ -37,7 +39,9 @@
 
 gstwaylandsink.c: scaler-client-protocol.h
 
-waylandpool.c: scaler-client-protocol.h
+wlshmallocator.c: scaler-client-protocol.h
+
+wlbuffer.c: scaler-client-protocol.h
 
 wldisplay.c: scaler-client-protocol.h
 
diff --git a/ext/wayland/Makefile.in b/ext/wayland/Makefile.in
index 01d996f..0b15a8b 100644
--- a/ext/wayland/Makefile.in
+++ b/ext/wayland/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -159,7 +159,8 @@
 	$(top_builddir)/gst-libs/gst/wayland/libgstwayland-$(GST_API_VERSION).la
 am_libgstwaylandsink_la_OBJECTS =  \
 	libgstwaylandsink_la-gstwaylandsink.lo \
-	libgstwaylandsink_la-waylandpool.lo \
+	libgstwaylandsink_la-wlshmallocator.lo \
+	libgstwaylandsink_la-wlbuffer.lo \
 	libgstwaylandsink_la-wldisplay.lo \
 	libgstwaylandsink_la-wlwindow.lo \
 	libgstwaylandsink_la-wlvideoformat.lo \
@@ -251,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -291,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -299,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -348,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -428,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -437,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -450,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -475,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -548,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -577,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -613,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -653,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -680,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -734,7 +745,8 @@
 plugin_LTLIBRARIES = libgstwaylandsink.la
 libgstwaylandsink_la_SOURCES = \
 	gstwaylandsink.c \
-	waylandpool.c \
+	wlshmallocator.c \
+	wlbuffer.c \
 	wldisplay.c \
 	wlwindow.c \
 	wlvideoformat.c \
@@ -753,7 +765,8 @@
 libgstwaylandsink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
 noinst_HEADERS = \
 	gstwaylandsink.h \
-	waylandpool.h \
+	wlshmallocator.h \
+	wlbuffer.h \
 	wldisplay.h \
 	wlwindow.h \
 	wlvideoformat.h \
@@ -842,8 +855,9 @@
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-gstwaylandsink.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-scaler-protocol.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-waylandpool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-wlbuffer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-wldisplay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-wlshmallocator.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-wlvideoformat.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwaylandsink_la-wlwindow.Plo@am__quote@
 
@@ -878,12 +892,19 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -c -o libgstwaylandsink_la-gstwaylandsink.lo `test -f 'gstwaylandsink.c' || echo '$(srcdir)/'`gstwaylandsink.c
 
-libgstwaylandsink_la-waylandpool.lo: waylandpool.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -MT libgstwaylandsink_la-waylandpool.lo -MD -MP -MF $(DEPDIR)/libgstwaylandsink_la-waylandpool.Tpo -c -o libgstwaylandsink_la-waylandpool.lo `test -f 'waylandpool.c' || echo '$(srcdir)/'`waylandpool.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstwaylandsink_la-waylandpool.Tpo $(DEPDIR)/libgstwaylandsink_la-waylandpool.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='waylandpool.c' object='libgstwaylandsink_la-waylandpool.lo' libtool=yes @AMDEPBACKSLASH@
+libgstwaylandsink_la-wlshmallocator.lo: wlshmallocator.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -MT libgstwaylandsink_la-wlshmallocator.lo -MD -MP -MF $(DEPDIR)/libgstwaylandsink_la-wlshmallocator.Tpo -c -o libgstwaylandsink_la-wlshmallocator.lo `test -f 'wlshmallocator.c' || echo '$(srcdir)/'`wlshmallocator.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstwaylandsink_la-wlshmallocator.Tpo $(DEPDIR)/libgstwaylandsink_la-wlshmallocator.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='wlshmallocator.c' object='libgstwaylandsink_la-wlshmallocator.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -c -o libgstwaylandsink_la-waylandpool.lo `test -f 'waylandpool.c' || echo '$(srcdir)/'`waylandpool.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -c -o libgstwaylandsink_la-wlshmallocator.lo `test -f 'wlshmallocator.c' || echo '$(srcdir)/'`wlshmallocator.c
+
+libgstwaylandsink_la-wlbuffer.lo: wlbuffer.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -MT libgstwaylandsink_la-wlbuffer.lo -MD -MP -MF $(DEPDIR)/libgstwaylandsink_la-wlbuffer.Tpo -c -o libgstwaylandsink_la-wlbuffer.lo `test -f 'wlbuffer.c' || echo '$(srcdir)/'`wlbuffer.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstwaylandsink_la-wlbuffer.Tpo $(DEPDIR)/libgstwaylandsink_la-wlbuffer.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='wlbuffer.c' object='libgstwaylandsink_la-wlbuffer.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -c -o libgstwaylandsink_la-wlbuffer.lo `test -f 'wlbuffer.c' || echo '$(srcdir)/'`wlbuffer.c
 
 libgstwaylandsink_la-wldisplay.lo: wldisplay.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwaylandsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwaylandsink_la_CFLAGS) $(CFLAGS) -MT libgstwaylandsink_la-wldisplay.lo -MD -MP -MF $(DEPDIR)/libgstwaylandsink_la-wldisplay.Tpo -c -o libgstwaylandsink_la-wldisplay.lo `test -f 'wldisplay.c' || echo '$(srcdir)/'`wldisplay.c
@@ -1136,7 +1157,9 @@
 
 gstwaylandsink.c: scaler-client-protocol.h
 
-waylandpool.c: scaler-client-protocol.h
+wlshmallocator.c: scaler-client-protocol.h
+
+wlbuffer.c: scaler-client-protocol.h
 
 wldisplay.c: scaler-client-protocol.h
 
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index d029d83..b4d6f61 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -43,7 +43,8 @@
 
 #include "gstwaylandsink.h"
 #include "wlvideoformat.h"
-#include "waylandpool.h"
+#include "wlbuffer.h"
+#include "wlshmallocator.h"
 
 #include <gst/wayland/wayland.h>
 #include <gst/video/videooverlay.h>
@@ -211,14 +212,8 @@
 
   if (sink->last_buffer)
     gst_buffer_unref (sink->last_buffer);
-  if (sink->display) {
-    /* see comment about this call in gst_wayland_sink_change_state() */
-    if (sink->pool) {
-      gst_wayland_compositor_release_all_buffers (GST_WAYLAND_BUFFER_POOL
-          (sink->pool));
-    }
+  if (sink->display)
     g_object_unref (sink->display);
-  }
   if (sink->window)
     g_object_unref (sink->window);
   if (sink->pool)
@@ -338,11 +333,7 @@
           g_clear_object (&sink->window);
         } else {
           /* remove buffer from surface, show nothing */
-          wl_surface_attach (sink->window->surface, NULL, 0, 0);
-          wl_surface_damage (sink->window->surface, 0, 0,
-              sink->window->surface_width, sink->window->surface_height);
-          wl_surface_commit (sink->window->surface);
-          wl_display_flush (sink->display->display);
+          gst_wl_window_render (sink->window, NULL, NULL);
         }
       }
       break;
@@ -359,27 +350,10 @@
        * restarted (GstVideoOverlay behaves like that in other sinks)
        */
       if (sink->display && !sink->window) {     /* -> the window was toplevel */
-        /* Force all buffers to return to the pool, regardless of
-         * whether the compositor has released them or not. We are
-         * going to kill the display, so we need to return all buffers
-         * to be destroyed before this happens.
-         * Note that this is done here instead of the pool destructor
-         * because the buffers hold a reference to the pool. Also,
-         * the buffers can only be unref'ed from the display's event loop
-         * and the pool holds a reference to the display. If we drop
-         * our references here, when the compositor releases the buffers,
-         * they will be unref'ed from the event loop thread, which will
-         * unref the pool and therefore the display, which will try to
-         * stop the thread from within itself and cause a deadlock.
-         */
-        if (sink->pool) {
-          gst_wayland_compositor_release_all_buffers (GST_WAYLAND_BUFFER_POOL
-              (sink->pool));
-        }
         g_clear_object (&sink->display);
-        g_clear_object (&sink->pool);
       }
       g_mutex_unlock (&sink->display_lock);
+      g_clear_object (&sink->pool);
       break;
     default:
       break;
@@ -432,7 +406,7 @@
     formats = sink->display->formats;
     for (i = 0; i < formats->len; i++) {
       fmt = g_array_index (formats, uint32_t, i);
-      g_value_set_string (&value, gst_wayland_format_to_string (fmt));
+      g_value_set_string (&value, gst_wl_shm_format_to_string (fmt));
       gst_value_list_append_value (&list, &value);
     }
 
@@ -466,7 +440,6 @@
   GArray *formats;
   gint i;
   GstStructure *structure;
-  static GstAllocationParams params = { 0, 0, 0, 15, };
 
   sink = GST_WAYLAND_SINK (bsink);
 
@@ -476,7 +449,7 @@
   if (!gst_video_info_from_caps (&info, caps))
     goto invalid_format;
 
-  format = gst_video_format_to_wayland_format (GST_VIDEO_INFO_FORMAT (&info));
+  format = gst_video_format_to_wl_shm_format (GST_VIDEO_INFO_FORMAT (&info));
   if ((gint) format == -1)
     goto invalid_format;
 
@@ -491,13 +464,14 @@
     goto unsupported_format;
 
   /* create a new pool for the new configuration */
-  newpool = gst_wayland_buffer_pool_new (sink->display);
+  newpool = gst_video_buffer_pool_new ();
   if (!newpool)
     goto pool_failed;
 
   structure = gst_buffer_pool_get_config (newpool);
   gst_buffer_pool_config_set_params (structure, caps, info.size, 2, 0);
-  gst_buffer_pool_config_set_allocator (structure, NULL, &params);
+  gst_buffer_pool_config_set_allocator (structure, gst_wl_shm_allocator_get (),
+      NULL);
   if (!gst_buffer_pool_set_config (newpool, structure))
     goto config_failed;
 
@@ -519,7 +493,7 @@
 unsupported_format:
   {
     GST_DEBUG_OBJECT (sink, "Format %s is not available on the display",
-        gst_wayland_format_to_string (format));
+        gst_wl_shm_format_to_string (format));
     return FALSE;
   }
 pool_failed:
@@ -539,76 +513,20 @@
 gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
 {
   GstWaylandSink *sink = GST_WAYLAND_SINK (bsink);
-  GstBufferPool *pool = NULL;
   GstStructure *config;
-  GstCaps *caps;
-  guint size;
-  gboolean need_pool;
+  guint size, min_bufs, max_bufs;
 
-  gst_query_parse_allocation (query, &caps, &need_pool);
+  config = gst_buffer_pool_get_config (sink->pool);
+  gst_buffer_pool_config_get_params (config, NULL, &size, &min_bufs, &max_bufs);
 
-  if (caps == NULL)
-    goto no_caps;
+  /* we do have a pool for sure (created in set_caps),
+   * so let's propose it anyway, but also propose the allocator on its own */
+  gst_query_add_allocation_pool (query, sink->pool, size, min_bufs, max_bufs);
+  gst_query_add_allocation_param (query, gst_wl_shm_allocator_get (), NULL);
 
-  if (sink->pool)
-    pool = gst_object_ref (sink->pool);
-
-  if (pool != NULL) {
-    GstCaps *pcaps;
-
-    /* we had a pool, check caps */
-    config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
-
-    if (!gst_caps_is_equal (caps, pcaps)) {
-      /* different caps, we can't use this pool */
-      gst_object_unref (pool);
-      pool = NULL;
-    }
-    gst_structure_free (config);
-  }
-
-  if (pool == NULL && need_pool) {
-    GstVideoInfo info;
-
-    if (!gst_video_info_from_caps (&info, caps))
-      goto invalid_caps;
-
-    GST_DEBUG_OBJECT (sink, "create new pool");
-    pool = gst_wayland_buffer_pool_new (sink->display);
-
-    /* the normal size of a frame */
-    size = info.size;
-
-    config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_set_params (config, caps, size, 2, 0);
-    if (!gst_buffer_pool_set_config (pool, config))
-      goto config_failed;
-  }
-  if (pool) {
-    gst_query_add_allocation_pool (query, pool, size, 2, 0);
-    gst_object_unref (pool);
-  }
+  gst_structure_free (config);
 
   return TRUE;
-
-  /* ERRORS */
-no_caps:
-  {
-    GST_DEBUG_OBJECT (bsink, "no caps specified");
-    return FALSE;
-  }
-invalid_caps:
-  {
-    GST_DEBUG_OBJECT (bsink, "invalid caps specified");
-    return FALSE;
-  }
-config_failed:
-  {
-    GST_DEBUG_OBJECT (bsink, "failed setting config");
-    gst_object_unref (pool);
-    return FALSE;
-  }
 }
 
 static GstFlowReturn
@@ -637,29 +555,23 @@
 static void
 render_last_buffer (GstWaylandSink * sink)
 {
-  GstWlMeta *meta;
+  GstWlBuffer *wlbuffer;
+  const GstVideoInfo *info = NULL;
   struct wl_surface *surface;
   struct wl_callback *callback;
 
-  meta = gst_buffer_get_wl_meta (sink->last_buffer);
+  wlbuffer = gst_buffer_get_wl_buffer (sink->last_buffer);
   surface = gst_wl_window_get_wl_surface (sink->window);
 
   g_atomic_int_set (&sink->redraw_pending, TRUE);
   callback = wl_surface_frame (surface);
   wl_callback_add_listener (callback, &frame_callback_listener, sink);
 
-  /* Here we essentially add a reference to the buffer. This represents
-   * the fact that the compositor is using the buffer and it should
-   * not return back to the pool and be reused until the compositor
-   * releases it. The release is handled internally in the pool */
-  gst_wayland_compositor_acquire_buffer (meta->pool, sink->last_buffer);
-
-  wl_surface_attach (surface, meta->wbuffer, 0, 0);
-  wl_surface_damage (surface, 0, 0, sink->window->surface_width,
-      sink->window->surface_height);
-
-  wl_surface_commit (surface);
-  wl_display_flush (sink->display->display);
+  if (G_UNLIKELY (sink->video_info_changed)) {
+    info = &sink->video_info;
+    sink->video_info_changed = FALSE;
+  }
+  gst_wl_window_render (sink->window, wlbuffer, info);
 }
 
 static GstFlowReturn
@@ -667,7 +579,7 @@
 {
   GstWaylandSink *sink = GST_WAYLAND_SINK (bsink);
   GstBuffer *to_render;
-  GstWlMeta *meta;
+  GstWlBuffer *wlbuffer;
   GstFlowReturn ret = GST_FLOW_OK;
 
   g_mutex_lock (&sink->render_lock);
@@ -681,57 +593,86 @@
     gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (sink));
     g_mutex_lock (&sink->render_lock);
 
-    if (sink->window) {
-      /* inform the window about our caps */
-      gst_wl_window_set_video_info (sink->window, &sink->video_info);
-    } else {
+    if (!sink->window) {
       /* if we were not provided a window, create one ourselves */
       sink->window =
           gst_wl_window_new_toplevel (sink->display, &sink->video_info);
     }
-    sink->video_info_changed = FALSE;
   }
 
   /* drop buffers until we get a frame callback */
   if (g_atomic_int_get (&sink->redraw_pending) == TRUE)
     goto done;
 
-  if (G_UNLIKELY (sink->video_info_changed)) {
-    gst_wl_window_set_video_info (sink->window, &sink->video_info);
-    sink->video_info_changed = FALSE;
-  }
-
-  /* now that we have for sure set the video info on the window, it must have
-   * a valid size, otherwise this means that the application has called
-   * set_window_handle() without calling set_render_rectangle(), which is
-   * absolutely necessary for us.
-   */
-  if (G_UNLIKELY (sink->window->surface_width == 0 ||
-          sink->window->surface_height == 0))
+  /* make sure that the application has called set_render_rectangle() */
+  if (G_UNLIKELY (sink->window->render_rectangle.w == 0))
     goto no_window_size;
 
-  meta = gst_buffer_get_wl_meta (buffer);
+  wlbuffer = gst_buffer_get_wl_buffer (buffer);
 
-  if (meta && meta->pool->display == sink->display) {
-    GST_LOG_OBJECT (sink, "buffer %p from our pool, writing directly", buffer);
+  if (G_LIKELY (wlbuffer && wlbuffer->display == sink->display)) {
+    GST_LOG_OBJECT (sink, "buffer %p has a wl_buffer from our display, "
+        "writing directly", buffer);
     to_render = buffer;
   } else {
-    GstMapInfo src;
-    GST_LOG_OBJECT (sink, "buffer %p not from our pool, copying", buffer);
+    GstMemory *mem;
+    struct wl_buffer *wbuf = NULL;
 
-    if (!sink->pool)
-      goto no_pool;
+    GST_LOG_OBJECT (sink, "buffer %p does not have a wl_buffer from our "
+        "display, creating it", buffer);
 
-    if (!gst_buffer_pool_set_active (sink->pool, TRUE))
-      goto activate_failed;
+    mem = gst_buffer_peek_memory (buffer, 0);
 
-    ret = gst_buffer_pool_acquire_buffer (sink->pool, &to_render, NULL);
-    if (ret != GST_FLOW_OK)
-      goto no_buffer;
+    if (gst_is_wl_shm_memory (mem)) {
+      wbuf = gst_wl_shm_memory_construct_wl_buffer (mem, sink->display,
+          &sink->video_info);
+    }
 
-    gst_buffer_map (buffer, &src, GST_MAP_READ);
-    gst_buffer_fill (to_render, 0, src.data, src.size);
-    gst_buffer_unmap (buffer, &src);
+    if (wbuf) {
+      gst_buffer_add_wl_buffer (buffer, wbuf, sink->display);
+      to_render = buffer;
+    } else {
+      GstMapInfo src;
+      /* we don't know how to create a wl_buffer directly from the provided
+       * memory, so we have to copy the data to a memory that we know how
+       * to handle... */
+
+      GST_LOG_OBJECT (sink, "buffer %p cannot have a wl_buffer, "
+          "copying to wl_shm memory", buffer);
+
+      /* sink->pool always exists (created in set_caps), but it may not
+       * be active if upstream is not using it */
+      if (!gst_buffer_pool_is_active (sink->pool) &&
+          !gst_buffer_pool_set_active (sink->pool, TRUE))
+        goto activate_failed;
+
+      ret = gst_buffer_pool_acquire_buffer (sink->pool, &to_render, NULL);
+      if (ret != GST_FLOW_OK)
+        goto no_buffer;
+
+      /* the first time we acquire a buffer,
+       * we need to attach a wl_buffer on it */
+      wlbuffer = gst_buffer_get_wl_buffer (buffer);
+      if (G_UNLIKELY (!wlbuffer)) {
+        mem = gst_buffer_peek_memory (to_render, 0);
+        wbuf = gst_wl_shm_memory_construct_wl_buffer (mem, sink->display,
+            &sink->video_info);
+        if (G_UNLIKELY (!wbuf))
+          goto no_wl_buffer;
+
+        gst_buffer_add_wl_buffer (buffer, wbuf, sink->display);
+      }
+
+      gst_buffer_map (buffer, &src, GST_MAP_READ);
+      gst_buffer_fill (to_render, 0, src.data, src.size);
+      gst_buffer_unmap (buffer, &src);
+    }
+  }
+
+  /* drop double rendering */
+  if (G_UNLIKELY (to_render == sink->last_buffer)) {
+    GST_LOG_OBJECT (sink, "Buffer already being rendered");
+    goto done;
   }
 
   gst_buffer_replace (&sink->last_buffer, to_render);
@@ -751,14 +692,12 @@
   }
 no_buffer:
   {
-    GST_WARNING_OBJECT (sink, "could not create image");
+    GST_WARNING_OBJECT (sink, "could not create buffer");
     goto done;
   }
-no_pool:
+no_wl_buffer:
   {
-    GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
-        ("Internal error: can't allocate images"),
-        ("We don't have a bufferpool negotiated"));
+    GST_ERROR_OBJECT (sink, "could not create wl_buffer out of wl_shm memory");
     ret = GST_FLOW_ERROR;
     goto done;
   }
@@ -873,14 +812,14 @@
   g_return_if_fail (sink != NULL);
 
   g_mutex_lock (&sink->render_lock);
-  if (!sink->window || !sink->window->subsurface) {
+  if (!sink->window || !sink->window->area_subsurface) {
     g_mutex_unlock (&sink->render_lock);
     GST_INFO_OBJECT (sink,
         "begin_geometry_change called without window, ignoring");
     return;
   }
 
-  wl_subsurface_set_sync (sink->window->subsurface);
+  wl_subsurface_set_sync (sink->window->area_subsurface);
   g_mutex_unlock (&sink->render_lock);
 }
 
@@ -891,14 +830,14 @@
   g_return_if_fail (sink != NULL);
 
   g_mutex_lock (&sink->render_lock);
-  if (!sink->window || !sink->window->subsurface) {
+  if (!sink->window || !sink->window->area_subsurface) {
     g_mutex_unlock (&sink->render_lock);
     GST_INFO_OBJECT (sink,
         "end_geometry_change called without window, ignoring");
     return;
   }
 
-  wl_subsurface_set_desync (sink->window->subsurface);
+  wl_subsurface_set_desync (sink->window->area_subsurface);
   g_mutex_unlock (&sink->render_lock);
 }
 
@@ -908,6 +847,8 @@
   GST_DEBUG_CATEGORY_INIT (gstwayland_debug, "waylandsink", 0,
       " wayland video sink");
 
+  gst_wl_shm_allocator_register ();
+
   return gst_element_register (plugin, "waylandsink", GST_RANK_MARGINAL,
       GST_TYPE_WAYLAND_SINK);
 }
diff --git a/ext/wayland/waylandpool.c b/ext/wayland/waylandpool.c
deleted file mode 100644
index de20602..0000000
--- a/ext/wayland/waylandpool.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/* GStreamer
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2012 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
- * Copyright (C) 2014 Collabora Ltd.
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "waylandpool.h"
-#include "wldisplay.h"
-#include "wlvideoformat.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-
-GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
-#define GST_CAT_DEFAULT gstwayland_debug
-
-/* wl metadata */
-GType
-gst_wl_meta_api_get_type (void)
-{
-  static volatile GType type;
-  static const gchar *tags[] =
-      { "memory", "size", "colorspace", "orientation", NULL };
-
-  if (g_once_init_enter (&type)) {
-    GType _type = gst_meta_api_type_register ("GstWlMetaAPI", tags);
-    g_once_init_leave (&type, _type);
-  }
-  return type;
-}
-
-static void
-gst_wl_meta_free (GstWlMeta * meta, GstBuffer * buffer)
-{
-  GST_DEBUG ("destroying wl_buffer %p", meta->wbuffer);
-  wl_buffer_destroy (meta->wbuffer);
-}
-
-const GstMetaInfo *
-gst_wl_meta_get_info (void)
-{
-  static const GstMetaInfo *wl_meta_info = NULL;
-
-  if (g_once_init_enter (&wl_meta_info)) {
-    const GstMetaInfo *meta =
-        gst_meta_register (GST_WL_META_API_TYPE, "GstWlMeta",
-        sizeof (GstWlMeta), (GstMetaInitFunction) NULL,
-        (GstMetaFreeFunction) gst_wl_meta_free,
-        (GstMetaTransformFunction) NULL);
-    g_once_init_leave (&wl_meta_info, meta);
-  }
-  return wl_meta_info;
-}
-
-/* bufferpool */
-static void gst_wayland_buffer_pool_finalize (GObject * object);
-static gboolean gst_wayland_buffer_pool_set_config (GstBufferPool * pool,
-    GstStructure * config);
-static gboolean gst_wayland_buffer_pool_start (GstBufferPool * pool);
-static gboolean gst_wayland_buffer_pool_stop (GstBufferPool * pool);
-static GstFlowReturn gst_wayland_buffer_pool_alloc (GstBufferPool * pool,
-    GstBuffer ** buffer, GstBufferPoolAcquireParams * params);
-
-#define gst_wayland_buffer_pool_parent_class parent_class
-G_DEFINE_TYPE (GstWaylandBufferPool, gst_wayland_buffer_pool,
-    GST_TYPE_BUFFER_POOL);
-
-static void
-gst_wayland_buffer_pool_class_init (GstWaylandBufferPoolClass * klass)
-{
-  GObjectClass *gobject_class = (GObjectClass *) klass;
-  GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
-
-  gobject_class->finalize = gst_wayland_buffer_pool_finalize;
-
-  gstbufferpool_class->set_config = gst_wayland_buffer_pool_set_config;
-  gstbufferpool_class->start = gst_wayland_buffer_pool_start;
-  gstbufferpool_class->stop = gst_wayland_buffer_pool_stop;
-  gstbufferpool_class->alloc_buffer = gst_wayland_buffer_pool_alloc;
-}
-
-static void
-gst_wayland_buffer_pool_init (GstWaylandBufferPool * self)
-{
-  gst_video_info_init (&self->info);
-  g_mutex_init (&self->buffers_map_mutex);
-  self->buffers_map = g_hash_table_new (g_direct_hash, g_direct_equal);
-}
-
-static void
-gst_wayland_buffer_pool_finalize (GObject * object)
-{
-  GstWaylandBufferPool *pool = GST_WAYLAND_BUFFER_POOL_CAST (object);
-
-  if (pool->wl_pool)
-    gst_wayland_buffer_pool_stop (GST_BUFFER_POOL (pool));
-
-  g_mutex_clear (&pool->buffers_map_mutex);
-  g_hash_table_unref (pool->buffers_map);
-
-  g_object_unref (pool->display);
-
-  G_OBJECT_CLASS (gst_wayland_buffer_pool_parent_class)->finalize (object);
-}
-
-static void
-buffer_release (void *data, struct wl_buffer *wl_buffer)
-{
-  GstWaylandBufferPool *self = data;
-  GstBuffer *buffer;
-  GstWlMeta *meta;
-
-  g_mutex_lock (&self->buffers_map_mutex);
-  buffer = g_hash_table_lookup (self->buffers_map, wl_buffer);
-
-  GST_LOG_OBJECT (self, "wl_buffer::release (GstBuffer: %p)", buffer);
-
-  if (buffer) {
-    meta = gst_buffer_get_wl_meta (buffer);
-    if (meta->used_by_compositor) {
-      meta->used_by_compositor = FALSE;
-      /* unlock before unref because stop() may be called from here */
-      g_mutex_unlock (&self->buffers_map_mutex);
-      gst_buffer_unref (buffer);
-      return;
-    }
-  }
-  g_mutex_unlock (&self->buffers_map_mutex);
-}
-
-static const struct wl_buffer_listener buffer_listener = {
-  buffer_release
-};
-
-void
-gst_wayland_compositor_acquire_buffer (GstWaylandBufferPool * self,
-    GstBuffer * buffer)
-{
-  GstWlMeta *meta;
-
-  meta = gst_buffer_get_wl_meta (buffer);
-  g_return_if_fail (meta != NULL);
-  g_return_if_fail (meta->pool == self);
-  g_return_if_fail (meta->used_by_compositor == FALSE);
-
-  meta->used_by_compositor = TRUE;
-  gst_buffer_ref (buffer);
-}
-
-static void
-unref_used_buffers (gpointer key, gpointer value, gpointer data)
-{
-  GstBuffer *buffer = value;
-  GstWlMeta *meta = gst_buffer_get_wl_meta (buffer);
-  GList **to_unref = data;
-
-  if (meta->used_by_compositor) {
-    meta->used_by_compositor = FALSE;
-    *to_unref = g_list_prepend (*to_unref, buffer);
-  }
-}
-
-void
-gst_wayland_compositor_release_all_buffers (GstWaylandBufferPool * self)
-{
-  GList *to_unref = NULL;
-
-  g_mutex_lock (&self->buffers_map_mutex);
-  g_hash_table_foreach (self->buffers_map, unref_used_buffers, &to_unref);
-  g_mutex_unlock (&self->buffers_map_mutex);
-
-  /* unref without the lock because stop() may be called from here */
-  if (to_unref) {
-    g_list_free_full (to_unref, (GDestroyNotify) gst_buffer_unref);
-  }
-}
-
-static gboolean
-gst_wayland_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
-{
-  GstWaylandBufferPool *self = GST_WAYLAND_BUFFER_POOL_CAST (pool);
-  GstCaps *caps;
-
-  if (!gst_buffer_pool_config_get_params (config, &caps, 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 (&self->info, caps))
-    goto wrong_caps;
-
-  GST_LOG_OBJECT (pool, "%dx%d, caps %" GST_PTR_FORMAT,
-      GST_VIDEO_INFO_WIDTH (&self->info), GST_VIDEO_INFO_HEIGHT (&self->info),
-      caps);
-
-  /*Fixme: Enable metadata checking handling based on the config of pool */
-
-  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;
-  }
-}
-
-static gboolean
-gst_wayland_buffer_pool_start (GstBufferPool * pool)
-{
-  GstWaylandBufferPool *self = GST_WAYLAND_BUFFER_POOL (pool);
-  guint size = 0;
-  int fd;
-  char filename[1024];
-  static int init = 0;
-
-  GST_DEBUG_OBJECT (self, "Initializing wayland buffer pool");
-
-  /* configure */
-  size = GST_VIDEO_INFO_SIZE (&self->info) * 15;
-
-  /* allocate shm pool */
-  snprintf (filename, 1024, "%s/%s-%d-%s", g_get_user_runtime_dir (),
-      "wayland-shm", init++, "XXXXXX");
-
-  fd = mkstemp (filename);
-  if (fd < 0) {
-    GST_ERROR_OBJECT (pool, "opening temp file %s failed: %s", filename,
-        strerror (errno));
-    return FALSE;
-  }
-  if (ftruncate (fd, size) < 0) {
-    GST_ERROR_OBJECT (pool, "ftruncate failed: %s", strerror (errno));
-    close (fd);
-    return FALSE;
-  }
-
-  self->data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-  if (self->data == MAP_FAILED) {
-    GST_ERROR_OBJECT (pool, "mmap failed: %s", strerror (errno));
-    close (fd);
-    return FALSE;
-  }
-
-  self->wl_pool = wl_shm_create_pool (self->display->shm, fd, size);
-  unlink (filename);
-  close (fd);
-
-  self->size = size;
-  self->used = 0;
-
-  return GST_BUFFER_POOL_CLASS (parent_class)->start (pool);
-}
-
-static gboolean
-gst_wayland_buffer_pool_stop (GstBufferPool * pool)
-{
-  GstWaylandBufferPool *self = GST_WAYLAND_BUFFER_POOL (pool);
-
-  GST_DEBUG_OBJECT (self, "Stopping wayland buffer pool");
-
-  munmap (self->data, self->size);
-  wl_shm_pool_destroy (self->wl_pool);
-
-  self->wl_pool = NULL;
-  self->size = 0;
-  self->used = 0;
-
-  /* all buffers are about to be destroyed;
-   * we should no longer do anything with them */
-  g_mutex_lock (&self->buffers_map_mutex);
-  g_hash_table_remove_all (self->buffers_map);
-  g_mutex_unlock (&self->buffers_map_mutex);
-
-  return GST_BUFFER_POOL_CLASS (parent_class)->stop (pool);
-}
-
-static GstFlowReturn
-gst_wayland_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
-    GstBufferPoolAcquireParams * params)
-{
-  GstWaylandBufferPool *self = GST_WAYLAND_BUFFER_POOL_CAST (pool);
-  gint width, height, stride;
-  gsize size;
-  enum wl_shm_format format;
-  gint offset;
-  void *data;
-  GstWlMeta *meta;
-
-  width = GST_VIDEO_INFO_WIDTH (&self->info);
-  height = GST_VIDEO_INFO_HEIGHT (&self->info);
-  stride = GST_VIDEO_INFO_PLANE_STRIDE (&self->info, 0);
-  size = GST_VIDEO_INFO_SIZE (&self->info);
-  format =
-      gst_video_format_to_wayland_format (GST_VIDEO_INFO_FORMAT (&self->info));
-
-  GST_DEBUG_OBJECT (self, "Allocating buffer of size %" G_GSSIZE_FORMAT
-      " (%d x %d, stride %d), format %s", size, width, height, stride,
-      gst_wayland_format_to_string (format));
-
-  /* try to reserve another memory block from the shm pool */
-  if (self->used + size > self->size)
-    goto no_buffer;
-
-  offset = self->used;
-  self->used += size;
-  data = ((gchar *) self->data) + offset;
-
-  /* create buffer and its metadata object */
-  *buffer = gst_buffer_new ();
-  meta = (GstWlMeta *) gst_buffer_add_meta (*buffer, GST_WL_META_INFO, NULL);
-  meta->pool = self;
-  meta->wbuffer = wl_shm_pool_create_buffer (self->wl_pool, offset,
-      width, height, stride, format);
-  meta->used_by_compositor = FALSE;
-
-  /* configure listening to wl_buffer.release */
-  g_mutex_lock (&self->buffers_map_mutex);
-  g_hash_table_insert (self->buffers_map, meta->wbuffer, *buffer);
-  g_mutex_unlock (&self->buffers_map_mutex);
-
-  wl_buffer_add_listener (meta->wbuffer, &buffer_listener, self);
-
-  /* add the allocated memory on the GstBuffer */
-  gst_buffer_append_memory (*buffer,
-      gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, data,
-          size, 0, size, NULL, NULL));
-
-  return GST_FLOW_OK;
-
-  /* ERROR */
-no_buffer:
-  {
-    GST_WARNING_OBJECT (pool, "can't create buffer");
-    return GST_FLOW_ERROR;
-  }
-}
-
-GstBufferPool *
-gst_wayland_buffer_pool_new (GstWlDisplay * display)
-{
-  GstWaylandBufferPool *pool;
-
-  g_return_val_if_fail (GST_IS_WL_DISPLAY (display), NULL);
-  pool = g_object_new (GST_TYPE_WAYLAND_BUFFER_POOL, NULL);
-  pool->display = g_object_ref (display);
-
-  return GST_BUFFER_POOL_CAST (pool);
-}
diff --git a/ext/wayland/waylandpool.h b/ext/wayland/waylandpool.h
deleted file mode 100644
index ad5020b..0000000
--- a/ext/wayland/waylandpool.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* GStreamer Wayland buffer pool
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2012 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
- * Copyright (C) 2014 Collabora Ltd.
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_WAYLAND_BUFFER_POOL_H__
-#define __GST_WAYLAND_BUFFER_POOL_H__
-
-#include <gst/video/video.h>
-#include <gst/video/gstvideometa.h>
-
-#include "wldisplay.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_WAYLAND_BUFFER_POOL      (gst_wayland_buffer_pool_get_type())
-#define GST_IS_WAYLAND_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WAYLAND_BUFFER_POOL))
-#define GST_WAYLAND_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WAYLAND_BUFFER_POOL, GstWaylandBufferPool))
-#define GST_WAYLAND_BUFFER_POOL_CAST(obj) ((GstWaylandBufferPool*)(obj))
-
-typedef struct _GstWaylandBufferPool GstWaylandBufferPool;
-typedef struct _GstWaylandBufferPoolClass GstWaylandBufferPoolClass;
-
-/* buffer meta */
-typedef struct _GstWlMeta GstWlMeta;
-
-GType gst_wl_meta_api_get_type (void);
-#define GST_WL_META_API_TYPE  (gst_wl_meta_api_get_type())
-
-const GstMetaInfo * gst_wl_meta_get_info (void);
-#define GST_WL_META_INFO  (gst_wl_meta_get_info())
-
-#define gst_buffer_get_wl_meta(b) ((GstWlMeta*)gst_buffer_get_meta((b),GST_WL_META_API_TYPE))
-
-struct _GstWlMeta {
-  GstMeta meta;
-
-  GstWaylandBufferPool *pool;
-  struct wl_buffer *wbuffer;
-  gboolean used_by_compositor;
-};
-
-/* buffer pool */
-struct _GstWaylandBufferPool
-{
-  GstBufferPool bufferpool;
-  GstWlDisplay *display;
-
-  /* external configuration */
-  GstVideoInfo info;
-
-  /* allocation data */
-  struct wl_shm_pool *wl_pool;
-  size_t size;
-  size_t used;
-  void *data;
-
-  GMutex buffers_map_mutex;
-  GHashTable *buffers_map;
-};
-
-struct _GstWaylandBufferPoolClass
-{
-  GstBufferPoolClass parent_class;
-};
-
-GType gst_wayland_buffer_pool_get_type (void);
-
-GstBufferPool *gst_wayland_buffer_pool_new (GstWlDisplay * display);
-
-
-void gst_wayland_compositor_acquire_buffer (GstWaylandBufferPool * self,
-    GstBuffer * buffer);
-void gst_wayland_compositor_release_all_buffers (GstWaylandBufferPool * self);
-
-G_END_DECLS
-
-#endif /*__GST_WAYLAND_BUFFER_POOL_H__*/
diff --git a/ext/wayland/wlbuffer.c b/ext/wayland/wlbuffer.c
new file mode 100644
index 0000000..4ac99ef
--- /dev/null
+++ b/ext/wayland/wlbuffer.c
@@ -0,0 +1,232 @@
+/* GStreamer Wayland video sink
+ *
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+/* GstWlBuffer wraps wl_buffer and provides a mechanism for preventing
+ * buffers from being re-used while the compositor is using them. This
+ * is achieved by adding a reference to the GstBuffer as soon as its
+ * associated wl_buffer is sent to the compositor and by removing this
+ * reference as soon as the compositor sends a wl_buffer::release message.
+ *
+ * This mechanism is a bit complicated, though, because it adds cyclic
+ * references that can be dangerous. The reference cycles looks like:
+ *
+ *   ----------------
+ *   | GstWlDisplay | ---------------------------->
+ *   ----------------                              |
+ *                                                 |
+ *                                                 V
+ *   -----------------     -------------     ---------------
+ *   | GstBufferPool | --> | GstBuffer | ==> | GstWlBuffer |
+ *   |               | <-- |           | <-- |             |
+ *   -----------------     -------------     ---------------
+ *
+ * A GstBufferPool normally holds references to its GstBuffers and each buffer
+ * holds a reference to a GstWlBuffer (saved in the GstMiniObject qdata).
+ * When a GstBuffer is in use, it holds a reference back to the pool and the
+ * pool doesn't hold a reference to the GstBuffer. When the GstBuffer is unrefed
+ * externally, it returns back to the pool and the pool holds again a reference
+ * to the buffer.
+ *
+ * Now when the compositor is using a buffer, the GstWlBuffer also holds a ref
+ * to the GstBuffer, which prevents it from returning to the pool. When the
+ * last GstWlBuffer receives a release event and unrefs the last GstBuffer,
+ * the GstBufferPool will be able to stop and if no-one is holding a strong
+ * ref to it, it will be destroyed. This will destroy the pool's GstBuffers and
+ * also the GstWlBuffers. This will all happen in the same context of the last
+ * gst_buffer_unref, which will be called from the buffer_release() callback.
+ *
+ * The problem here lies in the fact that buffer_release() will be called
+ * from the event loop thread of GstWlDisplay, so it's as if the display
+ * holds a reference to the GstWlBuffer, but without having an actual reference.
+ * When we kill the display, there is no way for the GstWlBuffer, the associated
+ * GstBuffer and the GstBufferPool to get destroyed, so we are going to leak a
+ * fair ammount of memory.
+ *
+ * Normally, this rarely happens, because the compositor releases buffers
+ * almost immediately and when waylandsink stops, they are already released.
+ *
+ * However, we want to be absolutely certain, so a solution is introduced
+ * by registering all the GstWlBuffers with the display and explicitly
+ * releasing all the buffer references as soon as the display is destroyed.
+ *
+ * When the GstWlDisplay is finalized, it takes a reference to all the
+ * registered GstWlBuffers and then calls gst_wl_buffer_force_release_and_unref,
+ * which releases the potential reference to the GstBuffer, destroys the
+ * underlying wl_buffer and removes the reference that GstWlDisplay is holding.
+ * At that point, either the GstBuffer is alive somewhere and still holds a ref
+ * to the GstWlBuffer, which it will release when it gets destroyed, or the
+ * GstBuffer was destroyed in the meantime and the GstWlBuffer gets destroyed
+ * as soon as we remove the reference that GstWlDisplay holds.
+ */
+
+#include "wlbuffer.h"
+
+GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
+#define GST_CAT_DEFAULT gstwayland_debug
+
+G_DEFINE_TYPE (GstWlBuffer, gst_wl_buffer, G_TYPE_OBJECT);
+
+static G_DEFINE_QUARK (GstWlBufferQDataQuark, gst_wl_buffer_qdata);
+
+static void
+gst_wl_buffer_dispose (GObject * gobject)
+{
+  GstWlBuffer *self = GST_WL_BUFFER (gobject);
+
+  GST_TRACE_OBJECT (self, "dispose");
+
+  /* if the display is shutting down and we are trying to dipose
+   * the GstWlBuffer from another thread, unregister_buffer() will
+   * block and in the end the display will increase the refcount
+   * of this GstWlBuffer, so it will not be finalized */
+  if (self->display)
+    gst_wl_display_unregister_buffer (self->display, self);
+
+  G_OBJECT_CLASS (gst_wl_buffer_parent_class)->dispose (gobject);
+}
+
+static void
+gst_wl_buffer_finalize (GObject * gobject)
+{
+  GstWlBuffer *self = GST_WL_BUFFER (gobject);
+
+  GST_TRACE_OBJECT (self, "finalize");
+
+  if (self->wlbuffer)
+    wl_buffer_destroy (self->wlbuffer);
+
+  G_OBJECT_CLASS (gst_wl_buffer_parent_class)->finalize (gobject);
+}
+
+static void
+gst_wl_buffer_class_init (GstWlBufferClass * klass)
+{
+  GObjectClass *object_class = (GObjectClass *) klass;
+
+  object_class->dispose = gst_wl_buffer_dispose;
+  object_class->finalize = gst_wl_buffer_finalize;
+}
+
+static void
+gst_wl_buffer_init (GstWlBuffer * self)
+{
+}
+
+static void
+buffer_release (void *data, struct wl_buffer *wl_buffer)
+{
+  GstWlBuffer *self = data;
+
+  GST_LOG_OBJECT (self, "wl_buffer::release (GstBuffer: %p)", self->gstbuffer);
+
+  self->used_by_compositor = FALSE;
+
+  /* unref should be last, because it may end up destroying the GstWlBuffer */
+  gst_buffer_unref (self->gstbuffer);
+}
+
+static const struct wl_buffer_listener buffer_listener = {
+  buffer_release
+};
+
+static void
+gstbuffer_disposed (GstWlBuffer * self)
+{
+  g_assert (!self->used_by_compositor);
+  self->gstbuffer = NULL;
+
+  GST_TRACE_OBJECT (self, "owning GstBuffer was finalized");
+
+  /* this will normally destroy the GstWlBuffer, unless the display is
+   * finalizing and it has taken an additional reference to it */
+  g_object_unref (self);
+}
+
+GstWlBuffer *
+gst_buffer_add_wl_buffer (GstBuffer * gstbuffer, struct wl_buffer *wlbuffer,
+    GstWlDisplay * display)
+{
+  GstWlBuffer *self;
+
+  self = g_object_new (GST_TYPE_WL_BUFFER, NULL);
+  self->gstbuffer = gstbuffer;
+  self->wlbuffer = wlbuffer;
+  self->display = display;
+
+  gst_wl_display_register_buffer (self->display, self);
+
+  wl_buffer_add_listener (self->wlbuffer, &buffer_listener, self);
+
+  gst_mini_object_set_qdata ((GstMiniObject *) gstbuffer,
+      gst_wl_buffer_qdata_quark (), self, (GDestroyNotify) gstbuffer_disposed);
+
+  return self;
+}
+
+GstWlBuffer *
+gst_buffer_get_wl_buffer (GstBuffer * gstbuffer)
+{
+  return gst_mini_object_get_qdata ((GstMiniObject *) gstbuffer,
+      gst_wl_buffer_qdata_quark ());
+}
+
+void
+gst_wl_buffer_force_release_and_unref (GstWlBuffer * self)
+{
+  /* Force a buffer release.
+   * At this point, the GstWlDisplay has killed its event loop,
+   * so we don't need to worry about buffer_release() being called
+   * at the same time from the event loop thread */
+  if (self->used_by_compositor) {
+    GST_DEBUG_OBJECT (self, "forcing wl_buffer::release (GstBuffer: %p)",
+        self->gstbuffer);
+    self->used_by_compositor = FALSE;
+    gst_buffer_unref (self->gstbuffer);
+  }
+
+  /* Finalize this GstWlBuffer early.
+   * This method has been called as a result of the display shutting down,
+   * so we need to stop using any wayland resources and disconnect from
+   * the display. The GstWlBuffer stays alive, though, to avoid race
+   * conditions with the GstBuffer being destroyed from another thread.
+   * The last reference is either owned by the GstBuffer or by us and
+   * it will be released at the end of this function. */
+  GST_TRACE_OBJECT (self, "finalizing early");
+  wl_buffer_destroy (self->wlbuffer);
+  self->wlbuffer = NULL;
+  self->display = NULL;
+
+  /* remove the reference that the caller (GstWlDisplay) owns */
+  g_object_unref (self);
+}
+
+void
+gst_wl_buffer_attach (GstWlBuffer * self, struct wl_surface *surface)
+{
+  g_return_if_fail (self->used_by_compositor == FALSE);
+
+  wl_surface_attach (surface, self->wlbuffer, 0, 0);
+
+  /* Add a reference to the buffer. This represents the fact that
+   * the compositor is using the buffer and it should not return
+   * back to the pool and be re-used until the compositor releases it. */
+  gst_buffer_ref (self->gstbuffer);
+  self->used_by_compositor = TRUE;
+}
diff --git a/ext/wayland/wlbuffer.h b/ext/wayland/wlbuffer.h
new file mode 100644
index 0000000..cbb50f7
--- /dev/null
+++ b/ext/wayland/wlbuffer.h
@@ -0,0 +1,67 @@
+/* GStreamer Wayland video sink
+ *
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __GST_WL_BUFFER_H__
+#define __GST_WL_BUFFER_H__
+
+#include "wldisplay.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_WL_BUFFER                  (gst_wl_buffer_get_type ())
+#define GST_WL_BUFFER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_BUFFER, GstWlBuffer))
+#define GST_IS_WL_BUFFER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_BUFFER))
+#define GST_WL_BUFFER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_BUFFER, GstWlBufferClass))
+#define GST_IS_WL_BUFFER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_BUFFER))
+#define GST_WL_BUFFER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_BUFFER, GstWlBufferClass))
+
+typedef struct _GstWlBuffer GstWlBuffer;
+typedef struct _GstWlBufferClass GstWlBufferClass;
+
+struct _GstWlBuffer
+{
+  GObject parent_instance;
+
+  struct wl_buffer * wlbuffer;
+  GstBuffer *gstbuffer;
+
+  GstWlDisplay *display;
+
+  gboolean used_by_compositor;
+};
+
+struct _GstWlBufferClass
+{
+  GObjectClass parent_class;
+};
+
+GType gst_wl_buffer_get_type (void);
+
+GstWlBuffer * gst_buffer_add_wl_buffer (GstBuffer * gstbuffer,
+    struct wl_buffer * wlbuffer, GstWlDisplay * display);
+GstWlBuffer * gst_buffer_get_wl_buffer (GstBuffer * gstbuffer);
+
+void gst_wl_buffer_force_release_and_unref (GstWlBuffer * self);
+
+void gst_wl_buffer_attach (GstWlBuffer * self, struct wl_surface *surface);
+
+G_END_DECLS
+
+#endif /* __GST_WL_BUFFER_H__ */
diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c
index 46efab9..8c5eeaf 100644
--- a/ext/wayland/wldisplay.c
+++ b/ext/wayland/wldisplay.c
@@ -23,6 +23,7 @@
 #endif
 
 #include "wldisplay.h"
+#include "wlbuffer.h"
 
 #include <errno.h>
 
@@ -45,6 +46,8 @@
 {
   self->formats = g_array_new (FALSE, FALSE, sizeof (uint32_t));
   self->wl_fd_poll = gst_poll_new (TRUE);
+  self->buffers = g_hash_table_new (g_direct_hash, g_direct_equal);
+  g_mutex_init (&self->buffers_mutex);
 }
 
 static void
@@ -53,12 +56,23 @@
   GstWlDisplay *self = GST_WL_DISPLAY (gobject);
 
   gst_poll_set_flushing (self->wl_fd_poll, TRUE);
+  g_thread_join (self->thread);
 
-  if (self->thread)
-    g_thread_join (self->thread);
+  /* to avoid buffers being unregistered from another thread
+   * at the same time, take their ownership */
+  g_mutex_lock (&self->buffers_mutex);
+  self->shutting_down = TRUE;
+  g_hash_table_foreach (self->buffers, (GHFunc) g_object_ref, NULL);
+  g_mutex_unlock (&self->buffers_mutex);
+
+  g_hash_table_foreach (self->buffers,
+      (GHFunc) gst_wl_buffer_force_release_and_unref, NULL);
+  g_hash_table_remove_all (self->buffers);
 
   g_array_unref (self->formats);
   gst_poll_free (self->wl_fd_poll);
+  g_hash_table_unref (self->buffers);
+  g_mutex_clear (&self->buffers_mutex);
 
   if (self->shm)
     wl_shm_destroy (self->shm);
@@ -266,3 +280,26 @@
 
   return self;
 }
+
+void
+gst_wl_display_register_buffer (GstWlDisplay * self, gpointer buf)
+{
+  g_assert (!self->shutting_down);
+
+  GST_TRACE_OBJECT (self, "registering GstWlBuffer %p", buf);
+
+  g_mutex_lock (&self->buffers_mutex);
+  g_hash_table_add (self->buffers, buf);
+  g_mutex_unlock (&self->buffers_mutex);
+}
+
+void
+gst_wl_display_unregister_buffer (GstWlDisplay * self, gpointer buf)
+{
+  GST_TRACE_OBJECT (self, "unregistering GstWlBuffer %p", buf);
+
+  g_mutex_lock (&self->buffers_mutex);
+  if (G_LIKELY (!self->shutting_down))
+    g_hash_table_remove (self->buffers, buf);
+  g_mutex_unlock (&self->buffers_mutex);
+}
diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h
index 0224406..5505d60 100644
--- a/ext/wayland/wldisplay.h
+++ b/ext/wayland/wldisplay.h
@@ -58,6 +58,10 @@
   gboolean own_display;
   GThread *thread;
   GstPoll *wl_fd_poll;
+
+  GMutex buffers_mutex;
+  GHashTable *buffers;
+  gboolean shutting_down;
 };
 
 struct _GstWlDisplayClass
@@ -71,6 +75,10 @@
 GstWlDisplay *gst_wl_display_new_existing (struct wl_display * display,
     gboolean take_ownership, GError ** error);
 
+/* see wlbuffer.c for explanation */
+void gst_wl_display_register_buffer (GstWlDisplay * self, gpointer buf);
+void gst_wl_display_unregister_buffer (GstWlDisplay * self, gpointer buf);
+
 G_END_DECLS
 
 #endif /* __GST_WL_DISPLAY_H__ */
diff --git a/ext/wayland/wlshmallocator.c b/ext/wayland/wlshmallocator.c
new file mode 100644
index 0000000..6d82b23
--- /dev/null
+++ b/ext/wayland/wlshmallocator.c
@@ -0,0 +1,181 @@
+/* GStreamer Wayland video sink
+ *
+ * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "wlshmallocator.h"
+#include "wlvideoformat.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+
+GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
+#define GST_CAT_DEFAULT gstwayland_debug
+
+G_DEFINE_TYPE (GstWlShmAllocator, gst_wl_shm_allocator, GST_TYPE_ALLOCATOR);
+
+static GstMemory *
+gst_wl_shm_allocator_alloc (GstAllocator * allocator, gsize size,
+    GstAllocationParams * params)
+{
+  GstWlShmAllocator *self = GST_WL_SHM_ALLOCATOR (allocator);
+  char filename[1024];
+  static int init = 0;
+  int fd;
+  gpointer data;
+  GstWlShmMemory *mem;
+
+  /* TODO: make use of the allocation params, if necessary */
+
+  /* allocate shm pool */
+  snprintf (filename, 1024, "%s/%s-%d-%s", g_get_user_runtime_dir (),
+      "wayland-shm", init++, "XXXXXX");
+
+  fd = g_mkstemp (filename);
+  if (fd < 0) {
+    GST_ERROR_OBJECT (self, "opening temp file %s failed: %s", filename,
+        strerror (errno));
+    return NULL;
+  }
+  if (ftruncate (fd, size) < 0) {
+    GST_ERROR_OBJECT (self, "ftruncate failed: %s", strerror (errno));
+    close (fd);
+    return NULL;
+  }
+
+  data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (data == MAP_FAILED) {
+    GST_ERROR_OBJECT (self, "mmap failed: %s", strerror (errno));
+    close (fd);
+    return NULL;
+  }
+
+  unlink (filename);
+
+  mem = g_slice_new0 (GstWlShmMemory);
+  gst_memory_init ((GstMemory *) mem, GST_MEMORY_FLAG_NO_SHARE, allocator, NULL,
+      size, 0, 0, size);
+  mem->data = data;
+  mem->fd = fd;
+
+  return (GstMemory *) mem;
+}
+
+static void
+gst_wl_shm_allocator_free (GstAllocator * allocator, GstMemory * memory)
+{
+  GstWlShmMemory *shm_mem = (GstWlShmMemory *) memory;
+
+  if (shm_mem->fd != -1)
+    close (shm_mem->fd);
+  munmap (shm_mem->data, memory->maxsize);
+
+  g_slice_free (GstWlShmMemory, shm_mem);
+}
+
+static gpointer
+gst_wl_shm_mem_map (GstMemory * mem, gsize maxsize, GstMapFlags flags)
+{
+  return ((GstWlShmMemory *) mem)->data;
+}
+
+static void
+gst_wl_shm_mem_unmap (GstMemory * mem)
+{
+}
+
+static void
+gst_wl_shm_allocator_class_init (GstWlShmAllocatorClass * klass)
+{
+  GstAllocatorClass *alloc_class = (GstAllocatorClass *) klass;
+
+  alloc_class->alloc = GST_DEBUG_FUNCPTR (gst_wl_shm_allocator_alloc);
+  alloc_class->free = GST_DEBUG_FUNCPTR (gst_wl_shm_allocator_free);
+}
+
+static void
+gst_wl_shm_allocator_init (GstWlShmAllocator * self)
+{
+  self->parent_instance.mem_type = GST_ALLOCATOR_WL_SHM;
+  self->parent_instance.mem_map = gst_wl_shm_mem_map;
+  self->parent_instance.mem_unmap = gst_wl_shm_mem_unmap;
+
+  GST_OBJECT_FLAG_SET (self, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
+}
+
+void
+gst_wl_shm_allocator_register (void)
+{
+  gst_allocator_register (GST_ALLOCATOR_WL_SHM,
+      g_object_new (GST_TYPE_WL_SHM_ALLOCATOR, NULL));
+}
+
+GstAllocator *
+gst_wl_shm_allocator_get (void)
+{
+  return gst_allocator_find (GST_ALLOCATOR_WL_SHM);
+}
+
+gboolean
+gst_is_wl_shm_memory (GstMemory * mem)
+{
+  return gst_memory_is_type (mem, GST_ALLOCATOR_WL_SHM);
+}
+
+struct wl_buffer *
+gst_wl_shm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display,
+    const GstVideoInfo * info)
+{
+  GstWlShmMemory *shm_mem = (GstWlShmMemory *) mem;
+  gint width, height, stride;
+  gsize size;
+  enum wl_shm_format format;
+  struct wl_shm_pool *wl_pool;
+  struct wl_buffer *wbuffer;
+
+  width = GST_VIDEO_INFO_WIDTH (info);
+  height = GST_VIDEO_INFO_HEIGHT (info);
+  stride = GST_VIDEO_INFO_PLANE_STRIDE (info, 0);
+  size = GST_VIDEO_INFO_SIZE (info);
+  format = gst_video_format_to_wl_shm_format (GST_VIDEO_INFO_FORMAT (info));
+
+  g_return_val_if_fail (gst_is_wl_shm_memory (mem), NULL);
+  g_return_val_if_fail (size <= mem->size, NULL);
+  g_return_val_if_fail (shm_mem->fd != -1, NULL);
+
+  GST_DEBUG_OBJECT (mem->allocator, "Creating wl_buffer of size %"
+      G_GSSIZE_FORMAT " (%d x %d, stride %d), format %s", size, width, height,
+      stride, gst_wl_shm_format_to_string (format));
+
+  wl_pool = wl_shm_create_pool (display->shm, shm_mem->fd, mem->size);
+  wbuffer = wl_shm_pool_create_buffer (wl_pool, 0, width, height, stride,
+      format);
+
+  close (shm_mem->fd);
+  shm_mem->fd = -1;
+  wl_shm_pool_destroy (wl_pool);
+
+  return wbuffer;
+}
diff --git a/ext/wayland/wlshmallocator.h b/ext/wayland/wlshmallocator.h
new file mode 100644
index 0000000..f12882c
--- /dev/null
+++ b/ext/wayland/wlshmallocator.h
@@ -0,0 +1,74 @@
+/* GStreamer Wayland video sink
+ *
+ * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_WL_SHM_ALLOCATOR_H__
+#define __GST_WL_SHM_ALLOCATOR_H__
+
+#include <gst/video/video.h>
+#include <wayland-client-protocol.h>
+#include "wldisplay.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_WL_SHM_ALLOCATOR                  (gst_wl_shm_allocator_get_type ())
+#define GST_WL_SHM_ALLOCATOR(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_SHM_ALLOCATOR, GstWlShmAllocator))
+#define GST_IS_WL_SHM_ALLOCATOR(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_SHM_ALLOCATOR))
+#define GST_WL_SHM_ALLOCATOR_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_SHM_ALLOCATOR, GstWlShmAllocatorClass))
+#define GST_IS_WL_SHM_ALLOCATOR_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_SHM_ALLOCATOR))
+#define GST_WL_SHM_ALLOCATOR_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_SHM_ALLOCATOR, GstWlShmAllocatorClass))
+
+#define GST_ALLOCATOR_WL_SHM "wl_shm"
+
+typedef struct _GstWlShmMemory GstWlShmMemory;
+typedef struct _GstWlShmAllocator GstWlShmAllocator;
+typedef struct _GstWlShmAllocatorClass GstWlShmAllocatorClass;
+
+struct _GstWlShmMemory
+{
+  GstMemory parent;
+
+  gpointer data;
+  gint fd;
+};
+
+struct _GstWlShmAllocator
+{
+  GstAllocator parent_instance;
+};
+
+struct _GstWlShmAllocatorClass
+{
+  GstAllocatorClass parent_class;
+};
+
+GType gst_wl_shm_allocator_get_type (void);
+
+void gst_wl_shm_allocator_register (void);
+GstAllocator * gst_wl_shm_allocator_get (void);
+
+gboolean gst_is_wl_shm_memory (GstMemory * mem);
+struct wl_buffer * gst_wl_shm_memory_construct_wl_buffer (GstMemory * mem,
+    GstWlDisplay * display, const GstVideoInfo * info);
+
+G_END_DECLS
+
+#endif /* __GST_WL_SHM_ALLOCATOR_H__ */
diff --git a/ext/wayland/wlvideoformat.c b/ext/wayland/wlvideoformat.c
index f2166f9..1302da6 100644
--- a/ext/wayland/wlvideoformat.c
+++ b/ext/wayland/wlvideoformat.c
@@ -78,7 +78,7 @@
 };
 
 enum wl_shm_format
-gst_video_format_to_wayland_format (GstVideoFormat format)
+gst_video_format_to_wl_shm_format (GstVideoFormat format)
 {
   guint i;
 
@@ -86,12 +86,12 @@
     if (formats[i].gst_format == format)
       return formats[i].wl_format;
 
-  GST_WARNING ("wayland video format not found");
+  GST_WARNING ("wayland shm video format not found");
   return -1;
 }
 
 GstVideoFormat
-gst_wayland_format_to_video_format (enum wl_shm_format wl_format)
+gst_wl_shm_format_to_video_format (enum wl_shm_format wl_format)
 {
   guint i;
 
@@ -104,8 +104,8 @@
 }
 
 const gchar *
-gst_wayland_format_to_string (enum wl_shm_format wl_format)
+gst_wl_shm_format_to_string (enum wl_shm_format wl_format)
 {
   return gst_video_format_to_string
-      (gst_wayland_format_to_video_format (wl_format));
+      (gst_wl_shm_format_to_video_format (wl_format));
 }
diff --git a/ext/wayland/wlvideoformat.h b/ext/wayland/wlvideoformat.h
index 72efc81..e8ec7ae 100644
--- a/ext/wayland/wlvideoformat.h
+++ b/ext/wayland/wlvideoformat.h
@@ -24,15 +24,15 @@
 #ifndef __GST_WL_VIDEO_FORMAT_H__
 #define __GST_WL_VIDEO_FORMAT_H__
 
-#include <wayland-client.h>
+#include <wayland-client-protocol.h>
 #include <gst/video/video.h>
 
 G_BEGIN_DECLS
 
-enum wl_shm_format gst_video_format_to_wayland_format (GstVideoFormat format);
-GstVideoFormat gst_wayland_format_to_video_format (enum wl_shm_format wl_format);
+enum wl_shm_format gst_video_format_to_wl_shm_format (GstVideoFormat format);
+GstVideoFormat gst_wl_shm_format_to_video_format (enum wl_shm_format wl_format);
 
-const gchar *gst_wayland_format_to_string (enum wl_shm_format wl_format);
+const gchar *gst_wl_shm_format_to_string (enum wl_shm_format wl_format);
 
 G_END_DECLS
 
diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
index ea6c681..a964335 100644
--- a/ext/wayland/wlwindow.c
+++ b/ext/wayland/wlwindow.c
@@ -25,6 +25,8 @@
 #endif
 
 #include "wlwindow.h"
+#include "wlshmallocator.h"
+#include "wlbuffer.h"
 
 GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
 #define GST_CAT_DEFAULT gstwayland_debug
@@ -78,12 +80,15 @@
     wl_shell_surface_destroy (self->shell_surface);
   }
 
-  if (self->subsurface) {
-    wl_subsurface_destroy (self->subsurface);
-  }
+  wl_viewport_destroy (self->video_viewport);
+  wl_subsurface_destroy (self->video_subsurface);
+  wl_surface_destroy (self->video_surface);
 
-  wl_viewport_destroy (self->viewport);
-  wl_surface_destroy (self->surface);
+  if (self->area_subsurface) {
+    wl_subsurface_destroy (self->area_subsurface);
+  }
+  wl_viewport_destroy (self->area_viewport);
+  wl_surface_destroy (self->area_surface);
 
   g_clear_object (&self->display);
 
@@ -91,44 +96,84 @@
 }
 
 static GstWlWindow *
-gst_wl_window_new_internal (GstWlDisplay * display, struct wl_surface *surface)
+gst_wl_window_new_internal (GstWlDisplay * display)
 {
   GstWlWindow *window;
+  GstVideoInfo info;
+  GstBuffer *buf;
+  GstMapInfo mapinfo;
+  struct wl_buffer *wlbuf;
+  GstWlBuffer *gwlbuf;
   struct wl_region *region;
 
-  g_return_val_if_fail (surface != NULL, NULL);
-
   window = g_object_new (GST_TYPE_WL_WINDOW, NULL);
   window->display = g_object_ref (display);
-  window->surface = surface;
 
-  /* make sure the surface runs on our local queue */
-  wl_proxy_set_queue ((struct wl_proxy *) surface, display->queue);
+  window->area_surface = wl_compositor_create_surface (display->compositor);
+  window->video_surface = wl_compositor_create_surface (display->compositor);
 
-  window->viewport = wl_scaler_get_viewport (display->scaler, window->surface);
+  wl_proxy_set_queue ((struct wl_proxy *) window->area_surface, display->queue);
+  wl_proxy_set_queue ((struct wl_proxy *) window->video_surface,
+      display->queue);
+
+  /* embed video_surface in area_surface */
+  window->video_subsurface =
+      wl_subcompositor_get_subsurface (display->subcompositor,
+      window->video_surface, window->area_surface);
+  wl_subsurface_set_desync (window->video_subsurface);
+
+  window->area_viewport = wl_scaler_get_viewport (display->scaler,
+      window->area_surface);
+  window->video_viewport = wl_scaler_get_viewport (display->scaler,
+      window->video_surface);
+
+  /* draw the area_subsurface */
+  gst_video_info_set_format (&info,
+      /* we want WL_SHM_FORMAT_XRGB8888 */
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+      GST_VIDEO_FORMAT_xRGB,
+#else
+      GST_VIDEO_FORMAT_BGRx,
+#endif
+      1, 1);
+
+  buf = gst_buffer_new_allocate (gst_wl_shm_allocator_get (), info.size, NULL);
+  gst_buffer_map (buf, &mapinfo, GST_MAP_WRITE);
+  *((guint32 *) mapinfo.data) = 0;      /* paint it black */
+  gst_buffer_unmap (buf, &mapinfo);
+  wlbuf =
+      gst_wl_shm_memory_construct_wl_buffer (gst_buffer_peek_memory (buf, 0),
+      display, &info);
+  gwlbuf = gst_buffer_add_wl_buffer (buf, wlbuf, display);
+  gst_wl_buffer_attach (gwlbuf, window->area_surface);
+
+  /* at this point, the GstWlBuffer keeps the buffer
+   * alive and will free it on wl_buffer::release */
+  gst_buffer_unref (buf);
 
   /* do not accept input */
   region = wl_compositor_create_region (display->compositor);
-  wl_surface_set_input_region (surface, region);
+  wl_surface_set_input_region (window->area_surface, region);
+  wl_region_destroy (region);
+
+  region = wl_compositor_create_region (display->compositor);
+  wl_surface_set_input_region (window->video_surface, region);
   wl_region_destroy (region);
 
   return window;
 }
 
 GstWlWindow *
-gst_wl_window_new_toplevel (GstWlDisplay * display, GstVideoInfo * video_info)
+gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info)
 {
   GstWlWindow *window;
+  gint width;
 
-  window = gst_wl_window_new_internal (display,
-      wl_compositor_create_surface (display->compositor));
+  window = gst_wl_window_new_internal (display);
 
-  gst_wl_window_set_video_info (window, video_info);
-  gst_wl_window_set_render_rectangle (window, 0, 0, window->video_width,
-      window->video_height);
-
+  /* go toplevel */
   window->shell_surface = wl_shell_get_shell_surface (display->shell,
-      window->surface);
+      window->area_surface);
 
   if (window->shell_surface) {
     wl_shell_surface_add_listener (window->shell_surface,
@@ -141,6 +186,11 @@
     return NULL;
   }
 
+  /* set the initial size to be the same as the reported video size */
+  width =
+      gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d);
+  gst_wl_window_set_render_rectangle (window, 0, 0, width, info->height);
+
   return window;
 }
 
@@ -149,13 +199,13 @@
     struct wl_surface * parent)
 {
   GstWlWindow *window;
+  window = gst_wl_window_new_internal (display);
 
-  window = gst_wl_window_new_internal (display,
-      wl_compositor_create_surface (display->compositor));
-
-  window->subsurface = wl_subcompositor_get_subsurface (display->subcompositor,
-      window->surface, parent);
-  wl_subsurface_set_desync (window->subsurface);
+  /* embed in parent */
+  window->area_subsurface =
+      wl_subcompositor_get_subsurface (display->subcompositor,
+      window->area_surface, parent);
+  wl_subsurface_set_desync (window->area_subsurface);
 
   return window;
 }
@@ -173,7 +223,7 @@
 {
   g_return_val_if_fail (window != NULL, NULL);
 
-  return window->surface;
+  return window->video_surface;
 }
 
 gboolean
@@ -185,23 +235,32 @@
 }
 
 static void
-gst_wl_window_resize_internal (GstWlWindow * window, gboolean commit)
+gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit)
 {
   GstVideoRectangle src = { 0, };
   GstVideoRectangle res;
 
+  /* center the video_subsurface inside area_subsurface */
   src.w = window->video_width;
   src.h = window->video_height;
   gst_video_sink_center_rect (src, window->render_rectangle, &res, TRUE);
 
-  if (window->subsurface)
-    wl_subsurface_set_position (window->subsurface,
-        window->render_rectangle.x + res.x, window->render_rectangle.y + res.y);
-  wl_viewport_set_destination (window->viewport, res.w, res.h);
+  wl_subsurface_set_position (window->video_subsurface, res.x, res.y);
+  wl_viewport_set_destination (window->video_viewport, res.w, res.h);
 
   if (commit) {
-    wl_surface_damage (window->surface, 0, 0, res.w, res.h);
-    wl_surface_commit (window->surface);
+    wl_surface_damage (window->video_surface, 0, 0, res.w, res.h);
+    wl_surface_commit (window->video_surface);
+  }
+
+  if (gst_wl_window_is_toplevel (window)) {
+    struct wl_region *region;
+
+    region = wl_compositor_create_region (window->display->compositor);
+    wl_region_add (region, 0, 0, window->render_rectangle.w,
+        window->render_rectangle.h);
+    wl_surface_set_input_region (window->area_surface, region);
+    wl_region_destroy (region);
   }
 
   /* this is saved for use in wl_surface_damage */
@@ -210,16 +269,37 @@
 }
 
 void
-gst_wl_window_set_video_info (GstWlWindow * window, GstVideoInfo * info)
+gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
+    const GstVideoInfo * info)
 {
-  g_return_if_fail (window != NULL);
+  if (G_UNLIKELY (info)) {
+    window->video_width =
+        gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d);
+    window->video_height = info->height;
 
-  window->video_width =
-      gst_util_uint64_scale_int_round (info->width, info->par_n, info->par_d);
-  window->video_height = info->height;
+    wl_subsurface_set_sync (window->video_subsurface);
+    gst_wl_window_resize_video_surface (window, FALSE);
+  }
 
-  if (window->render_rectangle.w != 0)
-    gst_wl_window_resize_internal (window, FALSE);
+  if (G_LIKELY (buffer))
+    gst_wl_buffer_attach (buffer, window->video_surface);
+  else
+    wl_surface_attach (window->video_surface, NULL, 0, 0);
+
+  wl_surface_damage (window->video_surface, 0, 0, window->surface_width,
+      window->surface_height);
+  wl_surface_commit (window->video_surface);
+
+  if (G_UNLIKELY (info)) {
+    /* commit also the parent (area_surface) in order to change
+     * the position of the video_subsurface */
+    wl_surface_damage (window->area_surface, 0, 0, window->render_rectangle.w,
+        window->render_rectangle.h);
+    wl_surface_commit (window->area_surface);
+    wl_subsurface_set_desync (window->video_subsurface);
+  }
+
+  wl_display_flush (window->display->display);
 }
 
 void
@@ -233,6 +313,21 @@
   window->render_rectangle.w = w;
   window->render_rectangle.h = h;
 
+  /* position the area inside the parent - needs a parent commit to apply */
+  if (window->area_subsurface)
+    wl_subsurface_set_position (window->area_subsurface, x, y);
+
+  /* change the size of the area */
+  wl_viewport_set_destination (window->area_viewport, w, h);
+
+  if (window->video_width != 0) {
+    wl_subsurface_set_sync (window->video_subsurface);
+    gst_wl_window_resize_video_surface (window, TRUE);
+  }
+
+  wl_surface_damage (window->area_surface, 0, 0, w, h);
+  wl_surface_commit (window->area_surface);
+
   if (window->video_width != 0)
-    gst_wl_window_resize_internal (window, TRUE);
+    wl_subsurface_set_desync (window->video_subsurface);
 }
diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h
index f4cb360..e22cb26 100644
--- a/ext/wayland/wlwindow.h
+++ b/ext/wayland/wlwindow.h
@@ -22,6 +22,7 @@
 #define __GST_WL_WINDOW_H__
 
 #include "wldisplay.h"
+#include "wlbuffer.h"
 #include <gst/video/video.h>
 
 G_BEGIN_DECLS
@@ -41,16 +42,19 @@
   GObject parent_instance;
 
   GstWlDisplay *display;
-  struct wl_surface *surface;
-  struct wl_subsurface *subsurface;
-  struct wl_viewport *viewport;
+  struct wl_surface *area_surface;
+  struct wl_subsurface *area_subsurface;
+  struct wl_viewport *area_viewport;
+  struct wl_surface *video_surface;
+  struct wl_subsurface *video_subsurface;
+  struct wl_viewport *video_viewport;
   struct wl_shell_surface *shell_surface;
 
-  /* the size of the destination area where we are overlaying our subsurface */
+  /* the size and position of the area_(sub)surface */
   GstVideoRectangle render_rectangle;
   /* the size of the video in the buffers */
   gint video_width, video_height;
-  /* the size of the (sub)surface */
+  /* the size of the video_(sub)surface */
   gint surface_width, surface_height;
 };
 
@@ -62,7 +66,7 @@
 GType gst_wl_window_get_type (void);
 
 GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
-        GstVideoInfo * video_info);
+        const GstVideoInfo * info);
 GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
         struct wl_surface * parent);
 
@@ -70,8 +74,8 @@
 struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);
 gboolean gst_wl_window_is_toplevel (GstWlWindow *window);
 
-/* functions to manipulate the size on non-toplevel windows */
-void gst_wl_window_set_video_info (GstWlWindow * window, GstVideoInfo * info);
+void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
+        const GstVideoInfo * info);
 void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
         gint w, gint h);
 
diff --git a/ext/webp/Makefile.am b/ext/webp/Makefile.am
index 25c3557..ece138b 100644
--- a/ext/webp/Makefile.am
+++ b/ext/webp/Makefile.am
@@ -1,9 +1,10 @@
 plugin_LTLIBRARIES = libgstwebp.la
 
-noinst_HEADERS = gstwebpdec.h
+noinst_HEADERS = gstwebpdec.h gstwebpenc.h
 
 libgstwebp_la_SOURCES = gstwebp.c \
-			gstwebpdec.c
+			gstwebpdec.c \
+			gstwebpenc.c
 
 libgstwebp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(WEBP_CFLAGS)
 libgstwebp_la_LIBADD = \
diff --git a/ext/webp/Makefile.in b/ext/webp/Makefile.in
index ff443b0..b40b1e6 100644
--- a/ext/webp/Makefile.in
+++ b/ext/webp/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -158,7 +158,7 @@
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 am_libgstwebp_la_OBJECTS = libgstwebp_la-gstwebp.lo \
-	libgstwebp_la-gstwebpdec.lo
+	libgstwebp_la-gstwebpdec.lo libgstwebp_la-gstwebpenc.lo
 libgstwebp_la_OBJECTS = $(am_libgstwebp_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -727,9 +737,10 @@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
 plugin_LTLIBRARIES = libgstwebp.la
-noinst_HEADERS = gstwebpdec.h
+noinst_HEADERS = gstwebpdec.h gstwebpenc.h
 libgstwebp_la_SOURCES = gstwebp.c \
-			gstwebpdec.c
+			gstwebpdec.c \
+			gstwebpenc.c
 
 libgstwebp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(WEBP_CFLAGS)
 libgstwebp_la_LIBADD = \
@@ -822,6 +833,7 @@
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwebp_la-gstwebp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwebp_la-gstwebpdec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstwebp_la-gstwebpenc.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -861,6 +873,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwebp_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwebp_la_CFLAGS) $(CFLAGS) -c -o libgstwebp_la-gstwebpdec.lo `test -f 'gstwebpdec.c' || echo '$(srcdir)/'`gstwebpdec.c
 
+libgstwebp_la-gstwebpenc.lo: gstwebpenc.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwebp_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwebp_la_CFLAGS) $(CFLAGS) -MT libgstwebp_la-gstwebpenc.lo -MD -MP -MF $(DEPDIR)/libgstwebp_la-gstwebpenc.Tpo -c -o libgstwebp_la-gstwebpenc.lo `test -f 'gstwebpenc.c' || echo '$(srcdir)/'`gstwebpenc.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstwebp_la-gstwebpenc.Tpo $(DEPDIR)/libgstwebp_la-gstwebpenc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstwebpenc.c' object='libgstwebp_la-gstwebpenc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstwebp_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstwebp_la_CFLAGS) $(CFLAGS) -c -o libgstwebp_la-gstwebpenc.lo `test -f 'gstwebpenc.c' || echo '$(srcdir)/'`gstwebpenc.c
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
diff --git a/ext/webp/gstwebp.c b/ext/webp/gstwebp.c
index d0c1831..bd13e65 100644
--- a/ext/webp/gstwebp.c
+++ b/ext/webp/gstwebp.c
@@ -26,11 +26,13 @@
 #include <gst/gst.h>
 
 #include "gstwebpdec.h"
+#include "gstwebpenc.h"
 
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
   gst_webp_dec_register (plugin);
+  gst_webp_enc_register (plugin);
 
   return TRUE;
 }
diff --git a/ext/webp/gstwebpdec.c b/ext/webp/gstwebpdec.c
index 8ffb4ef..585840d 100644
--- a/ext/webp/gstwebpdec.c
+++ b/ext/webp/gstwebpdec.c
@@ -236,13 +236,12 @@
 gst_webp_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
 {
   GstWebPDec *webpdec = (GstWebPDec *) decoder;
-  GstVideoInfo *info = &state->info;
 
   if (webpdec->input_state)
     gst_video_codec_state_unref (webpdec->input_state);
   webpdec->input_state = gst_video_codec_state_ref (state);
 
-  if (GST_VIDEO_INFO_FPS_N (info) != 1 && GST_VIDEO_INFO_FPS_D (info) != 1)
+  if (decoder->input_segment.format == GST_FORMAT_TIME)
     gst_video_decoder_set_packetized (decoder, TRUE);
   else
     gst_video_decoder_set_packetized (decoder, FALSE);
diff --git a/ext/webp/gstwebpdec.h b/ext/webp/gstwebpdec.h
index bf2586e..6b89470 100644
--- a/ext/webp/gstwebpdec.h
+++ b/ext/webp/gstwebpdec.h
@@ -71,4 +71,6 @@
 GType gst_webp_dec_get_type (void);
 gboolean gst_webp_dec_register (GstPlugin * plugin);
 
+G_END_DECLS
+
 #endif /* __GST_WEBP_DEC_H__ */
diff --git a/ext/webp/gstwebpenc.c b/ext/webp/gstwebpenc.c
new file mode 100644
index 0000000..b813e4e
--- /dev/null
+++ b/ext/webp/gstwebpenc.c
@@ -0,0 +1,402 @@
+/* GStreamer
+ * Copyright (C) <2014> Sreerenj Balachandran <sreerenjb@gnome.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include <stdlib.h>             /* free */
+
+#include <gst/video/video.h>
+#include <gst/video/gstvideometa.h>
+
+#include "gstwebpenc.h"
+
+#define GST_CAT_DEFAULT webpenc_debug
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
+
+enum
+{
+  PROP_0,
+  PROP_LOSSLESS,
+  PROP_QUALITY,
+  PROP_SPEED,
+  PROP_PRESET
+};
+
+#define DEFAULT_LOSSLESS FALSE
+#define DEFAULT_QUALITY 90
+#define DEFAULT_SPEED 4
+#define DEFAULT_PRESET WEBP_PRESET_PHOTO
+
+static void gst_webp_enc_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_webp_enc_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static gboolean gst_webp_enc_start (GstVideoEncoder * benc);
+static gboolean gst_webp_enc_stop (GstVideoEncoder * benc);
+static gboolean gst_webp_enc_set_format (GstVideoEncoder * encoder,
+    GstVideoCodecState * state);
+static GstFlowReturn gst_webp_enc_handle_frame (GstVideoEncoder * encoder,
+    GstVideoCodecFrame * frame);
+static gboolean gst_webp_enc_propose_allocation (GstVideoEncoder * encoder,
+    GstQuery * query);
+
+static GstStaticPadTemplate webp_enc_sink_factory =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ I420, YV12, RGB, RGBA}"))
+    );
+static GstStaticPadTemplate webp_enc_src_factory =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("image/webp, "
+        "framerate = (fraction) [0/1, MAX], "
+        "width = (int) [ 16, 16383 ], " "height = (int) [ 16, 16383 ]")
+    );
+
+enum
+{
+  GST_WEBP_PRESET_DEFAULT,
+  GST_WEBP_PRESET_PICTURE,
+  GST_WEBP_PRESET_PHOTO,
+  GST_WEBP_PRESET_DRAWING,
+  GST_WEBP_PRESET_ICON,
+  GST_WEBP_PREET_TEXT
+};
+
+static const GEnumValue preset_values[] = {
+  {GST_WEBP_PRESET_DEFAULT, "Default", "none"},
+  {GST_WEBP_PRESET_PICTURE, "Digital picture,inner shot", "picture"},
+  {GST_WEBP_PRESET_PHOTO, "Outdoor photo, natural lighting", "photo"},
+  {GST_WEBP_PRESET_DRAWING, "Hand or Line drawing", "drawing"},
+  {GST_WEBP_PRESET_ICON, "Small-sized colorful images", "icon"},
+  {GST_WEBP_PREET_TEXT, "text-like", "text"},
+  {0, NULL, NULL},
+};
+
+#define GST_WEBP_ENC_PRESET_TYPE (gst_webp_enc_preset_get_type())
+static GType
+gst_webp_enc_preset_get_type (void)
+{
+  static GType preset_type = 0;
+
+  if (!preset_type) {
+    preset_type = g_enum_register_static ("GstWebpEncPreset", preset_values);
+  }
+  return preset_type;
+}
+
+#define gst_webp_enc_parent_class parent_class
+G_DEFINE_TYPE (GstWebpEnc, gst_webp_enc, GST_TYPE_VIDEO_ENCODER);
+
+static void
+gst_webp_enc_class_init (GstWebpEncClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+  GstVideoEncoderClass *venc_class;
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = (GstElementClass *) klass;
+  venc_class = (GstVideoEncoderClass *) klass;
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class->set_property = gst_webp_enc_set_property;
+  gobject_class->get_property = gst_webp_enc_get_property;
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&webp_enc_sink_factory));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&webp_enc_src_factory));
+  gst_element_class_set_static_metadata (element_class, "WEBP image encoder",
+      "Codec/Encoder/Image",
+      "Encode images in WEBP format",
+      "Sreerenj Balachandran <sreerenjb@gnome.org>");
+
+  venc_class->start = gst_webp_enc_start;
+  venc_class->stop = gst_webp_enc_stop;
+  venc_class->set_format = gst_webp_enc_set_format;
+  venc_class->handle_frame = gst_webp_enc_handle_frame;
+  venc_class->propose_allocation = gst_webp_enc_propose_allocation;
+
+  g_object_class_install_property (gobject_class, PROP_LOSSLESS,
+      g_param_spec_boolean ("lossless", "Lossless",
+          "Enable lossless encoding",
+          DEFAULT_LOSSLESS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_QUALITY,
+      g_param_spec_float ("quality", "quality-level",
+          "quality level, between 0 (smallest file) and 100 (biggest)",
+          0, 100, DEFAULT_QUALITY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SPEED,
+      g_param_spec_uint ("speed", "Compression Method",
+          "quality/speed trade-off (0=fast, 6=slower-better)",
+          0, 6, DEFAULT_SPEED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_PRESET,
+      g_param_spec_enum ("preset", "preset tuning",
+          "Preset name for visual tuning",
+          GST_WEBP_ENC_PRESET_TYPE, DEFAULT_PRESET,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  GST_DEBUG_CATEGORY_INIT (webpenc_debug, "webpenc", 0,
+      "WEBP encoding element");
+}
+
+static void
+gst_webp_enc_init (GstWebpEnc * webpenc)
+{
+  webpenc->lossless = DEFAULT_LOSSLESS;
+  webpenc->quality = DEFAULT_QUALITY;
+  webpenc->speed = DEFAULT_SPEED;
+  webpenc->preset = DEFAULT_PRESET;
+
+  webpenc->use_argb = FALSE;
+  webpenc->rgb_format = GST_VIDEO_FORMAT_UNKNOWN;
+}
+
+static gboolean
+gst_webp_enc_set_format (GstVideoEncoder * encoder, GstVideoCodecState * state)
+{
+  GstWebpEnc *enc = GST_WEBP_ENC (encoder);
+  GstVideoCodecState *output_state;
+  GstVideoInfo *info;
+  GstVideoFormat format;
+
+  info = &state->info;
+  format = GST_VIDEO_INFO_FORMAT (info);
+
+  if (GST_VIDEO_INFO_IS_YUV (info)) {
+    switch (format) {
+      case GST_VIDEO_FORMAT_I420:
+      case GST_VIDEO_FORMAT_YV12:
+        enc->webp_color_space = WEBP_YUV420;
+        break;
+      default:
+        break;
+    }
+  } else {
+    if (GST_VIDEO_INFO_IS_RGB (info)) {
+      enc->rgb_format = format;
+      enc->use_argb = 1;
+    }
+  }
+
+  if (enc->input_state)
+    gst_video_codec_state_unref (enc->input_state);
+  enc->input_state = gst_video_codec_state_ref (state);
+
+  output_state =
+      gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (enc),
+      gst_caps_new_empty_simple ("image/webp"), enc->input_state);
+  gst_video_codec_state_unref (output_state);
+
+  return TRUE;
+}
+
+static gboolean
+gst_webp_set_picture_params (GstWebpEnc * enc)
+{
+  GstVideoInfo *info;
+  gboolean ret = TRUE;
+
+  info = &enc->input_state->info;
+
+  if (!WebPPictureInit (&enc->webp_picture)) {
+    ret = FALSE;
+    goto failed_pic_init;
+  }
+
+  enc->webp_picture.use_argb = enc->use_argb;
+  if (!enc->use_argb)
+    enc->webp_picture.colorspace = enc->webp_color_space;
+
+  enc->webp_picture.width = GST_VIDEO_INFO_WIDTH (info);
+  enc->webp_picture.height = GST_VIDEO_INFO_HEIGHT (info);
+
+  WebPMemoryWriterInit (&enc->webp_writer);
+  enc->webp_picture.writer = WebPMemoryWrite;
+  enc->webp_picture.custom_ptr = &enc->webp_writer;
+
+  return ret;
+
+failed_pic_init:
+  {
+    GST_ERROR_OBJECT (enc, "Failed to Initialize WebPPicture !");
+    return ret;
+  }
+}
+
+static GstFlowReturn
+gst_webp_enc_handle_frame (GstVideoEncoder * encoder,
+    GstVideoCodecFrame * frame)
+{
+  GstWebpEnc *enc = GST_WEBP_ENC (encoder);
+  GstBuffer *out_buffer = NULL;
+  GstVideoFrame vframe;
+
+  GST_LOG_OBJECT (enc, "got new frame");
+
+  gst_webp_set_picture_params (enc);
+
+  if (!gst_video_frame_map (&vframe, &enc->input_state->info,
+          frame->input_buffer, GST_MAP_READ))
+    return GST_FLOW_ERROR;
+
+  if (!enc->use_argb) {
+    enc->webp_picture.y = GST_VIDEO_FRAME_COMP_DATA (&vframe, 0);
+    enc->webp_picture.u = GST_VIDEO_FRAME_COMP_DATA (&vframe, 1);
+    enc->webp_picture.v = GST_VIDEO_FRAME_COMP_DATA (&vframe, 2);
+
+    enc->webp_picture.y_stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, 0);
+    enc->webp_picture.uv_stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, 1);
+
+  } else {
+    switch (enc->rgb_format) {
+      case GST_VIDEO_FORMAT_RGB:
+        WebPPictureImportRGB (&enc->webp_picture,
+            GST_VIDEO_FRAME_COMP_DATA (&vframe, 0),
+            GST_VIDEO_FRAME_COMP_STRIDE (&vframe, 0));
+        break;
+      case GST_VIDEO_FORMAT_RGBA:
+        WebPPictureImportRGBA (&enc->webp_picture,
+            GST_VIDEO_FRAME_COMP_DATA (&vframe, 0),
+            GST_VIDEO_FRAME_COMP_STRIDE (&vframe, 0));
+        break;
+      default:
+        break;
+    }
+  }
+
+  if (WebPEncode (&enc->webp_config, &enc->webp_picture)) {
+    WebPPictureFree (&enc->webp_picture);
+
+    out_buffer = gst_buffer_new_allocate (NULL, enc->webp_writer.size, NULL);
+    if (!out_buffer) {
+      GST_ERROR_OBJECT (enc, "Failed to create output buffer");
+      return GST_FLOW_ERROR;
+    }
+    gst_buffer_fill (out_buffer, 0, enc->webp_writer.mem,
+        enc->webp_writer.size);
+    free (enc->webp_writer.mem);
+  } else {
+    GST_ERROR_OBJECT (enc, "Failed to encode WebPPicture");
+    return GST_FLOW_ERROR;
+  }
+
+  gst_video_frame_unmap (&vframe);
+  frame->output_buffer = out_buffer;
+  return gst_video_encoder_finish_frame (encoder, frame);
+}
+
+static gboolean
+gst_webp_enc_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
+{
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
+  return
+      GST_VIDEO_ENCODER_CLASS (parent_class)->propose_allocation (encoder,
+      query);
+}
+
+static void
+gst_webp_enc_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstWebpEnc *webpenc = GST_WEBP_ENC (object);
+
+  switch (prop_id) {
+    case PROP_LOSSLESS:
+      webpenc->lossless = g_value_get_boolean (value);
+      break;
+    case PROP_QUALITY:
+      webpenc->quality = g_value_get_float (value);
+      break;
+    case PROP_SPEED:
+      webpenc->speed = g_value_get_uint (value);
+      break;
+    case PROP_PRESET:
+      webpenc->preset = g_value_get_enum (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+
+}
+
+static void
+gst_webp_enc_get_property (GObject * object, guint prop_id, GValue * value,
+    GParamSpec * pspec)
+{
+  GstWebpEnc *webpenc = GST_WEBP_ENC (object);
+
+  switch (prop_id) {
+    case PROP_LOSSLESS:
+      g_value_set_boolean (value, webpenc->lossless);
+      break;
+    case PROP_QUALITY:
+      g_value_set_float (value, webpenc->quality);
+      break;
+    case PROP_SPEED:
+      g_value_set_uint (value, webpenc->speed);
+      break;
+    case PROP_PRESET:
+      g_value_set_enum (value, webpenc->preset);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_webp_enc_start (GstVideoEncoder * benc)
+{
+  GstWebpEnc *enc = (GstWebpEnc *) benc;
+
+  if (!WebPConfigPreset (&enc->webp_config, enc->preset, enc->quality)) {
+    GST_ERROR_OBJECT (enc, "Failed to Initialize WebPConfig ");
+    return FALSE;
+  }
+
+  enc->webp_config.lossless = enc->lossless;
+  enc->webp_config.method = enc->speed;
+  if (!WebPValidateConfig (&enc->webp_config)) {
+    GST_ERROR_OBJECT (enc, "Failed to Validate the WebPConfig");
+    return FALSE;
+  }
+  return TRUE;
+}
+
+static gboolean
+gst_webp_enc_stop (GstVideoEncoder * benc)
+{
+  GstWebpEnc *enc = GST_WEBP_ENC (benc);
+  if (enc->input_state)
+    gst_video_codec_state_unref (enc->input_state);
+  return TRUE;
+}
+
+gboolean
+gst_webp_enc_register (GstPlugin * plugin)
+{
+  return gst_element_register (plugin, "webpenc",
+      GST_RANK_PRIMARY, GST_TYPE_WEBP_ENC);
+}
diff --git a/ext/webp/gstwebpenc.h b/ext/webp/gstwebpenc.h
new file mode 100644
index 0000000..be1d11c
--- /dev/null
+++ b/ext/webp/gstwebpenc.h
@@ -0,0 +1,76 @@
+/* GStreamer
+ * Copyright (C) <2014> Sreerenj Balachandran <sreerenjb@gnome.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef __GST_WEBPENC_H__
+#define __GST_WEBPENC_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <webp/encode.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_WEBP_ENC \
+  (gst_webp_enc_get_type())
+#define GST_WEBP_ENC(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBP_ENC,GstWebpEnc))
+#define GST_WEBP_ENC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WEBP_ENC,GstWebpEncClass))
+#define GST_IS_WEBP_ENC(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBP_ENC))
+#define GST_IS_WEBP_ENC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WEBP_ENC))
+
+typedef struct _GstWebpEnc GstWebpEnc;
+typedef struct _GstWebpEncClass GstWebpEncClass;
+
+/**
+ * GstWebpEnc:
+ *
+ * Opaque data structure.
+ */
+struct _GstWebpEnc
+{
+  GstVideoEncoder element;
+
+  GstVideoCodecState *input_state;
+
+  gboolean lossless;
+  gfloat quality;
+  guint speed;
+  gint preset;
+
+  gboolean use_argb;
+  GstVideoFormat rgb_format;
+
+  WebPEncCSP webp_color_space;
+  struct WebPConfig webp_config;
+  struct WebPPicture webp_picture;
+  WebPMemoryWriter webp_writer;
+};
+
+struct _GstWebpEncClass
+{
+  GstVideoEncoderClass parent_class;
+};
+
+GType gst_webp_enc_get_type (void);
+gboolean gst_webp_enc_register (GstPlugin * plugin);
+
+G_END_DECLS
+#endif /* __GST_WEBPENC_H__ */
diff --git a/ext/x265/Makefile.am b/ext/x265/Makefile.am
new file mode 100644
index 0000000..d2a8102
--- /dev/null
+++ b/ext/x265/Makefile.am
@@ -0,0 +1,32 @@
+plugin_LTLIBRARIES = libgstx265.la
+
+libgstx265_la_SOURCES = gstx265enc.c
+libgstx265_la_CFLAGS = \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	$(GST_CFLAGS) \
+	$(X265_CFLAGS)
+libgstx265_la_LIBADD = \
+	$(GST_PLUGINS_BASE_LIBS) \
+	-lgstvideo-$(GST_API_VERSION) \
+	-lgstpbutils-$(GST_API_VERSION) \
+	$(GST_LIBS) \
+	$(X265_LIBS)
+libgstx265_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstx265_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS = gstx265enc.h
+
+Android.mk: Makefile.am $(BUILT_SOURCES)
+	androgenizer \
+	-:PROJECT libgstx265 -:SHARED libgstx265 \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstx265_la_SOURCES) \
+	 -:CPPFLAGS $(CPPFLAGS) \
+	 -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstx265_la_CFLAGS) -I'$$(GSTREAMER_AGGREGATE_TOP)/x265' \
+	 -:LDFLAGS $(libgstx265_la_LDFLAGS) \
+	           $(libgstx265_la_LIBADD) \
+	           -ldl \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+		       LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
+	> $@
diff --git a/ext/mythtv/Makefile.in b/ext/x265/Makefile.in
similarity index 90%
copy from ext/mythtv/Makefile.in
copy to ext/x265/Makefile.in
index 055754c..712244b 100644
--- a/ext/mythtv/Makefile.in
+++ b/ext/x265/Makefile.in
@@ -80,7 +80,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = ext/mythtv
+subdir = ext/x265
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -154,18 +154,18 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstmythtvsrc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
-am_libgstmythtvsrc_la_OBJECTS = libgstmythtvsrc_la-gstmythtvsrc.lo
-libgstmythtvsrc_la_OBJECTS = $(am_libgstmythtvsrc_la_OBJECTS)
+libgstx265_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libgstx265_la_OBJECTS = libgstx265_la-gstx265enc.lo
+libgstx265_la_OBJECTS = $(am_libgstx265_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstmythtvsrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) \
-	$(libgstmythtvsrc_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstx265_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(libgstx265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CCLD) $(libgstx265_la_CFLAGS) $(CFLAGS) \
+	$(libgstx265_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -200,8 +200,8 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstmythtvsrc_la_SOURCES)
-DIST_SOURCES = $(libgstmythtvsrc_la_SOURCES)
+SOURCES = $(libgstx265_la_SOURCES)
+DIST_SOURCES = $(libgstx265_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -724,25 +734,23 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstmythtvsrc.la
-libgstmythtvsrc_la_SOURCES = \
-		gstmythtvsrc.c
-
-libgstmythtvsrc_la_CFLAGS = \
+plugin_LTLIBRARIES = libgstx265.la
+libgstx265_la_SOURCES = gstx265enc.c
+libgstx265_la_CFLAGS = \
+	$(GST_PLUGINS_BASE_CFLAGS) \
 	$(GST_CFLAGS) \
-	$(GMYTH_CFLAGS)
+	$(X265_CFLAGS)
 
-libgstmythtvsrc_la_LDFLAGS = \
-	$(GST_PLUGIN_LDFLAGS)
+libgstx265_la_LIBADD = \
+	$(GST_PLUGINS_BASE_LIBS) \
+	-lgstvideo-$(GST_API_VERSION) \
+	-lgstpbutils-$(GST_API_VERSION) \
+	$(GST_LIBS) \
+	$(X265_LIBS)
 
-libgstmythtvsrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-libgstmythtvsrc_la_LIBADD = \
-	$(GST_BASE_LIBS) \
-	$(GMYTH_LIBS)
-
-noinst_HEADERS = \
-	gstmythtvsrc.h
-
+libgstx265_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstx265_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+noinst_HEADERS = gstx265enc.h
 all: all-am
 
 .SUFFIXES:
@@ -756,9 +764,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/mythtv/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/x265/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu ext/mythtv/Makefile
+	  $(AUTOMAKE) --gnu ext/x265/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -813,8 +821,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstmythtvsrc.la: $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_DEPENDENCIES) $(EXTRA_libgstmythtvsrc_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstmythtvsrc_la_LINK) -rpath $(plugindir) $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_LIBADD) $(LIBS)
+libgstx265.la: $(libgstx265_la_OBJECTS) $(libgstx265_la_DEPENDENCIES) $(EXTRA_libgstx265_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libgstx265_la_LINK) -rpath $(plugindir) $(libgstx265_la_OBJECTS) $(libgstx265_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -822,7 +830,7 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstx265_la-gstx265enc.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -848,12 +856,12 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstmythtvsrc_la-gstmythtvsrc.lo: gstmythtvsrc.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -MT libgstmythtvsrc_la-gstmythtvsrc.lo -MD -MP -MF $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstmythtvsrc.c' object='libgstmythtvsrc_la-gstmythtvsrc.lo' libtool=yes @AMDEPBACKSLASH@
+libgstx265_la-gstx265enc.lo: gstx265enc.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstx265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstx265_la_CFLAGS) $(CFLAGS) -MT libgstx265_la-gstx265enc.lo -MD -MP -MF $(DEPDIR)/libgstx265_la-gstx265enc.Tpo -c -o libgstx265_la-gstx265enc.lo `test -f 'gstx265enc.c' || echo '$(srcdir)/'`gstx265enc.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstx265_la-gstx265enc.Tpo $(DEPDIR)/libgstx265_la-gstx265enc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstx265enc.c' object='libgstx265_la-gstx265enc.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstx265_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstx265_la_CFLAGS) $(CFLAGS) -c -o libgstx265_la-gstx265enc.lo `test -f 'gstx265enc.c' || echo '$(srcdir)/'`gstx265enc.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -1069,6 +1077,21 @@
 	uninstall-pluginLTLIBRARIES
 
 
+Android.mk: Makefile.am $(BUILT_SOURCES)
+	androgenizer \
+	-:PROJECT libgstx265 -:SHARED libgstx265 \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstx265_la_SOURCES) \
+	 -:CPPFLAGS $(CPPFLAGS) \
+	 -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstx265_la_CFLAGS) -I'$$(GSTREAMER_AGGREGATE_TOP)/x265' \
+	 -:LDFLAGS $(libgstx265_la_LDFLAGS) \
+	           $(libgstx265_la_LIBADD) \
+	           -ldl \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+		       LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
+	> $@
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/ext/x265/gstx265enc.c b/ext/x265/gstx265enc.c
new file mode 100644
index 0000000..39b0fb2
--- /dev/null
+++ b/ext/x265/gstx265enc.c
@@ -0,0 +1,1239 @@
+/* GStreamer H265 encoder plugin
+ * Copyright (C) 2005 Michal Benes <michal.benes@itonis.tv>
+ * Copyright (C) 2005 Josef Zlomek <josef.zlomek@itonis.tv>
+ * Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sf.net>
+ * Copyright (C) 2014 Thijs Vermeir <thijs.vermeir@barco.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:element-x265enc
+ *
+ * This element encodes raw video into H265 compressed data.
+ *
+ **/
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "gstx265enc.h"
+
+#include <gst/pbutils/pbutils.h>
+#include <gst/video/video.h>
+#include <gst/video/gstvideometa.h>
+#include <gst/video/gstvideopool.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+GST_DEBUG_CATEGORY_STATIC (x265_enc_debug);
+#define GST_CAT_DEFAULT x265_enc_debug
+
+enum
+{
+  PROP_0,
+  PROP_BITRATE,
+  PROP_QP,
+  PROP_OPTION_STRING,
+  PROP_X265_LOG_LEVEL,
+  PROP_SPEED_PRESET,
+  PROP_TUNE
+};
+
+static GString *x265enc_defaults;
+
+#define PROP_BITRATE_DEFAULT            (2 * 1024)
+#define PROP_QP_DEFAULT                 -1
+#define PROP_OPTION_STRING_DEFAULT      ""
+#define PROP_LOG_LEVEL_DEFAULT           -1     // None
+#define PROP_SPEED_PRESET_DEFAULT        6      // Medium
+#define PROP_TUNE_DEFAULT                2      // SSIM
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define FORMATS "I420, Y444, I420_10LE, Y444_10LE"
+#else
+#define FORMATS "I420, Y444, I420_10BE, Y444_10BE"
+#endif
+
+#define GST_X265_ENC_LOG_LEVEL_TYPE (gst_x265_enc_log_level_get_type())
+static GType
+gst_x265_enc_log_level_get_type (void)
+{
+  static GType log_level = 0;
+
+  static const GEnumValue log_levels[] = {
+    {X265_LOG_NONE, "No logging", "none"},
+    {X265_LOG_ERROR, "Error", "error"},
+    {X265_LOG_WARNING, "Warning", "warning"},
+    {X265_LOG_INFO, "Info", "info"},
+    {X265_LOG_DEBUG, "Debug", "debug"},
+    {X265_LOG_FULL, "Full", "full"},
+    {0, NULL, NULL}
+  };
+
+  if (!log_level) {
+    log_level = g_enum_register_static ("GstX265LogLevel", log_levels);
+  }
+  return log_level;
+}
+
+#define GST_X265_ENC_SPEED_PRESET_TYPE (gst_x265_enc_speed_preset_get_type())
+static GType
+gst_x265_enc_speed_preset_get_type (void)
+{
+  static GType speed_preset = 0;
+  static GEnumValue *speed_presets;
+  int n, i;
+
+  if (speed_preset != 0)
+    return speed_preset;
+
+  n = 0;
+  while (x265_preset_names[n] != NULL)
+    n++;
+
+  speed_presets = g_new0 (GEnumValue, n + 2);
+
+  speed_presets[0].value = 0;
+  speed_presets[0].value_name = "No preset";
+  speed_presets[0].value_nick = "No preset";
+
+  for (i = 0; i < n; i++) {
+    speed_presets[i + 1].value = i + 1;
+    speed_presets[i + 1].value_name = x265_preset_names[i];
+    speed_presets[i + 1].value_nick = x265_preset_names[i];
+  }
+
+  speed_preset = g_enum_register_static ("GstX265SpeedPreset", speed_presets);
+
+  return speed_preset;
+}
+
+#define GST_X265_ENC_TUNE_TYPE (gst_x265_enc_tune_get_type())
+static GType
+gst_x265_enc_tune_get_type (void)
+{
+  static GType tune = 0;
+  static GEnumValue *tune_values;
+  int n, i;
+
+  if (tune != 0)
+    return tune;
+
+  n = 0;
+  while (x265_tune_names[n] != NULL)
+    n++;
+
+  tune_values = g_new0 (GEnumValue, n + 2);
+
+  tune_values[0].value = 0;
+  tune_values[0].value_name = "No tunning";
+  tune_values[0].value_nick = "No tunning";
+
+  for (i = 0; i < n; i++) {
+    tune_values[i + 1].value = i + 1;
+    tune_values[i + 1].value_name = x265_tune_names[i];
+    tune_values[i + 1].value_nick = x265_tune_names[i];
+  }
+
+  tune = g_enum_register_static ("GstX265Tune", tune_values);
+
+  return tune;
+}
+
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw, "
+        "format = (string) { " FORMATS " }, "
+        "framerate = (fraction) [0, MAX], "
+        "width = (int) [ 4, MAX ], " "height = (int) [ 4, MAX ]")
+    );
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-h265, "
+        "framerate = (fraction) [0/1, MAX], "
+        "width = (int) [ 4, MAX ], " "height = (int) [ 4, MAX ], "
+        "stream-format = (string) { avc, byte-stream }, "
+        "alignment = (string) au, " "profile = (string) { main }")
+    );
+
+static void gst_x265_enc_finalize (GObject * object);
+static gboolean gst_x265_enc_start (GstVideoEncoder * encoder);
+static gboolean gst_x265_enc_stop (GstVideoEncoder * encoder);
+static gboolean gst_x265_enc_flush (GstVideoEncoder * encoder);
+
+static gboolean gst_x265_enc_init_encoder (GstX265Enc * encoder);
+static void gst_x265_enc_close_encoder (GstX265Enc * encoder);
+
+static GstFlowReturn gst_x265_enc_finish (GstVideoEncoder * encoder);
+static GstFlowReturn gst_x265_enc_handle_frame (GstVideoEncoder * encoder,
+    GstVideoCodecFrame * frame);
+static void gst_x265_enc_flush_frames (GstX265Enc * encoder, gboolean send);
+static GstFlowReturn gst_x265_enc_encode_frame (GstX265Enc * encoder,
+    x265_picture * pic_in, GstVideoCodecFrame * input_frame, guint32 * i_nal,
+    gboolean send);
+static gboolean gst_x265_enc_set_format (GstVideoEncoder * video_enc,
+    GstVideoCodecState * state);
+static gboolean gst_x265_enc_propose_allocation (GstVideoEncoder * encoder,
+    GstQuery * query);
+
+static void gst_x265_enc_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_x265_enc_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+#define gst_x265_enc_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstX265Enc, gst_x265_enc, GST_TYPE_VIDEO_ENCODER,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
+
+static void
+set_value (GValue * val, gint count, ...)
+{
+  const gchar *fmt = NULL;
+  GValue sval = G_VALUE_INIT;
+  va_list ap;
+  gint i;
+
+  g_value_init (&sval, G_TYPE_STRING);
+
+  if (count > 1)
+    g_value_init (val, GST_TYPE_LIST);
+
+  va_start (ap, count);
+  for (i = 0; i < count; i++) {
+    fmt = va_arg (ap, const gchar *);
+    g_value_set_string (&sval, fmt);
+    if (count > 1) {
+      gst_value_list_append_value (val, &sval);
+    }
+  }
+  va_end (ap);
+
+  if (count == 1)
+    *val = sval;
+  else
+    g_value_unset (&sval);
+}
+
+static void
+gst_x265_enc_add_x265_chroma_format (GstStructure * s,
+    int x265_chroma_format_local)
+{
+  GValue fmt = G_VALUE_INIT;
+
+  if (x265_max_bit_depth >= 10) {
+    GST_INFO ("This x265 build supports %d-bit depth", x265_max_bit_depth);
+    if (x265_chroma_format_local == 0) {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+      set_value (&fmt, 4, "I420", "Y444", "I420_10LE", "Y444_10LE");
+#else
+      set_value (&fmt, 4, "I420", "Y444", "I420_10BE", "Y444_10BE");
+#endif
+    } else if (x265_chroma_format_local == X265_CSP_I444) {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+      set_value (&fmt, 2, "Y444", "Y444_10LE");
+#else
+      set_value (&fmt, 2, "Y444", "Y444_10BE");
+#endif
+    } else if (x265_chroma_format_local == X265_CSP_I420) {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+      set_value (&fmt, 2, "I420", "I420_10LE");
+#else
+      set_value (&fmt, 2, "I420", "I420_10BE");
+#endif
+    } else {
+      GST_ERROR ("Unsupported chroma format %d", x265_chroma_format_local);
+    }
+  } else if (x265_max_bit_depth == 8) {
+    GST_INFO ("This x265 build supports 8-bit depth");
+    if (x265_chroma_format_local == 0) {
+      set_value (&fmt, 2, "I420", "Y444");
+    } else if (x265_chroma_format_local == X265_CSP_I444) {
+      set_value (&fmt, 1, "Y444");
+    } else if (x265_chroma_format_local == X265_CSP_I420) {
+      set_value (&fmt, 1, "I420");
+    } else {
+      GST_ERROR ("Unsupported chroma format %d", x265_chroma_format_local);
+    }
+  }
+
+  if (G_VALUE_TYPE (&fmt) != G_TYPE_INVALID)
+    gst_structure_take_value (s, "format", &fmt);
+}
+
+static GstCaps *
+gst_x265_enc_get_supported_input_caps (void)
+{
+  GstCaps *caps;
+  int x265_chroma_format = 0;
+
+  caps = gst_caps_new_simple ("video/x-raw",
+      "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1,
+      "width", GST_TYPE_INT_RANGE, 4, G_MAXINT,
+      "height", GST_TYPE_INT_RANGE, 4, G_MAXINT, NULL);
+
+  gst_x265_enc_add_x265_chroma_format (gst_caps_get_structure (caps, 0),
+      x265_chroma_format);
+
+  GST_DEBUG ("returning %" GST_PTR_FORMAT, caps);
+  return caps;
+}
+
+static GstCaps *
+gst_x265_enc_sink_getcaps (GstVideoEncoder * enc, GstCaps * filter)
+{
+  GstCaps *supported_incaps;
+  GstCaps *ret;
+
+  supported_incaps = gst_x265_enc_get_supported_input_caps ();
+
+  ret = gst_video_encoder_proxy_getcaps (enc, supported_incaps, filter);
+  if (supported_incaps)
+    gst_caps_unref (supported_incaps);
+  return ret;
+}
+
+static void
+gst_x265_enc_class_init (GstX265EncClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+  GstVideoEncoderClass *gstencoder_class;
+
+  x265enc_defaults = g_string_new ("");
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  element_class = GST_ELEMENT_CLASS (klass);
+  gstencoder_class = GST_VIDEO_ENCODER_CLASS (klass);
+
+  gobject_class->set_property = gst_x265_enc_set_property;
+  gobject_class->get_property = gst_x265_enc_get_property;
+  gobject_class->finalize = gst_x265_enc_finalize;
+
+  gstencoder_class->set_format = GST_DEBUG_FUNCPTR (gst_x265_enc_set_format);
+  gstencoder_class->handle_frame =
+      GST_DEBUG_FUNCPTR (gst_x265_enc_handle_frame);
+  gstencoder_class->start = GST_DEBUG_FUNCPTR (gst_x265_enc_start);
+  gstencoder_class->stop = GST_DEBUG_FUNCPTR (gst_x265_enc_stop);
+  gstencoder_class->flush = GST_DEBUG_FUNCPTR (gst_x265_enc_flush);
+  gstencoder_class->finish = GST_DEBUG_FUNCPTR (gst_x265_enc_finish);
+  gstencoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_x265_enc_sink_getcaps);
+  gstencoder_class->propose_allocation =
+      GST_DEBUG_FUNCPTR (gst_x265_enc_propose_allocation);
+
+  g_object_class_install_property (gobject_class, PROP_BITRATE,
+      g_param_spec_uint ("bitrate", "Bitrate", "Bitrate in kbit/sec", 1,
+          100 * 1024, PROP_BITRATE_DEFAULT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+          GST_PARAM_MUTABLE_PLAYING));
+
+  g_object_class_install_property (gobject_class, PROP_QP,
+      g_param_spec_int ("qp", "Quantization parameter",
+          "QP for P slices in (implied) CQP mode (-1 = disabled)", -1,
+          51, PROP_QP_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_OPTION_STRING,
+      g_param_spec_string ("option-string", "Option string",
+          "String of x264 options (overridden by element properties)",
+          PROP_OPTION_STRING_DEFAULT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_X265_LOG_LEVEL,
+      g_param_spec_enum ("log-level", "(internal) x265 log level",
+          "x265 log level", GST_X265_ENC_LOG_LEVEL_TYPE,
+          PROP_LOG_LEVEL_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_SPEED_PRESET,
+      g_param_spec_enum ("speed-preset", "Speed preset",
+          "Preset name for speed/quality tradeoff options",
+          GST_X265_ENC_SPEED_PRESET_TYPE, PROP_SPEED_PRESET_DEFAULT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_TUNE,
+      g_param_spec_enum ("tune", "Tune options",
+          "Preset name for tuning options", GST_X265_ENC_TUNE_TYPE,
+          PROP_TUNE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gst_element_class_set_static_metadata (element_class,
+      "x265enc", "Codec/Encoder/Video", "H265 Encoder",
+      "Thijs Vermeir <thijs.vermeir@barco.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_factory));
+}
+
+/* initialize the new element
+ * instantiate pads and add them to element
+ * set functions
+ * initialize structure
+ */
+static void
+gst_x265_enc_init (GstX265Enc * encoder)
+{
+  x265_param_default (&encoder->x265param);
+
+  encoder->push_header = TRUE;
+
+  encoder->bitrate = PROP_BITRATE_DEFAULT;
+  encoder->qp = PROP_QP_DEFAULT;
+  encoder->option_string_prop = g_string_new (PROP_OPTION_STRING_DEFAULT);
+  encoder->log_level = PROP_LOG_LEVEL_DEFAULT;
+  encoder->speed_preset = PROP_SPEED_PRESET_DEFAULT;
+  encoder->tune = PROP_TUNE_DEFAULT;
+}
+
+typedef struct
+{
+  GstVideoCodecFrame *frame;
+  GstVideoFrame vframe;
+} FrameData;
+
+static FrameData *
+gst_x265_enc_queue_frame (GstX265Enc * enc, GstVideoCodecFrame * frame,
+    GstVideoInfo * info)
+{
+  GstVideoFrame vframe;
+  FrameData *fdata;
+
+  if (!gst_video_frame_map (&vframe, info, frame->input_buffer, GST_MAP_READ))
+    return NULL;
+
+  fdata = g_slice_new (FrameData);
+  fdata->frame = gst_video_codec_frame_ref (frame);
+  fdata->vframe = vframe;
+
+  enc->pending_frames = g_list_prepend (enc->pending_frames, fdata);
+
+  return fdata;
+}
+
+static void
+gst_x265_enc_dequeue_frame (GstX265Enc * enc, GstVideoCodecFrame * frame)
+{
+  GList *l;
+
+  for (l = enc->pending_frames; l; l = l->next) {
+    FrameData *fdata = l->data;
+
+    if (fdata->frame != frame)
+      continue;
+
+    gst_video_frame_unmap (&fdata->vframe);
+    gst_video_codec_frame_unref (fdata->frame);
+    g_slice_free (FrameData, fdata);
+
+    enc->pending_frames = g_list_delete_link (enc->pending_frames, l);
+    return;
+  }
+}
+
+static void
+gst_x265_enc_dequeue_all_frames (GstX265Enc * enc)
+{
+  GList *l;
+
+  for (l = enc->pending_frames; l; l = l->next) {
+    FrameData *fdata = l->data;
+
+    gst_video_frame_unmap (&fdata->vframe);
+    gst_video_codec_frame_unref (fdata->frame);
+    g_slice_free (FrameData, fdata);
+  }
+  g_list_free (enc->pending_frames);
+  enc->pending_frames = NULL;
+}
+
+static gboolean
+gst_x265_enc_start (GstVideoEncoder * encoder)
+{
+  //GstX265Enc *x265enc = GST_X265_ENC (encoder);
+
+  return TRUE;
+}
+
+static gboolean
+gst_x265_enc_stop (GstVideoEncoder * encoder)
+{
+  GstX265Enc *x265enc = GST_X265_ENC (encoder);
+
+  GST_DEBUG_OBJECT (encoder, "stop encoder");
+
+  gst_x265_enc_flush_frames (x265enc, FALSE);
+  gst_x265_enc_close_encoder (x265enc);
+  gst_x265_enc_dequeue_all_frames (x265enc);
+
+  if (x265enc->input_state)
+    gst_video_codec_state_unref (x265enc->input_state);
+  x265enc->input_state = NULL;
+
+  return TRUE;
+}
+
+
+static gboolean
+gst_x265_enc_flush (GstVideoEncoder * encoder)
+{
+  GstX265Enc *x265enc = GST_X265_ENC (encoder);
+
+  GST_DEBUG_OBJECT (encoder, "flushing encoder");
+
+  gst_x265_enc_flush_frames (x265enc, FALSE);
+  gst_x265_enc_close_encoder (x265enc);
+  gst_x265_enc_dequeue_all_frames (x265enc);
+
+  gst_x265_enc_init_encoder (x265enc);
+
+  return TRUE;
+}
+
+static void
+gst_x265_enc_finalize (GObject * object)
+{
+  GstX265Enc *encoder = GST_X265_ENC (object);
+
+  if (encoder->input_state)
+    gst_video_codec_state_unref (encoder->input_state);
+  encoder->input_state = NULL;
+
+  gst_x265_enc_close_encoder (encoder);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gint
+gst_x265_enc_gst_to_x265_video_format (GstVideoFormat format, gint * nplanes)
+{
+  switch (format) {
+    case GST_VIDEO_FORMAT_I420:
+    case GST_VIDEO_FORMAT_YV12:
+    case GST_VIDEO_FORMAT_I420_10LE:
+    case GST_VIDEO_FORMAT_I420_10BE:
+      if (nplanes)
+        *nplanes = 3;
+      return X265_CSP_I420;
+    case GST_VIDEO_FORMAT_Y444:
+    case GST_VIDEO_FORMAT_Y444_10LE:
+    case GST_VIDEO_FORMAT_Y444_10BE:
+      if (nplanes)
+        *nplanes = 3;
+      return X265_CSP_I444;
+    default:
+      g_return_val_if_reached (GST_VIDEO_FORMAT_UNKNOWN);
+  }
+}
+
+/*
+ * gst_x265_enc_parse_options
+ * @encoder: Encoder to which options are assigned
+ * @str: Option string
+ *
+ * Parse option string and assign to x265 parameters
+ *
+ */
+static gboolean
+gst_x265_enc_parse_options (GstX265Enc * encoder, const gchar * str)
+{
+  GStrv kvpairs;
+  guint npairs, i;
+  gint parse_result = 0, ret = 0;
+  gchar *options = (gchar *) str;
+
+  while (*options == ':')
+    options++;
+
+  kvpairs = g_strsplit (options, ":", 0);
+  npairs = g_strv_length (kvpairs);
+
+  for (i = 0; i < npairs; i++) {
+    GStrv key_val = g_strsplit (kvpairs[i], "=", 2);
+
+    parse_result =
+        x265_param_parse (&encoder->x265param, key_val[0], key_val[1]);
+
+    if (parse_result == X265_PARAM_BAD_NAME) {
+      GST_ERROR_OBJECT (encoder, "Bad name for option %s=%s",
+          key_val[0] ? key_val[0] : "", key_val[1] ? key_val[1] : "");
+    }
+    if (parse_result == X265_PARAM_BAD_VALUE) {
+      GST_ERROR_OBJECT (encoder,
+          "Bad value for option %s=%s (Note: a NULL value for a non-boolean triggers this)",
+          key_val[0] ? key_val[0] : "", key_val[1] ? key_val[1] : "");
+    }
+
+    g_strfreev (key_val);
+
+    if (parse_result)
+      ret++;
+  }
+
+  g_strfreev (kvpairs);
+  return !ret;
+}
+
+/*
+ * gst_x265_enc_init_encoder
+ * @encoder:  Encoder which should be initialized.
+ *
+ * Initialize x265 encoder.
+ *
+ */
+static gboolean
+gst_x265_enc_init_encoder (GstX265Enc * encoder)
+{
+  GstVideoInfo *info;
+
+  if (!encoder->input_state) {
+    GST_DEBUG_OBJECT (encoder, "Have no input state yet");
+    return FALSE;
+  }
+
+  info = &encoder->input_state->info;
+
+  /* make sure that the encoder is closed */
+  gst_x265_enc_close_encoder (encoder);
+
+  GST_OBJECT_LOCK (encoder);
+
+  if (x265_param_default_preset (&encoder->x265param,
+          x265_preset_names[encoder->speed_preset - 1],
+          x265_tune_names[encoder->tune]) < 0) {
+    GST_DEBUG_OBJECT (encoder, "preset or tune unrecognized");
+    GST_OBJECT_UNLOCK (encoder);
+    return FALSE;
+  }
+
+  /* set up encoder parameters */
+  encoder->x265param.logLevel = encoder->log_level;
+  encoder->x265param.internalCsp =
+      gst_x265_enc_gst_to_x265_video_format (info->finfo->format, NULL);
+  if (info->fps_d == 0 || info->fps_n == 0) {
+  } else {
+    encoder->x265param.fpsNum = info->fps_n;
+    encoder->x265param.fpsDenom = info->fps_d;
+  }
+  encoder->x265param.sourceWidth = info->width;
+  encoder->x265param.sourceHeight = info->height;
+  if (info->par_d > 0) {
+    encoder->x265param.vui.sarWidth = info->par_n;
+    encoder->x265param.vui.sarHeight = info->par_d;
+  }
+
+  if (encoder->qp != -1) {
+    /* CQP */
+    encoder->x265param.rc.qp = encoder->qp;
+    encoder->x265param.rc.rateControlMode = X265_RC_CQP;
+  } else {
+    /* ABR */
+    encoder->x265param.rc.bitrate = encoder->bitrate;
+    encoder->x265param.rc.rateControlMode = X265_RC_ABR;
+  }
+
+  /* apply option-string property */
+  if (encoder->option_string_prop && encoder->option_string_prop->len) {
+    GST_DEBUG_OBJECT (encoder, "Applying option-string: %s",
+        encoder->option_string_prop->str);
+    if (gst_x265_enc_parse_options (encoder,
+            encoder->option_string_prop->str) == FALSE) {
+      GST_DEBUG_OBJECT (encoder, "Your option-string contains errors.");
+      GST_OBJECT_UNLOCK (encoder);
+      return FALSE;
+    }
+  }
+
+  encoder->reconfig = FALSE;
+
+  /* good start, will be corrected if needed */
+  encoder->dts_offset = 0;
+
+  GST_OBJECT_UNLOCK (encoder);
+
+  encoder->x265enc = x265_encoder_open (&encoder->x265param);
+  if (!encoder->x265enc) {
+    GST_ELEMENT_ERROR (encoder, STREAM, ENCODE,
+        ("Can not initialize x265 encoder."), (NULL));
+    return FALSE;
+  }
+
+  encoder->push_header = TRUE;
+
+  return TRUE;
+}
+
+/* gst_x265_enc_close_encoder
+ * @encoder:  Encoder which should close.
+ *
+ * Close x265 encoder.
+ */
+static void
+gst_x265_enc_close_encoder (GstX265Enc * encoder)
+{
+  if (encoder->x265enc != NULL) {
+    x265_encoder_close (encoder->x265enc);
+    encoder->x265enc = NULL;
+  }
+}
+
+static x265_nal *
+gst_x265_enc_bytestream_to_nal (x265_nal * input)
+{
+  x265_nal *output;
+  int i, j, zeros;
+
+  output = g_malloc (sizeof (x265_nal));
+  output->payload = g_malloc (input->sizeBytes - 4);
+  output->sizeBytes = input->sizeBytes - 4;
+  output->type = input->type;
+
+  zeros = 0;
+  for (i = 4, j = 0; i < input->sizeBytes; (i++, j++)) {
+    if (input->payload[i] == 0x00) {
+      zeros++;
+    } else if (input->payload[i] == 0x03 && zeros == 2) {
+      zeros = 0;
+      j--;
+      output->sizeBytes--;
+      continue;
+    } else {
+      zeros = 0;
+    }
+    output->payload[j] = input->payload[i];
+  }
+
+  return output;
+}
+
+static void
+x265_nal_free (x265_nal * nal)
+{
+  g_free (nal->payload);
+  g_free (nal);
+}
+
+static gboolean
+gst_x265_enc_set_level_tier_and_profile (GstX265Enc * encoder, GstCaps * caps)
+{
+  x265_nal *nal, *vps_nal;
+  guint32 i_nal;
+  int header_return;
+
+  GST_DEBUG_OBJECT (encoder, "set profile, level and tier");
+
+  header_return = x265_encoder_headers (encoder->x265enc, &nal, &i_nal);
+  if (header_return < 0) {
+    GST_ELEMENT_ERROR (encoder, STREAM, ENCODE, ("Encode x265 header failed."),
+        ("x265_encoder_headers return code=%d", header_return));
+    return FALSE;
+  }
+
+  GST_DEBUG_OBJECT (encoder, "%d nal units in header", i_nal);
+
+  g_assert (nal[0].type == NAL_UNIT_VPS);
+  vps_nal = gst_x265_enc_bytestream_to_nal (&nal[0]);
+
+  GST_MEMDUMP ("VPS", vps_nal->payload, vps_nal->sizeBytes);
+
+  if (!gst_codec_utils_h265_caps_set_level_tier_and_profile (caps,
+          vps_nal->payload + 6, vps_nal->sizeBytes - 6)) {
+    GST_ELEMENT_ERROR (encoder, STREAM, ENCODE, ("Encode x265 failed."),
+        ("Failed to find correct level, tier or profile in VPS"));
+    return FALSE;
+  }
+
+  x265_nal_free (vps_nal);
+
+  return TRUE;
+}
+
+static GstBuffer *
+gst_x265_enc_get_header_buffer (GstX265Enc * encoder)
+{
+  x265_nal *nal;
+  guint32 i_nal, i, offset, vps_idx;
+  int header_return;
+  GstBuffer *buf;
+
+  header_return = x265_encoder_headers (encoder->x265enc, &nal, &i_nal);
+  if (header_return < 0) {
+    GST_ELEMENT_ERROR (encoder, STREAM, ENCODE, ("Encode x265 header failed."),
+        ("x265_encoder_headers return code=%d", header_return));
+    return FALSE;
+  }
+
+  GST_DEBUG_OBJECT (encoder, "%d nal units in header", i_nal);
+
+  /* x265 returns also non header nal units with the call x265_encoder_headers.
+   * The usefull headers are sequential (VPS, SPS and PPS), so we look for this
+   * nal units and only copy these tree nal units as the header */
+
+  for (vps_idx = 0; vps_idx < i_nal; vps_idx++) {
+    if (nal[vps_idx].type == 32) {
+      break;
+    }
+  }
+
+  if (vps_idx >= i_nal - 3) {
+    GST_ELEMENT_ERROR (encoder, STREAM, ENCODE, ("Encode x265 header failed."),
+        ("x265_encoder_headers did not return VPS, SPS and PPS"));
+    return FALSE;
+  }
+
+  offset = 0;
+  buf =
+      gst_buffer_new_allocate (NULL,
+      nal[vps_idx].sizeBytes + nal[vps_idx + 1].sizeBytes + nal[vps_idx +
+          2].sizeBytes, NULL);
+  for (i = 0; i < i_nal; i++) {
+    gst_buffer_fill (buf, offset, nal[i + vps_idx].payload,
+        nal[i + vps_idx].sizeBytes);
+    offset += nal[i + vps_idx].sizeBytes;
+  }
+
+  return buf;
+}
+
+/* gst_x265_enc_set_src_caps
+ * Returns: TRUE on success.
+ */
+static gboolean
+gst_x265_enc_set_src_caps (GstX265Enc * encoder, GstCaps * caps)
+{
+  GstCaps *outcaps;
+  GstStructure *structure;
+  GstVideoCodecState *state;
+  GstTagList *tags;
+
+  outcaps = gst_caps_new_empty_simple ("video/x-h265");
+  structure = gst_caps_get_structure (outcaps, 0);
+
+  gst_structure_set (structure, "stream-format", G_TYPE_STRING, "byte-stream",
+      NULL);
+  gst_structure_set (structure, "alignment", G_TYPE_STRING, "au", NULL);
+
+  if (!gst_x265_enc_set_level_tier_and_profile (encoder, outcaps)) {
+    gst_caps_unref (outcaps);
+    return FALSE;
+  }
+
+  state = gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (encoder),
+      outcaps, encoder->input_state);
+  GST_DEBUG_OBJECT (encoder, "output caps: %" GST_PTR_FORMAT, state->caps);
+  gst_video_codec_state_unref (state);
+
+  tags = gst_tag_list_new_empty ();
+  gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_ENCODER, "x265",
+      GST_TAG_ENCODER_VERSION, x265_version_str, NULL);
+  gst_video_encoder_merge_tags (GST_VIDEO_ENCODER (encoder), tags,
+      GST_TAG_MERGE_REPLACE);
+  gst_tag_list_unref (tags);
+
+  return TRUE;
+}
+
+static void
+gst_x265_enc_set_latency (GstX265Enc * encoder)
+{
+  GstVideoInfo *info = &encoder->input_state->info;
+  gint max_delayed_frames;
+  GstClockTime latency;
+
+  /* FIXME get a real value from the encoder, this is currently not exposed */
+  if (encoder->tune > 0 && encoder->tune <= G_N_ELEMENTS (x265_tune_names) &&
+      strcmp (x265_tune_names[encoder->tune + 1], "zerolatency") == 0)
+    max_delayed_frames = 0;
+  else
+    max_delayed_frames = 5;
+
+  if (info->fps_n) {
+    latency = gst_util_uint64_scale_ceil (GST_SECOND * info->fps_d,
+        max_delayed_frames, info->fps_n);
+  } else {
+    /* FIXME: Assume 25fps. This is better than reporting no latency at
+     * all and then later failing in live pipelines
+     */
+    latency = gst_util_uint64_scale_ceil (GST_SECOND * 1,
+        max_delayed_frames, 25);
+  }
+
+  GST_INFO_OBJECT (encoder,
+      "Updating latency to %" GST_TIME_FORMAT " (%d frames)",
+      GST_TIME_ARGS (latency), max_delayed_frames);
+
+  gst_video_encoder_set_latency (GST_VIDEO_ENCODER (encoder), latency, latency);
+}
+
+static gboolean
+gst_x265_enc_set_format (GstVideoEncoder * video_enc,
+    GstVideoCodecState * state)
+{
+  GstX265Enc *encoder = GST_X265_ENC (video_enc);
+  GstVideoInfo *info = &state->info;
+  gboolean level_ok = TRUE;
+
+  /* If the encoder is initialized, do not reinitialize it again if not
+   * necessary */
+  if (encoder->x265enc) {
+    GstVideoInfo *old = &encoder->input_state->info;
+
+    if (info->finfo->format == old->finfo->format
+        && info->width == old->width && info->height == old->height
+        && info->fps_n == old->fps_n && info->fps_d == old->fps_d
+        && info->par_n == old->par_n && info->par_d == old->par_d) {
+      gst_video_codec_state_unref (encoder->input_state);
+      encoder->input_state = gst_video_codec_state_ref (state);
+      return TRUE;
+    }
+
+    /* clear out pending frames */
+    gst_x265_enc_flush_frames (encoder, TRUE);
+  }
+
+  if (encoder->input_state)
+    gst_video_codec_state_unref (encoder->input_state);
+  encoder->input_state = gst_video_codec_state_ref (state);
+
+  if (!level_ok)
+    return FALSE;
+
+  if (!gst_x265_enc_init_encoder (encoder))
+    return FALSE;
+
+  if (!gst_x265_enc_set_src_caps (encoder, state->caps)) {
+    gst_x265_enc_close_encoder (encoder);
+    return FALSE;
+  }
+
+  gst_x265_enc_set_latency (encoder);
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_x265_enc_finish (GstVideoEncoder * encoder)
+{
+  GST_DEBUG_OBJECT (encoder, "finish encoder");
+
+  gst_x265_enc_flush_frames (GST_X265_ENC (encoder), TRUE);
+  gst_x265_enc_flush_frames (GST_X265_ENC (encoder), TRUE);
+  return GST_FLOW_OK;
+}
+
+static gboolean
+gst_x265_enc_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
+{
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
+
+  return GST_VIDEO_ENCODER_CLASS (parent_class)->propose_allocation (encoder,
+      query);
+}
+
+/* chain function
+ * this function does the actual processing
+ */
+static GstFlowReturn
+gst_x265_enc_handle_frame (GstVideoEncoder * video_enc,
+    GstVideoCodecFrame * frame)
+{
+  GstX265Enc *encoder = GST_X265_ENC (video_enc);
+  GstVideoInfo *info = &encoder->input_state->info;
+  GstFlowReturn ret;
+  x265_picture pic_in;
+  guint32 i_nal, i;
+  FrameData *fdata;
+  gint nplanes = 0;
+
+  if (G_UNLIKELY (encoder->x265enc == NULL))
+    goto not_inited;
+
+  /* set up input picture */
+  x265_picture_init (&encoder->x265param, &pic_in);
+
+  fdata = gst_x265_enc_queue_frame (encoder, frame, info);
+  if (!fdata)
+    goto invalid_frame;
+
+  pic_in.colorSpace =
+      gst_x265_enc_gst_to_x265_video_format (info->finfo->format, &nplanes);
+  for (i = 0; i < nplanes; i++) {
+    pic_in.planes[i] = GST_VIDEO_FRAME_PLANE_DATA (&fdata->vframe, i);
+    pic_in.stride[i] = GST_VIDEO_FRAME_COMP_STRIDE (&fdata->vframe, i);
+  }
+
+  pic_in.sliceType = X265_TYPE_AUTO;
+  pic_in.pts = frame->pts;
+  pic_in.dts = frame->dts;
+  pic_in.bitDepth = info->finfo->depth[0];
+  pic_in.userData = GINT_TO_POINTER (frame->system_frame_number);
+
+  ret = gst_x265_enc_encode_frame (encoder, &pic_in, frame, &i_nal, TRUE);
+
+  /* input buffer is released later on */
+  return ret;
+
+/* ERRORS */
+not_inited:
+  {
+    GST_WARNING_OBJECT (encoder, "Got buffer before set_caps was called");
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+invalid_frame:
+  {
+    GST_ERROR_OBJECT (encoder, "Failed to map frame");
+    return GST_FLOW_ERROR;
+  }
+}
+
+static GstFlowReturn
+gst_x265_enc_encode_frame (GstX265Enc * encoder, x265_picture * pic_in,
+    GstVideoCodecFrame * input_frame, guint32 * i_nal, gboolean send)
+{
+  GstVideoCodecFrame *frame = NULL;
+  GstBuffer *out_buf = NULL;
+  x265_picture pic_out;
+  x265_nal *nal;
+  int i_size, i, offset;
+  int encoder_return;
+  GstFlowReturn ret = GST_FLOW_OK;
+  gboolean update_latency = FALSE;
+
+  if (G_UNLIKELY (encoder->x265enc == NULL)) {
+    if (input_frame)
+      gst_video_codec_frame_unref (input_frame);
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+
+  GST_OBJECT_LOCK (encoder);
+  if (encoder->reconfig) {
+    // x265_encoder_reconfig is not yet implemented thus we shut down and re-create encoder
+    gst_x265_enc_init_encoder (encoder);
+    update_latency = TRUE;
+  }
+
+  if (pic_in && input_frame) {
+    if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (input_frame)) {
+      GST_INFO_OBJECT (encoder, "Forcing key frame");
+      pic_in->sliceType = X265_TYPE_IDR;
+    }
+  }
+  GST_OBJECT_UNLOCK (encoder);
+
+  if (G_UNLIKELY (update_latency))
+    gst_x265_enc_set_latency (encoder);
+
+  encoder_return = x265_encoder_encode (encoder->x265enc,
+      &nal, i_nal, pic_in, &pic_out);
+
+  GST_DEBUG_OBJECT (encoder, "encoder result (%d) with %u nal units",
+      encoder_return, *i_nal);
+
+  if (encoder_return < 0) {
+    GST_ELEMENT_ERROR (encoder, STREAM, ENCODE, ("Encode x265 frame failed."),
+        ("x265_encoder_encode return code=%d", encoder_return));
+    ret = GST_FLOW_ERROR;
+    /* Make sure we finish this frame */
+    frame = input_frame;
+    goto out;
+  }
+
+  /* Input frame is now queued */
+  if (input_frame)
+    gst_video_codec_frame_unref (input_frame);
+
+  if (!*i_nal) {
+    ret = GST_FLOW_OK;
+    GST_LOG_OBJECT (encoder, "no output yet");
+    goto out;
+  }
+
+  frame = gst_video_encoder_get_frame (GST_VIDEO_ENCODER (encoder),
+      GPOINTER_TO_INT (pic_out.userData));
+  g_assert (frame || !send);
+
+  GST_DEBUG_OBJECT (encoder,
+      "output picture ready POC=%d system=%d frame found %d", pic_out.poc,
+      GPOINTER_TO_INT (pic_out.userData), frame != NULL);
+
+  if (!send || !frame) {
+    GST_LOG_OBJECT (encoder, "not sending (%d) or frame not found (%d)", send,
+        frame != NULL);
+    ret = GST_FLOW_OK;
+    goto out;
+  }
+
+  i_size = 0;
+  offset = 0;
+  for (i = 0; i < *i_nal; i++)
+    i_size += nal[i].sizeBytes;
+  out_buf = gst_buffer_new_allocate (NULL, i_size, NULL);
+  for (i = 0; i < *i_nal; i++) {
+    gst_buffer_fill (out_buf, offset, nal[i].payload, nal[i].sizeBytes);
+    offset += nal[i].sizeBytes;
+  }
+
+  frame->output_buffer = out_buf;
+
+  if (encoder->push_header) {
+    GstBuffer *header;
+
+    header = gst_x265_enc_get_header_buffer (encoder);
+    frame->output_buffer = gst_buffer_append (header, frame->output_buffer);
+    encoder->push_header = FALSE;
+  }
+
+  GST_LOG_OBJECT (encoder,
+      "output: dts %" G_GINT64_FORMAT " pts %" G_GINT64_FORMAT,
+      (gint64) pic_out.dts, (gint64) pic_out.pts);
+
+  frame->dts = pic_out.dts + encoder->dts_offset;
+
+out:
+  if (frame) {
+    gst_x265_enc_dequeue_frame (encoder, frame);
+    ret = gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (encoder), frame);
+  }
+
+  return ret;
+}
+
+static void
+gst_x265_enc_flush_frames (GstX265Enc * encoder, gboolean send)
+{
+  GstFlowReturn flow_ret;
+  guint32 i_nal;
+
+  /* first send the remaining frames */
+  if (encoder->x265enc)
+    do {
+      flow_ret = gst_x265_enc_encode_frame (encoder, NULL, NULL, &i_nal, send);
+    } while (flow_ret == GST_FLOW_OK && i_nal > 0);
+}
+
+static void
+gst_x265_enc_reconfig (GstX265Enc * encoder)
+{
+  encoder->x265param.rc.bitrate = encoder->bitrate;
+  encoder->reconfig = TRUE;
+}
+
+static void
+gst_x265_enc_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstX265Enc *encoder;
+  GstState state;
+
+  encoder = GST_X265_ENC (object);
+
+  GST_OBJECT_LOCK (encoder);
+
+  state = GST_STATE (encoder);
+  if ((state != GST_STATE_READY && state != GST_STATE_NULL) &&
+      !(pspec->flags & GST_PARAM_MUTABLE_PLAYING))
+    goto wrong_state;
+
+  switch (prop_id) {
+    case PROP_BITRATE:
+      encoder->bitrate = g_value_get_uint (value);
+      break;
+    case PROP_QP:
+      encoder->qp = g_value_get_int (value);
+      break;
+    case PROP_OPTION_STRING:
+      g_string_assign (encoder->option_string_prop, g_value_get_string (value));
+      break;
+    case PROP_X265_LOG_LEVEL:
+      encoder->log_level = g_value_get_enum (value);
+      break;
+    case PROP_SPEED_PRESET:
+      encoder->speed_preset = g_value_get_enum (value);
+      break;
+    case PROP_TUNE:
+      encoder->tune = g_value_get_enum (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+
+  gst_x265_enc_reconfig (encoder);
+  GST_OBJECT_UNLOCK (encoder);
+  return;
+
+wrong_state:
+  {
+    GST_WARNING_OBJECT (encoder, "setting property in wrong state");
+    GST_OBJECT_UNLOCK (encoder);
+  }
+}
+
+static void
+gst_x265_enc_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstX265Enc *encoder;
+
+  encoder = GST_X265_ENC (object);
+
+  GST_OBJECT_LOCK (encoder);
+  switch (prop_id) {
+    case PROP_BITRATE:
+      g_value_set_uint (value, encoder->bitrate);
+      break;
+    case PROP_QP:
+      g_value_set_int (value, encoder->qp);
+      break;
+    case PROP_OPTION_STRING:
+      g_value_set_string (value, encoder->option_string_prop->str);
+      break;
+    case PROP_X265_LOG_LEVEL:
+      g_value_set_enum (value, encoder->log_level);
+      break;
+    case PROP_SPEED_PRESET:
+      g_value_set_enum (value, encoder->speed_preset);
+      break;
+    case PROP_TUNE:
+      g_value_set_enum (value, encoder->tune);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+  GST_OBJECT_UNLOCK (encoder);
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  GST_DEBUG_CATEGORY_INIT (x265_enc_debug, "x265enc", 0,
+      "h265 encoding element");
+
+  GST_INFO ("x265 build: %u", X265_BUILD);
+
+  return gst_element_register (plugin, "x265enc",
+      GST_RANK_PRIMARY, GST_TYPE_X265_ENC);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    x265,
+    "x265-based H265 plugins",
+    plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/x265/gstx265enc.h b/ext/x265/gstx265enc.h
new file mode 100644
index 0000000..58ba7c0
--- /dev/null
+++ b/ext/x265/gstx265enc.h
@@ -0,0 +1,88 @@
+/* GStreamer H265 encoder plugin
+ * Copyright (C) 2005 Michal Benes <michal.benes@itonis.tv>
+ * Copyright (C) 2005 Josef Zlomek <josef.zlomek@itonis.tv>
+ * Copyright (C) 2014 Thijs Vermeir <thijs.vermeir@barco.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_X265_ENC_H__
+#define __GST_X265_ENC_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/video/gstvideoencoder.h>
+#include "_stdint.h"
+#include <x265.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_X265_ENC \
+  (gst_x265_enc_get_type())
+#define GST_X265_ENC(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_X265_ENC,GstX265Enc))
+#define GST_X265_ENC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_X265_ENC,GstX265EncClass))
+#define GST_IS_X265_ENC(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_X265_ENC))
+#define GST_IS_X265_ENC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_X265_ENC))
+typedef struct _GstX265Enc GstX265Enc;
+typedef struct _GstX265EncClass GstX265EncClass;
+
+struct _GstX265Enc
+{
+  GstVideoEncoder element;
+
+  /*< private > */
+  x265_encoder *x265enc;
+  x265_param x265param;
+  GstClockTime dts_offset;
+  gboolean push_header;
+
+  /* List of frame/buffer mapping structs for
+   * pending frames */
+  GList *pending_frames;
+
+  /* properties */
+  guint bitrate;
+  gint qp;
+  gint log_level;
+  gint tune;
+  gint speed_preset;
+  GString *option_string_prop;  /* option-string property */
+  /*GString *option_string; *//* used by set prop */
+
+  /* input description */
+  GstVideoCodecState *input_state;
+
+  /* configuration changed  while playing */
+  gboolean reconfig;
+
+  /* from the downstream caps */
+  const gchar *peer_profile;
+  gboolean peer_intra_profile;
+  /*const x265_level_t *peer_level; */
+};
+
+struct _GstX265EncClass
+{
+  GstVideoEncoderClass parent_class;
+};
+
+GType gst_x265_enc_get_type (void);
+
+G_END_DECLS
+#endif /* __GST_X265_ENC_H__ */
diff --git a/ext/xvid/Makefile.in b/ext/xvid/Makefile.in
index b26f0d2..d5df9c9 100644
--- a/ext/xvid/Makefile.in
+++ b/ext/xvid/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/zbar/Makefile.in b/ext/zbar/Makefile.in
index e24b4a3..e9ec6e2 100644
--- a/ext/zbar/Makefile.in
+++ b/ext/zbar/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/ext/zbar/gstzbar.c b/ext/zbar/gstzbar.c
index e96d3ae..8c98ed9 100644
--- a/ext/zbar/gstzbar.c
+++ b/ext/zbar/gstzbar.c
@@ -101,9 +101,8 @@
 #define DEFAULT_CACHE    FALSE
 #define DEFAULT_MESSAGE  TRUE
 
-/* FIXME: add YVU9 and YUV9 once we have a GstVideoFormat for that */
 #define ZBAR_YUV_CAPS \
-    "{ Y800, I420, YV12, NV12, NV21, Y41B, Y42B }"
+    "{ Y800, I420, YV12, NV12, NV21, Y41B, Y42B, YUV9, YVU9 }"
 
 static GstStaticPadTemplate gst_zbar_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
diff --git a/gst-libs/Makefile.in b/gst-libs/Makefile.in
index 0c3ae85..aaf0220 100644
--- a/gst-libs/Makefile.in
+++ b/gst-libs/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -218,8 +218,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -258,7 +262,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -266,6 +269,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -315,8 +320,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -395,7 +398,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -404,7 +406,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -417,7 +418,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -442,6 +442,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -515,10 +517,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -544,6 +550,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -580,6 +589,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -620,17 +630,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -647,6 +656,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am
index b3f23f4..a7380f8 100644
--- a/gst-libs/gst/Makefile.am
+++ b/gst-libs/gst/Makefile.am
@@ -10,9 +10,27 @@
 WAYLAND_DIR=wayland
 endif
 
-SUBDIRS = interfaces basecamerabinsrc codecparsers \
-	 insertbin uridownloader mpegts base video $(GL_DIR) $(WAYLAND_DIR)
+SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc codecparsers \
+	 insertbin mpegts base video $(GL_DIR) $(WAYLAND_DIR)
 
 noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
-DIST_SUBDIRS = interfaces gl basecamerabinsrc codecparsers \
-	insertbin uridownloader mpegts wayland base video
+DIST_SUBDIRS = uridownloader adaptivedemux interfaces gl basecamerabinsrc \
+	codecparsers insertbin mpegts wayland base video
+
+#dependencies
+video: base
+
+adaptivedemux: uridownloader
+
+INDEPENDENT_SUBDIRS = \
+	interfaces basecamerabinsrc codecparsers insertbin uridownloader \
+	mpegts base $(GL_DIR) $(WAYLAND_DIR)
+
+.PHONY: independent-subdirs $(INDEPENDENT_SUBDIRS)
+
+independent-subdirs: $(INDEPENDENT_SUBDIRS)
+
+$(INDEPENDENT_SUBDIRS):
+	$(MAKE) -C $@
+
+all-recursive: independent-subdirs
diff --git a/gst-libs/gst/Makefile.in b/gst-libs/gst/Makefile.in
index 4b2cc29..0c6a518 100644
--- a/gst-libs/gst/Makefile.in
+++ b/gst-libs/gst/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -220,8 +220,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -260,7 +264,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -268,6 +271,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -317,8 +322,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -397,7 +400,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -406,7 +408,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -419,7 +420,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -444,6 +444,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -517,10 +519,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -546,6 +552,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -582,6 +591,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -622,17 +632,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -649,6 +658,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -703,12 +713,16 @@
 @USE_GLES2_TRUE@GL_DIR = gl
 @USE_OPENGL_TRUE@GL_DIR = gl
 @USE_WAYLAND_TRUE@WAYLAND_DIR = wayland
-SUBDIRS = interfaces basecamerabinsrc codecparsers \
-	 insertbin uridownloader mpegts base video $(GL_DIR) $(WAYLAND_DIR)
+SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc codecparsers \
+	 insertbin mpegts base video $(GL_DIR) $(WAYLAND_DIR)
 
 noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
-DIST_SUBDIRS = interfaces gl basecamerabinsrc codecparsers \
-	insertbin uridownloader mpegts wayland base video
+DIST_SUBDIRS = uridownloader adaptivedemux interfaces gl basecamerabinsrc \
+	codecparsers insertbin mpegts wayland base video
+
+INDEPENDENT_SUBDIRS = \
+	interfaces basecamerabinsrc codecparsers insertbin uridownloader \
+	mpegts base $(GL_DIR) $(WAYLAND_DIR)
 
 all: all-recursive
 
@@ -1021,6 +1035,20 @@
 	ps ps-am tags tags-am uninstall uninstall-am
 
 
+#dependencies
+video: base
+
+adaptivedemux: uridownloader
+
+.PHONY: independent-subdirs $(INDEPENDENT_SUBDIRS)
+
+independent-subdirs: $(INDEPENDENT_SUBDIRS)
+
+$(INDEPENDENT_SUBDIRS):
+	$(MAKE) -C $@
+
+all-recursive: independent-subdirs
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/gst-libs/gst/adaptivedemux/Makefile.am b/gst-libs/gst/adaptivedemux/Makefile.am
new file mode 100644
index 0000000..7ef8990
--- /dev/null
+++ b/gst-libs/gst/adaptivedemux/Makefile.am
@@ -0,0 +1,36 @@
+
+lib_LTLIBRARIES = libgstadaptivedemux-@GST_API_VERSION@.la
+
+CLEANFILES = $(BUILT_SOURCES)
+
+libgstadaptivedemux_@GST_API_VERSION@_la_SOURCES = \
+	gstadaptivedemux.c
+
+libgstadaptivedemux_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/adaptivedemux
+
+noinst_HEADERS = gstadaptivedemux.h
+
+libgstadaptivedemux_@GST_API_VERSION@_la_CFLAGS = \
+	$(GST_PLUGINS_BAD_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	-DGST_USE_UNSTABLE_API \
+	$(GST_CFLAGS)
+libgstadaptivedemux_@GST_API_VERSION@_la_LIBADD = \
+	$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-$(GST_API_VERSION).la \
+	-lgstapp-$(GST_API_VERSION) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
+
+libgstadaptivedemux_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
+
+Android.mk: Makefile.am
+	androgenizer -:PROJECT libgstadaptivedemux -:STATIC libgstadaptivedemux-@GST_API_VERSION@ \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstadaptivedemux_@GST_API_VERSION@_la_SOURCES) \
+	 -:CFLAGS $(DEFS) $(libgstadaptivedemux_@GST_API_VERSION@_la_CFLAGS) \
+	 -:LDFLAGS $(libgstadaptivedemux_@GST_API_VERSION@_la_LDFLAGS) \
+	           $(libgstadaptivedemux_@GST_API_VERSION@_la_LIBADD) \
+	           -ldl \
+	 -:HEADER_TARGET gstreamer-@GST_API_VERSION@/gst/adaptivedemux \
+	 -:HEADERS $(libgstadaptivedemuxinclude_HEADERS) \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+	> $@
diff --git a/sys/osxvideo/Makefile.in b/gst-libs/gst/adaptivedemux/Makefile.in
similarity index 83%
copy from sys/osxvideo/Makefile.in
copy to gst-libs/gst/adaptivedemux/Makefile.in
index a756e27..b6ef985 100644
--- a/sys/osxvideo/Makefile.in
+++ b/gst-libs/gst/adaptivedemux/Makefile.in
@@ -80,7 +80,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = sys/osxvideo
+subdir = gst-libs/gst/adaptivedemux
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -151,23 +151,25 @@
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(plugindir)"
-LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(libdir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstosxvideosrc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+libgstadaptivedemux_@GST_API_VERSION@_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-$(GST_API_VERSION).la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
-am_libgstosxvideosrc_la_OBJECTS =  \
-	libgstosxvideosrc_la-osxvideoplugin.lo \
-	libgstosxvideosrc_la-osxvideosrc.lo
-libgstosxvideosrc_la_OBJECTS = $(am_libgstosxvideosrc_la_OBJECTS)
+am_libgstadaptivedemux_@GST_API_VERSION@_la_OBJECTS =  \
+	libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.lo
+libgstadaptivedemux_@GST_API_VERSION@_la_OBJECTS =  \
+	$(am_libgstadaptivedemux_@GST_API_VERSION@_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstosxvideosrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) \
-	$(libgstosxvideosrc_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstadaptivedemux_@GST_API_VERSION@_la_LINK = $(LIBTOOL) $(AM_V_lt) \
+	--tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CCLD) $(libgstadaptivedemux_@GST_API_VERSION@_la_CFLAGS) \
+	$(CFLAGS) $(libgstadaptivedemux_@GST_API_VERSION@_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -202,8 +204,8 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstosxvideosrc_la_SOURCES)
-DIST_SOURCES = $(libgstosxvideosrc_la_SOURCES)
+SOURCES = $(libgstadaptivedemux_@GST_API_VERSION@_la_SOURCES)
+DIST_SOURCES = $(libgstadaptivedemux_@GST_API_VERSION@_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -246,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -726,20 +738,24 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstosxvideosrc.la
-libgstosxvideosrc_la_SOURCES = osxvideoplugin.c osxvideosrc.c
-libgstosxvideosrc_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
-	$(GST_PLUGINS_BASE_CFLAGS) -Wno-deprecated-declarations
+lib_LTLIBRARIES = libgstadaptivedemux-@GST_API_VERSION@.la
+CLEANFILES = $(BUILT_SOURCES)
+libgstadaptivedemux_@GST_API_VERSION@_la_SOURCES = \
+	gstadaptivedemux.c
 
-libgstosxvideosrc_la_LIBADD = \
-	$(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
-	-lgstinterfaces-$(GST_API_VERSION)
+libgstadaptivedemux_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/adaptivedemux
+noinst_HEADERS = gstadaptivedemux.h
+libgstadaptivedemux_@GST_API_VERSION@_la_CFLAGS = \
+	$(GST_PLUGINS_BAD_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	-DGST_USE_UNSTABLE_API \
+	$(GST_CFLAGS)
 
-libgstosxvideosrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-libgstosxvideosrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \
-	-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,QuickTime
+libgstadaptivedemux_@GST_API_VERSION@_la_LIBADD = \
+	$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-$(GST_API_VERSION).la \
+	-lgstapp-$(GST_API_VERSION) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
 
-noinst_HEADERS = osxvideosrc.h
+libgstadaptivedemux_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
 all: all-am
 
 .SUFFIXES:
@@ -753,9 +769,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sys/osxvideo/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gst-libs/gst/adaptivedemux/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu sys/osxvideo/Makefile
+	  $(AUTOMAKE) --gnu gst-libs/gst/adaptivedemux/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -775,33 +791,33 @@
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
 	    list2="$$list2 $$p"; \
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
 
-uninstall-pluginLTLIBRARIES:
+uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
-	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	for p in $$list; do \
 	  $(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
 	done
 
-clean-pluginLTLIBRARIES:
-	-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
-	@list='$(plugin_LTLIBRARIES)'; \
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; \
 	locs=`for p in $$list; do echo $$p; done | \
 	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
 	      sort -u`; \
@@ -810,8 +826,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstosxvideosrc.la: $(libgstosxvideosrc_la_OBJECTS) $(libgstosxvideosrc_la_DEPENDENCIES) $(EXTRA_libgstosxvideosrc_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstosxvideosrc_la_LINK) -rpath $(plugindir) $(libgstosxvideosrc_la_OBJECTS) $(libgstosxvideosrc_la_LIBADD) $(LIBS)
+libgstadaptivedemux-@GST_API_VERSION@.la: $(libgstadaptivedemux_@GST_API_VERSION@_la_OBJECTS) $(libgstadaptivedemux_@GST_API_VERSION@_la_DEPENDENCIES) $(EXTRA_libgstadaptivedemux_@GST_API_VERSION@_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libgstadaptivedemux_@GST_API_VERSION@_la_LINK) -rpath $(libdir) $(libgstadaptivedemux_@GST_API_VERSION@_la_OBJECTS) $(libgstadaptivedemux_@GST_API_VERSION@_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -819,8 +835,7 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -846,19 +861,12 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstosxvideosrc_la-osxvideoplugin.lo: osxvideoplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -MT libgstosxvideosrc_la-osxvideoplugin.lo -MD -MP -MF $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Tpo -c -o libgstosxvideosrc_la-osxvideoplugin.lo `test -f 'osxvideoplugin.c' || echo '$(srcdir)/'`osxvideoplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Tpo $(DEPDIR)/libgstosxvideosrc_la-osxvideoplugin.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='osxvideoplugin.c' object='libgstosxvideosrc_la-osxvideoplugin.lo' libtool=yes @AMDEPBACKSLASH@
+libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.lo: gstadaptivedemux.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstadaptivedemux_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.lo -MD -MP -MF $(DEPDIR)/libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.Tpo -c -o libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.lo `test -f 'gstadaptivedemux.c' || echo '$(srcdir)/'`gstadaptivedemux.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.Tpo $(DEPDIR)/libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstadaptivedemux.c' object='libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -c -o libgstosxvideosrc_la-osxvideoplugin.lo `test -f 'osxvideoplugin.c' || echo '$(srcdir)/'`osxvideoplugin.c
-
-libgstosxvideosrc_la-osxvideosrc.lo: osxvideosrc.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -MT libgstosxvideosrc_la-osxvideosrc.lo -MD -MP -MF $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Tpo -c -o libgstosxvideosrc_la-osxvideosrc.lo `test -f 'osxvideosrc.c' || echo '$(srcdir)/'`osxvideosrc.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Tpo $(DEPDIR)/libgstosxvideosrc_la-osxvideosrc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='osxvideosrc.c' object='libgstosxvideosrc_la-osxvideosrc.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstosxvideosrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstosxvideosrc_la_CFLAGS) $(CFLAGS) -c -o libgstosxvideosrc_la-osxvideosrc.lo `test -f 'osxvideosrc.c' || echo '$(srcdir)/'`osxvideosrc.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstadaptivedemux_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstadaptivedemux_@GST_API_VERSION@_la-gstadaptivedemux.lo `test -f 'gstadaptivedemux.c' || echo '$(srcdir)/'`gstadaptivedemux.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -952,7 +960,7 @@
 check: check-am
 all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(plugindir)"; do \
+	for dir in "$(DESTDIR)$(libdir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -977,6 +985,7 @@
 mostlyclean-generic:
 
 clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -987,7 +996,7 @@
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -1008,13 +1017,13 @@
 
 info-am:
 
-install-data-am: install-pluginLTLIBRARIES
+install-data-am:
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am:
+install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-am
 
@@ -1054,26 +1063,39 @@
 
 ps-am:
 
-uninstall-am: uninstall-pluginLTLIBRARIES
+uninstall-am: uninstall-libLTLIBRARIES
 
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-pluginLTLIBRARIES cscopelist-am ctags \
+	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
 	ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
 	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-pluginLTLIBRARIES install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
-	uninstall-pluginLTLIBRARIES
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
 
 
+Android.mk: Makefile.am
+	androgenizer -:PROJECT libgstadaptivedemux -:STATIC libgstadaptivedemux-@GST_API_VERSION@ \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstadaptivedemux_@GST_API_VERSION@_la_SOURCES) \
+	 -:CFLAGS $(DEFS) $(libgstadaptivedemux_@GST_API_VERSION@_la_CFLAGS) \
+	 -:LDFLAGS $(libgstadaptivedemux_@GST_API_VERSION@_la_LDFLAGS) \
+	           $(libgstadaptivedemux_@GST_API_VERSION@_la_LIBADD) \
+	           -ldl \
+	 -:HEADER_TARGET gstreamer-@GST_API_VERSION@/gst/adaptivedemux \
+	 -:HEADERS $(libgstadaptivedemuxinclude_HEADERS) \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+	> $@
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
new file mode 100644
index 0000000..cf4a317
--- /dev/null
+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
@@ -0,0 +1,2580 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014 Samsung Electronics. All rights reserved.
+ *   Author: Thiago Santos <thiagoss@osg.samsung.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:gstadaptivedemux
+ * @short_description: Base class for adaptive demuxers
+ * @see_also:
+ *
+ * What is an adaptive demuxer?
+ * Adaptive demuxers are special demuxers in the sense that they don't
+ * actually demux data received from upstream but download the data
+ * themselves.
+ *
+ * Adaptive formats (HLS, DASH, MSS) are composed of a manifest file and
+ * a set of fragments. The manifest describes the available media and
+ * the sequence of fragments to use. Each fragments contains a small
+ * part of the media (typically only a few seconds). It is possible for
+ * the manifest to have the same media available in different configurations
+ * (bitrates for example) so that the client can select the one that
+ * best suits its scenario (network fluctuation, hardware requirements...).
+ * It is possible to switch from one representation of the media to another
+ * during playback. That's why it is called 'adaptive', because it can be
+ * adapted to the client's needs.
+ *
+ * Architectural overview:
+ * The manifest is received by the demuxer in its sink pad and, upon receiving
+ * EOS, it parses the manifest and exposes the streams available in it. For
+ * each stream a source element will be created and will download the list
+ * of fragments one by one. Once a fragment is finished downloading, the next
+ * URI is set to the source element and it starts fetching it and pushing
+ * through the stream's pad. This implies that each stream is independent from
+ * each other as it runs on a separate thread.
+ *
+ * After downloading each fragment, the download rate of it is calculated and
+ * the demuxer has a chance to switch to a different bitrate if needed. The
+ * switch can be done by simply pushing a new caps before the next fragment
+ * when codecs are the same, or by exposing a new pad group if it needs
+ * a codec change.
+ *
+ * Extra features:
+ * - Not linked streams: Streams that are not-linked have their download threads
+ *                       interrupted to save network bandwidth. When they are
+ *                       relinked a reconfigure event is received and the
+ *                       stream is restarted.
+ *
+ * Subclasses:
+ * While GstAdaptiveDemux is responsible for the workflow, it knows nothing
+ * about the intrinsics of the subclass formats, so the subclasses are
+ * resposible for maintaining the manifest data structures and stream
+ * information.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstadaptivedemux.h"
+#include "gst/gst-i18n-plugin.h"
+#include <gst/base/gstadapter.h>
+#include <gst/uridownloader/gsturidownloader.h>
+
+GST_DEBUG_CATEGORY (adaptivedemux_debug);
+#define GST_CAT_DEFAULT adaptivedemux_debug
+
+#define GST_ADAPTIVE_DEMUX_GET_PRIVATE(obj)  \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_ADAPTIVE_DEMUX, \
+        GstAdaptiveDemuxPrivate))
+
+#define MAX_DOWNLOAD_ERROR_COUNT 3
+#define DEFAULT_FAILED_COUNT 3
+#define DEFAULT_LOOKBACK_FRAGMENTS 3
+#define DEFAULT_CONNECTION_SPEED 0
+#define DEFAULT_BITRATE_LIMIT 0.8
+
+enum
+{
+  PROP_0,
+  PROP_LOOKBACK_FRAGMENTS,
+  PROP_CONNECTION_SPEED,
+  PROP_BITRATE_LIMIT,
+  PROP_LAST
+};
+
+enum GstAdaptiveDemuxFlowReturn
+{
+  GST_ADAPTIVE_DEMUX_FLOW_SWITCH = GST_FLOW_CUSTOM_SUCCESS_2 + 1
+};
+
+struct _GstAdaptiveDemuxPrivate
+{
+  GstAdapter *input_adapter;
+  GstBuffer *manifest_buffer;
+
+  GstUriDownloader *downloader;
+
+  GList *old_streams;
+
+  GstTask *updates_task;
+  GRecMutex updates_lock;
+  GMutex updates_timed_lock;
+  GCond updates_timed_cond;
+  gboolean stop_updates_task;
+  gint update_failed_count;
+
+  gint64 next_update;
+
+  gboolean exposing;
+};
+
+static GstBinClass *parent_class = NULL;
+static void gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass);
+static void gst_adaptive_demux_init (GstAdaptiveDemux * dec,
+    GstAdaptiveDemuxClass * klass);
+static void gst_adaptive_demux_finalize (GObject * object);
+static GstStateChangeReturn gst_adaptive_demux_change_state (GstElement *
+    element, GstStateChange transition);
+
+static void gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg);
+
+static gboolean gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
+    GstEvent * event);
+static GstFlowReturn gst_adaptive_demux_sink_chain (GstPad * pad,
+    GstObject * parent, GstBuffer * buffer);
+static gboolean gst_adaptive_demux_src_query (GstPad * pad, GstObject * parent,
+    GstQuery * query);
+static gboolean gst_adaptive_demux_src_event (GstPad * pad, GstObject * parent,
+    GstEvent * event);
+
+static gboolean
+gst_adaptive_demux_push_src_event (GstAdaptiveDemux * demux, GstEvent * event);
+
+static void gst_adaptive_demux_updates_loop (GstAdaptiveDemux * demux);
+static void gst_adaptive_demux_stream_download_loop (GstAdaptiveDemuxStream *
+    stream);
+static void gst_adaptive_demux_reset (GstAdaptiveDemux * demux);
+static gboolean gst_adaptive_demux_expose_streams (GstAdaptiveDemux * demux,
+    gboolean first_segment);
+static gboolean gst_adaptive_demux_is_live (GstAdaptiveDemux * demux);
+static GstFlowReturn gst_adaptive_demux_stream_seek (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, GstClockTime ts);
+static gboolean gst_adaptive_demux_stream_has_next_fragment (GstAdaptiveDemux *
+    demux, GstAdaptiveDemuxStream * stream);
+static gboolean gst_adaptive_demux_stream_select_bitrate (GstAdaptiveDemux *
+    demux, GstAdaptiveDemuxStream * stream, guint64 bitrate);
+static GstFlowReturn
+gst_adaptive_demux_stream_update_fragment_info (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+static gint64
+gst_adaptive_demux_stream_get_fragment_waiting_time (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+static GstFlowReturn gst_adaptive_demux_update_manifest (GstAdaptiveDemux *
+    demux);
+static gboolean gst_adaptive_demux_has_next_period (GstAdaptiveDemux * demux);
+static void gst_adaptive_demux_advance_period (GstAdaptiveDemux * demux);
+
+static void gst_adaptive_demux_stream_free (GstAdaptiveDemuxStream * stream);
+static GstFlowReturn
+gst_adaptive_demux_stream_push_event (GstAdaptiveDemuxStream * stream,
+    GstEvent * event);
+static void gst_adaptive_demux_stream_download_wait (GstAdaptiveDemuxStream *
+    stream, GstClockTime time_diff);
+
+static void gst_adaptive_demux_start_tasks (GstAdaptiveDemux * demux);
+static void gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux);
+static GstFlowReturn gst_adaptive_demux_combine_flows (GstAdaptiveDemux *
+    demux);
+static void
+gst_adaptive_demux_stream_fragment_download_finish (GstAdaptiveDemuxStream *
+    stream, GstFlowReturn ret, GError * err);
+static GstFlowReturn
+gst_adaptive_demux_stream_data_received_default (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+static GstFlowReturn
+gst_adaptive_demux_stream_finish_fragment_default (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream);
+
+
+/* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
+ * method to get to the padtemplates */
+GType
+gst_adaptive_demux_get_type (void)
+{
+  static volatile gsize type = 0;
+
+  if (g_once_init_enter (&type)) {
+    GType _type;
+    static const GTypeInfo info = {
+      sizeof (GstAdaptiveDemuxClass),
+      NULL,
+      NULL,
+      (GClassInitFunc) gst_adaptive_demux_class_init,
+      NULL,
+      NULL,
+      sizeof (GstAdaptiveDemux),
+      0,
+      (GInstanceInitFunc) gst_adaptive_demux_init,
+    };
+
+    _type = g_type_register_static (GST_TYPE_BIN,
+        "GstAdaptiveDemux", &info, G_TYPE_FLAG_ABSTRACT);
+    g_once_init_leave (&type, _type);
+  }
+  return type;
+}
+
+static void
+gst_adaptive_demux_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX (object);
+
+  switch (prop_id) {
+    case PROP_LOOKBACK_FRAGMENTS:
+      demux->num_lookback_fragments = g_value_get_uint (value);
+      break;
+    case PROP_CONNECTION_SPEED:
+      demux->connection_speed = g_value_get_uint (value) * 1000;
+      GST_DEBUG_OBJECT (demux, "Connection speed set to %u",
+          demux->connection_speed);
+      break;
+    case PROP_BITRATE_LIMIT:
+      demux->bitrate_limit = g_value_get_float (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_adaptive_demux_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX (object);
+
+  switch (prop_id) {
+    case PROP_LOOKBACK_FRAGMENTS:
+      g_value_set_uint (value, demux->num_lookback_fragments);
+      break;
+    case PROP_CONNECTION_SPEED:
+      g_value_set_uint (value, demux->connection_speed / 1000);
+      break;
+    case PROP_BITRATE_LIMIT:
+      g_value_set_float (value, demux->bitrate_limit);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+  GstBinClass *gstbin_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gstelement_class = GST_ELEMENT_CLASS (klass);
+  gstbin_class = GST_BIN_CLASS (klass);
+
+  GST_DEBUG_CATEGORY_INIT (adaptivedemux_debug, "adaptivedemux", 0,
+      "Base Adaptive Demux");
+
+  parent_class = g_type_class_peek_parent (klass);
+  g_type_class_add_private (klass, sizeof (GstAdaptiveDemuxPrivate));
+
+  gobject_class->set_property = gst_adaptive_demux_set_property;
+  gobject_class->get_property = gst_adaptive_demux_get_property;
+  gobject_class->finalize = gst_adaptive_demux_finalize;
+
+  g_object_class_install_property (gobject_class, PROP_LOOKBACK_FRAGMENTS,
+      g_param_spec_uint ("num-lookback-fragments",
+          "Number of fragments to look back",
+          "The number of fragments the demuxer will look back to calculate an average bitrate",
+          1, G_MAXUINT, DEFAULT_LOOKBACK_FRAGMENTS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+
+  g_object_class_install_property (gobject_class, PROP_CONNECTION_SPEED,
+      g_param_spec_uint ("connection-speed", "Connection Speed",
+          "Network connection speed in kbps (0 = calculate from downloaded"
+          " fragments)", 0, G_MAXUINT / 1000, DEFAULT_CONNECTION_SPEED,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /* FIXME 2.0: rename this property to bandwidth-usage or any better name */
+  g_object_class_install_property (gobject_class, PROP_BITRATE_LIMIT,
+      g_param_spec_float ("bitrate-limit",
+          "Bitrate limit in %",
+          "Limit of the available bitrate to use when switching to alternates.",
+          0, 1, DEFAULT_BITRATE_LIMIT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gstelement_class->change_state = gst_adaptive_demux_change_state;
+
+  gstbin_class->handle_message = gst_adaptive_demux_handle_message;
+
+  klass->data_received = gst_adaptive_demux_stream_data_received_default;
+  klass->finish_fragment = gst_adaptive_demux_stream_finish_fragment_default;
+}
+
+static void
+gst_adaptive_demux_init (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxClass * klass)
+{
+  GstPadTemplate *pad_template;
+  GstPad *pad;
+
+  GST_DEBUG_OBJECT (demux, "gst_adaptive_demux_init");
+
+  demux->priv = GST_ADAPTIVE_DEMUX_GET_PRIVATE (demux);
+  demux->priv->input_adapter = gst_adapter_new ();
+  demux->priv->downloader = gst_uri_downloader_new ();
+  demux->stream_struct_size = sizeof (GstAdaptiveDemuxStream);
+
+  gst_segment_init (&demux->segment, GST_FORMAT_TIME);
+
+  g_rec_mutex_init (&demux->priv->updates_lock);
+  demux->priv->updates_task =
+      gst_task_new ((GstTaskFunction) gst_adaptive_demux_updates_loop,
+      demux, NULL);
+  gst_task_set_lock (demux->priv->updates_task, &demux->priv->updates_lock);
+
+  g_mutex_init (&demux->priv->updates_timed_lock);
+  g_cond_init (&demux->priv->updates_timed_cond);
+
+  g_cond_init (&demux->manifest_cond);
+  g_mutex_init (&demux->manifest_lock);
+
+  pad_template =
+      gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink");
+  g_return_if_fail (pad_template != NULL);
+
+  demux->sinkpad = pad = gst_pad_new_from_template (pad_template, "sink");
+  gst_pad_set_event_function (demux->sinkpad,
+      GST_DEBUG_FUNCPTR (gst_adaptive_demux_sink_event));
+  gst_pad_set_chain_function (demux->sinkpad,
+      GST_DEBUG_FUNCPTR (gst_adaptive_demux_sink_chain));
+
+  /* Properties */
+  demux->num_lookback_fragments = DEFAULT_LOOKBACK_FRAGMENTS;
+  demux->bitrate_limit = DEFAULT_BITRATE_LIMIT;
+  demux->connection_speed = DEFAULT_CONNECTION_SPEED;
+
+  gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
+}
+
+static void
+gst_adaptive_demux_finalize (GObject * object)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (object);
+  GstAdaptiveDemuxPrivate *priv = demux->priv;
+
+  GST_DEBUG_OBJECT (object, "finalize");
+
+  g_object_unref (priv->input_adapter);
+  g_object_unref (priv->downloader);
+
+  g_mutex_clear (&priv->updates_timed_lock);
+  g_cond_clear (&priv->updates_timed_cond);
+  g_cond_clear (&demux->manifest_cond);
+  g_object_unref (priv->updates_task);
+  g_rec_mutex_clear (&priv->updates_lock);
+  g_mutex_clear (&demux->manifest_lock);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static GstStateChangeReturn
+gst_adaptive_demux_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (element);
+  GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      gst_adaptive_demux_reset (demux);
+      break;
+    default:
+      break;
+  }
+
+  result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+  return result;
+}
+
+static gboolean
+gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
+    GstEvent * event)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (parent);
+  GstAdaptiveDemuxClass *demux_class;
+
+  switch (event->type) {
+    case GST_EVENT_FLUSH_STOP:
+      gst_adaptive_demux_reset (demux);
+      break;
+    case GST_EVENT_EOS:{
+      GstQuery *query;
+      gboolean query_res;
+      gboolean ret = TRUE;
+      gsize available;
+
+      demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+      available = gst_adapter_available (demux->priv->input_adapter);
+
+      if (available == 0) {
+        GST_WARNING_OBJECT (demux, "Received EOS without a manifest.");
+        break;
+      }
+
+      GST_DEBUG_OBJECT (demux, "Got EOS on the sink pad: manifest fetched");
+
+      /* Need to get the URI to use it as a base to generate the fragment's
+       * uris */
+      query = gst_query_new_uri ();
+      query_res = gst_pad_peer_query (pad, query);
+      GST_MANIFEST_LOCK (demux);
+      if (query_res) {
+        gchar *uri, *redirect_uri;
+        gboolean permanent;
+
+        gst_query_parse_uri (query, &uri);
+        gst_query_parse_uri_redirection (query, &redirect_uri);
+        gst_query_parse_uri_redirection_permanent (query, &permanent);
+
+        if (permanent && redirect_uri) {
+          demux->manifest_uri = redirect_uri;
+          demux->manifest_base_uri = NULL;
+          g_free (uri);
+        } else {
+          demux->manifest_uri = uri;
+          demux->manifest_base_uri = redirect_uri;
+        }
+
+        GST_DEBUG_OBJECT (demux, "Fetched manifest at URI: %s (base: %s)",
+            demux->manifest_uri, GST_STR_NULL (demux->manifest_base_uri));
+      } else {
+        GST_WARNING_OBJECT (demux, "Upstream URI query failed.");
+      }
+      gst_query_unref (query);
+
+      /* Let the subclass parse the manifest */
+      demux->priv->manifest_buffer =
+          gst_adapter_take_buffer (demux->priv->input_adapter, available);
+      if (!demux_class->process_manifest (demux, demux->priv->manifest_buffer)) {
+        /* In most cases, this will happen if we set a wrong url in the
+         * source element and we have received the 404 HTML response instead of
+         * the manifest */
+        GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid manifest."),
+            (NULL));
+        ret = FALSE;
+      }
+
+      gst_element_post_message (GST_ELEMENT_CAST (demux),
+          gst_message_new_element (GST_OBJECT_CAST (demux),
+              gst_structure_new (STATISTICS_MESSAGE_NAME,
+                  "manifest-uri", G_TYPE_STRING,
+                  demux->manifest_uri, "uri", G_TYPE_STRING,
+                  demux->manifest_uri,
+                  "manifest-download-start", GST_TYPE_CLOCK_TIME,
+                  GST_CLOCK_TIME_NONE,
+                  "manifest-download-stop", GST_TYPE_CLOCK_TIME,
+                  gst_util_get_timestamp (), NULL)));
+
+      if (ret) {
+        /* Send duration message */
+        if (!gst_adaptive_demux_is_live (demux)) {
+          GstClockTime duration = demux_class->get_duration (demux);
+
+          if (duration != GST_CLOCK_TIME_NONE) {
+            GST_DEBUG_OBJECT (demux,
+                "Sending duration message : %" GST_TIME_FORMAT,
+                GST_TIME_ARGS (duration));
+            gst_element_post_message (GST_ELEMENT (demux),
+                gst_message_new_duration_changed (GST_OBJECT (demux)));
+          } else {
+            GST_DEBUG_OBJECT (demux,
+                "media duration unknown, can not send the duration message");
+          }
+        }
+
+        if (demux->next_streams) {
+          gst_adaptive_demux_expose_streams (demux, TRUE);
+          gst_adaptive_demux_start_tasks (demux);
+          if (gst_adaptive_demux_is_live (demux)) {
+            /* Task to periodically update the manifest */
+            gst_task_start (demux->priv->updates_task);
+          }
+        } else {
+          /* no streams */
+          GST_WARNING_OBJECT (demux, "No streams created from manifest");
+          GST_ELEMENT_ERROR (demux, STREAM, DEMUX,
+              (_("This file contains no playable streams.")),
+              ("No known stream formats found at the Manifest"));
+          ret = FALSE;
+        }
+
+      }
+      GST_MANIFEST_UNLOCK (demux);
+
+      gst_event_unref (event);
+      return ret;
+    }
+    case GST_EVENT_SEGMENT:
+      /* Swallow newsegments, we'll push our own */
+      gst_event_unref (event);
+      return TRUE;
+    default:
+      break;
+  }
+
+  return gst_pad_event_default (pad, parent, event);
+}
+
+static GstFlowReturn
+gst_adaptive_demux_sink_chain (GstPad * pad, GstObject * parent,
+    GstBuffer * buffer)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (parent);
+  gst_adapter_push (demux->priv->input_adapter, buffer);
+
+  GST_INFO_OBJECT (demux, "Received manifest buffer, total size is %i bytes",
+      (gint) gst_adapter_available (demux->priv->input_adapter));
+
+  return GST_FLOW_OK;
+}
+
+static void
+gst_adaptive_demux_reset (GstAdaptiveDemux * demux)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+  GList *iter;
+
+  gst_adaptive_demux_stop_tasks (demux);
+  gst_uri_downloader_reset (demux->priv->downloader);
+
+  if (klass->reset)
+    klass->reset (demux);
+
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+    if (stream->pad)
+      gst_element_remove_pad (GST_ELEMENT_CAST (demux), stream->pad);
+    gst_adaptive_demux_stream_free (stream);
+  }
+  g_list_free (demux->streams);
+  demux->streams = NULL;
+
+  if (demux->priv->old_streams) {
+    g_list_free_full (demux->priv->old_streams,
+        (GDestroyNotify) gst_adaptive_demux_stream_free);
+    demux->priv->old_streams = NULL;
+  }
+
+  g_free (demux->manifest_uri);
+  g_free (demux->manifest_base_uri);
+  demux->manifest_uri = NULL;
+  demux->manifest_base_uri = NULL;
+
+  gst_adapter_clear (demux->priv->input_adapter);
+  if (demux->priv->manifest_buffer) {
+    gst_buffer_unref (demux->priv->manifest_buffer);
+    demux->priv->manifest_buffer = NULL;
+  }
+
+  gst_segment_init (&demux->segment, GST_FORMAT_TIME);
+
+  demux->have_group_id = FALSE;
+  demux->group_id = G_MAXUINT;
+  demux->priv->exposing = FALSE;
+}
+
+static void
+gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg)
+{
+  GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (bin);
+
+  switch (GST_MESSAGE_TYPE (msg)) {
+    case GST_MESSAGE_ERROR:{
+      GList *iter;
+      GstAdaptiveDemuxStream *stream;
+      GError *err = NULL;
+      gchar *debug = NULL;
+      gchar *new_error = NULL;
+
+      for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+        stream = iter->data;
+        if (GST_OBJECT_CAST (stream->src) == GST_MESSAGE_SRC (msg)) {
+          gst_message_parse_error (msg, &err, &debug);
+
+          GST_WARNING_OBJECT (GST_ADAPTIVE_DEMUX_STREAM_PAD (stream),
+              "Source posted error: %d:%d %s (%s)", err->domain, err->code,
+              err->message, debug);
+
+          if (debug)
+            new_error = g_strdup_printf ("%s: %s\n", err->message, debug);
+          if (new_error) {
+            g_free (err->message);
+            err->message = new_error;
+          }
+
+          /* error, but ask to retry */
+          gst_adaptive_demux_stream_fragment_download_finish (stream,
+              GST_FLOW_CUSTOM_ERROR, err);
+
+          g_error_free (err);
+          g_free (debug);
+          break;
+        }
+      }
+
+      gst_message_unref (msg);
+      msg = NULL;
+    }
+      break;
+    default:
+      break;
+  }
+
+  if (msg)
+    GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
+}
+
+void
+gst_adaptive_demux_set_stream_struct_size (GstAdaptiveDemux * demux,
+    gsize struct_size)
+{
+  demux->stream_struct_size = struct_size;
+}
+
+static gboolean
+gst_adaptive_demux_expose_stream (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstPad *pad = stream->pad;
+  gchar *name = gst_pad_get_name (pad);
+  GstEvent *event;
+  gchar *stream_id;
+
+  gst_pad_set_active (pad, TRUE);
+  stream->need_header = TRUE;
+
+  stream_id = gst_pad_create_stream_id (pad, GST_ELEMENT_CAST (demux), name);
+
+  event =
+      gst_pad_get_sticky_event (GST_ADAPTIVE_DEMUX_SINK_PAD (demux),
+      GST_EVENT_STREAM_START, 0);
+  if (event) {
+    if (gst_event_parse_group_id (event, &demux->group_id))
+      demux->have_group_id = TRUE;
+    else
+      demux->have_group_id = FALSE;
+    gst_event_unref (event);
+  } else if (!demux->have_group_id) {
+    demux->have_group_id = TRUE;
+    demux->group_id = gst_util_group_id_next ();
+  }
+  event = gst_event_new_stream_start (stream_id);
+  if (demux->have_group_id)
+    gst_event_set_group_id (event, demux->group_id);
+
+  gst_pad_push_event (pad, event);
+  g_free (stream_id);
+  g_free (name);
+
+  GST_DEBUG_OBJECT (demux, "Adding srcpad %s:%s with caps %" GST_PTR_FORMAT,
+      GST_DEBUG_PAD_NAME (pad), stream->pending_caps);
+
+  if (stream->pending_caps) {
+    gst_pad_set_caps (pad, stream->pending_caps);
+    gst_caps_unref (stream->pending_caps);
+    stream->pending_caps = NULL;
+  }
+
+  stream->download_finished = FALSE;
+  stream->discont = FALSE;
+
+  gst_object_ref (pad);
+
+  return gst_element_add_pad (GST_ELEMENT_CAST (demux), pad);
+}
+
+static GstClockTime
+gst_adaptive_demux_stream_get_presentation_offset (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstAdaptiveDemuxClass *klass;
+
+  klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  if (klass->get_presentation_offset == NULL)
+    return 0;
+
+  return klass->get_presentation_offset (demux, stream);
+}
+
+static gboolean
+gst_adaptive_demux_expose_streams (GstAdaptiveDemux * demux,
+    gboolean first_segment)
+{
+  GList *iter;
+  GList *old_streams;
+  GstClockTime min_pts = GST_CLOCK_TIME_NONE;
+
+  g_return_val_if_fail (demux->next_streams != NULL, FALSE);
+
+  demux->priv->exposing = TRUE;
+  old_streams = demux->streams;
+  demux->streams = demux->next_streams;
+  demux->next_streams = NULL;
+
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+
+    if (!gst_adaptive_demux_expose_stream (demux,
+            GST_ADAPTIVE_DEMUX_STREAM_CAST (stream))) {
+      /* TODO act on error */
+    }
+
+    if (first_segment) {
+      /* TODO we only need the first timestamp, maybe create a simple function */
+      gst_adaptive_demux_stream_update_fragment_info (demux, stream);
+
+      if (GST_CLOCK_TIME_IS_VALID (min_pts)) {
+        min_pts = MIN (min_pts, stream->fragment.timestamp);
+      } else {
+        min_pts = stream->fragment.timestamp;
+      }
+    }
+  }
+
+  if (first_segment)
+    demux->segment.start = demux->segment.position = demux->segment.time =
+        min_pts;
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+    GstClockTime offset;
+
+    offset = gst_adaptive_demux_stream_get_presentation_offset (demux, stream);
+    stream->segment = demux->segment;
+    stream->segment.start = stream->segment.position =
+        stream->fragment.timestamp + offset;
+    stream->pending_segment = gst_event_new_segment (&stream->segment);
+  }
+
+  gst_element_no_more_pads (GST_ELEMENT_CAST (demux));
+  demux->priv->exposing = FALSE;
+
+  if (old_streams) {
+    GstEvent *eos = gst_event_new_eos ();
+
+    for (iter = old_streams; iter; iter = g_list_next (iter)) {
+      GstAdaptiveDemuxStream *stream = iter->data;
+
+      GST_LOG_OBJECT (stream->pad, "Removing stream");
+      gst_pad_push_event (stream->pad, gst_event_ref (eos));
+      gst_pad_set_active (stream->pad, FALSE);
+      gst_element_remove_pad (GST_ELEMENT (demux), stream->pad);
+    }
+    gst_event_unref (eos);
+
+    /* The list should be freed from another thread as we can't properly
+     * cleanup a GstTask from itself */
+    GST_OBJECT_LOCK (demux);
+    demux->priv->old_streams =
+        g_list_concat (demux->priv->old_streams, old_streams);
+    GST_OBJECT_UNLOCK (demux);
+  }
+
+  return TRUE;
+}
+
+GstAdaptiveDemuxStream *
+gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux, GstPad * pad)
+{
+  GstAdaptiveDemuxStream *stream;
+
+  stream = g_malloc0 (demux->stream_struct_size);
+
+  /* Downloading task */
+  g_rec_mutex_init (&stream->download_lock);
+  stream->download_task =
+      gst_task_new ((GstTaskFunction) gst_adaptive_demux_stream_download_loop,
+      stream, NULL);
+  gst_task_set_lock (stream->download_task, &stream->download_lock);
+
+  stream->pad = pad;
+  stream->demux = demux;
+  stream->fragment_bitrates =
+      g_malloc0 (sizeof (guint64) * demux->num_lookback_fragments);
+  gst_pad_set_element_private (pad, stream);
+
+  gst_pad_set_query_function (pad,
+      GST_DEBUG_FUNCPTR (gst_adaptive_demux_src_query));
+  gst_pad_set_event_function (pad,
+      GST_DEBUG_FUNCPTR (gst_adaptive_demux_src_event));
+
+  gst_segment_init (&stream->segment, GST_FORMAT_TIME);
+  g_cond_init (&stream->fragment_download_cond);
+  g_mutex_init (&stream->fragment_download_lock);
+  stream->adapter = gst_adapter_new ();
+
+  demux->next_streams = g_list_append (demux->next_streams, stream);
+
+  return stream;
+}
+
+static void
+gst_adaptive_demux_stream_free (GstAdaptiveDemuxStream * stream)
+{
+  GstAdaptiveDemux *demux = stream->demux;
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  if (klass->stream_free)
+    klass->stream_free (stream);
+
+  g_clear_error (&stream->last_error);
+  if (stream->download_task) {
+    if (GST_TASK_STATE (stream->download_task) != GST_TASK_STOPPED) {
+      GST_DEBUG_OBJECT (demux, "Leaving streaming task %s:%s",
+          GST_DEBUG_PAD_NAME (stream->pad));
+
+      g_cond_signal (&stream->fragment_download_cond);
+      gst_task_stop (stream->download_task);
+    }
+    GST_LOG_OBJECT (demux, "Waiting for task to finish");
+    gst_task_join (stream->download_task);
+    GST_LOG_OBJECT (demux, "Finished");
+    gst_object_unref (stream->download_task);
+    g_rec_mutex_clear (&stream->download_lock);
+    stream->download_task = NULL;
+  }
+
+  gst_adaptive_demux_stream_fragment_clear (&stream->fragment);
+
+  if (stream->pending_segment) {
+    gst_event_unref (stream->pending_segment);
+    stream->pending_segment = NULL;
+  }
+
+  if (stream->src_srcpad) {
+    gst_object_unref (stream->src_srcpad);
+    stream->src_srcpad = NULL;
+  }
+
+  if (stream->src) {
+    gst_element_set_state (stream->src, GST_STATE_NULL);
+    gst_bin_remove (GST_BIN_CAST (demux), stream->src);
+    stream->src = NULL;
+  }
+
+  g_cond_clear (&stream->fragment_download_cond);
+  g_mutex_clear (&stream->fragment_download_lock);
+
+  g_free (stream->fragment_bitrates);
+
+  if (stream->pad) {
+    gst_object_unref (stream->pad);
+    stream->pad = NULL;
+  }
+  if (stream->pending_caps)
+    gst_caps_unref (stream->pending_caps);
+
+  g_object_unref (stream->adapter);
+
+  g_free (stream);
+}
+
+static gboolean
+gst_adaptive_demux_get_live_seek_range (GstAdaptiveDemux * demux,
+    gint64 * range_start, gint64 * range_stop)
+{
+  GstAdaptiveDemuxClass *klass;
+
+  klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  g_return_val_if_fail (klass->get_live_seek_range, FALSE);
+
+  return klass->get_live_seek_range (demux, range_start, range_stop);
+}
+
+static gboolean
+gst_adaptive_demux_can_seek (GstAdaptiveDemux * demux)
+{
+  GstAdaptiveDemuxClass *klass;
+
+  klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+  if (gst_adaptive_demux_is_live (demux)) {
+    return klass->get_live_seek_range != NULL;
+  }
+
+  return klass->seek != NULL;
+}
+
+static gboolean
+gst_adaptive_demux_src_event (GstPad * pad, GstObject * parent,
+    GstEvent * event)
+{
+  GstAdaptiveDemux *demux;
+  GstAdaptiveDemuxClass *demux_class;
+
+  demux = GST_ADAPTIVE_DEMUX_CAST (parent);
+  demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  switch (event->type) {
+    case GST_EVENT_SEEK:
+    {
+      gdouble rate;
+      GstFormat format;
+      GstSeekFlags flags;
+      GstSeekType start_type, stop_type;
+      gint64 start, stop;
+      guint32 seqnum;
+      GList *iter;
+      gboolean update;
+      gboolean ret = TRUE;
+      GstSegment oldsegment;
+
+      GST_INFO_OBJECT (demux, "Received seek event");
+
+      GST_MANIFEST_LOCK (demux);
+      if (!gst_adaptive_demux_can_seek (demux)) {
+        GST_MANIFEST_UNLOCK (demux);
+        gst_event_unref (event);
+        return FALSE;
+      }
+      GST_MANIFEST_UNLOCK (demux);
+
+      gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
+          &stop_type, &stop);
+
+      if (format != GST_FORMAT_TIME) {
+        gst_event_unref (event);
+        return FALSE;
+      }
+
+      if (gst_adaptive_demux_is_live (demux)) {
+        gint64 range_start, range_stop;
+        if (!gst_adaptive_demux_get_live_seek_range (demux, &range_start,
+                &range_stop)) {
+          gst_event_unref (event);
+          return FALSE;
+        }
+        if (start < range_start || start >= range_stop) {
+          GST_WARNING_OBJECT (demux, "Seek to invalid position");
+          gst_event_unref (event);
+          return FALSE;
+        }
+      }
+
+      seqnum = gst_event_get_seqnum (event);
+
+      GST_DEBUG_OBJECT (demux,
+          "seek event, rate: %f type: %d start: %" GST_TIME_FORMAT " stop: %"
+          GST_TIME_FORMAT, rate, start_type, GST_TIME_ARGS (start),
+          GST_TIME_ARGS (stop));
+
+      /* have a backup in case seek fails */
+      gst_segment_copy_into (&demux->segment, &oldsegment);
+
+      gst_segment_do_seek (&demux->segment, rate, format, flags, start_type,
+          start, stop_type, stop, &update);
+
+      if (flags & GST_SEEK_FLAG_FLUSH) {
+        GstEvent *fevent;
+
+        GST_DEBUG_OBJECT (demux, "sending flush start");
+        fevent = gst_event_new_flush_start ();
+        gst_event_set_seqnum (fevent, seqnum);
+        gst_adaptive_demux_push_src_event (demux, fevent);
+      }
+      gst_adaptive_demux_stop_tasks (demux);
+      GST_DEBUG_OBJECT (demux, "Seeking to segment %" GST_SEGMENT_FORMAT,
+          &demux->segment);
+
+      GST_MANIFEST_LOCK (demux);
+      ret = demux_class->seek (demux, event);
+
+      if (ret) {
+        GstEvent *seg_evt;
+
+        seg_evt = gst_event_new_segment (&demux->segment);
+        gst_event_set_seqnum (seg_evt, seqnum);
+        for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+          GstAdaptiveDemuxStream *stream = iter->data;
+
+          gst_event_replace (&stream->pending_segment, seg_evt);
+        }
+        gst_event_unref (seg_evt);
+      } else {
+        /* Is there anything else we can do if it fails? */
+        gst_segment_copy_into (&oldsegment, &demux->segment);
+      }
+
+      if (flags & GST_SEEK_FLAG_FLUSH) {
+        GstEvent *fevent;
+
+        GST_DEBUG_OBJECT (demux, "Sending flush stop on all pad");
+        fevent = gst_event_new_flush_stop (TRUE);
+        gst_event_set_seqnum (fevent, seqnum);
+        gst_adaptive_demux_push_src_event (demux, fevent);
+      }
+      if (demux->next_streams) {
+        gst_adaptive_demux_expose_streams (demux, TRUE);
+      }
+
+      /* Restart the demux */
+      gst_adaptive_demux_start_tasks (demux);
+      GST_MANIFEST_UNLOCK (demux);
+
+      gst_event_unref (event);
+      return ret;
+    }
+    case GST_EVENT_RECONFIGURE:{
+      GList *iter;
+
+      /* When exposing pads reconfigure events are received as result
+       * of the linking of the pads. The exposing and reconfigure happens
+       * from the same thread. This prevents a deadlock and, although
+       * not beautiful, makes this safe by avoiding that the demux->streams
+       * list gets modified while this loop is running */
+      if (!demux->priv->exposing)
+        GST_MANIFEST_LOCK (demux);
+
+      for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+        GstAdaptiveDemuxStream *stream = iter->data;
+
+        if (stream->pad == pad) {
+          g_mutex_lock (&stream->fragment_download_lock);
+          if (stream->last_ret == GST_FLOW_NOT_LINKED) {
+            stream->last_ret = GST_FLOW_OK;
+            stream->restart_download = TRUE;
+            stream->need_header = TRUE;
+            stream->discont = TRUE;
+            GST_DEBUG_OBJECT (stream->pad, "Restarting download loop");
+            gst_task_start (stream->download_task);
+          }
+          g_mutex_unlock (&stream->fragment_download_lock);
+          gst_event_unref (event);
+          if (!demux->priv->exposing)
+            GST_MANIFEST_UNLOCK (demux);
+          return TRUE;
+        }
+      }
+      if (!demux->priv->exposing)
+        GST_MANIFEST_UNLOCK (demux);
+    }
+      break;
+    case GST_EVENT_LATENCY:{
+      /* Upstream and our internal source are irrelevant
+       * for latency, and we should not fail here to
+       * configure the latency */
+      gst_event_unref (event);
+      return TRUE;
+    }
+    default:
+      break;
+  }
+
+  return gst_pad_event_default (pad, parent, event);
+}
+
+static gboolean
+gst_adaptive_demux_src_query (GstPad * pad, GstObject * parent,
+    GstQuery * query)
+{
+  GstAdaptiveDemux *demux;
+  GstAdaptiveDemuxClass *demux_class;
+  gboolean ret = FALSE;
+
+  if (query == NULL)
+    return FALSE;
+
+  demux = GST_ADAPTIVE_DEMUX_CAST (parent);
+  demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  switch (query->type) {
+    case GST_QUERY_DURATION:{
+      GstClockTime duration = -1;
+      GstFormat fmt;
+
+      GST_MANIFEST_LOCK (demux);
+      gst_query_parse_duration (query, &fmt, NULL);
+      if (fmt == GST_FORMAT_TIME && demux->priv->manifest_buffer != NULL) {
+        duration = demux_class->get_duration (demux);
+
+        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) {
+          gst_query_set_duration (query, GST_FORMAT_TIME, duration);
+          ret = TRUE;
+        }
+      }
+      GST_MANIFEST_UNLOCK (demux);
+      GST_DEBUG_OBJECT (demux, "GST_QUERY_DURATION returns %s with duration %"
+          GST_TIME_FORMAT, ret ? "TRUE" : "FALSE", GST_TIME_ARGS (duration));
+      break;
+    }
+    case GST_QUERY_LATENCY:{
+      gboolean live = FALSE;
+
+      GST_MANIFEST_LOCK (demux);
+      live = demux->priv->manifest_buffer && gst_adaptive_demux_is_live (demux);
+      GST_MANIFEST_UNLOCK (demux);
+
+      gst_query_set_latency (query, live, 0, -1);
+      ret = TRUE;
+      break;
+    }
+    case GST_QUERY_SEEKING:{
+      GstFormat fmt;
+      gint64 stop = -1;
+      gint64 start = 0;
+
+      GST_MANIFEST_LOCK (demux);
+      if (demux->priv->manifest_buffer == NULL) {
+        GST_MANIFEST_UNLOCK (demux);
+        return FALSE;           /* can't answer without manifest */
+      }
+
+      gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
+      GST_INFO_OBJECT (demux, "Received GST_QUERY_SEEKING with format %d", fmt);
+      if (fmt == GST_FORMAT_TIME) {
+        GstClockTime duration;
+        gboolean can_seek = gst_adaptive_demux_can_seek (demux);
+
+        ret = TRUE;
+        if (can_seek) {
+          if (gst_adaptive_demux_is_live (demux)) {
+            ret = gst_adaptive_demux_get_live_seek_range (demux, &start, &stop);
+          } else {
+            duration = demux_class->get_duration (demux);
+            if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0)
+              stop = duration;
+          }
+        }
+        gst_query_set_seeking (query, fmt, can_seek, start, stop);
+        GST_INFO_OBJECT (demux, "GST_QUERY_SEEKING returning with start : %"
+            GST_TIME_FORMAT ", stop : %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
+      }
+      GST_MANIFEST_UNLOCK (demux);
+      break;
+    }
+    case GST_QUERY_URI:
+      /* TODO HLS can answer this differently it seems */
+      GST_MANIFEST_LOCK (demux);
+      if (demux->manifest_uri) {
+        /* FIXME: (hls) Do we answer with the variant playlist, with the current
+         * playlist or the the uri of the last downlowaded fragment? */
+        gst_query_set_uri (query, demux->manifest_uri);
+        ret = TRUE;
+      }
+      GST_MANIFEST_UNLOCK (demux);
+      break;
+    default:
+      /* Don't forward queries upstream because of the special nature of this
+       *  "demuxer", which relies on the upstream element only to be fed
+       *  the Manifest
+       */
+      break;
+  }
+
+  return ret;
+}
+
+static void
+gst_adaptive_demux_start_tasks (GstAdaptiveDemux * demux)
+{
+  GList *iter;
+
+  GST_INFO_OBJECT (demux, "Starting streams' tasks");
+  demux->cancelled = FALSE;
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+    stream->last_ret = GST_FLOW_OK;
+    gst_task_start (stream->download_task);
+  }
+}
+
+static void
+gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux)
+{
+  GList *iter;
+
+  demux->cancelled = TRUE;
+
+  demux->priv->stop_updates_task = TRUE;
+  gst_task_stop (demux->priv->updates_task);
+  g_cond_signal (&demux->priv->updates_timed_cond);
+
+  GST_MANIFEST_LOCK (demux);
+  g_cond_broadcast (&demux->manifest_cond);
+  GST_MANIFEST_UNLOCK (demux);
+
+  gst_uri_downloader_cancel (demux->priv->downloader);
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+
+    gst_task_stop (stream->download_task);
+    if (stream->src)
+      gst_element_set_state (stream->src, GST_STATE_READY);
+    g_mutex_lock (&stream->fragment_download_lock);
+    stream->download_finished = TRUE;
+    g_cond_signal (&stream->fragment_download_cond);
+    g_mutex_unlock (&stream->fragment_download_lock);
+  }
+
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+
+    gst_task_join (stream->download_task);
+    stream->download_error_count = 0;
+    stream->need_header = TRUE;
+    gst_adapter_clear (stream->adapter);
+  }
+  gst_task_join (demux->priv->updates_task);
+}
+
+static gboolean
+gst_adaptive_demux_push_src_event (GstAdaptiveDemux * demux, GstEvent * event)
+{
+  GList *iter;
+  gboolean ret = TRUE;
+
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+    gst_event_ref (event);
+    ret = ret & gst_pad_push_event (stream->pad, event);
+  }
+  gst_event_unref (event);
+  return ret;
+}
+
+void
+gst_adaptive_demux_stream_set_caps (GstAdaptiveDemuxStream * stream,
+    GstCaps * caps)
+{
+  GST_DEBUG_OBJECT (stream->pad, "setting new caps for stream %" GST_PTR_FORMAT,
+      caps);
+  gst_caps_replace (&stream->pending_caps, caps);
+  gst_caps_unref (caps);
+}
+
+void
+gst_adaptive_demux_stream_set_tags (GstAdaptiveDemuxStream * stream,
+    GstTagList * tags)
+{
+  GST_DEBUG_OBJECT (stream->pad, "setting new tags for stream %" GST_PTR_FORMAT,
+      tags);
+  if (stream->pending_tags) {
+    gst_tag_list_unref (stream->pending_tags);
+  }
+  stream->pending_tags = tags;
+}
+
+static guint64
+_update_average_bitrate (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, guint64 new_bitrate)
+{
+  gint index = stream->moving_index % demux->num_lookback_fragments;
+
+  stream->moving_bitrate -= stream->fragment_bitrates[index];
+  stream->fragment_bitrates[index] = new_bitrate;
+  stream->moving_bitrate += new_bitrate;
+
+  stream->moving_index += 1;
+
+  if (stream->moving_index > demux->num_lookback_fragments)
+    return stream->moving_bitrate / demux->num_lookback_fragments;
+  return stream->moving_bitrate / stream->moving_index;
+}
+
+static guint64
+gst_adaptive_demux_stream_update_current_bitrate (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  guint64 average_bitrate;
+  guint64 fragment_bitrate;
+
+  fragment_bitrate =
+      (stream->fragment_total_size * 8) /
+      ((double) stream->fragment_total_time / G_GUINT64_CONSTANT (1000000));
+  stream->fragment_total_size = 0;
+  stream->fragment_total_time = 0;
+
+  average_bitrate = _update_average_bitrate (demux, stream, fragment_bitrate);
+
+  GST_INFO_OBJECT (stream, "last fragment bitrate was %" G_GUINT64_FORMAT,
+      fragment_bitrate);
+  GST_INFO_OBJECT (stream,
+      "Last %u fragments average bitrate is %" G_GUINT64_FORMAT,
+      demux->num_lookback_fragments, average_bitrate);
+
+  /* Conservative approach, make sure we don't upgrade too fast */
+  stream->current_download_rate = MIN (average_bitrate, fragment_bitrate);
+
+  if (demux->connection_speed) {
+    GST_LOG_OBJECT (demux, "Connection-speed is set to %u kbps, using it",
+        demux->connection_speed / 1000);
+    return demux->connection_speed;
+  }
+
+  stream->current_download_rate *= demux->bitrate_limit;
+  GST_DEBUG_OBJECT (demux, "Bitrate after bitrate limit (%0.2f): %"
+      G_GUINT64_FORMAT, demux->bitrate_limit, stream->current_download_rate);
+
+  return stream->current_download_rate;
+}
+
+static GstFlowReturn
+gst_adaptive_demux_combine_flows (GstAdaptiveDemux * demux)
+{
+  gboolean all_notlinked = TRUE;
+  gboolean all_eos = TRUE;
+  GList *iter;
+
+  for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+    GstAdaptiveDemuxStream *stream = iter->data;
+
+    g_mutex_lock (&stream->fragment_download_lock);
+    if (stream->last_ret != GST_FLOW_NOT_LINKED) {
+      all_notlinked = FALSE;
+      if (stream->last_ret != GST_FLOW_EOS)
+        all_eos = FALSE;
+    }
+
+    if (stream->last_ret <= GST_FLOW_NOT_NEGOTIATED
+        || stream->last_ret == GST_FLOW_FLUSHING) {
+      g_mutex_unlock (&stream->fragment_download_lock);
+      return stream->last_ret;
+    }
+    g_mutex_unlock (&stream->fragment_download_lock);
+  }
+  if (all_notlinked)
+    return GST_FLOW_NOT_LINKED;
+  else if (all_eos)
+    return GST_FLOW_EOS;
+  return GST_FLOW_OK;
+}
+
+GstFlowReturn
+gst_adaptive_demux_stream_push_buffer (GstAdaptiveDemuxStream * stream,
+    GstBuffer * buffer)
+{
+  GstAdaptiveDemux *demux = stream->demux;
+  GstFlowReturn ret = GST_FLOW_OK;
+  gboolean discont = FALSE;
+  GstClockTime offset =
+      gst_adaptive_demux_stream_get_presentation_offset (demux, stream);
+
+  if (stream->first_fragment_buffer) {
+    if (demux->segment.rate < 0)
+      /* Set DISCONT flag for every first buffer in reverse playback mode
+       * as each fragment for its own has to be reversed */
+      discont = TRUE;
+
+    GST_BUFFER_PTS (buffer) = stream->fragment.timestamp;
+    if (GST_BUFFER_PTS_IS_VALID (buffer))
+      stream->segment.position = GST_BUFFER_PTS (buffer);
+  } else {
+    GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
+  }
+
+  if (stream->discont) {
+    discont = TRUE;
+    stream->discont = FALSE;
+  }
+
+  if (discont) {
+    GST_DEBUG_OBJECT (stream->pad, "Marking fragment as discontinuous");
+    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
+  } else {
+    GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
+  }
+
+  stream->first_fragment_buffer = FALSE;
+
+  if (GST_BUFFER_PTS (buffer) != GST_CLOCK_TIME_NONE)
+    GST_BUFFER_PTS (buffer) += offset;
+  GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
+  GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
+
+  if (G_UNLIKELY (stream->pending_caps)) {
+    GST_DEBUG_OBJECT (stream->pad, "Setting pending caps: %" GST_PTR_FORMAT,
+        stream->pending_caps);
+    gst_pad_set_caps (stream->pad, stream->pending_caps);
+    gst_caps_unref (stream->pending_caps);
+    stream->pending_caps = NULL;
+  }
+  if (G_UNLIKELY (stream->pending_segment)) {
+    GST_DEBUG_OBJECT (stream->pad, "Sending pending seg: %" GST_PTR_FORMAT,
+        stream->pending_segment);
+    gst_pad_push_event (stream->pad, stream->pending_segment);
+    stream->pending_segment = NULL;
+  }
+  if (G_UNLIKELY (stream->pending_tags)) {
+    GST_DEBUG_OBJECT (stream->pad, "Sending pending tags: %" GST_PTR_FORMAT,
+        stream->pending_tags);
+    gst_pad_push_event (stream->pad, gst_event_new_tag (stream->pending_tags));
+    stream->pending_tags = NULL;
+  }
+
+  ret = gst_pad_push (stream->pad, buffer);
+  GST_LOG_OBJECT (stream->pad, "Push result: %d %s", ret,
+      gst_flow_get_name (ret));
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_adaptive_demux_stream_finish_fragment_default (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  /* No need to advance, this isn't a real fragment */
+  if (G_UNLIKELY (stream->downloading_header || stream->downloading_index))
+    return GST_FLOW_OK;
+
+  return gst_adaptive_demux_stream_advance_fragment (demux, stream,
+      stream->fragment.duration);
+}
+
+static GstFlowReturn
+gst_adaptive_demux_stream_data_received_default (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstBuffer *buffer;
+
+  buffer = gst_adapter_take_buffer (stream->adapter,
+      gst_adapter_available (stream->adapter));
+  return gst_adaptive_demux_stream_push_buffer (stream, buffer);
+}
+
+static GstFlowReturn
+_src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+{
+  GstPad *srcpad = (GstPad *) parent;
+  GstAdaptiveDemuxStream *stream = gst_pad_get_element_private (srcpad);
+  GstAdaptiveDemux *demux = stream->demux;
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+  GstFlowReturn ret = GST_FLOW_OK;
+
+  if (stream->starting_fragment) {
+    stream->starting_fragment = FALSE;
+    if (klass->start_fragment) {
+      klass->start_fragment (demux, stream);
+    }
+
+    GST_BUFFER_PTS (buffer) = stream->fragment.timestamp;
+
+    GST_LOG_OBJECT (stream->pad, "set fragment pts=%" GST_TIME_FORMAT,
+        GST_TIME_ARGS (GST_BUFFER_PTS (buffer)));
+
+    if (GST_BUFFER_PTS_IS_VALID (buffer))
+      stream->segment.position = GST_BUFFER_PTS (buffer);
+
+  } else {
+    GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
+  }
+
+  stream->download_total_time +=
+      g_get_monotonic_time () - stream->download_chunk_start_time;
+  stream->download_total_bytes += gst_buffer_get_size (buffer);
+
+  stream->fragment_total_size += gst_buffer_get_size (buffer);
+  stream->fragment_total_time +=
+      g_get_monotonic_time () - stream->download_chunk_start_time;
+
+  gst_adapter_push (stream->adapter, buffer);
+  GST_DEBUG_OBJECT (stream->pad, "Received buffer of size %" G_GSIZE_FORMAT
+      ". Now %" G_GSIZE_FORMAT " on adapter", gst_buffer_get_size (buffer),
+      gst_adapter_available (stream->adapter));
+  ret = klass->data_received (demux, stream);
+  stream->download_chunk_start_time = g_get_monotonic_time ();
+
+  if (ret != GST_FLOW_OK) {
+    if (ret < GST_FLOW_EOS) {
+      GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL),
+          ("stream stopped, reason %s", gst_flow_get_name (ret)));
+
+      /* TODO push this on all pads */
+      gst_pad_push_event (stream->pad, gst_event_new_eos ());
+    } else {
+      GST_DEBUG_OBJECT (stream->pad, "stream stopped, reason %s",
+          gst_flow_get_name (ret));
+    }
+
+    gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
+    if (ret == (GstFlowReturn) GST_ADAPTIVE_DEMUX_FLOW_SWITCH)
+      ret = GST_FLOW_EOS;       /* return EOS to make the source stop */
+  }
+
+  return ret;
+}
+
+static void
+gst_adaptive_demux_stream_fragment_download_finish (GstAdaptiveDemuxStream *
+    stream, GstFlowReturn ret, GError * err)
+{
+  g_mutex_lock (&stream->fragment_download_lock);
+  stream->download_finished = TRUE;
+
+  /* if we have an error, only replace last_ret if it was OK before to avoid
+   * overwriting the first error we got */
+  if (err) {
+    if (stream->last_ret == GST_FLOW_OK) {
+      stream->last_ret = ret;
+      g_clear_error (&stream->last_error);
+      stream->last_error = g_error_copy (err);
+    }
+  } else {
+    stream->last_ret = ret;
+  }
+  g_cond_signal (&stream->fragment_download_cond);
+  g_mutex_unlock (&stream->fragment_download_lock);
+}
+
+static gboolean
+_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
+{
+  GstPad *srcpad = GST_PAD_CAST (parent);
+  GstAdaptiveDemuxStream *stream = gst_pad_get_element_private (srcpad);
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_EOS:{
+      GstAdaptiveDemuxClass *klass;
+      GstFlowReturn ret;
+
+      klass = GST_ADAPTIVE_DEMUX_GET_CLASS (stream->demux);
+      ret = klass->finish_fragment (stream->demux, stream);
+      gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
+      break;
+    }
+    default:
+      break;
+  }
+
+  gst_event_unref (event);
+
+  return TRUE;
+}
+
+static gboolean
+_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
+{
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_ALLOCATION:
+      return FALSE;
+      break;
+    default:
+      break;
+  }
+
+  return gst_pad_query_default (pad, parent, query);
+}
+
+static gboolean
+gst_adaptive_demux_stream_wait_manifest_update (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  gboolean ret = TRUE;
+
+  /* Wait until we're cancelled or there's something for
+   * us to download in the playlist or the playlist
+   * became non-live */
+  while (TRUE) {
+    if (demux->cancelled) {
+      ret = FALSE;
+      break;
+    }
+
+    /* Got a new fragment or not live anymore? */
+    if (gst_adaptive_demux_stream_has_next_fragment (demux, stream)) {
+      GST_DEBUG_OBJECT (demux, "new fragment available, "
+          "not waiting for manifest update");
+      ret = TRUE;
+      break;
+    }
+
+    if (!gst_adaptive_demux_is_live (demux)) {
+      GST_DEBUG_OBJECT (demux, "Not live anymore, "
+          "not waiting for manifest update");
+      ret = FALSE;
+      break;
+    }
+
+    GST_DEBUG_OBJECT (demux, "No fragment left but live playlist, wait a bit");
+    g_cond_wait (&demux->manifest_cond, GST_MANIFEST_GET_LOCK (demux));
+  }
+  GST_DEBUG_OBJECT (demux, "Retrying now");
+  return ret;
+}
+
+static gboolean
+_adaptive_demux_pad_remove_eos_sticky (GstPad * pad, GstEvent ** event,
+    gpointer udata)
+{
+  if (GST_EVENT_TYPE (*event) == GST_EVENT_EOS) {
+    gst_event_replace (event, NULL);
+    return FALSE;
+  }
+  return TRUE;
+}
+
+static void
+gst_adaptive_demux_stream_clear_eos_and_flush_state (GstAdaptiveDemuxStream *
+    stream)
+{
+  GstPad *internal_pad;
+
+  internal_pad =
+      GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (stream->pad)));
+  gst_pad_sticky_events_foreach (internal_pad,
+      _adaptive_demux_pad_remove_eos_sticky, NULL);
+  GST_OBJECT_FLAG_UNSET (internal_pad, GST_PAD_FLAG_EOS);
+  /* In case the stream is recovering from a flushing seek it is also needed
+   * to remove the flushing state from this pad. The flushing state is set
+   * because of the flow return propagating until the source element */
+  GST_PAD_UNSET_FLUSHING (internal_pad);
+
+  gst_object_unref (internal_pad);
+}
+
+static gboolean
+gst_adaptive_demux_stream_update_source (GstAdaptiveDemuxStream * stream,
+    const gchar * uri, const gchar * referer, gboolean refresh,
+    gboolean allow_cache)
+{
+  GstAdaptiveDemux *demux = stream->demux;
+
+  if (!gst_uri_is_valid (uri)) {
+    GST_WARNING_OBJECT (stream->pad, "Invalid URI: %s", uri);
+    return FALSE;
+  }
+
+  if (stream->src != NULL) {
+    gchar *old_protocol, *new_protocol;
+    gchar *old_uri;
+
+    old_uri = gst_uri_handler_get_uri (GST_URI_HANDLER (stream->src));
+    old_protocol = gst_uri_get_protocol (old_uri);
+    new_protocol = gst_uri_get_protocol (uri);
+
+    if (!g_str_equal (old_protocol, new_protocol)) {
+      gst_object_unref (stream->src_srcpad);
+      gst_element_set_state (stream->src, GST_STATE_NULL);
+      gst_bin_remove (GST_BIN_CAST (demux), stream->src);
+      stream->src = NULL;
+      stream->src_srcpad = NULL;
+      GST_DEBUG_OBJECT (demux, "Can't re-use old source element");
+    } else {
+      GError *err = NULL;
+
+      GST_DEBUG_OBJECT (demux, "Re-using old source element");
+      if (!gst_uri_handler_set_uri (GST_URI_HANDLER (stream->src), uri, &err)) {
+        GST_DEBUG_OBJECT (demux, "Failed to re-use old source element: %s",
+            err->message);
+        g_clear_error (&err);
+        gst_object_unref (stream->src_srcpad);
+        gst_element_set_state (stream->src, GST_STATE_NULL);
+        gst_bin_remove (GST_BIN_CAST (demux), stream->src);
+        stream->src = NULL;
+        stream->src_srcpad = NULL;
+      }
+    }
+    g_free (old_uri);
+    g_free (old_protocol);
+    g_free (new_protocol);
+  }
+
+  if (stream->src == NULL) {
+    GObjectClass *gobject_class;
+    GstPad *internal_pad;
+
+    stream->src = gst_element_make_from_uri (GST_URI_SRC, uri, NULL, NULL);
+    if (stream->src == NULL) {
+      GST_ELEMENT_ERROR (demux, CORE, MISSING_PLUGIN,
+          ("Missing plugin to handle URI: '%s'", uri), (NULL));
+      return FALSE;
+    }
+
+    gobject_class = G_OBJECT_GET_CLASS (stream->src);
+
+    if (g_object_class_find_property (gobject_class, "compress"))
+      g_object_set (stream->src, "compress", FALSE, NULL);
+    if (g_object_class_find_property (gobject_class, "keep-alive"))
+      g_object_set (stream->src, "keep-alive", TRUE, NULL);
+    if (g_object_class_find_property (gobject_class, "extra-headers")) {
+      if (referer || refresh || !allow_cache) {
+        GstStructure *extra_headers = gst_structure_new_empty ("headers");
+
+        if (referer)
+          gst_structure_set (extra_headers, "Referer", G_TYPE_STRING, referer,
+              NULL);
+
+        if (!allow_cache)
+          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
+              "no-cache", NULL);
+        else if (refresh)
+          gst_structure_set (extra_headers, "Cache-Control", G_TYPE_STRING,
+              "max-age=0", NULL);
+
+        g_object_set (stream->src, "extra-headers", extra_headers, NULL);
+
+        gst_structure_free (extra_headers);
+      } else {
+        g_object_set (stream->src, "extra-headers", NULL, NULL);
+      }
+    }
+
+    gst_element_set_locked_state (stream->src, TRUE);
+    gst_bin_add (GST_BIN_CAST (demux), stream->src);
+    stream->src_srcpad = gst_element_get_static_pad (stream->src, "src");
+
+    gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (stream->pad),
+        stream->src_srcpad);
+
+    /* set up our internal pad to drop all events from
+     * the http src we don't care about. On the chain function
+     * we just push the buffer forward, but this way dash can get
+     * the flow return from downstream */
+    internal_pad =
+        GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (stream->pad)));
+    gst_pad_set_chain_function (GST_PAD_CAST (internal_pad), _src_chain);
+    gst_pad_set_event_function (GST_PAD_CAST (internal_pad), _src_event);
+    /* need to set query otherwise deadlocks happen with allocation queries */
+    gst_pad_set_query_function (GST_PAD_CAST (internal_pad), _src_query);
+    gst_object_unref (internal_pad);
+  }
+  return TRUE;
+}
+
+/* must be called with the stream's fragment_download_lock */
+static GstFlowReturn
+gst_adaptive_demux_stream_download_uri (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, const gchar * uri, gint64 start,
+    gint64 end)
+{
+  GstFlowReturn ret = GST_FLOW_OK;
+  GST_DEBUG_OBJECT (stream->pad, "Downloading uri: %s, range:%" G_GINT64_FORMAT
+      " - %" G_GINT64_FORMAT, uri, start, end);
+
+  stream->download_finished = FALSE;
+
+  if (!gst_adaptive_demux_stream_update_source (stream, uri, NULL, FALSE, TRUE)) {
+    g_mutex_lock (&stream->fragment_download_lock);
+    ret = stream->last_ret = GST_FLOW_ERROR;
+    g_mutex_unlock (&stream->fragment_download_lock);
+    return ret;
+  }
+
+  if (gst_element_set_state (stream->src,
+          GST_STATE_READY) != GST_STATE_CHANGE_FAILURE) {
+    if (start != 0 || end != -1) {
+      if (!gst_element_send_event (stream->src, gst_event_new_seek (1.0,
+                  GST_FORMAT_BYTES, (GstSeekFlags) GST_SEEK_FLAG_FLUSH,
+                  GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, end))) {
+
+        /* looks like the source can't handle seeks in READY */
+        g_clear_error (&stream->last_error);
+        stream->last_error = g_error_new (GST_CORE_ERROR,
+            GST_CORE_ERROR_NOT_IMPLEMENTED,
+            "Source element can't handle range requests");
+        stream->last_ret = GST_FLOW_ERROR;
+      }
+    }
+
+    g_mutex_lock (&stream->fragment_download_lock);
+    if (G_LIKELY (stream->last_ret == GST_FLOW_OK)) {
+      stream->download_start_time = g_get_monotonic_time ();
+      stream->download_chunk_start_time = g_get_monotonic_time ();
+      g_mutex_unlock (&stream->fragment_download_lock);
+      gst_element_sync_state_with_parent (stream->src);
+      g_mutex_lock (&stream->fragment_download_lock);
+
+      /* wait for the fragment to be completely downloaded */
+      GST_DEBUG_OBJECT (stream->pad,
+          "Waiting for fragment download to finish: %s", uri);
+      while (!stream->demux->cancelled && !stream->download_finished) {
+        g_cond_wait (&stream->fragment_download_cond,
+            &stream->fragment_download_lock);
+      }
+      ret = stream->last_ret;
+
+      GST_DEBUG_OBJECT (stream->pad, "Fragment download finished: %s", uri);
+    }
+    g_mutex_unlock (&stream->fragment_download_lock);
+  } else {
+    g_mutex_lock (&stream->fragment_download_lock);
+    if (stream->last_ret == GST_FLOW_OK)
+      stream->last_ret = GST_FLOW_CUSTOM_ERROR;
+    ret = GST_FLOW_CUSTOM_ERROR;
+    g_mutex_unlock (&stream->fragment_download_lock);
+  }
+
+  /* flush the proxypads so that the EOS state is reset */
+  gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_start ());
+  gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_stop (TRUE));
+
+  gst_element_set_state (stream->src, GST_STATE_READY);
+  gst_adaptive_demux_stream_clear_eos_and_flush_state (stream);
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_adaptive_demux_stream_download_header_fragment (GstAdaptiveDemuxStream *
+    stream)
+{
+  GstAdaptiveDemux *demux = stream->demux;
+  GstFlowReturn ret = GST_FLOW_OK;
+
+  if (stream->fragment.header_uri != NULL) {
+    GST_DEBUG_OBJECT (demux, "Fetching header %s %" G_GINT64_FORMAT "-%"
+        G_GINT64_FORMAT, stream->fragment.header_uri,
+        stream->fragment.header_range_start, stream->fragment.header_range_end);
+
+    stream->downloading_header = TRUE;
+    ret = gst_adaptive_demux_stream_download_uri (demux, stream,
+        stream->fragment.header_uri, stream->fragment.header_range_start,
+        stream->fragment.header_range_end);
+    stream->downloading_header = FALSE;
+  }
+
+  /* check if we have an index */
+  if (!demux->cancelled && ret == GST_FLOW_OK) {        /* TODO check for other valid types */
+
+    if (stream->fragment.index_uri != NULL) {
+      GST_DEBUG_OBJECT (demux,
+          "Fetching index %s %" G_GINT64_FORMAT "-%" G_GINT64_FORMAT,
+          stream->fragment.index_uri,
+          stream->fragment.index_range_start, stream->fragment.index_range_end);
+      stream->downloading_index = TRUE;
+      ret = gst_adaptive_demux_stream_download_uri (demux, stream,
+          stream->fragment.index_uri, stream->fragment.index_range_start,
+          stream->fragment.index_range_end);
+      stream->downloading_index = FALSE;
+    }
+  }
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_adaptive_demux_stream_download_fragment (GstAdaptiveDemuxStream * stream)
+{
+  GstAdaptiveDemux *demux = stream->demux;
+  gchar *url = NULL;
+  GstFlowReturn ret = GST_FLOW_OK;
+
+  g_mutex_lock (&stream->fragment_download_lock);
+  stream->starting_fragment = TRUE;
+  stream->last_ret = GST_FLOW_OK;
+  stream->first_fragment_buffer = TRUE;
+  g_mutex_unlock (&stream->fragment_download_lock);
+
+  if (stream->fragment.uri == NULL && stream->fragment.header_uri == NULL &&
+      stream->fragment.index_uri == NULL)
+    goto no_url_error;
+
+  if (stream->need_header) {
+    ret = gst_adaptive_demux_stream_download_header_fragment (stream);
+    stream->need_header = FALSE;
+    if (ret != GST_FLOW_OK) {
+      return ret;
+    }
+  }
+
+  url = stream->fragment.uri;
+  GST_DEBUG_OBJECT (stream->pad, "Got url '%s' for stream %p", url, stream);
+  if (url) {
+    ret =
+        gst_adaptive_demux_stream_download_uri (demux, stream, url,
+        stream->fragment.range_start, stream->fragment.range_end);
+    GST_DEBUG_OBJECT (stream->pad, "Fragment download result: %d %s",
+        stream->last_ret, gst_flow_get_name (stream->last_ret));
+    if (ret != GST_FLOW_OK) {
+      GST_INFO_OBJECT (demux, "No fragment downloaded");
+      /* TODO check if we are truly stoping */
+      if (ret != GST_FLOW_ERROR && gst_adaptive_demux_is_live (demux)) {
+        /* looks like there is no way of knowing when a live stream has ended
+         * Have to assume we are falling behind and cause a manifest reload */
+        return GST_FLOW_EOS;
+      }
+    }
+  }
+
+  return ret;
+
+no_url_error:
+  {
+    GST_ELEMENT_ERROR (demux, STREAM, DEMUX,
+        (_("Failed to get fragment URL.")),
+        ("An error happened when getting fragment URL"));
+    gst_task_stop (stream->download_task);
+    return GST_FLOW_ERROR;
+  }
+}
+
+static void
+gst_adaptive_demux_stream_download_loop (GstAdaptiveDemuxStream * stream)
+{
+  GstAdaptiveDemux *demux = stream->demux;
+  guint64 next_download = 0;
+  GstFlowReturn ret;
+  gboolean live;
+
+  GST_LOG_OBJECT (stream->pad, "download loop start");
+
+  /* Check if we're done with our segment */
+  if (demux->segment.rate > 0) {
+    if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop)
+        && stream->segment.position >= demux->segment.stop) {
+      ret = GST_FLOW_EOS;
+      gst_task_stop (stream->download_task);
+      goto end_of_manifest;
+    }
+  } else {
+    if (GST_CLOCK_TIME_IS_VALID (demux->segment.start)
+        && stream->segment.position < demux->segment.start) {
+      ret = GST_FLOW_EOS;
+      gst_task_stop (stream->download_task);
+      goto end_of_manifest;
+    }
+  }
+
+  GST_OBJECT_LOCK (demux);
+  if (demux->cancelled) {
+    stream->last_ret = GST_FLOW_FLUSHING;
+    goto cancelled;
+  }
+
+  /* Cleanup old streams if any */
+  if (G_UNLIKELY (demux->priv->old_streams != NULL)) {
+    GList *old_streams = demux->priv->old_streams;
+    demux->priv->old_streams = NULL;
+    GST_OBJECT_UNLOCK (demux);
+
+    /* Need to unlock as it might post messages to the bus */
+    GST_DEBUG_OBJECT (stream->pad, "Cleaning up old streams");
+    g_list_free_full (old_streams,
+        (GDestroyNotify) gst_adaptive_demux_stream_free);
+    GST_DEBUG_OBJECT (stream->pad, "Cleaning up old streams (done)");
+  } else {
+    GST_OBJECT_UNLOCK (demux);
+  }
+
+  GST_MANIFEST_LOCK (demux);
+  if (G_UNLIKELY (stream->restart_download)) {
+    GstSegment segment;
+    GstEvent *seg_event;
+    GstClockTime cur, ts;
+    gint64 pos;
+
+    GST_DEBUG_OBJECT (stream->pad,
+        "Activating stream due to reconfigure event");
+
+    cur = stream->segment.position;
+
+    if (gst_pad_peer_query_position (stream->pad, GST_FORMAT_TIME, &pos)) {
+      ts = (GstClockTime) pos;
+      GST_DEBUG_OBJECT (demux, "Downstream position: %"
+          GST_TIME_FORMAT, GST_TIME_ARGS (ts));
+    } else {
+      gboolean have_pos = FALSE;
+
+      /* query other pads as some faulty element in the pad's branch might
+       * reject position queries. This should be better than using the
+       * demux segment position that can be much ahead */
+      for (GList * iter = demux->streams; iter != NULL;
+          iter = g_list_next (iter)) {
+        GstAdaptiveDemuxStream *cur_stream = iter->data;
+
+        have_pos =
+            gst_pad_peer_query_position (cur_stream->pad, GST_FORMAT_TIME,
+            &pos);
+        if (have_pos) {
+          ts = (GstClockTime) pos;
+          GST_DEBUG_OBJECT (stream->pad, "Downstream position: %"
+              GST_TIME_FORMAT, GST_TIME_ARGS (ts));
+          break;
+        }
+      }
+
+      if (!have_pos) {
+        ts = stream->segment.position;
+        GST_DEBUG_OBJECT (stream->pad, "Downstream position query failed, "
+            "failling back to looking at other pads");
+      }
+    }
+
+    /* we might have already pushed this data */
+    ts = MAX (ts, cur);
+
+    GST_DEBUG_OBJECT (stream->pad, "Restarting stream at "
+        "position %" GST_TIME_FORMAT, GST_TIME_ARGS (ts));
+    gst_segment_copy_into (&demux->segment, &segment);
+
+    if (GST_CLOCK_TIME_IS_VALID (ts)) {
+      /* TODO check return */
+      gst_adaptive_demux_stream_seek (demux, stream, ts);
+
+      if (cur < ts) {
+        segment.position = ts;
+      }
+    }
+    seg_event = gst_event_new_segment (&segment);
+    GST_DEBUG_OBJECT (stream->pad, "Sending restart segment: %"
+        GST_PTR_FORMAT, seg_event);
+    gst_pad_push_event (stream->pad, seg_event);
+
+    stream->restart_download = FALSE;
+  }
+  GST_OBJECT_LOCK (demux);
+  if (demux->cancelled) {
+    stream->last_ret = GST_FLOW_FLUSHING;
+    GST_MANIFEST_UNLOCK (demux);
+    goto cancelled;
+  }
+  GST_OBJECT_UNLOCK (demux);
+
+  live = gst_adaptive_demux_is_live (demux);
+
+  ret = gst_adaptive_demux_stream_update_fragment_info (demux, stream);
+  GST_DEBUG_OBJECT (stream->pad, "Fragment info update result: %d %s",
+      ret, gst_flow_get_name (ret));
+  if (ret == GST_FLOW_OK) {
+
+    /* wait for live fragments to be available */
+    if (live) {
+      gint64 wait_time =
+          gst_adaptive_demux_stream_get_fragment_waiting_time (demux, stream);
+      if (wait_time > 0)
+        gst_adaptive_demux_stream_download_wait (stream, wait_time);
+    }
+
+    GST_MANIFEST_UNLOCK (demux);
+
+    GST_OBJECT_LOCK (demux);
+    if (demux->cancelled) {
+      stream->last_ret = GST_FLOW_FLUSHING;
+      goto cancelled;
+    }
+    GST_OBJECT_UNLOCK (demux);
+
+    stream->last_ret = GST_FLOW_OK;
+    next_download = g_get_monotonic_time ();
+    ret = gst_adaptive_demux_stream_download_fragment (stream);
+
+    GST_OBJECT_LOCK (demux);
+    if (demux->cancelled) {
+      stream->last_ret = GST_FLOW_FLUSHING;
+      goto cancelled;
+    }
+    GST_OBJECT_UNLOCK (demux);
+
+    GST_MANIFEST_LOCK (demux);
+  }
+
+  switch (ret) {
+    case GST_FLOW_OK:
+      break;                    /* all is good, let's go */
+    case GST_FLOW_EOS:
+      GST_DEBUG_OBJECT (stream->pad, "EOS, checking to stop download loop");
+      /* we push the EOS after releasing the object lock */
+      if (gst_adaptive_demux_is_live (demux)) {
+        if (gst_adaptive_demux_stream_wait_manifest_update (demux, stream)) {
+          GST_MANIFEST_UNLOCK (demux);
+          return;
+        }
+        gst_task_stop (stream->download_task);
+      } else {
+        gst_task_stop (stream->download_task);
+        if (gst_adaptive_demux_combine_flows (demux) == GST_FLOW_EOS) {
+          if (gst_adaptive_demux_has_next_period (demux)) {
+            gst_adaptive_demux_advance_period (demux);
+            ret = GST_FLOW_OK;
+          }
+        }
+      }
+      break;
+
+    case GST_FLOW_NOT_LINKED:
+      gst_task_stop (stream->download_task);
+      if (gst_adaptive_demux_combine_flows (demux)
+          == GST_FLOW_NOT_LINKED) {
+        GST_ELEMENT_ERROR (demux, STREAM, FAILED,
+            (_("Internal data stream error.")), ("stream stopped, reason %s",
+                gst_flow_get_name (GST_FLOW_NOT_LINKED)));
+      }
+      break;
+
+    case GST_FLOW_FLUSHING:{
+      GList *iter;
+
+      for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+        GstAdaptiveDemuxStream *other;
+
+        other = iter->data;
+        gst_task_stop (other->download_task);
+      }
+    }
+      break;
+
+    default:
+      if (ret <= GST_FLOW_ERROR) {
+        gboolean is_live = gst_adaptive_demux_is_live (demux);
+        GST_WARNING_OBJECT (demux, "Error while downloading fragment");
+        if (++stream->download_error_count > MAX_DOWNLOAD_ERROR_COUNT) {
+          GST_MANIFEST_UNLOCK (demux);
+          goto download_error;
+        }
+
+        g_clear_error (&stream->last_error);
+
+        /* First try to update the playlist for non-live playlists
+         * in case the URIs have changed in the meantime. But only
+         * try it the first time, after that we're going to wait a
+         * a bit to not flood the server */
+        if (stream->download_error_count == 1 && !is_live) {
+          /* TODO hlsdemux had more options to this function (boolean and err) */
+          GST_MANIFEST_UNLOCK (demux);
+          if (gst_adaptive_demux_update_manifest (demux) == GST_FLOW_OK) {
+            /* Retry immediately, the playlist actually has changed */
+            GST_DEBUG_OBJECT (demux, "Updated the playlist");
+            return;
+          }
+          GST_MANIFEST_LOCK (demux);
+        }
+
+        /* Wait half the fragment duration before retrying */
+        next_download +=
+            gst_util_uint64_scale
+            (stream->fragment.duration, G_USEC_PER_SEC, 2 * GST_SECOND);
+
+        GST_MANIFEST_UNLOCK (demux);
+        g_mutex_lock (&stream->fragment_download_lock);
+        if (demux->cancelled) {
+          g_mutex_unlock (&stream->fragment_download_lock);
+          return;
+        }
+        g_cond_wait_until (&stream->fragment_download_cond,
+            &stream->fragment_download_lock, next_download);
+        g_mutex_unlock (&stream->fragment_download_lock);
+        GST_DEBUG_OBJECT (demux, "Retrying now");
+
+        /* Refetch the playlist now after we waited */
+        if (!is_live
+            && gst_adaptive_demux_update_manifest (demux) == GST_FLOW_OK) {
+          GST_DEBUG_OBJECT (demux, "Updated the playlist");
+        }
+        return;
+      }
+      break;
+  }
+
+  GST_MANIFEST_UNLOCK (demux);
+end_of_manifest:
+  if (G_UNLIKELY (ret == GST_FLOW_EOS)) {
+    gst_adaptive_demux_stream_push_event (stream, gst_event_new_eos ());
+  }
+
+end:
+  GST_LOG_OBJECT (stream->pad, "download loop end");
+  return;
+
+cancelled:
+  {
+    GST_DEBUG_OBJECT (stream->pad, "Stream has been cancelled");
+    GST_OBJECT_UNLOCK (demux);
+    goto end;
+  }
+download_error:
+  {
+    GstMessage *msg;
+
+    if (stream->last_error) {
+      gchar *debug = g_strdup_printf ("Error on stream %s:%s",
+          GST_DEBUG_PAD_NAME (stream->pad));
+      msg =
+          gst_message_new_error (GST_OBJECT_CAST (demux), stream->last_error,
+          debug);
+      GST_ERROR_OBJECT (stream->pad, "Download error: %s",
+          stream->last_error->message);
+      g_free (debug);
+    } else {
+      GError *err =
+          g_error_new (GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_FOUND,
+          _("Couldn't download fragments"));
+      msg =
+          gst_message_new_error (GST_OBJECT_CAST (demux), err,
+          "Fragment downloading has failed consecutive times");
+      g_error_free (err);
+      GST_ERROR_OBJECT (stream->pad,
+          "Download error: Couldn't download fragments, too many failures");
+    }
+
+    gst_element_post_message (GST_ELEMENT_CAST (demux), msg);
+    goto end;
+  }
+}
+
+static void
+gst_adaptive_demux_updates_loop (GstAdaptiveDemux * demux)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  /* Loop for updating of the playlist. This periodically checks if
+   * the playlist is updated and does so, then signals the streaming
+   * thread in case it can continue downloading now. */
+
+  /* block until the next scheduled update or the signal to quit this thread */
+  GST_DEBUG_OBJECT (demux, "Started updates task");
+
+  demux->priv->next_update =
+      g_get_monotonic_time () + klass->get_manifest_update_interval (demux);
+
+  /* Updating playlist only needed for live playlists */
+  while (gst_adaptive_demux_is_live (demux)) {
+    GstFlowReturn ret = GST_FLOW_OK;
+
+    /* Wait here until we should do the next update or we're cancelled */
+    GST_DEBUG_OBJECT (demux, "Wait for next playlist update");
+
+    g_mutex_lock (&demux->priv->updates_timed_lock);
+    if (demux->priv->stop_updates_task) {
+      g_mutex_unlock (&demux->priv->updates_timed_lock);
+      goto quit;
+    }
+    g_cond_wait_until (&demux->priv->updates_timed_cond,
+        &demux->priv->updates_timed_lock, demux->priv->next_update);
+    if (demux->priv->stop_updates_task) {
+      g_mutex_unlock (&demux->priv->updates_timed_lock);
+      goto quit;
+    }
+    g_mutex_unlock (&demux->priv->updates_timed_lock);
+
+    GST_DEBUG_OBJECT (demux, "Updating playlist");
+    ret = gst_adaptive_demux_update_manifest (demux);
+    if (ret == GST_FLOW_EOS) {
+    } else if (ret != GST_FLOW_OK) {
+      if (demux->priv->stop_updates_task)
+        goto quit;
+      demux->priv->update_failed_count++;
+      if (demux->priv->update_failed_count <= DEFAULT_FAILED_COUNT) {
+        GST_WARNING_OBJECT (demux, "Could not update the playlist");
+        demux->priv->next_update =
+            g_get_monotonic_time () +
+            klass->get_manifest_update_interval (demux);
+      } else {
+        GST_ERROR_OBJECT (demux, "Could not update playlist");
+        goto error;
+      }
+    } else {
+      GST_DEBUG_OBJECT (demux, "Updated playlist successfully");
+      GST_MANIFEST_LOCK (demux);
+      demux->priv->next_update =
+          g_get_monotonic_time () + klass->get_manifest_update_interval (demux);
+      /* Wake up download task */
+      g_cond_broadcast (&demux->manifest_cond);
+      GST_MANIFEST_UNLOCK (demux);
+    }
+  }
+
+quit:
+  {
+    GST_DEBUG_OBJECT (demux, "Stopped updates task");
+    gst_task_stop (demux->priv->updates_task);
+    return;
+  }
+
+error:
+  {
+    GST_DEBUG_OBJECT (demux, "Stopped updates task because of error");
+    gst_adaptive_demux_stop_tasks (demux);
+  }
+}
+
+
+static gboolean
+gst_adaptive_demux_stream_push_event (GstAdaptiveDemuxStream * stream,
+    GstEvent * event)
+{
+  gboolean ret;
+
+  if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+    stream->eos = TRUE;
+  }
+  GST_DEBUG_OBJECT (GST_ADAPTIVE_DEMUX_STREAM_PAD (stream),
+      "Pushing event %" GST_PTR_FORMAT, event);
+  ret = gst_pad_push_event (GST_ADAPTIVE_DEMUX_STREAM_PAD (stream), event);
+  return ret;
+}
+
+static gboolean
+gst_adaptive_demux_is_live (GstAdaptiveDemux * demux)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  if (klass->is_live)
+    return klass->is_live (demux);
+  return FALSE;
+}
+
+static GstFlowReturn
+gst_adaptive_demux_stream_seek (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, GstClockTime ts)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  if (klass->stream_seek)
+    return klass->stream_seek (stream, ts);
+  return GST_FLOW_ERROR;
+}
+
+static gboolean
+gst_adaptive_demux_stream_has_next_fragment (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+  gboolean ret = TRUE;
+
+  if (klass->stream_has_next_fragment)
+    ret = klass->stream_has_next_fragment (stream);
+
+  return ret;
+}
+
+GstFlowReturn
+gst_adaptive_demux_stream_advance_fragment (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, GstClockTime duration)
+{
+  GstFlowReturn ret;
+
+  GST_MANIFEST_LOCK (demux);
+  if (stream->last_ret == GST_FLOW_OK) {
+    stream->last_ret =
+        gst_adaptive_demux_stream_advance_fragment_unlocked (demux, stream,
+        duration);
+  }
+  ret = stream->last_ret;
+  GST_MANIFEST_UNLOCK (demux);
+
+  return ret;
+}
+
+GstFlowReturn
+gst_adaptive_demux_stream_advance_fragment_unlocked (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, GstClockTime duration)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+  GstFlowReturn ret;
+
+  g_return_val_if_fail (klass->stream_advance_fragment != NULL, GST_FLOW_ERROR);
+
+  stream->download_error_count = 0;
+  g_clear_error (&stream->last_error);
+  stream->download_total_time +=
+      g_get_monotonic_time () - stream->download_chunk_start_time;
+  stream->fragment_total_time +=
+      g_get_monotonic_time () - stream->download_chunk_start_time;
+
+  /* FIXME - url has no indication of byte ranges for subsegments */
+  gst_element_post_message (GST_ELEMENT_CAST (demux),
+      gst_message_new_element (GST_OBJECT_CAST (demux),
+          gst_structure_new (STATISTICS_MESSAGE_NAME,
+              "manifest-uri", G_TYPE_STRING,
+              demux->manifest_uri, "uri", G_TYPE_STRING,
+              stream->fragment.uri, "fragment-start-time",
+              GST_TYPE_CLOCK_TIME, stream->download_start_time,
+              "fragment-stop-time", GST_TYPE_CLOCK_TIME,
+              gst_util_get_timestamp (), "fragment-size", G_TYPE_UINT64,
+              stream->download_total_bytes, "fragment-download-time",
+              GST_TYPE_CLOCK_TIME,
+              stream->download_total_time * GST_USECOND, NULL)));
+
+  if (GST_CLOCK_TIME_IS_VALID (duration))
+    stream->segment.position += duration;
+  ret = klass->stream_advance_fragment (stream);
+
+  stream->download_start_time = stream->download_chunk_start_time =
+      g_get_monotonic_time ();
+
+  if (ret == GST_FLOW_OK) {
+    if (gst_adaptive_demux_stream_select_bitrate (demux, stream,
+            gst_adaptive_demux_stream_update_current_bitrate (demux, stream))) {
+      stream->need_header = TRUE;
+      gst_adapter_clear (stream->adapter);
+      ret = (GstFlowReturn) GST_ADAPTIVE_DEMUX_FLOW_SWITCH;
+    }
+
+    /* the subclass might want to switch pads */
+    if (G_UNLIKELY (demux->next_streams)) {
+      gst_task_stop (stream->download_task);
+      /* TODO only allow switching streams if other downloads are not ongoing */
+      GST_DEBUG_OBJECT (demux, "Subclass wants new pads "
+          "to do bitrate switching");
+      gst_adaptive_demux_expose_streams (demux, FALSE);
+      gst_adaptive_demux_start_tasks (demux);
+      ret = GST_FLOW_EOS;
+    }
+  }
+
+  return ret;
+}
+
+static gboolean
+gst_adaptive_demux_stream_select_bitrate (GstAdaptiveDemux *
+    demux, GstAdaptiveDemuxStream * stream, guint64 bitrate)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  /* FIXME: Currently several issues have be found when letting bitrate adaptation
+   * happen using trick modes (such as 'All streams finished without buffers') and
+   * the adaptive algorithm does not properly behave. */
+  if (demux->segment.rate != 1.0)
+    return FALSE;
+
+  if (klass->stream_select_bitrate)
+    return klass->stream_select_bitrate (stream, bitrate);
+  return FALSE;
+}
+
+static GstFlowReturn
+gst_adaptive_demux_stream_update_fragment_info (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  g_return_val_if_fail (klass->stream_update_fragment_info != NULL,
+      GST_FLOW_ERROR);
+
+  return klass->stream_update_fragment_info (stream);
+}
+
+static gint64
+gst_adaptive_demux_stream_get_fragment_waiting_time (GstAdaptiveDemux *
+    demux, GstAdaptiveDemuxStream * stream)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  if (klass->stream_get_fragment_waiting_time)
+    return klass->stream_get_fragment_waiting_time (stream);
+  return 0;
+}
+
+static GstFlowReturn
+gst_adaptive_demux_update_manifest (GstAdaptiveDemux * demux)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+  GstFragment *download;
+  GstBuffer *buffer;
+  GstFlowReturn ret;
+
+  download = gst_uri_downloader_fetch_uri (demux->priv->downloader,
+      demux->manifest_uri, NULL, TRUE, TRUE, TRUE, NULL);
+  if (download) {
+
+    GST_MANIFEST_LOCK (demux);
+    g_free (demux->manifest_uri);
+    g_free (demux->manifest_base_uri);
+    if (download->redirect_permanent && download->redirect_uri) {
+      demux->manifest_uri = g_strdup (download->redirect_uri);
+      demux->manifest_base_uri = NULL;
+    } else {
+      demux->manifest_uri = g_strdup (download->uri);
+      demux->manifest_base_uri = g_strdup (download->redirect_uri);
+    }
+
+    buffer = gst_fragment_get_buffer (download);
+    g_object_unref (download);
+    ret = klass->update_manifest (demux, buffer);
+    if (ret == GST_FLOW_OK) {
+      GstClockTime duration;
+      gst_buffer_unref (demux->priv->manifest_buffer);
+      demux->priv->manifest_buffer = buffer;
+
+      /* Send an updated duration message */
+      duration = klass->get_duration (demux);
+
+      GST_MANIFEST_UNLOCK (demux);
+      if (duration != GST_CLOCK_TIME_NONE) {
+        GST_DEBUG_OBJECT (demux,
+            "Sending duration message : %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (duration));
+        gst_element_post_message (GST_ELEMENT (demux),
+            gst_message_new_duration_changed (GST_OBJECT (demux)));
+      } else {
+        GST_DEBUG_OBJECT (demux,
+            "Duration unknown, can not send the duration message");
+      }
+    } else {
+      GST_MANIFEST_UNLOCK (demux);
+      gst_buffer_unref (buffer);
+      /* Should the manifest uri vars be reverted to original values? */
+    }
+  } else {
+    ret = GST_FLOW_NOT_LINKED;
+  }
+
+  return ret;
+}
+
+void
+gst_adaptive_demux_stream_fragment_clear (GstAdaptiveDemuxStreamFragment * f)
+{
+  g_free (f->uri);
+  f->uri = NULL;
+  f->range_start = 0;
+  f->range_end = -1;
+
+  g_free (f->header_uri);
+  f->header_uri = NULL;
+  f->header_range_start = 0;
+  f->header_range_end = -1;
+
+  g_free (f->index_uri);
+  f->index_uri = NULL;
+  f->index_range_start = 0;
+  f->index_range_end = -1;
+}
+
+static gboolean
+gst_adaptive_demux_has_next_period (GstAdaptiveDemux * demux)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+  gboolean ret = FALSE;
+
+  if (klass->has_next_period)
+    ret = klass->has_next_period (demux);
+  GST_DEBUG_OBJECT (demux, "Has next period: %d", ret);
+  return ret;
+}
+
+static void
+gst_adaptive_demux_advance_period (GstAdaptiveDemux * demux)
+{
+  GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
+
+  g_return_if_fail (klass->advance_period != NULL);
+
+  GST_DEBUG_OBJECT (demux, "Advancing to next period");
+  klass->advance_period (demux);
+  gst_adaptive_demux_expose_streams (demux, FALSE);
+  gst_adaptive_demux_start_tasks (demux);
+}
+
+static void
+gst_adaptive_demux_stream_download_wait (GstAdaptiveDemuxStream * stream,
+    GstClockTime time_diff)
+{
+  gint64 end_time = g_get_monotonic_time () + time_diff / GST_USECOND;
+
+  GST_DEBUG_OBJECT (stream->pad, "Download waiting for %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (time_diff));
+  g_mutex_lock (&stream->fragment_download_lock);
+  g_cond_wait_until (&stream->fragment_download_cond,
+      &stream->fragment_download_lock, end_time);
+  g_mutex_unlock (&stream->fragment_download_lock);
+  GST_DEBUG_OBJECT (stream->pad, "Download finished waiting");
+}
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
new file mode 100644
index 0000000..36e20ef
--- /dev/null
+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
@@ -0,0 +1,419 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014 Samsung Electronics. All rights reserved.
+ *   Author: Thiago Santos <thiagoss@osg.samsung.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_ADAPTIVE_DEMUX_H_
+#define _GST_ADAPTIVE_DEMUX_H_
+
+#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_ADAPTIVE_DEMUX \
+  (gst_adaptive_demux_get_type())
+#define GST_ADAPTIVE_DEMUX(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ADAPTIVE_DEMUX,GstAdaptiveDemux))
+#define GST_ADAPTIVE_DEMUX_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ADAPTIVE_DEMUX,GstAdaptiveDemuxClass))
+#define GST_ADAPTIVE_DEMUX_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_ADAPTIVE_DEMUX,GstAdaptiveDemuxClass))
+#define GST_IS_ADAPTIVE_DEMUX(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ADAPTIVE_DEMUX))
+#define GST_IS_ADAPTIVE_DEMUX_CLASS(obj) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ADAPTIVE_DEMUX))
+#define GST_ADAPTIVE_DEMUX_CAST(obj) ((GstAdaptiveDemux *)obj)
+
+#define GST_ADAPTIVE_DEMUX_STREAM_CAST(obj) ((GstAdaptiveDemuxStream *)obj)
+
+/**
+ * GST_ADAPTIVE_DEMUX_SINK_NAME:
+ *
+ * The name of the templates for the sink pad.
+ */
+#define GST_ADAPTIVE_DEMUX_SINK_NAME    "sink"
+
+/**
+ * GST_ADAPTIVE_DEMUX_SINK_PAD:
+ * @obj: a #GstAdaptiveDemux
+ *
+ * Gives the pointer to the sink #GstPad object of the element.
+ */
+#define GST_ADAPTIVE_DEMUX_SINK_PAD(obj)        (((GstAdaptiveDemux *) (obj))->sinkpad)
+
+#define GST_ADAPTIVE_DEMUX_STREAM_PAD(obj)      (((GstAdaptiveDemuxStream *) (obj))->pad)
+
+#define GST_ADAPTIVE_DEMUX_STREAM_NEED_HEADER(obj) (((GstAdaptiveDemuxStream *) (obj))->need_header)
+
+#define STATISTICS_MESSAGE_NAME "adaptive-streaming-statistics"
+
+#define GST_MANIFEST_GET_LOCK(d) (&(GST_ADAPTIVE_DEMUX_CAST(d)->manifest_lock))
+#define GST_MANIFEST_LOCK(d) (g_mutex_lock (GST_MANIFEST_GET_LOCK (d)))
+#define GST_MANIFEST_UNLOCK(d) (g_mutex_unlock (GST_MANIFEST_GET_LOCK (d)))
+
+#define GST_ELEMENT_ERROR_FROM_ERROR(el, msg, err) G_STMT_START { \
+  gchar *__dbg = g_strdup_printf ("%s: %s", msg, err->message);         \
+  GST_WARNING_OBJECT (el, "error: %s", __dbg);                          \
+  gst_element_message_full (GST_ELEMENT(el), GST_MESSAGE_ERROR,         \
+    err->domain, err->code,                                             \
+    NULL, __dbg, __FILE__, GST_FUNCTION, __LINE__);                     \
+  g_clear_error (&err); \
+} G_STMT_END
+
+typedef struct _GstAdaptiveDemuxStreamFragment GstAdaptiveDemuxStreamFragment;
+typedef struct _GstAdaptiveDemuxStream GstAdaptiveDemuxStream;
+typedef struct _GstAdaptiveDemux GstAdaptiveDemux;
+typedef struct _GstAdaptiveDemuxClass GstAdaptiveDemuxClass;
+typedef struct _GstAdaptiveDemuxPrivate GstAdaptiveDemuxPrivate;
+
+struct _GstAdaptiveDemuxStreamFragment
+{
+  GstClockTime timestamp;
+  GstClockTime duration;
+
+  gchar *uri;
+  gint64 range_start;
+  gint64 range_end;
+
+  /* when headers are needed */
+  gchar *header_uri;
+  gint64 header_range_start;
+  gint64 header_range_end;
+
+  /* when index is needed */
+  gchar *index_uri;
+  gint64 index_range_start;
+  gint64 index_range_end;
+};
+
+struct _GstAdaptiveDemuxStream
+{
+  GstPad *pad;
+
+  GstAdaptiveDemux *demux;
+
+  GstSegment segment;
+
+  GstAdapter *adapter;
+
+  GstCaps *pending_caps;
+  GstEvent *pending_segment;
+  GstTagList *pending_tags;
+  gboolean need_header;
+
+  GstFlowReturn last_ret;
+  GError *last_error;
+
+  GstTask *download_task;
+  GRecMutex download_lock;
+
+  gboolean restart_download;
+  gboolean discont;
+
+  gboolean downloading_header;
+  gboolean downloading_index;
+
+  /* download tooling */
+  GstElement *src;
+  GstPad *src_srcpad;
+  GMutex fragment_download_lock;
+  GCond fragment_download_cond;
+  gboolean download_finished;
+  gboolean starting_fragment;
+  gboolean first_fragment_buffer;
+  gint64 download_start_time;
+  gint64 download_chunk_start_time;
+  gint64 download_total_time;
+  gint64 download_total_bytes;
+  guint64 current_download_rate;
+
+  /* Per fragment download information */
+  guint64 fragment_total_time;
+  guint64 fragment_total_size;
+
+  /* Average for the last fragments */
+  guint64 moving_bitrate;
+  guint moving_index;
+  guint64 *fragment_bitrates;
+
+  GstAdaptiveDemuxStreamFragment fragment;
+
+  guint download_error_count;
+
+  /* TODO check if used */
+  gboolean eos;
+};
+
+/**
+ * GstAdaptiveDemux:
+ *
+ * The opaque #GstAdaptiveDemux data structure.
+ */
+struct _GstAdaptiveDemux
+{
+  /*< private >*/
+  GstBin     bin;
+
+  gsize stream_struct_size;
+
+  /*< protected >*/
+  GstPad         *sinkpad;
+
+  GstAdaptiveDemuxPrivate *priv;
+
+  GList *streams;
+  GList *next_streams;
+
+  GstSegment segment;
+
+  gboolean cancelled;
+
+  GMutex manifest_lock;
+  GCond manifest_cond;
+
+  gchar *manifest_uri;
+  gchar *manifest_base_uri;
+
+  /* Properties */
+  guint num_lookback_fragments;
+  gfloat bitrate_limit;         /* limit of the available bitrate to use */
+  guint connection_speed;
+
+  gboolean have_group_id;
+  guint group_id;
+};
+
+/**
+ * GstAdaptiveDemuxClass:
+ *
+ */
+struct _GstAdaptiveDemuxClass
+{
+  /*< private >*/
+  GstBinClass bin_class;
+
+  /*< public >*/
+
+  /**
+   * process_manifest: Parse the manifest
+   * @demux: #GstAdaptiveDemux
+   * @manifest: the manifest to be parsed
+   *
+   * Parse the manifest and add the created streams using
+   * gst_adaptive_demux_stream_new()
+   *
+   * Returns: #TRUE if successful
+   */
+  gboolean      (*process_manifest) (GstAdaptiveDemux * demux, GstBuffer * manifest);
+
+  /**
+   * get_manifest_update_interval:
+   * @demux: #GstAdaptiveDemux
+   *
+   * Used during live streaming, the subclass should return the interval
+   * between successive manifest updates
+   *
+   * Returns: the update interval in microseconds
+   */
+  gint64        (*get_manifest_update_interval) (GstAdaptiveDemux * demux);
+  /**
+   * update_manifest:
+   * @demux: #GstAdaptiveDemux
+   * @buf: Downloaded manifest data
+   *
+   * During live streaming, this will be called for the subclass to update its
+   * manifest with the new version
+   *
+   * Returns: #GST_FLOW_OK is all succeeded, #GST_FLOW_EOS if the stream ended
+   *          or #GST_FLOW_ERROR if an error happened
+   */
+  GstFlowReturn (*update_manifest) (GstAdaptiveDemux * demux, GstBuffer * buf);
+
+  gboolean      (*is_live)          (GstAdaptiveDemux * demux);
+  GstClockTime  (*get_duration)     (GstAdaptiveDemux * demux);
+
+  /**
+   * reset:
+   * @demux: #GstAdaptiveDemux
+   *
+   * Reset the internal state of the subclass, getting ready to restart with
+   * a new stream afterwards
+   */
+  void          (*reset)            (GstAdaptiveDemux * demux);
+
+  /**
+   * seek:
+   * @demux: #GstAdaptiveDemux
+   * @seek: a seek #GstEvent
+   *
+   * The demuxer should seek on all its streams to the specified position
+   * in the seek event
+   *
+   * Returns: #TRUE if successful
+   */
+  gboolean      (*seek)             (GstAdaptiveDemux * demux, GstEvent * seek);
+
+  /**
+   * has_next_period:
+   * @demux: #GstAdaptiveDemux
+   *
+   * Checks if there is a next period following the current one.
+   * DASH can have multiple medias chained in its manifest, when one finishes
+   * this function is called to verify if there is a new period to be played
+   * in sequence.
+   *
+   * Returns: #TRUE if there is another period
+   */
+  gboolean      (*has_next_period)  (GstAdaptiveDemux * demux);
+  /**
+   * advance_period:
+   * @demux: #GstAdaptiveDemux
+   *
+   * Advances the manifest to the next period. New streams should be created
+   * using gst_adaptive_demux_stream_new().
+   */
+  void          (*advance_period)  (GstAdaptiveDemux * demux);
+
+  void          (*stream_free)     (GstAdaptiveDemuxStream * stream);
+  GstFlowReturn (*stream_seek)     (GstAdaptiveDemuxStream * stream, GstClockTime ts);
+  gboolean      (*stream_has_next_fragment)  (GstAdaptiveDemuxStream * stream);
+  GstFlowReturn (*stream_advance_fragment) (GstAdaptiveDemuxStream * stream);
+  /**
+   * stream_update_fragment_info:
+   * @stream: #GstAdaptiveDemuxStream
+   *
+   * Requests the stream to set the information about the current fragment to its
+   * current fragment struct
+   *
+   * Returns: #GST_FLOW_OK in success, #GST_FLOW_ERROR on error and #GST_FLOW_EOS
+   *          if there is no fragment.
+   */
+  GstFlowReturn (*stream_update_fragment_info) (GstAdaptiveDemuxStream * stream);
+  /**
+   * stream_select_bitrate:
+   * @stream: #GstAdaptiveDemuxStream
+   * @bitrate: the bitrate to select (in bytes per second)
+   *
+   * The stream should try to select the bitrate that is the greater, but not
+   * greater than the requested bitrate. If it needs a codec change it should
+   * create the new stream using gst_adaptive_demux_stream_new(). If it only
+   * needs a caps change it should set the new caps using
+   * gst_adaptive_demux_stream_set_caps().
+   *
+   * Returns: #TRUE if the stream changed bitrate, #FALSE otherwise
+   */
+  gboolean      (*stream_select_bitrate) (GstAdaptiveDemuxStream * stream, guint64 bitrate);
+  /**
+   * stream_get_fragment_waiting_time:
+   * @stream: #GstAdaptiveDemuxStream
+   *
+   * For live streams, requests how much time should be waited before starting
+   * to download the fragment. This is useful to avoid downloading a fragment that
+   * isn't available yet.
+   *
+   * Returns: The waiting time in microsseconds
+   */
+  gint64        (*stream_get_fragment_waiting_time) (GstAdaptiveDemuxStream * stream);
+
+  /**
+   * start_fragment:
+   * @demux: #GstAdaptiveDemux
+   * @stream: #GstAdaptiveDemuxStream
+   *
+   * Notifies the subclass that the given stream is starting the download
+   * of a new fragment. Can be used to reset/init internal state that is
+   * needed before each fragment, like decryption engines.
+   *
+   * Returns: #TRUE if successful.
+   */
+  gboolean      (*start_fragment) (GstAdaptiveDemux * demux, GstAdaptiveDemuxStream * stream);
+  /**
+   * finish_fragment:
+   * @demux: #GstAdaptiveDemux
+   * @stream: #GstAdaptiveDemuxStream
+   *
+   * Notifies the subclass that a fragment download was finished.
+   * It can be used to cleanup internal state after a fragment and
+   * also push any pending data before moving to the next fragment.
+   */
+  GstFlowReturn (*finish_fragment) (GstAdaptiveDemux * demux, GstAdaptiveDemuxStream * stream);
+  /**
+   * data_received:
+   * @demux: #GstAdaptiveDemux
+   * @stream: #GstAdaptiveDemuxStream
+   *
+   * Notifies the subclass that a fragment chunk was downloaded. The subclass
+   * can look at the data at the adapter and modify/push data as desired.
+   *
+   * Returns: #GST_FLOW_OK if successful, #GST_FLOW_ERROR in case of error.
+   */
+  GstFlowReturn (*data_received) (GstAdaptiveDemux * demux, GstAdaptiveDemuxStream * stream);
+
+  /**
+   * get_live_seek_range:
+   * @demux: #GstAdaptiveDemux
+   * @start: pointer to put the start position allowed to seek to
+   * @stop: pointer to put the stop position allowed to seek to
+   *
+   * Gets the allowed seek start and stop positions for the current live stream
+   *
+   * Return: %TRUE if successful
+   */
+  gboolean (*get_live_seek_range) (GstAdaptiveDemux * demux, gint64 * start, gint64 * stop);
+
+  /**
+   * get_presentation_offset:
+   * @demux: #GstAdaptiveDemux
+   * @stream: #GstAdaptiveDemuxStream
+   *
+   * Gets the delay to apply to @stream.
+   *
+   * Return: a #GstClockTime representing the (positive) time offset to apply to
+   * @stream.
+   */
+  GstClockTime (*get_presentation_offset) (GstAdaptiveDemux *demux, GstAdaptiveDemuxStream *stream);
+};
+
+GType    gst_adaptive_demux_get_type (void);
+
+void     gst_adaptive_demux_set_stream_struct_size (GstAdaptiveDemux * demux,
+                                                    gsize struct_size);
+
+
+GstAdaptiveDemuxStream *gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux,
+                                                       GstPad * pad);
+void gst_adaptive_demux_stream_set_caps (GstAdaptiveDemuxStream * stream,
+                                         GstCaps * caps);
+void gst_adaptive_demux_stream_set_tags (GstAdaptiveDemuxStream * stream,
+                                         GstTagList * tags);
+void gst_adaptive_demux_stream_fragment_clear (GstAdaptiveDemuxStreamFragment * f);
+
+GstFlowReturn gst_adaptive_demux_stream_push_buffer (GstAdaptiveDemuxStream * stream, GstBuffer * buffer);
+GstFlowReturn
+gst_adaptive_demux_stream_advance_fragment (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, GstClockTime duration);
+GstFlowReturn
+gst_adaptive_demux_stream_advance_fragment_unlocked (GstAdaptiveDemux * demux,
+    GstAdaptiveDemuxStream * stream, GstClockTime duration);
+
+G_END_DECLS
+
+#endif
+
diff --git a/gst-libs/gst/base/Makefile.in b/gst-libs/gst/base/Makefile.in
index 4df2ab1..2807402 100644
--- a/gst-libs/gst/base/Makefile.in
+++ b/gst-libs/gst/base/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/base/gstaggregator.c b/gst-libs/gst/base/gstaggregator.c
index e12ed93..788c84a 100644
--- a/gst-libs/gst/base/gstaggregator.c
+++ b/gst-libs/gst/base/gstaggregator.c
@@ -1,4 +1,4 @@
-/* GStreamer
+/* GStreamer aggregator base class
  * Copyright (C) 2014 Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
  * Copyright (C) 2014 Thibault Saunier <tsaunier@gnome.org>
  *
@@ -29,8 +29,8 @@
  * Control is given to the subclass when all pads have data.
  * <itemizedlist>
  *  <listitem><para>
- *    Base class for mixers and muxers. Implementers should at least implement
- *    the aggregate () vmethod.
+ *    Base class for mixers and muxers. Subclasses should at least implement
+ *    the #GstAggregatorClass.aggregate() virtual method.
  *  </para></listitem>
  *  <listitem><para>
  *    When data is queued on all pads, tha aggregate vmethod is called.
@@ -69,61 +69,139 @@
 /*  Might become API */
 static void gst_aggregator_merge_tags (GstAggregator * aggregator,
     const GstTagList * tags, GstTagMergeMode mode);
+static void gst_aggregator_set_latency_property (GstAggregator * agg,
+    gint64 latency);
+static gint64 gst_aggregator_get_latency_property (GstAggregator * agg);
+
+
+/* Locking order, locks in this element must always be taken in this order
+ *
+ * standard sink pad stream lock -> GST_PAD_STREAM_LOCK (aggpad)
+ * Aggregator pad flush lock -> PAD_FLUSH_LOCK(aggpad)
+ * standard src pad stream lock -> GST_PAD_STREAM_LOCK (srcpad)
+ * Aggregator src lock -> SRC_LOCK(agg) w/ SRC_WAIT/BROADCAST
+ * standard element object lock -> GST_OBJECT_LOCK(agg)
+ * Aggregator pad lock -> PAD_LOCK (aggpad) w/ PAD_WAIT/BROADCAST_EVENT(aggpad)
+ * standard src pad object lock -> GST_OBJECT_LOCK(srcpad)
+ * standard sink pad object lock -> GST_OBJECT_LOCK(aggpad)
+ */
+
 
 GST_DEBUG_CATEGORY_STATIC (aggregator_debug);
 #define GST_CAT_DEFAULT aggregator_debug
 
 /* GstAggregatorPad definitions */
-#define PAD_LOCK_EVENT(pad)   G_STMT_START {                            \
-  GST_LOG_OBJECT (pad, "Taking EVENT lock from thread %p",              \
+#define PAD_LOCK(pad)   G_STMT_START {                                  \
+  GST_TRACE_OBJECT (pad, "Taking PAD lock from thread %p",              \
         g_thread_self());                                               \
-  g_mutex_lock(&pad->priv->event_lock);                                 \
-  GST_LOG_OBJECT (pad, "Took EVENT lock from thread %p",              \
+  g_mutex_lock(&pad->priv->lock);                                       \
+  GST_TRACE_OBJECT (pad, "Took PAD lock from thread %p",                \
         g_thread_self());                                               \
   } G_STMT_END
 
-#define PAD_UNLOCK_EVENT(pad)  G_STMT_START {                           \
-  GST_LOG_OBJECT (pad, "Releasing EVENT lock from thread %p",          \
-        g_thread_self());                                               \
-  g_mutex_unlock(&pad->priv->event_lock);                               \
-  GST_LOG_OBJECT (pad, "Release EVENT lock from thread %p",          \
+#define PAD_UNLOCK(pad)  G_STMT_START {                                 \
+  GST_TRACE_OBJECT (pad, "Releasing PAD lock from thread %p",           \
+      g_thread_self());                                                 \
+  g_mutex_unlock(&pad->priv->lock);                                     \
+  GST_TRACE_OBJECT (pad, "Release PAD lock from thread %p",             \
         g_thread_self());                                               \
   } G_STMT_END
 
 
 #define PAD_WAIT_EVENT(pad)   G_STMT_START {                            \
-  GST_LOG_OBJECT (pad, "Waiting for EVENT on thread %p",               \
+  GST_LOG_OBJECT (pad, "Waiting for EVENT on thread %p",                \
         g_thread_self());                                               \
-  g_cond_wait(&(((GstAggregatorPad* )pad)->priv->event_cond),       \
-      &(pad->priv->event_lock));                                        \
-  GST_LOG_OBJECT (pad, "DONE Waiting for EVENT on thread %p",               \
+  g_cond_wait(&(((GstAggregatorPad* )pad)->priv->event_cond),           \
+      (&((GstAggregatorPad*)pad)->priv->lock));                         \
+  GST_LOG_OBJECT (pad, "DONE Waiting for EVENT on thread %p",           \
         g_thread_self());                                               \
   } G_STMT_END
 
-#define PAD_BROADCAST_EVENT(pad) {                                          \
+#define PAD_BROADCAST_EVENT(pad) G_STMT_START {                        \
   GST_LOG_OBJECT (pad, "Signaling EVENT from thread %p",               \
-        g_thread_self());                                                   \
-  g_cond_broadcast(&(((GstAggregatorPad* )pad)->priv->event_cond)); \
-  }
+        g_thread_self());                                              \
+  g_cond_broadcast(&(((GstAggregatorPad* )pad)->priv->event_cond));    \
+  } G_STMT_END
+
+
+#define PAD_FLUSH_LOCK(pad)     G_STMT_START {                          \
+  GST_TRACE_OBJECT (pad, "Taking lock from thread %p",                  \
+        g_thread_self());                                               \
+  g_mutex_lock(&pad->priv->flush_lock);                                 \
+  GST_TRACE_OBJECT (pad, "Took lock from thread %p",                    \
+        g_thread_self());                                               \
+  } G_STMT_END
+
+#define PAD_FLUSH_UNLOCK(pad)   G_STMT_START {                          \
+  GST_TRACE_OBJECT (pad, "Releasing lock from thread %p",               \
+        g_thread_self());                                               \
+  g_mutex_unlock(&pad->priv->flush_lock);                               \
+  GST_TRACE_OBJECT (pad, "Release lock from thread %p",                 \
+        g_thread_self());                                               \
+  } G_STMT_END
+
+#define SRC_LOCK(self)   G_STMT_START {                             \
+  GST_TRACE_OBJECT (self, "Taking src lock from thread %p",         \
+      g_thread_self());                                             \
+  g_mutex_lock(&self->priv->src_lock);                              \
+  GST_TRACE_OBJECT (self, "Took src lock from thread %p",           \
+        g_thread_self());                                           \
+  } G_STMT_END
+
+#define SRC_UNLOCK(self)  G_STMT_START {                            \
+  GST_TRACE_OBJECT (self, "Releasing src lock from thread %p",      \
+        g_thread_self());                                           \
+  g_mutex_unlock(&self->priv->src_lock);                            \
+  GST_TRACE_OBJECT (self, "Released src lock from thread %p",       \
+        g_thread_self());                                           \
+  } G_STMT_END
+
+#define SRC_WAIT(self) G_STMT_START {                               \
+  GST_LOG_OBJECT (self, "Waiting for src on thread %p",             \
+        g_thread_self());                                           \
+  g_cond_wait(&(self->priv->src_cond), &(self->priv->src_lock));    \
+  GST_LOG_OBJECT (self, "DONE Waiting for src on thread %p",        \
+        g_thread_self());                                           \
+  } G_STMT_END
+
+#define SRC_BROADCAST(self) G_STMT_START {                          \
+    GST_LOG_OBJECT (self, "Signaling src from thread %p",           \
+        g_thread_self());                                           \
+    if (self->priv->aggregate_id)                                   \
+      gst_clock_id_unschedule (self->priv->aggregate_id);           \
+    g_cond_broadcast(&(self->priv->src_cond));                      \
+  } G_STMT_END
 
 struct _GstAggregatorPadPrivate
 {
+  /* To always be used atomically */
+  gboolean flushing;
+
+  /* Following fields are protected by the PAD_LOCK */
   gboolean pending_flush_start;
   gboolean pending_flush_stop;
   gboolean pending_eos;
-  gboolean flushing;
 
-  GMutex event_lock;
+  GstBuffer *buffer;
+  gboolean eos;
+
+  GMutex lock;
   GCond event_cond;
+  /* This lock prevents a flush start processing happening while
+   * the chain function is also happening.
+   */
+  GMutex flush_lock;
 };
 
 static gboolean
-_aggpad_flush (GstAggregatorPad * aggpad, GstAggregator * agg)
+gst_aggregator_pad_flush (GstAggregatorPad * aggpad, GstAggregator * agg)
 {
   GstAggregatorPadClass *klass = GST_AGGREGATOR_PAD_GET_CLASS (aggpad);
 
-  aggpad->eos = FALSE;
+  PAD_LOCK (aggpad);
+  aggpad->priv->eos = FALSE;
   aggpad->priv->flushing = FALSE;
+  PAD_UNLOCK (aggpad);
 
   if (klass->flush)
     return klass->flush (aggpad, agg);
@@ -136,47 +214,42 @@
  *************************************/
 static GstElementClass *aggregator_parent_class = NULL;
 
-#define MAIN_CONTEXT_LOCK(self) G_STMT_START {                       \
-  GST_LOG_OBJECT (self, "Getting MAIN_CONTEXT_LOCK in thread %p",    \
-        g_thread_self());                                            \
-  g_mutex_lock(&((GstAggregator*)self)->priv->mcontext_lock);    \
-  GST_LOG_OBJECT (self, "Got MAIN_CONTEXT_LOCK in thread %p",        \
-        g_thread_self());                                            \
-} G_STMT_END
-
-#define MAIN_CONTEXT_UNLOCK(self) G_STMT_START {                     \
-  g_mutex_unlock(&((GstAggregator*)self)->priv->mcontext_lock);  \
-  GST_LOG_OBJECT (self, "Unlocked MAIN_CONTEXT_LOCK in thread %p",   \
-        g_thread_self());                                            \
-} G_STMT_END
+/* All members are protected by the object lock unless otherwise noted */
 
 struct _GstAggregatorPrivate
 {
   gint padcount;
 
-  GMainContext *mcontext;
-
   /* Our state is >= PAUSED */
-  gboolean running;
-
-  /* Ensure that when we remove all sources from the maincontext
-   * we can not add any source, avoiding:
-   * "g_source_attach: assertion '!SOURCE_DESTROYED (source)' failed" */
-  GMutex mcontext_lock;
-  GList *gsources;
+  gboolean running;             /* protected by src_lock */
 
   gint seqnum;
-  gboolean send_stream_start;
+  gboolean send_stream_start;   /* protected by srcpad stream lock */
   gboolean send_segment;
   gboolean flush_seeking;
   gboolean pending_flush_start;
-  gboolean send_eos;
+  gboolean send_eos;            /* protected by srcpad stream lock */
   GstFlowReturn flow_return;
 
-  GstCaps *srccaps;
+  GstCaps *srccaps;             /* protected by the srcpad stream lock */
 
   GstTagList *tags;
   gboolean tags_changed;
+
+  gboolean latency_live;        /* protected by src_lock */
+  GstClockTime latency_min;     /* protected by src_lock */
+  GstClockTime latency_max;     /* protected by src_lock */
+
+  GstClockTime sub_latency_min; /* protected by src_lock */
+  GstClockTime sub_latency_max; /* protected by src_lock */
+
+  /* aggregate */
+  GstClockID aggregate_id;      /* protected by src_lock */
+  GMutex src_lock;
+  GCond src_cond;
+
+  /* properties */
+  gint64 latency;
 };
 
 typedef struct
@@ -184,13 +257,24 @@
   GstEvent *event;
   gboolean result;
   gboolean flush;
+
+  gboolean one_actually_seeked;
 } EventData;
 
+#define DEFAULT_LATENCY        0
+
+enum
+{
+  PROP_0,
+  PROP_LATENCY,
+  PROP_LAST
+};
+
 /**
  * gst_aggregator_iterate_sinkpads:
  * @self: The #GstAggregator
- * @func: The function to call.
- * @user_data: The data to pass to @func.
+ * @func: (scope call): The function to call.
+ * @user_data: (closure): The data to pass to @func.
  *
  * Iterate the sinkpads of aggregator to call a function on them.
  *
@@ -216,7 +300,7 @@
     switch (gst_iterator_next (iter, &item)) {
       case GST_ITERATOR_OK:
       {
-        GstPad *pad;
+        GstAggregatorPad *pad;
 
         pad = g_value_get_object (&item);
 
@@ -226,8 +310,9 @@
           break;
         }
 
-        GST_LOG_OBJECT (self, "calling function on pad %s:%s",
-            GST_DEBUG_PAD_NAME (pad));
+        GST_LOG_OBJECT (pad, "calling function %s on pad",
+            GST_DEBUG_FUNCPTR_NAME (func));
+
         result = func (self, pad, user_data);
 
         done = !result;
@@ -264,47 +349,69 @@
   return result;
 }
 
-static inline gboolean
-_check_all_pads_with_data_or_eos (GstAggregator * self,
-    GstAggregatorPad * aggpad)
+static gboolean
+gst_aggregator_check_pads_ready (GstAggregator * self)
 {
-  if (aggpad->buffer || aggpad->eos) {
-    return TRUE;
+  GstAggregatorPad *pad;
+  GList *l, *sinkpads;
+
+  GST_LOG_OBJECT (self, "checking pads");
+
+  GST_OBJECT_LOCK (self);
+
+  sinkpads = GST_ELEMENT_CAST (self)->sinkpads;
+  if (sinkpads == NULL)
+    goto no_sinkpads;
+
+  for (l = sinkpads; l != NULL; l = l->next) {
+    pad = l->data;
+
+    PAD_LOCK (pad);
+    if (pad->priv->buffer == NULL && !pad->priv->eos) {
+      PAD_UNLOCK (pad);
+      goto pad_not_ready;
+    }
+    PAD_UNLOCK (pad);
+
   }
 
-  GST_LOG_OBJECT (aggpad, "Not ready to be aggregated");
+  GST_OBJECT_UNLOCK (self);
+  GST_LOG_OBJECT (self, "pads are ready");
+  return TRUE;
 
-  return FALSE;
-}
-
-/**
- * gst_aggregator_set_src_caps:
- * @self: The #GstAggregator
- * @caps: The #GstCaps to set later on the src pad.
- *
- * Sets the caps to be used on the src pad.
- */
-void
-gst_aggregator_set_src_caps (GstAggregator * self, GstCaps * caps)
-{
-  gst_caps_replace (&self->priv->srccaps, caps);
+no_sinkpads:
+  {
+    GST_LOG_OBJECT (self, "pads not ready: no sink pads");
+    GST_OBJECT_UNLOCK (self);
+    return FALSE;
+  }
+pad_not_ready:
+  {
+    GST_LOG_OBJECT (pad, "pad not ready to be aggregated yet");
+    GST_OBJECT_UNLOCK (self);
+    return FALSE;
+  }
 }
 
 static void
-_reset_flow_values (GstAggregator * self)
+gst_aggregator_reset_flow_values (GstAggregator * self)
 {
+  GST_OBJECT_LOCK (self);
   self->priv->flow_return = GST_FLOW_FLUSHING;
   self->priv->send_stream_start = TRUE;
   self->priv->send_segment = TRUE;
   gst_segment_init (&self->segment, GST_FORMAT_TIME);
+  GST_OBJECT_UNLOCK (self);
 }
 
 static inline void
-_push_mandatory_events (GstAggregator * self)
+gst_aggregator_push_mandatory_events (GstAggregator * self)
 {
   GstAggregatorPrivate *priv = self->priv;
+  GstEvent *segment = NULL;
+  GstEvent *tags = NULL;
 
-  if (g_atomic_int_get (&self->priv->send_stream_start)) {
+  if (self->priv->send_stream_start) {
     gchar s_id[32];
 
     GST_INFO_OBJECT (self, "pushing stream start");
@@ -313,7 +420,7 @@
     if (!gst_pad_push_event (self->srcpad, gst_event_new_stream_start (s_id))) {
       GST_WARNING_OBJECT (self->srcpad, "Sending stream start event failed");
     }
-    g_atomic_int_set (&self->priv->send_stream_start, FALSE);
+    self->priv->send_stream_start = FALSE;
   }
 
   if (self->priv->srccaps) {
@@ -328,134 +435,256 @@
     self->priv->srccaps = NULL;
   }
 
-  if (g_atomic_int_get (&self->priv->send_segment)) {
-    if (!g_atomic_int_get (&self->priv->flush_seeking)) {
-      GstEvent *segev = gst_event_new_segment (&self->segment);
+  GST_OBJECT_LOCK (self);
+  if (self->priv->send_segment && !self->priv->flush_seeking) {
+    segment = gst_event_new_segment (&self->segment);
 
-      if (!self->priv->seqnum)
-        self->priv->seqnum = gst_event_get_seqnum (segev);
-      else
-        gst_event_set_seqnum (segev, self->priv->seqnum);
+    if (!self->priv->seqnum)
+      self->priv->seqnum = gst_event_get_seqnum (segment);
+    else
+      gst_event_set_seqnum (segment, self->priv->seqnum);
+    self->priv->send_segment = FALSE;
 
-      GST_DEBUG_OBJECT (self, "pushing segment %" GST_PTR_FORMAT, segev);
-      gst_pad_push_event (self->srcpad, segev);
-      g_atomic_int_set (&self->priv->send_segment, FALSE);
-    }
+    GST_DEBUG_OBJECT (self, "pushing segment %" GST_PTR_FORMAT, segment);
   }
 
-  if (priv->tags && priv->tags_changed) {
-    gst_pad_push_event (self->srcpad,
-        gst_event_new_tag (gst_tag_list_ref (priv->tags)));
+  if (priv->tags && priv->tags_changed && !self->priv->flush_seeking) {
+    tags = gst_event_new_tag (gst_tag_list_ref (priv->tags));
     priv->tags_changed = FALSE;
   }
+  GST_OBJECT_UNLOCK (self);
+
+  if (segment)
+    gst_pad_push_event (self->srcpad, segment);
+  if (tags)
+    gst_pad_push_event (self->srcpad, tags);
+
+}
+
+/**
+ * gst_aggregator_set_src_caps:
+ * @self: The #GstAggregator
+ * @caps: The #GstCaps to set on the src pad.
+ *
+ * Sets the caps to be used on the src pad.
+ */
+void
+gst_aggregator_set_src_caps (GstAggregator * self, GstCaps * caps)
+{
+  GST_PAD_STREAM_LOCK (self->srcpad);
+  gst_caps_replace (&self->priv->srccaps, caps);
+  gst_aggregator_push_mandatory_events (self);
+  GST_PAD_STREAM_UNLOCK (self->srcpad);
 }
 
 /**
  * gst_aggregator_finish_buffer:
  * @self: The #GstAggregator
- * @buffer: the #GstBuffer to push.
+ * @buffer: (transfer full): the #GstBuffer to push.
  *
- * This method will take care of sending mandatory events before pushing
- * the provided buffer.
+ * This method will push the provided output buffer downstream. If needed,
+ * mandatory events such as stream-start, caps, and segment events will be
+ * sent before pushing the buffer.
  */
 GstFlowReturn
 gst_aggregator_finish_buffer (GstAggregator * self, GstBuffer * buffer)
 {
-  _push_mandatory_events (self);
+  gst_aggregator_push_mandatory_events (self);
 
-  if (!g_atomic_int_get (&self->priv->flush_seeking) &&
-      gst_pad_is_active (self->srcpad)) {
+  GST_OBJECT_LOCK (self);
+  if (!self->priv->flush_seeking && gst_pad_is_active (self->srcpad)) {
     GST_TRACE_OBJECT (self, "pushing buffer %" GST_PTR_FORMAT, buffer);
+    GST_OBJECT_UNLOCK (self);
     return gst_pad_push (self->srcpad, buffer);
   } else {
     GST_INFO_OBJECT (self, "Not pushing (active: %i, flushing: %i)",
-        g_atomic_int_get (&self->priv->flush_seeking),
-        gst_pad_is_active (self->srcpad));
+        self->priv->flush_seeking, gst_pad_is_active (self->srcpad));
+    GST_OBJECT_UNLOCK (self);
     gst_buffer_unref (buffer);
     return GST_FLOW_OK;
   }
 }
 
 static void
-_push_eos (GstAggregator * self)
+gst_aggregator_push_eos (GstAggregator * self)
 {
   GstEvent *event;
-  _push_mandatory_events (self);
+  gst_aggregator_push_mandatory_events (self);
 
-  self->priv->send_eos = FALSE;
   event = gst_event_new_eos ();
+
+  GST_OBJECT_LOCK (self);
+  self->priv->send_eos = FALSE;
   gst_event_set_seqnum (event, self->priv->seqnum);
+  GST_OBJECT_UNLOCK (self);
+
   gst_pad_push_event (self->srcpad, event);
 }
 
-
-static void
-_destroy_gsource (GSource * source)
+static GstClockTime
+gst_aggregator_get_next_time (GstAggregator * self)
 {
-  g_source_destroy (source);
-  g_source_unref (source);
-}
+  GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (self);
 
-static void
-_remove_all_sources (GstAggregator * self)
-{
-  GstAggregatorPrivate *priv = self->priv;
+  if (klass->get_next_time)
+    return klass->get_next_time (self);
 
-  MAIN_CONTEXT_LOCK (self);
-  g_list_free_full (priv->gsources, (GDestroyNotify) _destroy_gsource);
-  priv->gsources = NULL;
-  MAIN_CONTEXT_UNLOCK (self);
+  return GST_CLOCK_TIME_NONE;
 }
 
 static gboolean
-aggregate_func (GstAggregator * self)
+gst_aggregator_wait_and_check (GstAggregator * self, gboolean * timeout)
+{
+  GstClockTime latency_max, latency_min;
+  GstClockTime start;
+  gboolean live, res;
+
+  *timeout = FALSE;
+
+  SRC_LOCK (self);
+
+  gst_aggregator_get_latency_unlocked (self, &live, &latency_min, &latency_max);
+
+  if (gst_aggregator_check_pads_ready (self)) {
+    GST_DEBUG_OBJECT (self, "all pads have data");
+    SRC_UNLOCK (self);
+
+    return TRUE;
+  }
+
+  /* Before waiting, check if we're actually still running */
+  if (!self->priv->running || !self->priv->send_eos) {
+    SRC_UNLOCK (self);
+
+    return FALSE;
+  }
+
+  start = gst_aggregator_get_next_time (self);
+
+  if (!live || !GST_IS_CLOCK (GST_ELEMENT_CLOCK (self))
+      || !GST_CLOCK_TIME_IS_VALID (start)) {
+    /* We wake up here when something happened, and below
+     * then check if we're ready now. If we return FALSE,
+     * we will be directly called again.
+     */
+    SRC_WAIT (self);
+  } else {
+    GstClockTime base_time, time;
+    GstClock *clock;
+    GstClockReturn status;
+    GstClockTimeDiff jitter;
+
+    GST_DEBUG_OBJECT (self, "got subclass start time: %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (start));
+
+    GST_OBJECT_LOCK (self);
+    base_time = GST_ELEMENT_CAST (self)->base_time;
+    clock = GST_ELEMENT_CLOCK (self);
+    if (clock)
+      gst_object_ref (clock);
+    GST_OBJECT_UNLOCK (self);
+
+    time = base_time + start;
+    time += latency_min;
+
+    GST_DEBUG_OBJECT (self, "possibly waiting for clock to reach %"
+        GST_TIME_FORMAT " (base %" GST_TIME_FORMAT " start %" GST_TIME_FORMAT
+        " latency max %" GST_TIME_FORMAT " latency min %" GST_TIME_FORMAT
+        " current %" GST_TIME_FORMAT ")", GST_TIME_ARGS (time),
+        GST_TIME_ARGS (GST_ELEMENT_CAST (self)->base_time),
+        GST_TIME_ARGS (start), GST_TIME_ARGS (latency_max),
+        GST_TIME_ARGS (latency_min),
+        GST_TIME_ARGS (gst_clock_get_time (clock)));
+
+
+    self->priv->aggregate_id = gst_clock_new_single_shot_id (clock, time);
+    gst_object_unref (clock);
+    SRC_UNLOCK (self);
+
+    jitter = 0;
+    status = gst_clock_id_wait (self->priv->aggregate_id, &jitter);
+
+    SRC_LOCK (self);
+    if (self->priv->aggregate_id) {
+      gst_clock_id_unref (self->priv->aggregate_id);
+      self->priv->aggregate_id = NULL;
+    }
+
+    GST_DEBUG_OBJECT (self,
+        "clock returned %d (jitter: %s%" GST_TIME_FORMAT ")",
+        status, (jitter < 0 ? "-" : " "),
+        GST_TIME_ARGS ((jitter < 0 ? -jitter : jitter)));
+
+    /* we timed out */
+    if (status == GST_CLOCK_OK || status == GST_CLOCK_EARLY) {
+      SRC_UNLOCK (self);
+      *timeout = TRUE;
+      return TRUE;
+    }
+  }
+
+  res = gst_aggregator_check_pads_ready (self);
+  SRC_UNLOCK (self);
+
+  return res;
+}
+
+static void
+gst_aggregator_aggregate_func (GstAggregator * self)
 {
   GstAggregatorPrivate *priv = self->priv;
   GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (self);
+  gboolean timeout = FALSE;
 
-  GST_LOG_OBJECT (self, "Checking aggregate");
-  while (priv->send_eos && gst_aggregator_iterate_sinkpads (self,
-          (GstAggregatorPadForeachFunc) _check_all_pads_with_data_or_eos,
-          NULL) && priv->running) {
-    GST_TRACE_OBJECT (self, "Actually aggregating!");
-
-    priv->flow_return = klass->aggregate (self);
-
-    if (priv->flow_return == GST_FLOW_EOS) {
-      g_main_context_wakeup (self->priv->mcontext);
-      _remove_all_sources (self);
-      _push_eos (self);
-    }
-
-    if (priv->flow_return == GST_FLOW_FLUSHING &&
-        g_atomic_int_get (&priv->flush_seeking))
-      priv->flow_return = GST_FLOW_OK;
-
-    GST_LOG_OBJECT (self, "flow return is %s",
-        gst_flow_get_name (priv->flow_return));
-
-    if (priv->flow_return != GST_FLOW_OK)
-      break;
-  }
-
-  return G_SOURCE_REMOVE;
-}
-
-static void
-iterate_main_context_func (GstAggregator * self)
-{
   if (self->priv->running == FALSE) {
     GST_DEBUG_OBJECT (self, "Not running anymore");
-
     return;
   }
 
-  g_main_context_iteration (self->priv->mcontext, TRUE);
+  GST_LOG_OBJECT (self, "Checking aggregate");
+  while (priv->send_eos && priv->running) {
+    GstFlowReturn flow_return;
+
+    if (!gst_aggregator_wait_and_check (self, &timeout))
+      continue;
+
+    GST_TRACE_OBJECT (self, "Actually aggregating!");
+
+    flow_return = klass->aggregate (self, timeout);
+
+    GST_OBJECT_LOCK (self);
+    if (flow_return == GST_FLOW_FLUSHING && priv->flush_seeking)
+      priv->flow_return = GST_FLOW_OK;
+    else
+      priv->flow_return = flow_return;
+    GST_OBJECT_UNLOCK (self);
+
+    if (flow_return == GST_FLOW_EOS) {
+      gst_aggregator_push_eos (self);
+    }
+
+    GST_LOG_OBJECT (self, "flow return is %s", gst_flow_get_name (flow_return));
+
+    if (flow_return != GST_FLOW_OK)
+      break;
+  }
+
+  /* Pause the task here, the only ways to get here are:
+   * 1) We're stopping, in which case the task is stopped anyway
+   * 2) We got a flow error above, in which case it might take
+   *    some time to forward the flow return upstream and we
+   *    would otherwise call the task function over and over
+   *    again without doing anything
+   */
+  gst_pad_pause_task (self->srcpad);
 }
 
 static gboolean
-_start (GstAggregator * self)
+gst_aggregator_start (GstAggregator * self)
 {
+  GstAggregatorClass *klass;
+  gboolean result;
+
   self->priv->running = TRUE;
   self->priv->send_stream_start = TRUE;
   self->priv->send_segment = TRUE;
@@ -463,28 +692,41 @@
   self->priv->srccaps = NULL;
   self->priv->flow_return = GST_FLOW_OK;
 
-  return TRUE;
+  klass = GST_AGGREGATOR_GET_CLASS (self);
+
+  if (klass->start)
+    result = klass->start (self);
+  else
+    result = TRUE;
+
+  return result;
 }
 
 static gboolean
 _check_pending_flush_stop (GstAggregatorPad * pad)
 {
-  return (!pad->priv->pending_flush_stop && !pad->priv->pending_flush_start);
+  gboolean res;
+
+  PAD_LOCK (pad);
+  res = (!pad->priv->pending_flush_stop && !pad->priv->pending_flush_start);
+  PAD_UNLOCK (pad);
+
+  return res;
 }
 
 static gboolean
-_stop_srcpad_task (GstAggregator * self, GstEvent * flush_start)
+gst_aggregator_stop_srcpad_task (GstAggregator * self, GstEvent * flush_start)
 {
   gboolean res = TRUE;
 
   GST_INFO_OBJECT (self, "%s srcpad task",
       flush_start ? "Pausing" : "Stopping");
 
+  SRC_LOCK (self);
   self->priv->running = FALSE;
+  SRC_BROADCAST (self);
+  SRC_UNLOCK (self);
 
-  /*  Clean the stack of GSource set on the MainContext */
-  g_main_context_wakeup (self->priv->mcontext);
-  _remove_all_sources (self);
   if (flush_start) {
     res = gst_pad_push_event (self->srcpad, flush_start);
   }
@@ -495,135 +737,151 @@
 }
 
 static void
-_start_srcpad_task (GstAggregator * self)
+gst_aggregator_start_srcpad_task (GstAggregator * self)
 {
   GST_INFO_OBJECT (self, "Starting srcpad task");
 
   self->priv->running = TRUE;
   gst_pad_start_task (GST_PAD (self->srcpad),
-      (GstTaskFunction) iterate_main_context_func, self, NULL);
-}
-
-static inline void
-_add_aggregate_gsource (GstAggregator * self)
-{
-  GSource *source;
-  GstAggregatorPrivate *priv = self->priv;
-
-  MAIN_CONTEXT_LOCK (self);
-  source = g_idle_source_new ();
-  g_source_set_callback (source, (GSourceFunc) aggregate_func, self, NULL);
-  priv->gsources = g_list_prepend (priv->gsources, source);
-  g_source_attach (source, priv->mcontext);
-  MAIN_CONTEXT_UNLOCK (self);
+      (GstTaskFunction) gst_aggregator_aggregate_func, self, NULL);
 }
 
 static GstFlowReturn
-_flush (GstAggregator * self)
+gst_aggregator_flush (GstAggregator * self)
 {
   GstFlowReturn ret = GST_FLOW_OK;
   GstAggregatorPrivate *priv = self->priv;
   GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (self);
 
   GST_DEBUG_OBJECT (self, "Flushing everything");
-  g_atomic_int_set (&priv->send_segment, TRUE);
-  g_atomic_int_set (&priv->flush_seeking, FALSE);
-  g_atomic_int_set (&priv->tags_changed, FALSE);
+  GST_OBJECT_LOCK (self);
+  priv->send_segment = TRUE;
+  priv->flush_seeking = FALSE;
+  priv->tags_changed = FALSE;
+  GST_OBJECT_UNLOCK (self);
   if (klass->flush)
     ret = klass->flush (self);
 
   return ret;
 }
 
+
+/* Called with GstAggregator's object lock held */
+
 static gboolean
-_all_flush_stop_received (GstAggregator * self)
+gst_aggregator_all_flush_stop_received_locked (GstAggregator * self)
 {
   GList *tmp;
   GstAggregatorPad *tmppad;
 
-  GST_OBJECT_LOCK (self);
   for (tmp = GST_ELEMENT (self)->sinkpads; tmp; tmp = tmp->next) {
     tmppad = (GstAggregatorPad *) tmp->data;
 
     if (_check_pending_flush_stop (tmppad) == FALSE) {
       GST_DEBUG_OBJECT (tmppad, "Is not last %i -- %i",
           tmppad->priv->pending_flush_start, tmppad->priv->pending_flush_stop);
-      GST_OBJECT_UNLOCK (self);
       return FALSE;
     }
   }
-  GST_OBJECT_UNLOCK (self);
 
   return TRUE;
 }
 
+static void
+gst_aggregator_flush_start (GstAggregator * self, GstAggregatorPad * aggpad,
+    GstEvent * event)
+{
+  GstAggregatorPrivate *priv = self->priv;
+  GstAggregatorPadPrivate *padpriv = aggpad->priv;
+
+  g_atomic_int_set (&aggpad->priv->flushing, TRUE);
+
+  /*  Remove pad buffer and wake up the streaming thread */
+  gst_aggregator_pad_drop_buffer (aggpad);
+
+  PAD_FLUSH_LOCK (aggpad);
+  PAD_LOCK (aggpad);
+  if (padpriv->pending_flush_start) {
+    GST_DEBUG_OBJECT (aggpad, "Expecting FLUSH_STOP now");
+
+    padpriv->pending_flush_start = FALSE;
+    padpriv->pending_flush_stop = TRUE;
+  }
+  PAD_UNLOCK (aggpad);
+
+  GST_OBJECT_LOCK (self);
+  if (priv->flush_seeking) {
+    /* If flush_seeking we forward the first FLUSH_START */
+    if (priv->pending_flush_start) {
+      priv->pending_flush_start = FALSE;
+      GST_OBJECT_UNLOCK (self);
+
+      GST_INFO_OBJECT (self, "Flushing, pausing srcpad task");
+      gst_aggregator_stop_srcpad_task (self, event);
+      priv->flow_return = GST_FLOW_OK;
+
+      GST_INFO_OBJECT (self, "Getting STREAM_LOCK while seeking");
+      GST_PAD_STREAM_LOCK (self->srcpad);
+      GST_LOG_OBJECT (self, "GOT STREAM_LOCK");
+      event = NULL;
+    } else {
+      GST_OBJECT_UNLOCK (self);
+      gst_event_unref (event);
+    }
+  } else {
+    GST_OBJECT_UNLOCK (self);
+    gst_event_unref (event);
+  }
+  PAD_FLUSH_UNLOCK (aggpad);
+
+  gst_aggregator_pad_drop_buffer (aggpad);
+}
+
 /* GstAggregator vmethods default implementations */
 static gboolean
-_sink_event (GstAggregator * self, GstAggregatorPad * aggpad, GstEvent * event)
+gst_aggregator_default_sink_event (GstAggregator * self,
+    GstAggregatorPad * aggpad, GstEvent * event)
 {
   gboolean res = TRUE;
   GstPad *pad = GST_PAD (aggpad);
   GstAggregatorPrivate *priv = self->priv;
-  GstAggregatorPadPrivate *padpriv = aggpad->priv;
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_FLUSH_START:
     {
-      GstBuffer *tmpbuf;
-
-      g_atomic_int_set (&aggpad->priv->flushing, TRUE);
-      /*  Remove pad buffer and wake up the streaming thread */
-      tmpbuf = gst_aggregator_pad_steal_buffer (aggpad);
-      gst_buffer_replace (&tmpbuf, NULL);
-      if (g_atomic_int_compare_and_exchange (&padpriv->pending_flush_start,
-              TRUE, FALSE) == TRUE) {
-        GST_DEBUG_OBJECT (aggpad, "Expecting FLUSH_STOP now");
-        g_atomic_int_set (&padpriv->pending_flush_stop, TRUE);
-      }
-
-      if (g_atomic_int_get (&priv->flush_seeking)) {
-        /* If flush_seeking we forward the first FLUSH_START */
-        if (g_atomic_int_compare_and_exchange (&priv->pending_flush_start,
-                TRUE, FALSE) == TRUE) {
-
-          GST_DEBUG_OBJECT (self, "Flushing, pausing srcpad task");
-          _stop_srcpad_task (self, event);
-          priv->flow_return = GST_FLOW_OK;
-
-          GST_INFO_OBJECT (self, "Getting STREAM_LOCK while seeking");
-          GST_PAD_STREAM_LOCK (self->srcpad);
-          GST_LOG_OBJECT (self, "GOT STREAM_LOCK");
-          event = NULL;
-          goto eat;
-        }
-      }
-
+      gst_aggregator_flush_start (self, aggpad, event);
       /* We forward only in one case: right after flush_seeking */
+      event = NULL;
       goto eat;
     }
     case GST_EVENT_FLUSH_STOP:
     {
       GST_DEBUG_OBJECT (aggpad, "Got FLUSH_STOP");
 
-      _aggpad_flush (aggpad, self);
-      if (g_atomic_int_get (&priv->flush_seeking)) {
+      gst_aggregator_pad_flush (aggpad, self);
+      GST_OBJECT_LOCK (self);
+      if (priv->flush_seeking) {
         g_atomic_int_set (&aggpad->priv->pending_flush_stop, FALSE);
+        if (gst_aggregator_all_flush_stop_received_locked (self)) {
+          GST_OBJECT_UNLOCK (self);
+          /* That means we received FLUSH_STOP/FLUSH_STOP on
+           * all sinkpads -- Seeking is Done... sending FLUSH_STOP */
+          gst_aggregator_flush (self);
+          gst_pad_push_event (self->srcpad, event);
+          event = NULL;
+          SRC_LOCK (self);
+          priv->send_eos = TRUE;
+          SRC_BROADCAST (self);
+          SRC_UNLOCK (self);
 
-        if (g_atomic_int_get (&priv->flush_seeking)) {
-          if (_all_flush_stop_received (self)) {
-            /* That means we received FLUSH_STOP/FLUSH_STOP on
-             * all sinkpads -- Seeking is Done... sending FLUSH_STOP */
-            _flush (self);
-            gst_pad_push_event (self->srcpad, event);
-            priv->send_eos = TRUE;
-            event = NULL;
-            _add_aggregate_gsource (self);
-
-            GST_INFO_OBJECT (self, "Releasing source pad STREAM_LOCK");
-            GST_PAD_STREAM_UNLOCK (self->srcpad);
-            _start_srcpad_task (self);
-          }
+          GST_INFO_OBJECT (self, "Releasing source pad STREAM_LOCK");
+          GST_PAD_STREAM_UNLOCK (self->srcpad);
+          gst_aggregator_start_srcpad_task (self);
+        } else {
+          GST_OBJECT_UNLOCK (self);
         }
+      } else {
+        GST_OBJECT_UNLOCK (self);
       }
 
       /* We never forward the event */
@@ -637,28 +895,41 @@
        * check for it. Mark pending_eos, eos will be set when steal_buffer is
        * called
        */
-      PAD_LOCK_EVENT (aggpad);
-      if (!aggpad->buffer) {
-        aggpad->eos = TRUE;
+      SRC_LOCK (self);
+      PAD_LOCK (aggpad);
+      if (!aggpad->priv->buffer) {
+        aggpad->priv->eos = TRUE;
       } else {
         aggpad->priv->pending_eos = TRUE;
       }
-      PAD_UNLOCK_EVENT (aggpad);
+      PAD_UNLOCK (aggpad);
 
-      _add_aggregate_gsource (self);
+      SRC_BROADCAST (self);
+      SRC_UNLOCK (self);
       goto eat;
     }
     case GST_EVENT_SEGMENT:
     {
-      PAD_LOCK_EVENT (aggpad);
+      GST_OBJECT_LOCK (aggpad);
       gst_event_copy_segment (event, &aggpad->segment);
-      PAD_UNLOCK_EVENT (aggpad);
+      GST_OBJECT_UNLOCK (aggpad);
+
+      GST_OBJECT_LOCK (self);
+      self->priv->seqnum = gst_event_get_seqnum (event);
+      GST_OBJECT_UNLOCK (self);
       goto eat;
     }
     case GST_EVENT_STREAM_START:
     {
       goto eat;
     }
+    case GST_EVENT_GAP:
+    {
+      /* FIXME: need API to handle GAP events properly */
+      GST_FIXME_OBJECT (self, "implement support for GAP events");
+      /* don't forward GAP events downstream */
+      goto eat;
+    }
     case GST_EVENT_TAG:
     {
       GstTagList *tags;
@@ -690,41 +961,50 @@
   return res;
 }
 
-static gboolean
-_flush_pad (GstAggregator * self, GstAggregatorPad * pad, gpointer unused_udata)
+static inline gboolean
+gst_aggregator_stop_pad (GstAggregator * self, GstAggregatorPad * pad,
+    gpointer unused_udata)
 {
-  _aggpad_flush (pad, self);
+  gst_aggregator_pad_flush (pad, self);
 
   return TRUE;
 }
 
 static gboolean
-_stop (GstAggregator * agg)
+gst_aggregator_stop (GstAggregator * agg)
 {
-  _reset_flow_values (agg);
+  GstAggregatorClass *klass;
+  gboolean result;
 
-  gst_aggregator_iterate_sinkpads (agg,
-      (GstAggregatorPadForeachFunc) _flush_pad, NULL);
+  gst_aggregator_reset_flow_values (agg);
+
+  gst_aggregator_iterate_sinkpads (agg, gst_aggregator_stop_pad, NULL);
+
+  klass = GST_AGGREGATOR_GET_CLASS (agg);
+
+  if (klass->stop)
+    result = klass->stop (agg);
+  else
+    result = TRUE;
 
   if (agg->priv->tags)
     gst_tag_list_unref (agg->priv->tags);
   agg->priv->tags = NULL;
 
-  return TRUE;
+  return result;
 }
 
 /* GstElement vmethods implementations */
 static GstStateChangeReturn
-_change_state (GstElement * element, GstStateChange transition)
+gst_aggregator_change_state (GstElement * element, GstStateChange transition)
 {
   GstStateChangeReturn ret;
   GstAggregator *self = GST_AGGREGATOR (element);
-  GstAggregatorClass *agg_class = GST_AGGREGATOR_GET_CLASS (self);
-
 
   switch (transition) {
     case GST_STATE_CHANGE_READY_TO_PAUSED:
-      agg_class->start (self);
+      if (!gst_aggregator_start (self))
+        goto error_start;
       break;
     default:
       break;
@@ -738,7 +1018,10 @@
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
-      agg_class->stop (self);
+      if (!gst_aggregator_stop (self)) {
+        /* What to do in this case? Error out? */
+        GST_ERROR_OBJECT (self, "Subclass failed to stop.");
+      }
       break;
     default:
       break;
@@ -746,34 +1029,39 @@
 
   return ret;
 
+/* ERRORS */
 failure:
   {
     GST_ERROR_OBJECT (element, "parent failed state change");
     return ret;
   }
+error_start:
+  {
+    GST_ERROR_OBJECT (element, "Subclass failed to start");
+    return GST_STATE_CHANGE_FAILURE;
+  }
 }
 
 static void
-_release_pad (GstElement * element, GstPad * pad)
+gst_aggregator_release_pad (GstElement * element, GstPad * pad)
 {
-  GstBuffer *tmpbuf;
-
   GstAggregator *self = GST_AGGREGATOR (element);
+
   GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
 
   GST_INFO_OBJECT (pad, "Removing pad");
 
+  SRC_LOCK (self);
   g_atomic_int_set (&aggpad->priv->flushing, TRUE);
-  tmpbuf = gst_aggregator_pad_steal_buffer (aggpad);
-  gst_buffer_replace (&tmpbuf, NULL);
+  gst_aggregator_pad_drop_buffer (aggpad);
   gst_element_remove_pad (element, pad);
 
-  /* Something changed make sure we try to aggregate */
-  _add_aggregate_gsource (self);
+  SRC_BROADCAST (self);
+  SRC_UNLOCK (self);
 }
 
 static GstPad *
-_request_new_pad (GstElement * element,
+gst_aggregator_request_new_pad (GstElement * element,
     GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
 {
   GstAggregator *self;
@@ -804,6 +1092,7 @@
     agg_pad = g_object_new (GST_AGGREGATOR_GET_CLASS (self)->sinkpads_type,
         "name", name, "direction", GST_PAD_SINK, "template", templ, NULL);
     g_free (name);
+
     GST_OBJECT_UNLOCK (element);
 
   } else {
@@ -822,7 +1111,152 @@
 }
 
 static gboolean
-_src_query (GstAggregator * self, GstQuery * query)
+gst_aggregator_query_latency (GstAggregator * self, GstQuery * query)
+{
+  gboolean query_ret, live;
+  GstClockTime our_latency, min, max;
+
+  query_ret = gst_pad_query_default (self->srcpad, GST_OBJECT (self), query);
+
+  if (!query_ret) {
+    GST_WARNING_OBJECT (self, "Latency query failed");
+    return FALSE;
+  }
+
+  gst_query_parse_latency (query, &live, &min, &max);
+
+  SRC_LOCK (self);
+  our_latency = self->priv->latency;
+
+  if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (min))) {
+    GST_ERROR_OBJECT (self, "Invalid minimum latency %" GST_TIME_FORMAT
+        ". Please file a bug at " PACKAGE_BUGREPORT ".", GST_TIME_ARGS (min));
+    SRC_UNLOCK (self);
+    return FALSE;
+  }
+
+  if (min > max && GST_CLOCK_TIME_IS_VALID (max)) {
+    GST_ELEMENT_WARNING (self, CORE, CLOCK, (NULL),
+        ("Impossible to configure latency: max %" GST_TIME_FORMAT " < min %"
+            GST_TIME_FORMAT ". Add queues or other buffering elements.",
+            GST_TIME_ARGS (max), GST_TIME_ARGS (min)));
+    SRC_UNLOCK (self);
+    return FALSE;
+  }
+
+  self->priv->latency_live = live;
+  self->priv->latency_min = min;
+  self->priv->latency_max = max;
+
+  /* add our own */
+  min += our_latency;
+  min += self->priv->sub_latency_min;
+  if (GST_CLOCK_TIME_IS_VALID (self->priv->sub_latency_max)
+      && GST_CLOCK_TIME_IS_VALID (max))
+    max += self->priv->sub_latency_max;
+  else
+    max = GST_CLOCK_TIME_NONE;
+
+  if (live && min > max) {
+    GST_ELEMENT_WARNING (self, CORE, NEGOTIATION,
+        ("%s", "Latency too big"),
+        ("The requested latency value is too big for the current pipeline.  "
+            "Limiting to %" G_GINT64_FORMAT, max));
+    min = max;
+    /* FIXME: This could in theory become negative, but in
+     * that case all is lost anyway */
+    self->priv->latency -= min - max;
+    /* FIXME: shouldn't we g_object_notify() the change here? */
+  }
+
+  SRC_BROADCAST (self);
+  SRC_UNLOCK (self);
+
+  GST_DEBUG_OBJECT (self, "configured latency live:%s min:%" G_GINT64_FORMAT
+      " max:%" G_GINT64_FORMAT, live ? "true" : "false", min, max);
+
+  gst_query_set_latency (query, live, min, max);
+
+  return query_ret;
+}
+
+/**
+ * gst_aggregator_get_latency_unlocked:
+ * @self: a #GstAggregator
+ * @live: (out) (allow-none): whether @self is live
+ * @min_latency: (out) (allow-none): the configured minimum latency of @self
+ * @max_latency: (out) (allow-none): the configured maximum latency of @self
+ *
+ * Retreives the latency values reported by @self in response to the latency
+ * query.
+ *
+ * Typically only called by subclasses.
+ *
+ * MUST be called with the src_lock held.
+ */
+void
+gst_aggregator_get_latency_unlocked (GstAggregator * self, gboolean * live,
+    GstClockTime * min_latency, GstClockTime * max_latency)
+{
+  GstClockTime min, max;
+
+  g_return_if_fail (GST_IS_AGGREGATOR (self));
+
+  /* latency_min is never GST_CLOCK_TIME_NONE by construction */
+  min = self->priv->latency_min;
+  max = self->priv->latency_max;
+
+  /* add our own */
+  min += self->priv->latency;
+  min += self->priv->sub_latency_min;
+  if (GST_CLOCK_TIME_IS_VALID (max)
+      && GST_CLOCK_TIME_IS_VALID (self->priv->sub_latency_max))
+    max += self->priv->sub_latency_max;
+  else
+    max = GST_CLOCK_TIME_NONE;
+
+  if (live)
+    *live = self->priv->latency_live;
+  if (min_latency)
+    *min_latency = min;
+  if (max_latency)
+    *max_latency = max;
+}
+
+static gboolean
+gst_aggregator_send_event (GstElement * element, GstEvent * event)
+{
+  GstAggregator *self = GST_AGGREGATOR (element);
+
+  GST_STATE_LOCK (element);
+  if (GST_EVENT_TYPE (event) == GST_EVENT_SEEK &&
+      GST_STATE (element) < GST_STATE_PAUSED) {
+    gdouble rate;
+    GstFormat fmt;
+    GstSeekFlags flags;
+    GstSeekType start_type, stop_type;
+    gint64 start, stop;
+
+    gst_event_parse_seek (event, &rate, &fmt, &flags, &start_type,
+        &start, &stop_type, &stop);
+
+    GST_OBJECT_LOCK (self);
+    gst_segment_do_seek (&self->segment, rate, fmt, flags, start_type, start,
+        stop_type, stop, NULL);
+    self->priv->seqnum = gst_event_get_seqnum (event);
+    GST_OBJECT_UNLOCK (self);
+
+    GST_DEBUG_OBJECT (element, "Storing segment %" GST_PTR_FORMAT, event);
+  }
+  GST_STATE_UNLOCK (element);
+
+
+  return GST_ELEMENT_CLASS (aggregator_parent_class)->send_event (element,
+      event);
+}
+
+static gboolean
+gst_aggregator_default_src_query (GstAggregator * self, GstQuery * query)
 {
   gboolean res = TRUE;
 
@@ -839,6 +1273,8 @@
 
       goto discard;
     }
+    case GST_QUERY_LATENCY:
+      return gst_aggregator_query_latency (self, query);
     default:
       break;
   }
@@ -850,11 +1286,12 @@
 }
 
 static gboolean
-event_forward_func (GstPad * pad, EventData * evdata)
+gst_aggregator_event_forward_func (GstPad * pad, gpointer user_data)
 {
+  EventData *evdata = user_data;
   gboolean ret = TRUE;
   GstPad *peer = gst_pad_get_peer (pad);
-  GstAggregatorPadPrivate *padpriv = GST_AGGREGATOR_PAD (pad)->priv;
+  GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
 
   if (peer) {
     ret = gst_pad_send_event (peer, gst_event_ref (evdata->event));
@@ -862,60 +1299,85 @@
     gst_object_unref (peer);
   }
 
-  evdata->result &= ret;
-
   if (ret == FALSE) {
     if (GST_EVENT_TYPE (evdata->event) == GST_EVENT_SEEK)
       GST_ERROR_OBJECT (pad, "Event %" GST_PTR_FORMAT " failed", evdata->event);
-    else
-      GST_INFO_OBJECT (pad, "Event %" GST_PTR_FORMAT " failed", evdata->event);
+
+    if (GST_EVENT_TYPE (evdata->event) == GST_EVENT_SEEK) {
+      GstQuery *seeking = gst_query_new_seeking (GST_FORMAT_TIME);
+
+      if (gst_pad_query (peer, seeking)) {
+        gboolean seekable;
+
+        gst_query_parse_seeking (seeking, NULL, &seekable, NULL, NULL);
+
+        if (seekable == FALSE) {
+          GST_INFO_OBJECT (pad,
+              "Source not seekable, We failed but it does not matter!");
+
+          ret = TRUE;
+        }
+      } else {
+        GST_ERROR_OBJECT (pad, "Query seeking FAILED");
+      }
+
+      gst_query_unref (seeking);
+    }
 
     if (evdata->flush) {
-      padpriv->pending_flush_start = FALSE;
-      padpriv->pending_flush_stop = FALSE;
+      PAD_LOCK (aggpad);
+      aggpad->priv->pending_flush_start = FALSE;
+      aggpad->priv->pending_flush_stop = FALSE;
+      PAD_UNLOCK (aggpad);
     }
+  } else {
+    evdata->one_actually_seeked = TRUE;
   }
 
+  evdata->result &= ret;
+
   /* Always send to all pads */
   return FALSE;
 }
 
-static gboolean
-_set_flush_pending (GstAggregator * self, GstAggregatorPad * pad,
-    gpointer udata)
-{
-  pad->priv->pending_flush_start = TRUE;
-  pad->priv->pending_flush_stop = FALSE;
-
-  return TRUE;
-}
-
-static gboolean
-_forward_event_to_all_sinkpads (GstAggregator * self, GstEvent * event,
-    gboolean flush)
+static EventData
+gst_aggregator_forward_event_to_all_sinkpads (GstAggregator * self,
+    GstEvent * event, gboolean flush)
 {
   EventData evdata;
 
   evdata.event = event;
   evdata.result = TRUE;
   evdata.flush = flush;
+  evdata.one_actually_seeked = FALSE;
 
   /* We first need to set all pads as flushing in a first pass
    * as flush_start flush_stop is sometimes sent synchronously
    * while we send the seek event */
-  if (flush)
-    gst_aggregator_iterate_sinkpads (self,
-        (GstAggregatorPadForeachFunc) _set_flush_pending, NULL);
-  gst_pad_forward (self->srcpad, (GstPadForwardFunction) event_forward_func,
-      &evdata);
+  if (flush) {
+    GList *l;
+
+    GST_OBJECT_LOCK (self);
+    for (l = GST_ELEMENT_CAST (self)->sinkpads; l != NULL; l = l->next) {
+      GstAggregatorPad *pad = l->data;
+
+      PAD_LOCK (pad);
+      pad->priv->pending_flush_start = TRUE;
+      pad->priv->pending_flush_stop = FALSE;
+      PAD_UNLOCK (pad);
+    }
+    GST_OBJECT_UNLOCK (self);
+  }
+
+  gst_pad_forward (self->srcpad, gst_aggregator_event_forward_func, &evdata);
 
   gst_event_unref (event);
 
-  return evdata.result;
+  return evdata;
 }
 
 static gboolean
-_do_seek (GstAggregator * self, GstEvent * event)
+gst_aggregator_do_seek (GstAggregator * self, GstEvent * event)
 {
   gdouble rate;
   GstFormat fmt;
@@ -923,7 +1385,7 @@
   GstSeekType start_type, stop_type;
   gint64 start, stop;
   gboolean flush;
-  gboolean res;
+  EventData evdata;
   GstAggregatorPrivate *priv = self->priv;
 
   gst_event_parse_seek (event, &rate, &fmt, &flags, &start_type,
@@ -933,40 +1395,43 @@
 
   flush = flags & GST_SEEK_FLAG_FLUSH;
 
+  GST_OBJECT_LOCK (self);
   if (flush) {
-    g_atomic_int_set (&priv->pending_flush_start, TRUE);
-    g_atomic_int_set (&priv->flush_seeking, TRUE);
+    priv->pending_flush_start = TRUE;
+    priv->flush_seeking = TRUE;
   }
 
   gst_segment_do_seek (&self->segment, rate, fmt, flags, start_type, start,
       stop_type, stop, NULL);
+  GST_OBJECT_UNLOCK (self);
 
   /* forward the seek upstream */
-  res = _forward_event_to_all_sinkpads (self, event, flush);
+  evdata = gst_aggregator_forward_event_to_all_sinkpads (self, event, flush);
   event = NULL;
 
-  if (!res) {
-    g_atomic_int_set (&priv->flush_seeking, FALSE);
-    g_atomic_int_set (&priv->pending_flush_start, FALSE);
+  if (!evdata.result || !evdata.one_actually_seeked) {
+    GST_OBJECT_LOCK (self);
+    priv->flush_seeking = FALSE;
+    priv->pending_flush_start = FALSE;
+    GST_OBJECT_UNLOCK (self);
   }
 
-  GST_INFO_OBJECT (self, "seek done, result: %d", res);
+  GST_INFO_OBJECT (self, "seek done, result: %d", evdata.result);
 
-  return res;
+  return evdata.result;
 }
 
 static gboolean
-_src_event (GstAggregator * self, GstEvent * event)
+gst_aggregator_default_src_event (GstAggregator * self, GstEvent * event)
 {
+  EventData evdata;
   gboolean res = TRUE;
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_SEEK:
     {
       gst_event_ref (event);
-      res = _do_seek (self, event);
-      if (res)
-        self->priv->seqnum = gst_event_get_seqnum (event);
+      res = gst_aggregator_do_seek (self, event);
       gst_event_unref (event);
       event = NULL;
       goto done;
@@ -984,14 +1449,16 @@
     }
   }
 
-  return _forward_event_to_all_sinkpads (self, event, FALSE);
+  evdata = gst_aggregator_forward_event_to_all_sinkpads (self, event, FALSE);
+  res = evdata.result;
 
 done:
   return res;
 }
 
 static gboolean
-src_event_func (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_aggregator_src_pad_event_func (GstPad * pad, GstObject * parent,
+    GstEvent * event)
 {
   GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
 
@@ -999,7 +1466,8 @@
 }
 
 static gboolean
-src_query_func (GstPad * pad, GstObject * parent, GstQuery * query)
+gst_aggregator_src_pad_query_func (GstPad * pad, GstObject * parent,
+    GstQuery * query)
 {
   GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
 
@@ -1007,7 +1475,7 @@
 }
 
 static gboolean
-src_activate_mode (GstPad * pad,
+gst_aggregator_src_pad_activate_mode_func (GstPad * pad,
     GstObject * parent, GstPadMode mode, gboolean active)
 {
   GstAggregator *self = GST_AGGREGATOR (parent);
@@ -1024,7 +1492,7 @@
       case GST_PAD_MODE_PUSH:
       {
         GST_INFO_OBJECT (pad, "Activating pad!");
-        _start_srcpad_task (self);
+        gst_aggregator_start_srcpad_task (self);
         return TRUE;
       }
       default:
@@ -1037,13 +1505,14 @@
 
   /* deactivating */
   GST_INFO_OBJECT (self, "Deactivating srcpad");
-  _stop_srcpad_task (self, FALSE);
+  gst_aggregator_stop_srcpad_task (self, FALSE);
 
   return TRUE;
 }
 
 static gboolean
-_sink_query (GstAggregator * self, GstAggregatorPad * aggpad, GstQuery * query)
+gst_aggregator_default_sink_query (GstAggregator * self,
+    GstAggregatorPad * aggpad, GstQuery * query)
 {
   GstPad *pad = GST_PAD (aggpad);
 
@@ -1055,20 +1524,122 @@
 {
   GstAggregator *self = (GstAggregator *) object;
 
-  g_mutex_clear (&self->priv->mcontext_lock);
+  g_mutex_clear (&self->priv->src_lock);
+  g_cond_clear (&self->priv->src_cond);
 
   G_OBJECT_CLASS (aggregator_parent_class)->finalize (object);
 }
 
+/*
+ * gst_aggregator_set_latency_property:
+ * @agg: a #GstAggregator
+ * @latency: the new latency value.
+ *
+ * Sets the new latency value to @latency. This value is used to limit the
+ * amount of time a pad waits for data to appear before considering the pad
+ * as unresponsive.
+ */
 static void
-gst_aggregator_dispose (GObject * object)
+gst_aggregator_set_latency_property (GstAggregator * self, gint64 latency)
 {
-  GstAggregator *self = (GstAggregator *) object;
+  gboolean changed;
+  GstClockTime min, max;
 
-  G_OBJECT_CLASS (aggregator_parent_class)->dispose (object);
+  g_return_if_fail (GST_IS_AGGREGATOR (self));
+  g_return_if_fail (GST_CLOCK_TIME_IS_VALID (latency));
 
-  g_main_context_unref (self->priv->mcontext);
-  _remove_all_sources (self);
+  SRC_LOCK (self);
+  if (self->priv->latency_live) {
+    min = self->priv->latency_min;
+    max = self->priv->latency_max;
+    /* add our own */
+    min += latency;
+    min += self->priv->sub_latency_min;
+    if (GST_CLOCK_TIME_IS_VALID (self->priv->sub_latency_max)
+        && GST_CLOCK_TIME_IS_VALID (max))
+      max += self->priv->sub_latency_max;
+    else
+      max = GST_CLOCK_TIME_NONE;
+
+    if (GST_CLOCK_TIME_IS_VALID (max) && min > max) {
+      GST_ELEMENT_WARNING (self, CORE, NEGOTIATION,
+          ("%s", "Latency too big"),
+          ("The requested latency value is too big for the latency in the "
+              "current pipeline.  Limiting to %" G_GINT64_FORMAT, max));
+      /* FIXME: This could in theory become negative, but in
+       * that case all is lost anyway */
+      latency -= min - max;
+      /* FIXME: shouldn't we g_object_notify() the change here? */
+    }
+  }
+
+  changed = (self->priv->latency != latency);
+  self->priv->latency = latency;
+
+  if (changed)
+    SRC_BROADCAST (self);
+  SRC_UNLOCK (self);
+
+  if (changed)
+    gst_element_post_message (GST_ELEMENT_CAST (self),
+        gst_message_new_latency (GST_OBJECT_CAST (self)));
+}
+
+/*
+ * gst_aggregator_get_latency_property:
+ * @agg: a #GstAggregator
+ *
+ * Gets the latency value. See gst_aggregator_set_latency for
+ * more details.
+ *
+ * Returns: The time in nanoseconds to wait for data to arrive on a sink pad 
+ * before a pad is deemed unresponsive. A value of -1 means an
+ * unlimited time.
+ */
+static gint64
+gst_aggregator_get_latency_property (GstAggregator * agg)
+{
+  gint64 res;
+
+  g_return_val_if_fail (GST_IS_AGGREGATOR (agg), -1);
+
+  GST_OBJECT_LOCK (agg);
+  res = agg->priv->latency;
+  GST_OBJECT_UNLOCK (agg);
+
+  return res;
+}
+
+static void
+gst_aggregator_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstAggregator *agg = GST_AGGREGATOR (object);
+
+  switch (prop_id) {
+    case PROP_LATENCY:
+      gst_aggregator_set_latency_property (agg, g_value_get_int64 (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_aggregator_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstAggregator *agg = GST_AGGREGATOR (object);
+
+  switch (prop_id) {
+    case PROP_LATENCY:
+      g_value_set_int64 (value, gst_aggregator_get_latency_property (agg));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
 }
 
 /* GObject vmethods implementations */
@@ -1085,21 +1656,34 @@
       GST_DEBUG_FG_MAGENTA, "GstAggregator");
 
   klass->sinkpads_type = GST_TYPE_AGGREGATOR_PAD;
-  klass->start = _start;
-  klass->stop = _stop;
 
-  klass->sink_event = _sink_event;
-  klass->sink_query = _sink_query;
+  klass->sink_event = gst_aggregator_default_sink_event;
+  klass->sink_query = gst_aggregator_default_sink_query;
 
-  klass->src_event = _src_event;
-  klass->src_query = _src_query;
+  klass->src_event = gst_aggregator_default_src_event;
+  klass->src_query = gst_aggregator_default_src_query;
 
-  gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (_request_new_pad);
-  gstelement_class->release_pad = GST_DEBUG_FUNCPTR (_release_pad);
-  gstelement_class->change_state = GST_DEBUG_FUNCPTR (_change_state);
+  gstelement_class->request_new_pad =
+      GST_DEBUG_FUNCPTR (gst_aggregator_request_new_pad);
+  gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_aggregator_send_event);
+  gstelement_class->release_pad =
+      GST_DEBUG_FUNCPTR (gst_aggregator_release_pad);
+  gstelement_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_aggregator_change_state);
 
+  gobject_class->set_property = gst_aggregator_set_property;
+  gobject_class->get_property = gst_aggregator_get_property;
   gobject_class->finalize = gst_aggregator_finalize;
-  gobject_class->dispose = gst_aggregator_dispose;
+
+  g_object_class_install_property (gobject_class, PROP_LATENCY,
+      g_param_spec_int64 ("latency", "Buffer latency",
+          "Additional latency in live mode to allow upstream "
+          "to take longer to produce buffers for the current "
+          "position", 0,
+          (G_MAXLONG == G_MAXINT64) ? G_MAXINT64 : (G_MAXLONG * GST_SECOND - 1),
+          DEFAULT_LATENCY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  GST_DEBUG_REGISTER_FUNCPTR (gst_aggregator_stop_pad);
 }
 
 static void
@@ -1122,21 +1706,27 @@
 
   priv->padcount = -1;
   priv->tags_changed = FALSE;
-  _reset_flow_values (self);
 
-  priv->mcontext = g_main_context_new ();
+  self->priv->latency_live = FALSE;
+  self->priv->latency_min = self->priv->sub_latency_min = 0;
+  self->priv->latency_max = self->priv->sub_latency_max = 0;
+  gst_aggregator_reset_flow_values (self);
+
   self->srcpad = gst_pad_new_from_template (pad_template, "src");
 
   gst_pad_set_event_function (self->srcpad,
-      GST_DEBUG_FUNCPTR ((GstPadEventFunction) src_event_func));
+      GST_DEBUG_FUNCPTR (gst_aggregator_src_pad_event_func));
   gst_pad_set_query_function (self->srcpad,
-      GST_DEBUG_FUNCPTR ((GstPadQueryFunction) src_query_func));
+      GST_DEBUG_FUNCPTR (gst_aggregator_src_pad_query_func));
   gst_pad_set_activatemode_function (self->srcpad,
-      GST_DEBUG_FUNCPTR ((GstPadActivateModeFunction) src_activate_mode));
+      GST_DEBUG_FUNCPTR (gst_aggregator_src_pad_activate_mode_func));
 
   gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
 
-  g_mutex_init (&self->priv->mcontext_lock);
+  self->priv->latency = DEFAULT_LATENCY;
+
+  g_mutex_init (&self->priv->src_lock);
+  g_cond_init (&self->priv->src_cond);
 }
 
 /* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
@@ -1168,50 +1758,61 @@
 }
 
 static GstFlowReturn
-_chain (GstPad * pad, GstObject * object, GstBuffer * buffer)
+gst_aggregator_pad_chain (GstPad * pad, GstObject * object, GstBuffer * buffer)
 {
   GstBuffer *actual_buf = buffer;
   GstAggregator *self = GST_AGGREGATOR (object);
   GstAggregatorPrivate *priv = self->priv;
   GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
   GstAggregatorClass *aggclass = GST_AGGREGATOR_GET_CLASS (object);
+  GstFlowReturn flow_return;
 
   GST_DEBUG_OBJECT (aggpad, "Start chaining a buffer %" GST_PTR_FORMAT, buffer);
 
+  PAD_FLUSH_LOCK (aggpad);
+
   if (g_atomic_int_get (&aggpad->priv->flushing) == TRUE)
     goto flushing;
 
-  if (g_atomic_int_get (&aggpad->priv->pending_eos) == TRUE)
+  PAD_LOCK (aggpad);
+  if (aggpad->priv->pending_eos == TRUE)
     goto eos;
 
-  PAD_LOCK_EVENT (aggpad);
-  if (aggpad->buffer) {
+  while (aggpad->priv->buffer
+      && g_atomic_int_get (&aggpad->priv->flushing) == FALSE) {
     GST_DEBUG_OBJECT (aggpad, "Waiting for buffer to be consumed");
     PAD_WAIT_EVENT (aggpad);
   }
-  PAD_UNLOCK_EVENT (aggpad);
+  PAD_UNLOCK (aggpad);
 
   if (g_atomic_int_get (&aggpad->priv->flushing) == TRUE)
     goto flushing;
 
-
   if (aggclass->clip) {
     aggclass->clip (self, aggpad, buffer, &actual_buf);
   }
 
-  PAD_LOCK_EVENT (aggpad);
-  if (aggpad->buffer)
-    gst_buffer_unref (aggpad->buffer);
-  aggpad->buffer = actual_buf;
-  PAD_UNLOCK_EVENT (aggpad);
+  SRC_LOCK (self);
+  PAD_LOCK (aggpad);
+  if (aggpad->priv->buffer)
+    gst_buffer_unref (aggpad->priv->buffer);
+  aggpad->priv->buffer = actual_buf;
+  PAD_UNLOCK (aggpad);
+  PAD_FLUSH_UNLOCK (aggpad);
 
-  _add_aggregate_gsource (self);
+  SRC_BROADCAST (self);
+  SRC_UNLOCK (self);
 
   GST_DEBUG_OBJECT (aggpad, "Done chaining");
 
-  return priv->flow_return;
+  GST_OBJECT_LOCK (self);
+  flow_return = priv->flow_return;
+  GST_OBJECT_UNLOCK (self);
+
+  return flow_return;
 
 flushing:
+  PAD_FLUSH_UNLOCK (aggpad);
 
   gst_buffer_unref (buffer);
   GST_DEBUG_OBJECT (aggpad, "We are flushing");
@@ -1219,6 +1820,8 @@
   return GST_FLOW_FLUSHING;
 
 eos:
+  PAD_UNLOCK (aggpad);
+  PAD_FLUSH_UNLOCK (aggpad);
 
   gst_buffer_unref (buffer);
   GST_DEBUG_OBJECT (pad, "We are EOS already...");
@@ -1227,40 +1830,96 @@
 }
 
 static gboolean
-pad_query_func (GstPad * pad, GstObject * parent, GstQuery * query)
+gst_aggregator_pad_query_func (GstPad * pad, GstObject * parent,
+    GstQuery * query)
 {
+  GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
   GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
 
+  if (GST_QUERY_IS_SERIALIZED (query)) {
+    PAD_LOCK (aggpad);
+
+    if (g_atomic_int_get (&aggpad->priv->flushing) == TRUE) {
+      PAD_UNLOCK (aggpad);
+      goto flushing;
+    }
+
+    while (aggpad->priv->buffer
+        && g_atomic_int_get (&aggpad->priv->flushing) == FALSE) {
+      GST_DEBUG_OBJECT (aggpad, "Waiting for buffer to be consumed");
+      PAD_WAIT_EVENT (aggpad);
+    }
+    PAD_UNLOCK (aggpad);
+
+    if (g_atomic_int_get (&aggpad->priv->flushing) == TRUE)
+      goto flushing;
+  }
+
   return klass->sink_query (GST_AGGREGATOR (parent),
       GST_AGGREGATOR_PAD (pad), query);
+
+flushing:
+  GST_DEBUG_OBJECT (aggpad, "Pad is flushing, dropping query");
+  return FALSE;
 }
 
 static gboolean
-pad_event_func (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
+    GstEvent * event)
 {
+  GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
   GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
 
+  if (GST_EVENT_IS_SERIALIZED (event) && GST_EVENT_TYPE (event) != GST_EVENT_EOS
+      && GST_EVENT_TYPE (event) != GST_EVENT_SEGMENT_DONE) {
+    PAD_LOCK (aggpad);
+
+    if (g_atomic_int_get (&aggpad->priv->flushing) == TRUE
+        && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) {
+      PAD_UNLOCK (aggpad);
+      goto flushing;
+    }
+
+    while (aggpad->priv->buffer
+        && g_atomic_int_get (&aggpad->priv->flushing) == FALSE) {
+      GST_DEBUG_OBJECT (aggpad, "Waiting for buffer to be consumed");
+      PAD_WAIT_EVENT (aggpad);
+    }
+    PAD_UNLOCK (aggpad);
+
+    if (g_atomic_int_get (&aggpad->priv->flushing) == TRUE
+        && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP)
+      goto flushing;
+  }
+
   return klass->sink_event (GST_AGGREGATOR (parent),
       GST_AGGREGATOR_PAD (pad), event);
+
+flushing:
+  GST_DEBUG_OBJECT (aggpad, "Pad is flushing, dropping event");
+  if (GST_EVENT_IS_STICKY (event))
+    gst_pad_store_sticky_event (pad, event);
+  gst_event_unref (event);
+  return FALSE;
 }
 
 static gboolean
-pad_activate_mode_func (GstPad * pad,
+gst_aggregator_pad_activate_mode_func (GstPad * pad,
     GstObject * parent, GstPadMode mode, gboolean active)
 {
   GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
 
   if (active == FALSE) {
-    PAD_LOCK_EVENT (aggpad);
+    PAD_LOCK (aggpad);
     g_atomic_int_set (&aggpad->priv->flushing, TRUE);
-    gst_buffer_replace (&aggpad->buffer, NULL);
+    gst_buffer_replace (&aggpad->priv->buffer, NULL);
     PAD_BROADCAST_EVENT (aggpad);
-    PAD_UNLOCK_EVENT (aggpad);
+    PAD_UNLOCK (aggpad);
   } else {
+    PAD_LOCK (aggpad);
     g_atomic_int_set (&aggpad->priv->flushing, FALSE);
-    PAD_LOCK_EVENT (aggpad);
     PAD_BROADCAST_EVENT (aggpad);
-    PAD_UNLOCK_EVENT (aggpad);
+    PAD_UNLOCK (aggpad);
   }
 
   return TRUE;
@@ -1269,22 +1928,21 @@
 /***********************************
  * GstAggregatorPad implementation  *
  ************************************/
-static GstPadClass *aggregator_pad_parent_class = NULL;
 G_DEFINE_TYPE (GstAggregatorPad, gst_aggregator_pad, GST_TYPE_PAD);
 
 static void
-_pad_constructed (GObject * object)
+gst_aggregator_pad_constructed (GObject * object)
 {
   GstPad *pad = GST_PAD (object);
 
   gst_pad_set_chain_function (pad,
-      GST_DEBUG_FUNCPTR ((GstPadChainFunction) _chain));
+      GST_DEBUG_FUNCPTR (gst_aggregator_pad_chain));
   gst_pad_set_event_function (pad,
-      GST_DEBUG_FUNCPTR ((GstPadEventFunction) pad_event_func));
+      GST_DEBUG_FUNCPTR (gst_aggregator_pad_event_func));
   gst_pad_set_query_function (pad,
-      GST_DEBUG_FUNCPTR ((GstPadQueryFunction) pad_query_func));
+      GST_DEBUG_FUNCPTR (gst_aggregator_pad_query_func));
   gst_pad_set_activatemode_function (pad,
-      GST_DEBUG_FUNCPTR ((GstPadActivateModeFunction) pad_activate_mode_func));
+      GST_DEBUG_FUNCPTR (gst_aggregator_pad_activate_mode_func));
 }
 
 static void
@@ -1292,23 +1950,21 @@
 {
   GstAggregatorPad *pad = (GstAggregatorPad *) object;
 
-  g_mutex_clear (&pad->priv->event_lock);
   g_cond_clear (&pad->priv->event_cond);
+  g_mutex_clear (&pad->priv->flush_lock);
+  g_mutex_clear (&pad->priv->lock);
 
-  G_OBJECT_CLASS (aggregator_pad_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gst_aggregator_pad_parent_class)->finalize (object);
 }
 
 static void
 gst_aggregator_pad_dispose (GObject * object)
 {
   GstAggregatorPad *pad = (GstAggregatorPad *) object;
-  GstBuffer *buf;
 
-  buf = gst_aggregator_pad_steal_buffer (pad);
-  if (buf)
-    gst_buffer_unref (buf);
+  gst_aggregator_pad_drop_buffer (pad);
 
-  G_OBJECT_CLASS (aggregator_pad_parent_class)->dispose (object);
+  G_OBJECT_CLASS (gst_aggregator_pad_parent_class)->dispose (object);
 }
 
 static void
@@ -1316,12 +1972,11 @@
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
 
-  aggregator_pad_parent_class = g_type_class_peek_parent (klass);
   g_type_class_add_private (klass, sizeof (GstAggregatorPadPrivate));
 
-  gobject_class->constructed = GST_DEBUG_FUNCPTR (_pad_constructed);
-  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_aggregator_pad_finalize);
-  gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_aggregator_pad_dispose);
+  gobject_class->constructed = gst_aggregator_pad_constructed;
+  gobject_class->finalize = gst_aggregator_pad_finalize;
+  gobject_class->dispose = gst_aggregator_pad_dispose;
 }
 
 static void
@@ -1331,10 +1986,11 @@
       G_TYPE_INSTANCE_GET_PRIVATE (pad, GST_TYPE_AGGREGATOR_PAD,
       GstAggregatorPadPrivate);
 
-  pad->buffer = NULL;
-  g_mutex_init (&pad->priv->event_lock);
+  pad->priv->buffer = NULL;
   g_cond_init (&pad->priv->event_cond);
 
+  g_mutex_init (&pad->priv->flush_lock);
+  g_mutex_init (&pad->priv->lock);
 }
 
 /**
@@ -1351,24 +2007,46 @@
 {
   GstBuffer *buffer = NULL;
 
-  PAD_LOCK_EVENT (pad);
-  if (pad->buffer) {
+  PAD_LOCK (pad);
+  if (pad->priv->buffer) {
     GST_TRACE_OBJECT (pad, "Consuming buffer");
-    buffer = pad->buffer;
-    pad->buffer = NULL;
+    buffer = pad->priv->buffer;
+    pad->priv->buffer = NULL;
     if (pad->priv->pending_eos) {
       pad->priv->pending_eos = FALSE;
-      pad->eos = TRUE;
+      pad->priv->eos = TRUE;
     }
     PAD_BROADCAST_EVENT (pad);
-    GST_DEBUG_OBJECT (pad, "Consummed: %" GST_PTR_FORMAT, buffer);
+    GST_DEBUG_OBJECT (pad, "Consumed: %" GST_PTR_FORMAT, buffer);
   }
-  PAD_UNLOCK_EVENT (pad);
+  PAD_UNLOCK (pad);
 
   return buffer;
 }
 
 /**
+ * gst_aggregator_pad_drop_buffer:
+ * @pad: the pad where to drop any pending buffer
+ *
+ * Drop the buffer currently queued in @pad.
+ *
+ * Returns: TRUE if there was a buffer queued in @pad, or FALSE if not.
+ */
+gboolean
+gst_aggregator_pad_drop_buffer (GstAggregatorPad * pad)
+{
+  GstBuffer *buf;
+
+  buf = gst_aggregator_pad_steal_buffer (pad);
+
+  if (buf == NULL)
+    return FALSE;
+
+  gst_buffer_unref (buf);
+  return TRUE;
+}
+
+/**
  * gst_aggregator_pad_get_buffer:
  * @pad: the pad to get buffer from
  *
@@ -1381,14 +2059,26 @@
 {
   GstBuffer *buffer = NULL;
 
-  PAD_LOCK_EVENT (pad);
-  if (pad->buffer)
-    buffer = gst_buffer_ref (pad->buffer);
-  PAD_UNLOCK_EVENT (pad);
+  PAD_LOCK (pad);
+  if (pad->priv->buffer)
+    buffer = gst_buffer_ref (pad->priv->buffer);
+  PAD_UNLOCK (pad);
 
   return buffer;
 }
 
+gboolean
+gst_aggregator_pad_is_eos (GstAggregatorPad * pad)
+{
+  gboolean is_eos;
+
+  PAD_LOCK (pad);
+  is_eos = pad->priv->eos;
+  PAD_UNLOCK (pad);
+
+  return is_eos;
+}
+
 /**
  * gst_aggregator_merge_tags:
  * @self: a #GstAggregator
@@ -1423,3 +2113,43 @@
   self->priv->tags_changed = TRUE;
   GST_OBJECT_UNLOCK (self);
 }
+
+/**
+ * gst_aggregator_set_latency:
+ * @self: a #GstAggregator
+ * @min_latency: minimum latency
+ * @max_latency: maximum latency
+ *
+ * Lets #GstAggregator sub-classes tell the baseclass what their internal
+ * latency is. Will also post a LATENCY message on the bus so the pipeline
+ * can reconfigure its global latency.
+ */
+void
+gst_aggregator_set_latency (GstAggregator * self,
+    GstClockTime min_latency, GstClockTime max_latency)
+{
+  gboolean changed = FALSE;
+
+  g_return_if_fail (GST_IS_AGGREGATOR (self));
+  g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min_latency));
+  g_return_if_fail (max_latency >= min_latency);
+
+  SRC_LOCK (self);
+  if (self->priv->sub_latency_min != min_latency) {
+    self->priv->sub_latency_min = min_latency;
+    changed = TRUE;
+  }
+  if (self->priv->sub_latency_max != max_latency) {
+    self->priv->sub_latency_max = max_latency;
+    changed = TRUE;
+  }
+
+  if (changed)
+    SRC_BROADCAST (self);
+  SRC_UNLOCK (self);
+
+  if (changed) {
+    gst_element_post_message (GST_ELEMENT_CAST (self),
+        gst_message_new_latency (GST_OBJECT_CAST (self)));
+  }
+}
diff --git a/gst-libs/gst/base/gstaggregator.h b/gst-libs/gst/base/gstaggregator.h
index 507da13..a4ebdd7 100644
--- a/gst-libs/gst/base/gstaggregator.h
+++ b/gst-libs/gst/base/gstaggregator.h
@@ -1,9 +1,7 @@
-/* GStreamer
+/* GStreamer aggregator base class
  * Copyright (C) 2014 Mathieu Duponchelle <mathieu.duponchelle@oencreed.com>
  * Copyright (C) 2014 Thibault Saunier <tsaunier@gnome.org>
  *
- * gstaggregator.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
@@ -46,6 +44,7 @@
 
 #define GST_TYPE_AGGREGATOR_PAD            (gst_aggregator_pad_get_type())
 #define GST_AGGREGATOR_PAD(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AGGREGATOR_PAD, GstAggregatorPad))
+#define GST_AGGREGATOR_PAD_CAST(obj)       ((GstAggregatorPad *)(obj))
 #define GST_AGGREGATOR_PAD_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AGGREGATOR_PAD, GstAggregatorPadClass))
 #define GST_AGGREGATOR_PAD_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AGGREGATOR_PAD, GstAggregatorPadClass))
 #define GST_IS_AGGREGATOR_PAD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AGGREGATOR_PAD))
@@ -70,9 +69,8 @@
 {
   GstPad                       parent;
 
-  GstBuffer                 *  buffer;
-  GstSegment                   segment;
-  gboolean                     eos;
+  /* Protected by the OBJECT_LOCK */
+  GstSegment segment;
 
   /* < Private > */
   GstAggregatorPadPrivate   *  priv;
@@ -95,7 +93,7 @@
   GstFlowReturn (*flush)     (GstAggregatorPad * aggpad, GstAggregator * aggregator);
 
   /*< private >*/
-  gpointer      _gst_reserved[GST_PADDING];
+  gpointer      _gst_reserved[GST_PADDING_LARGE];
 };
 
 GType gst_aggregator_pad_get_type           (void);
@@ -106,6 +104,8 @@
 
 GstBuffer * gst_aggregator_pad_steal_buffer (GstAggregatorPad *  pad);
 GstBuffer * gst_aggregator_pad_get_buffer   (GstAggregatorPad *  pad);
+gboolean    gst_aggregator_pad_drop_buffer  (GstAggregatorPad *  pad);
+gboolean    gst_aggregator_pad_is_eos       (GstAggregatorPad *  pad);
 
 /*********************
  * GstAggregator API *
@@ -113,18 +113,20 @@
 
 #define GST_TYPE_AGGREGATOR            (gst_aggregator_get_type())
 #define GST_AGGREGATOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AGGREGATOR,GstAggregator))
+#define GST_AGGREGATOR_CAST(obj)       ((GstAggregator *)(obj))
 #define GST_AGGREGATOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AGGREGATOR,GstAggregatorClass))
 #define GST_AGGREGATOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AGGREGATOR,GstAggregatorClass))
 #define GST_IS_AGGREGATOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AGGREGATOR))
 #define GST_IS_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AGGREGATOR))
 
-#define GST_FLOW_CUSTOM_SUCCESS        GST_FLOW_NOT_HANDLED
+#define GST_FLOW_NOT_HANDLED           GST_FLOW_CUSTOM_SUCCESS
 
 /**
  * GstAggregator:
- * @aggregator_pads: #GList of #GstAggregatorPad managed by this #GstAggregator.
+ * @srcpad: the aggregator's source pad
+ * @segment: the output segment
  *
- * Collectpads object.
+ * Aggregator base class object structure.
  */
 struct _GstAggregator
 {
@@ -132,12 +134,13 @@
 
   GstPad                *  srcpad;
 
+  /* Only access with the object lock held */
   GstSegment               segment;
 
   /*< private >*/
   GstAggregatorPrivate  *  priv;
 
-  gpointer                 _gst_reserved[GST_PADDING];
+  gpointer                 _gst_reserved[GST_PADDING_LARGE];
 };
 
 /**
@@ -176,13 +179,18 @@
  *                  of. Once / if a buffer has been constructed from the
  *                  aggregated buffers, the subclass should call _finish_buffer.
  * @stop:           Optional.
- *                  Should be linked up first. Called when the
- *                  element goes from PAUSED to READY. The subclass should free
- *                  all resources and reset its state.
+ *                  Called when the element goes from PAUSED to READY.
+ *                  The subclass should free all resources and reset its state.
  * @start:          Optional.
- *                  Should be linked up first. Called when the element goes from
- *                  READY to PAUSED. The subclass should get ready to process
+ *                  Called when the element goes from READY to PAUSED.
+ *                  The subclass should get ready to process
  *                  aggregated buffers.
+ * @get_next_time:  Optional.
+ *                  Called when the element needs to know the time of the next
+ *                  rendered buffer for live pipelines. This causes deadline
+ *                  based aggregation to occur. Defaults to returning
+ *                  GST_CLOCK_TIME_NONE causing the element to wait for buffers
+ *                  on all sink pads before aggregating.
  *
  * The aggregator base class will handle in a thread-safe way all manners of
  * concurrent flushes, seeks, pad additions and removals, leaving to the
@@ -201,39 +209,42 @@
 
   GstFlowReturn     (*flush)          (GstAggregator    *  aggregator);
 
-  GstFlowReturn     (*clip)           (GstAggregator    *  agg,
-                                       GstAggregatorPad *  bpad,
+  GstFlowReturn     (*clip)           (GstAggregator    *  aggregator,
+                                       GstAggregatorPad *  aggregator_pad,
                                        GstBuffer        *  buf,
                                        GstBuffer        ** outbuf);
 
   /* sinkpads virtual methods */
-  gboolean          (*sink_event)     (GstAggregator    *  aggregate,
-                                       GstAggregatorPad *  bpad,
+  gboolean          (*sink_event)     (GstAggregator    *  aggregator,
+                                       GstAggregatorPad *  aggregator_pad,
                                        GstEvent         *  event);
 
-  gboolean          (*sink_query)     (GstAggregator    *  aggregate,
-                                       GstAggregatorPad *  bpad,
+  gboolean          (*sink_query)     (GstAggregator    *  aggregator,
+                                       GstAggregatorPad *  aggregator_pad,
                                        GstQuery         *  query);
 
   /* srcpad virtual methods */
-  gboolean          (*src_event)      (GstAggregator    *  aggregate,
+  gboolean          (*src_event)      (GstAggregator    *  aggregator,
                                        GstEvent         *  event);
 
-  gboolean          (*src_query)      (GstAggregator    *  aggregate,
+  gboolean          (*src_query)      (GstAggregator    *  aggregator,
                                        GstQuery         *  query);
 
   gboolean          (*src_activate)   (GstAggregator    *  aggregator,
                                        GstPadMode          mode,
                                        gboolean            active);
 
-  GstFlowReturn     (*aggregate)      (GstAggregator    *  aggregator);
+  GstFlowReturn     (*aggregate)      (GstAggregator    *  aggregator,
+                                       gboolean            timeout);
 
   gboolean          (*stop)           (GstAggregator    *  aggregator);
 
   gboolean          (*start)          (GstAggregator    *  aggregator);
 
+  GstClockTime      (*get_next_time)  (GstAggregator    *  aggregator);
+
   /*< private >*/
-  gpointer          _gst_reserved[GST_PADDING];
+  gpointer          _gst_reserved[GST_PADDING_LARGE];
 };
 
 /*************************
@@ -245,16 +256,25 @@
 void           gst_aggregator_set_src_caps          (GstAggregator                *  agg,
                                                      GstCaps                      *  caps);
 
+void           gst_aggregator_set_latency           (GstAggregator                *  self,
+                                                     GstClockTime                    min_latency,
+                                                     GstClockTime                    max_latency);
+
 GType gst_aggregator_get_type(void);
 
-/* API that should eventually land in GstElement itself*/
-typedef gboolean (*GstAggregatorPadForeachFunc)    (GstAggregator                 *  self,
-                                                    GstPad                        *  pad,
+/* API that should eventually land in GstElement itself (FIXME) */
+typedef gboolean (*GstAggregatorPadForeachFunc)    (GstAggregator                 *  aggregator,
+                                                    GstAggregatorPad              *  aggregator_pad,
                                                     gpointer                         user_data);
+
 gboolean gst_aggregator_iterate_sinkpads           (GstAggregator                 *  self,
                                                     GstAggregatorPadForeachFunc      func,
                                                     gpointer                         user_data);
 
+void     gst_aggregator_get_latency_unlocked       (GstAggregator                 *  self,
+                                                    gboolean                      *  live,
+                                                    GstClockTime                  *  min,
+                                                    GstClockTime                  *  max);
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/basecamerabinsrc/Makefile.in b/gst-libs/gst/basecamerabinsrc/Makefile.in
index 944fde6..5c32e65 100644
--- a/gst-libs/gst/basecamerabinsrc/Makefile.in
+++ b/gst-libs/gst/basecamerabinsrc/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -235,8 +235,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -275,7 +279,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -283,6 +286,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -332,8 +337,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -412,7 +415,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -421,7 +423,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -434,7 +435,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -459,6 +459,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -532,10 +534,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -561,6 +567,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -597,6 +606,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -637,17 +647,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -664,6 +673,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c
index abc3a44..ed3e74c 100644
--- a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c
+++ b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c
@@ -40,7 +40,7 @@
  * During construct_pipeline() vmethod a subclass can add several elements into
  * the bin and expose 3 srcs pads as ghostpads implementing the 3 pad templates.
  *
- * However the subclass is responsable for adding the pad templates for the
+ * However the subclass is responsible for adding the pad templates for the
  * source pads and they must be named "vidsrc", "imgsrc" and "vfsrc". The pad
  * templates should be installed in the subclass' class_init function, like so:
  * |[
@@ -62,7 +62,7 @@
  * ]|
  *
  * It is also possible to add regular pads from the subclass and implement the
- * dataflow methods on these pads. This way all functionality can be implemneted
+ * dataflow methods on these pads. This way all functionality can be implemented
  * directly in the subclass without extra elements.
  *
  * The src will receive the capture mode from #GstCameraBin2 on the
diff --git a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h
index 1b93663..828b700 100644
--- a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h
+++ b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h
@@ -34,6 +34,7 @@
 #include "gstcamerabinpreview.h"
 
 G_BEGIN_DECLS
+
 #define GST_TYPE_BASE_CAMERA_SRC \
   (gst_base_camera_src_get_type())
 #define GST_BASE_CAMERA_SRC(obj) \
@@ -140,4 +141,6 @@
 void gst_base_camera_src_post_preview (GstBaseCameraSrc *self, GstSample * sample);
 // XXX add methods to get/set img capture and vid capture caps..
 
+G_END_DECLS
+
 #endif /* __GST_BASE_CAMERA_SRC_H__ */
diff --git a/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c b/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c
index 06af5b2..cfdc074 100644
--- a/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c
+++ b/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c
@@ -231,14 +231,9 @@
 {
   g_return_if_fail (preview != NULL);
 
-  if (preview->processing_lock.p) {
-    g_mutex_clear (&preview->processing_lock);
-    preview->processing_lock.p = NULL;
-  }
-  if (preview->processing_cond.p) {
-    g_cond_clear (&preview->processing_cond);
-    preview->processing_cond.p = NULL;
-  }
+  g_mutex_clear (&preview->processing_lock);
+  g_cond_clear (&preview->processing_cond);
+
   if (preview->pipeline) {
     gst_element_set_state (preview->pipeline, GST_STATE_NULL);
     gst_object_unref (preview->pipeline);
diff --git a/gst-libs/gst/codecparsers/Makefile.in b/gst-libs/gst/codecparsers/Makefile.in
index b2d206a..738a4f8 100644
--- a/gst-libs/gst/codecparsers/Makefile.in
+++ b/gst-libs/gst/codecparsers/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -263,8 +263,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -303,7 +307,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -311,6 +314,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -360,8 +365,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -440,7 +443,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -449,7 +451,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -462,7 +463,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -487,6 +487,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -560,10 +562,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -589,6 +595,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -625,6 +634,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -665,17 +675,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -692,6 +701,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/codecparsers/dboolhuff.c b/gst-libs/gst/codecparsers/dboolhuff.c
index 0007d7a..692d78b 100644
--- a/gst-libs/gst/codecparsers/dboolhuff.c
+++ b/gst-libs/gst/codecparsers/dboolhuff.c
@@ -11,65 +11,63 @@
 
 #include "dboolhuff.h"
 
-int vp8dx_start_decode(BOOL_DECODER *br,
-                       const unsigned char *source,
-                       unsigned int source_sz,
-                       vp8_decrypt_cb *decrypt_cb,
-                       void *decrypt_state)
+int
+vp8dx_start_decode (BOOL_DECODER * br,
+    const unsigned char *source,
+    unsigned int source_sz, vp8_decrypt_cb * decrypt_cb, void *decrypt_state)
 {
-    br->user_buffer_end = source+source_sz;
-    br->user_buffer     = source;
-    br->value    = 0;
-    br->count    = -8;
-    br->range    = 255;
-    br->decrypt_cb = decrypt_cb;
-    br->decrypt_state = decrypt_state;
+  br->user_buffer_end = source + source_sz;
+  br->user_buffer = source;
+  br->value = 0;
+  br->count = -8;
+  br->range = 255;
+  br->decrypt_cb = decrypt_cb;
+  br->decrypt_state = decrypt_state;
 
-    if (source_sz && !source)
-        return 1;
+  if (source_sz && !source)
+    return 1;
 
-    /* Populate the buffer */
-    vp8dx_bool_decoder_fill(br);
+  /* Populate the buffer */
+  vp8dx_bool_decoder_fill (br);
 
-    return 0;
+  return 0;
 }
 
-void vp8dx_bool_decoder_fill(BOOL_DECODER *br)
+void
+vp8dx_bool_decoder_fill (BOOL_DECODER * br)
 {
-    const unsigned char *bufptr = br->user_buffer;
-    VP8_BD_VALUE value = br->value;
-    int count = br->count;
-    int shift = VP8_BD_VALUE_SIZE - 8 - (count + 8);
-    size_t bytes_left = br->user_buffer_end - bufptr;
-    size_t bits_left = bytes_left * CHAR_BIT;
-    int x = (int)(shift + CHAR_BIT - bits_left);
-    int loop_end = 0;
-    unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1];
+  const unsigned char *bufptr = br->user_buffer;
+  VP8_BD_VALUE value = br->value;
+  int count = br->count;
+  int shift = VP8_BD_VALUE_SIZE - 8 - (count + 8);
+  size_t bytes_left = br->user_buffer_end - bufptr;
+  size_t bits_left = bytes_left * CHAR_BIT;
+  int x = (int) (shift + CHAR_BIT - bits_left);
+  int loop_end = 0;
+  unsigned char decrypted[sizeof (VP8_BD_VALUE) + 1];
 
-    if (br->decrypt_cb) {
-        size_t n = bytes_left > sizeof(decrypted) ? sizeof(decrypted) : bytes_left;
-        br->decrypt_cb(br->decrypt_state, bufptr, decrypted, (int)n);
-        bufptr = decrypted;
+  if (br->decrypt_cb) {
+    size_t n =
+        bytes_left > sizeof (decrypted) ? sizeof (decrypted) : bytes_left;
+    br->decrypt_cb (br->decrypt_state, bufptr, decrypted, (int) n);
+    bufptr = decrypted;
+  }
+
+  if (x >= 0) {
+    count += VP8_LOTS_OF_BITS;
+    loop_end = x;
+  }
+
+  if (x < 0 || bits_left) {
+    while (shift >= loop_end) {
+      count += CHAR_BIT;
+      value |= (VP8_BD_VALUE) * bufptr << shift;
+      ++bufptr;
+      ++br->user_buffer;
+      shift -= CHAR_BIT;
     }
+  }
 
-    if(x >= 0)
-    {
-        count += VP8_LOTS_OF_BITS;
-        loop_end = x;
-    }
-
-    if (x < 0 || bits_left)
-    {
-        while(shift >= loop_end)
-        {
-            count += CHAR_BIT;
-            value |= (VP8_BD_VALUE)*bufptr << shift;
-            ++bufptr;
-            ++br->user_buffer;
-            shift -= CHAR_BIT;
-        }
-    }
-
-    br->value = value;
-    br->count = count;
+  br->value = value;
+  br->count = count;
 }
diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
index a396554..2648194 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.c
+++ b/gst-libs/gst/codecparsers/gsth264parser.c
@@ -151,7 +151,7 @@
 } PAR;
 
 /* Table E-1 - Meaning of sample aspect ratio indicator (1..16) */
-static PAR aspect_ratios[17] = {
+static const PAR aspect_ratios[17] = {
   {0, 0},
   {1, 1},
   {12, 11},
@@ -204,6 +204,8 @@
 gst_h264_parse_nalu_header (GstH264NalUnit * nalu)
 {
   guint8 *data = nalu->data + nalu->offset;
+  guint8 svc_extension_flag;
+  GstBitReader br;
 
   if (nalu->size < 1)
     return FALSE;
@@ -211,6 +213,42 @@
   nalu->type = (data[0] & 0x1f);
   nalu->ref_idc = (data[0] & 0x60) >> 5;
   nalu->idr_pic_flag = (nalu->type == 5 ? 1 : 0);
+  nalu->header_bytes = 1;
+
+  nalu->extension_type = GST_H264_NAL_EXTENSION_NONE;
+
+  switch (nalu->type) {
+    case GST_H264_NAL_PREFIX_UNIT:
+    case GST_H264_NAL_SLICE_EXT:
+      if (nalu->size < 4)
+        return FALSE;
+      gst_bit_reader_init (&br, nalu->data + nalu->offset + nalu->header_bytes,
+          nalu->size - nalu->header_bytes);
+
+      svc_extension_flag = gst_bit_reader_get_bits_uint8_unchecked (&br, 1);
+      if (svc_extension_flag) { /* SVC */
+
+        nalu->extension_type = GST_H264_NAL_EXTENSION_SVC;
+
+      } else {                  /* MVC */
+        GstH264NalUnitExtensionMVC *const mvc = &nalu->extension.mvc;
+
+        nalu->extension_type = GST_H264_NAL_EXTENSION_MVC;
+        mvc->non_idr_flag = gst_bit_reader_get_bits_uint8_unchecked (&br, 1);
+        mvc->priority_id = gst_bit_reader_get_bits_uint8_unchecked (&br, 6);
+        mvc->view_id = gst_bit_reader_get_bits_uint16_unchecked (&br, 10);
+        mvc->temporal_id = gst_bit_reader_get_bits_uint8_unchecked (&br, 3);
+        mvc->anchor_pic_flag = gst_bit_reader_get_bits_uint8_unchecked (&br, 1);
+        mvc->inter_view_flag = gst_bit_reader_get_bits_uint8_unchecked (&br, 1);
+
+        /* Update IdrPicFlag (H.7.4.1.1) */
+        nalu->idr_pic_flag = !mvc->non_idr_flag;
+      }
+      nalu->header_bytes += 3;
+      break;
+    default:
+      break;
+  }
 
   GST_DEBUG ("Nal type %u, ref_idc %u", nalu->type, nalu->ref_idc);
   return TRUE;
@@ -242,6 +280,114 @@
   return TRUE;
 }
 
+/* Copy MVC-specific data for subset SPS header */
+static gboolean
+gst_h264_sps_mvc_copy (GstH264SPS * dst_sps, const GstH264SPS * src_sps)
+{
+  GstH264SPSExtMVC *const dst_mvc = &dst_sps->extension.mvc;
+  const GstH264SPSExtMVC *const src_mvc = &src_sps->extension.mvc;
+  guint i, j, k;
+
+  g_assert (dst_sps->extension_type == GST_H264_NAL_EXTENSION_MVC);
+
+  dst_mvc->num_views_minus1 = src_mvc->num_views_minus1;
+  dst_mvc->view = g_new0 (GstH264SPSExtMVCView, dst_mvc->num_views_minus1 + 1);
+  if (!dst_mvc->view)
+    return FALSE;
+
+  dst_mvc->view[0].view_id = src_mvc->view[0].view_id;
+
+  for (i = 1; i <= dst_mvc->num_views_minus1; i++) {
+    GstH264SPSExtMVCView *const dst_view = &dst_mvc->view[i];
+    const GstH264SPSExtMVCView *const src_view = &src_mvc->view[i];
+
+    dst_view->view_id = src_view->view_id;
+
+    dst_view->num_anchor_refs_l0 = src_view->num_anchor_refs_l0;
+    for (j = 0; j < dst_view->num_anchor_refs_l0; j++)
+      dst_view->anchor_ref_l0[j] = src_view->anchor_ref_l0[j];
+
+    dst_view->num_anchor_refs_l1 = src_view->num_anchor_refs_l1;
+    for (j = 0; j < dst_view->num_anchor_refs_l1; j++)
+      dst_view->anchor_ref_l1[j] = src_view->anchor_ref_l1[j];
+
+    dst_view->num_non_anchor_refs_l0 = src_view->num_non_anchor_refs_l0;
+    for (j = 0; j < dst_view->num_non_anchor_refs_l0; j++)
+      dst_view->non_anchor_ref_l0[j] = src_view->non_anchor_ref_l0[j];
+
+    dst_view->num_non_anchor_refs_l1 = src_view->num_non_anchor_refs_l1;
+    for (j = 0; j < dst_view->num_non_anchor_refs_l1; j++)
+      dst_view->non_anchor_ref_l1[j] = src_view->non_anchor_ref_l1[j];
+  }
+
+  dst_mvc->num_level_values_signalled_minus1 =
+      src_mvc->num_level_values_signalled_minus1;
+  dst_mvc->level_value = g_new0 (GstH264SPSExtMVCLevelValue,
+      dst_mvc->num_level_values_signalled_minus1 + 1);
+  if (!dst_mvc->level_value)
+    return FALSE;
+
+  for (i = 0; i <= dst_mvc->num_level_values_signalled_minus1; i++) {
+    GstH264SPSExtMVCLevelValue *const dst_value = &dst_mvc->level_value[i];
+    const GstH264SPSExtMVCLevelValue *const src_value =
+        &src_mvc->level_value[i];
+
+    dst_value->level_idc = src_value->level_idc;
+
+    dst_value->num_applicable_ops_minus1 = src_value->num_applicable_ops_minus1;
+    dst_value->applicable_op = g_new0 (GstH264SPSExtMVCLevelValueOp,
+        dst_value->num_applicable_ops_minus1 + 1);
+    if (!dst_value->applicable_op)
+      return FALSE;
+
+    for (j = 0; j <= dst_value->num_applicable_ops_minus1; j++) {
+      GstH264SPSExtMVCLevelValueOp *const dst_op = &dst_value->applicable_op[j];
+      const GstH264SPSExtMVCLevelValueOp *const src_op =
+          &src_value->applicable_op[j];
+
+      dst_op->temporal_id = src_op->temporal_id;
+      dst_op->num_target_views_minus1 = src_op->num_target_views_minus1;
+      dst_op->target_view_id =
+          g_new (guint16, dst_op->num_target_views_minus1 + 1);
+      if (!dst_op->target_view_id)
+        return FALSE;
+
+      for (k = 0; k <= dst_op->num_target_views_minus1; k++)
+        dst_op->target_view_id[k] = src_op->target_view_id[k];
+      dst_op->num_views_minus1 = src_op->num_views_minus1;
+    }
+  }
+  return TRUE;
+}
+
+/*
+ * gst_h264_sps_copy:
+ * @dst_sps: The destination #GstH264SPS to copy into
+ * @src_sps: The source #GstH264SPS to copy from
+ *
+ * Copies @src_sps into @dst_sps.
+ *
+ * Returns: %TRUE if everything went fine, %FALSE otherwise
+ */
+static gboolean
+gst_h264_sps_copy (GstH264SPS * dst_sps, const GstH264SPS * src_sps)
+{
+  g_return_val_if_fail (dst_sps != NULL, FALSE);
+  g_return_val_if_fail (src_sps != NULL, FALSE);
+
+  gst_h264_sps_clear (dst_sps);
+
+  *dst_sps = *src_sps;
+
+  switch (dst_sps->extension_type) {
+    case GST_H264_NAL_EXTENSION_MVC:
+      if (!gst_h264_sps_mvc_copy (dst_sps, src_sps))
+        return FALSE;
+      break;
+  }
+  return TRUE;
+}
+
 /****** Parsing functions *****/
 
 static gboolean
@@ -251,7 +397,7 @@
 
   GST_DEBUG ("parsing \"HRD Parameters\"");
 
-  READ_UE_ALLOWED (nr, hrd->cpb_cnt_minus1, 0, 31);
+  READ_UE_MAX (nr, hrd->cpb_cnt_minus1, 31);
   READ_UINT8 (nr, hrd->bit_rate_scale, 4);
   READ_UINT8 (nr, hrd->cpb_size_scale, 4);
 
@@ -327,8 +473,8 @@
 
   READ_UINT8 (nr, vui->chroma_loc_info_present_flag, 1);
   if (vui->chroma_loc_info_present_flag) {
-    READ_UE_ALLOWED (nr, vui->chroma_sample_loc_type_top_field, 0, 5);
-    READ_UE_ALLOWED (nr, vui->chroma_sample_loc_type_bottom_field, 0, 5);
+    READ_UE_MAX (nr, vui->chroma_sample_loc_type_top_field, 5);
+    READ_UE_MAX (nr, vui->chroma_sample_loc_type_bottom_field, 5);
   }
 
   READ_UINT8 (nr, vui->timing_info_present_flag, 1);
@@ -367,9 +513,9 @@
   if (vui->bitstream_restriction_flag) {
     READ_UINT8 (nr, vui->motion_vectors_over_pic_boundaries_flag, 1);
     READ_UE (nr, vui->max_bytes_per_pic_denom);
-    READ_UE_ALLOWED (nr, vui->max_bits_per_mb_denom, 0, 16);
-    READ_UE_ALLOWED (nr, vui->log2_max_mv_length_horizontal, 0, 16);
-    READ_UE_ALLOWED (nr, vui->log2_max_mv_length_vertical, 0, 16);
+    READ_UE_MAX (nr, vui->max_bits_per_mb_denom, 16);
+    READ_UE_MAX (nr, vui->log2_max_mv_length_horizontal, 16);
+    READ_UE_MAX (nr, vui->log2_max_mv_length_vertical, 16);
     READ_UE (nr, vui->num_reorder_frames);
     READ_UE (nr, vui->max_dec_frame_buffering);
   }
@@ -497,19 +643,22 @@
 
 static gboolean
 slice_parse_ref_pic_list_modification_1 (GstH264SliceHdr * slice,
-    NalReader * nr, guint list)
+    NalReader * nr, guint list, gboolean is_mvc)
 {
   GstH264RefPicListModification *entries;
   guint8 *ref_pic_list_modification_flag, *n_ref_pic_list_modification;
   guint32 modification_of_pic_nums_idc;
+  gsize max_entries;
   guint i = 0;
 
   if (list == 0) {
     entries = slice->ref_pic_list_modification_l0;
+    max_entries = G_N_ELEMENTS (slice->ref_pic_list_modification_l0);
     ref_pic_list_modification_flag = &slice->ref_pic_list_modification_flag_l0;
     n_ref_pic_list_modification = &slice->n_ref_pic_list_modification_l0;
   } else {
     entries = slice->ref_pic_list_modification_l1;
+    max_entries = G_N_ELEMENTS (slice->ref_pic_list_modification_l1);
     ref_pic_list_modification_flag = &slice->ref_pic_list_modification_flag_l1;
     n_ref_pic_list_modification = &slice->n_ref_pic_list_modification_l1;
   }
@@ -518,16 +667,21 @@
   if (*ref_pic_list_modification_flag) {
     while (1) {
       READ_UE (nr, modification_of_pic_nums_idc);
-      if (modification_of_pic_nums_idc == 3)
-        break;
       if (modification_of_pic_nums_idc == 0 ||
           modification_of_pic_nums_idc == 1) {
-        READ_UE_ALLOWED (nr, entries[i].value.abs_diff_pic_num_minus1, 0,
+        READ_UE_MAX (nr, entries[i].value.abs_diff_pic_num_minus1,
             slice->max_pic_num - 1);
       } else if (modification_of_pic_nums_idc == 2) {
         READ_UE (nr, entries[i].value.long_term_pic_num);
+      } else if (is_mvc && (modification_of_pic_nums_idc == 4 ||
+              modification_of_pic_nums_idc == 5)) {
+        READ_UE (nr, entries[i].value.abs_diff_view_idx_minus1);
       }
       entries[i++].modification_of_pic_nums_idc = modification_of_pic_nums_idc;
+      if (modification_of_pic_nums_idc == 3)
+        break;
+      if (i >= max_entries)
+        goto error;
     }
   }
   *n_ref_pic_list_modification = i;
@@ -540,15 +694,16 @@
 }
 
 static gboolean
-slice_parse_ref_pic_list_modification (GstH264SliceHdr * slice, NalReader * nr)
+slice_parse_ref_pic_list_modification (GstH264SliceHdr * slice, NalReader * nr,
+    gboolean is_mvc)
 {
   if (!GST_H264_IS_I_SLICE (slice) && !GST_H264_IS_SI_SLICE (slice)) {
-    if (!slice_parse_ref_pic_list_modification_1 (slice, nr, 0))
+    if (!slice_parse_ref_pic_list_modification_1 (slice, nr, 0, is_mvc))
       return FALSE;
   }
 
   if (GST_H264_IS_B_SLICE (slice)) {
-    if (!slice_parse_ref_pic_list_modification_1 (slice, nr, 1))
+    if (!slice_parse_ref_pic_list_modification_1 (slice, nr, 1, is_mvc))
       return FALSE;
   }
   return TRUE;
@@ -620,7 +775,7 @@
 
   p = &slice->pred_weight_table;
 
-  READ_UE_ALLOWED (nr, p->luma_log2_weight_denom, 0, 7);
+  READ_UE_MAX (nr, p->luma_log2_weight_denom, 7);
   /* set default values */
   default_luma_weight = 1 << p->luma_log2_weight_denom;
   for (i = 0; i < G_N_ELEMENTS (p->luma_weight_l0); i++)
@@ -633,7 +788,7 @@
   }
 
   if (chroma_array_type != 0) {
-    READ_UE_ALLOWED (nr, p->chroma_log2_weight_denom, 0, 7);
+    READ_UE_MAX (nr, p->chroma_log2_weight_denom, 7);
     /* set default values */
     default_chroma_weight = 1 << p->chroma_log2_weight_denom;
     for (i = 0; i < G_N_ELEMENTS (p->chroma_weight_l0); i++) {
@@ -712,7 +867,7 @@
 
   GST_DEBUG ("parsing \"Buffering period\"");
 
-  READ_UE_ALLOWED (nr, sps_id, 0, GST_H264_MAX_SPS_COUNT - 1);
+  READ_UE_MAX (nr, sps_id, GST_H264_MAX_SPS_COUNT - 1);
   sps = gst_h264_parser_get_sps (nalparser, sps_id);
   if (!sps) {
     GST_WARNING ("couldn't find associated sequence parameter set with id: %d",
@@ -731,9 +886,9 @@
 
       for (sched_sel_idx = 0; sched_sel_idx <= hrd->cpb_cnt_minus1;
           sched_sel_idx++) {
-        READ_UINT8 (nr, per->nal_initial_cpb_removal_delay[sched_sel_idx],
+        READ_UINT32 (nr, per->nal_initial_cpb_removal_delay[sched_sel_idx],
             nbits);
-        READ_UINT8 (nr,
+        READ_UINT32 (nr,
             per->nal_initial_cpb_removal_delay_offset[sched_sel_idx], nbits);
       }
     }
@@ -745,9 +900,9 @@
 
       for (sched_sel_idx = 0; sched_sel_idx <= hrd->cpb_cnt_minus1;
           sched_sel_idx++) {
-        READ_UINT8 (nr, per->vcl_initial_cpb_removal_delay[sched_sel_idx],
+        READ_UINT32 (nr, per->vcl_initial_cpb_removal_delay[sched_sel_idx],
             nbits);
-        READ_UINT8 (nr,
+        READ_UINT32 (nr,
             per->vcl_initial_cpb_removal_delay_offset[sched_sel_idx], nbits);
       }
     }
@@ -894,7 +1049,7 @@
     goto error;
   }
 
-  READ_UE_ALLOWED (nr, rp->recovery_frame_cnt, 0, sps->max_frame_num - 1);
+  READ_UE_MAX (nr, rp->recovery_frame_cnt, sps->max_frame_num - 1);
   READ_UINT8 (nr, rp->exact_match_flag, 1);
   READ_UINT8 (nr, rp->broken_link_flag, 1);
   READ_UINT8 (nr, rp->changing_slice_group_idc, 2);
@@ -906,6 +1061,88 @@
   return GST_H264_PARSER_ERROR;
 }
 
+/* Parse SEI stereo_video_info() message */
+static GstH264ParserResult
+gst_h264_parser_parse_stereo_video_info (GstH264NalParser * nalparser,
+    GstH264StereoVideoInfo * info, NalReader * nr)
+{
+  GST_DEBUG ("parsing \"Stereo Video info\"");
+
+  READ_UINT8 (nr, info->field_views_flag, 1);
+  if (info->field_views_flag) {
+    READ_UINT8 (nr, info->top_field_is_left_view_flag, 1);
+  } else {
+    READ_UINT8 (nr, info->current_frame_is_left_view_flag, 1);
+    READ_UINT8 (nr, info->next_frame_is_second_view_flag, 1);
+  }
+  READ_UINT8 (nr, info->left_view_self_contained_flag, 1);
+  READ_UINT8 (nr, info->right_view_self_contained_flag, 1);
+
+  return GST_H264_PARSER_OK;
+
+error:
+  GST_WARNING ("error parsing \"Stereo Video info\"");
+  return GST_H264_PARSER_ERROR;
+}
+
+/* Parse SEI frame_packing_arrangement() message */
+static GstH264ParserResult
+gst_h264_parser_parse_frame_packing (GstH264NalParser * nalparser,
+    GstH264FramePacking * frame_packing, NalReader * nr, guint payload_size)
+{
+  guint8 frame_packing_extension_flag;
+  guint start_pos;
+
+  GST_DEBUG ("parsing \"Frame Packing Arrangement\"");
+
+  start_pos = nal_reader_get_pos (nr);
+  READ_UE (nr, frame_packing->frame_packing_id);
+  READ_UINT8 (nr, frame_packing->frame_packing_cancel_flag, 1);
+
+  if (!frame_packing->frame_packing_cancel_flag) {
+    READ_UINT8 (nr, frame_packing->frame_packing_type, 7);
+    READ_UINT8 (nr, frame_packing->quincunx_sampling_flag, 1);
+    READ_UINT8 (nr, frame_packing->content_interpretation_type, 6);
+    READ_UINT8 (nr, frame_packing->spatial_flipping_flag, 1);
+    READ_UINT8 (nr, frame_packing->frame0_flipped_flag, 1);
+    READ_UINT8 (nr, frame_packing->field_views_flag, 1);
+    READ_UINT8 (nr, frame_packing->current_frame_is_frame0_flag, 1);
+    READ_UINT8 (nr, frame_packing->frame0_self_contained_flag, 1);
+    READ_UINT8 (nr, frame_packing->frame1_self_contained_flag, 1);
+
+    if (!frame_packing->quincunx_sampling_flag &&
+        frame_packing->frame_packing_type !=
+        GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING) {
+      READ_UINT8 (nr, frame_packing->frame0_grid_position_x, 4);
+      READ_UINT8 (nr, frame_packing->frame0_grid_position_y, 4);
+      READ_UINT8 (nr, frame_packing->frame1_grid_position_x, 4);
+      READ_UINT8 (nr, frame_packing->frame1_grid_position_y, 4);
+    }
+
+    /* Skip frame_packing_arrangement_reserved_byte */
+    if (!nal_reader_skip (nr, 8))
+      goto error;
+
+    READ_UE_MAX (nr, frame_packing->frame_packing_repetition_period, 16384);
+  }
+
+  READ_UINT8 (nr, frame_packing_extension_flag, 1);
+
+  /* All data that follows within a frame packing arrangement SEI message
+     after the value 1 for frame_packing_arrangement_extension_flag shall
+     be ignored (D.2.25) */
+  if (frame_packing_extension_flag) {
+    nal_reader_skip_long (nr,
+        payload_size - (nal_reader_get_pos (nr) - start_pos));
+  }
+
+  return GST_H264_PARSER_OK;
+
+error:
+  GST_WARNING ("error parsing \"Frame Packing Arrangement\"");
+  return GST_H264_PARSER_ERROR;
+}
+
 static GstH264ParserResult
 gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
     NalReader * nr, GstH264SEIMessage * sei)
@@ -951,6 +1188,14 @@
       res = gst_h264_parser_parse_recovery_point (nalparser,
           &sei->payload.recovery_point, nr);
       break;
+    case GST_H264_SEI_STEREO_VIDEO_INFO:
+      res = gst_h264_parser_parse_stereo_video_info (nalparser,
+          &sei->payload.stereo_video_info, nr);
+      break;
+    case GST_H264_SEI_FRAME_PACKING:
+      res = gst_h264_parser_parse_frame_packing (nalparser,
+          &sei->payload.frame_packing, nr, payload_size);
+      break;
     default:
       /* Just consume payloadSize bytes, which does not account for
          emulation prevention bytes */
@@ -1016,6 +1261,8 @@
 {
   guint i;
 
+  for (i = 0; i < GST_H264_MAX_SPS_COUNT; i++)
+    gst_h264_sps_clear (&nalparser->sps[i]);
   for (i = 0; i < GST_H264_MAX_PPS_COUNT; i++)
     gst_h264_pps_clear (&nalparser->pps[i]);
   g_slice_free (GstH264NalParser, nalparser);
@@ -1248,12 +1495,10 @@
   if (res == GST_H264_PARSER_OK) {
     GST_DEBUG ("adding sequence parameter set with id: %d to array", sps->id);
 
-    nalparser->sps[sps->id] = *sps;
+    if (!gst_h264_sps_copy (&nalparser->sps[sps->id], sps))
+      return GST_H264_PARSER_ERROR;
     nalparser->last_sps = &nalparser->sps[sps->id];
   }
-
-
-
   return res;
 }
 
@@ -1269,6 +1514,7 @@
 
   /* set default values for fields that might not be present in the bitstream
      and have valid defaults */
+  sps->extension_type = GST_H264_NAL_EXTENSION_NONE;
   sps->chroma_format_idc = 1;
   sps->separate_colour_plane_flag = 0;
   sps->bit_depth_luma_minus8 = 0;
@@ -1288,25 +1534,28 @@
   READ_UINT8 (nr, sps->constraint_set1_flag, 1);
   READ_UINT8 (nr, sps->constraint_set2_flag, 1);
   READ_UINT8 (nr, sps->constraint_set3_flag, 1);
+  READ_UINT8 (nr, sps->constraint_set4_flag, 1);
+  READ_UINT8 (nr, sps->constraint_set5_flag, 1);
 
-  /* skip reserved_zero_4bits */
-  if (!nal_reader_skip (nr, 4))
+  /* skip reserved_zero_2bits */
+  if (!nal_reader_skip (nr, 2))
     goto error;
 
   READ_UINT8 (nr, sps->level_idc, 8);
 
-  READ_UE_ALLOWED (nr, sps->id, 0, GST_H264_MAX_SPS_COUNT - 1);
+  READ_UE_MAX (nr, sps->id, GST_H264_MAX_SPS_COUNT - 1);
 
   if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
       sps->profile_idc == 122 || sps->profile_idc == 244 ||
       sps->profile_idc == 44 || sps->profile_idc == 83 ||
-      sps->profile_idc == 86) {
-    READ_UE_ALLOWED (nr, sps->chroma_format_idc, 0, 3);
+      sps->profile_idc == 86 || sps->profile_idc == 118 ||
+      sps->profile_idc == 128) {
+    READ_UE_MAX (nr, sps->chroma_format_idc, 3);
     if (sps->chroma_format_idc == 3)
       READ_UINT8 (nr, sps->separate_colour_plane_flag, 1);
 
-    READ_UE_ALLOWED (nr, sps->bit_depth_luma_minus8, 0, 6);
-    READ_UE_ALLOWED (nr, sps->bit_depth_chroma_minus8, 0, 6);
+    READ_UE_MAX (nr, sps->bit_depth_luma_minus8, 6);
+    READ_UE_MAX (nr, sps->bit_depth_chroma_minus8, 6);
     READ_UINT8 (nr, sps->qpprime_y_zero_transform_bypass_flag, 1);
 
     READ_UINT8 (nr, sps->scaling_matrix_present_flag, 1);
@@ -1322,20 +1571,20 @@
     }
   }
 
-  READ_UE_ALLOWED (nr, sps->log2_max_frame_num_minus4, 0, 12);
+  READ_UE_MAX (nr, sps->log2_max_frame_num_minus4, 12);
 
   sps->max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4);
 
-  READ_UE_ALLOWED (nr, sps->pic_order_cnt_type, 0, 2);
+  READ_UE_MAX (nr, sps->pic_order_cnt_type, 2);
   if (sps->pic_order_cnt_type == 0) {
-    READ_UE_ALLOWED (nr, sps->log2_max_pic_order_cnt_lsb_minus4, 0, 12);
+    READ_UE_MAX (nr, sps->log2_max_pic_order_cnt_lsb_minus4, 12);
   } else if (sps->pic_order_cnt_type == 1) {
     guint i;
 
     READ_UINT8 (nr, sps->delta_pic_order_always_zero_flag, 1);
     READ_SE (nr, sps->offset_for_non_ref_pic);
     READ_SE (nr, sps->offset_for_top_to_bottom_field);
-    READ_UE_ALLOWED (nr, sps->num_ref_frames_in_pic_order_cnt_cycle, 0, 255);
+    READ_UE_MAX (nr, sps->num_ref_frames_in_pic_order_cnt_cycle, 255);
 
     for (i = 0; i < sps->num_ref_frames_in_pic_order_cnt_cycle; i++)
       READ_SE (nr, sps->offset_for_ref_frame[i]);
@@ -1430,6 +1679,105 @@
   return FALSE;
 }
 
+/* Parse subset_seq_parameter_set() data for MVC */
+static gboolean
+gst_h264_parse_sps_mvc_data (NalReader * nr, GstH264SPS * sps,
+    gboolean parse_vui_params)
+{
+  GstH264SPSExtMVC *const mvc = &sps->extension.mvc;
+  guint8 bit_equal_to_one;
+  guint i, j, k;
+
+  READ_UINT8 (nr, bit_equal_to_one, 1);
+  if (!bit_equal_to_one)
+    return FALSE;
+
+  sps->extension_type = GST_H264_NAL_EXTENSION_MVC;
+
+  READ_UE_MAX (nr, mvc->num_views_minus1, GST_H264_MAX_VIEW_COUNT - 1);
+
+  mvc->view = g_new0 (GstH264SPSExtMVCView, mvc->num_views_minus1 + 1);
+  if (!mvc->view)
+    goto error_allocation_failed;
+
+  for (i = 0; i <= mvc->num_views_minus1; i++)
+    READ_UE_MAX (nr, mvc->view[i].view_id, GST_H264_MAX_VIEW_ID);
+
+  for (i = 1; i <= mvc->num_views_minus1; i++) {
+    /* for RefPicList0 */
+    READ_UE_MAX (nr, mvc->view[i].num_anchor_refs_l0, 15);
+    for (j = 0; j < mvc->view[i].num_anchor_refs_l0; j++) {
+      READ_UE_MAX (nr, mvc->view[i].anchor_ref_l0[j], GST_H264_MAX_VIEW_ID);
+    }
+
+    /* for RefPicList1 */
+    READ_UE_MAX (nr, mvc->view[i].num_anchor_refs_l1, 15);
+    for (j = 0; j < mvc->view[i].num_anchor_refs_l1; j++) {
+      READ_UE_MAX (nr, mvc->view[i].anchor_ref_l1[j], GST_H264_MAX_VIEW_ID);
+    }
+  }
+
+  for (i = 1; i <= mvc->num_views_minus1; i++) {
+    /* for RefPicList0 */
+    READ_UE_MAX (nr, mvc->view[i].num_non_anchor_refs_l0, 15);
+    for (j = 0; j < mvc->view[i].num_non_anchor_refs_l0; j++) {
+      READ_UE_MAX (nr, mvc->view[i].non_anchor_ref_l0[j], GST_H264_MAX_VIEW_ID);
+    }
+
+    /* for RefPicList1 */
+    READ_UE_MAX (nr, mvc->view[i].num_non_anchor_refs_l1, 15);
+    for (j = 0; j < mvc->view[i].num_non_anchor_refs_l1; j++) {
+      READ_UE_MAX (nr, mvc->view[i].non_anchor_ref_l1[j], GST_H264_MAX_VIEW_ID);
+    }
+  }
+
+  READ_UE_MAX (nr, mvc->num_level_values_signalled_minus1, 63);
+
+  mvc->level_value =
+      g_new0 (GstH264SPSExtMVCLevelValue,
+      mvc->num_level_values_signalled_minus1 + 1);
+  if (!mvc->level_value)
+    goto error_allocation_failed;
+
+  for (i = 0; i <= mvc->num_level_values_signalled_minus1; i++) {
+    GstH264SPSExtMVCLevelValue *const level_value = &mvc->level_value[i];
+
+    READ_UINT8 (nr, level_value->level_idc, 8);
+
+    READ_UE_MAX (nr, level_value->num_applicable_ops_minus1, 1023);
+    level_value->applicable_op =
+        g_new0 (GstH264SPSExtMVCLevelValueOp,
+        level_value->num_applicable_ops_minus1 + 1);
+    if (!level_value->applicable_op)
+      goto error_allocation_failed;
+
+    for (j = 0; j <= level_value->num_applicable_ops_minus1; j++) {
+      GstH264SPSExtMVCLevelValueOp *const op = &level_value->applicable_op[j];
+
+      READ_UINT8 (nr, op->temporal_id, 3);
+
+      READ_UE_MAX (nr, op->num_target_views_minus1, 1023);
+      op->target_view_id = g_new (guint16, op->num_target_views_minus1 + 1);
+      if (!op->target_view_id)
+        goto error_allocation_failed;
+
+      for (k = 0; k <= op->num_target_views_minus1; k++)
+        READ_UE_MAX (nr, op->target_view_id[k], GST_H264_MAX_VIEW_ID);
+      READ_UE_MAX (nr, op->num_views_minus1, 1023);
+    }
+  }
+  return TRUE;
+
+error_allocation_failed:
+  GST_WARNING ("failed to allocate memory");
+  gst_h264_sps_clear (sps);
+  return FALSE;
+
+error:
+  gst_h264_sps_clear (sps);
+  return FALSE;
+}
+
 /**
  * gst_h264_parse_sps:
  * @nalu: The #GST_H264_NAL_SPS #GstH264NalUnit to parse
@@ -1449,7 +1797,8 @@
   INITIALIZE_DEBUG_CATEGORY;
   GST_DEBUG ("parsing SPS");
 
-  nal_reader_init (&nr, nalu->data + nalu->offset + 1, nalu->size - 1);
+  nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
+      nalu->size - nalu->header_bytes);
 
   if (!gst_h264_parse_sps_data (&nr, sps, parse_vui_params))
     goto error;
@@ -1465,6 +1814,96 @@
 }
 
 /**
+ * gst_h264_parser_parse_subset_sps:
+ * @nalparser: a #GstH264NalParser
+ * @nalu: The #GST_H264_NAL_SUBSET_SPS #GstH264NalUnit to parse
+ * @sps: The #GstH264SPS to fill.
+ * @parse_vui_params: Whether to parse the vui_params or not
+ *
+ * Parses @data, and fills in the @sps structure.
+ *
+ * This function fully parses @data and allocates all the necessary
+ * data structures needed for MVC extensions. The resulting @sps
+ * structure shall be deallocated with gst_h264_sps_clear() when it is
+ * no longer needed.
+ *
+ * Note: if the caller doesn't need any of the MVC-specific data, then
+ * gst_h264_parser_parse_sps() is more efficient because those extra
+ * syntax elements are not parsed and no extra memory is allocated.
+ *
+ * Returns: a #GstH264ParserResult
+ *
+ * Since: 1.6
+ */
+GstH264ParserResult
+gst_h264_parser_parse_subset_sps (GstH264NalParser * nalparser,
+    GstH264NalUnit * nalu, GstH264SPS * sps, gboolean parse_vui_params)
+{
+  GstH264ParserResult res;
+
+  res = gst_h264_parse_subset_sps (nalu, sps, parse_vui_params);
+  if (res == GST_H264_PARSER_OK) {
+    GST_DEBUG ("adding sequence parameter set with id: %d to array", sps->id);
+
+    if (!gst_h264_sps_copy (&nalparser->sps[sps->id], sps))
+      return GST_H264_PARSER_ERROR;
+    nalparser->last_sps = &nalparser->sps[sps->id];
+  }
+  return res;
+}
+
+/**
+ * gst_h264_parse_subset_sps:
+ * @nalu: The #GST_H264_NAL_SUBSET_SPS #GstH264NalUnit to parse
+ * @sps: The #GstH264SPS to fill.
+ * @parse_vui_params: Whether to parse the vui_params or not
+ *
+ * Parses @data, and fills in the @sps structure.
+ *
+ * This function fully parses @data and allocates all the necessary
+ * data structures needed for MVC extensions. The resulting @sps
+ * structure shall be deallocated with gst_h264_sps_clear() when it is
+ * no longer needed.
+ *
+ * Note: if the caller doesn't need any of the MVC-specific data, then
+ * gst_h264_parser_parse_sps() is more efficient because those extra
+ * syntax elements are not parsed and no extra memory is allocated.
+ *
+ * Returns: a #GstH264ParserResult
+ *
+ * Since: 1.6
+ */
+GstH264ParserResult
+gst_h264_parse_subset_sps (GstH264NalUnit * nalu, GstH264SPS * sps,
+    gboolean parse_vui_params)
+{
+  NalReader nr;
+
+  INITIALIZE_DEBUG_CATEGORY;
+  GST_DEBUG ("parsing Subset SPS");
+
+  nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
+      nalu->size - nalu->header_bytes);
+
+  if (!gst_h264_parse_sps_data (&nr, sps, TRUE))
+    goto error;
+
+  if (sps->profile_idc == GST_H264_PROFILE_MULTIVIEW_HIGH ||
+      sps->profile_idc == GST_H264_PROFILE_STEREO_HIGH) {
+    if (!gst_h264_parse_sps_mvc_data (&nr, sps, parse_vui_params))
+      goto error;
+  }
+
+  sps->valid = TRUE;
+  return GST_H264_PARSER_OK;
+
+error:
+  GST_WARNING ("error parsing \"Subset sequence parameter set\"");
+  sps->valid = FALSE;
+  return GST_H264_PARSER_ERROR;
+}
+
+/**
  * gst_h264_parse_pps:
  * @nalparser: a #GstH264NalParser
  * @nalu: The #GST_H264_NAL_PPS #GstH264NalUnit to parse
@@ -1491,10 +1930,11 @@
   INITIALIZE_DEBUG_CATEGORY;
   GST_DEBUG ("parsing PPS");
 
-  nal_reader_init (&nr, nalu->data + nalu->offset + 1, nalu->size - 1);
+  nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
+      nalu->size - nalu->header_bytes);
 
-  READ_UE_ALLOWED (&nr, pps->id, 0, GST_H264_MAX_PPS_COUNT - 1);
-  READ_UE_ALLOWED (&nr, sps_id, 0, GST_H264_MAX_SPS_COUNT - 1);
+  READ_UE_MAX (&nr, pps->id, GST_H264_MAX_PPS_COUNT - 1);
+  READ_UE_MAX (&nr, sps_id, GST_H264_MAX_SPS_COUNT - 1);
 
   sps = gst_h264_parser_get_sps (nalparser, sps_id);
   if (!sps) {
@@ -1515,9 +1955,9 @@
 
   READ_UINT8 (&nr, pps->entropy_coding_mode_flag, 1);
   READ_UINT8 (&nr, pps->pic_order_present_flag, 1);
-  READ_UE_ALLOWED (&nr, pps->num_slice_groups_minus1, 0, 7);
+  READ_UE_MAX (&nr, pps->num_slice_groups_minus1, 7);
   if (pps->num_slice_groups_minus1 > 0) {
-    READ_UE_ALLOWED (&nr, pps->slice_group_map_type, 0, 6);
+    READ_UE_MAX (&nr, pps->slice_group_map_type, 6);
 
     if (pps->slice_group_map_type == 0) {
       gint i;
@@ -1548,8 +1988,8 @@
     }
   }
 
-  READ_UE_ALLOWED (&nr, pps->num_ref_idx_l0_active_minus1, 0, 31);
-  READ_UE_ALLOWED (&nr, pps->num_ref_idx_l1_active_minus1, 0, 31);
+  READ_UE_MAX (&nr, pps->num_ref_idx_l0_active_minus1, 31);
+  READ_UE_MAX (&nr, pps->num_ref_idx_l1_active_minus1, 31);
   READ_UINT8 (&nr, pps->weighted_pred_flag, 1);
   READ_UINT8 (&nr, pps->weighted_bipred_idc, 2);
   READ_SE_ALLOWED (&nr, pps->pic_init_qp_minus26, -(26 + qp_bd_offset), 25);
@@ -1676,14 +2116,15 @@
   }
 
 
-  nal_reader_init (&nr, nalu->data + nalu->offset + 1, nalu->size - 1);
+  nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
+      nalu->size - nalu->header_bytes);
 
   READ_UE (&nr, slice->first_mb_in_slice);
   READ_UE (&nr, slice->type);
 
   GST_DEBUG ("parsing \"Slice header\", slice type %u", slice->type);
 
-  READ_UE_ALLOWED (&nr, pps_id, 0, GST_H264_MAX_PPS_COUNT - 1);
+  READ_UE_MAX (&nr, pps_id, GST_H264_MAX_PPS_COUNT - 1);
   pps = gst_h264_parser_get_pps (nalparser, pps_id);
 
   if (!pps) {
@@ -1701,6 +2142,12 @@
     return GST_H264_PARSER_BROKEN_LINK;
   }
 
+  /* Check we can actually parse this slice (AVC, MVC headers only) */
+  if (sps->extension_type && sps->extension_type != GST_H264_NAL_EXTENSION_MVC) {
+    GST_WARNING ("failed to parse unsupported slice header");
+    return GST_H264_PARSER_BROKEN_DATA;
+  }
+
   /* set default values for fields that might not be present in the bitstream
      and have valid defaults */
   slice->field_pic_flag = 0;
@@ -1733,7 +2180,7 @@
     slice->max_pic_num = sps->max_frame_num;
 
   if (nalu->idr_pic_flag)
-    READ_UE_ALLOWED (&nr, slice->idr_pic_id, 0, G_MAXUINT16);
+    READ_UE_MAX (&nr, slice->idr_pic_id, G_MAXUINT16);
 
   if (sps->pic_order_cnt_type == 0) {
     READ_UINT16 (&nr, slice->pic_order_cnt_lsb,
@@ -1750,7 +2197,7 @@
   }
 
   if (pps->redundant_pic_cnt_present_flag)
-    READ_UE_ALLOWED (&nr, slice->redundant_pic_cnt, 0, G_MAXINT8);
+    READ_UE_MAX (&nr, slice->redundant_pic_cnt, G_MAXINT8);
 
   if (GST_H264_IS_B_SLICE (slice))
     READ_UINT8 (&nr, slice->direct_spatial_mv_pred_flag, 1);
@@ -1761,14 +2208,15 @@
 
     READ_UINT8 (&nr, num_ref_idx_active_override_flag, 1);
     if (num_ref_idx_active_override_flag) {
-      READ_UE_ALLOWED (&nr, slice->num_ref_idx_l0_active_minus1, 0, 31);
+      READ_UE_MAX (&nr, slice->num_ref_idx_l0_active_minus1, 31);
 
       if (GST_H264_IS_B_SLICE (slice))
-        READ_UE_ALLOWED (&nr, slice->num_ref_idx_l1_active_minus1, 0, 31);
+        READ_UE_MAX (&nr, slice->num_ref_idx_l1_active_minus1, 31);
     }
   }
 
-  if (!slice_parse_ref_pic_list_modification (slice, &nr))
+  if (!slice_parse_ref_pic_list_modification (slice, &nr,
+          GST_H264_IS_MVC_NALU (nalu)))
     goto error;
 
   if ((pps->weighted_pred_flag && (GST_H264_IS_P_SLICE (slice)
@@ -1786,7 +2234,7 @@
 
   if (pps->entropy_coding_mode_flag && !GST_H264_IS_I_SLICE (slice) &&
       !GST_H264_IS_SI_SLICE (slice))
-    READ_UE_ALLOWED (&nr, slice->cabac_init_idc, 0, 2);
+    READ_UE_MAX (&nr, slice->cabac_init_idc, 2);
 
   READ_SE_ALLOWED (&nr, slice->slice_qp_delta, -87, 77);
 
@@ -1799,7 +2247,7 @@
   }
 
   if (pps->deblocking_filter_control_present_flag) {
-    READ_UE_ALLOWED (&nr, slice->disable_deblocking_filter_idc, 0, 2);
+    READ_UE_MAX (&nr, slice->disable_deblocking_filter_idc, 2);
     if (slice->disable_deblocking_filter_idc != 1) {
       READ_SE_ALLOWED (&nr, slice->slice_alpha_c0_offset_div2, -6, 6);
       READ_SE_ALLOWED (&nr, slice->slice_beta_offset_div2, -6, 6);
@@ -1827,6 +2275,56 @@
   return GST_H264_PARSER_ERROR;
 }
 
+/* Free MVC-specific data from subset SPS header */
+static void
+gst_h264_sps_mvc_clear (GstH264SPS * sps)
+{
+  GstH264SPSExtMVC *const mvc = &sps->extension.mvc;
+  guint i, j;
+
+  g_assert (sps->extension_type == GST_H264_NAL_EXTENSION_MVC);
+
+  g_free (mvc->view);
+  mvc->view = NULL;
+
+  for (i = 0; i <= mvc->num_level_values_signalled_minus1; i++) {
+    GstH264SPSExtMVCLevelValue *const level_value = &mvc->level_value[i];
+
+    for (j = 0; j <= level_value->num_applicable_ops_minus1; j++) {
+      g_free (level_value->applicable_op[j].target_view_id);
+      level_value->applicable_op[j].target_view_id = NULL;
+    }
+    g_free (level_value->applicable_op);
+    level_value->applicable_op = NULL;
+  }
+  g_free (mvc->level_value);
+  mvc->level_value = NULL;
+
+  /* All meaningful MVC info are now gone, just pretend to be a
+   * standard AVC struct now */
+  sps->extension_type = GST_H264_NAL_EXTENSION_NONE;
+}
+
+/**
+ * gst_h264_sps_clear:
+ * @sps: The #GstH264SPS to free
+ *
+ * Clears all @sps internal resources.
+ *
+ * Since: 1.6
+ */
+void
+gst_h264_sps_clear (GstH264SPS * sps)
+{
+  g_return_if_fail (sps != NULL);
+
+  switch (sps->extension_type) {
+    case GST_H264_NAL_EXTENSION_MVC:
+      gst_h264_sps_mvc_clear (sps);
+      break;
+  }
+}
+
 /**
  * gst_h264_parser_parse_sei:
  * @nalparser: a #GstH264NalParser
@@ -1846,7 +2344,8 @@
   GstH264ParserResult res;
 
   GST_DEBUG ("parsing SEI nal");
-  nal_reader_init (&nr, nalu->data + nalu->offset + 1, nalu->size - 1);
+  nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
+      nalu->size - nalu->header_bytes);
   *messages = g_array_new (FALSE, FALSE, sizeof (GstH264SEIMessage));
 
   do {
diff --git a/gst-libs/gst/codecparsers/gsth264parser.h b/gst-libs/gst/codecparsers/gsth264parser.h
index 8b2ff65..2dcb1b7 100644
--- a/gst-libs/gst/codecparsers/gsth264parser.h
+++ b/gst-libs/gst/codecparsers/gsth264parser.h
@@ -41,6 +41,8 @@
 
 #define GST_H264_MAX_SPS_COUNT   32
 #define GST_H264_MAX_PPS_COUNT   256
+#define GST_H264_MAX_VIEW_COUNT  1024
+#define GST_H264_MAX_VIEW_ID     (GST_H264_MAX_VIEW_COUNT - 1)
 
 #define GST_H264_IS_P_SLICE(slice)  (((slice)->type % 5) == GST_H264_P_SLICE)
 #define GST_H264_IS_B_SLICE(slice)  (((slice)->type % 5) == GST_H264_B_SLICE)
@@ -49,6 +51,28 @@
 #define GST_H264_IS_SI_SLICE(slice) (((slice)->type % 5) == GST_H264_SI_SLICE)
 
 /**
+ * GST_H264_IS_SVC_NALU:
+ * @nalu: a #GstH264NalUnit
+ *
+ * Check if @nalu is a scalable extension NAL unit.
+ *
+ * Since: 1.6
+ */
+#define GST_H264_IS_SVC_NALU(nalu) \
+  ((nalu)->extension_type == GST_H264_NAL_EXTENSION_SVC)
+
+/**
+ * GST_H264_IS_MVC_NALU:
+ * @nalu: a #GstH264NalUnit
+ *
+ * Check if @nalu is a multiview extension NAL unit.
+ *
+ * Since: 1.6
+ */
+#define GST_H264_IS_MVC_NALU(nalu) \
+  ((nalu)->extension_type == GST_H264_NAL_EXTENSION_MVC)
+
+/**
  * GstH264Profile:
  * @GST_H264_PROFILE_BASELINE: Baseline profile (A.2.1)
  * @GST_H264_PROFILE_MAIN: Main profile (A.2.2)
@@ -132,11 +156,28 @@
 } GstH264NalUnitType;
 
 /**
+ * GstH264NalUnitExtensionType:
+ * @GST_H264_NAL_EXTENSION_NONE: No NAL unit header extension is available
+ * @GST_H264_NAL_EXTENSION_SVC: NAL unit header extension for SVC (Annex G)
+ * @GST_H264_NAL_EXTENSION_MVC: NAL unit header extension for MVC (Annex H)
+ *
+ * Indicates the type of H.264 NAL unit extension.
+ *
+ * Since: 1.6
+ */
+typedef enum
+{
+  GST_H264_NAL_EXTENSION_NONE = 0,
+  GST_H264_NAL_EXTENSION_SVC,
+  GST_H264_NAL_EXTENSION_MVC,
+} GstH264NalUnitExtensionType;
+
+/**
  * GstH264ParserResult:
  * @GST_H264_PARSER_OK: The parsing succeded
  * @GST_H264_PARSER_BROKEN_DATA: The data to parse is broken
  * @GST_H264_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
- * @GST_H264_PARSER_ERROR: An error accured when parsing
+ * @GST_H264_PARSER_ERROR: An error occured when parsing
  * @GST_H264_PARSER_NO_NAL: No nal found during the parsing
  * @GST_H264_PARSER_NO_NAL_END: Start of the nal found, but not the end.
  *
@@ -153,10 +194,39 @@
 } GstH264ParserResult;
 
 /**
+ * GstH264FramePackingType:
+ * @GST_H264_FRAME_PACKING_NONE: A complete 2D frame without any frame packing
+ * @GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING: Checkerboard
+ *   based interleaving
+ * @GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING: Column based interleaving
+ * @GST_H264_FRAME_PACKING_ROW_INTERLEAVING: Row based interleaving
+ * @GST_H264_FRAME_PACKING_SIDE_BY_SIDE: Side-by-side packing
+ * @GST_H264_FRMAE_PACKING_TOP_BOTTOM: Top-Bottom packing
+ * @GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING: Temporal interleaving
+ *
+ * Frame packing arrangement types.
+ *
+ * Since: 1.6
+ */
+typedef enum
+{
+  GST_H264_FRAME_PACKING_NONE                           = 6,
+  GST_H264_FRAME_PACKING_CHECKERBOARD_INTERLEAVING      = 0,
+  GST_H264_FRAME_PACKING_COLUMN_INTERLEAVING            = 1,
+  GST_H264_FRAME_PACKING_ROW_INTERLEAVING               = 2,
+  GST_H264_FRAME_PACKING_SIDE_BY_SIDE                   = 3,
+  GST_H264_FRMAE_PACKING_TOP_BOTTOM                     = 4,
+  GST_H264_FRAME_PACKING_TEMPORAL_INTERLEAVING          = 5
+} GstH264FramePackingType;
+
+/**
  * GstH264SEIPayloadType:
  * @GST_H264_SEI_BUF_PERIOD: Buffering Period SEI Message
  * @GST_H264_SEI_PIC_TIMING: Picture Timing SEI Message
  * @GST_H264_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.2.7)
+ * @GST_H264_SEI_STEREO_VIDEO_INFO: stereo video info SEI message (Since: 1.6)
+ * @GST_H264_SEI_FRAME_PACKING: Frame Packing Arrangement (FPA) message that
+ *     contains the 3D arrangement for stereoscopic 3D video (Since: 1.6)
  * ...
  *
  * The type of SEI message.
@@ -166,6 +236,8 @@
   GST_H264_SEI_BUF_PERIOD = 0,
   GST_H264_SEI_PIC_TIMING = 1,
   GST_H264_SEI_RECOVERY_POINT = 6,
+  GST_H264_SEI_STEREO_VIDEO_INFO = 21,
+  GST_H264_SEI_FRAME_PACKING = 45
       /* and more...  */
 } GstH264SEIPayloadType;
 
@@ -221,6 +293,12 @@
 typedef struct _GstH264NalParser              GstH264NalParser;
 
 typedef struct _GstH264NalUnit                GstH264NalUnit;
+typedef struct _GstH264NalUnitExtensionMVC    GstH264NalUnitExtensionMVC;
+
+typedef struct _GstH264SPSExtMVCView          GstH264SPSExtMVCView;
+typedef struct _GstH264SPSExtMVCLevelValue    GstH264SPSExtMVCLevelValue;
+typedef struct _GstH264SPSExtMVCLevelValueOp  GstH264SPSExtMVCLevelValueOp;
+typedef struct _GstH264SPSExtMVC              GstH264SPSExtMVC;
 
 typedef struct _GstH264SPS                    GstH264SPS;
 typedef struct _GstH264PPS                    GstH264PPS;
@@ -237,9 +315,36 @@
 typedef struct _GstH264PicTiming              GstH264PicTiming;
 typedef struct _GstH264BufferingPeriod        GstH264BufferingPeriod;
 typedef struct _GstH264RecoveryPoint          GstH264RecoveryPoint;
+typedef struct _GstH264StereoVideoInfo        GstH264StereoVideoInfo;
+typedef struct _GstH264FramePacking           GstH264FramePacking;
 typedef struct _GstH264SEIMessage             GstH264SEIMessage;
 
 /**
+ * GstH264NalUnitExtensionMVC:
+ * @non_idr_flag: If equal to 0, it specifies that the current access
+ *   unit is an IDR access unit
+ * @priority_id: The priority identifier for the NAL unit
+ * @view_id: The view identifier for the NAL unit
+ * @temporal_id: The temporal identifier for the NAL unit
+ * @anchor_pic_flag: If equal to 1, it specifies that the current
+ *   access unit is an anchor access unit
+ * @inter_view_flag: If equal to 0, it specifies that the current view
+ *   component is not used for inter-view prediction by any other view
+ *   component in the current access unit
+ *
+ * Since: 1.6
+ */
+struct _GstH264NalUnitExtensionMVC
+{
+  guint8 non_idr_flag;
+  guint8 priority_id;
+  guint16 view_id;
+  guint8 temporal_id;
+  guint8 anchor_pic_flag;
+  guint8 inter_view_flag;
+};
+
+/**
  * GstH264NalUnit:
  * @ref_idc: not equal to 0 specifies that the content of the NAL unit
  *  contains a sequence parameter set, a sequence parameter set
@@ -257,6 +362,8 @@
  * @valid: If the nal unit is valid, which means it has
  * already been parsed
  * @data: The data from which the Nalu has been parsed
+ * @header_bytes: The size of the NALU header in bytes (Since 1.6)
+ * @extension_type: the extension type (Since 1.6)
  *
  * Structure defining the Nal unit headers
  */
@@ -273,6 +380,12 @@
   gboolean valid;
 
   guint8 *data;
+
+  guint8 header_bytes;
+  guint8 extension_type;
+  union {
+    GstH264NalUnitExtensionMVC mvc;
+  } extension;
 };
 
 /**
@@ -424,6 +537,105 @@
 };
 
 /**
+ * GstH264SPSExtMVCView:
+ * @num_anchor_refs_l0: specifies the number of view components for
+ *   inter-view prediction in the initialized RefPicList0 in decoding
+ *   anchor view components.
+ * @anchor_ref_l0: specifies the view_id for inter-view prediction in
+ *   the initialized RefPicList0 in decoding anchor view components.
+ * @num_anchor_refs_l1: specifies the number of view components for
+ *   inter-view prediction in the initialized RefPicList1 in decoding
+ *   anchor view components.
+ * @anchor_ref_l1: specifies the view_id for inter-view prediction in
+ *   the initialized RefPicList1 in decoding anchor view components.
+ * @num_non_anchor_refs_l0: specifies the number of view components
+ *   for inter-view prediction in the initialized RefPicList0 in
+ *   decoding non-anchor view components.
+ * @non_anchor_ref_l0: specifies the view_id for inter-view prediction
+ *   in the initialized RefPicList0 in decoding non-anchor view
+ *   components.
+ * @num_non_anchor_refs_l1: specifies the number of view components
+ *   for inter-view prediction in the initialized RefPicList1 in
+ *   decoding non-anchor view components.
+ * @non_anchor_ref_l1: specifies the view_id for inter-view prediction
+ *   in the initialized RefPicList1 in decoding non-anchor view
+ *   components.
+ *
+ * Represents inter-view dependency relationships for the coded video
+ * sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCView
+{
+  guint16 view_id;
+  guint8 num_anchor_refs_l0;
+  guint16 anchor_ref_l0[15];
+  guint8 num_anchor_refs_l1;
+  guint16 anchor_ref_l1[15];
+  guint8 num_non_anchor_refs_l0;
+  guint16 non_anchor_ref_l0[15];
+  guint8 num_non_anchor_refs_l1;
+  guint16 non_anchor_ref_l1[15];
+};
+
+/**
+ * GstH264SPSExtMVCLevelValueOp:
+ *
+ * Represents an operation point for the coded video sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCLevelValueOp
+{
+  guint8 temporal_id;
+  guint16 num_target_views_minus1;
+  guint16 *target_view_id;
+  guint16 num_views_minus1;
+};
+
+/**
+ * GstH264SPSExtMVCLevelValue:
+ * @level_idc: specifies the level value signalled for the coded video
+ *   sequence
+ * @num_applicable_ops_minus1: plus 1 specifies the number of
+ *   operation points to which the level indicated by level_idc applies
+ * @applicable_op: specifies the applicable operation point
+ *
+ * Represents level values for a subset of the operation points for
+ * the coded video sequence.
+ *
+ * Since: 1.6
+ */
+struct _GstH264SPSExtMVCLevelValue
+{
+  guint8 level_idc;
+  guint16 num_applicable_ops_minus1;
+  GstH264SPSExtMVCLevelValueOp *applicable_op;
+};
+
+/**
+ * GstH264SPSExtMVC:
+ * @num_views_minus1: plus 1 specifies the maximum number of coded
+ *   views in the coded video sequence
+ * @view: array of #GstH264SPSExtMVCView
+ * @num_level_values_signalled_minus1: plus 1 specifies the number of
+ *   level values signalled for the coded video sequence.
+ * @level_value: array of #GstH264SPSExtMVCLevelValue
+ *
+ * Represents the parsed seq_parameter_set_mvc_extension().
+ *
+ * Since: 1.6
+	 */
+struct _GstH264SPSExtMVC
+{
+  guint16 num_views_minus1;
+  GstH264SPSExtMVCView *view;
+  guint8 num_level_values_signalled_minus1;
+  GstH264SPSExtMVCLevelValue *level_value;
+};
+
+/**
  * GstH264SPS:
  * @id: The ID of the sequence parameter set
  * @profile_idc: indicate the profile to which the coded video sequence conforms
@@ -439,6 +651,8 @@
   guint8 constraint_set1_flag;
   guint8 constraint_set2_flag;
   guint8 constraint_set3_flag;
+  guint8 constraint_set4_flag;
+  guint8 constraint_set5_flag;
   guint8 level_idc;
 
   guint8 chroma_format_idc;
@@ -494,6 +708,12 @@
   gint crop_rect_x, crop_rect_y;
   gint fps_num, fps_den;
   gboolean valid;
+
+  /* Subset SPS extensions */
+  guint8 extension_type;
+  union {
+    GstH264SPSExtMVC mvc;
+  } extension;
 };
 
 /**
@@ -556,6 +776,8 @@
     guint32 abs_diff_pic_num_minus1;
     /* if modification_of_pic_nums_idc == 2 */
     guint32 long_term_pic_num;
+    /* if modification_of_pic_nums_idc == 4 || 5 */
+    guint32 abs_diff_view_idx_minus1;
   } value;
 };
 
@@ -687,6 +909,46 @@
   guint32 time_offset;
 };
 
+/**
+ * GstH264FramePacking:
+ *
+ * Since: 1.6
+ */
+struct _GstH264FramePacking
+{
+  guint32 frame_packing_id;
+  guint8 frame_packing_cancel_flag;
+  guint8 frame_packing_type; /* GstH264FramePackingType */
+  guint8 quincunx_sampling_flag;
+  guint8 content_interpretation_type;
+  guint8 spatial_flipping_flag;
+  guint8 frame0_flipped_flag;
+  guint8 field_views_flag;
+  guint8 current_frame_is_frame0_flag;
+  guint8 frame0_self_contained_flag;
+  guint8 frame1_self_contained_flag;
+  guint8 frame0_grid_position_x;
+  guint8 frame0_grid_position_y;
+  guint8 frame1_grid_position_x;
+  guint8 frame1_grid_position_y;
+  guint16 frame_packing_repetition_period;
+};
+
+/**
+ * GstH264StereoVideoInfo:
+ *
+ * Since: 1.6
+ */
+struct _GstH264StereoVideoInfo
+{
+  guint8 field_views_flag;
+  guint8 top_field_is_left_view_flag;
+  guint8 current_frame_is_left_view_flag;
+  guint8 next_frame_is_second_view_flag;
+  guint8 left_view_self_contained_flag;
+  guint8 right_view_self_contained_flag;
+};
+
 struct _GstH264PicTiming
 {
   guint32 cpb_removal_delay;
@@ -705,12 +967,12 @@
   GstH264SPS *sps;
 
   /* seq->vui_parameters->nal_hrd_parameters_present_flag */
-  guint8 nal_initial_cpb_removal_delay[32];
-  guint8 nal_initial_cpb_removal_delay_offset[32];
+  guint32 nal_initial_cpb_removal_delay[32];
+  guint32 nal_initial_cpb_removal_delay_offset[32];
 
   /* seq->vui_parameters->vcl_hrd_parameters_present_flag */
-  guint8 vcl_initial_cpb_removal_delay[32];
-  guint8 vcl_initial_cpb_removal_delay_offset[32];
+  guint32 vcl_initial_cpb_removal_delay[32];
+  guint32 vcl_initial_cpb_removal_delay_offset[32];
 };
 
 struct _GstH264RecoveryPoint
@@ -729,6 +991,8 @@
     GstH264BufferingPeriod buffering_period;
     GstH264PicTiming pic_timing;
     GstH264RecoveryPoint recovery_point;
+    GstH264StereoVideoInfo stereo_video_info;
+    GstH264FramePacking frame_packing;
     /* ... could implement more */
   } payload;
 };
@@ -768,6 +1032,9 @@
                                                        GstH264SliceHdr *slice, gboolean parse_pred_weight_table,
                                                        gboolean parse_dec_ref_pic_marking);
 
+GstH264ParserResult gst_h264_parser_parse_subset_sps  (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
+                                                       GstH264SPS *sps, gboolean parse_vui_params);
+
 GstH264ParserResult gst_h264_parser_parse_sps         (GstH264NalParser *nalparser, GstH264NalUnit *nalu,
                                                        GstH264SPS *sps, gboolean parse_vui_params);
 
@@ -779,12 +1046,16 @@
 
 void gst_h264_nal_parser_free                         (GstH264NalParser *nalparser);
 
+GstH264ParserResult gst_h264_parse_subset_sps         (GstH264NalUnit *nalu,
+                                                       GstH264SPS *sps, gboolean parse_vui_params);
+
 GstH264ParserResult gst_h264_parse_sps                (GstH264NalUnit *nalu,
                                                        GstH264SPS *sps, gboolean parse_vui_params);
 
 GstH264ParserResult gst_h264_parse_pps                (GstH264NalParser *nalparser,
                                                        GstH264NalUnit *nalu, GstH264PPS *pps);
 
+void                gst_h264_sps_clear                (GstH264SPS *sps);
 void                gst_h264_pps_clear                (GstH264PPS *pps);
 
 void    gst_h264_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
diff --git a/gst-libs/gst/codecparsers/gsth265parser.c b/gst-libs/gst/codecparsers/gsth265parser.c
index fd6e80f..083b278 100644
--- a/gst-libs/gst/codecparsers/gsth265parser.c
+++ b/gst-libs/gst/codecparsers/gsth265parser.c
@@ -137,7 +137,7 @@
 } PAR;
 
 /* Table E-1 - Meaning of sample aspect ratio indicator (1..16) */
-static PAR aspect_ratios[17] = {
+static const PAR aspect_ratios[17] = {
   {0, 0},
   {1, 1},
   {12, 11},
@@ -306,14 +306,12 @@
     sub_hrd->cbr_flag[i] = 0;
 
   for (i = 0; i <= CpbCnt; i++) {
-    READ_UE_ALLOWED (nr, sub_hrd->bit_rate_value_minus1[i], 0, G_MAXUINT32 - 1);
-    READ_UE_ALLOWED (nr, sub_hrd->cpb_size_value_minus1[i], 0, G_MAXUINT32 - 1);
+    READ_UE_MAX (nr, sub_hrd->bit_rate_value_minus1[i], G_MAXUINT32 - 1);
+    READ_UE_MAX (nr, sub_hrd->cpb_size_value_minus1[i], G_MAXUINT32 - 1);
 
     if (sub_pic_hrd_params_present_flag) {
-      READ_UE_ALLOWED (nr, sub_hrd->cpb_size_du_value_minus1[i], 0,
-          G_MAXUINT32 - 1);
-      READ_UE_ALLOWED (nr, sub_hrd->bit_rate_du_value_minus1[i], 0,
-          G_MAXUINT32 - 1);
+      READ_UE_MAX (nr, sub_hrd->cpb_size_du_value_minus1[i], G_MAXUINT32 - 1);
+      READ_UE_MAX (nr, sub_hrd->bit_rate_du_value_minus1[i], G_MAXUINT32 - 1);
     }
 
     READ_UINT8 (nr, sub_hrd->cbr_flag[i], 1);
@@ -384,12 +382,12 @@
       hrd->fixed_pic_rate_within_cvs_flag[i] = 1;
 
     if (hrd->fixed_pic_rate_within_cvs_flag[i]) {
-      READ_UE_ALLOWED (nr, hrd->elemental_duration_in_tc_minus1[i], 0, 2047);
+      READ_UE_MAX (nr, hrd->elemental_duration_in_tc_minus1[i], 2047);
     } else
       READ_UINT8 (nr, hrd->low_delay_hrd_flag[i], 1);
 
     if (!hrd->low_delay_hrd_flag[i])
-      READ_UE_ALLOWED (nr, hrd->cpb_cnt_minus1[i], 0, 31);
+      READ_UE_MAX (nr, hrd->cpb_cnt_minus1[i], 31);
 
     if (hrd->nal_hrd_parameters_present_flag)
       if (!gst_h265_parse_sub_layer_hrd_parameters (&hrd->sublayer_hrd_params
@@ -483,8 +481,8 @@
 
   READ_UINT8 (nr, vui->chroma_loc_info_present_flag, 1);
   if (vui->chroma_loc_info_present_flag) {
-    READ_UE_ALLOWED (nr, vui->chroma_sample_loc_type_top_field, 0, 5);
-    READ_UE_ALLOWED (nr, vui->chroma_sample_loc_type_bottom_field, 0, 5);
+    READ_UE_MAX (nr, vui->chroma_sample_loc_type_top_field, 5);
+    READ_UE_MAX (nr, vui->chroma_sample_loc_type_bottom_field, 5);
   }
 
   READ_UINT8 (nr, vui->neutral_chroma_indication_flag, 1);
@@ -513,8 +511,7 @@
 
     READ_UINT8 (nr, vui->poc_proportional_to_timing_flag, 1);
     if (vui->poc_proportional_to_timing_flag)
-      READ_UE_ALLOWED (nr, vui->num_ticks_poc_diff_one_minus1, 0,
-          G_MAXUINT32 - 1);
+      READ_UE_MAX (nr, vui->num_ticks_poc_diff_one_minus1, G_MAXUINT32 - 1);
 
     READ_UINT8 (nr, vui->hrd_parameters_present_flag, 1);
     if (vui->hrd_parameters_present_flag)
@@ -528,11 +525,11 @@
     READ_UINT8 (nr, vui->tiles_fixed_structure_flag, 1);
     READ_UINT8 (nr, vui->motion_vectors_over_pic_boundaries_flag, 1);
     READ_UINT8 (nr, vui->restricted_ref_pic_lists_flag, 1);
-    READ_UE_ALLOWED (nr, vui->min_spatial_segmentation_idc, 0, 4096);
-    READ_UE_ALLOWED (nr, vui->max_bytes_per_pic_denom, 0, 16);
-    READ_UE_ALLOWED (nr, vui->max_bits_per_min_cu_denom, 0, 16);
-    READ_UE_ALLOWED (nr, vui->log2_max_mv_length_horizontal, 0, 16);
-    READ_UE_ALLOWED (nr, vui->log2_max_mv_length_vertical, 0, 15);
+    READ_UE_MAX (nr, vui->min_spatial_segmentation_idc, 4096);
+    READ_UE_MAX (nr, vui->max_bytes_per_pic_denom, 16);
+    READ_UE_MAX (nr, vui->max_bits_per_min_cu_denom, 16);
+    READ_UE_MAX (nr, vui->log2_max_mv_length_horizontal, 16);
+    READ_UE_MAX (nr, vui->log2_max_mv_length_vertical, 15);
   }
 
   return TRUE;
@@ -590,7 +587,7 @@
 
     case GST_H265_QUANT_MATIX_8X8:
     case GST_H265_QUANT_MATIX_16X16:
-      if (matrixId >= 0 && matrixId <= 2)
+      if (matrixId <= 2)
         memcpy (*sl, default_scaling_list1, 64);
       else
         memcpy (*sl, default_scaling_list2, 64);
@@ -649,7 +646,7 @@
         if (!scaling_list_pred_mode_flag) {
           guint8 refMatrixId;
 
-          READ_UE_ALLOWED (nr, scaling_list_pred_matrix_id_delta, 0, matrixId);
+          READ_UE_MAX (nr, scaling_list_pred_matrix_id_delta, matrixId);
 
           if (!scaling_list_pred_matrix_id_delta) {
             if (!get_default_scaling_lists (&sl, sizeId, matrixId))
@@ -710,7 +707,7 @@
 {
   guint8 num_short_term_ref_pic_sets;
   guint8 RefRpsIdx = 0;
-  guint16 deltaRps = 0;
+  gint16 deltaRps = 0;
   guint8 use_delta_flag[16] = { 0 };
   guint8 used_by_curr_pic_flag[16] = { 0 };
   guint32 delta_poc_s0_minus1[16] = { 0 };
@@ -736,10 +733,10 @@
     GstH265ShortTermRefPicSet *RefRPS;
 
     if (stRpsIdx == num_short_term_ref_pic_sets)
-      READ_UE_ALLOWED (nr, stRPS->delta_idx_minus1, 0, stRpsIdx - 1);
+      READ_UE_MAX (nr, stRPS->delta_idx_minus1, stRpsIdx - 1);
 
     READ_UINT8 (nr, stRPS->delta_rps_sign, 1);
-    READ_UE_ALLOWED (nr, stRPS->abs_delta_rps_minus1, 0, 32767);
+    READ_UE_MAX (nr, stRPS->abs_delta_rps_minus1, 32767);
 
     RefRpsIdx = stRpsIdx - stRPS->delta_idx_minus1 - 1; /* 7-45 */
     deltaRps = (1 - 2 * stRPS->delta_rps_sign) * (stRPS->abs_delta_rps_minus1 + 1);     /* 7-46 */
@@ -803,16 +800,16 @@
 
   } else {
     /* 7-49 */
-    READ_UE_ALLOWED (nr, stRPS->NumNegativePics, 0,
+    READ_UE_MAX (nr, stRPS->NumNegativePics,
         sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1]);
 
     /* 7-50 */
-    READ_UE_ALLOWED (nr, stRPS->NumPositivePics, 0,
+    READ_UE_MAX (nr, stRPS->NumPositivePics,
         (sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1] -
             stRPS->NumNegativePics));
 
     for (i = 0; i < stRPS->NumNegativePics; i++) {
-      READ_UE_ALLOWED (nr, delta_poc_s0_minus1[i], 0, 32767);
+      READ_UE_MAX (nr, delta_poc_s0_minus1[i], 32767);
       /* 7-51 */
       READ_UINT8 (nr, stRPS->UsedByCurrPicS0[i], 1);
 
@@ -827,7 +824,7 @@
     }
 
     for (j = 0; j < stRPS->NumPositivePics; j++) {
-      READ_UE_ALLOWED (nr, delta_poc_s1_minus1[j], 0, 32767);
+      READ_UE_MAX (nr, delta_poc_s1_minus1[j], 32767);
 
       /* 7-52 */
       READ_UINT8 (nr, stRPS->UsedByCurrPicS1[j], 1);
@@ -873,7 +870,7 @@
   if (rpl_mod->ref_pic_list_modification_flag_l0) {
     for (i = 0; i < slice->num_ref_idx_l0_active_minus1; i++) {
       READ_UINT32 (nr, rpl_mod->list_entry_l0[i], n);
-      CHECK_ALLOWED (rpl_mod->list_entry_l0[i], 0, (NumPocTotalCurr - 1));
+      CHECK_ALLOWED_MAX (rpl_mod->list_entry_l0[i], (NumPocTotalCurr - 1));
     }
   }
   if (GST_H265_IS_B_SLICE (slice)) {
@@ -881,7 +878,7 @@
     if (rpl_mod->ref_pic_list_modification_flag_l1)
       for (i = 0; i <= slice->num_ref_idx_l1_active_minus1; i++) {
         READ_UINT32 (nr, rpl_mod->list_entry_l1[i], n);
-        CHECK_ALLOWED (rpl_mod->list_entry_l1[i], 0, (NumPocTotalCurr - 1));
+        CHECK_ALLOWED_MAX (rpl_mod->list_entry_l1[i], (NumPocTotalCurr - 1));
       }
   }
 
@@ -904,7 +901,7 @@
 
   p = &slice->pred_weight_table;
 
-  READ_UE_ALLOWED (nr, p->luma_log2_weight_denom, 0, 7);
+  READ_UE_MAX (nr, p->luma_log2_weight_denom, 7);
 
   /* set default values */
   for (i = 0; i < G_N_ELEMENTS (p->chroma_weight_l0_flag); i++) {
@@ -979,7 +976,7 @@
 
   GST_DEBUG ("parsing \"Buffering period\"");
 
-  READ_UE_ALLOWED (nr, sps_id, 0, GST_H265_MAX_SPS_COUNT - 1);
+  READ_UE_MAX (nr, sps_id, GST_H265_MAX_SPS_COUNT - 1);
   sps = gst_h265_parser_get_sps (parser, sps_id);
   if (!sps) {
     GST_WARNING ("couldn't find associated sequence parameter set with id: %d",
@@ -1443,12 +1440,10 @@
   for (i =
       (vps->sub_layer_ordering_info_present_flag ? 0 :
           vps->max_sub_layers_minus1); i <= vps->max_sub_layers_minus1; i++) {
-    READ_UE_ALLOWED (&nr, vps->max_dec_pic_buffering_minus1[i], 0,
-        G_MAXUINT32 - 1);
-    READ_UE_ALLOWED (&nr, vps->max_num_reorder_pics[i], 0,
+    READ_UE_MAX (&nr, vps->max_dec_pic_buffering_minus1[i], G_MAXUINT32 - 1);
+    READ_UE_MAX (&nr, vps->max_num_reorder_pics[i],
         vps->max_dec_pic_buffering_minus1[i]);
-    READ_UE_ALLOWED (&nr, vps->max_latency_increase_plus1[i], 0,
-        G_MAXUINT32 - 1);
+    READ_UE_MAX (&nr, vps->max_latency_increase_plus1[i], G_MAXUINT32 - 1);
   }
   /* setting default values if vps->sub_layer_ordering_info_present_flag is zero */
   if (!vps->sub_layer_ordering_info_present_flag && vps->max_sub_layers_minus1) {
@@ -1463,10 +1458,10 @@
   }
 
   READ_UINT8 (&nr, vps->max_layer_id, 6);
-  CHECK_ALLOWED (vps->max_layer_id, 0, 0);
+  CHECK_ALLOWED_MAX (vps->max_layer_id, 0);
 
-  READ_UE_ALLOWED (&nr, vps->num_layer_sets_minus1, 0, 1023);
-  CHECK_ALLOWED (vps->num_layer_sets_minus1, 0, 0);
+  READ_UE_MAX (&nr, vps->num_layer_sets_minus1, 1023);
+  CHECK_ALLOWED_MAX (vps->num_layer_sets_minus1, 0);
 
   for (i = 1; i <= vps->num_layer_sets_minus1; i++)
     for (j = 0; j <= vps->max_layer_id; j++)
@@ -1480,15 +1475,14 @@
     READ_UINT8 (&nr, vps->poc_proportional_to_timing_flag, 1);
 
     if (vps->poc_proportional_to_timing_flag)
-      READ_UE_ALLOWED (&nr, vps->num_ticks_poc_diff_one_minus1, 0,
-          G_MAXUINT32 - 1);
+      READ_UE_MAX (&nr, vps->num_ticks_poc_diff_one_minus1, G_MAXUINT32 - 1);
 
-    READ_UE_ALLOWED (&nr, vps->num_hrd_parameters, 0, 1024);
-    CHECK_ALLOWED (vps->num_hrd_parameters, 0, 1);
+    READ_UE_MAX (&nr, vps->num_hrd_parameters, 1024);
+    CHECK_ALLOWED_MAX (vps->num_hrd_parameters, 1);
 
     if (vps->num_hrd_parameters) {
-      READ_UE_ALLOWED (&nr, vps->hrd_layer_set_idx, 0, 1023);
-      CHECK_ALLOWED (vps->hrd_layer_set_idx, 0, 0);
+      READ_UE_MAX (&nr, vps->hrd_layer_set_idx, 1023);
+      CHECK_ALLOWED_MAX (vps->hrd_layer_set_idx, 0);
 
       if (!gst_h265_parse_hrd_parameters (&vps->hrd_params, &nr,
               vps->cprms_present_flag, vps->max_sub_layers_minus1))
@@ -1588,9 +1582,9 @@
           sps->max_sub_layers_minus1))
     goto error;
 
-  READ_UE_ALLOWED (&nr, sps->id, 0, GST_H265_MAX_SPS_COUNT - 1);
+  READ_UE_MAX (&nr, sps->id, GST_H265_MAX_SPS_COUNT - 1);
 
-  READ_UE_ALLOWED (&nr, sps->chroma_format_idc, 0, 3);
+  READ_UE_MAX (&nr, sps->chroma_format_idc, 3);
   if (sps->chroma_format_idc == 3)
     READ_UINT8 (&nr, sps->separate_colour_plane_flag, 1);
 
@@ -1605,19 +1599,18 @@
     READ_UE (&nr, sps->conf_win_bottom_offset);
   }
 
-  READ_UE_ALLOWED (&nr, sps->bit_depth_luma_minus8, 0, 6);
-  READ_UE_ALLOWED (&nr, sps->bit_depth_chroma_minus8, 0, 6);
-  READ_UE_ALLOWED (&nr, sps->log2_max_pic_order_cnt_lsb_minus4, 0, 12);
+  READ_UE_MAX (&nr, sps->bit_depth_luma_minus8, 6);
+  READ_UE_MAX (&nr, sps->bit_depth_chroma_minus8, 6);
+  READ_UE_MAX (&nr, sps->log2_max_pic_order_cnt_lsb_minus4, 12);
 
   READ_UINT8 (&nr, sps->sub_layer_ordering_info_present_flag, 1);
   for (i =
       (sps->sub_layer_ordering_info_present_flag ? 0 :
           sps->max_sub_layers_minus1); i <= sps->max_sub_layers_minus1; i++) {
-    READ_UE_ALLOWED (&nr, sps->max_dec_pic_buffering_minus1[i], 0, 16);
-    READ_UE_ALLOWED (&nr, sps->max_num_reorder_pics[i], 0,
+    READ_UE_MAX (&nr, sps->max_dec_pic_buffering_minus1[i], 16);
+    READ_UE_MAX (&nr, sps->max_num_reorder_pics[i],
         sps->max_dec_pic_buffering_minus1[i]);
-    READ_UE_ALLOWED (&nr, sps->max_latency_increase_plus1[i], 0,
-        G_MAXUINT32 - 1);
+    READ_UE_MAX (&nr, sps->max_latency_increase_plus1[i], G_MAXUINT32 - 1);
   }
   /* setting default values if sps->sub_layer_ordering_info_present_flag is zero */
   if (!sps->sub_layer_ordering_info_present_flag && sps->max_sub_layers_minus1) {
@@ -1633,12 +1626,12 @@
 
   /* The limits are calculted based on the profile_tier_level constraint
    * in Annex-A: CtbLog2SizeY = 4 to 6 */
-  READ_UE_ALLOWED (&nr, sps->log2_min_luma_coding_block_size_minus3, 0, 3);
-  READ_UE_ALLOWED (&nr, sps->log2_diff_max_min_luma_coding_block_size, 0, 6);
-  READ_UE_ALLOWED (&nr, sps->log2_min_transform_block_size_minus2, 0, 3);
-  READ_UE_ALLOWED (&nr, sps->log2_diff_max_min_transform_block_size, 0, 3);
-  READ_UE_ALLOWED (&nr, sps->max_transform_hierarchy_depth_inter, 0, 4);
-  READ_UE_ALLOWED (&nr, sps->max_transform_hierarchy_depth_intra, 0, 4);
+  READ_UE_MAX (&nr, sps->log2_min_luma_coding_block_size_minus3, 3);
+  READ_UE_MAX (&nr, sps->log2_diff_max_min_luma_coding_block_size, 6);
+  READ_UE_MAX (&nr, sps->log2_min_transform_block_size_minus2, 3);
+  READ_UE_MAX (&nr, sps->log2_diff_max_min_transform_block_size, 3);
+  READ_UE_MAX (&nr, sps->max_transform_hierarchy_depth_inter, 4);
+  READ_UE_MAX (&nr, sps->max_transform_hierarchy_depth_intra, 4);
 
   READ_UINT8 (&nr, sps->scaling_list_enabled_flag, 1);
   if (sps->scaling_list_enabled_flag) {
@@ -1656,14 +1649,12 @@
   if (sps->pcm_enabled_flag) {
     READ_UINT8 (&nr, sps->pcm_sample_bit_depth_luma_minus1, 4);
     READ_UINT8 (&nr, sps->pcm_sample_bit_depth_chroma_minus1, 4);
-    READ_UE_ALLOWED (&nr, sps->log2_min_pcm_luma_coding_block_size_minus3, 0,
-        2);
-    READ_UE_ALLOWED (&nr, sps->log2_diff_max_min_pcm_luma_coding_block_size, 0,
-        2);
+    READ_UE_MAX (&nr, sps->log2_min_pcm_luma_coding_block_size_minus3, 2);
+    READ_UE_MAX (&nr, sps->log2_diff_max_min_pcm_luma_coding_block_size, 2);
     READ_UINT8 (&nr, sps->pcm_loop_filter_disabled_flag, 1);
   }
 
-  READ_UE_ALLOWED (&nr, sps->num_short_term_ref_pic_sets, 0, 64);
+  READ_UE_MAX (&nr, sps->num_short_term_ref_pic_sets, 64);
   for (i = 0; i < sps->num_short_term_ref_pic_sets; i++)
     if (!gst_h265_parser_parse_short_term_ref_pic_sets
         (&sps->short_term_ref_pic_set[i], &nr, i, sps))
@@ -1671,7 +1662,7 @@
 
   READ_UINT8 (&nr, sps->long_term_ref_pics_present_flag, 1);
   if (sps->long_term_ref_pics_present_flag) {
-    READ_UE_ALLOWED (&nr, sps->num_long_term_ref_pics_sps, 0, 32);
+    READ_UE_MAX (&nr, sps->num_long_term_ref_pics_sps, 32);
     for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) {
       READ_UINT16 (&nr, sps->lt_ref_pic_poc_lsb_sps[i],
           sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
@@ -1760,8 +1751,8 @@
   nal_reader_init (&nr, nalu->data + nalu->offset + nalu->header_bytes,
       nalu->size - nalu->header_bytes);
 
-  READ_UE_ALLOWED (&nr, pps->id, 0, GST_H265_MAX_PPS_COUNT - 1);
-  READ_UE_ALLOWED (&nr, sps_id, 0, GST_H265_MAX_SPS_COUNT - 1);
+  READ_UE_MAX (&nr, pps->id, GST_H265_MAX_PPS_COUNT - 1);
+  READ_UE_MAX (&nr, sps_id, GST_H265_MAX_SPS_COUNT - 1);
 
   sps = gst_h265_parser_get_sps (parser, sps_id);
   if (!sps) {
@@ -1790,8 +1781,8 @@
   READ_UINT8 (&nr, pps->sign_data_hiding_enabled_flag, 1);
   READ_UINT8 (&nr, pps->cabac_init_present_flag, 1);
 
-  READ_UE_ALLOWED (&nr, pps->num_ref_idx_l0_default_active_minus1, 0, 14);
-  READ_UE_ALLOWED (&nr, pps->num_ref_idx_l1_default_active_minus1, 0, 14);
+  READ_UE_MAX (&nr, pps->num_ref_idx_l0_default_active_minus1, 14);
+  READ_UE_MAX (&nr, pps->num_ref_idx_l1_default_active_minus1, 14);
   READ_SE_ALLOWED (&nr, pps->init_qp_minus26, -(26 + qp_bd_offset), 25);
 
   READ_UINT8 (&nr, pps->constrained_intra_pred_flag, 1);
@@ -1799,7 +1790,7 @@
 
   READ_UINT8 (&nr, pps->cu_qp_delta_enabled_flag, 1);
   if (pps->cu_qp_delta_enabled_flag)
-    READ_UE_ALLOWED (&nr, pps->diff_cu_qp_delta_depth, 0,
+    READ_UE_MAX (&nr, pps->diff_cu_qp_delta_depth,
         sps->log2_diff_max_min_luma_coding_block_size);
 
   READ_SE_ALLOWED (&nr, pps->cb_qp_offset, -12, 12);
@@ -1850,7 +1841,7 @@
       goto error;
 
   READ_UINT8 (&nr, pps->lists_modification_present_flag, 1);
-  READ_UE_ALLOWED (&nr, pps->log2_parallel_merge_level_minus2, 0, 4);
+  READ_UE_MAX (&nr, pps->log2_parallel_merge_level_minus2, 4);
   READ_UINT8 (&nr, pps->slice_segment_header_extension_present_flag, 1);
   READ_UINT8 (&nr, pps->pps_extension_flag, 1);
 
@@ -1936,7 +1927,7 @@
       && nalu->type <= RESERVED_IRAP_NAL_TYPE_MAX)
     READ_UINT8 (&nr, slice->no_output_of_prior_pics_flag, 1);
 
-  READ_UE_ALLOWED (&nr, pps_id, 0, GST_H265_MAX_PPS_COUNT - 1);
+  READ_UE_MAX (&nr, pps_id, GST_H265_MAX_PPS_COUNT - 1);
   pps = gst_h265_parser_get_pps (parser, pps_id);
   if (!pps) {
     GST_WARNING
@@ -2002,7 +1993,7 @@
   if (!slice->dependent_slice_segment_flag) {
     for (i = 0; i < pps->num_extra_slice_header_bits; i++)
       nal_reader_skip (&nr, 1);
-    READ_UE_ALLOWED (&nr, slice->type, 0, 63);
+    READ_UE_MAX (&nr, slice->type, 63);
 
 
     if (pps->output_flag_present_flag)
@@ -2014,7 +2005,6 @@
         && (nalu->type != GST_H265_NAL_SLICE_IDR_N_LP)) {
       READ_UINT16 (&nr, slice->pic_order_cnt_lsb,
           (sps->log2_max_pic_order_cnt_lsb_minus4 + 4));
-      CHECK_ALLOWED (slice->pic_order_cnt_lsb, 0, G_MAXUINT16);
 
       READ_UINT8 (&nr, slice->short_term_ref_pic_set_sps_flag, 1);
       if (!slice->short_term_ref_pic_set_sps_flag) {
@@ -2025,7 +2015,7 @@
       } else if (sps->num_short_term_ref_pic_sets > 1) {
         const guint n = ceil_log2 (sps->num_short_term_ref_pic_sets);
         READ_UINT8 (&nr, slice->short_term_ref_pic_set_idx, n);
-        CHECK_ALLOWED (slice->short_term_ref_pic_set_idx, 0,
+        CHECK_ALLOWED_MAX (slice->short_term_ref_pic_set_idx,
             sps->num_short_term_ref_pic_sets - 1);
       }
 
@@ -2033,10 +2023,10 @@
         guint32 limit;
 
         if (sps->num_long_term_ref_pics_sps > 0)
-          READ_UE_ALLOWED (&nr, slice->num_long_term_sps, 0,
+          READ_UE_MAX (&nr, slice->num_long_term_sps,
               sps->num_long_term_ref_pics_sps);
 
-        READ_UE_ALLOWED (&nr, slice->num_long_term_pics, 0, 16);
+        READ_UE_MAX (&nr, slice->num_long_term_pics, 16);
         limit = slice->num_long_term_sps + slice->num_long_term_pics;
         for (i = 0; i < limit; i++) {
           if (i < slice->num_long_term_sps) {
@@ -2074,9 +2064,9 @@
       READ_UINT8 (&nr, slice->num_ref_idx_active_override_flag, 1);
 
       if (slice->num_ref_idx_active_override_flag) {
-        READ_UE_ALLOWED (&nr, slice->num_ref_idx_l0_active_minus1, 0, 14);
+        READ_UE_MAX (&nr, slice->num_ref_idx_l0_active_minus1, 14);
         if (GST_H265_IS_B_SLICE (slice))
-          READ_UE_ALLOWED (&nr, slice->num_ref_idx_l1_active_minus1, 0, 14);
+          READ_UE_MAX (&nr, slice->num_ref_idx_l1_active_minus1, 14);
       } else {
         /*set default values */
         slice->num_ref_idx_l0_active_minus1 =
@@ -2126,11 +2116,11 @@
           if ((GST_H265_IS_P_SLICE (slice))
               || ((GST_H265_IS_B_SLICE (slice))
                   && (slice->collocated_from_l0_flag))) {
-            READ_UE_ALLOWED (&nr, slice->collocated_ref_idx, 0,
+            READ_UE_MAX (&nr, slice->collocated_ref_idx,
                 slice->num_ref_idx_l0_active_minus1);
           } else if ((GST_H265_IS_B_SLICE (slice))
               && (!slice->collocated_from_l0_flag)) {
-            READ_UE_ALLOWED (&nr, slice->collocated_ref_idx, 0,
+            READ_UE_MAX (&nr, slice->collocated_ref_idx,
                 slice->num_ref_idx_l1_active_minus1);
           }
         }
@@ -2139,7 +2129,7 @@
           (pps->weighted_bipred_flag && GST_H265_IS_B_SLICE (slice)))
         if (!gst_h265_slice_parse_pred_weight_table (slice, &nr))
           goto error;
-      READ_UE_ALLOWED (&nr, slice->five_minus_max_num_merge_cand, 0, 4);
+      READ_UE_MAX (&nr, slice->five_minus_max_num_merge_cand, 4);
     }
 
     READ_SE_ALLOWED (&nr, slice->qp_delta, -87, 77);
@@ -2176,9 +2166,9 @@
     else
       offset_max = (pps->num_tile_columns_minus1 + 1) * PicHeightInCtbsY - 1;
 
-    READ_UE_ALLOWED (&nr, slice->num_entry_point_offsets, 0, offset_max);
+    READ_UE_MAX (&nr, slice->num_entry_point_offsets, offset_max);
     if (slice->num_entry_point_offsets > 0) {
-      READ_UE_ALLOWED (&nr, slice->offset_len_minus1, 0, 31);
+      READ_UE_MAX (&nr, slice->offset_len_minus1, 31);
       slice->entry_point_offset_minus1 =
           g_new0 (guint32, slice->num_entry_point_offsets);
       for (i = 0; i < slice->num_entry_point_offsets; i++)
@@ -2189,7 +2179,7 @@
 
   if (pps->slice_segment_header_extension_present_flag) {
     guint16 slice_segment_header_extension_length;
-    READ_UE_ALLOWED (&nr, slice_segment_header_extension_length, 0, 256);
+    READ_UE_MAX (&nr, slice_segment_header_extension_length, 256);
     for (i = 0; i < slice_segment_header_extension_length; i++)
       if (!nal_reader_skip (&nr, 8))
         goto error;
diff --git a/gst-libs/gst/codecparsers/gstmpeg4parser.c b/gst-libs/gst/codecparsers/gstmpeg4parser.c
index 4bf63e5..7dbc811 100644
--- a/gst-libs/gst/codecparsers/gstmpeg4parser.c
+++ b/gst-libs/gst/codecparsers/gstmpeg4parser.c
@@ -123,21 +123,21 @@
 };
 
 static const VLCTable mpeg4_dmv_size_vlc_table[] = {
-  {0x00, 2, 0},
-  {0x02, 3, 1},
-  {0x03, 3, 2},
-  {0x04, 3, 3},
-  {0x05, 3, 4},
-  {0x06, 3, 5},
-  {0x0e, 4, 6},
-  {0x1e, 5, 7},
-  {0x3e, 6, 8},
-  {0x7e, 7, 9},
-  {0xfe, 8, 10},
-  {0x1fe, 9, 11},
-  {0x3fe, 10, 12},
-  {0x7fe, 11, 13},
-  {0xffe, 12, 14}
+  {0, 0x00, 2},
+  {1, 0x02, 3},
+  {2, 0x03, 3},
+  {3, 0x04, 3},
+  {4, 0x05, 3},
+  {5, 0x06, 3},
+  {6, 0x0e, 4},
+  {7, 0x1e, 5},
+  {8, 0x3e, 6},
+  {9, 0x7e, 7},
+  {10, 0xfe, 8},
+  {11, 0x1fe, 9},
+  {12, 0x3fe, 10},
+  {13, 0x7fe, 11},
+  {14, 0xffe, 12}
 };
 
 static void
@@ -347,7 +347,7 @@
     }
   }
 
-  return off++;                 /* Take the following 1 into account */
+  return off;
 }
 
 /**
diff --git a/gst-libs/gst/codecparsers/gstvc1parser.c b/gst-libs/gst/codecparsers/gstvc1parser.c
index 081e813..fd16ee0 100644
--- a/gst-libs/gst/codecparsers/gstvc1parser.c
+++ b/gst-libs/gst/codecparsers/gstvc1parser.c
@@ -242,7 +242,7 @@
   gint par_n, par_d;
 } PAR;
 
-static PAR aspect_ratios[] = {
+static const PAR aspect_ratios[] = {
   {0, 0},
   {1, 1},
   {12, 11},
diff --git a/gst-libs/gst/codecparsers/nalutils.h b/gst-libs/gst/codecparsers/nalutils.h
index 87a4b33..11cbe7a 100644
--- a/gst-libs/gst/codecparsers/nalutils.h
+++ b/gst-libs/gst/codecparsers/nalutils.h
@@ -80,6 +80,14 @@
 gboolean nal_reader_get_ue (NalReader * nr, guint32 * val);
 gboolean nal_reader_get_se (NalReader * nr, gint32 * val);
 
+#define CHECK_ALLOWED_MAX(val, max) { \
+  if (val > max) { \
+    GST_WARNING ("value greater than max. value: %d, max %d", \
+                     val, max); \
+    goto error; \
+  } \
+}
+
 #define CHECK_ALLOWED(val, min, max) { \
   if (val < min || val > max) { \
     GST_WARNING ("value not in allowed range. value: %d, range %d-%d", \
@@ -130,6 +138,13 @@
   val = tmp; \
 }
 
+#define READ_UE_MAX(nr, val, max) { \
+  guint32 tmp; \
+  READ_UE (nr, tmp); \
+  CHECK_ALLOWED_MAX (tmp, max); \
+  val = tmp; \
+}
+
 #define READ_SE(nr, val) { \
   if (!nal_reader_get_se (nr, &val)) { \
     GST_WARNING ("failed to read SE"); \
diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
index ed35144..fcf318d 100644
--- a/gst-libs/gst/gl/Makefile.am
+++ b/gst-libs/gst/gl/Makefile.am
@@ -6,7 +6,7 @@
 
 noinst_HEADERS =
 
-built_header_configure = gstglconfig.h
+built_sys_header_configure = gstglconfig.h
 
 libgstgl_@GST_API_VERSION@_la_SOURCES = \
 	gstgldisplay.c \
@@ -14,6 +14,7 @@
 	gstglmemory.c \
 	gstglbufferpool.c \
 	gstglfilter.c \
+	gstglbasefilter.c \
         gstglshader.c \
         gstglshadervariables.c \
         gstglcolorconvert.c \
@@ -24,7 +25,8 @@
         gstglapi.c \
         gstglfeature.c \
         gstglutils.c \
-        gstglframebuffer.c
+        gstglframebuffer.c \
+        gstglsyncmeta.c
 
 libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
 libgstgl_@GST_API_VERSION@include_HEADERS = \
@@ -34,6 +36,7 @@
 	gstglmemory.h \
 	gstglbufferpool.h \
 	gstglfilter.h \
+	gstglbasefilter.h \
 	gstglshadervariables.h \
 	gstglshader.h \
 	gstglcolorconvert.h \
@@ -44,6 +47,7 @@
 	gstglfeature.h \
 	gstglutils.h \
 	gstglframebuffer.h \
+	gstglsyncmeta.h \
 	gstgl_fwd.h \
 	gl.h
 
@@ -95,8 +99,8 @@
 libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la
 endif
 
-nodist_libgstgl_@GST_API_VERSION@include_HEADERS = \
-	$(built_header_configure)
+configexecincludedir = $(libdir)/gstreamer-@GST_API_VERSION@/include/gst/gl
+nodist_configexecinclude_HEADERS = $(built_sys_header_configure)
 
 libgstgl_@GST_API_VERSION@_la_CFLAGS = \
 	-I$(top_srcdir)/gst-libs \
@@ -113,4 +117,58 @@
 	$(GST_LT_LDFLAGS)
 
 # DISTCLEANFILES is for files generated by configure
-DISTCLEANFILES = $(built_header_configure)
+DISTCLEANFILES = $(built_sys_header_configure)
+
+if HAVE_INTROSPECTION
+BUILT_GIRSOURCES = GstGL-@GST_API_VERSION@.gir
+
+gir_headers=$(patsubst %,$(srcdir)/%, $(libgstgl_@GST_API_VERSION@include_HEADERS))
+gir_sources=$(patsubst %,$(srcdir)/%, $(libgstgl_@GST_API_VERSION@_la_SOURCES))
+
+GstGL-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstgl-@GST_API_VERSION@.la
+	$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
+		GST_PLUGIN_SYSTEM_PATH_1_0="" GST_PLUGIN_PATH_1_0="" GST_REGISTRY_UPDATE=no \
+		$(INTROSPECTION_SCANNER) -v --namespace GstGL \
+		--nsversion=@GST_API_VERSION@ \
+		--strip-prefix=Gst \
+		--warn-all \
+		--c-include "gst/gl/gl.h" \
+		-I$(top_srcdir)/gst-libs \
+		-I$(top_builddir)/gst-libs \
+		$(GST_PLUGINS_BASE_CFLAGS) \
+		--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
+		--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
+		--library=libgstgl-@GST_API_VERSION@.la \
+		--include=Gst-@GST_API_VERSION@ \
+		--include=GstBase-@GST_API_VERSION@ \
+		--libtool="$(top_builddir)/libtool" \
+		--pkg gstreamer-@GST_API_VERSION@ \
+		--pkg gstreamer-base-@GST_API_VERSION@ \
+		--pkg gstreamer-video-@GST_API_VERSION@ \
+		--pkg-export gstreamer-gl-@GST_API_VERSION@ \
+		--add-init-section="gst_init(NULL,NULL);" \
+		-DGST_USE_UNSTABLE_API \
+		--output $@ \
+		$(gir_headers) \
+		$(gir_sources)
+
+# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
+# install anything - we need to install inside our prefix.
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(BUILT_GIRSOURCES)
+
+typelibsdir = $(libdir)/girepository-1.0/
+
+typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
+
+%.typelib: %.gir $(INTROSPECTION_COMPILER)
+	$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
+		$(INTROSPECTION_COMPILER) \
+		--includedir=$(srcdir) \
+		--includedir=$(builddir) \
+		--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
+		--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
+		$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
+
+CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
+endif
diff --git a/gst-libs/gst/gl/Makefile.in b/gst-libs/gst/gl/Makefile.in
index 433b7fa..4200a7a 100644
--- a/gst-libs/gst/gl/Makefile.in
+++ b/gst-libs/gst/gl/Makefile.in
@@ -15,6 +15,7 @@
 @SET_MAKE@
 
 
+
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -107,6 +108,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -120,7 +122,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -168,9 +169,10 @@
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(libdir)" \
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \
+	"$(DESTDIR)$(typelibsdir)" \
 	"$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)" \
-	"$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)"
+	"$(DESTDIR)$(configexecincludedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libgstgl_@GST_API_VERSION@_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@@ -185,6 +187,7 @@
 	libgstgl_@GST_API_VERSION@_la-gstglmemory.lo \
 	libgstgl_@GST_API_VERSION@_la-gstglbufferpool.lo \
 	libgstgl_@GST_API_VERSION@_la-gstglfilter.lo \
+	libgstgl_@GST_API_VERSION@_la-gstglbasefilter.lo \
 	libgstgl_@GST_API_VERSION@_la-gstglshader.lo \
 	libgstgl_@GST_API_VERSION@_la-gstglshadervariables.lo \
 	libgstgl_@GST_API_VERSION@_la-gstglcolorconvert.lo \
@@ -195,7 +198,8 @@
 	libgstgl_@GST_API_VERSION@_la-gstglapi.lo \
 	libgstgl_@GST_API_VERSION@_la-gstglfeature.lo \
 	libgstgl_@GST_API_VERSION@_la-gstglutils.lo \
-	libgstgl_@GST_API_VERSION@_la-gstglframebuffer.lo
+	libgstgl_@GST_API_VERSION@_la-gstglframebuffer.lo \
+	libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.lo
 libgstgl_@GST_API_VERSION@_la_OBJECTS =  \
 	$(am_libgstgl_@GST_API_VERSION@_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
@@ -255,9 +259,9 @@
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+DATA = $(gir_DATA) $(typelibs_DATA)
 HEADERS = $(libgstgl_@GST_API_VERSION@include_HEADERS) \
-	$(nodist_libgstgl_@GST_API_VERSION@include_HEADERS) \
-	$(noinst_HEADERS)
+	$(nodist_configexecinclude_HEADERS) $(noinst_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 am__recursive_targets = \
@@ -327,8 +331,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -367,7 +375,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -375,6 +382,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -424,8 +433,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -504,7 +511,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -513,7 +519,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -526,7 +531,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -551,6 +555,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -624,10 +630,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -653,6 +663,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -689,6 +702,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -729,17 +743,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -756,6 +769,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -813,13 +827,14 @@
 	$(am__append_13) $(am__append_15)
 DIST_SUBDIRS = glprototypes android x11 win32 cocoa wayland dispmanx egl eagl
 noinst_HEADERS = 
-built_header_configure = gstglconfig.h
+built_sys_header_configure = gstglconfig.h
 libgstgl_@GST_API_VERSION@_la_SOURCES = \
 	gstgldisplay.c \
 	gstglcontext.c \
 	gstglmemory.c \
 	gstglbufferpool.c \
 	gstglfilter.c \
+	gstglbasefilter.c \
         gstglshader.c \
         gstglshadervariables.c \
         gstglcolorconvert.c \
@@ -830,7 +845,8 @@
         gstglapi.c \
         gstglfeature.c \
         gstglutils.c \
-        gstglframebuffer.c
+        gstglframebuffer.c \
+        gstglsyncmeta.c
 
 libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
 libgstgl_@GST_API_VERSION@include_HEADERS = \
@@ -840,6 +856,7 @@
 	gstglmemory.h \
 	gstglbufferpool.h \
 	gstglfilter.h \
+	gstglbasefilter.h \
 	gstglshadervariables.h \
 	gstglshader.h \
 	gstglcolorconvert.h \
@@ -850,6 +867,7 @@
 	gstglfeature.h \
 	gstglutils.h \
 	gstglframebuffer.h \
+	gstglsyncmeta.h \
 	gstgl_fwd.h \
 	gl.h
 
@@ -859,9 +877,8 @@
 	$(am__append_4) $(am__append_6) $(am__append_8) \
 	$(am__append_10) $(am__append_12) $(am__append_14) \
 	$(am__append_16)
-nodist_libgstgl_@GST_API_VERSION@include_HEADERS = \
-	$(built_header_configure)
-
+configexecincludedir = $(libdir)/gstreamer-@GST_API_VERSION@/include/gst/gl
+nodist_configexecinclude_HEADERS = $(built_sys_header_configure)
 libgstgl_@GST_API_VERSION@_la_CFLAGS = \
 	-I$(top_srcdir)/gst-libs \
 	-I$(top_builddir)/gst-libs \
@@ -878,7 +895,18 @@
 
 
 # DISTCLEANFILES is for files generated by configure
-DISTCLEANFILES = $(built_header_configure)
+DISTCLEANFILES = $(built_sys_header_configure)
+@HAVE_INTROSPECTION_TRUE@BUILT_GIRSOURCES = GstGL-@GST_API_VERSION@.gir
+@HAVE_INTROSPECTION_TRUE@gir_headers = $(patsubst %,$(srcdir)/%, $(libgstgl_@GST_API_VERSION@include_HEADERS))
+@HAVE_INTROSPECTION_TRUE@gir_sources = $(patsubst %,$(srcdir)/%, $(libgstgl_@GST_API_VERSION@_la_SOURCES))
+
+# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
+# install anything - we need to install inside our prefix.
+@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0
+@HAVE_INTROSPECTION_TRUE@gir_DATA = $(BUILT_GIRSOURCES)
+@HAVE_INTROSPECTION_TRUE@typelibsdir = $(libdir)/girepository-1.0/
+@HAVE_INTROSPECTION_TRUE@typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
+@HAVE_INTROSPECTION_TRUE@CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
 all: all-recursive
 
 .SUFFIXES:
@@ -959,6 +987,7 @@
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglapi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglbasefilter.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglbufferpool.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglcolorconvert.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglcontext.Plo@am__quote@
@@ -970,6 +999,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglmemory.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglshader.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglshadervariables.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglupload.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstgluploadmeta.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglutils.Plo@am__quote@
@@ -1034,6 +1064,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstgl_@GST_API_VERSION@_la-gstglfilter.lo `test -f 'gstglfilter.c' || echo '$(srcdir)/'`gstglfilter.c
 
+libgstgl_@GST_API_VERSION@_la-gstglbasefilter.lo: gstglbasefilter.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstgl_@GST_API_VERSION@_la-gstglbasefilter.lo -MD -MP -MF $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglbasefilter.Tpo -c -o libgstgl_@GST_API_VERSION@_la-gstglbasefilter.lo `test -f 'gstglbasefilter.c' || echo '$(srcdir)/'`gstglbasefilter.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglbasefilter.Tpo $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglbasefilter.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglbasefilter.c' object='libgstgl_@GST_API_VERSION@_la-gstglbasefilter.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstgl_@GST_API_VERSION@_la-gstglbasefilter.lo `test -f 'gstglbasefilter.c' || echo '$(srcdir)/'`gstglbasefilter.c
+
 libgstgl_@GST_API_VERSION@_la-gstglshader.lo: gstglshader.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstgl_@GST_API_VERSION@_la-gstglshader.lo -MD -MP -MF $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglshader.Tpo -c -o libgstgl_@GST_API_VERSION@_la-gstglshader.lo `test -f 'gstglshader.c' || echo '$(srcdir)/'`gstglshader.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglshader.Tpo $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglshader.Plo
@@ -1111,11 +1148,60 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstgl_@GST_API_VERSION@_la-gstglframebuffer.lo `test -f 'gstglframebuffer.c' || echo '$(srcdir)/'`gstglframebuffer.c
 
+libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.lo: gstglsyncmeta.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.lo -MD -MP -MF $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.Tpo -c -o libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.lo `test -f 'gstglsyncmeta.c' || echo '$(srcdir)/'`gstglsyncmeta.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.Tpo $(DEPDIR)/libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstglsyncmeta.c' object='libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstgl_@GST_API_VERSION@_la-gstglsyncmeta.lo `test -f 'gstglsyncmeta.c' || echo '$(srcdir)/'`gstglsyncmeta.c
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-girDATA: $(gir_DATA)
+	@$(NORMAL_INSTALL)
+	@list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \
+	done
+
+uninstall-girDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(gir_DATA)'; test -n "$(girdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir)
+install-typelibsDATA: $(typelibs_DATA)
+	@$(NORMAL_INSTALL)
+	@list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(typelibsdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(typelibsdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibsdir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibsdir)" || exit $$?; \
+	done
+
+uninstall-typelibsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(typelibsdir)'; $(am__uninstall_files_from_dir)
 install-libgstgl_@GST_API_VERSION@includeHEADERS: $(libgstgl_@GST_API_VERSION@include_HEADERS)
 	@$(NORMAL_INSTALL)
 	@list='$(libgstgl_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstgl_@GST_API_VERSION@includedir)" || list=; \
@@ -1137,27 +1223,27 @@
 	@list='$(libgstgl_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstgl_@GST_API_VERSION@includedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	dir='$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)'; $(am__uninstall_files_from_dir)
-install-nodist_libgstgl_@GST_API_VERSION@includeHEADERS: $(nodist_libgstgl_@GST_API_VERSION@include_HEADERS)
+install-nodist_configexecincludeHEADERS: $(nodist_configexecinclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	@list='$(nodist_libgstgl_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstgl_@GST_API_VERSION@includedir)" || list=; \
+	@list='$(nodist_configexecinclude_HEADERS)'; test -n "$(configexecincludedir)" || list=; \
 	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)" || exit 1; \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(configexecincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(configexecincludedir)" || exit 1; \
 	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
 	done | $(am__base_list) | \
 	while read files; do \
-	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)'"; \
-	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)" || exit $$?; \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(configexecincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(configexecincludedir)" || exit $$?; \
 	done
 
-uninstall-nodist_libgstgl_@GST_API_VERSION@includeHEADERS:
+uninstall-nodist_configexecincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
-	@list='$(nodist_libgstgl_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstgl_@GST_API_VERSION@includedir)" || list=; \
+	@list='$(nodist_configexecinclude_HEADERS)'; test -n "$(configexecincludedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)'; $(am__uninstall_files_from_dir)
+	dir='$(DESTDIR)$(configexecincludedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
@@ -1315,10 +1401,10 @@
 	done
 check-am: all-am
 check: check-recursive
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
 installdirs: installdirs-recursive
 installdirs-am:
-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)" "$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)"; do \
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(typelibsdir)" "$(DESTDIR)$(libgstgl_@GST_API_VERSION@includedir)" "$(DESTDIR)$(configexecincludedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-recursive
@@ -1343,6 +1429,7 @@
 mostlyclean-generic:
 
 clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -1375,14 +1462,16 @@
 
 info-am:
 
-install-data-am: install-libgstgl_@GST_API_VERSION@includeHEADERS \
-	install-nodist_libgstgl_@GST_API_VERSION@includeHEADERS
+install-data-am: install-girDATA \
+	install-libgstgl_@GST_API_VERSION@includeHEADERS \
+	install-typelibsDATA
 
 install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
-install-exec-am: install-libLTLIBRARIES
+install-exec-am: install-libLTLIBRARIES \
+	install-nodist_configexecincludeHEADERS
 
 install-html: install-html-recursive
 
@@ -1422,9 +1511,10 @@
 
 ps-am:
 
-uninstall-am: uninstall-libLTLIBRARIES \
+uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \
 	uninstall-libgstgl_@GST_API_VERSION@includeHEADERS \
-	uninstall-nodist_libgstgl_@GST_API_VERSION@includeHEADERS
+	uninstall-nodist_configexecincludeHEADERS \
+	uninstall-typelibsDATA
 
 .MAKE: $(am__recursive_targets) install-am install-strip
 
@@ -1434,21 +1524,58 @@
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am \
+	install-dvi-am install-exec install-exec-am install-girDATA \
+	install-html install-html-am install-info install-info-am \
 	install-libLTLIBRARIES \
 	install-libgstgl_@GST_API_VERSION@includeHEADERS install-man \
-	install-nodist_libgstgl_@GST_API_VERSION@includeHEADERS \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
+	install-nodist_configexecincludeHEADERS install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	install-typelibsDATA installcheck installcheck-am installdirs \
 	installdirs-am maintainer-clean maintainer-clean-generic \
 	mostlyclean mostlyclean-compile mostlyclean-generic \
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am uninstall-libLTLIBRARIES \
+	uninstall-am uninstall-girDATA uninstall-libLTLIBRARIES \
 	uninstall-libgstgl_@GST_API_VERSION@includeHEADERS \
-	uninstall-nodist_libgstgl_@GST_API_VERSION@includeHEADERS
+	uninstall-nodist_configexecincludeHEADERS \
+	uninstall-typelibsDATA
 
 
+@HAVE_INTROSPECTION_TRUE@GstGL-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstgl-@GST_API_VERSION@.la
+@HAVE_INTROSPECTION_TRUE@	$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
+@HAVE_INTROSPECTION_TRUE@		GST_PLUGIN_SYSTEM_PATH_1_0="" GST_PLUGIN_PATH_1_0="" GST_REGISTRY_UPDATE=no \
+@HAVE_INTROSPECTION_TRUE@		$(INTROSPECTION_SCANNER) -v --namespace GstGL \
+@HAVE_INTROSPECTION_TRUE@		--nsversion=@GST_API_VERSION@ \
+@HAVE_INTROSPECTION_TRUE@		--strip-prefix=Gst \
+@HAVE_INTROSPECTION_TRUE@		--warn-all \
+@HAVE_INTROSPECTION_TRUE@		--c-include "gst/gl/gl.h" \
+@HAVE_INTROSPECTION_TRUE@		-I$(top_srcdir)/gst-libs \
+@HAVE_INTROSPECTION_TRUE@		-I$(top_builddir)/gst-libs \
+@HAVE_INTROSPECTION_TRUE@		$(GST_PLUGINS_BASE_CFLAGS) \
+@HAVE_INTROSPECTION_TRUE@		--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
+@HAVE_INTROSPECTION_TRUE@		--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
+@HAVE_INTROSPECTION_TRUE@		--library=libgstgl-@GST_API_VERSION@.la \
+@HAVE_INTROSPECTION_TRUE@		--include=Gst-@GST_API_VERSION@ \
+@HAVE_INTROSPECTION_TRUE@		--include=GstBase-@GST_API_VERSION@ \
+@HAVE_INTROSPECTION_TRUE@		--libtool="$(top_builddir)/libtool" \
+@HAVE_INTROSPECTION_TRUE@		--pkg gstreamer-@GST_API_VERSION@ \
+@HAVE_INTROSPECTION_TRUE@		--pkg gstreamer-base-@GST_API_VERSION@ \
+@HAVE_INTROSPECTION_TRUE@		--pkg gstreamer-video-@GST_API_VERSION@ \
+@HAVE_INTROSPECTION_TRUE@		--pkg-export gstreamer-gl-@GST_API_VERSION@ \
+@HAVE_INTROSPECTION_TRUE@		--add-init-section="gst_init(NULL,NULL);" \
+@HAVE_INTROSPECTION_TRUE@		-DGST_USE_UNSTABLE_API \
+@HAVE_INTROSPECTION_TRUE@		--output $@ \
+@HAVE_INTROSPECTION_TRUE@		$(gir_headers) \
+@HAVE_INTROSPECTION_TRUE@		$(gir_sources)
+
+@HAVE_INTROSPECTION_TRUE@%.typelib: %.gir $(INTROSPECTION_COMPILER)
+@HAVE_INTROSPECTION_TRUE@	$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
+@HAVE_INTROSPECTION_TRUE@		$(INTROSPECTION_COMPILER) \
+@HAVE_INTROSPECTION_TRUE@		--includedir=$(srcdir) \
+@HAVE_INTROSPECTION_TRUE@		--includedir=$(builddir) \
+@HAVE_INTROSPECTION_TRUE@		--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
+@HAVE_INTROSPECTION_TRUE@		--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
+@HAVE_INTROSPECTION_TRUE@		$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/gst-libs/gst/gl/android/Makefile.in b/gst-libs/gst/gl/android/Makefile.in
index 0a84ca4..beb0c43 100644
--- a/gst-libs/gst/gl/android/Makefile.in
+++ b/gst-libs/gst/gl/android/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -243,8 +243,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -283,7 +287,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -291,6 +294,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -340,8 +345,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -420,7 +423,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -429,7 +431,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -442,7 +443,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -467,6 +467,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -540,10 +542,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -569,6 +575,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -605,6 +614,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -645,17 +655,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -672,6 +681,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/gl/android/gstglwindow_android_egl.c b/gst-libs/gst/gl/android/gstglwindow_android_egl.c
index 1a70999..f3c5436 100644
--- a/gst-libs/gst/gl/android/gstglwindow_android_egl.c
+++ b/gst-libs/gst/gl/android/gstglwindow_android_egl.c
@@ -38,14 +38,14 @@
 #define gst_gl_window_android_egl_parent_class parent_class
 G_DEFINE_TYPE (GstGLWindowAndroidEGL, gst_gl_window_android_egl,
     GST_GL_TYPE_WINDOW);
+static void gst_gl_window_android_egl_finalize (GObject * object);
 
 static guintptr gst_gl_window_android_egl_get_display (GstGLWindow * window);
 static guintptr gst_gl_window_android_egl_get_window_handle (GstGLWindow *
     window);
 static void gst_gl_window_android_egl_set_window_handle (GstGLWindow * window,
     guintptr handle);
-static void gst_gl_window_android_egl_draw (GstGLWindow * window, guint width,
-    guint height);
+static void gst_gl_window_android_egl_draw (GstGLWindow * window);
 static void gst_gl_window_android_egl_run (GstGLWindow * window);
 static void gst_gl_window_android_egl_quit (GstGLWindow * window);
 static void gst_gl_window_android_egl_send_message_async (GstGLWindow * window,
@@ -58,6 +58,7 @@
 gst_gl_window_android_egl_class_init (GstGLWindowAndroidEGLClass * klass)
 {
   GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
+  GObjectClass *gobject_class = (GObjectClass *) klass;
 
   window_class->get_display =
       GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_display);
@@ -74,11 +75,26 @@
       GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_send_message_async);
   window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_open);
   window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_close);
+
+  gobject_class->finalize = gst_gl_window_android_egl_finalize;
 }
 
 static void
 gst_gl_window_android_egl_init (GstGLWindowAndroidEGL * window)
 {
+  window->main_context = g_main_context_new ();
+  window->loop = g_main_loop_new (window->main_context, FALSE);
+}
+
+static void
+gst_gl_window_android_egl_finalize (GObject * object)
+{
+  GstGLWindowAndroidEGL *window_egl = GST_GL_WINDOW_ANDROID_EGL (object);
+
+  g_main_loop_unref (window_egl->loop);
+  g_main_context_unref (window_egl->main_context);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 /* Must be called in the gl thread */
@@ -97,25 +113,12 @@
 static gboolean
 gst_gl_window_android_egl_open (GstGLWindow * window, GError ** error)
 {
-  GstGLWindowAndroidEGL *window_egl;
-
-  window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
-
-  window_egl->main_context = g_main_context_new ();
-  window_egl->loop = g_main_loop_new (window_egl->main_context, FALSE);
-
   return TRUE;
 }
 
 static void
 gst_gl_window_android_egl_close (GstGLWindow * window)
 {
-  GstGLWindowAndroidEGL *window_egl;
-
-  window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
-
-  g_main_loop_unref (window_egl->loop);
-  g_main_context_unref (window_egl->main_context);
 }
 
 static void
@@ -200,17 +203,10 @@
   return (guintptr) window_egl->native_window;
 }
 
-struct draw
-{
-  GstGLWindowAndroidEGL *window;
-  guint width, height;
-};
-
 static void
 draw_cb (gpointer data)
 {
-  struct draw *draw_data = data;
-  GstGLWindowAndroidEGL *window_egl = draw_data->window;
+  GstGLWindowAndroidEGL *window_egl = data;
   GstGLWindow *window = GST_GL_WINDOW (window_egl);
   GstGLContext *context = gst_gl_window_get_context (window);
   GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
@@ -242,16 +238,9 @@
 }
 
 static void
-gst_gl_window_android_egl_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_window_android_egl_draw (GstGLWindow * window)
 {
-  struct draw draw_data;
-  GstGLWindowAndroidEGL *window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
-
-  draw_data.window = window_egl;
-  draw_data.width = width;
-  draw_data.height = height;
-
-  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
 }
 
 static guintptr
diff --git a/gst-libs/gst/gl/cocoa/Makefile.am b/gst-libs/gst/gl/cocoa/Makefile.am
index b374079..f45583d 100644
--- a/gst-libs/gst/gl/cocoa/Makefile.am
+++ b/gst-libs/gst/gl/cocoa/Makefile.am
@@ -4,13 +4,20 @@
 
 libgstgl_cocoa_la_SOURCES = \
 	gstglwindow_cocoa.m \
-	gstglcontext_cocoa.m
+	gstglcontext_cocoa.m \
+	gstgldisplay_cocoa.m \
+	gstglcaopengllayer.m
 
 noinst_HEADERS = \
+	gstgldisplay_cocoa.h \
 	gstglwindow_cocoa.h \
-	gstglcontext_cocoa.h \
 	gstgl_cocoa_private.h
 
+libgstgl_cocoaincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/cocoa
+libgstgl_cocoainclude_HEADERS = \
+	gstglcontext_cocoa.h \
+	gstglcaopengllayer.h
+
 libgstgl_cocoa_la_CFLAGS = \
 	-I$(top_srcdir)/gst-libs \
 	-I$(top_builddir)/gst-libs \
diff --git a/gst-libs/gst/gl/cocoa/Makefile.in b/gst-libs/gst/gl/cocoa/Makefile.in
index 98532d4..96d2aec 100644
--- a/gst-libs/gst/gl/cocoa/Makefile.in
+++ b/gst-libs/gst/gl/cocoa/Makefile.in
@@ -82,7 +82,8 @@
 target_triplet = @target@
 subdir = gst-libs/gst/gl/cocoa
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/depcomp $(noinst_HEADERS)
+	$(top_srcdir)/depcomp $(libgstgl_cocoainclude_HEADERS) \
+	$(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
 	$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -90,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -127,7 +128,9 @@
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgstgl_cocoa_la_LIBADD =
 am_libgstgl_cocoa_la_OBJECTS = libgstgl_cocoa_la-gstglwindow_cocoa.lo \
-	libgstgl_cocoa_la-gstglcontext_cocoa.lo
+	libgstgl_cocoa_la-gstglcontext_cocoa.lo \
+	libgstgl_cocoa_la-gstgldisplay_cocoa.lo \
+	libgstgl_cocoa_la-gstglcaopengllayer.lo
 libgstgl_cocoa_la_OBJECTS = $(am_libgstgl_cocoa_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -178,7 +181,35 @@
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
-HEADERS = $(noinst_HEADERS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libgstgl_cocoaincludedir)"
+HEADERS = $(libgstgl_cocoainclude_HEADERS) $(noinst_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -215,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -255,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -263,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -312,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -392,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -401,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -414,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -439,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -512,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -541,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -577,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -617,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -644,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -698,13 +739,20 @@
 noinst_LTLIBRARIES = libgstgl-cocoa.la
 libgstgl_cocoa_la_SOURCES = \
 	gstglwindow_cocoa.m \
-	gstglcontext_cocoa.m
+	gstglcontext_cocoa.m \
+	gstgldisplay_cocoa.m \
+	gstglcaopengllayer.m
 
 noinst_HEADERS = \
+	gstgldisplay_cocoa.h \
 	gstglwindow_cocoa.h \
-	gstglcontext_cocoa.h \
 	gstgl_cocoa_private.h
 
+libgstgl_cocoaincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/cocoa
+libgstgl_cocoainclude_HEADERS = \
+	gstglcontext_cocoa.h \
+	gstglcaopengllayer.h
+
 libgstgl_cocoa_la_CFLAGS = \
 	-I$(top_srcdir)/gst-libs \
 	-I$(top_builddir)/gst-libs \
@@ -781,7 +829,9 @@
 distclean-compile:
 	-rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_cocoa_la-gstglcaopengllayer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_cocoa_la-gstglcontext_cocoa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_cocoa_la-gstgldisplay_cocoa.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstgl_cocoa_la-gstglwindow_cocoa.Plo@am__quote@
 
 .m.o:
@@ -822,11 +872,46 @@
 @AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstgl_cocoa_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_cocoa_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstgl_cocoa_la-gstglcontext_cocoa.lo `test -f 'gstglcontext_cocoa.m' || echo '$(srcdir)/'`gstglcontext_cocoa.m
 
+libgstgl_cocoa_la-gstgldisplay_cocoa.lo: gstgldisplay_cocoa.m
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(LIBTOOL) $(AM_V_lt) $(libgstgl_cocoa_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_cocoa_la_OBJCFLAGS) $(OBJCFLAGS) -MT libgstgl_cocoa_la-gstgldisplay_cocoa.lo -MD -MP -MF $(DEPDIR)/libgstgl_cocoa_la-gstgldisplay_cocoa.Tpo -c -o libgstgl_cocoa_la-gstgldisplay_cocoa.lo `test -f 'gstgldisplay_cocoa.m' || echo '$(srcdir)/'`gstgldisplay_cocoa.m
+@am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstgl_cocoa_la-gstgldisplay_cocoa.Tpo $(DEPDIR)/libgstgl_cocoa_la-gstgldisplay_cocoa.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='gstgldisplay_cocoa.m' object='libgstgl_cocoa_la-gstgldisplay_cocoa.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstgl_cocoa_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_cocoa_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstgl_cocoa_la-gstgldisplay_cocoa.lo `test -f 'gstgldisplay_cocoa.m' || echo '$(srcdir)/'`gstgldisplay_cocoa.m
+
+libgstgl_cocoa_la-gstglcaopengllayer.lo: gstglcaopengllayer.m
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(LIBTOOL) $(AM_V_lt) $(libgstgl_cocoa_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_cocoa_la_OBJCFLAGS) $(OBJCFLAGS) -MT libgstgl_cocoa_la-gstglcaopengllayer.lo -MD -MP -MF $(DEPDIR)/libgstgl_cocoa_la-gstglcaopengllayer.Tpo -c -o libgstgl_cocoa_la-gstglcaopengllayer.lo `test -f 'gstglcaopengllayer.m' || echo '$(srcdir)/'`gstglcaopengllayer.m
+@am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstgl_cocoa_la-gstglcaopengllayer.Tpo $(DEPDIR)/libgstgl_cocoa_la-gstglcaopengllayer.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='gstglcaopengllayer.m' object='libgstgl_cocoa_la-gstglcaopengllayer.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstgl_cocoa_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstgl_cocoa_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstgl_cocoa_la-gstglcaopengllayer.lo `test -f 'gstglcaopengllayer.m' || echo '$(srcdir)/'`gstglcaopengllayer.m
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-libgstgl_cocoaincludeHEADERS: $(libgstgl_cocoainclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	@list='$(libgstgl_cocoainclude_HEADERS)'; test -n "$(libgstgl_cocoaincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libgstgl_cocoaincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libgstgl_cocoaincludedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libgstgl_cocoaincludedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libgstgl_cocoaincludedir)" || exit $$?; \
+	done
+
+uninstall-libgstgl_cocoaincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(libgstgl_cocoainclude_HEADERS)'; test -n "$(libgstgl_cocoaincludedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(libgstgl_cocoaincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -914,6 +999,9 @@
 check: check-am
 all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
+	for dir in "$(DESTDIR)$(libgstgl_cocoaincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -967,7 +1055,7 @@
 
 info-am:
 
-install-data-am:
+install-data-am: install-libgstgl_cocoaincludeHEADERS
 
 install-dvi: install-dvi-am
 
@@ -1013,7 +1101,7 @@
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-libgstgl_cocoaincludeHEADERS
 
 .MAKE: install-am install-strip
 
@@ -1024,12 +1112,13 @@
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
 	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-am uninstall uninstall-am
+	install-info-am install-libgstgl_cocoaincludeHEADERS \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am uninstall-libgstgl_cocoaincludeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h b/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h
index fa7178b..0ccadc8 100644
--- a/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h
+++ b/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h
@@ -27,14 +27,17 @@
 
 #include "gstglwindow_cocoa.h"
 #include "gstglcontext_cocoa.h"
+#include "gstglcaopengllayer.h"
 
 G_BEGIN_DECLS
 
 struct _GstGLContextCocoaPrivate
 {
-  NSOpenGLContext *gl_context;
-  NSOpenGLContext *external_gl_context;
-  gint source_id;
+  CGLPixelFormatObj pixel_format;
+  CGLContextObj gl_context;
+  CGLContextObj external_gl_context;
+
+  GstGLAPI context_api;
 };
 
 
@@ -45,12 +48,16 @@
 /* =============================================================*/
 
 @interface GstGLNSView: NSView {
+@public
   GstGLWindowCocoa *window_cocoa;
+  GstGLCAOpenGLLayer *layer;
 }
-- (id) initWithFrame:(GstGLWindowCocoa *)window rect:(NSRect)contentRect;
+- (id) initWithFrameLayer:(GstGLWindowCocoa *)window rect:(NSRect)contentRect layer:(CALayer *)layerContent;
 @end
 
-gboolean gst_gl_window_cocoa_create_window (GstGLWindowCocoa *window_cocoa, NSRect rect);
+gboolean gst_gl_window_cocoa_create_window (GstGLWindowCocoa *window_cocoa);
+
+void _invoke_on_main (GstGLWindowCB func, gpointer data);
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h
new file mode 100644
index 0000000..53a14d8
--- /dev/null
+++ b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h
@@ -0,0 +1,58 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_CA_OPENGL_LAYER__
+#define __GST_GL_CA_OPENGL_LAYER__
+
+#include <gst/gst.h>
+#include <gst/gl/gl.h>
+#include <Cocoa/Cocoa.h>
+
+#include <gst/gl/cocoa/gstglcontext_cocoa.h>
+
+G_BEGIN_DECLS
+
+@interface GstGLCAOpenGLLayer : CAOpenGLLayer {
+@public
+  GstGLContextCocoa *gst_gl_context;
+  CGLContextObj gl_context;
+
+@private
+  CGRect last_bounds;
+  gint expected_dims[4];
+
+  GstGLWindowCB draw_cb;
+  gpointer draw_data;
+  GDestroyNotify draw_notify;
+
+  GstGLWindowResizeCB resize_cb;
+  gpointer resize_data;
+  GDestroyNotify resize_notify;
+
+  gint can_draw;
+}
+- (void) setDrawCallback:(GstGLWindowCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
+- (void) setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
+- (id) initWithGstGLContext: (GstGLContextCocoa *)context;
+@end
+
+G_END_DECLS
+
+#endif /* __GST_GL_CA_OPENGL_LAYER__ */
diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
new file mode 100644
index 0000000..b39a161
--- /dev/null
+++ b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
@@ -0,0 +1,193 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <Cocoa/Cocoa.h>
+
+#include "gstglcaopengllayer.h"
+#include "gstgl_cocoa_private.h"
+
+@implementation GstGLCAOpenGLLayer
+- (void)dealloc {
+  if (self->draw_notify)
+    self->draw_notify (self->draw_data);
+
+  GST_TRACE ("dealloc GstGLCAOpenGLLayer %p context %p", self, self->gst_gl_context);
+
+  [super dealloc];
+}
+
+static void
+_context_ready (gpointer data)
+{
+  GstGLCAOpenGLLayer *ca_layer = data;
+
+  g_atomic_int_set (&ca_layer->can_draw, 1);
+}
+
+- (id)initWithGstGLContext:(GstGLContextCocoa *)parent_gl_context {
+  [super init];
+
+  GST_LOG ("init CAOpenGLLayer");
+
+  self->gst_gl_context = parent_gl_context;
+  self.needsDisplayOnBoundsChange = YES;
+
+  gst_gl_window_send_message_async (GST_GL_CONTEXT (parent_gl_context)->window,
+      (GstGLWindowCB) _context_ready, self, NULL);
+
+  return self;
+}
+
+- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask {
+  CGLPixelFormatObj fmt = NULL;
+
+  if (self->gst_gl_context)
+    fmt = gst_gl_context_cocoa_get_pixel_format (self->gst_gl_context);
+
+  if (!fmt) {
+    CGLPixelFormatAttribute attribs[] = {
+      kCGLPFADoubleBuffer,
+      kCGLPFAAccumSize, 32,
+      0
+    };
+    CGLError ret;
+    gint npix = 0;
+
+    GST_DEBUG ("creating new pixel format for CAOpenGLLayer %p", self);
+
+    ret = CGLChoosePixelFormat (attribs, &fmt, &npix);
+    if (ret != kCGLNoError) {
+      GST_ERROR ("CAOpenGLLayer cannot choose a pixel format: %s", CGLErrorString (ret));
+    }
+  }
+
+  return fmt;
+}
+
+- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat {
+  CGLContextObj external_context = NULL;
+  CGLError ret;
+
+  if (self->gst_gl_context)
+    external_context = (CGLContextObj) gst_gl_context_get_gl_context (GST_GL_CONTEXT (self->gst_gl_context));
+
+  GST_INFO ("attempting to create CGLContext for CAOpenGLLayer with "
+      "share context %p", external_context);
+
+  ret = CGLCreateContext (pixelFormat, external_context, &self->gl_context);
+  if (ret != kCGLNoError) {
+    GST_ERROR ("failed to create CGL context in CAOpenGLLayer with share context %p: %s", external_context, CGLErrorString(ret));
+  }
+
+  return self->gl_context;
+}
+
+- (void)releaseCGLContext:(CGLContextObj)glContext {
+  CGLReleaseContext (glContext);
+}
+
+- (void)setDrawCallback:(GstGLWindowCB)cb data:(gpointer)data
+      notify:(GDestroyNotify)notify {
+  g_return_if_fail (cb);
+
+  if (self->draw_notify)
+    self->draw_notify (self->draw_data);
+
+  self->draw_cb = cb;
+  self->draw_data = data;
+  self->draw_notify = notify;
+}
+
+- (void)setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)data
+      notify:(GDestroyNotify)notify {
+  if (self->resize_notify)
+    self->resize_notify (self->resize_notify);
+
+  self->resize_cb = cb;
+  self->resize_data = data;
+  self->resize_notify = notify;
+}
+
+- (BOOL)canDrawInCGLContext:(CGLContextObj)glContext
+               pixelFormat:(CGLPixelFormatObj)pixelFormat
+            forLayerTime:(CFTimeInterval)interval
+             displayTime:(const CVTimeStamp *)timeStamp {
+  return g_atomic_int_get (&self->can_draw);
+}
+
+- (void)drawInCGLContext:(CGLContextObj)glContext
+               pixelFormat:(CGLPixelFormatObj)pixelFormat
+            forLayerTime:(CFTimeInterval)interval
+             displayTime:(const CVTimeStamp *)timeStamp {
+  const GstGLFuncs *gl = ((GstGLContext *)self->gst_gl_context)->gl_vtable;
+  GstVideoRectangle src, dst, result;
+  gint ca_viewport[4];
+
+  GST_LOG ("CAOpenGLLayer drawing with cgl context %p", glContext);
+
+  /* attempt to get the correct viewport back due to CA being too smart
+   * and messing around with it so center the expected viewport into
+   * the CA viewport set up on entry to this function */
+  gl->GetIntegerv (GL_VIEWPORT, ca_viewport);
+
+  if (self->last_bounds.size.width != self.bounds.size.width
+      || self->last_bounds.size.height != self.bounds.size.height) {
+    if (self->resize_cb) {
+      self->resize_cb (self->resize_data, self.bounds.size.width,
+          self.bounds.size.height);
+
+      gl->GetIntegerv (GL_VIEWPORT, self->expected_dims);
+    } else {
+      /* default to whatever ca gives us */
+      self->expected_dims[0] = ca_viewport[0];
+      self->expected_dims[1] = ca_viewport[1];
+      self->expected_dims[2] = ca_viewport[2];
+      self->expected_dims[3] = ca_viewport[3];
+    }
+
+    self->last_bounds = self.bounds;
+  }
+
+  src.x = self->expected_dims[0];
+  src.y = self->expected_dims[1];
+  src.w = self->expected_dims[2];
+  src.h = self->expected_dims[3];
+
+  dst.x = ca_viewport[0];
+  dst.y = ca_viewport[1];
+  dst.w = ca_viewport[2];
+  dst.h = ca_viewport[3];
+
+  gst_video_sink_center_rect (src, dst, &result, TRUE);
+
+  gl->Viewport (result.x, result.y, result.w, result.h);
+
+  if (self->draw_cb)
+    self->draw_cb (self->draw_data);
+
+  /* flushes the buffer */
+  [super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:interval displayTime:timeStamp];
+}
+
+@end
diff --git a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h
index d7f0e04..6b79bc4 100644
--- a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h
+++ b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h
@@ -61,6 +61,10 @@
 GType gst_gl_context_cocoa_get_type (void);
 
 GstGLContextCocoa * gst_gl_context_cocoa_new (void);
+guintptr gst_gl_context_cocoa_get_current_context (void);
+CGLPixelFormatObj gst_gl_context_cocoa_get_pixel_format (GstGLContextCocoa *context);
+void gst_gl_context_cocoa_dump_pixel_format (CGLPixelFormatObj fmt);
+
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m
index 44d9d75..f2fc429 100644
--- a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m
+++ b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m
@@ -38,69 +38,16 @@
 #define GST_GL_CONTEXT_COCOA_GET_PRIVATE(o)  \
   (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_CONTEXT_COCOA, GstGLContextCocoaPrivate))
 
-G_DEFINE_TYPE (GstGLContextCocoa, gst_gl_context_cocoa, GST_GL_TYPE_CONTEXT);
+GST_DEBUG_CATEGORY_STATIC (gst_gl_context_cocoa_debug);
+#define GST_CAT_DEFAULT gst_gl_context_cocoa_debug
 
-static GMutex nsapp_lock;
-static GCond nsapp_cond;
-
-static gboolean
-gst_gl_window_cocoa_init_nsapp (gpointer data)
-{
-  NSAutoreleasePool *pool = nil;
-
-  g_mutex_lock (&nsapp_lock);
-
-  pool = [[NSAutoreleasePool alloc] init];
-
-  /* The sharedApplication class method initializes
-   * the display environment and connects your program
-   * to the window server and the display server
-   */
-
-  /* TODO: so consider to create GstGLDisplayCocoa
-   * in gst/gl/cocoa/gstgldisplay_cocoa.h/c
-   */
-
-  /* has to be called in the main thread */
-  [NSApplication sharedApplication];
-
-  GST_DEBUG ("NSApp initialized from a GTimeoutSource");
-
-  [pool release];
-
-  g_cond_signal (&nsapp_cond);
-  g_mutex_unlock (&nsapp_lock);
-
-  return FALSE;
-}
-
-static gboolean
-gst_gl_window_cocoa_nsapp_iteration (gpointer data)
-{
-  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
-  NSEvent *event = nil;
-
-  if ([NSThread isMainThread]) {
-
-    while ((event = ([NSApp nextEventMatchingMask:NSAnyEventMask
-      untilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]
-      inMode:NSDefaultRunLoopMode dequeue:YES])) != nil) {
-
-      [NSApp sendEvent:event];
-    }
-  }
-
-  [pool release];
-
-  return TRUE;
-}
+G_DEFINE_TYPE_WITH_CODE (GstGLContextCocoa, gst_gl_context_cocoa,
+    GST_GL_TYPE_CONTEXT, GST_DEBUG_CATEGORY_INIT (gst_gl_context_cocoa_debug, "glcontext_cocoa", 0, "Cocoa GL Context"); );
 
 static void
 gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
 {
   GstGLContextClass *context_class = (GstGLContextClass *) klass;
-  NSAutoreleasePool* pool = nil;
 
   g_type_class_add_private (klass, sizeof (GstGLContextCocoaPrivate));
 
@@ -115,76 +62,6 @@
       GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_api);
   context_class->get_gl_platform =
       GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_platform);
-
-  pool = [[NSAutoreleasePool alloc] init];
-
-  /* [NSApplication sharedApplication] will usually be
-   * called in your application so it's not necessary
-   * to do that the following. Except for debugging 
-   * purpose like when using gst-launch.
-   * So here we handle the two cases where the first
-   * GstGLContext is either created in the main thread
-   * or from another thread like a streaming thread
-   */
-
-  if ([NSThread isMainThread]) {
-    /* In the main thread so just do the call now */
-
-    /* The sharedApplication class method initializes
-     * the display environment and connects your program
-     * to the window server and the display server
-     */
-
-    /* TODO: so consider to create GstGLDisplayCocoa
-     * in gst/gl/cocoa/gstgldisplay_cocoa.h/c
-     */
-
-    /* has to be called in the main thread */
-    [NSApplication sharedApplication];
-
-    GST_DEBUG ("NSApp initialized");
-  } else {
-    /* Not in the main thread, assume there is a
-     * glib main loop running this is for debugging
-     * purposes so that's ok to let us a chance
-     */
-    GMainContext *context;
-    gboolean is_loop_running = FALSE;
-    gint64 end_time = 0;
-
-    context = g_main_context_default ();
-
-    if (g_main_context_is_owner (context)) {
-      /* At the thread running the default GLib main context but
-       * not the Cocoa main thread
-       * We can't do anything here
-       */
-    } else if (g_main_context_acquire (context)) {
-      /* No main loop running on the default main context,
-       * we can't do anything here */
-      g_main_context_release (context);
-    } else {
-      /* Main loop running on the default main context but it
-       * is not running in this thread */
-      g_mutex_init (&nsapp_lock);
-      g_cond_init (&nsapp_cond);
-
-      g_mutex_lock (&nsapp_lock);
-      g_idle_add_full (G_PRIORITY_HIGH, gst_gl_window_cocoa_init_nsapp, NULL, NULL);
-      end_time = g_get_monotonic_time () + 500 * 1000;
-      is_loop_running = g_cond_wait_until (&nsapp_cond, &nsapp_lock, end_time);
-      g_mutex_unlock (&nsapp_lock);
-
-      if (!is_loop_running) {
-        GST_WARNING ("no mainloop running");
-      }
-
-      g_cond_clear (&nsapp_cond);
-      g_mutex_clear (&nsapp_lock);
-    }
-  }
-
-  [pool release];
 }
 
 static void
@@ -202,6 +79,84 @@
   return context;
 }
 
+struct pixel_attr
+{
+  CGLPixelFormatAttribute attr;
+  const gchar *attr_name;
+};
+
+static struct pixel_attr pixel_attrs[] = {
+  {kCGLPFAAllRenderers, "All Renderers"},
+  {kCGLPFADoubleBuffer, "Double Buffered"},
+  {kCGLPFAStereo, "Stereo"},
+  {kCGLPFAAuxBuffers, "Aux Buffers"},
+  {kCGLPFAColorSize, "Color Size"},
+  {kCGLPFAAlphaSize, "Alpha Size"},
+  {kCGLPFADepthSize, "Depth Size"},
+  {kCGLPFAStencilSize, "Stencil Size"},
+  {kCGLPFAAccumSize, "Accum Size"},
+  {kCGLPFAMinimumPolicy, "Minimum Policy"},
+  {kCGLPFAMaximumPolicy, "Maximum Policy"},
+  {kCGLPFASampleBuffers, "Sample Buffers"},
+  {kCGLPFASamples, "Samples"},
+  {kCGLPFAAuxDepthStencil, "Aux Depth Stencil"},
+  {kCGLPFAColorFloat, "Color Float"},
+  {kCGLPFAMultisample, "Multisample"},
+  {kCGLPFASupersample, "Supersample"},
+  {kCGLPFARendererID, "Renderer ID"},
+  {kCGLPFANoRecovery, "No Recovery"},
+  {kCGLPFAAccelerated, "Accelerated"},
+  {kCGLPFAClosestPolicy, "Closest Policy"},
+  {kCGLPFABackingStore, "Backing Store"},
+  {kCGLPFADisplayMask, "Display Mask"},
+  {kCGLPFAAllowOfflineRenderers, "Allow Offline Renderers"},
+  {kCGLPFAAcceleratedCompute, "Accelerated Compute"},
+  {kCGLPFAOpenGLProfile, "OpenGL Profile"},
+  {kCGLPFAVirtualScreenCount, "Virtual Screen Count"},
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1090
+  {kCGLPFACompliant, "Compliant"},
+  {kCGLPFARemotePBuffer, "Remote PBuffer"},
+  {kCGLPFASingleRenderer, "Single Renderer"},
+  {kCGLPFAWindow, "Window"},
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+//  {kCGLPFAOffScreen, "Off Screen"},
+//  {kCGLPFAPBuffer, "PBuffer"},
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+//  {kCGLPFAFullScreen, "Full Screen"},
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+//  {kCGLPFAMPSafe, "MP Safe"},
+//  {kCGLPFAMultiScreen, "Multi Screen"},
+//  {kCGLPFARobust, "Robust"},
+#endif
+};
+
+void
+gst_gl_context_cocoa_dump_pixel_format (CGLPixelFormatObj fmt)
+{
+  int i;
+
+  for (i = 0; i < G_N_ELEMENTS (pixel_attrs); i++) {
+    gint val;
+    CGLError ret = CGLDescribePixelFormat (fmt, 0, pixel_attrs[i].attr, &val);
+
+    if (ret != kCGLNoError) {
+      GST_WARNING ("failed to get pixel format %p attribute %s", fmt, pixel_attrs[i].attr_name);
+    } else {
+      GST_DEBUG ("Pixel format %p attr %s = %i", fmt, pixel_attrs[i].attr_name,
+          val);
+    }
+  }
+}
+
+CGLPixelFormatObj
+gst_gl_context_cocoa_get_pixel_format (GstGLContextCocoa *context)
+{
+  return context->priv->pixel_format;
+}
+
 static gboolean
 gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
     GstGLContext *other_context, GError **error)
@@ -210,105 +165,80 @@
   GstGLContextCocoaPrivate *priv = context_cocoa->priv;
   GstGLWindow *window = gst_gl_context_get_window (context);
   GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
-  __block NSOpenGLContext *glContext = nil;
-
-  priv->source_id = g_timeout_add (200, gst_gl_window_cocoa_nsapp_iteration, NULL);
+  const GLint swapInterval = 1;
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+  CGLPixelFormatObj fmt = NULL;
+  CGLContextObj glContext;
+  CGLPixelFormatAttribute attribs[] = {
+    kCGLPFADoubleBuffer,
+    kCGLPFAAccumSize, 32,
+    0
+  };
+  CGLError ret;
+  gint npix;
 
   priv->gl_context = nil;
   if (other_context)
-    priv->external_gl_context = (NSOpenGLContext *) gst_gl_context_get_gl_context (other_context);
+    priv->external_gl_context = (CGLContextObj) gst_gl_context_get_gl_context (other_context);
   else
     priv->external_gl_context = NULL;
 
-  dispatch_sync (dispatch_get_main_queue (), ^{
-    NSAutoreleasePool *pool;
-    NSOpenGLPixelFormat *fmt = nil;
-    GstGLNSView *glView = nil;
-    NSOpenGLPixelFormatAttribute attribs[] = {
-      NSOpenGLPFADoubleBuffer,
-      NSOpenGLPFAAccumSize, 32,
-      0
-    };
-    NSRect rect;
-    NSWindow *window_handle;
-
-    pool = [[NSAutoreleasePool alloc] init];
-
-    rect.origin.x = 0;
-    rect.origin.y = 0;
-    rect.size.width = 320;
-    rect.size.height = 240;
-
-    gst_gl_window_cocoa_create_window (window_cocoa, rect);
-    window_handle = (NSWindow *) gst_gl_window_get_window_handle (window);
-
-    fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
-    if (!fmt) {
-      gst_object_unref (window);
-      GST_WARNING ("cannot create NSOpenGLPixelFormat");
-      return;
-    }
-
-    glView = [[GstGLNSView alloc] initWithFrame:window_cocoa rect:rect];
-
-    [window_handle setContentView:glView];
-
-    glContext = [[NSOpenGLContext alloc] initWithFormat:fmt
-      shareContext:context_cocoa->priv->external_gl_context];
-
-    GST_DEBUG ("NSOpenGL context created: %"G_GUINTPTR_FORMAT, (guintptr) glContext);
-
-    context_cocoa->priv->gl_context = glContext;
-
-    [glContext setView:glView];
-
-    [pool release];
-  });
-
-  if (!glContext) {
-    g_source_remove (priv->source_id);
-    priv->source_id = 0;
-    return FALSE;
+  if (priv->external_gl_context) {
+    fmt = CGLGetPixelFormat (priv->external_gl_context);
   }
 
-  /* OpenGL context is made current only one time threre.
-   * Indeed, all OpenGL calls are made in only one thread,
-   * the Application thread */
-  [glContext makeCurrentContext];
+  if (!fmt) {
+    ret = CGLChoosePixelFormat (attribs, &fmt, &npix);
+    if (ret != kCGLNoError) {
+      g_set_error (error, GST_GL_CONTEXT_ERROR,
+          GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "cannot choose a pixel format: %s", CGLErrorString (ret));
+      goto error;
+    }
+  }
 
-  [glContext update];
+  gst_gl_context_cocoa_dump_pixel_format (fmt);
+
+  ret = CGLCreateContext (fmt, priv->external_gl_context, &glContext);
+  if (ret != kCGLNoError) {
+    g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
+        "failed to create context: %s", CGLErrorString (ret));
+    goto error;
+  }
+
+  context_cocoa->priv->pixel_format = fmt;
+  context_cocoa->priv->gl_context = glContext;
+
+  _invoke_on_main ((GstGLWindowCB) gst_gl_window_cocoa_create_window,
+      window_cocoa);
+
+  if (!context_cocoa->priv->gl_context) {
+    goto error;
+  }
+
+  GST_INFO_OBJECT (context, "GL context created: %p", context_cocoa->priv->gl_context);
+
+  CGLSetCurrentContext (context_cocoa->priv->gl_context);
 
   /* Back and front buffers are swapped only during the vertical retrace of the monitor.
    * Discarded if you configured your driver to Never-use-V-Sync.
    */
-  NS_DURING {
-    if (glContext) {
-      const GLint swapInterval = 1;
-      [glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
-    }
-  } NS_HANDLER {
-     GST_DEBUG ("your back-end does not implement NSOpenglContext::setValues\n");
-  }
-  NS_ENDHANDLER
-
-  GST_DEBUG ("opengl GstGLNSWindow initialized");
+  CGLSetParameter (context_cocoa->priv->gl_context, kCGLCPSwapInterval, &swapInterval);
 
   gst_object_unref (window);
+  [pool release];
 
   return TRUE;
+
+error:
+  gst_object_unref (window);
+  [pool release];
+  return FALSE;
 }
 
 static void
 gst_gl_context_cocoa_destroy_context (GstGLContext *context)
 {
-  GstGLContextCocoa *context_cocoa = GST_GL_CONTEXT_COCOA (context);
-  GstGLContextCocoaPrivate *priv = context_cocoa->priv;
-
   /* FIXME: Need to release context and other things? */
-  if (priv->source_id) {
-    g_source_remove (priv->source_id);
-    priv->source_id = 0;
-  }
 }
 
 static guintptr
@@ -320,15 +250,10 @@
 static gboolean
 gst_gl_context_cocoa_activate (GstGLContext * context, gboolean activate)
 {
-  GstGLContextCocoa *context_cocoa;
+  GstGLContextCocoa *context_cocoa = GST_GL_CONTEXT_COCOA (context);
+  gpointer context_handle = activate ? context_cocoa->priv->gl_context : NULL;
 
-  context_cocoa = GST_GL_CONTEXT_COCOA (context);
-
-  if (activate)
-    [context_cocoa->priv->gl_context makeCurrentContext];
-  else
-    [NSOpenGLContext clearCurrentContext];
-  return TRUE;
+  return kCGLNoError == CGLSetCurrentContext (context_handle);
 }
 
 static GstGLAPI
@@ -342,3 +267,9 @@
 {
   return GST_GL_PLATFORM_CGL;
 }
+
+guintptr
+gst_gl_context_cocoa_get_current_context (void)
+{
+  return (guintptr) CGLGetCurrentContext ();
+}
diff --git a/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.h b/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.h
new file mode 100644
index 0000000..5551f0f
--- /dev/null
+++ b/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.h
@@ -0,0 +1,62 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_DISPLAY_COCOA_H__
+#define __GST_GL_DISPLAY_COCOA_H__
+
+#include <gst/gst.h>
+
+#include <gst/gl/gstgl_fwd.h>
+#include <gst/gl/gstgldisplay.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_display_cocoa_get_type (void);
+
+#define GST_TYPE_GL_DISPLAY_COCOA             (gst_gl_display_cocoa_get_type())
+#define GST_GL_DISPLAY_COCOA(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_COCOA,GstGLDisplayCocoa))
+#define GST_GL_DISPLAY_COCOA_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_COCOA,GstGLDisplayCocoaClass))
+#define GST_IS_GL_DISPLAY_COCOA(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_COCOA))
+#define GST_IS_GL_DISPLAY_COCOA_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_COCOA))
+#define GST_GL_DISPLAY_COCOA_CAST(obj)        ((GstGLDisplayCocoa*)(obj))
+
+typedef struct _GstGLDisplayCocoa GstGLDisplayCocoa;
+typedef struct _GstGLDisplayCocoaClass GstGLDisplayCocoaClass;
+
+/**
+ * GstGLDisplayCocoa:
+ *
+ * Initialized NSApp if the application has not done it.
+ */
+struct _GstGLDisplayCocoa
+{
+  GstGLDisplay          parent;
+};
+
+struct _GstGLDisplayCocoaClass
+{
+  GstGLDisplayClass object_class;
+};
+
+GstGLDisplayCocoa *gst_gl_display_cocoa_new (void);
+
+G_END_DECLS
+
+#endif /* __GST_GL_DISPLAY_COCOA_H__ */
diff --git a/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m b/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m
new file mode 100644
index 0000000..f7c0252
--- /dev/null
+++ b/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m
@@ -0,0 +1,247 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <Cocoa/Cocoa.h>
+
+#include <gst/gl/cocoa/gstgldisplay_cocoa.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
+#define GST_CAT_DEFAULT gst_gl_display_debug
+
+G_DEFINE_TYPE (GstGLDisplayCocoa, gst_gl_display_cocoa, GST_TYPE_GL_DISPLAY);
+
+static void gst_gl_display_cocoa_finalize (GObject * object);
+static guintptr gst_gl_display_cocoa_get_handle (GstGLDisplay * display);
+
+/* Define this if the GLib patch from
+ * https://bugzilla.gnome.org/show_bug.cgi?id=741450
+ * is used
+ */
+#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
+
+static GstGLDisplayCocoa *singleton = NULL;
+static gint nsapp_source_id = 0;
+static GMutex nsapp_lock;
+static GCond nsapp_cond;
+
+static gboolean
+gst_gl_display_cocoa_nsapp_iteration (gpointer data)
+{
+  NSAutoreleasePool *pool = nil;
+  NSEvent *event = nil;
+
+  if (![NSThread isMainThread]) {
+    GST_WARNING ("NSApp iteration not running in the main thread");
+    return FALSE;
+  }
+
+  pool = [[NSAutoreleasePool alloc] init];
+
+  while ((event = ([NSApp nextEventMatchingMask:NSAnyEventMask
+      untilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]
+      inMode:NSDefaultRunLoopMode dequeue:YES])) != nil) {
+    [NSApp sendEvent:event];
+  }
+
+  [pool release];
+
+  return TRUE;
+}
+
+static void
+gst_gl_display_cocoa_open_and_attach_source (gpointer data)
+{
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+  if ([NSThread isMainThread]) {
+    /* The sharedApplication class method initializes
+     * the display environment and connects your program
+     * to the window server and the display server.
+     * It has to be done in the main thread.
+     */
+    [NSApplication sharedApplication];
+
+    GST_DEBUG ("Custom NSApp initialization done");
+
+    nsapp_source_id = g_timeout_add (60, gst_gl_display_cocoa_nsapp_iteration,
+        NULL);
+
+    GST_DEBUG ("NSApp iteration loop attached, id %d", nsapp_source_id);
+  }
+
+  [pool release];
+}
+
+static gboolean
+gst_gl_display_cocoa_init_nsapp (gpointer data)
+{
+  g_mutex_lock (&nsapp_lock);
+
+  gst_gl_display_cocoa_open_and_attach_source (data);
+
+  g_cond_signal (&nsapp_cond);
+  g_mutex_unlock (&nsapp_lock);
+
+  return FALSE;
+}
+
+static GstGLDisplayCocoa *
+gst_gl_display_cocoa_setup_nsapp (gpointer data)
+{
+  GMainContext *context = g_main_context_default ();
+  gint delta_ms = 0;
+
+  g_mutex_lock (&nsapp_lock);
+
+  if (singleton) {
+    GST_DEBUG ("Get existing display");
+    singleton = gst_object_ref (singleton);
+    g_mutex_unlock (&nsapp_lock);
+    return singleton;
+  }
+
+  if (NSApp != nil && !singleton) {
+    GstGLDisplayCocoa *ret = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
+    g_mutex_unlock (&nsapp_lock);
+    return ret;
+  }
+
+  /* All application have to start with [NSApplication sharedApplication]
+   * so if NSApp is nil here let's assume this is a debugging application
+   * that runs a glib main loop. */
+  g_assert (NSApp == nil);
+
+  GST_DEBUG ("The application has not initialized NSApp");
+
+  if ([NSThread isMainThread]) {
+
+    GST_DEBUG ("Setting up NSApp from the main thread");
+    if (g_main_context_is_owner (context)) {
+      GST_DEBUG ("The main thread own the context");
+      gst_gl_display_cocoa_open_and_attach_source (data);
+    } else if (g_main_context_acquire (context)) {
+      GST_DEBUG ("The main loop should be shortly running in the main thread");
+      gst_gl_display_cocoa_open_and_attach_source (data);
+      g_main_context_release (context);
+    } else {
+      GST_WARNING ("Main loop running in another thread");
+    }
+  } else {
+
+    GST_DEBUG ("Setting up NSApp not from the main thread");
+
+    if (g_main_context_is_owner (context)) {
+      GST_WARNING ("Default context not own by the main thread");
+      delta_ms = -1;
+    } else if (g_main_context_acquire (context)) {
+      GST_DEBUG ("The main loop should be shortly running in the main thread");
+      delta_ms = 1000;
+      g_main_context_release (context);
+    } else {
+      GST_DEBUG ("Main loop running in main thread");
+      delta_ms = 500;
+    }
+
+    if (delta_ms > 0) {
+      gint64 end_time = g_get_monotonic_time () + delta_ms * 1000;;
+      g_idle_add_full (G_PRIORITY_HIGH, gst_gl_display_cocoa_init_nsapp, data, NULL);
+      g_cond_wait_until (&nsapp_cond, &nsapp_lock, end_time);
+    }
+  }
+
+  if (NSApp == nil) {
+    GST_ERROR ("Custom NSApp initialization failed");
+  } else {
+    GST_DEBUG ("Create display");
+    singleton = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
+  }
+
+  g_mutex_unlock (&nsapp_lock);
+
+  return singleton;
+}
+
+#endif
+
+static void
+gst_gl_display_cocoa_class_init (GstGLDisplayCocoaClass * klass)
+{
+  GST_GL_DISPLAY_CLASS (klass)->get_handle =
+      GST_DEBUG_FUNCPTR (gst_gl_display_cocoa_get_handle);
+
+  G_OBJECT_CLASS (klass)->finalize = gst_gl_display_cocoa_finalize;
+}
+
+static void
+gst_gl_display_cocoa_init (GstGLDisplayCocoa * display_cocoa)
+{
+  GstGLDisplay *display = (GstGLDisplay *) display_cocoa;
+  display->type = GST_GL_DISPLAY_TYPE_COCOA;
+}
+
+static void
+gst_gl_display_cocoa_finalize (GObject * object)
+{
+#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
+  g_mutex_lock (&nsapp_lock);
+  if (singleton) {
+    GST_DEBUG ("Destroy display");
+    singleton = NULL;
+    if (nsapp_source_id) {
+      GST_DEBUG ("Remove NSApp loop iteration, id %d", nsapp_source_id);
+      g_source_remove (nsapp_source_id);
+    }
+    nsapp_source_id = 0;
+    g_mutex_unlock (&nsapp_lock);
+  }
+  g_mutex_unlock (&nsapp_lock);
+#endif
+
+  G_OBJECT_CLASS (gst_gl_display_cocoa_parent_class)->finalize (object);
+}
+
+/**
+ * gst_gl_display_cocoa_new:
+ *
+ * Create a new #GstGLDisplayCocoa.
+ *
+ * Returns: (transfer full): a new #GstGLDisplayCocoa or %NULL
+ */
+GstGLDisplayCocoa *
+gst_gl_display_cocoa_new (void)
+{
+  GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
+
+#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
+  return gst_gl_display_cocoa_setup_nsapp (NULL);
+#else
+  return g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
+#endif
+}
+
+static guintptr
+gst_gl_display_cocoa_get_handle (GstGLDisplay * display)
+{
+  return (guintptr) NSApp;
+}
diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h
index 9d2eda0..775c291 100644
--- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h
+++ b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h
@@ -60,6 +60,8 @@
 
 GstGLWindowCocoa * gst_gl_window_cocoa_new (void);
 
+void gst_gl_window_cocoa_draw_thread (GstGLWindowCocoa *window_cocoa);
+
 G_END_DECLS
 
 #endif /* __GST_GL_WINDOW_COCOA_H__ */
diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m
index f9aa330..01a2175 100644
--- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m
+++ b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m
@@ -24,6 +24,7 @@
 #endif
 
 #include <Cocoa/Cocoa.h>
+#include <QuartzCore/QuartzCore.h>
 
 #include "gstgl_cocoa_private.h"
 
@@ -64,17 +65,21 @@
   GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow");
 #define gst_gl_window_cocoa_parent_class parent_class
 G_DEFINE_TYPE_WITH_CODE (GstGLWindowCocoa, gst_gl_window_cocoa, GST_GL_TYPE_WINDOW, DEBUG_INIT);
+static void gst_gl_window_cocoa_finalize (GObject * object);
 
 static gboolean gst_gl_window_cocoa_open (GstGLWindow *window, GError **err);
 static void gst_gl_window_cocoa_close (GstGLWindow *window);
 static guintptr gst_gl_window_cocoa_get_window_handle (GstGLWindow * window);
 static void gst_gl_window_cocoa_set_window_handle (GstGLWindow * window,
     guintptr handle);
-static void gst_gl_window_cocoa_draw (GstGLWindow * window, guint width, guint height);
+static void gst_gl_window_cocoa_draw (GstGLWindow * window);
 static void gst_gl_window_cocoa_run (GstGLWindow * window);
 static void gst_gl_window_cocoa_quit (GstGLWindow * window);
 static void gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
     GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
+static void gst_gl_window_cocoa_set_preferred_size (GstGLWindow * window,
+    gint width, gint height);
+static void gst_gl_window_cocoa_show (GstGLWindow * window);
 
 struct _GstGLWindowCocoaPrivate
 {
@@ -83,16 +88,20 @@
   gboolean visible;
   GMainContext *main_context;
   GMainLoop *loop;
+  gint preferred_width;
+  gint preferred_height;
 
   GLint viewport_dim[4];
+
+  /* atomic set when the internal NSView has been created */
+  int view_ready;
 };
 
 static void
 gst_gl_window_cocoa_class_init (GstGLWindowCocoaClass * klass)
 {
-  GstGLWindowClass *window_class;
-
-  window_class = (GstGLWindowClass *) klass;
+  GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
+  GObjectClass *gobject_class = (GObjectClass *) klass;
 
   g_type_class_add_private (klass, sizeof (GstGLWindowCocoaPrivate));
 
@@ -108,12 +117,34 @@
   window_class->quit = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_quit);
   window_class->send_message_async =
       GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_send_message_async);
+  window_class->set_preferred_size =
+      GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_set_preferred_size);
+  window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_show);
+
+  gobject_class->finalize = gst_gl_window_cocoa_finalize;
 }
 
 static void
 gst_gl_window_cocoa_init (GstGLWindowCocoa * window)
 {
   window->priv = GST_GL_WINDOW_COCOA_GET_PRIVATE (window);
+
+  window->priv->preferred_width = 320;
+  window->priv->preferred_height = 240;
+
+  window->priv->main_context = g_main_context_new ();
+  window->priv->loop =g_main_loop_new (window->priv->main_context, FALSE);
+}
+
+static void
+gst_gl_window_cocoa_finalize (GObject * object)
+{
+  GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (object);
+
+  g_main_loop_unref (window_cocoa->priv->loop);
+  g_main_context_unref (window_cocoa->priv->main_context);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 /* Must be called in the gl thread */
@@ -127,9 +158,21 @@
 
 /* Must be called from the main thread */
 gboolean
-gst_gl_window_cocoa_create_window (GstGLWindowCocoa *window_cocoa, NSRect rect)
+gst_gl_window_cocoa_create_window (GstGLWindowCocoa *window_cocoa)
 {
   GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
+  GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
+  NSRect mainRect = [[NSScreen mainScreen] visibleFrame];
+  gint h = priv->preferred_height;
+  gint y = mainRect.size.height > h ? (mainRect.size.height - h) * 0.5 : 0;
+  NSRect rect = NSMakeRect (0, y, priv->preferred_width, priv->preferred_height);
+  NSRect windowRect = NSMakeRect (0, y, priv->preferred_width, priv->preferred_height);
+  GstGLContext *context = gst_gl_window_get_context (window);
+  GstGLContextCocoa *context_cocoa = GST_GL_CONTEXT_COCOA (context);
+  GstGLCAOpenGLLayer *layer = [[GstGLCAOpenGLLayer alloc] initWithGstGLContext:context_cocoa];
+  GstGLNSView *glView = [[GstGLNSView alloc] initWithFrameLayer:window_cocoa rect:windowRect layer:layer];
+
+  gst_object_unref (context);
 
   priv->internal_win_id = [[GstGLNSWindow alloc] initWithContentRect:rect styleMask: 
       (NSTitledWindowMask | NSClosableWindowMask |
@@ -138,6 +181,10 @@
 
       GST_DEBUG ("NSWindow id: %"G_GUINTPTR_FORMAT, (guintptr) priv->internal_win_id);
 
+  [priv->internal_win_id setContentView:glView];
+
+  g_atomic_int_set (&window_cocoa->priv->view_ready, 1);
+
   return TRUE;
 }
 
@@ -148,22 +195,13 @@
 
   window_cocoa = GST_GL_WINDOW_COCOA (window);
 
-  window_cocoa->priv->main_context = g_main_context_new ();
-  window_cocoa->priv->loop =
-      g_main_loop_new (window_cocoa->priv->main_context, FALSE);
-
   return TRUE;
 }
 
 static void
 gst_gl_window_cocoa_close (GstGLWindow *window)
 {
-  GstGLWindowCocoa *window_cocoa;
-
-  window_cocoa = GST_GL_WINDOW_COCOA (window);
-
-  g_main_loop_unref (window_cocoa->priv->loop);
-  g_main_context_unref (window_cocoa->priv->main_context);
+  GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
 
   [window_cocoa->priv->internal_win_id release];
   window_cocoa->priv->internal_win_id = nil;
@@ -211,87 +249,70 @@
   }
 }
 
-/* Thread safe */
-struct draw
-{
-  GstGLWindowCocoa *window;
-  guint width, height;
-};
-
 static void
-draw_cb (gpointer data)
+_show_window (gpointer data)
 {
-  struct draw *draw_data = data;
-  GstGLWindowCocoa *window_cocoa = draw_data->window;
+  GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (data);
   GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
 
-  /* useful when set_window_handle is called before
-   * the internal NSWindow */
-  if (priv->external_view && !priv->visible) {
-    gst_gl_window_cocoa_set_window_handle (GST_GL_WINDOW (window_cocoa), (guintptr) priv->external_view);
-    priv->visible = TRUE;
-  }
+  GST_DEBUG_OBJECT (window_cocoa, "make the window available\n");
+  [priv->internal_win_id makeMainWindow];
+  [priv->internal_win_id orderFrontRegardless];
+  [priv->internal_win_id setViewsNeedDisplay:YES];
 
-  if (!priv->external_view && !priv->visible) {
-    dispatch_sync (dispatch_get_main_queue (), ^{
-      NSRect mainRect = [[NSScreen mainScreen] visibleFrame];
-      NSRect windowRect = [priv->internal_win_id frame];
-      gint x = 0;
-      gint y = 0;
+  priv->visible = TRUE;
+}
 
-      GST_DEBUG ("main screen rect: %d %d %d %d\n", (int) mainRect.origin.x,
-          (int) mainRect.origin.y, (int) mainRect.size.width,
-          (int) mainRect.size.height);
+static void
+gst_gl_window_cocoa_show (GstGLWindow * window)
+{
+  GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
+  GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
 
-      windowRect.origin.x += x;
-      windowRect.origin.y += mainRect.size.height > y ? (mainRect.size.height - y) * 0.5 : y;
-      windowRect.size.width = draw_data->width;
-      windowRect.size.height = draw_data->height;
-
-      GST_DEBUG ("window rect: %d %d %d %d\n", (int) windowRect.origin.x,
-          (int) windowRect.origin.y, (int) windowRect.size.width,
-          (int) windowRect.size.height);
-
-      x += 20;
-      y += 20;
-
-      [priv->internal_win_id setFrame:windowRect display:NO];
-      GST_DEBUG ("make the window available\n");
-      [priv->internal_win_id makeMainWindow];
-
-      [priv->internal_win_id orderFrontRegardless];
-
-      [priv->internal_win_id setViewsNeedDisplay:YES];
-    });
-    priv->visible = TRUE;
-  }
-
-  if (g_main_loop_is_running (priv->loop)) {
-    if (![priv->internal_win_id isClosed]) {
-      GstGLContext *context = gst_gl_window_get_context (GST_GL_WINDOW (window_cocoa));
-      NSOpenGLContext * glContext = (NSOpenGLContext *) gst_gl_context_get_gl_context (context);
-
-      /* draw opengl scene in the back buffer */
-      GST_GL_WINDOW (window_cocoa)->draw (GST_GL_WINDOW (window_cocoa)->draw_data);
-
-      /* Copy the back buffer to the front buffer */
-      [glContext flushBuffer];
-
-      gst_object_unref (context);
+  if (!priv->visible) {
+    /* useful when set_window_handle is called before
+     * the internal NSWindow */
+    if (priv->external_view) {
+      gst_gl_window_cocoa_set_window_handle (window, (guintptr) priv->external_view);
+      priv->visible = TRUE;
+      return;
     }
+
+    if (!priv->external_view && !priv->visible)
+      _invoke_on_main ((GstGLWindowCB) _show_window, window);
   }
 }
 
 static void
-gst_gl_window_cocoa_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_window_cocoa_draw (GstGLWindow * window)
 {
-  struct draw draw_data;
+  GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
+  GstGLNSView *view;
 
-  draw_data.window = GST_GL_WINDOW_COCOA (window);
-  draw_data.width = width;
-  draw_data.height = height;
+  /* As the view is created asynchronously in the main thread we cannot know
+   * exactly when it will be ready to draw to */
+  if (!g_atomic_int_get (&window_cocoa->priv->view_ready))
+    return;
 
-  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+  view = (GstGLNSView *)[window_cocoa->priv->internal_win_id contentView];
+
+  /* this redraws the GstGLCAOpenGLLayer which calls
+   * gst_gl_window_cocoa_draw_thread(). Use an explicit CATransaction since we
+   * don't know how often the main runloop is running.
+   */
+  [CATransaction begin];
+  [view setNeedsDisplay:YES];
+  [CATransaction commit];
+}
+
+static void
+gst_gl_window_cocoa_set_preferred_size (GstGLWindow * window, gint width,
+    gint height)
+{
+  GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
+
+  window_cocoa->priv->preferred_width = width;
+  window_cocoa->priv->preferred_height = height;
 }
 
 static void
@@ -357,6 +378,64 @@
       (GSourceFunc) _run_message, message);
 }
 
+static void
+gst_gl_cocoa_draw_cb (GstGLWindowCocoa *window_cocoa)
+{
+  GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
+
+  if (g_main_loop_is_running (priv->loop)) {
+    if (![priv->internal_win_id isClosed]) {
+     GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
+
+      /* draw opengl scene in the back buffer */
+      if (window->draw)
+        window->draw (window->draw_data);
+    }
+  }
+}
+
+static void
+gst_gl_cocoa_resize_cb (GstGLNSView * view, guint width, guint height)
+{
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+  GstGLWindowCocoa *window_cocoa = view->window_cocoa;
+  GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
+  GstGLContext *context = gst_gl_window_get_context (window);
+
+  if (g_main_loop_is_running (window_cocoa->priv->loop) && ![window_cocoa->priv->internal_win_id isClosed]) {
+    const GstGLFuncs *gl;
+    NSRect bounds = [view bounds];
+    NSRect visibleRect = [view visibleRect];
+    gint viewport_dim[4];
+
+    gl = context->gl_vtable;
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+    bounds = [view convertRectToBacking:bounds];
+    visibleRect = [view convertRectToBacking:visibleRect];
+#endif
+
+    GST_DEBUG_OBJECT (window, "Window resized: bounds %lf %lf %lf %lf "
+                      "visibleRect %lf %lf %lf %lf",
+                      bounds.origin.x, bounds.origin.y,
+                      bounds.size.width, bounds.size.height,
+                      visibleRect.origin.x, visibleRect.origin.y,
+                      visibleRect.size.width, visibleRect.size.height);
+
+    if (window->resize) {
+      window->resize (window->resize_data, width, height);
+      gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
+    }
+
+    gl->Viewport (viewport_dim[0] - visibleRect.origin.x,
+                  viewport_dim[1] - visibleRect.origin.y,
+                  viewport_dim[2], viewport_dim[3]);
+  }
+
+  gst_object_unref (context);
+  [pool release];
+}
+
 /* =============================================================*/
 /*                                                              */
 /*                    GstGLNSWindow implementation              */
@@ -385,7 +464,7 @@
 
   [self setTitle:@"OpenGL renderer"];
 
-  [self setBackgroundColor:[NSColor clearColor]];
+  [self setBackgroundColor:[NSColor blackColor]];
 
   [self orderOut:window_cocoa->priv->internal_win_id];
 
@@ -437,13 +516,14 @@
 
   GST_DEBUG ("user clicked the close button\n");
   [window_cocoa->priv->internal_win_id setClosed];
-  gst_gl_window_send_message_async (GST_GL_WINDOW (window_cocoa), (GstGLWindowCB) close_window_cb, gst_object_ref (window_cocoa), (GDestroyNotify) gst_object_unref);
+  gst_gl_window_send_message_async (GST_GL_WINDOW (window_cocoa),
+      (GstGLWindowCB) close_window_cb, gst_object_ref (window_cocoa),
+      (GDestroyNotify) gst_object_unref);
   return YES;
 }
 
 @end
 
-
 /* =============================================================*/
 /*                                                              */
 /*                GstGLNSView implementation              */
@@ -453,66 +533,38 @@
 @implementation GstGLNSView
 
 /* Must be called from the application main thread */
-- (id)initWithFrame:(GstGLWindowCocoa *)window rect:(NSRect)contentRect {
+- (id)initWithFrameLayer:(GstGLWindowCocoa *)window rect:(NSRect)contentRect layer:(CALayer *)layerContent {
 
   self = [super initWithFrame: contentRect];
 
   window_cocoa = window;
 
-  [self setWantsLayer:NO];
+  /* The order of the next two calls matters.  This creates a layer-hosted
+   * NSView.  Calling setWantsLayer before setLayer will create a
+   * layer-backed NSView.  See the apple developer documentation on the
+   * difference.
+   */
+  [self setLayer:layerContent];
+  [self setWantsLayer:YES];
+  self->layer = (GstGLCAOpenGLLayer *)layerContent;
+  [self->layer setDrawCallback:(GstGLWindowCB)gst_gl_cocoa_draw_cb
+      data:window notify:NULL];
+  [self->layer setResizeCallback:(GstGLWindowResizeCB)gst_gl_cocoa_resize_cb
+      data:self notify:NULL];
 
-  /* Get notified about changes */
-  [self setPostsFrameChangedNotifications:YES];
-  [[NSNotificationCenter defaultCenter] addObserver: self selector:@selector(reshape:) name: NSViewFrameDidChangeNotification object: self];
+  [self setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawOnSetNeedsDisplay];
+
   [self setWantsBestResolutionOpenGLSurface:YES];
 
   return self;
 }
 
 - (void) dealloc {
-  [[NSNotificationCenter defaultCenter] removeObserver: self];
+  [self->layer release];
+
   [super dealloc];
 }
 
-struct resize
-{
-  GstGLWindowCocoa * window;
-  NSRect bounds, visibleRect;
-};
-
-static void
-resize_cb (gpointer data)
-{
-  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-  struct resize *resize_data = data;
-  GstGLWindowCocoa *window_cocoa = resize_data->window;
-  GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
-  GstGLContext *context = gst_gl_window_get_context (window);
-  NSOpenGLContext * glContext = (NSOpenGLContext *) gst_gl_context_get_gl_context (context);
-
-  if (g_main_loop_is_running (window_cocoa->priv->loop) && ![window_cocoa->priv->internal_win_id isClosed]) {
-    const GstGLFuncs *gl;
-
-    [glContext update];
-
-    gl = context->gl_vtable;
-
-    if (window->resize) {
-      window->resize (window->resize_data, resize_data->bounds.size.width, resize_data->bounds.size.height);
-      gl->GetIntegerv (GL_VIEWPORT, window_cocoa->priv->viewport_dim);
-    }
-
-    gl->Viewport (window_cocoa->priv->viewport_dim[0] - resize_data->visibleRect.origin.x,
-                  window_cocoa->priv->viewport_dim[1] - resize_data->visibleRect.origin.y,
-                  window_cocoa->priv->viewport_dim[2], window_cocoa->priv->viewport_dim[3]);
-
-    GST_GL_WINDOW (window_cocoa)->draw (GST_GL_WINDOW (window_cocoa)->draw_data);
-    [glContext flushBuffer];
-  }
-  gst_object_unref (context);
-  [pool release];
-}
-
 - (void)renewGState {
   /* Don't update the screen until we redraw, this
    * prevents flickering during scrolling, clipping,
@@ -523,40 +575,6 @@
   [super renewGState];
 }
 
-- (void)reshape: (NSNotification*)notification {
-  GstGLWindow *window;
-
-  window = GST_GL_WINDOW (window_cocoa);
-
-  if (window->resize) {
-    NSRect bounds = [self bounds];
-    NSRect visibleRect = [self visibleRect];
-    struct resize *resize_data = g_new (struct resize, 1);
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
-    bounds = [self convertRectToBacking:bounds];
-    visibleRect = [self convertRectToBacking:visibleRect];
-#endif
-
-    GST_DEBUG_OBJECT (window, "Window resized: bounds %lf %lf %lf %lf "
-                      "visibleRect %lf %lf %lf %lf",
-                      bounds.origin.x, bounds.origin.y,
-                      bounds.size.width, bounds.size.height,
-                      visibleRect.origin.x, visibleRect.origin.y,
-                      visibleRect.size.width, visibleRect.size.height);
-
-    resize_data->window = window_cocoa;
-    resize_data->bounds = bounds;
-    resize_data->visibleRect = visibleRect;
-
-    gst_gl_window_send_message_async (GST_GL_WINDOW (window_cocoa), (GstGLWindowCB) resize_cb, resize_data, (GDestroyNotify) g_free);
-  }
-}
-
-- (void)drawRect: (NSRect)dirtyRect {
-  [self reshape:nil];
-}
-
 - (BOOL) isOpaque {
     return YES;
 }
@@ -567,3 +585,14 @@
 
 @end
 
+void
+_invoke_on_main (GstGLWindowCB func, gpointer data)
+{
+  if ([NSThread isMainThread]) {
+    func (data);
+  } else {
+    dispatch_async (dispatch_get_main_queue (), ^{
+      func (data);
+    });
+  }
+}
diff --git a/gst-libs/gst/gl/dispmanx/Makefile.in b/gst-libs/gst/gl/dispmanx/Makefile.in
index 5832b48..63d88c0 100644
--- a/gst-libs/gst/gl/dispmanx/Makefile.in
+++ b/gst-libs/gst/gl/dispmanx/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -215,8 +215,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -255,7 +259,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -263,6 +266,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -312,8 +317,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -392,7 +395,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -401,7 +403,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -414,7 +415,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -439,6 +439,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -512,10 +514,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -541,6 +547,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -577,6 +586,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -617,17 +627,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -644,6 +653,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c
index 6533835..ca5411a 100644
--- a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c
+++ b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c
@@ -39,8 +39,9 @@
     window);
 static void gst_gl_window_dispmanx_egl_set_window_handle (GstGLWindow * window,
     guintptr handle);
-static void gst_gl_window_dispmanx_egl_draw (GstGLWindow * window, guint width,
-    guint height);
+static void gst_gl_window_dispmanx_egl_set_preferred_size (GstGLWindow * window,
+    gint width, gint height);
+static void gst_gl_window_dispmanx_egl_draw (GstGLWindow * window);
 static void gst_gl_window_dispmanx_egl_run (GstGLWindow * window);
 static void gst_gl_window_dispmanx_egl_quit (GstGLWindow * window);
 static void gst_gl_window_dispmanx_egl_send_message_async (GstGLWindow * window,
@@ -74,6 +75,8 @@
   window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_open);
   window_class->get_display =
       GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_get_display);
+  window_class->set_preferred_size =
+      GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_set_preferred_size);
 }
 
 static void
@@ -228,6 +231,15 @@
 }
 
 static void
+gst_gl_window_dispmanx_egl_set_preferred_size (GstGLWindow * window, gint width, gint height)
+{
+  GstGLWindowDispmanxEGL *window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
+
+  window_egl->preferred_width = width;
+  window_egl->preferred_height = height;
+}
+
+static void
 window_resize (GstGLWindowDispmanxEGL * window_egl, guint width, guint height)
 {
   GST_DEBUG ("resizing window from %ux%u to %ux%u",
@@ -275,33 +287,27 @@
     vc_dispmanx_update_submit_sync (dispman_update);
 
     if (GST_GL_WINDOW (window_egl)->resize)
-      GST_GL_WINDOW (window_egl)->resize (GST_GL_WINDOW (window_egl)->
-          resize_data, width, height);
+      GST_GL_WINDOW (window_egl)->
+          resize (GST_GL_WINDOW (window_egl)->resize_data, width, height);
   }
 
   window_egl->native.width = width;
   window_egl->native.height = height;
 }
 
-struct draw
-{
-  GstGLWindowDispmanxEGL *window;
-  guint width, height;
-};
-
 static void
 draw_cb (gpointer data)
 {
-  struct draw *draw_data = data;
-  GstGLWindowDispmanxEGL *window_egl = draw_data->window;
+  GstGLWindowDispmanxEGL *window_egl = data;
   GstGLWindow *window = GST_GL_WINDOW (window_egl);
   GstGLContext *context = gst_gl_window_get_context (window);
   GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
 
-  if (window_egl->native.width != draw_data->width
-      || window_egl->native.height != draw_data->height) {
+  if (window_egl->native.width != window_egl->preferred_width
+      || window_egl->native.height != window_egl->preferred_height) {
     GST_DEBUG ("dimensions don't match, attempting resize");
-    window_resize (window_egl, draw_data->width, draw_data->height);
+    window_resize (window_egl, window_egl->preferred_width,
+        window_egl->preferred_height);
   }
 
   if (window->draw)
@@ -313,16 +319,9 @@
 }
 
 static void
-gst_gl_window_dispmanx_egl_draw (GstGLWindow * window, guint width,
-    guint height)
+gst_gl_window_dispmanx_egl_draw (GstGLWindow * window)
 {
-  struct draw draw_data;
-
-  draw_data.window = GST_GL_WINDOW_DISPMANX_EGL (window);
-  draw_data.width = width;
-  draw_data.height = height;
-
-  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
 }
 
 static guintptr
diff --git a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h
index a3f11a2..f8a6817 100644
--- a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h
+++ b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h
@@ -48,6 +48,9 @@
   uint32_t dp_width;
   EGL_DISPMANX_WINDOW_T native;
 
+  gint preferred_width;
+  gint preferred_height;
+
   GMainContext *main_context;
   GMainLoop *loop;
 
diff --git a/gst-libs/gst/gl/eagl/Makefile.in b/gst-libs/gst/gl/eagl/Makefile.in
index 85bc0f6..69cc8e5 100644
--- a/gst-libs/gst/gl/eagl/Makefile.in
+++ b/gst-libs/gst/gl/eagl/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -215,8 +215,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -255,7 +259,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -263,6 +266,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -312,8 +317,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -392,7 +395,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -401,7 +403,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -414,7 +415,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -439,6 +439,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -512,10 +514,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -541,6 +547,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -577,6 +586,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -617,17 +627,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -644,6 +653,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/gl/eagl/gstglcontext_eagl.h b/gst-libs/gst/gl/eagl/gstglcontext_eagl.h
index bc4618c..b621b35 100644
--- a/gst-libs/gst/gl/eagl/gstglcontext_eagl.h
+++ b/gst-libs/gst/gl/eagl/gstglcontext_eagl.h
@@ -59,8 +59,10 @@
 
 GstGLContextEagl * gst_gl_context_eagl_new (void);
 
+void gst_gl_context_eagl_resize (GstGLContextEagl * eagl_context);
 void gst_gl_context_eagl_prepare_draw (GstGLContextEagl * context);
 void gst_gl_context_eagl_finish_draw (GstGLContextEagl * context);
+guintptr gst_gl_context_eagl_get_current_context (void);
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/gl/eagl/gstglcontext_eagl.m b/gst-libs/gst/gl/eagl/gstglcontext_eagl.m
index e3b71f3..e01fa62 100644
--- a/gst-libs/gst/gl/eagl/gstglcontext_eagl.m
+++ b/gst-libs/gst/gl/eagl/gstglcontext_eagl.m
@@ -99,6 +99,22 @@
   return context;
 }
 
+void
+gst_gl_context_eagl_resize (GstGLContextEagl * eagl_context)
+{
+  int width, height;
+
+  glBindRenderbuffer (GL_RENDERBUFFER, eagl_context->priv->color_renderbuffer);
+  [eagl_context->priv->eagl_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:eagl_context->priv->eagl_layer];
+  glGetRenderbufferParameteriv (GL_RENDERBUFFER,
+      GL_RENDERBUFFER_WIDTH, &width);
+  glGetRenderbufferParameteriv (GL_RENDERBUFFER,
+      GL_RENDERBUFFER_HEIGHT, &height);
+  glBindRenderbuffer (GL_RENDERBUFFER, eagl_context->priv->depth_renderbuffer);
+  glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width,
+      height);
+}
+
 static gboolean
 gst_gl_context_eagl_create_context (GstGLContext * context, GstGLAPI gl_api,
     GstGLContext * other_context, GError ** error)
@@ -341,3 +357,8 @@
   return GST_GL_PLATFORM_EAGL;
 }
 
+guintptr
+gst_gl_context_eagl_get_current_context (void)
+{
+  return (guintptr) [EAGLContext currentContext];
+}
diff --git a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
index 53f03ca..f1fc8b8 100644
--- a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
+++ b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
@@ -40,13 +40,15 @@
 #define gst_gl_window_eagl_parent_class parent_class
 G_DEFINE_TYPE_WITH_CODE (GstGLWindowEagl, gst_gl_window_eagl,
     GST_GL_TYPE_WINDOW, DEBUG_INIT);
+static void gst_gl_window_eagl_finalize (GObject * object);
 
 static guintptr gst_gl_window_eagl_get_display (GstGLWindow * window);
 static guintptr gst_gl_window_eagl_get_window_handle (GstGLWindow * window);
 static void gst_gl_window_eagl_set_window_handle (GstGLWindow * window,
     guintptr handle);
-static void gst_gl_window_eagl_draw (GstGLWindow * window, guint width,
-    guint height);
+static void gst_gl_window_eagl_set_preferred_size (GstGLWindow * window,
+    gint width, gint height);
+static void gst_gl_window_eagl_draw (GstGLWindow * window);
 static void gst_gl_window_eagl_run (GstGLWindow * window);
 static void gst_gl_window_eagl_quit (GstGLWindow * window);
 static void gst_gl_window_eagl_send_message_async (GstGLWindow * window,
@@ -58,6 +60,7 @@
 {
   UIView *view;
   gint window_width, window_height;
+  gint preferred_width, preferred_height;
 
   GMainContext *main_context;
   GMainLoop *loop;
@@ -66,9 +69,8 @@
 static void
 gst_gl_window_eagl_class_init (GstGLWindowEaglClass * klass)
 {
-  GstGLWindowClass *window_class;
-
-  window_class = (GstGLWindowClass *) klass;
+  GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
+  GObjectClass *gobject_class = (GObjectClass *) klass;
 
   g_type_class_add_private (klass, sizeof (GstGLWindowEaglPrivate));
 
@@ -86,12 +88,30 @@
       GST_DEBUG_FUNCPTR (gst_gl_window_eagl_send_message_async);
   window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_open);
   window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_close);
+  window_class->set_preferred_size =
+      GST_DEBUG_FUNCPTR (gst_gl_window_eagl_set_preferred_size);
+
+  gobject_class->finalize = gst_gl_window_eagl_finalize;
 }
 
 static void
 gst_gl_window_eagl_init (GstGLWindowEagl * window)
 {
   window->priv = GST_GL_WINDOW_EAGL_GET_PRIVATE (window);
+
+  window->priv->main_context = g_main_context_new ();
+  window->priv->loop = g_main_loop_new (window->priv->main_context, FALSE);
+}
+
+static void
+gst_gl_window_eagl_finalize (GObject * object)
+{
+  GstGLWindowEagl *window_eagl = GST_GL_WINDOW_EAGL (object);
+
+  g_main_loop_unref (window_eagl->priv->loop);
+  g_main_context_unref (window_eagl->priv->main_context);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 /* Must be called in the gl thread */
@@ -128,26 +148,12 @@
 static gboolean
 gst_gl_window_eagl_open (GstGLWindow * window, GError ** error)
 {
-  GstGLWindowEagl *window_eagl;
-
-  window_eagl = GST_GL_WINDOW_EAGL (window);
-
-  window_eagl->priv->main_context = g_main_context_new ();
-  window_eagl->priv->loop =
-      g_main_loop_new (window_eagl->priv->main_context, FALSE);
-
   return TRUE;
 }
 
 static void
 gst_gl_window_eagl_close (GstGLWindow * window)
 {
-  GstGLWindowEagl *window_eagl;
-
-  window_eagl = GST_GL_WINDOW_EAGL (window);
-
-  g_main_loop_unref (window_eagl->priv->loop);
-  g_main_context_unref (window_eagl->priv->main_context);
 }
 
 static void
@@ -215,17 +221,19 @@
       (GSourceFunc) _run_message, message);
 }
 
-struct draw
+static void
+gst_gl_window_eagl_set_preferred_size (GstGLWindow * window, gint width, gint height)
 {
-  GstGLWindowEagl *window;
-  guint width, height;
-};
+  GstGLWindowEagl *window_eagl = GST_GL_WINDOW_EAGL (window);
+
+  window_eagl->priv->preferred_width = width;
+  window_eagl->priv->preferred_height = height;
+}
 
 static void
 draw_cb (gpointer data)
 {
-  struct draw *draw_data = data;
-  GstGLWindowEagl *window_eagl = draw_data->window;
+  GstGLWindowEagl *window_eagl = data;
   GstGLWindow *window = GST_GL_WINDOW (window_eagl);
   GstGLContext *context = gst_gl_window_get_context (window);
   GstGLContextEagl *eagl_context = GST_GL_CONTEXT_EAGL (context);
@@ -238,12 +246,17 @@
     eagl_layer = (CAEAGLLayer *)[window_eagl->priv->view layer];
     size = eagl_layer.frame.size;
 
-    if (window_eagl->priv->window_width != size.width || window_eagl->priv->window_height != size.height) {
+    if (window_eagl->priv->window_width != size.width ||
+        window_eagl->priv->window_height != size.height) {
+
       window_eagl->priv->window_width = size.width;
       window_eagl->priv->window_height = size.height;
 
+      gst_gl_context_eagl_resize (eagl_context);
+
       if (window->resize)
-        window->resize (window->resize_data, size.width, size.height);
+        window->resize (window->resize_data, window_eagl->priv->window_width,
+            window_eagl->priv->window_height);
     }
   }
 
@@ -260,13 +273,7 @@
 }
 
 static void
-gst_gl_window_eagl_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_window_eagl_draw (GstGLWindow * window)
 {
-  struct draw draw_data;
-
-  draw_data.window = GST_GL_WINDOW_EAGL (window);
-  draw_data.width = width;
-  draw_data.height = height;
-
-  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
 }
diff --git a/gst-libs/gst/gl/egl/Makefile.am b/gst-libs/gst/gl/egl/Makefile.am
index 946b40b..e72aadd 100644
--- a/gst-libs/gst/gl/egl/Makefile.am
+++ b/gst-libs/gst/gl/egl/Makefile.am
@@ -7,12 +7,12 @@
 	gstglcontext_egl.c \
 	gsteglimagememory.c
 
-noinst_HEADERS = \
-	gstglcontext_egl.h
+noinst_HEADERS =
 
 libgstgl_eglincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/egl
 libgstgl_eglinclude_HEADERS = \
 	gstgldisplay_egl.h \
+	gstglcontext_egl.h \
 	gsteglimagememory.h
 
 libgstgl_egl_la_CFLAGS = \
diff --git a/gst-libs/gst/gl/egl/Makefile.in b/gst-libs/gst/gl/egl/Makefile.in
index dde426d..ae6ece3 100644
--- a/gst-libs/gst/gl/egl/Makefile.in
+++ b/gst-libs/gst/gl/egl/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -731,12 +741,11 @@
 	gstglcontext_egl.c \
 	gsteglimagememory.c
 
-noinst_HEADERS = \
-	gstglcontext_egl.h
-
+noinst_HEADERS = 
 libgstgl_eglincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/egl
 libgstgl_eglinclude_HEADERS = \
 	gstgldisplay_egl.h \
+	gstglcontext_egl.h \
 	gsteglimagememory.h
 
 libgstgl_egl_la_CFLAGS = \
diff --git a/gst-libs/gst/gl/egl/gsteglimagememory.c b/gst-libs/gst/gl/egl/gsteglimagememory.c
index 5a023a5..eb45830 100644
--- a/gst-libs/gst/gl/egl/gsteglimagememory.c
+++ b/gst-libs/gst/gl/egl/gsteglimagememory.c
@@ -25,27 +25,10 @@
 #endif
 
 #include "gsteglimagememory.h"
-#include "gstglcontext_egl.h"
 
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_EGL_IMAGE_MEMORY);
 #define GST_CAT_DEFAULT GST_CAT_EGL_IMAGE_MEMORY
 
-typedef void (*GstEGLImageDestroyNotify) (GstGLContextEGL * context,
-    gpointer data);
-
-typedef struct
-{
-  GstMemory parent;
-
-  GstGLContextEGL *context;
-  EGLImageKHR image;
-  GstVideoGLTextureType type;
-  GstVideoGLTextureOrientation orientation;
-
-  gpointer user_data;
-  GstEGLImageDestroyNotify user_data_destroy;
-} GstEGLImageMemory;
-
 #define GST_EGL_IMAGE_MEMORY(mem) ((GstEGLImageMemory*)(mem))
 
 gboolean
@@ -211,7 +194,7 @@
 gst_egl_image_allocator_init_instance (gpointer data)
 {
   GstAllocator *allocator =
-      g_object_new (gst_egl_image_allocator_get_type (), NULL);;
+      g_object_new (gst_egl_image_allocator_get_type (), NULL);
 
   GST_DEBUG_CATEGORY_INIT (GST_CAT_EGL_IMAGE_MEMORY, "eglimagememory", 0,
       "EGLImage Memory");
@@ -317,13 +300,7 @@
 
     gl = GST_GL_CONTEXT (GST_EGL_IMAGE_MEMORY (mem)->context)->gl_vtable;
 
-    if (i == 0)
-      gl->ActiveTexture (GL_TEXTURE0);
-    else if (i == 1)
-      gl->ActiveTexture (GL_TEXTURE1);
-    else if (i == 2)
-      gl->ActiveTexture (GL_TEXTURE2);
-
+    gl->ActiveTexture (GL_TEXTURE0 + i);
     gl->BindTexture (GL_TEXTURE_2D, texture_id[i]);
     gl->EGLImageTargetTexture2D (GL_TEXTURE_2D,
         gst_egl_image_memory_get_image (mem));
diff --git a/gst-libs/gst/gl/egl/gsteglimagememory.h b/gst-libs/gst/gl/egl/gsteglimagememory.h
index bfcbaaa..ce1fd44 100644
--- a/gst-libs/gst/gl/egl/gsteglimagememory.h
+++ b/gst-libs/gst/gl/egl/gsteglimagememory.h
@@ -29,13 +29,32 @@
 #include <gst/video/video.h>
 
 #include <gst/gl/gl.h>
+#include "gstglcontext_egl.h"
 
 G_BEGIN_DECLS
 
+typedef void (*GstEGLImageDestroyNotify) (GstGLContextEGL * context,
+    gpointer data);
+
+typedef struct _GstEGLImageMemory GstEGLImageMemory;
+
 #define GST_EGL_IMAGE_MEMORY_TYPE "EGLImage"
 
 #define GST_CAPS_FEATURE_MEMORY_EGL_IMAGE "memory:EGLImage"
 
+struct _GstEGLImageMemory
+{
+  GstMemory parent;
+
+  GstGLContextEGL *context;
+  EGLImageKHR image;
+  GstVideoGLTextureType type;
+  GstVideoGLTextureOrientation orientation;
+
+  gpointer user_data;
+  GstEGLImageDestroyNotify user_data_destroy;
+};
+
 void gst_egl_image_memory_init (void);
 gboolean gst_egl_image_memory_setup_buffer (GstGLContext * context, GstVideoInfo * info, GstBuffer * buffer);
 gboolean gst_is_egl_image_memory (GstMemory * mem);
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c
index 4ccec8d..28c2359 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.c
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c
@@ -38,6 +38,8 @@
 #include "../win32/gstglwindow_win32.h"
 #endif
 
+#define GST_CAT_DEFAULT gst_gl_context_debug
+
 static gboolean gst_gl_context_egl_create_context (GstGLContext * context,
     GstGLAPI gl_api, GstGLContext * other_context, GError ** error);
 static void gst_gl_context_egl_destroy_context (GstGLContext * context);
@@ -51,8 +53,6 @@
 static GstGLAPI gst_gl_context_egl_get_gl_api (GstGLContext * context);
 static GstGLPlatform gst_gl_context_egl_get_gl_platform (GstGLContext *
     context);
-static gpointer gst_gl_context_egl_get_proc_address (GstGLContext * context,
-    const gchar * name);
 static gboolean gst_gl_context_egl_check_feature (GstGLContext * context,
     const gchar * feature);
 
@@ -82,6 +82,8 @@
       GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_proc_address);
   context_class->check_feature =
       GST_DEBUG_FUNCPTR (gst_gl_context_egl_check_feature);
+  context_class->get_current_context =
+      GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_current_context);
 }
 
 static void
@@ -216,7 +218,7 @@
   GstGLWindow *window = NULL;
   EGLNativeWindowType window_handle = (EGLNativeWindowType) 0;
   gint i = 0;
-  EGLint context_attrib[3];
+  EGLint context_attrib[5];
   EGLint majorVersion;
   EGLint minorVersion;
   const gchar *egl_exts;
@@ -227,6 +229,8 @@
   egl = GST_GL_CONTEXT_EGL (context);
   window = gst_gl_context_get_window (context);
 
+  GST_DEBUG_OBJECT (context, "Creating EGL context");
+
   if (other_context) {
     if (gst_gl_context_get_gl_platform (other_context) != GST_GL_PLATFORM_EGL) {
       g_set_error (error, GST_GL_CONTEXT_ERROR,
@@ -328,18 +332,43 @@
     goto failure;
   }
 
-  GST_DEBUG ("about to create gl context\n");
+  egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS);
+
+  GST_DEBUG ("about to create gl context");
 
   if (egl->gl_api & GST_GL_API_GLES2) {
     context_attrib[i++] = EGL_CONTEXT_CLIENT_VERSION;
     context_attrib[i++] = 2;
   }
+#if !defined(GST_DISABLE_GST_DEBUG) && defined(EGL_KHR_create_context)
+  if (gst_gl_check_extension ("EGL_KHR_create_context", egl_exts)) {
+    context_attrib[i++] = EGL_CONTEXT_FLAGS_KHR;
+    context_attrib[i++] = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
+  }
+#endif
   context_attrib[i++] = EGL_NONE;
 
   egl->egl_context =
       eglCreateContext (egl->egl_display, egl->egl_config,
       (EGLContext) external_gl_context, context_attrib);
 
+#ifdef EGL_KHR_create_context
+  if (egl->egl_context == EGL_NO_CONTEXT && egl->gl_api & GST_GL_API_GLES2
+      && eglGetError () != EGL_SUCCESS) {
+    /* try without EGL_CONTEXT_FLAGS flags as it was added to
+     * EGL_KHR_create_context for gles contexts */
+    int i;
+    for (i = 0; i < G_N_ELEMENTS (context_attrib); i++) {
+      if (context_attrib[i] == EGL_CONTEXT_FLAGS_KHR ||
+          context_attrib[i] == EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR)
+        context_attrib[i] = EGL_NONE;
+    }
+    egl->egl_context =
+        eglCreateContext (egl->egl_display, egl->egl_config,
+        (EGLContext) external_gl_context, context_attrib);
+  }
+#endif
+
   if (egl->egl_context != EGL_NO_CONTEXT) {
     GST_INFO ("gl context created: %" G_GUINTPTR_FORMAT,
         (guintptr) egl->egl_context);
@@ -351,8 +380,6 @@
     goto failure;
   }
 
-  egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS);
-
   if (other_context == NULL) {
     /* FIXME do we want a window vfunc ? */
 #if GST_GL_HAVE_WINDOW_X11
@@ -372,13 +399,18 @@
         (EGLNativeWindowType) gst_gl_window_get_window_handle (window);
 
   if (window_handle) {
+    GST_DEBUG ("Creating EGLSurface from window_handle %p",
+        (void *) window_handle);
     egl->egl_surface =
         eglCreateWindowSurface (egl->egl_display, egl->egl_config,
         window_handle, NULL);
+    /* Store window handle for later comparision */
+    egl->window_handle = window_handle;
   } else if (!gst_gl_check_extension ("EGL_KHR_surfaceless_context", egl_exts)) {
     EGLint surface_attrib[7];
     gint j = 0;
 
+    GST_DEBUG ("Surfaceless context, creating PBufferSurface");
     /* FIXME: Width/height doesn't seem to matter but we can't leave them
      * at 0, otherwise X11 complains about BadValue */
     surface_attrib[j++] = EGL_WIDTH;
@@ -393,6 +425,7 @@
         eglCreatePbufferSurface (egl->egl_display, egl->egl_config,
         surface_attrib);
   } else {
+    GST_DEBUG ("No surface/handle !");
     egl->egl_surface = EGL_NO_SURFACE;
     need_surface = FALSE;
   }
@@ -446,11 +479,16 @@
 
   gst_gl_context_egl_activate (context, FALSE);
 
-  if (egl->egl_surface)
+  if (egl->egl_surface) {
     eglDestroySurface (egl->egl_display, egl->egl_surface);
+    egl->egl_surface = EGL_NO_SURFACE;
+  }
 
-  if (egl->egl_context)
+  if (egl->egl_context) {
     eglDestroyContext (egl->egl_display, egl->egl_context);
+    egl->egl_context = NULL;
+  }
+  egl->window_handle = 0;
 
   eglReleaseThread ();
 }
@@ -463,10 +501,30 @@
 
   egl = GST_GL_CONTEXT_EGL (context);
 
-  if (activate)
+  if (activate) {
+    GstGLWindow *window = gst_gl_context_get_window (context);
+    EGLNativeWindowType handle = 0;
+    /* Check if the backing handle changed */
+    if (window) {
+      handle = (EGLNativeWindowType) gst_gl_window_get_window_handle (window);
+      gst_object_unref (window);
+    }
+    if (handle && handle != egl->window_handle) {
+      GST_DEBUG_OBJECT (context,
+          "Handle changed (have:%p, now:%p), switching surface",
+          (void *) egl->window_handle, (void *) handle);
+      if (egl->egl_surface) {
+        eglDestroySurface (egl->egl_display, egl->egl_surface);
+        egl->egl_surface = EGL_NO_SURFACE;
+      }
+      egl->egl_surface =
+          eglCreateWindowSurface (egl->egl_display, egl->egl_config, handle,
+          NULL);
+      egl->window_handle = handle;
+    }
     result = eglMakeCurrent (egl->egl_display, egl->egl_surface,
         egl->egl_surface, egl->egl_context);
-  else
+  } else
     result = eglMakeCurrent (egl->egl_display, EGL_NO_SURFACE,
         EGL_NO_SURFACE, EGL_NO_CONTEXT);
 
@@ -522,13 +580,14 @@
   return NULL;
 }
 
-static gpointer
+gpointer
 gst_gl_context_egl_get_proc_address (GstGLContext * context, const gchar * name)
 {
   gpointer result = NULL;
   static GOnce g_once = G_ONCE_INIT;
+  GstGLAPI gl_api = gst_gl_context_get_gl_api (context);
 
-  result = gst_gl_context_default_get_proc_address (context, name);
+  result = gst_gl_context_default_get_proc_address (gl_api, name);
 
   g_once (&g_once, load_egl_module, NULL);
 
@@ -560,3 +619,9 @@
 
   return FALSE;
 }
+
+guintptr
+gst_gl_context_egl_get_current_context (void)
+{
+  return (guintptr) eglGetCurrentContext ();
+}
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.h b/gst-libs/gst/gl/egl/gstglcontext_egl.h
index 9601865..82119fc 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.h
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.h
@@ -49,6 +49,9 @@
   EGLImageKHR (*eglCreateImage) (EGLDisplay dpy, EGLContext ctx, EGLenum target,
       EGLClientBuffer buffer, const EGLint *attrib_list);
   EGLBoolean (*eglDestroyImage) (EGLDisplay dpy, EGLImageKHR image);
+
+  /* Cached handle */
+  EGLNativeWindowType window_handle;
 };
 
 struct _GstGLContextEGLClass {
@@ -56,7 +59,9 @@
 };
 
 GType gst_gl_context_egl_get_type     (void);
-GstGLContextEGL * gst_gl_context_egl_new (void);
+GstGLContextEGL *   gst_gl_context_egl_new                  (void);
+guintptr            gst_gl_context_egl_get_current_context  (void);
+gpointer            gst_gl_context_egl_get_proc_address     (GstGLContext * context, const gchar * name);
 
 /* TODO:
  * add support for EGL_NO_CONTEXT
diff --git a/gst-libs/gst/gl/gl.h b/gst-libs/gst/gl/gl.h
index d5debe6..8cb1b3b 100644
--- a/gst-libs/gst/gl/gl.h
+++ b/gst-libs/gst/gl/gl.h
@@ -42,7 +42,9 @@
 #include <gst/gl/gstglmemory.h>
 #include <gst/gl/gstglbufferpool.h>
 #include <gst/gl/gstglframebuffer.h>
+#include <gst/gl/gstglbasefilter.h>
 #include <gst/gl/gstglfilter.h>
 #include <gst/gl/gstglshadervariables.h>
+#include <gst/gl/gstglsyncmeta.h>
 
 #endif /* __GST_GL_H__ */
diff --git a/gst-libs/gst/gl/glprototypes/Makefile.am b/gst-libs/gst/gl/glprototypes/Makefile.am
index 6528630..fa4d1b8 100644
--- a/gst-libs/gst/gl/glprototypes/Makefile.am
+++ b/gst-libs/gst/gl/glprototypes/Makefile.am
@@ -11,5 +11,8 @@
 	opengl.h \
 	shaders.h \
 	gstgl_compat.h \
-	gstgl_gles2compat.h
+	gstgl_gles2compat.h \
+	debug.h \
+	vao.h \
+	sync.h
 
diff --git a/gst-libs/gst/gl/glprototypes/Makefile.in b/gst-libs/gst/gl/glprototypes/Makefile.in
index 81ebb05..88d2122 100644
--- a/gst-libs/gst/gl/glprototypes/Makefile.in
+++ b/gst-libs/gst/gl/glprototypes/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -207,8 +207,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -247,7 +251,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -255,6 +258,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -304,8 +309,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -384,7 +387,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -393,7 +395,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -406,7 +407,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -431,6 +431,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -504,10 +506,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -533,6 +539,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -569,6 +578,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -609,17 +619,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -636,6 +645,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -699,7 +709,10 @@
 	opengl.h \
 	shaders.h \
 	gstgl_compat.h \
-	gstgl_gles2compat.h
+	gstgl_gles2compat.h \
+	debug.h \
+	vao.h \
+	sync.h
 
 all: all-am
 
diff --git a/gst-libs/gst/gl/glprototypes/all_functions.h b/gst-libs/gst/gl/glprototypes/all_functions.h
index 12f9a62..e2cb6da 100644
--- a/gst-libs/gst/gl/glprototypes/all_functions.h
+++ b/gst-libs/gst/gl/glprototypes/all_functions.h
@@ -26,3 +26,6 @@
 #include "gles.h"
 #include "opengl.h"
 #include "shaders.h"
+#include "debug.h"
+#include "vao.h"
+#include "sync.h"
diff --git a/gst-libs/gst/gl/glprototypes/base.h b/gst-libs/gst/gl/glprototypes/base.h
index ab25e7e..e816738 100644
--- a/gst-libs/gst/gl/glprototypes/base.h
+++ b/gst-libs/gst/gl/glprototypes/base.h
@@ -298,6 +298,14 @@
 GST_GL_EXT_FUNCTION (void *, MapBuffer,
                    (GLenum		 target,
                     GLenum		 access))
+GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (unmap_buffer,
+                  GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
+                  1, 5,
+                  3, 0,
+                  "ARB\0OES\0",
+                  "vertex_buffer_object\0mapbuffer\0")
 GST_GL_EXT_FUNCTION (GLboolean, UnmapBuffer,
                    (GLenum		 target))
 GST_GL_EXT_END ()
@@ -305,10 +313,12 @@
 GST_GL_EXT_BEGIN (gl3,
                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
                   GST_GL_API_GLES2,
-                  3, 1,
+                  3, 0,
                   3, 0,
                   "\0",
                   "\0")
 GST_GL_EXT_FUNCTION (const GLubyte*, GetStringi,
                      (GLenum name, GLint index))
+GST_GL_EXT_FUNCTION (void *, MapBufferRange,
+                     (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access))
 GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/debug.h b/gst-libs/gst/gl/glprototypes/debug.h
new file mode 100644
index 0000000..6c53ea2
--- /dev/null
+++ b/gst-libs/gst/gl/glprototypes/debug.h
@@ -0,0 +1,90 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <ystreet00@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (debug,
+                  GST_GL_API_OPENGL3,
+                  4, 3,
+                  255, 255,
+                  "KHR:\0KHR\0ARB\0",
+                  "debug\0debug_output\0")
+GST_GL_EXT_FUNCTION (void, DebugMessageControl,
+                     (GLenum source,
+                      GLenum type,
+                      GLenum severity,
+                      GLsizei count,
+                      const GLuint* ids,
+                      gboolean enabled))
+GST_GL_EXT_FUNCTION (void, DebugMessageInsert,
+                     (GLenum source,
+                      GLenum type,
+                      GLenum severity,
+                      GLsizei length,
+                      const gchar *message))
+GST_GL_EXT_FUNCTION (void, DebugMessageCallback,
+                     (GST_GL_DEBUG_PROC callback,
+                      gpointer user_data))
+GST_GL_EXT_FUNCTION (GLuint, GetDebugMessageLog,
+                     (GLuint count,
+                      GLsizei bufSize,
+                      GLenum* sources,
+                      GLenum* types,
+                      GLuint* ids,
+                      GLenum* severities,
+                      GLsizei* lengths,
+                      gchar* messageLog))
+GST_GL_EXT_FUNCTION (void, GetPointerv,
+                     (GLenum pname,
+                      gpointer * params))
+GST_GL_EXT_END ()                      
+
+GST_GL_EXT_BEGIN (khr_debug,
+                  GST_GL_API_OPENGL3,
+                  4, 3,
+                  255, 255,
+                  "KHR:\0KHR\0",
+                  "debug\0")
+GST_GL_EXT_FUNCTION (void, PushDebugGroup,
+                     (GLenum source,
+                      GLuint id,
+                      GLsizei length,
+                      const gchar * message))
+GST_GL_EXT_FUNCTION (void, PopDebugGroup, (void))
+GST_GL_EXT_FUNCTION (void, ObjectLabel,
+                     (GLenum identifier,
+                      GLuint name,
+                      GLsizei length,
+                      const gchar *label))
+GST_GL_EXT_FUNCTION (void, GetObjectLabel,
+                     (GLenum identifier,
+                      GLuint name,
+                      GLsizei bufSize, 
+                      GLsizei *length,
+                      gchar *label))
+GST_GL_EXT_FUNCTION (void, ObjectPtrLabel,
+                     (gpointer ptr,
+                      GLsizei length,
+                      const gchar *label))
+GST_GL_EXT_FUNCTION (void, GetObjectPtrLabel,
+                     (gpointer ptr,
+                      GLsizei bufSize,
+                      GLsizei *length,
+                      gchar *label))
+GST_GL_EXT_END ()
+
diff --git a/gst-libs/gst/gl/glprototypes/gstgl_compat.h b/gst-libs/gst/gl/glprototypes/gstgl_compat.h
index 5e1f8bb..a4f963d 100644
--- a/gst-libs/gst/gl/glprototypes/gstgl_compat.h
+++ b/gst-libs/gst/gl/glprototypes/gstgl_compat.h
@@ -36,5 +36,29 @@
 #if !GST_GL_HAVE_GLINTPTR
 typedef ptrdiff_t GLintptr;
 #endif
+#if !GST_GL_HAVE_GLSYNC
+typedef gpointer GLsync;
+#endif
+#if !GST_GL_HAVE_GLUINT64
+typedef guint64 GLuint64;
+#endif
+
+#if !defined(GST_GL_DEBUG_PROC)
+#if defined(GLDEBUGPROC)
+#define GST_GL_DEBUG_PROC GLDEBUGPROC
+#elif defined(GLDEBUGPROCARB)
+#define GST_GL_DEBUG_PROC GLDEBUGPROCARB
+#elif defined(GLDEBUGPROCKHR)
+#define GST_GL_DEBUG_PROC GLDEBUGPROCKHR
+#else
+typedef void (GSTGLAPI *GST_GL_DEBUG_PROC) (GLenum source,
+                                            GLenum type,
+                                            GLuint id,
+                                            GLenum severity,
+                                            GLsizei length,
+                                            const gchar* message,
+                                            gpointer user_data);
+#endif
+#endif
 
 #endif
diff --git a/gst-libs/gst/gl/glprototypes/sync.h b/gst-libs/gst/gl/glprototypes/sync.h
new file mode 100644
index 0000000..3181037
--- /dev/null
+++ b/gst-libs/gst/gl/glprototypes/sync.h
@@ -0,0 +1,46 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (sync,
+                  GST_GL_API_OPENGL3,
+                  3, 2,
+                  3, 0,
+                  "",
+                  "")
+GST_GL_EXT_FUNCTION (GLsync, FenceSync,
+                     (GLenum condition,
+                      GLbitfield flags))
+GST_GL_EXT_FUNCTION (GLboolean, IsSync,
+                     (GLsync sync))
+GST_GL_EXT_FUNCTION (void, DeleteSync,
+                     (GLsync sync))
+GST_GL_EXT_FUNCTION (GLenum, ClientWaitSync,
+                     (GLsync sync,
+                      GLbitfield flags,
+                      GLuint64 timeout))
+GST_GL_EXT_FUNCTION (void, WaitSync,
+                     (GLsync sync,
+                      GLbitfield flags,
+                      GLuint64 timeout))
+GST_GL_EXT_FUNCTION (void, GetSynciv,
+                     (GLsync sync,
+                      GLenum flags,
+                      GLuint64 timeout))
+GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/vao.h b/gst-libs/gst/gl/glprototypes/vao.h
new file mode 100644
index 0000000..32d1159
--- /dev/null
+++ b/gst-libs/gst/gl/glprototypes/vao.h
@@ -0,0 +1,37 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GST_GL_EXT_BEGIN (vao,
+                  GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
+                  3, 0,
+                  3, 0,
+                  "ARB:\0OES\0",
+                  "vertex_array_object\0")
+GST_GL_EXT_FUNCTION (void, GenVertexArrays,
+                     (GLsizei               n,
+                      GLuint               *arrays))
+GST_GL_EXT_FUNCTION (void, DeleteVertexArrays,
+                     (GLsizei               n,
+                      GLuint               *arrays))
+GST_GL_EXT_FUNCTION (void, BindVertexArray,
+                     (GLuint                array))
+GST_GL_EXT_FUNCTION (GLboolean, IsVertexArray,
+                     (GLuint                array))
+GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/gstgl_fwd.h b/gst-libs/gst/gl/gstgl_fwd.h
index b0eedc0..d0100b6 100644
--- a/gst-libs/gst/gl/gstgl_fwd.h
+++ b/gst-libs/gst/gl/gstgl_fwd.h
@@ -63,6 +63,13 @@
 typedef struct _GstGLColorConvertClass GstGLColorConvertClass;
 typedef struct _GstGLColorConvertPrivate GstGLColorConvertPrivate;
 
+typedef struct _GstGLBaseFilter GstGLBaseFilter;
+typedef struct _GstGLBaseFilterClass GstGLBaseFilterClass;
+typedef struct _GstGLBaseFilterPrivate GstGLBaseFilterPrivate;
+
+typedef struct _GstGLFilter GstGLFilter;
+typedef struct _GstGLFilterClass GstGLFilterClass;
+
 G_END_DECLS
 
 #endif /* __GST_GL_FWD_H__ */
diff --git a/gst-libs/gst/gl/gstglapi.c b/gst-libs/gst/gl/gstglapi.c
index 5d7e621..3bee14b 100644
--- a/gst-libs/gst/gl/gstglapi.c
+++ b/gst-libs/gst/gl/gstglapi.c
@@ -24,8 +24,7 @@
 #include "gstglapi.h"
 
 /**
- * gst_gl_api_to_string():
- *
+ * gst_gl_api_to_string:
  * @api: a #GstGLAPI to stringify
  *
  * Returns: A space seperated string of the OpenGL api's enabled in @api
@@ -78,11 +77,10 @@
 }
 
 /**
- * gst_gl_api_from_string():
+ * gst_gl_api_from_string:
+ * @api_s: a space seperated string of OpenGL apis
  *
- * @apis_s: a space seperated string of OpenGL apis
- *
- * Returns: The #GstGLAPI represented by @apis_s
+ * Returns: The #GstGLAPI represented by @api_s
  */
 GstGLAPI
 gst_gl_api_from_string (const gchar * apis_s)
@@ -121,8 +119,7 @@
 }
 
 /**
- * gst_gl_platform_to_string():
- *
+ * gst_gl_platform_to_string:
  * @api: a #GstGLPlatform to stringify
  *
  * Returns: A space seperated string of the OpenGL platforms enabled in @api
@@ -165,8 +162,7 @@
 }
 
 /**
- * gst_gl_platform_from_string():
- *
+ * gst_gl_platform_from_string:
  * @platform_s: a space seperated string of OpenGL platformss
  *
  * Returns: The #GstGLPlatform represented by @platform_s
diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h
index 83b94a2..c260590 100644
--- a/gst-libs/gst/gl/gstglapi.h
+++ b/gst-libs/gst/gl/gstglapi.h
@@ -22,7 +22,6 @@
 #define __GST_GL_API_H__
 
 #include <gst/gl/gstglconfig.h>
-#include <gst/gl/glprototypes/gstgl_compat.h>
 
 #if GST_GL_HAVE_PLATFORM_EGL
 
@@ -75,11 +74,9 @@
 #   define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
 #   include <OpenGL/gl3.h>
 #  endif
-#  include <OpenGL/glu.h>
 # else
 #  include <GL/gl.h>
-#  include <GL/glu.h>
-#  if __WIN32__ || _WIN32
+#  if defined(__WIN32__) || defined(_WIN32)
 #   include <GL/glext.h>
 #  endif
 # endif
@@ -90,6 +87,7 @@
 #else
 #define GSTGLAPI
 #endif
+#include <gst/gl/glprototypes/gstgl_compat.h>
 
 #include <gst/gst.h>
 
@@ -125,7 +123,7 @@
 #define GST_GL_EXT_BEGIN(name, gl_availability, min_gl, maj_gl, gles_maj, \
     gles_min, ext_suf, ext_name)
 #define GST_GL_EXT_FUNCTION(ret, name, args) \
-  ret GSTGLAPI (*name) args;
+  ret (GSTGLAPI *name) args;
 #define GST_GL_EXT_END()
 
 typedef struct _GstGLFuncs
diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c
new file mode 100644
index 0000000..e61d7f7
--- /dev/null
+++ b/gst-libs/gst/gl/gstglbasefilter.c
@@ -0,0 +1,415 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/video/gstvideometa.h>
+
+#include <gst/gl/gl.h>
+
+#define GST_CAT_DEFAULT gst_gl_base_filter_debug
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
+
+#define GST_GL_BASE_FILTER_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_BASE_FILTER, GstGLBaseFilterPrivate))
+
+struct _GstGLBaseFilterPrivate
+{
+  GstGLContext *other_context;
+
+  gboolean gl_result;
+};
+
+/* Properties */
+enum
+{
+  PROP_0,
+  PROP_CONTEXT
+};
+
+#define gst_gl_base_filter_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstGLBaseFilter, gst_gl_base_filter,
+    GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_gl_base_filter_debug,
+        "glbasefilter", 0, "glbasefilter element");
+    );
+
+static void gst_gl_base_filter_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_gl_base_filter_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+static void gst_gl_base_filter_set_context (GstElement * element,
+    GstContext * context);
+static GstStateChangeReturn gst_gl_base_filter_change_state (GstElement *
+    element, GstStateChange transition);
+static gboolean gst_gl_base_filter_query (GstBaseTransform * trans,
+    GstPadDirection direction, GstQuery * query);
+static void gst_gl_base_filter_reset (GstGLBaseFilter * filter);
+static gboolean gst_gl_base_filter_start (GstBaseTransform * bt);
+static gboolean gst_gl_base_filter_stop (GstBaseTransform * bt);
+static gboolean gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
+    GstQuery * query);
+static gboolean gst_gl_base_filter_propose_allocation (GstBaseTransform * trans,
+    GstQuery * decide_query, GstQuery * query);
+
+/* GstGLContextThreadFunc */
+static void gst_gl_base_filter_gl_start (GstGLContext * context, gpointer data);
+static void gst_gl_base_filter_gl_stop (GstGLContext * context, gpointer data);
+
+static void
+gst_gl_base_filter_class_init (GstGLBaseFilterClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *element_class;
+
+  g_type_class_add_private (klass, sizeof (GstGLBaseFilterPrivate));
+
+  gobject_class = (GObjectClass *) klass;
+  element_class = GST_ELEMENT_CLASS (klass);
+
+  gobject_class->set_property = gst_gl_base_filter_set_property;
+  gobject_class->get_property = gst_gl_base_filter_get_property;
+
+  GST_BASE_TRANSFORM_CLASS (klass)->query = gst_gl_base_filter_query;
+  GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_base_filter_start;
+  GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_base_filter_stop;
+  GST_BASE_TRANSFORM_CLASS (klass)->decide_allocation =
+      gst_gl_base_filter_decide_allocation;
+  GST_BASE_TRANSFORM_CLASS (klass)->propose_allocation =
+      gst_gl_base_filter_propose_allocation;
+
+  element_class->set_context = gst_gl_base_filter_set_context;
+  element_class->change_state = gst_gl_base_filter_change_state;
+
+  g_object_class_install_property (gobject_class, PROP_CONTEXT,
+      g_param_spec_object ("context",
+          "OpenGL context",
+          "Get OpenGL context",
+          GST_GL_TYPE_CONTEXT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  klass->supported_gl_api = GST_GL_API_ANY;
+}
+
+static void
+gst_gl_base_filter_init (GstGLBaseFilter * filter)
+{
+  filter->priv = GST_GL_BASE_FILTER_GET_PRIVATE (filter);
+}
+
+static void
+gst_gl_base_filter_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  switch (prop_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_gl_base_filter_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (object);
+
+  switch (prop_id) {
+    case PROP_CONTEXT:
+      g_value_set_object (value, filter->context);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_gl_base_filter_set_context (GstElement * element, GstContext * context)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (element);
+  GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
+
+  gst_gl_handle_set_context (element, context, &filter->display,
+      &filter->priv->other_context);
+  if (filter->display)
+    gst_gl_display_filter_gl_api (filter->display,
+        filter_class->supported_gl_api);
+}
+
+static gboolean
+_find_local_gl_context (GstGLBaseFilter * filter)
+{
+  GstQuery *query;
+  GstContext *context;
+  const GstStructure *s;
+
+  if (filter->context)
+    return TRUE;
+
+  query = gst_query_new_context ("gst.gl.local_context");
+  if (!filter->context
+      && gst_gl_run_query (GST_ELEMENT (filter), query, GST_PAD_SRC)) {
+    gst_query_parse_context (query, &context);
+    if (context) {
+      s = gst_context_get_structure (context);
+      gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &filter->context,
+          NULL);
+    }
+  }
+  if (!filter->context
+      && gst_gl_run_query (GST_ELEMENT (filter), query, GST_PAD_SINK)) {
+    gst_query_parse_context (query, &context);
+    if (context) {
+      s = gst_context_get_structure (context);
+      gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &filter->context,
+          NULL);
+    }
+  }
+
+  GST_DEBUG_OBJECT (filter, "found local context %p", filter->context);
+
+  gst_query_unref (query);
+
+  if (filter->context)
+    return TRUE;
+
+  return FALSE;
+}
+
+static gboolean
+gst_gl_base_filter_query (GstBaseTransform * trans, GstPadDirection direction,
+    GstQuery * query)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (trans);
+  GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_ALLOCATION:
+    {
+      if (direction == GST_PAD_SINK
+          && gst_base_transform_is_passthrough (trans)) {
+        _find_local_gl_context (filter);
+
+        return gst_pad_peer_query (GST_BASE_TRANSFORM_SRC_PAD (trans), query);
+      }
+      break;
+    }
+    case GST_QUERY_CONTEXT:
+    {
+      const gchar *context_type;
+      GstContext *context, *old_context;
+      gboolean ret;
+
+      ret = gst_gl_handle_context_query ((GstElement *) filter, query,
+          &filter->display, &filter->priv->other_context);
+      if (filter->display)
+        gst_gl_display_filter_gl_api (filter->display,
+            filter_class->supported_gl_api);
+
+      gst_query_parse_context_type (query, &context_type);
+
+      if (g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
+        GstStructure *s;
+
+        gst_query_parse_context (query, &old_context);
+
+        if (old_context)
+          context = gst_context_copy (old_context);
+        else
+          context = gst_context_new ("gst.gl.local_context", FALSE);
+
+        s = gst_context_writable_structure (context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, filter->context,
+            NULL);
+        gst_query_set_context (query, context);
+        gst_context_unref (context);
+
+        ret = filter->context != NULL;
+      }
+      GST_LOG_OBJECT (filter, "context query of type %s %i", context_type, ret);
+
+      if (ret)
+        return ret;
+      break;
+    }
+    default:
+      break;
+  }
+
+  return GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, direction,
+      query);
+}
+
+static void
+gst_gl_base_filter_reset (GstGLBaseFilter * filter)
+{
+  GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
+
+  if (filter->context) {
+    if (filter_class->gl_stop != NULL) {
+      gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_stop,
+          filter);
+    }
+
+    gst_object_unref (filter->context);
+    filter->context = NULL;
+  }
+
+  if (filter->display) {
+    gst_object_unref (filter->display);
+    filter->display = NULL;
+  }
+
+  if (filter->priv->other_context) {
+    gst_object_unref (filter->priv->other_context);
+    filter->priv->other_context = NULL;
+  }
+}
+
+static gboolean
+gst_gl_base_filter_start (GstBaseTransform * bt)
+{
+  return TRUE;
+}
+
+static gboolean
+gst_gl_base_filter_stop (GstBaseTransform * bt)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (bt);
+
+  gst_gl_base_filter_reset (filter);
+
+  return TRUE;
+}
+
+static void
+gst_gl_base_filter_gl_start (GstGLContext * context, gpointer data)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (data);
+  GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
+
+  if (filter_class->gl_start) {
+    filter->priv->gl_result = filter_class->gl_start (filter);
+  } else {
+    filter->priv->gl_result = TRUE;
+  }
+}
+
+static void
+gst_gl_base_filter_gl_stop (GstGLContext * context, gpointer data)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (data);
+  GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
+
+  if (filter_class->gl_stop)
+    filter_class->gl_stop (filter);
+}
+
+static gboolean
+gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
+    GstQuery * query)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (trans);
+  GError *error = NULL;
+
+  _find_local_gl_context (filter);
+
+  if (!filter->context) {
+    do {
+      if (filter->context)
+        gst_object_unref (filter->context);
+      /* just get a GL context.  we don't care */
+      filter->context =
+          gst_gl_display_get_gl_context_for_thread (filter->display, NULL);
+      if (!filter->context) {
+        filter->context = gst_gl_context_new (filter->display);
+        if (!gst_gl_context_create (filter->context,
+                filter->priv->other_context, &error))
+          goto context_error;
+      }
+    } while (!gst_gl_display_add_context (filter->display, filter->context));
+  }
+
+  gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_start,
+      filter);
+  if (!filter->priv->gl_result)
+    goto error;
+
+  return TRUE;
+
+context_error:
+  {
+    GST_ELEMENT_ERROR (trans, RESOURCE, NOT_FOUND, ("%s", error->message),
+        (NULL));
+    return FALSE;
+  }
+error:
+  {
+    GST_ELEMENT_ERROR (trans, LIBRARY, INIT,
+        ("Subclass failed to initialize."), (NULL));
+    return FALSE;
+  }
+}
+
+static gboolean
+gst_gl_base_filter_propose_allocation (GstBaseTransform * trans,
+    GstQuery * decide_query, GstQuery * query)
+{
+  return FALSE;
+}
+
+static GstStateChangeReturn
+gst_gl_base_filter_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstGLBaseFilter *filter = GST_GL_BASE_FILTER (element);
+  GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
+  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+
+  GST_DEBUG_OBJECT (filter, "changing state: %s => %s",
+      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
+      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!gst_gl_ensure_element_data (element, &filter->display,
+              &filter->priv->other_context))
+        return GST_STATE_CHANGE_FAILURE;
+
+      gst_gl_display_filter_gl_api (filter->display,
+          filter_class->supported_gl_api);
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    default:
+      break;
+  }
+
+  return ret;
+}
diff --git a/gst-libs/gst/gl/gstglbasefilter.h b/gst-libs/gst/gl/gstglbasefilter.h
new file mode 100644
index 0000000..5ed3980
--- /dev/null
+++ b/gst-libs/gst/gl/gstglbasefilter.h
@@ -0,0 +1,83 @@
+/*
+ * GStreamer
+ * Copyright (C) 2007 David Schleef <ds@schleef.org>
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2008 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GST_GL_BASE_FILTER_H_
+#define _GST_GL_BASE_FILTER_H_
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+#include <gst/video/video.h>
+
+#include <gst/gl/gl.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_base_filter_get_type(void);
+#define GST_TYPE_GL_BASE_FILTER            (gst_gl_base_filter_get_type())
+#define GST_GL_BASE_FILTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BASE_FILTER,GstGLBaseFilter))
+#define GST_IS_GL_BASE_FILTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BASE_FILTER))
+#define GST_GL_BASE_FILTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_BASE_FILTER,GstGLBaseFilterClass))
+#define GST_IS_GL_BASE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_BASE_FILTER))
+#define GST_GL_BASE_FILTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_BASE_FILTER,GstGLBaseFilterClass))
+
+/**
+ * GstGLBaseFilter:
+ * @base_transform: parent #GstBaseTransform
+ * @display: the currently configured #GstGLDisplay
+ * @context: the currently configured #GstGLContext
+ *
+ * #GstGLBaseFilter is a base class that provides the logic of getting the
+ * GL context from the pipeline.
+ */
+struct _GstGLBaseFilter
+{
+  GstBaseTransform   parent;
+
+  GstGLDisplay      *display;
+  GstGLContext      *context;
+
+  /* <private> */
+  gpointer _padding[GST_PADDING];
+
+  GstGLBaseFilterPrivate *priv;
+};
+
+/**
+ * GstGLBaseFilterClass:
+ * @base_transform_class: parent class
+ * @gl_start: called in the GL thread to setup the element GL state.
+ * @gl_stop: called in the GL thread to setup the element GL state.
+ */
+struct _GstGLBaseFilterClass
+{
+  GstBaseTransformClass parent_class;
+  GstGLAPI supported_gl_api;
+
+  gboolean (*gl_start)          (GstGLBaseFilter *filter);
+  void     (*gl_stop)           (GstGLBaseFilter *filter);
+
+  gpointer _padding[GST_PADDING];
+};
+
+G_END_DECLS
+
+#endif /* _GST_GL_BASE_FILTER_H_ */
diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c
index e716527..6dd496c 100644
--- a/gst-libs/gst/gl/gstglbufferpool.c
+++ b/gst-libs/gst/gl/gstglbufferpool.c
@@ -24,6 +24,7 @@
 
 #include "gl.h"
 #include "gstglbufferpool.h"
+#include "gstglutils.h"
 
 #if GST_GL_HAVE_PLATFORM_EGL
 #include <gst/gl/egl/gsteglimagememory.h>
@@ -50,7 +51,10 @@
   GstCaps *caps;
   gint im_format;
   GstVideoInfo info;
+  GstVideoAlignment valign;
   gboolean add_videometa;
+  gboolean add_uploadmeta;
+  gboolean add_glsyncmeta;
   gboolean want_eglimage;
   GstBuffer *last_buffer;
 };
@@ -71,7 +75,11 @@
 static const gchar **
 gst_gl_buffer_pool_get_options (GstBufferPool * pool)
 {
-  static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META, NULL
+  static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META,
+    GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META,
+    GST_BUFFER_POOL_OPTION_GL_SYNC_META,
+    GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT,
+    NULL
   };
 
   return options;
@@ -83,12 +91,15 @@
   GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
   GstGLBufferPoolPrivate *priv = glpool->priv;
   GstVideoInfo info;
-  GstCaps *caps;
-  GstAllocator *allocator;
+  GstCaps *caps = NULL;
+  guint min_buffers, max_buffers;
+  GstAllocator *allocator = NULL;
   GstAllocationParams alloc_params;
   gboolean reset = TRUE;
+  gint p;
 
-  if (!gst_buffer_pool_config_get_params (config, &caps, NULL, NULL, NULL))
+  if (!gst_buffer_pool_config_get_params (config, &caps, NULL, &min_buffers,
+          &max_buffers))
     goto wrong_config;
 
   if (caps == NULL)
@@ -104,11 +115,16 @@
   if (!gst_buffer_pool_config_get_allocator (config, &allocator, &alloc_params))
     goto wrong_config;
 
+  if (priv->allocator)
+    gst_object_unref (priv->allocator);
+
   if (!allocator) {
     gst_gl_memory_init ();
-    allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
+    priv->allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
+  } else {
+    priv->allocator = gst_object_ref (allocator);
   }
-  priv->allocator = allocator;
+
   priv->params = alloc_params;
 
   priv->im_format = GST_VIDEO_INFO_FORMAT (&info);
@@ -123,14 +139,32 @@
 
   priv->add_videometa = gst_buffer_pool_config_has_option (config,
       GST_BUFFER_POOL_OPTION_VIDEO_META);
+  priv->add_uploadmeta = gst_buffer_pool_config_has_option (config,
+      GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META);
+  priv->add_glsyncmeta = gst_buffer_pool_config_has_option (config,
+      GST_BUFFER_POOL_OPTION_GL_SYNC_META);
 
 #if GST_GL_HAVE_PLATFORM_EGL
-  priv->want_eglimage = (priv->allocator
-      && g_strcmp0 (priv->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
+  g_assert (priv->allocator != NULL);
+  priv->want_eglimage =
+      (g_strcmp0 (priv->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
 #else
   priv->want_eglimage = FALSE;
 #endif
 
+  if (gst_buffer_pool_config_has_option (config,
+          GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) {
+
+    priv->add_videometa = TRUE;
+
+    gst_buffer_pool_config_get_video_alignment (config, &priv->valign);
+    gst_video_info_align (&priv->info, &priv->valign);
+
+    gst_buffer_pool_config_set_video_alignment (config, &priv->valign);
+  } else {
+    gst_video_alignment_reset (&priv->valign);
+  }
+
   if (reset) {
     if (glpool->upload)
       gst_object_unref (glpool->upload);
@@ -138,6 +172,17 @@
     glpool->upload = gst_gl_upload_meta_new (glpool->context);
   }
 
+  /* Recalulate the size and offset as we don't add padding between planes. */
+  priv->info.size = 0;
+  for (p = 0; p < GST_VIDEO_INFO_N_PLANES (&priv->info); p++) {
+    priv->info.offset[p] = priv->info.size;
+    priv->info.size +=
+        gst_gl_get_plane_data_size (&priv->info, &priv->valign, p);
+  }
+
+  gst_buffer_pool_config_set_params (config, caps, priv->info.size,
+      min_buffers, max_buffers);
+
   return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config);
 
   /* ERRORS */
@@ -188,9 +233,11 @@
   GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
   GstGLBufferPoolPrivate *priv = glpool->priv;
   GstVideoInfo *info;
+  GstVideoAlignment *valign;
   GstBuffer *buf;
 
   info = &priv->info;
+  valign = &priv->valign;
 
   if (!(buf = gst_buffer_new ())) {
     goto no_buffer;
@@ -208,10 +255,15 @@
   }
 #endif
 
-  if (!gst_gl_memory_setup_buffer (glpool->context, info, buf))
+  if (!gst_gl_memory_setup_buffer (glpool->context, &priv->params, info,
+          valign, buf))
     goto mem_create_failed;
 
-  gst_gl_upload_meta_add_to_buffer (glpool->upload, buf);
+  if (priv->add_uploadmeta)
+    gst_gl_upload_meta_add_to_buffer (glpool->upload, buf);
+
+  if (priv->add_glsyncmeta)
+    gst_buffer_add_gl_sync_meta (glpool->context, buf);
 
   *buffer = buf;
 
@@ -286,7 +338,8 @@
   pool = g_object_new (GST_TYPE_GL_BUFFER_POOL, NULL);
   pool->context = gst_object_ref (context);
 
-  GST_LOG_OBJECT (pool, "new GL buffer pool %p", pool);
+  GST_LOG_OBJECT (pool, "new GL buffer pool for context %" GST_PTR_FORMAT,
+      context);
 
   return GST_BUFFER_POOL_CAST (pool);
 }
@@ -338,6 +391,7 @@
   priv->caps = NULL;
   priv->im_format = GST_VIDEO_FORMAT_UNKNOWN;
   priv->add_videometa = TRUE;
+  priv->add_glsyncmeta = FALSE;
   priv->want_eglimage = FALSE;
   priv->last_buffer = FALSE;
 
@@ -368,4 +422,9 @@
     gst_object_unref (pool->context);
     pool->context = NULL;
   }
+
+  if (priv->allocator) {
+    gst_object_unref (priv->allocator);
+    priv->allocator = NULL;
+  }
 }
diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
index 2c76694..86906bb 100644
--- a/gst-libs/gst/gl/gstglcolorconvert.c
+++ b/gst-libs/gst/gl/gstglcolorconvert.c
@@ -110,7 +110,7 @@
 static const gfloat from_rgb_bt709_vcoeff[] = { 0.440654, -0.400285, -0.040370 };
 
 
-/** GRAY16 to RGB conversion 
+/* GRAY16 to RGB conversion
  *  data transfered as GL_LUMINANCE_ALPHA then convert back to GRAY16 
  *  high byte weight as : 255*256/65535 
  *  ([0~1] denormalize to [0~255],shift to high byte,normalize to [0~1])
@@ -136,7 +136,24 @@
       " gl_FragColor = vec4(t.%c, t.%c, t.%c, t.%c);\n"
       "}";
 
-/** GRAY16 to RGB conversion 
+static const gchar frag_APPLE_YUV_TO_RGB[] =
+      "#ifdef GL_ES\n"
+      "precision mediump float;\n"
+      "#endif\n"
+      "varying vec2 v_texcoord;\n"
+      "uniform float width;\n"
+      "uniform float height;\n"
+      "uniform sampler2DRect tex;\n"
+      "uniform vec2 tex_scale0;\n"
+      "uniform vec2 tex_scale1;\n"
+      "uniform vec2 tex_scale2;\n"
+      "void main(void)\n"
+      "{\n"
+      " vec4 t = texture2DRect(tex, v_texcoord * vec2(width, height) * tex_scale0);\n"
+      " gl_FragColor = vec4(t.%c, t.%c, t.%c, t.%c);\n"
+      "}";
+
+/* GRAY16 to RGB conversion
  *  data transfered as GL_LUMINANCE_ALPHA then convert back to GRAY16 
  *  high byte weight as : 255*256/65535 
  *  ([0~1] denormalize to [0~255],shift to high byte,normalize to [0~1])
@@ -206,7 +223,7 @@
     "  gl_FragColor = vec4(a,y,u,v);\n"
     "}\n";
 
-/** YUV to RGB conversion */
+/* YUV to RGB conversion */
 static const char frag_PLANAR_YUV_to_RGB[] =
     "#ifdef GL_ES\n"
     "precision mediump float;\n"
@@ -278,7 +295,7 @@
     "  gl_FragData[2] = vec4(v, 0.0, 0.0, 1.0);\n"
     "}\n";
 
-/** NV12/NV21 to RGB conversion */
+/* NV12/NV21 to RGB conversion */
 static const char frag_NV12_NV21_to_RGB[] = {
       "#ifdef GL_ES\n"
       "precision mediump float;\n"
@@ -392,6 +409,15 @@
     "   v_texcoord = a_texcoord;  \n"
     "}                            \n";
 
+static const GLfloat vertices[] = {
+     1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
+    -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
+    -1.0f,  1.0f, 0.0f, 0.0f, 1.0f,
+     1.0f,  1.0f, 0.0f, 1.0f, 1.0f
+};
+
+static const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
 /* *INDENT-ON* */
 
 struct ConvertInfo
@@ -415,6 +441,12 @@
 
   GstGLMemory *in_tex[GST_VIDEO_MAX_PLANES];
   GstGLMemory *out_tex[GST_VIDEO_MAX_PLANES];
+
+  GLuint vao;
+  GLuint vertex_buffer;
+  GLuint vbo_indices;
+  GLuint attr_position;
+  GLuint attr_texture;
 };
 
 GST_DEBUG_CATEGORY_STATIC (gst_gl_color_convert_debug);
@@ -466,6 +498,9 @@
   gst_video_info_set_format (&convert->out_info, GST_VIDEO_FORMAT_ENCODED, 0,
       0);
 
+  GST_DEBUG_OBJECT (convert,
+      "Created new colorconvert for context %" GST_PTR_FORMAT, context);
+
   return convert;
 }
 
@@ -487,6 +522,27 @@
 }
 
 static void
+_reset_gl (GstGLContext * context, GstGLColorConvert * convert)
+{
+  const GstGLFuncs *gl = context->gl_vtable;
+
+  if (convert->priv->vao) {
+    gl->DeleteVertexArrays (1, &convert->priv->vao);
+    convert->priv->vao = 0;
+  }
+
+  if (convert->priv->vertex_buffer) {
+    gl->DeleteBuffers (1, &convert->priv->vertex_buffer);
+    convert->priv->vertex_buffer = 0;
+  }
+
+  if (convert->priv->vbo_indices) {
+    gl->DeleteBuffers (1, &convert->priv->vbo_indices);
+    convert->priv->vbo_indices = 0;
+  }
+}
+
+static void
 gst_gl_color_convert_reset (GstGLColorConvert * convert)
 {
   guint i;
@@ -511,49 +567,138 @@
     gst_object_unref (convert->shader);
     convert->shader = NULL;
   }
+
+  if (convert->context) {
+    gst_gl_context_thread_add (convert->context,
+        (GstGLContextThreadFunc) _reset_gl, convert);
+  }
 }
 
-static void
-_gst_gl_color_convert_set_format_unlocked (GstGLColorConvert * convert,
-    GstVideoInfo * in_info, GstVideoInfo * out_info)
+static gboolean
+_gst_gl_color_convert_set_caps_unlocked (GstGLColorConvert * convert,
+    GstCaps * in_caps, GstCaps * out_caps)
 {
-  g_return_if_fail (convert != NULL);
-  g_return_if_fail (in_info);
-  g_return_if_fail (out_info);
-  g_return_if_fail (GST_VIDEO_INFO_FORMAT (in_info) !=
-      GST_VIDEO_FORMAT_UNKNOWN);
-  g_return_if_fail (GST_VIDEO_INFO_FORMAT (in_info) !=
-      GST_VIDEO_FORMAT_ENCODED);
-  g_return_if_fail (GST_VIDEO_INFO_FORMAT (out_info) !=
-      GST_VIDEO_FORMAT_UNKNOWN);
-  g_return_if_fail (GST_VIDEO_INFO_FORMAT (out_info) !=
-      GST_VIDEO_FORMAT_ENCODED);
+  GstVideoInfo in_info, out_info;
+  GstCapsFeatures *in_features, *out_features;
 
-  if (gst_video_info_is_equal (&convert->in_info, in_info) &&
-      gst_video_info_is_equal (&convert->out_info, out_info))
-    return;
+  g_return_val_if_fail (convert != NULL, FALSE);
+  g_return_val_if_fail (in_caps, FALSE);
+  g_return_val_if_fail (out_caps, FALSE);
+
+  if (!gst_video_info_from_caps (&in_info, in_caps))
+    g_assert_not_reached ();
+
+  if (!gst_video_info_from_caps (&out_info, out_caps))
+    g_assert_not_reached ();
+
+  g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&in_info) !=
+      GST_VIDEO_FORMAT_UNKNOWN, FALSE);
+  g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&in_info) !=
+      GST_VIDEO_FORMAT_ENCODED, FALSE);
+  g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&out_info) !=
+      GST_VIDEO_FORMAT_UNKNOWN, FALSE);
+  g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&out_info) !=
+      GST_VIDEO_FORMAT_ENCODED, FALSE);
+
+  in_features = gst_caps_get_features (in_caps, 0);
+  out_features = gst_caps_get_features (out_caps, 0);
+
+  if (!gst_caps_features_contains (in_features,
+          GST_CAPS_FEATURE_MEMORY_GL_MEMORY)
+      || !gst_caps_features_contains (out_features,
+          GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
+    return FALSE;
+  }
+
+  if (gst_video_info_is_equal (&convert->in_info, &in_info) &&
+      gst_video_info_is_equal (&convert->out_info, &out_info))
+    return TRUE;
 
   gst_gl_color_convert_reset (convert);
-  convert->in_info = *in_info;
-  convert->out_info = *out_info;
+  convert->in_info = in_info;
+  convert->out_info = out_info;
   convert->initted = FALSE;
+
+  return TRUE;
 }
 
 /**
- * gst_gl_color_convert_set_format:
+ * gst_gl_color_convert_set_caps:
  * @convert: a #GstGLColorConvert
  * @in_info: input #GstVideoInfo
  * @out_info: output #GstVideoInfo
  *
  * Initializes @convert with the information required for conversion.
  */
-void
-gst_gl_color_convert_set_format (GstGLColorConvert * convert,
-    GstVideoInfo * in_info, GstVideoInfo * out_info)
+gboolean
+gst_gl_color_convert_set_caps (GstGLColorConvert * convert,
+    GstCaps * in_caps, GstCaps * out_caps)
 {
+  gboolean ret;
+
   GST_OBJECT_LOCK (convert);
-  _gst_gl_color_convert_set_format_unlocked (convert, in_info, out_info);
+  ret = _gst_gl_color_convert_set_caps_unlocked (convert, in_caps, out_caps);
   GST_OBJECT_UNLOCK (convert);
+
+  return ret;
+}
+
+/* copies the given caps */
+static GstCaps *
+gst_gl_color_convert_caps_remove_format_info (GstCaps * caps)
+{
+  GstStructure *st;
+  GstCapsFeatures *f;
+  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);
+    f = gst_caps_get_features (caps, i);
+
+    /* If this is already expressed by the existing caps
+     * skip this structure */
+    if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
+      continue;
+
+    st = gst_structure_copy (st);
+    gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
+        NULL);
+
+    gst_caps_append_structure_full (res, st,
+        gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
+  }
+
+  return res;
+}
+
+GstCaps *
+gst_gl_color_convert_transform_caps (GstGLContext * convert,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
+{
+  GstCaps *templ, *result;
+
+  templ =
+      gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
+      (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_GL_COLOR_CONVERT_FORMATS));
+
+  caps = gst_gl_color_convert_caps_remove_format_info (caps);
+  result = gst_caps_intersect (caps, templ);
+  gst_caps_unref (caps);
+  gst_caps_unref (templ);
+
+  if (filter) {
+    GstCaps *tmp;
+
+    tmp = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (result);
+    result = tmp;
+  }
+
+  return result;
 }
 
 /**
@@ -562,7 +707,7 @@
  * @inbuf: the texture ids for input formatted according to in_info
  *
  * Converts the data contained by @inbuf using the formats specified by the
- * #GstVideoInfo<!--  -->s passed to gst_gl_color_convert_set_format() 
+ * #GstVideoInfo<!--  -->s passed to gst_gl_color_convert_set_caps() 
  *
  * Returns: a converted #GstBuffer or %NULL%
  */
@@ -597,7 +742,7 @@
 
   if (!convert->priv->result) {
     if (convert->outbuf)
-      gst_object_unref (convert->outbuf);
+      gst_buffer_unref (convert->outbuf);
     convert->outbuf = NULL;
     return NULL;
   }
@@ -644,12 +789,26 @@
   gchar *expect, *want;
   int len;
 
-  if (g_ascii_strcasecmp (expected, wanted) == 0)
+  if (g_ascii_strcasecmp (expected, wanted) == 0) {
+    g_string_free (ret, TRUE);
     return g_ascii_strdown (expected, -1);
+  }
 
   expect = g_ascii_strdown (expected, -1);
   want = g_ascii_strdown (wanted, -1);
 
+  if (strcmp (expect, "rgb16") == 0 || strcmp (expect, "bgr16") == 0) {
+    gchar *temp = expect;
+    expect = g_strndup (temp, 3);
+    g_free (temp);
+  }
+
+  if (strcmp (want, "rgb16") == 0 || strcmp (want, "bgr16") == 0) {
+    gchar *temp = want;
+    want = g_strndup (temp, 3);
+    g_free (temp);
+  }
+
   /* pad want with 'a's */
   if ((len = strlen (want)) < 4) {
     gchar *new_want = g_strndup (want, 4);
@@ -744,77 +903,104 @@
       gst_gl_context_check_feature (convert->context, "GL_EXT_texture_rg")
       || gst_gl_context_check_feature (convert->context, "GL_ARB_texture_rg");
 #endif
+  gboolean apple_ycbcr = gst_gl_context_check_feature (convert->context,
+      "GL_APPLE_ycbcr_422");
+  gboolean in_tex_rectangular = FALSE;
+
+#if GST_GL_HAVE_OPENGL
+  GstMemory *memory = gst_buffer_peek_memory (convert->inbuf, 0);
+  if (gst_is_gl_memory (memory) && (USING_OPENGL (convert->context)
+          || USING_OPENGL3 (convert->context))) {
+    in_tex_rectangular =
+        ((GstGLMemory *) memory)->tex_target == GL_TEXTURE_RECTANGLE;
+  }
+#endif
 
   info->out_n_textures = 1;
 
-  switch (GST_VIDEO_INFO_FORMAT (&convert->in_info)) {
-    case GST_VIDEO_FORMAT_AYUV:
-      info->frag_prog = g_strdup_printf (frag_AYUV_to_RGB, pixel_order[0],
-          pixel_order[1], pixel_order[2], pixel_order[3]);
-      info->in_n_textures = 1;
-      info->shader_tex_names[0] = "tex";
-      break;
-    case GST_VIDEO_FORMAT_I420:
-    case GST_VIDEO_FORMAT_Y444:
-    case GST_VIDEO_FORMAT_Y42B:
-    case GST_VIDEO_FORMAT_Y41B:
-      info->frag_prog = g_strdup_printf (frag_PLANAR_YUV_to_RGB, pixel_order[0],
-          pixel_order[1], pixel_order[2], pixel_order[3]);
-      info->in_n_textures = 3;
-      info->shader_tex_names[0] = "Ytex";
-      info->shader_tex_names[1] = "Utex";
-      info->shader_tex_names[2] = "Vtex";
-      break;
-    case GST_VIDEO_FORMAT_YV12:
-      info->frag_prog = g_strdup_printf (frag_PLANAR_YUV_to_RGB, pixel_order[0],
-          pixel_order[1], pixel_order[2], pixel_order[3]);
-      info->in_n_textures = 3;
-      info->shader_tex_names[0] = "Ytex";
-      info->shader_tex_names[1] = "Vtex";
-      info->shader_tex_names[2] = "Utex";
-      break;
-    case GST_VIDEO_FORMAT_YUY2:
-    {
-      char uv_val = texture_rg ? 'g' : 'a';
-      info->frag_prog = g_strdup_printf (frag_YUY2_UYVY_to_RGB, 'r', uv_val,
-          uv_val, 'g', 'a', pixel_order[0], pixel_order[1], pixel_order[2],
-          pixel_order[3]);
-      info->in_n_textures = 1;
-      info->shader_tex_names[0] = "Ytex";
-      break;
+  if (in_tex_rectangular && apple_ycbcr
+      && gst_buffer_n_memory (convert->inbuf) == 1) {
+    /* FIXME: We should probably also check if tex_target actually is using
+     * the Apple YCbCr422 extension. It could also be a normal UYVY texture
+     * with RB or Lum/Alpha
+     */
+    info->frag_prog =
+        g_strdup_printf (frag_APPLE_YUV_TO_RGB, pixel_order[0], pixel_order[1],
+        pixel_order[2], pixel_order[3]);
+    info->in_n_textures = 1;
+    info->shader_tex_names[0] = "tex";
+  } else {
+    switch (GST_VIDEO_INFO_FORMAT (&convert->in_info)) {
+      case GST_VIDEO_FORMAT_AYUV:
+        info->frag_prog = g_strdup_printf (frag_AYUV_to_RGB, pixel_order[0],
+            pixel_order[1], pixel_order[2], pixel_order[3]);
+        info->in_n_textures = 1;
+        info->shader_tex_names[0] = "tex";
+        break;
+      case GST_VIDEO_FORMAT_I420:
+      case GST_VIDEO_FORMAT_Y444:
+      case GST_VIDEO_FORMAT_Y42B:
+      case GST_VIDEO_FORMAT_Y41B:
+        info->frag_prog =
+            g_strdup_printf (frag_PLANAR_YUV_to_RGB, pixel_order[0],
+            pixel_order[1], pixel_order[2], pixel_order[3]);
+        info->in_n_textures = 3;
+        info->shader_tex_names[0] = "Ytex";
+        info->shader_tex_names[1] = "Utex";
+        info->shader_tex_names[2] = "Vtex";
+        break;
+      case GST_VIDEO_FORMAT_YV12:
+        info->frag_prog =
+            g_strdup_printf (frag_PLANAR_YUV_to_RGB, pixel_order[0],
+            pixel_order[1], pixel_order[2], pixel_order[3]);
+        info->in_n_textures = 3;
+        info->shader_tex_names[0] = "Ytex";
+        info->shader_tex_names[1] = "Vtex";
+        info->shader_tex_names[2] = "Utex";
+        break;
+      case GST_VIDEO_FORMAT_YUY2:
+      {
+        char uv_val = texture_rg ? 'g' : 'a';
+        info->frag_prog = g_strdup_printf (frag_YUY2_UYVY_to_RGB, 'r', uv_val,
+            uv_val, 'g', 'a', pixel_order[0], pixel_order[1], pixel_order[2],
+            pixel_order[3]);
+        info->in_n_textures = 1;
+        info->shader_tex_names[0] = "Ytex";
+        break;
+      }
+      case GST_VIDEO_FORMAT_NV12:
+      {
+        char val2 = texture_rg ? 'g' : 'a';
+        info->frag_prog = g_strdup_printf (frag_NV12_NV21_to_RGB, 'r', val2,
+            pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
+        info->in_n_textures = 2;
+        info->shader_tex_names[0] = "Ytex";
+        info->shader_tex_names[1] = "UVtex";
+        break;
+      }
+      case GST_VIDEO_FORMAT_NV21:
+      {
+        char val2 = texture_rg ? 'g' : 'a';
+        info->frag_prog = g_strdup_printf (frag_NV12_NV21_to_RGB, val2, 'r',
+            pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
+        info->in_n_textures = 2;
+        info->shader_tex_names[0] = "Ytex";
+        info->shader_tex_names[1] = "UVtex";
+        break;
+      }
+      case GST_VIDEO_FORMAT_UYVY:
+      {
+        char y_val = texture_rg ? 'g' : 'a';
+        info->frag_prog = g_strdup_printf (frag_YUY2_UYVY_to_RGB, y_val, 'g',
+            'g', 'r', 'b', pixel_order[0], pixel_order[1], pixel_order[2],
+            pixel_order[3]);
+        info->in_n_textures = 1;
+        info->shader_tex_names[0] = "Ytex";
+        break;
+      }
+      default:
+        break;
     }
-    case GST_VIDEO_FORMAT_NV12:
-    {
-      char val2 = texture_rg ? 'g' : 'a';
-      info->frag_prog = g_strdup_printf (frag_NV12_NV21_to_RGB, 'r', val2,
-          pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
-      info->in_n_textures = 2;
-      info->shader_tex_names[0] = "Ytex";
-      info->shader_tex_names[1] = "UVtex";
-      break;
-    }
-    case GST_VIDEO_FORMAT_NV21:
-    {
-      char val2 = texture_rg ? 'g' : 'a';
-      info->frag_prog = g_strdup_printf (frag_NV12_NV21_to_RGB, val2, 'r',
-          pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
-      info->in_n_textures = 2;
-      info->shader_tex_names[0] = "Ytex";
-      info->shader_tex_names[1] = "UVtex";
-      break;
-    }
-    case GST_VIDEO_FORMAT_UYVY:
-    {
-      char y_val = texture_rg ? 'g' : 'a';
-      info->frag_prog = g_strdup_printf (frag_YUY2_UYVY_to_RGB, y_val, 'g',
-          'g', 'r', 'b', pixel_order[0], pixel_order[1], pixel_order[2],
-          pixel_order[3]);
-      info->in_n_textures = 1;
-      info->shader_tex_names[0] = "Ytex";
-      break;
-    }
-    default:
-      break;
   }
 
   if (gst_video_colorimetry_matches (&convert->in_info.colorimetry,
@@ -986,6 +1172,36 @@
   g_free (pixel_order);
 }
 
+static void
+_bind_buffer (GstGLColorConvert * convert)
+{
+  const GstGLFuncs *gl = convert->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, convert->priv->vertex_buffer);
+
+  /* Load the vertex position */
+  gl->VertexAttribPointer (convert->priv->attr_position, 3, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) 0);
+
+  /* Load the texture coordinate */
+  gl->VertexAttribPointer (convert->priv->attr_texture, 2, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
+
+  gl->EnableVertexAttribArray (convert->priv->attr_position);
+  gl->EnableVertexAttribArray (convert->priv->attr_texture);
+}
+
+static void
+_unbind_buffer (GstGLColorConvert * convert)
+{
+  const GstGLFuncs *gl = convert->context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  gl->DisableVertexAttribArray (convert->priv->attr_position);
+  gl->DisableVertexAttribArray (convert->priv->attr_texture);
+}
+
 /* Called in the gl thread */
 static gboolean
 _init_convert (GstGLColorConvert * convert)
@@ -1068,9 +1284,9 @@
   if (!res)
     goto error;
 
-  convert->shader_attr_position_loc =
+  convert->priv->attr_position =
       gst_gl_shader_get_attribute_location (convert->shader, "a_position");
-  convert->shader_attr_texture_loc =
+  convert->priv->attr_texture =
       gst_gl_shader_get_attribute_location (convert->shader, "a_texcoord");
 
   gst_gl_shader_use (convert->shader);
@@ -1109,6 +1325,34 @@
     goto error;
   }
 
+  if (!convert->priv->vertex_buffer) {
+    if (gl->GenVertexArrays) {
+      gl->GenVertexArrays (1, &convert->priv->vao);
+      gl->BindVertexArray (convert->priv->vao);
+    }
+
+    gl->GenBuffers (1, &convert->priv->vertex_buffer);
+    gl->BindBuffer (GL_ARRAY_BUFFER, convert->priv->vertex_buffer);
+    gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
+        GL_STATIC_DRAW);
+
+    if (gl->GenVertexArrays) {
+      _bind_buffer (convert);
+      gl->BindVertexArray (0);
+    }
+
+    gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+  }
+
+  if (!convert->priv->vbo_indices) {
+    gl->GenBuffers (1, &convert->priv->vbo_indices);
+    gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, convert->priv->vbo_indices);
+    gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
+        GL_STATIC_DRAW);
+    gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+  }
+
+
   gl->BindTexture (GL_TEXTURE_2D, 0);
 
   convert->initted = TRUE;
@@ -1166,7 +1410,7 @@
   /* setup the render buffer for depth */
   gl->GenRenderbuffers (1, &convert->depth_buffer);
   gl->BindRenderbuffer (GL_RENDERBUFFER, convert->depth_buffer);
-  if (USING_OPENGL (convert->context)) {
+  if (USING_OPENGL (convert->context) || USING_OPENGL3 (convert->context)) {
     gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT,
         out_width, out_height);
     gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
@@ -1240,19 +1484,12 @@
   }
 
   convert->outbuf = gst_buffer_new ();
-  if (!gst_gl_memory_setup_buffer (convert->context, &convert->out_info,
-          convert->outbuf)) {
+  if (!gst_gl_memory_setup_buffer (convert->context, NULL, &convert->out_info,
+          NULL, convert->outbuf)) {
     convert->priv->result = FALSE;
     return;
   }
 
-  gst_buffer_add_video_meta_full (convert->outbuf, 0,
-      GST_VIDEO_INFO_FORMAT (&convert->out_info),
-      GST_VIDEO_INFO_WIDTH (&convert->out_info),
-      GST_VIDEO_INFO_HEIGHT (&convert->out_info),
-      GST_VIDEO_INFO_N_PLANES (&convert->out_info),
-      convert->out_info.offset, convert->out_info.stride);
-
   for (i = 0; i < c_info->in_n_textures; i++) {
     convert->priv->in_tex[i] =
         (GstGLMemory *) gst_buffer_peek_memory (convert->inbuf, i);
@@ -1273,22 +1510,32 @@
   for (j = 0; j < c_info->out_n_textures; j++) {
     GstGLMemory *out_tex =
         (GstGLMemory *) gst_buffer_peek_memory (convert->outbuf, j);
+    gint mem_width, mem_height;
+
     if (!gst_is_gl_memory ((GstMemory *) out_tex)) {
       GST_ERROR_OBJECT (convert, "output must be GstGLMemory");
       res = FALSE;
       goto out;
     }
 
+    mem_width = gst_gl_memory_get_texture_width (out_tex);
+    mem_height = gst_gl_memory_get_texture_height (out_tex);
+
     if (out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
         || out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA
-        || out_width != out_tex->width || out_height != out_tex->height) {
+        || out_width != mem_width || out_height != mem_height) {
       /* Luminance formats are not color renderable */
       /* renderering to a framebuffer only renders the intersection of all
        * the attachments i.e. the smallest attachment size */
+      GstVideoInfo temp_info;
+
+      gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA, out_width,
+          out_height);
+
       if (!convert->priv->out_tex[j])
         convert->priv->out_tex[j] =
-            (GstGLMemory *) gst_gl_memory_alloc (context,
-            GST_VIDEO_GL_TEXTURE_TYPE_RGBA, out_width, out_height, out_width);
+            (GstGLMemory *) gst_gl_memory_alloc (context, NULL, &temp_info, 0,
+            NULL);
     } else {
       convert->priv->out_tex[j] = out_tex;
     }
@@ -1316,11 +1563,16 @@
   for (j--; j >= 0; j--) {
     GstGLMemory *out_tex =
         (GstGLMemory *) gst_buffer_peek_memory (convert->outbuf, j);
+    gint mem_width, mem_height;
+
     gst_memory_unmap ((GstMemory *) convert->priv->out_tex[j], &out_info[j]);
 
+    mem_width = gst_gl_memory_get_texture_width (out_tex);
+    mem_height = gst_gl_memory_get_texture_height (out_tex);
+
     if (out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
         || out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA
-        || out_width != out_tex->width || out_height != out_tex->height) {
+        || out_width != mem_width || out_height != mem_height) {
       GstMapInfo to_info, from_info;
 
       if (!gst_memory_map ((GstMemory *) convert->priv->out_tex[j], &from_info,
@@ -1338,8 +1590,8 @@
         continue;
       }
       gst_gl_memory_copy_into_texture (convert->priv->out_tex[j],
-          out_tex->tex_id, out_tex->tex_type, out_tex->width, out_tex->height,
-          out_tex->stride, FALSE);
+          out_tex->tex_id, out_tex->tex_type, mem_width, mem_height,
+          GST_VIDEO_INFO_PLANE_STRIDE (&out_tex->info, out_tex->plane), FALSE);
       gst_memory_unmap ((GstMemory *) convert->priv->out_tex[j], &from_info);
       gst_memory_unmap ((GstMemory *) out_tex, &to_info);
     } else {
@@ -1365,6 +1617,14 @@
     convert->outbuf = NULL;
   }
 
+  if (convert->outbuf) {
+    GstGLSyncMeta *sync_meta =
+        gst_buffer_add_gl_sync_meta (convert->context, convert->outbuf);
+
+    if (sync_meta)
+      gst_gl_sync_meta_set_sync_point (sync_meta, convert->context);
+  }
+
   convert->priv->result = res;
   return;
 }
@@ -1379,18 +1639,6 @@
 
   GLint viewport_dim[4];
 
-  const GLfloat vVertices[] = { 1.0f, -1.0f, 0.0f,
-    1.0f, 0.0f,
-    -1.0f, -1.0f, 0.0f,
-    0.0f, 0.0f,
-    -1.0f, 1.0f, 0.0f,
-    0.0f, 1.0f,
-    1.0f, 1.0f, 0.0f,
-    1.0f, 1.0f
-  };
-
-  GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
   GLenum multipleRT[] = {
     GL_COLOR_ATTACHMENT0,
     GL_COLOR_ATTACHMENT1,
@@ -1422,29 +1670,24 @@
 
   gl->Viewport (0, 0, out_width, out_height);
 
-  gl->ClearColor (0.0, 0.0, 0.0, 0.0);
-  gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
   gst_gl_shader_use (convert->shader);
 
-  gl->VertexAttribPointer (convert->shader_attr_position_loc, 3,
-      GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), vVertices);
-  gl->VertexAttribPointer (convert->shader_attr_texture_loc, 2,
-      GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), &vVertices[3]);
-
-  gl->EnableVertexAttribArray (convert->shader_attr_position_loc);
-  gl->EnableVertexAttribArray (convert->shader_attr_texture_loc);
+  if (gl->BindVertexArray)
+    gl->BindVertexArray (convert->priv->vao);
+  else
+    _bind_buffer (convert);
 
   for (i = c_info->in_n_textures - 1; i >= 0; i--) {
     gchar *scale_name = g_strdup_printf ("tex_scale%u", i);
+    GstGLMemory *m = convert->priv->in_tex[i];
+    guint tex_target = m->tex_target;
 
     gl->ActiveTexture (GL_TEXTURE0 + i);
-    gl->BindTexture (GL_TEXTURE_2D, convert->priv->in_tex[i]->tex_id);
-
-    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    gl->BindTexture (tex_target, convert->priv->in_tex[i]->tex_id);
+    gl->TexParameteri (tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    gl->TexParameteri (tex_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    gl->TexParameteri (tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    gl->TexParameteri (tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
     gst_gl_shader_set_uniform_2fv (convert->shader, scale_name, 1,
         convert->priv->in_tex[i]->tex_scaling);
@@ -1452,14 +1695,19 @@
     g_free (scale_name);
   }
 
-  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+  gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, convert->priv->vbo_indices);
+  gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
 
-  gl->DisableVertexAttribArray (convert->shader_attr_position_loc);
-  gl->DisableVertexAttribArray (convert->shader_attr_texture_loc);
+  if (gl->BindVertexArray)
+    gl->BindVertexArray (0);
+  else
+    _unbind_buffer (convert);
 
   if (gl->DrawBuffer)
     gl->DrawBuffer (GL_NONE);
 
+  gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
+
   /* we are done with the shader */
   gst_gl_context_clear_shader (context);
 
diff --git a/gst-libs/gst/gl/gstglcolorconvert.h b/gst-libs/gst/gl/gstglcolorconvert.h
index 9b905c7..748ac90 100644
--- a/gst-libs/gst/gl/gstglcolorconvert.h
+++ b/gst-libs/gst/gl/gstglcolorconvert.h
@@ -61,8 +61,6 @@
   GLuint           fbo;
   GLuint           depth_buffer;
   GstGLShader     *shader;
-  GLint            shader_attr_position_loc;
-  GLint            shader_attr_texture_loc;
 
   /* <private> */
   GstGLColorConvertPrivate *priv;
@@ -88,20 +86,26 @@
 #define GST_GL_COLOR_CONVERT_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \
                                "xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, " \
                                "Y41B, NV12, NV21, YUY2, UYVY, AYUV, " \
-                               "GRAY8, GRAY16_LE, GRAY16_BE }"
+                               "GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16 }"
 
 /**
  * GST_GL_COLOR_CONVERT_VIDEO_CAPS:
  *
  * The currently supported #GstCaps that can be converted
  */
-#define GST_GL_COLOR_CONVERT_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS)
+#define GST_GL_COLOR_CONVERT_VIDEO_CAPS \
+    GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, \
+        GST_GL_COLOR_CONVERT_FORMATS)
 
 GstGLColorConvert * gst_gl_color_convert_new (GstGLContext * context);
 
-void     gst_gl_color_convert_set_format    (GstGLColorConvert * convert,
-                                             GstVideoInfo * in_info,
-                                             GstVideoInfo * out_info);
+GstCaps *   gst_gl_color_convert_transform_caps (GstGLContext * convert,
+                                                 GstPadDirection direction,
+                                                 GstCaps * caps,
+                                                 GstCaps * filter);
+gboolean    gst_gl_color_convert_set_caps    (GstGLColorConvert * convert,
+                                              GstCaps           * in_caps,
+                                              GstCaps           * out_caps);
 
 GstBuffer * gst_gl_color_convert_perform    (GstGLColorConvert * convert, GstBuffer * inbuf);
 
diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c
index a197bf1..d05169f 100644
--- a/gst-libs/gst/gl/gstglcontext.c
+++ b/gst-libs/gst/gl/gstglcontext.c
@@ -65,7 +65,11 @@
 #include "eagl/gstglcontext_eagl.h"
 #endif
 
+GST_DEBUG_CATEGORY_STATIC (gst_performance);
+static GPrivate current_context_key;
+
 static GModule *module_self;
+static GOnce module_self_gonce = G_ONCE_INIT;
 
 #if GST_GL_HAVE_OPENGL
 static GOnce module_opengl_gonce = G_ONCE_INIT;
@@ -117,6 +121,14 @@
 }
 #endif
 
+static gpointer
+load_self_module (gpointer user_data)
+{
+  module_self = g_module_open (NULL, G_MODULE_BIND_LAZY);
+
+  return NULL;
+}
+
 #if GST_GL_HAVE_GLES3
 #error "Add module loading support for GLES3"
 #endif
@@ -131,6 +143,8 @@
   (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_CONTEXT, GstGLContextPrivate))
 
 static gpointer gst_gl_context_create_thread (GstGLContext * context);
+static gpointer _default_get_proc_address (GstGLContext * context,
+    const gchar * name);
 static void gst_gl_context_finalize (GObject * object);
 
 struct _GstGLContextPrivate
@@ -225,10 +239,7 @@
 {
   g_type_class_add_private (klass, sizeof (GstGLContextPrivate));
 
-  module_self = g_module_open (NULL, G_MODULE_BIND_LAZY);
-
-  klass->get_proc_address =
-      GST_DEBUG_FUNCPTR (gst_gl_context_default_get_proc_address);
+  klass->get_proc_address = GST_DEBUG_FUNCPTR (_default_get_proc_address);
 
   G_OBJECT_CLASS (klass)->finalize = gst_gl_context_finalize;
 }
@@ -241,6 +252,7 @@
   if (g_once_init_enter (&_init)) {
     GST_DEBUG_CATEGORY_INIT (gst_gl_context_debug, "glcontext", 0,
         "glcontext element");
+    GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE");
     g_once_init_leave (&_init, 1);
   }
 }
@@ -264,7 +276,12 @@
   _init_debug ();
 
   user_choice = g_getenv ("GST_GL_PLATFORM");
-  GST_INFO ("creating a context, user choice:%s", user_choice);
+  GST_INFO ("creating a context for display %" GST_PTR_FORMAT
+      ", user choice:%s", display, user_choice);
+#if GST_GL_HAVE_PLATFORM_CGL
+  if (!context && (!user_choice || g_strstr_len (user_choice, 5, "cgl")))
+    context = GST_GL_CONTEXT (gst_gl_context_cocoa_new ());
+#endif
 #if GST_GL_HAVE_PLATFORM_GLX
   if (!context && (!user_choice || g_strstr_len (user_choice, 3, "glx")))
     context = GST_GL_CONTEXT (gst_gl_context_glx_new ());
@@ -273,10 +290,6 @@
   if (!context && (!user_choice || g_strstr_len (user_choice, 7, "egl")))
     context = GST_GL_CONTEXT (gst_gl_context_egl_new ());
 #endif
-#if GST_GL_HAVE_PLATFORM_CGL
-  if (!context && (!user_choice || g_strstr_len (user_choice, 5, "cgl")))
-    context = GST_GL_CONTEXT (gst_gl_context_cocoa_new ());
-#endif
 #if GST_GL_HAVE_PLATFORM_WGL
   if (!context && (!user_choice || g_strstr_len (user_choice, 3, "wgl"))) {
     context = GST_GL_CONTEXT (gst_gl_context_wgl_new ());
@@ -297,6 +310,10 @@
 
   context->priv->display = gst_object_ref (display);
 
+  GST_DEBUG_OBJECT (context,
+      "Done creating context for display %" GST_PTR_FORMAT " (user_choice:%s)",
+      display, user_choice);
+
   return context;
 }
 
@@ -319,9 +336,15 @@
 {
   GstGLContext *context;
   GstGLWrappedContext *context_wrap = NULL;
+  GstGLContextClass *context_class;
+  GstGLAPI display_api;
 
   _init_debug ();
 
+  display_api = gst_gl_display_get_gl_api (display);
+  g_return_val_if_fail ((display_api & available_apis) != GST_GL_API_NONE,
+      NULL);
+
   context_wrap = g_object_new (GST_GL_TYPE_WRAPPED_CONTEXT, NULL);
 
   if (!context_wrap) {
@@ -338,9 +361,197 @@
   context_wrap->platform = context_type;
   context_wrap->available_apis = available_apis;
 
+  context_class = GST_GL_CONTEXT_GET_CLASS (context);
+
+#if GST_GL_HAVE_PLATFORM_GLX
+  if (context_type == GST_GL_PLATFORM_GLX) {
+    context_class->get_current_context = gst_gl_context_glx_get_current_context;
+    context_class->get_proc_address = gst_gl_context_glx_get_proc_address;
+  }
+#endif
+#if GST_GL_HAVE_PLATFORM_EGL
+  if (context_type == GST_GL_PLATFORM_EGL) {
+    context_class->get_current_context = gst_gl_context_egl_get_current_context;
+    context_class->get_proc_address = gst_gl_context_egl_get_proc_address;
+  }
+#endif
+#if GST_GL_HAVE_PLATFORM_CGL
+  if (context_type == GST_GL_PLATFORM_CGL) {
+    context_class->get_current_context =
+        gst_gl_context_cocoa_get_current_context;
+    context_class->get_proc_address = _default_get_proc_address;
+  }
+#endif
+#if GST_GL_HAVE_PLATFORM_WGL
+  if (context_type == GST_GL_PLATFORM_WGL) {
+    context_class->get_current_context = gst_gl_context_wgl_get_current_context;
+    context_class->get_proc_address = gst_gl_context_wgl_get_proc_address;
+  }
+#endif
+#if GST_GL_HAVE_PLATFORM_EAGL
+  if (context_type == GST_GL_PLATFORM_EAGL) {
+    context_class->get_current_context =
+        gst_gl_context_eagl_get_current_context;
+    context_class->get_proc_address = _default_get_proc_address;
+  }
+#endif
+
+  if (!context_class->get_current_context) {
+    /* we don't have API support */
+    gst_object_unref (context);
+    return NULL;
+  }
+
   return context;
 }
 
+/**
+ * gst_gl_context_get_current_gl_context:
+ * @context_type: a #GstGLPlatform specifying the type of context to retreive
+ *
+ * Returns: The OpenGL context handle current in the calling thread or %NULL
+ *
+ * Since: 1.6
+ */
+guintptr
+gst_gl_context_get_current_gl_context (GstGLPlatform context_type)
+{
+  guintptr handle = 0;
+
+  _init_debug ();
+
+#if GST_GL_HAVE_PLATFORM_GLX
+  if (!handle && (context_type & GST_GL_PLATFORM_GLX) != 0)
+    handle = gst_gl_context_glx_get_current_context ();
+#endif
+#if GST_GL_HAVE_PLATFORM_EGL
+  if (!handle && (context_type & GST_GL_PLATFORM_EGL) != 0)
+    handle = gst_gl_context_egl_get_current_context ();
+#endif
+#if GST_GL_HAVE_PLATFORM_CGL
+  if (!handle && (context_type & GST_GL_PLATFORM_CGL) != 0)
+    handle = gst_gl_context_cocoa_get_current_context ();
+#endif
+#if GST_GL_HAVE_PLATFORM_WGL
+  if (!handle && (context_type & GST_GL_PLATFORM_WGL) != 0)
+    handle = gst_gl_context_wgl_get_current_context ();
+#endif
+#if GST_GL_HAVE_PLATFORM_EAGL
+  if (!handle && (context_type & GST_GL_PLATFORM_EAGL) != 0)
+    handle = gst_gl_context_eagl_get_current_context ();
+#endif
+
+  if (!handle)
+    GST_WARNING ("Could not retreive current context");
+
+  return handle;
+}
+
+/**
+ * gst_gl_context_get_current_gl_api:
+ * @context_type: a #GstGLPlatform specifying the type of context to retreive
+ * @major: (out): (allow-none): the major version
+ * @minor: (out): (allow-none): the minor version
+ *
+ * If an error occurs, @major and @minor aren't modified and %GST_GL_API_NONE is
+ * returned.
+ *
+ * Returns: The version supported by the OpenGL context current in the calling
+ *          thread or %GST_GL_API_NONE
+ *
+ * Since: 1.6
+ */
+GstGLAPI
+gst_gl_context_get_current_gl_api (guint * major, guint * minor)
+{
+  const GLubyte *(*GetString) (GLenum name);
+#if GST_GL_HAVE_OPENGL
+  void (*GetIntegerv) (GLenum name, GLuint * n);
+#endif
+  const gchar *version;
+  gint maj, min, n;
+  GstGLAPI ret = (1 << 31);
+
+  _init_debug ();
+
+  while (ret != GST_GL_API_NONE) {
+    /* FIXME: attempt to delve into the platform specific GetProcAddress */
+    GetString = gst_gl_context_default_get_proc_address (ret, "glGetString");
+#if GST_GL_HAVE_OPENGL
+    GetIntegerv =
+        gst_gl_context_default_get_proc_address (ret, "glGetIntegerv");
+#endif
+    if (!GetString) {
+      goto next;
+    }
+
+    version = (const gchar *) GetString (GL_VERSION);
+    if (!version)
+      goto next;
+
+    /* strlen (x.x) == 3 */
+    n = strlen (version);
+    if (n < 3)
+      goto next;
+
+    if (g_strstr_len (version, 9, "OpenGL ES")) {
+      /* strlen (OpenGL ES x.x) == 13 */
+      if (n < 13)
+        goto next;
+
+      sscanf (&version[10], "%d.%d", &maj, &min);
+
+      if (maj <= 0 || min < 0)
+        goto next;
+
+      if (maj == 1) {
+        ret = GST_GL_API_GLES1;
+        break;
+      } else if (maj == 2 || maj == 3) {
+        ret = GST_GL_API_GLES2;
+        break;
+      }
+
+      goto next;
+    } else {
+      sscanf (version, "%d.%d", &maj, &min);
+
+      if (maj <= 0 || min < 0)
+        goto next;
+
+#if GST_GL_HAVE_OPENGL
+      if (GetIntegerv && (maj > 3 || (maj == 3 && min > 1))) {
+        GLuint context_flags = 0;
+
+        ret = GST_GL_API_NONE;
+        GetIntegerv (GL_CONTEXT_PROFILE_MASK, &context_flags);
+        if (context_flags & GL_CONTEXT_CORE_PROFILE_BIT)
+          ret |= GST_GL_API_OPENGL3;
+        if (context_flags & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
+          ret |= GST_GL_API_OPENGL;
+        break;
+      }
+#endif
+      ret = GST_GL_API_OPENGL;
+      break;
+    }
+
+  next:
+    /* iterate through the apis */
+    ret >>= 1;
+  }
+
+  if (ret == GST_GL_API_NONE)
+    return GST_GL_API_NONE;
+
+  if (major)
+    *major = maj;
+  if (minor)
+    *minor = min;
+
+  return ret;
+}
+
 static void
 gst_gl_context_finalize (GObject * object)
 {
@@ -352,7 +563,7 @@
 
     if (context->priv->alive) {
       g_mutex_lock (&context->priv->render_lock);
-      GST_INFO ("send quit gl window loop");
+      GST_INFO_OBJECT (context, "send quit gl window loop");
       gst_gl_window_quit (context->window);
       while (context->priv->alive) {
         g_cond_wait (&context->priv->destroy_cond, &context->priv->render_lock);
@@ -364,9 +575,9 @@
 
     if (context->priv->gl_thread) {
       gpointer ret = g_thread_join (context->priv->gl_thread);
-      GST_INFO ("gl thread joined");
+      GST_INFO_OBJECT (context, "gl thread joined");
       if (ret != NULL)
-        GST_ERROR ("gl thread returned a non-null pointer");
+        GST_ERROR_OBJECT (context, "gl thread returned a non-null pointer");
       context->priv->gl_thread = NULL;
     }
 
@@ -388,6 +599,7 @@
   g_free (context->priv->gl_exts);
   g_weak_ref_clear (&context->priv->other_context_ref);
 
+  GST_DEBUG_OBJECT (context, "End of finalize");
   G_OBJECT_CLASS (gst_gl_context_parent_class)->finalize (object);
 }
 
@@ -415,11 +627,18 @@
   context_class = GST_GL_CONTEXT_GET_CLASS (context);
   g_return_val_if_fail (context_class->activate != NULL, FALSE);
 
+  GST_DEBUG_OBJECT (context, "activate:%d", activate);
+
   GST_OBJECT_LOCK (context);
   result = context_class->activate (context, activate);
 
-  context->priv->active_thread = result
-      && activate ? context->priv->gl_thread : NULL;
+  if (result && activate) {
+    context->priv->active_thread = g_thread_self ();
+    g_private_set (&current_context_key, context);
+  } else {
+    context->priv->active_thread = NULL;
+    g_private_set (&current_context_key, NULL);
+  }
   GST_OBJECT_UNLOCK (context);
 
   return result;
@@ -431,7 +650,7 @@
  *
  * Returns: (transfer full): The #GThread, @context is current in or NULL
  *
- * Since: 1.4.5
+ * Since: 1.6
  */
 GThread *
 gst_gl_context_get_thread (GstGLContext * context)
@@ -472,6 +691,14 @@
   return context_class->get_gl_api (context);
 }
 
+static gpointer
+_default_get_proc_address (GstGLContext * context, const gchar * name)
+{
+  GstGLAPI gl_api = gst_gl_context_get_gl_api (context);
+
+  return gst_gl_context_default_get_proc_address (gl_api, name);
+}
+
 /**
  * gst_gl_context_get_proc_address:
  * @context: a #GstGLContext
@@ -494,7 +721,6 @@
   GstGLContextClass *context_class;
 
   g_return_val_if_fail (GST_GL_IS_CONTEXT (context), NULL);
-  g_return_val_if_fail (!GST_GL_IS_WRAPPED_CONTEXT (context), NULL);
   context_class = GST_GL_CONTEXT_GET_CLASS (context);
   g_return_val_if_fail (context_class->get_proc_address != NULL, NULL);
 
@@ -504,11 +730,9 @@
 }
 
 gpointer
-gst_gl_context_default_get_proc_address (GstGLContext * context,
-    const gchar * name)
+gst_gl_context_default_get_proc_address (GstGLAPI gl_api, const gchar * name)
 {
   gpointer ret = NULL;
-  GstGLAPI gl_api = gst_gl_context_get_gl_api (context);
 
   /* First try to load symbol from the selected GL API for this context */
 #if GST_GL_HAVE_GLES2
@@ -528,6 +752,7 @@
 #endif
 
   /* Otherwise fall back to the current module */
+  g_once (&module_self_gonce, load_self_module, NULL);
   if (!ret)
     g_module_symbol (module_self, name, &ret);
 
@@ -552,6 +777,8 @@
 {
   g_return_val_if_fail (!GST_GL_IS_WRAPPED_CONTEXT (context), FALSE);
 
+  GST_DEBUG_OBJECT (context, "window:%" GST_PTR_FORMAT, window);
+
   /* we can't change the window while we are running */
   if (context->priv->alive)
     return FALSE;
@@ -584,8 +811,10 @@
 {
   g_return_val_if_fail (GST_GL_IS_CONTEXT (context), NULL);
 
-  if (GST_GL_IS_WRAPPED_CONTEXT (context))
+  if (GST_GL_IS_WRAPPED_CONTEXT (context)) {
+    GST_WARNING_OBJECT (context, "context is not toplevel, returning NULL");
     return NULL;
+  }
 
   _ensure_window (context);
 
@@ -686,6 +915,9 @@
 
   g_return_val_if_fail (GST_GL_IS_CONTEXT (context), FALSE);
   g_return_val_if_fail (!GST_GL_IS_WRAPPED_CONTEXT (context), FALSE);
+
+  GST_DEBUG_OBJECT (context, " other_context:%" GST_PTR_FORMAT, other_context);
+
   _ensure_window (context);
 
   g_mutex_lock (&context->priv->render_lock);
@@ -701,7 +933,7 @@
 
     context->priv->created = TRUE;
 
-    GST_INFO ("gl thread created");
+    GST_INFO_OBJECT (context, "gl thread created");
   }
 
   alive = context->priv->alive;
@@ -711,6 +943,154 @@
   return alive;
 }
 
+#ifndef GL_DEBUG_TYPE_ERROR
+#define GL_DEBUG_TYPE_ERROR 0x824C
+#endif
+#ifndef GL_DEBUG_TYPE_DEPRECATED_BEHAVIOUR
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOUR 0x824D
+#endif
+#ifndef GL_DEBUG_TYPE_UNDEFINED_BEHAVIOUR
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOUR 0x824E
+#endif
+#ifndef GL_DEBUG_TYPE_PORTABILITY
+#define GL_DEBUG_TYPE_PORTABILITY 0x824F
+#endif
+#ifndef GL_DEBUG_TYPE_PERFORMANCE
+#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
+#endif
+#ifndef GL_DEBUG_TYPE_MARKER
+#define GL_DEBUG_TYPE_MARKER 0x8268
+#endif
+#ifndef GL_DEBUG_TYPE_OTHER
+#define GL_DEBUG_TYPE_OTHER 0x8251
+#endif
+
+#ifndef GL_DEBUG_SEVERITY_HIGH
+#define GL_DEBUG_SEVERITY_HIGH 0x9146
+#endif
+#ifndef GL_DEBUG_SEVERITY_MEDIUM
+#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
+#endif
+#ifndef GL_DEBUG_SEVERITY_LOW
+#define GL_DEBUG_SEVERITY_LOW 0x9148
+#endif
+#ifndef GL_DEBUG_SEVERITY_NOTIFICATION
+#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
+#endif
+
+#ifndef GL_DEBUG_SOURCE_API
+#define GL_DEBUG_SOURCE_API 0x8246
+#endif
+#ifndef GL_DEBUG_SOURCE_WINDOW_SYSTEM
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
+#endif
+#ifndef GL_DEBUG_SOURCE_SHADER_COMPILER
+#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
+#endif
+#ifndef GL_DEBUG_SOURCE_THIRD_PARTY
+#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
+#endif
+#ifndef GL_DEBUG_SOURCE_APPLICATION
+#define GL_DEBUG_SOURCE_APPLICATION 0x824A
+#endif
+#ifndef GL_DEBUG_SOURCE_OTHER
+#define GL_DEBUG_SOURCE_OTHER 0x824B
+#endif
+
+#if !defined(GST_DISABLE_GST_DEBUG)
+static inline const gchar *
+_debug_severity_to_string (GLenum severity)
+{
+  switch (severity) {
+    case GL_DEBUG_SEVERITY_HIGH:
+      return "high";
+    case GL_DEBUG_SEVERITY_MEDIUM:
+      return "medium";
+    case GL_DEBUG_SEVERITY_LOW:
+      return "low";
+    case GL_DEBUG_SEVERITY_NOTIFICATION:
+      return "notification";
+    default:
+      return "invalid";
+  }
+}
+
+static inline const gchar *
+_debug_source_to_string (GLenum source)
+{
+  switch (source) {
+    case GL_DEBUG_SOURCE_API:
+      return "API";
+    case GL_DEBUG_SOURCE_WINDOW_SYSTEM:
+      return "winsys";
+    case GL_DEBUG_SOURCE_SHADER_COMPILER:
+      return "shader compiler";
+    case GL_DEBUG_SOURCE_THIRD_PARTY:
+      return "third party";
+    case GL_DEBUG_SOURCE_APPLICATION:
+      return "application";
+    case GL_DEBUG_SOURCE_OTHER:
+      return "other";
+    default:
+      return "invalid";
+  }
+}
+
+static inline const gchar *
+_debug_type_to_string (GLenum type)
+{
+  switch (type) {
+    case GL_DEBUG_TYPE_ERROR:
+      return "error";
+    case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOUR:
+      return "deprecated";
+    case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOUR:
+      return "undefined";
+    case GL_DEBUG_TYPE_PORTABILITY:
+      return "portability";
+    case GL_DEBUG_TYPE_PERFORMANCE:
+      return "performance";
+    case GL_DEBUG_TYPE_MARKER:
+      return "debug marker";
+    case GL_DEBUG_TYPE_OTHER:
+      return "other";
+    default:
+      return "invalid";
+  }
+}
+
+static void GSTGLAPI
+_gst_gl_debug_callback (GLenum source, GLenum type, GLuint id, GLenum severity,
+    GLsizei length, const gchar * message, gpointer user_data)
+{
+  GstGLContext *context = user_data;
+  const gchar *severity_str = _debug_severity_to_string (severity);
+  const gchar *source_str = _debug_source_to_string (source);
+  const gchar *type_str = _debug_type_to_string (type);
+
+  switch (type) {
+    case GL_DEBUG_TYPE_ERROR:
+    case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOUR:
+      GST_ERROR_OBJECT (context, "%s: GL %s from %s id:%u, %s", severity_str,
+          type_str, source_str, id, message);
+      break;
+    case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOUR:
+    case GL_DEBUG_TYPE_PORTABILITY:
+      GST_FIXME_OBJECT (context, "%s: GL %s from %s id:%u, %s", severity_str,
+          type_str, source_str, id, message);
+      break;
+    case GL_DEBUG_TYPE_PERFORMANCE:
+      GST_CAT_DEBUG_OBJECT (gst_performance, context, "%s: GL %s from %s id:%u,"
+          " %s", severity_str, type_str, source_str, id, message);
+      break;
+    default:
+      GST_DEBUG_OBJECT (context, "%s: GL %s from %s id:%u, %s", severity_str,
+          type_str, source_str, id, message);
+      break;
+  }
+}
+#endif
+
 static gboolean
 _create_context_info (GstGLContext * context, GstGLAPI gl_api, gint * gl_major,
     gint * gl_minor, GError ** error)
@@ -722,13 +1102,20 @@
 
   gl = context->gl_vtable;
 
-  GST_INFO ("GL_VERSION: %s",
+  if (!gl->GetString || !gl->GetString (GL_VERSION)) {
+    g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
+        "glGetString not defined or returned invalid value");
+    return FALSE;
+  }
+
+  GST_INFO_OBJECT (context, "GL_VERSION: %s",
       GST_STR_NULL ((const gchar *) gl->GetString (GL_VERSION)));
-  GST_INFO ("GL_SHADING_LANGUAGE_VERSION: %s", GST_STR_NULL ((const gchar *)
+  GST_INFO_OBJECT (context, "GL_SHADING_LANGUAGE_VERSION: %s",
+      GST_STR_NULL ((const gchar *)
           gl->GetString (GL_SHADING_LANGUAGE_VERSION)));
-  GST_INFO ("GL_VENDOR: %s",
+  GST_INFO_OBJECT (context, "GL_VENDOR: %s",
       GST_STR_NULL ((const gchar *) gl->GetString (GL_VENDOR)));
-  GST_INFO ("GL_RENDERER: %s",
+  GST_INFO_OBJECT (context, "GL_RENDERER: %s",
       GST_STR_NULL ((const gchar *) gl->GetString (GL_RENDERER)));
 
   gl_err = gl->GetError ();
@@ -811,27 +1198,36 @@
   GstGLContextClass *context_class;
   GstGLWindowClass *window_class;
   GstGLFuncs *gl;
-  gboolean ret = FALSE;
-  GstGLAPI compiled_api, user_api, gl_api;
+  GstGLAPI compiled_api, user_api, gl_api, display_api;
   gchar *api_string;
   gchar *compiled_api_s;
-  gchar *user_api_string;
+  gchar *user_api_s;
+  gchar *display_api_s;
   const gchar *user_choice;
   GError **error;
   GstGLContext *other_context;
-  GString *ext_g_str = NULL;
-  const gchar *ext_const_c_str = NULL;
 
   g_mutex_lock (&context->priv->render_lock);
 
+  GST_DEBUG_OBJECT (context, "Creating thread");
+
   error = context->priv->error;
   other_context = g_weak_ref_get (&context->priv->other_context_ref);
 
   context_class = GST_GL_CONTEXT_GET_CLASS (context);
   window_class = GST_GL_WINDOW_GET_CLASS (context->window);
 
+  display_api = gst_gl_display_get_gl_api (context->priv->display);
+  if (display_api == GST_GL_API_NONE) {
+    g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
+        "Cannot create context with satisfying requested apis "
+        "(display has no GL api!)");
+    goto failure;
+  }
+
   if (window_class->open) {
     if (!window_class->open (context->window, error)) {
+      GST_WARNING_OBJECT (context, "Failed to open window");
       g_assert (error == NULL || *error != NULL);
       goto failure;
     }
@@ -839,49 +1235,58 @@
 
   gl = context->gl_vtable;
   compiled_api = _compiled_api ();
-
-  user_choice = g_getenv ("GST_GL_API");
-
-  user_api = gst_gl_api_from_string (user_choice);
-  user_api_string = gst_gl_api_to_string (user_api);
-
   compiled_api_s = gst_gl_api_to_string (compiled_api);
 
-  if ((user_api & compiled_api) == GST_GL_API_NONE) {
+  user_choice = g_getenv ("GST_GL_API");
+  user_api = gst_gl_api_from_string (user_choice);
+  user_api_s = gst_gl_api_to_string (user_api);
+
+  display_api_s = gst_gl_api_to_string (display_api);
+
+  if ((user_api & compiled_api & display_api) == GST_GL_API_NONE) {
     g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
         "Cannot create context with the user requested api (%s).  "
-        "We have support for (%s)", user_api_string, compiled_api_s);
-    g_free (user_api_string);
+        "We have support for (%s), display api (%s)", user_api_s,
+        compiled_api_s, display_api_s);
+    g_free (user_api_s);
     g_free (compiled_api_s);
+    g_free (display_api_s);
     goto failure;
   }
 
   if (context_class->choose_format &&
       !context_class->choose_format (context, error)) {
+    GST_WARNING ("Failed to choose format");
     g_assert (error == NULL || *error != NULL);
     g_free (compiled_api_s);
-    g_free (user_api_string);
+    g_free (user_api_s);
+    g_free (display_api_s);
     goto failure;
   }
 
-  GST_INFO ("Attempting to create opengl context. user chosen api(s) (%s), "
-      "compiled api support (%s)", user_api_string, compiled_api_s);
+  GST_INFO_OBJECT (context,
+      "Attempting to create opengl context. user chosen api(s) (%s), "
+      "compiled api support (%s) display api (%s)", user_api_s, compiled_api_s,
+      display_api_s);
 
-  if (!context_class->create_context (context, compiled_api & user_api,
-          other_context, error)) {
+  if (!context_class->create_context (context,
+          compiled_api & user_api & display_api, other_context, error)) {
+    GST_WARNING_OBJECT (context, "Failed to create context");
     g_assert (error == NULL || *error != NULL);
     g_free (compiled_api_s);
-    g_free (user_api_string);
+    g_free (user_api_s);
+    g_free (display_api_s);
     goto failure;
   }
-  GST_INFO ("created context");
+  GST_INFO_OBJECT (context, "created context");
 
-  if (!context_class->activate (context, TRUE)) {
+  if (!gst_gl_context_activate (context, TRUE)) {
     g_set_error (error, GST_GL_CONTEXT_ERROR,
         GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
         "Failed to activate the GL Context");
     g_free (compiled_api_s);
-    g_free (user_api_string);
+    g_free (user_api_s);
+    g_free (display_api_s);
     goto failure;
   }
 
@@ -889,22 +1294,138 @@
   g_assert (gl_api != GST_GL_API_NONE && gl_api != GST_GL_API_ANY);
 
   api_string = gst_gl_api_to_string (gl_api);
-  GST_INFO ("available GL APIs: %s", api_string);
+  GST_INFO_OBJECT (context, "available GL APIs: %s", api_string);
 
-  if (((compiled_api & gl_api) & user_api) == GST_GL_API_NONE) {
+  if (((compiled_api & gl_api & display_api) & user_api) == GST_GL_API_NONE) {
     g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
         "failed to create context, context "
         "could not provide correct api. user (%s), compiled (%s), context (%s)",
-        user_api_string, compiled_api_s, api_string);
+        user_api_s, compiled_api_s, api_string);
     g_free (api_string);
     g_free (compiled_api_s);
-    g_free (user_api_string);
+    g_free (user_api_s);
+    g_free (display_api_s);
     goto failure;
   }
 
   g_free (api_string);
   g_free (compiled_api_s);
-  g_free (user_api_string);
+  g_free (user_api_s);
+  g_free (display_api_s);
+
+  GST_DEBUG_OBJECT (context, "Filling info");
+  gst_gl_context_fill_info (context, error);
+
+  context->priv->alive = TRUE;
+
+  if (gl->DebugMessageCallback) {
+#if !defined(GST_DISABLE_GST_DEBUG)
+    GST_INFO_OBJECT (context, "Enabling GL context debugging");
+    /* enable them all */
+    gl->DebugMessageControl (GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0,
+        GL_TRUE);
+    gl->DebugMessageCallback (_gst_gl_debug_callback, context);
+#endif
+  }
+
+  if (other_context) {
+    GST_DEBUG_OBJECT (context, "Unreffing other_context %" GST_PTR_FORMAT,
+        other_context);
+    gst_object_unref (other_context);
+  }
+
+  g_cond_signal (&context->priv->create_cond);
+
+//  g_mutex_unlock (&context->priv->render_lock);
+  gst_gl_window_send_message_async (context->window,
+      (GstGLWindowCB) _unlock_create_thread, context, NULL);
+
+  gst_gl_window_run (context->window);
+
+  GST_INFO_OBJECT (context, "loop exited");
+
+  g_mutex_lock (&context->priv->render_lock);
+
+  context->priv->alive = FALSE;
+
+  gst_gl_context_activate (context, FALSE);
+
+  context_class->destroy_context (context);
+
+  /* User supplied callback */
+  if (context->window->close)
+    context->window->close (context->window->close_data);
+
+  /* window specific shutdown */
+  if (window_class->close) {
+    window_class->close (context->window);
+  }
+
+  g_cond_signal (&context->priv->destroy_cond);
+
+  g_mutex_unlock (&context->priv->render_lock);
+
+  return NULL;
+
+failure:
+  {
+    if (other_context)
+      gst_object_unref (other_context);
+
+    g_cond_signal (&context->priv->create_cond);
+    g_mutex_unlock (&context->priv->render_lock);
+    return NULL;
+  }
+}
+
+/**
+ * gst_gl_context_destroy:
+ * @context: a #GstGLContext:
+ *
+ * Destroys an OpenGL context.
+ *
+ * Should only be called after gst_gl_context_create() has been successfully
+ * called for this context.
+ *
+ * Since: 1.6
+ */
+void
+gst_gl_context_destroy (GstGLContext * context)
+{
+  GstGLContextClass *context_class;
+
+  g_return_if_fail (GST_GL_IS_CONTEXT (context));
+  context_class = GST_GL_CONTEXT_GET_CLASS (context);
+  g_return_if_fail (context_class->destroy_context != NULL);
+
+  context_class->destroy_context (context);
+}
+
+/**
+ * gst_gl_context_fill_info:
+ * @context: a #GstGLContext:
+ *
+ * Fills @context's info (version, extensions, vtable, etc) from the GL
+ * context in the current thread.  Typically used with wrapped contexts to
+ * allow wrapped contexts to be used as regular #GstGLContext's.
+ *
+ * Since: 1.6
+ */
+gboolean
+gst_gl_context_fill_info (GstGLContext * context, GError ** error)
+{
+  GstGLFuncs *gl;
+  GString *ext_g_str = NULL;
+  const gchar *ext_const_c_str = NULL;
+  GstGLAPI gl_api;
+  gboolean ret;
+
+  g_return_val_if_fail (GST_GL_IS_CONTEXT (context), FALSE);
+  g_return_val_if_fail (context->priv->active_thread == g_thread_self (),
+      FALSE);
+
+  gl = context->gl_vtable;
+  gl_api = gst_gl_context_get_gl_api (context);
 
   gl->GetError = gst_gl_context_get_proc_address (context, "glGetError");
   gl->GetString = gst_gl_context_get_proc_address (context, "glGetString");
@@ -948,50 +1469,19 @@
     context->priv->gl_exts = g_strdup (ext_const_c_str);
   }
 
-  context->priv->alive = TRUE;
-
-  g_cond_signal (&context->priv->create_cond);
-
-//  g_mutex_unlock (&context->priv->render_lock);
-  gst_gl_window_send_message_async (context->window,
-      (GstGLWindowCB) _unlock_create_thread, context, NULL);
-
-  gst_gl_window_run (context->window);
-
-  GST_INFO ("loop exited\n");
-
-  g_mutex_lock (&context->priv->render_lock);
-
-  context->priv->alive = FALSE;
-
-  context_class->activate (context, FALSE);
-
-  context_class->destroy_context (context);
-
-  /* User supplied callback */
-  if (context->window->close)
-    context->window->close (context->window->close_data);
-
-  /* window specific shutdown */
-  if (window_class->close) {
-    window_class->close (context->window);
+  if (gl_api & GST_GL_API_OPENGL3
+      && !gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 4, 1)
+      && !gst_gl_check_extension ("GL_ARB_ES2_compatibility",
+          context->priv->gl_exts)) {
+    g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
+        "An opengl3 context created but the required ES2 compatibility was not found");
+    goto failure;
   }
 
-  g_cond_signal (&context->priv->destroy_cond);
-
-  g_mutex_unlock (&context->priv->render_lock);
-
-  return NULL;
+  return TRUE;
 
 failure:
-  {
-    if (other_context)
-      gst_object_unref (other_context);
-
-    g_cond_signal (&context->priv->create_cond);
-    g_mutex_unlock (&context->priv->render_lock);
-    return NULL;
-  }
+  return FALSE;
 }
 
 /**
@@ -1093,7 +1583,12 @@
 
   g_return_if_fail (GST_GL_IS_CONTEXT (context));
   g_return_if_fail (func != NULL);
-  g_return_if_fail (!GST_GL_IS_WRAPPED_CONTEXT (context));
+
+  if (GST_GL_IS_WRAPPED_CONTEXT (context)) {
+    g_return_if_fail (context->priv->active_thread == g_thread_self ());
+    func (context, data);
+    return;
+  }
 
   rdata.context = context;
   rdata.data = data;
@@ -1123,7 +1618,7 @@
 gst_gl_context_get_gl_version (GstGLContext * context, gint * maj, gint * min)
 {
   g_return_if_fail (GST_GL_IS_CONTEXT (context));
-  g_return_if_fail (maj == NULL && min == NULL);
+  g_return_if_fail (maj != NULL && min != NULL);
 
   if (maj)
     *maj = context->priv->gl_major;
@@ -1196,6 +1691,21 @@
   return context_class->check_feature (context, feature);
 }
 
+/**
+ * gst_gl_context_get_current:
+ *
+ * See also gst_gl_context_activate().
+ *
+ * Returns: the #GstGLContext active in the current thread or %NULL
+ *
+ * Since: 1.6
+ */
+GstGLContext *
+gst_gl_context_get_current (void)
+{
+  return g_private_get (&current_context_key);
+}
+
 static GstGLAPI
 gst_gl_wrapped_context_get_gl_api (GstGLContext * context)
 {
@@ -1223,9 +1733,12 @@
 static gboolean
 gst_gl_wrapped_context_activate (GstGLContext * context, gboolean activate)
 {
-  g_assert_not_reached ();
+  if (activate)
+    context->priv->gl_thread = g_thread_self ();
+  else
+    context->priv->gl_thread = NULL;
 
-  return FALSE;
+  return TRUE;
 }
 
 static void
diff --git a/gst-libs/gst/gl/gstglcontext.h b/gst-libs/gst/gl/gstglcontext.h
index 7d6a842..63ba3d6 100644
--- a/gst-libs/gst/gl/gstglcontext.h
+++ b/gst-libs/gst/gl/gstglcontext.h
@@ -95,6 +95,7 @@
 struct _GstGLContextClass {
   GstObjectClass parent_class;
 
+  guintptr      (*get_current_context) (void);
   guintptr      (*get_gl_context)     (GstGLContext *context);
   GstGLAPI      (*get_gl_api)         (GstGLContext *context);
   GstGLPlatform (*get_gl_platform)    (GstGLContext *context);
@@ -121,6 +122,7 @@
 
 gboolean      gst_gl_context_activate         (GstGLContext *context, gboolean activate);
 GThread *     gst_gl_context_get_thread       (GstGLContext *context);
+GstGLContext * gst_gl_context_get_current     (void);
 
 GstGLDisplay * gst_gl_context_get_display (GstGLContext *context);
 gpointer      gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name);
@@ -130,8 +132,9 @@
 gboolean      gst_gl_context_can_share        (GstGLContext * context, GstGLContext *other_context);
 
 gboolean      gst_gl_context_create           (GstGLContext *context, GstGLContext *other_context, GError ** error);
+void          gst_gl_context_destroy          (GstGLContext *context);
 
-gpointer      gst_gl_context_default_get_proc_address (GstGLContext *context, const gchar *name);
+gpointer      gst_gl_context_default_get_proc_address (GstGLAPI gl_api, const gchar *name);
 
 gboolean      gst_gl_context_set_window (GstGLContext *context, GstGLWindow *window);
 GstGLWindow * gst_gl_context_get_window (GstGLContext *context);
@@ -140,10 +143,17 @@
 gboolean      gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api, gint maj, gint min);
 gboolean      gst_gl_context_check_feature (GstGLContext *context, const gchar *feature);
 
+guintptr      gst_gl_context_get_current_gl_context     (GstGLPlatform platform);
+GstGLAPI      gst_gl_context_get_current_gl_api         (guint *major, guint *minor);
+
+gboolean gst_gl_context_fill_info (GstGLContext * context, GError ** error);
+
 /* FIXME: remove */
 void gst_gl_context_thread_add (GstGLContext * context,
     GstGLContextThreadFunc func, gpointer data);
 
+GST_DEBUG_CATEGORY_EXTERN (gst_gl_context_debug);
+
 G_END_DECLS
 
 #endif /* __GST_GL_CONTEXT_H__ */
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
index 6b7b835..89f22ea 100644
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ b/gst-libs/gst/gl/gstgldisplay.c
@@ -56,6 +56,9 @@
 #include "gl.h"
 #include "gstgldisplay.h"
 
+#if GST_GL_HAVE_WINDOW_COCOA
+#include <gst/gl/cocoa/gstgldisplay_cocoa.h>
+#endif
 #if GST_GL_HAVE_WINDOW_X11
 #include <gst/gl/x11/gstgldisplay_x11.h>
 #endif
@@ -83,7 +86,9 @@
 
 struct _GstGLDisplayPrivate
 {
-  gint dummy;
+  GstGLAPI gl_api;
+
+  GList *contexts;
 };
 
 static void
@@ -102,6 +107,7 @@
   display->priv = GST_GL_DISPLAY_GET_PRIVATE (display);
 
   display->type = GST_GL_DISPLAY_TYPE_ANY;
+  display->priv->gl_api = GST_GL_API_ANY;
 
   GST_TRACE ("init %p", display);
 
@@ -115,7 +121,17 @@
 static void
 gst_gl_display_finalize (GObject * object)
 {
-  GST_TRACE ("finalize %p", object);
+  GstGLDisplay *display = GST_GL_DISPLAY (object);
+  GList *l;
+
+  GST_TRACE_OBJECT (object, "finalizing");
+
+  for (l = display->priv->contexts; l; l = l->next) {
+    g_weak_ref_clear ((GWeakRef *) l->data);
+    g_free (l->data);
+  }
+
+  g_list_free (display->priv->contexts);
 
   G_OBJECT_CLASS (gst_gl_display_parent_class)->finalize (object);
 }
@@ -146,8 +162,11 @@
       GST_STR_NULL (user_choice), GST_STR_NULL (platform_choice));
 
 #if GST_GL_HAVE_WINDOW_COCOA
-  if (!display && (!user_choice || g_strstr_len (user_choice, 5, "cocoa")))
-    display = g_object_new (GST_TYPE_GL_DISPLAY, NULL);
+  if (!display && (!user_choice || g_strstr_len (user_choice, 5, "cocoa"))) {
+    display = GST_GL_DISPLAY (gst_gl_display_cocoa_new ());
+    if (!display)
+      return NULL;
+  }
 #endif
 #if GST_GL_HAVE_WINDOW_X11
   if (!display && (!user_choice || g_strstr_len (user_choice, 3, "x11")))
@@ -193,6 +212,53 @@
 }
 
 /**
+ * gst_gl_display_filter_gl_api:
+ * @display: a #GstGLDisplay
+ *
+ * limit the use of OpenGL to the requested @gl_api.  This is intended to allow
+ * application and elements to request a specific set of OpenGL API's based on
+ * what they support.  See gst_gl_context_get_gl_api() for the retreiving the
+ * API supported by a #GstGLContext.
+ */
+void
+gst_gl_display_filter_gl_api (GstGLDisplay * display, GstGLAPI gl_api)
+{
+  gchar *gl_api_s;
+
+  g_return_if_fail (GST_IS_GL_DISPLAY (display));
+
+  gl_api_s = gst_gl_api_to_string (gl_api);
+  GST_TRACE_OBJECT (display, "filtering with api %s", gl_api_s);
+  g_free (gl_api_s);
+
+  GST_OBJECT_LOCK (display);
+  display->priv->gl_api &= gl_api;
+  GST_OBJECT_UNLOCK (display);
+}
+
+/**
+ * gst_gl_display_get_gl_api:
+ * @display: a #GstGLDisplay
+ *
+ * see gst_gl_display_filter_gl_api() for what the returned value represents
+ *
+ * Returns: the #GstGLAPI configured for @display
+ */
+GstGLAPI
+gst_gl_display_get_gl_api (GstGLDisplay * display)
+{
+  GstGLAPI ret;
+
+  g_return_val_if_fail (GST_IS_GL_DISPLAY (display), GST_GL_API_NONE);
+
+  GST_OBJECT_LOCK (display);
+  ret = display->priv->gl_api;
+  GST_OBJECT_UNLOCK (display);
+
+  return ret;
+}
+
+/**
  * gst_gl_display_get_handle_type:
  * @display: a #GstGLDisplay
  *
@@ -224,8 +290,10 @@
 
   g_return_if_fail (context != NULL);
 
-  GST_CAT_LOG (gst_context, "setting GstGLDisplay(%p) on context(%p)", display,
-      context);
+  if (display)
+    GST_CAT_LOG (gst_context,
+        "setting GstGLDisplay(%" GST_PTR_FORMAT ") on context(%" GST_PTR_FORMAT
+        ")", display, context);
 
   s = gst_context_writable_structure (context);
   gst_structure_set (s, GST_GL_DISPLAY_CONTEXT_TYPE, GST_TYPE_GL_DISPLAY,
@@ -259,3 +327,149 @@
 
   return ret;
 }
+
+static GstGLContext *
+_get_gl_context_for_thread_unlocked (GstGLDisplay * display, GThread * thread)
+{
+  GstGLContext *context = NULL;
+  GList *prev = NULL, *l = display->priv->contexts;
+
+  while (l) {
+    GWeakRef *ref = l->data;
+    GThread *context_thread;
+
+    context = g_weak_ref_get (ref);
+    if (!context) {
+      /* remove dead contexts */
+      g_weak_ref_clear (l->data);
+      display->priv->contexts = g_list_delete_link (display->priv->contexts, l);
+      l = prev ? prev->next : display->priv->contexts;
+      continue;
+    }
+
+    context_thread = gst_gl_context_get_thread (context);
+    if (thread != NULL && thread == context_thread) {
+      g_thread_unref (context_thread);
+      gst_object_unref (context);
+      prev = l;
+      l = l->next;
+      continue;
+    }
+
+    if (context_thread)
+      g_thread_unref (context_thread);
+    return context;
+  }
+
+  return NULL;
+}
+
+/**
+ * gst_gl_display_get_gl_context_for_thread:
+ * @display: a #GstGLDisplay
+ * @thread: a #GThread
+ *
+ * Returns: (transfer full): the #GstGLContext current on @thread or %NULL
+ *
+ * Since: 1.6
+ */
+GstGLContext *
+gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display,
+    GThread * thread)
+{
+  GstGLContext *context;
+
+  g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
+
+  GST_OBJECT_LOCK (display);
+  context = _get_gl_context_for_thread_unlocked (display, thread);
+  GST_DEBUG_OBJECT (display, "returning context %" GST_PTR_FORMAT " for thread "
+      "%p", context, thread);
+  GST_OBJECT_UNLOCK (display);
+
+  return context;
+}
+
+static gboolean
+_check_collision (GstGLContext * context, GstGLContext * collision)
+{
+  GThread *thread, *collision_thread;
+  gboolean ret = FALSE;
+
+  if (!context || !collision)
+    return FALSE;
+
+  thread = gst_gl_context_get_thread (context);
+  collision_thread = gst_gl_context_get_thread (collision);
+
+  if (!thread || !collision_thread) {
+    ret = FALSE;
+    goto out;
+  }
+
+  if (collision == context) {
+    ret = TRUE;
+    goto out;
+  }
+
+out:
+  if (thread)
+    g_thread_unref (thread);
+  if (collision_thread)
+    g_thread_unref (collision_thread);
+
+  return ret;
+}
+
+/**
+ * gst_gl_display_add_context:
+ * @display: a #GstGLDisplay
+ * @context: (transfer none): a #GstGLContext
+ *
+ * Returns: whether @context was successfully added. %FALSE may be returned
+ * if there already exists another context for @context's active thread.
+ *
+ * Since: 1.6
+ */
+gboolean
+gst_gl_display_add_context (GstGLDisplay * display, GstGLContext * context)
+{
+  GstGLContext *collision = NULL;
+  GstGLDisplay *context_display;
+  gboolean ret = TRUE;
+  GThread *thread;
+  GWeakRef *ref;
+
+  g_return_val_if_fail (GST_IS_GL_DISPLAY (display), FALSE);
+  g_return_val_if_fail (GST_GL_IS_CONTEXT (context), FALSE);
+
+  context_display = gst_gl_context_get_display (context);
+  g_assert (context_display == display);
+  gst_object_unref (context_display);
+
+  GST_OBJECT_LOCK (display);
+
+  thread = gst_gl_context_get_thread (context);
+  if (thread) {
+    collision = _get_gl_context_for_thread_unlocked (display, thread);
+    if (_check_collision (context, collision)) {
+      ret = FALSE;
+      goto out;
+    }
+  }
+
+  ref = g_new0 (GWeakRef, 1);
+  g_weak_ref_init (ref, context);
+
+  display->priv->contexts = g_list_prepend (display->priv->contexts, ref);
+
+out:
+  if (collision)
+    gst_object_unref (collision);
+
+  GST_DEBUG_OBJECT (display, "%ssuccessfully inserted context %" GST_PTR_FORMAT,
+      ret ? "" : "un", context);
+  GST_OBJECT_UNLOCK (display);
+
+  return ret;
+}
diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h
index 09489a6..d50b463 100644
--- a/gst-libs/gst/gl/gstgldisplay.h
+++ b/gst-libs/gst/gl/gstgldisplay.h
@@ -83,11 +83,19 @@
 
 guintptr         gst_gl_display_get_handle             (GstGLDisplay * display);
 GstGLDisplayType gst_gl_display_get_handle_type        (GstGLDisplay * display);
+void             gst_gl_display_filter_gl_api          (GstGLDisplay * display,
+                                                        GstGLAPI api);
+GstGLAPI         gst_gl_display_get_gl_api             (GstGLDisplay * display);
 
 #define GST_GL_DISPLAY_CONTEXT_TYPE "gst.gl.GLDisplay"
 void     gst_context_set_gl_display (GstContext * context, GstGLDisplay * display);
 gboolean gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display);
 
+GstGLContext * gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display,
+    GThread * thread);
+gboolean gst_gl_display_add_context (GstGLDisplay * display,
+    GstGLContext * context);
+
 G_END_DECLS
 
 #endif /* __GST_GL_DISPLAY_H__ */
diff --git a/gst-libs/gst/gl/gstgldownload.c b/gst-libs/gst/gl/gstgldownload.c
index 47e277a..d5b35c3 100644
--- a/gst-libs/gst/gl/gstgldownload.c
+++ b/gst-libs/gst/gl/gstgldownload.c
@@ -47,7 +47,8 @@
     gpointer data[GST_VIDEO_MAX_PLANES]);
 static gboolean _init_download (GstGLDownload * download);
 static gboolean _gst_gl_download_perform_with_data_unlocked (GstGLDownload *
-    download, GLuint texture_id, gpointer data[GST_VIDEO_MAX_PLANES]);
+    download, GLuint texture_id, GLuint texture_target,
+    gpointer data[GST_VIDEO_MAX_PLANES]);
 static void gst_gl_download_reset (GstGLDownload * download);
 
 /* *INDENT-ON* */
@@ -179,10 +180,75 @@
   GST_OBJECT_UNLOCK (download);
 }
 
+static GstCaps *
+_set_caps_features (const GstCaps * caps, const gchar * feature_name)
+{
+  GstCaps *tmp = gst_caps_copy (caps);
+  guint n = gst_caps_get_size (tmp);
+  guint i = 0;
+
+  for (i = 0; i < n; i++) {
+    GstCapsFeatures *features;
+
+    features = gst_caps_features_new (feature_name, NULL);
+    gst_caps_set_features (tmp, i, features);
+  }
+
+  return tmp;
+}
+
+GstCaps *
+gst_gl_download_transform_caps (GstGLContext * context,
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
+{
+  GstCaps *gl_templ, *templ, *result, *tmp;
+
+  templ =
+      gst_caps_from_string (GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS));
+  gl_templ =
+      gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
+      (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_GL_COLOR_CONVERT_FORMATS));
+
+  if (direction == GST_PAD_SRC) {
+    tmp = gst_caps_intersect_full (caps, templ, GST_CAPS_INTERSECT_FIRST);
+    result = _set_caps_features (tmp, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+    gst_caps_unref (tmp);
+    tmp = result;
+  } else {
+    tmp = gst_caps_ref (caps);
+  }
+
+  result =
+      gst_gl_color_convert_transform_caps (context, direction, tmp, filter);
+  gst_caps_unref (tmp);
+  tmp = result;
+
+  if (direction == GST_PAD_SINK) {
+    result = _set_caps_features (tmp, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
+    gst_caps_unref (tmp);
+    tmp = result;
+    result = gst_caps_intersect_full (tmp, templ, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+    tmp = result;
+  }
+
+  if (filter) {
+    result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+  } else {
+    result = tmp;
+  }
+  gst_caps_unref (templ);
+  gst_caps_unref (gl_templ);
+
+  return result;
+}
+
 /**
  * gst_gl_download_perform_with_data:
  * @download: a #GstGLDownload
  * @texture_id: the texture id to download
+ * @texture_target: the GL texture target
  * @data: (out): where the downloaded data should go
  *
  * Downloads @texture_id into @data. @data size and format is specified by
@@ -191,7 +257,8 @@
  * Returns: whether the download was successful
  */
 gboolean
-gst_gl_download_perform_with_data (GstGLDownload * download, GLuint texture_id,
+gst_gl_download_perform_with_data (GstGLDownload * download,
+    GLuint texture_id, GLuint texture_target,
     gpointer data[GST_VIDEO_MAX_PLANES])
 {
   gboolean ret;
@@ -200,7 +267,8 @@
 
   GST_OBJECT_LOCK (download);
   ret =
-      _gst_gl_download_perform_with_data_unlocked (download, texture_id, data);
+      _gst_gl_download_perform_with_data_unlocked (download,
+      texture_id, texture_target, data);
   GST_OBJECT_UNLOCK (download);
 
   return ret;
@@ -208,7 +276,8 @@
 
 static gboolean
 _gst_gl_download_perform_with_data_unlocked (GstGLDownload * download,
-    GLuint texture_id, gpointer data[GST_VIDEO_MAX_PLANES])
+    GLuint texture_id, GLuint texture_target,
+    gpointer data[GST_VIDEO_MAX_PLANES])
 {
   guint i;
 
@@ -223,11 +292,17 @@
     g_return_val_if_fail (data[i] != NULL, FALSE);
   }
 
-  if (!download->priv->in_tex[0])
+  if (!download->priv->in_tex[0]) {
+    GstVideoInfo temp_info;
+
+    gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA,
+        GST_VIDEO_INFO_WIDTH (&download->info),
+        GST_VIDEO_INFO_HEIGHT (&download->info));
+
     download->priv->in_tex[0] =
-        gst_gl_memory_wrapped_texture (download->context, texture_id,
-        GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&download->info),
-        GST_VIDEO_INFO_HEIGHT (&download->info), NULL, NULL);
+        gst_gl_memory_wrapped_texture (download->context,
+        texture_id, texture_target, &temp_info, 0, NULL, NULL, NULL);
+  }
 
   download->priv->in_tex[0]->tex_id = texture_id;
 
@@ -240,6 +315,9 @@
   GstVideoFormat v_format;
   guint out_width, out_height;
   GstVideoInfo in_info;
+  GstCaps *in_caps, *out_caps;
+  GstCapsFeatures *in_gl_features, *out_gl_features;
+  gboolean res;
 
   v_format = GST_VIDEO_INFO_FORMAT (&download->info);
   out_width = GST_VIDEO_INFO_WIDTH (&download->info);
@@ -260,13 +338,24 @@
     }
   }
 
+  in_gl_features =
+      gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
   gst_video_info_set_format (&in_info, GST_VIDEO_FORMAT_RGBA, out_width,
       out_height);
+  in_caps = gst_video_info_to_caps (&in_info);
+  gst_caps_set_features (in_caps, 0, in_gl_features);
 
-  gst_gl_color_convert_set_format (download->convert, &in_info,
-      &download->info);
+  out_gl_features =
+      gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  out_caps = gst_video_info_to_caps (&download->info);
+  gst_caps_set_features (out_caps, 0, out_gl_features);
 
-  return TRUE;
+  res = gst_gl_color_convert_set_caps (download->convert, in_caps, out_caps);
+
+  gst_caps_unref (in_caps);
+  gst_caps_unref (out_caps);
+
+  return res;
 }
 
 static gboolean
@@ -303,6 +392,8 @@
     gpointer temp_data = ((GstGLMemory *) out_mem)->data;
     ((GstGLMemory *) out_mem)->data = data[i];
 
+    gst_gl_memory_download_transfer ((GstGLMemory *) out_mem);
+
     if (!gst_memory_map (out_mem, &map_info, GST_MAP_READ)) {
       GST_ERROR_OBJECT (download, "Failed to map memory");
       ret = FALSE;
diff --git a/gst-libs/gst/gl/gstgldownload.h b/gst-libs/gst/gl/gstgldownload.h
index 531e4f4..2eeccf4 100644
--- a/gst-libs/gst/gl/gstgldownload.h
+++ b/gst-libs/gst/gl/gstgldownload.h
@@ -73,8 +73,13 @@
 GstGLDownload * gst_gl_download_new          (GstGLContext * context);
 
 void gst_gl_download_set_format                (GstGLDownload * download, GstVideoInfo * out_info);
+GstCaps * gst_gl_download_transform_caps       (GstGLContext * convert,
+                                                GstPadDirection direction,
+                                                GstCaps * caps,
+                                                GstCaps * filter);
 
-gboolean gst_gl_download_perform_with_data          (GstGLDownload * download, GLuint texture_id,
+gboolean gst_gl_download_perform_with_data          (GstGLDownload * download,
+                                                     GLuint texture_id, GLuint texture_target,
                                                      gpointer data[GST_VIDEO_MAX_PLANES]);
 
 G_END_DECLS
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
index 26bf3f9..cf95d1c 100644
--- a/gst-libs/gst/gl/gstglfilter.c
+++ b/gst-libs/gst/gl/gstglfilter.c
@@ -24,6 +24,8 @@
 #include "config.h"
 #endif
 
+#include <gst/video/gstvideometa.h>
+
 #include "gstglfilter.h"
 
 #if GST_GL_HAVE_PLATFORM_EGL
@@ -35,59 +37,39 @@
 
 
 static GstStaticPadTemplate gst_gl_filter_src_pad_template =
-    GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
         (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
-            "RGBA") "; "
-#if GST_GL_HAVE_PLATFORM_EGL
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_EGL_IMAGE,
-            "RGBA") "; "
-#endif
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-        (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META,
-            "RGBA") "; " GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS))
+            "RGBA"))
     );
 
 static GstStaticPadTemplate gst_gl_filter_sink_pad_template =
-    GST_STATIC_PAD_TEMPLATE ("sink",
+GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
         (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
-            "RGBA") "; "
-#if GST_GL_HAVE_PLATFORM_EGL
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_EGL_IMAGE,
-            "RGBA") "; "
-#endif
-        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-        (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "RGBA") "; "
-        GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS))
+            "RGBA"))
     );
 
 /* Properties */
 enum
 {
   PROP_0,
-  PROP_OTHER_CONTEXT
 };
 
-#define DEBUG_INIT \
-  GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0, "glfilter element");
 #define gst_gl_filter_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstGLFilter, gst_gl_filter, GST_TYPE_BASE_TRANSFORM,
-    DEBUG_INIT);
+G_DEFINE_TYPE_WITH_CODE (GstGLFilter, gst_gl_filter, GST_TYPE_GL_BASE_FILTER,
+    GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0,
+        "glfilter element"););
 
 static void gst_gl_filter_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_gl_filter_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static void gst_gl_filter_set_context (GstElement * element,
-    GstContext * context);
-static gboolean gst_gl_filter_query (GstBaseTransform * trans,
-    GstPadDirection direction, GstQuery * query);
 static GstCaps *gst_gl_filter_transform_caps (GstBaseTransform * bt,
     GstPadDirection direction, GstCaps * caps, GstCaps * filter);
 static GstCaps *gst_gl_filter_fixate_caps (GstBaseTransform * bt,
@@ -105,10 +87,8 @@
     GstQuery * query);
 static gboolean gst_gl_filter_set_caps (GstBaseTransform * bt, GstCaps * incaps,
     GstCaps * outcaps);
-
-/* GstGLContextThreadFunc */
-static void gst_gl_filter_start_gl (GstGLContext * context, gpointer data);
-static void gst_gl_filter_stop_gl (GstGLContext * context, gpointer data);
+static gboolean gst_gl_filter_gl_start (GstGLBaseFilter * filter);
+static void gst_gl_filter_gl_stop (GstGLBaseFilter * filter);
 
 static void
 gst_gl_filter_class_init (GstGLFilterClass * klass)
@@ -126,7 +106,6 @@
       gst_gl_filter_transform_caps;
   GST_BASE_TRANSFORM_CLASS (klass)->fixate_caps = gst_gl_filter_fixate_caps;
   GST_BASE_TRANSFORM_CLASS (klass)->transform = gst_gl_filter_transform;
-  GST_BASE_TRANSFORM_CLASS (klass)->query = gst_gl_filter_query;
   GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_filter_start;
   GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_filter_stop;
   GST_BASE_TRANSFORM_CLASS (klass)->set_caps = gst_gl_filter_set_caps;
@@ -136,50 +115,27 @@
       gst_gl_filter_decide_allocation;
   GST_BASE_TRANSFORM_CLASS (klass)->get_unit_size = gst_gl_filter_get_unit_size;
 
-  element_class->set_context = gst_gl_filter_set_context;
-
-  g_object_class_install_property (gobject_class, PROP_OTHER_CONTEXT,
-      g_param_spec_object ("other-context",
-          "External OpenGL context",
-          "Give an external OpenGL context with which to share textures",
-          GST_GL_TYPE_CONTEXT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  GST_GL_BASE_FILTER_CLASS (klass)->gl_start = gst_gl_filter_gl_start;
+  GST_GL_BASE_FILTER_CLASS (klass)->gl_stop = gst_gl_filter_gl_stop;
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&gst_gl_filter_src_pad_template));
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&gst_gl_filter_sink_pad_template));
-
-  klass->set_caps = NULL;
-  klass->filter = NULL;
-  klass->display_init_cb = NULL;
-  klass->display_reset_cb = NULL;
-  klass->onInitFBO = NULL;
-  klass->onStart = NULL;
-  klass->onStop = NULL;
-  klass->onReset = NULL;
-  klass->filter_texture = NULL;
 }
 
 static void
 gst_gl_filter_init (GstGLFilter * filter)
 {
-  gst_gl_filter_reset (filter);
+  filter->draw_attr_position_loc = -1;
+  filter->draw_attr_texture_loc = -1;
 }
 
 static void
 gst_gl_filter_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
-  GstGLFilter *filter = GST_GL_FILTER (object);
-
   switch (prop_id) {
-    case PROP_OTHER_CONTEXT:
-    {
-      if (filter->other_context)
-        gst_object_unref (filter->other_context);
-      filter->other_context = g_value_dup_object (value);
-      break;
-    }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -190,12 +146,7 @@
 gst_gl_filter_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec)
 {
-  GstGLFilter *filter = GST_GL_FILTER (object);
-
   switch (prop_id) {
-    case PROP_OTHER_CONTEXT:
-      g_value_set_object (value, filter->other_context);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -203,103 +154,14 @@
 }
 
 static void
-gst_gl_filter_set_context (GstElement * element, GstContext * context)
-{
-  GstGLFilter *filter = GST_GL_FILTER (element);
-
-  gst_gl_handle_set_context (element, context, &filter->display);
-}
-
-static gboolean
-gst_gl_filter_query (GstBaseTransform * trans, GstPadDirection direction,
-    GstQuery * query)
-{
-  GstGLFilter *filter;
-
-  filter = GST_GL_FILTER (trans);
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_ALLOCATION:
-    {
-      if (direction == GST_PAD_SINK
-          && gst_base_transform_is_passthrough (trans))
-        return gst_pad_peer_query (GST_BASE_TRANSFORM_SRC_PAD (trans), query);
-      break;
-    }
-    case GST_QUERY_CONTEXT:
-    {
-      return gst_gl_handle_context_query ((GstElement *) filter, query,
-          &filter->display);
-      break;
-    }
-    default:
-      break;
-  }
-
-  return GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, direction,
-      query);;
-}
-
-static void
 gst_gl_filter_reset (GstGLFilter * filter)
 {
-  GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
-
   gst_caps_replace (&filter->out_caps, NULL);
 
-  if (filter->upload) {
-    gst_object_unref (filter->upload);
-    filter->upload = NULL;
+  if (filter->pool) {
+    gst_object_unref (filter->pool);
+    filter->pool = NULL;
   }
-
-  if (filter->download) {
-    gst_object_unref (filter->download);
-    filter->download = NULL;
-  }
-
-  if (filter->context) {
-    if (filter_class->onReset)
-      filter_class->onReset (filter);
-
-    if (filter_class->display_reset_cb != NULL) {
-      gst_gl_context_thread_add (filter->context, gst_gl_filter_stop_gl,
-          filter);
-    }
-    //blocking call, delete the FBO
-    if (filter->fbo != 0) {
-      gst_gl_context_del_fbo (filter->context, filter->fbo,
-          filter->depthbuffer);
-    }
-
-    if (filter->in_tex_id) {
-      gst_gl_context_del_texture (filter->context, &filter->in_tex_id);
-      filter->in_tex_id = 0;
-    }
-
-    if (filter->out_tex_id) {
-      gst_gl_context_del_texture (filter->context, &filter->out_tex_id);
-      filter->out_tex_id = 0;
-    }
-
-    gst_object_unref (filter->context);
-    filter->context = NULL;
-  }
-
-  if (filter->display) {
-    gst_object_unref (filter->display);
-    filter->display = NULL;
-  }
-
-  filter->fbo = 0;
-  filter->depthbuffer = 0;
-  filter->default_shader = NULL;
-  if (filter->other_context)
-    gst_object_unref (filter->other_context);
-  filter->other_context = NULL;
-
-  if (filter->context)
-    gst_object_unref (filter->context);
-  filter->context = NULL;
 }
 
 static gboolean
@@ -308,13 +170,10 @@
   GstGLFilter *filter = GST_GL_FILTER (bt);
   GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
 
-  if (!gst_gl_ensure_display (filter, &filter->display))
-    return FALSE;
-
   if (filter_class->onStart)
     filter_class->onStart (filter);
 
-  return TRUE;
+  return GST_BASE_TRANSFORM_CLASS (parent_class)->start (bt);
 }
 
 static gboolean
@@ -328,25 +187,85 @@
 
   gst_gl_filter_reset (filter);
 
+  return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (bt);
+}
+
+static gboolean
+gst_gl_filter_gl_start (GstGLBaseFilter * base_filter)
+{
+  GstGLFilter *filter = GST_GL_FILTER (base_filter);
+  GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
+  gint out_width, out_height;
+  GError *error = NULL;
+
+  out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
+  out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
+
+  if (filter->fbo) {
+    gst_gl_context_del_fbo (context, filter->fbo, filter->depthbuffer);
+    filter->fbo = 0;
+    filter->depthbuffer = 0;
+  }
+  //blocking call, generate a FBO
+  if (!gst_gl_context_gen_fbo (context, out_width, out_height,
+          &filter->fbo, &filter->depthbuffer))
+    goto context_error;
+
+  if (filter_class->display_init_cb)
+    filter_class->display_init_cb (filter);
+
+  if (filter_class->onInitFBO) {
+    if (!filter_class->onInitFBO (filter))
+      goto error;
+  }
+
   return TRUE;
+
+context_error:
+  {
+    GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND, ("%s", error->message),
+        (NULL));
+    return FALSE;
+  }
+error:
+  {
+    GST_ELEMENT_ERROR (filter, LIBRARY, INIT,
+        ("Subclass failed to initialize."), (NULL));
+    return FALSE;
+  }
 }
 
 static void
-gst_gl_filter_start_gl (GstGLContext * context, gpointer data)
+gst_gl_filter_gl_stop (GstGLBaseFilter * base_filter)
 {
-  GstGLFilter *filter = GST_GL_FILTER (data);
+  GstGLFilter *filter = GST_GL_FILTER (base_filter);
   GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
+  const GstGLFuncs *gl = context->gl_vtable;
 
-  filter_class->display_init_cb (filter);
-}
+  if (filter_class->display_reset_cb)
+    filter_class->display_reset_cb (filter);
 
-static void
-gst_gl_filter_stop_gl (GstGLContext * context, gpointer data)
-{
-  GstGLFilter *filter = GST_GL_FILTER (data);
-  GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
+  if (filter->vao) {
+    gl->DeleteVertexArrays (1, &filter->vao);
+    filter->vao = 0;
+  }
 
-  filter_class->display_reset_cb (filter);
+  if (filter->vertex_buffer) {
+    gl->DeleteBuffers (1, &filter->vertex_buffer);
+    filter->vertex_buffer = 0;
+  }
+
+  if (filter->fbo != 0) {
+    gst_gl_context_del_fbo (context, filter->fbo, filter->depthbuffer);
+  }
+
+  filter->fbo = 0;
+  filter->depthbuffer = 0;
+  filter->default_shader = NULL;
+  filter->draw_attr_position_loc = -1;
+  filter->draw_attr_texture_loc = -1;
 }
 
 static GstCaps *
@@ -423,18 +342,13 @@
     /* if both width and height are already fixed, we can't do anything
      * about it anymore */
     if (w && h) {
-      gint n = 1, d = 1;
-
       GST_DEBUG_OBJECT (bt, "dimensions already set to %dx%d, not fixating",
           w, h);
       if (!gst_value_is_fixed (to_par)) {
-        GST_DEBUG_OBJECT (bt, "fixating to_par to %dx%d", n, d);
+        GST_DEBUG_OBJECT (bt, "fixating to_par to %dx%d", 1, 1);
         if (gst_structure_has_field (outs, "pixel-aspect-ratio"))
           gst_structure_fixate_field_nearest_fraction (outs,
               "pixel-aspect-ratio", 1, 1);
-        else if (n != d)
-          gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
-              1, 1, NULL);
       }
       goto done;
     }
@@ -588,6 +502,7 @@
               &to_par_n, &to_par_d)) {
         GST_ELEMENT_ERROR (bt, CORE, NEGOTIATION, (NULL),
             ("Error calculating the output scaled size - integer overflow"));
+        gst_structure_free (tmp);
         goto done;
       }
 
@@ -677,36 +592,9 @@
   return othercaps;
 }
 
-
-static GstCaps *
-gst_gl_filter_set_caps_features (const GstCaps * caps,
-    const gchar * feature_name)
-{
-  GstCaps *tmp = gst_caps_copy (caps);
-  guint n = gst_caps_get_size (tmp);
-  guint i = 0;
-
-  for (i = 0; i < n; i++) {
-    GstCapsFeatures *features = gst_caps_get_features (tmp, i);
-    if (features) {
-      guint n_f = gst_caps_features_get_size (features);
-      guint j = 0;
-      for (j = 0; j < n_f; j++) {
-        gst_caps_features_remove_id (features,
-            gst_caps_features_get_nth_id (features, j));
-      }
-    }
-
-    gst_caps_features_add (features, feature_name);
-    gst_caps_set_simple (tmp, "format", G_TYPE_STRING, "RGBA", NULL);
-  }
-
-  return tmp;
-}
-
 /* copies the given caps */
 static GstCaps *
-gst_gl_filter_caps_remove_format_info (GstCaps * caps)
+gst_gl_filter_caps_remove_size (GstCaps * caps)
 {
   GstStructure *st;
   GstCapsFeatures *f;
@@ -726,12 +614,7 @@
       continue;
 
     st = gst_structure_copy (st);
-    /* Only remove format info for the cases when we can actually convert */
-    if (!gst_caps_features_is_any (f)
-        && gst_caps_features_is_equal (f,
-            GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))
-      gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
-          "width", "height", NULL);
+    gst_structure_remove_fields (st, "width", "height", NULL);
 
     gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
   }
@@ -740,57 +623,43 @@
 }
 
 static GstCaps *
+gst_gl_filter_set_caps_features (const GstCaps * caps,
+    const gchar * feature_name)
+{
+  GstCaps *ret = gst_gl_caps_replace_all_caps_features (caps, feature_name);
+  gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
+  return ret;
+}
+
+static GstCaps *
 gst_gl_filter_transform_caps (GstBaseTransform * bt,
-    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
+    GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps)
 {
   GstCaps *tmp = NULL;
   GstCaps *result = NULL;
-  GstCaps *glcaps = gst_gl_filter_set_caps_features (caps,
-      GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
-#if GST_GL_HAVE_PLATFORM_EGL
-  GstCaps *eglcaps = gst_gl_filter_set_caps_features (caps,
-      GST_CAPS_FEATURE_MEMORY_EGL_IMAGE);
-#endif
-  GstCaps *uploadcaps = gst_gl_filter_set_caps_features (caps,
-      GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META);
-  GstCaps *raw_caps =
-      gst_caps_from_string (GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS));
-  GstCapsFeatures *f;
 
-  tmp = gst_caps_new_empty ();
+  result = gst_gl_filter_caps_remove_size (caps);
+  tmp = result;
+  GST_DEBUG_OBJECT (bt, "size removal returned caps %" GST_PTR_FORMAT, tmp);
 
-  tmp = gst_caps_merge (tmp, glcaps);
-#if GST_GL_HAVE_PLATFORM_EGL
-  tmp = gst_caps_merge (tmp, eglcaps);
-#endif
-  tmp = gst_caps_merge (tmp, uploadcaps);
-  tmp = gst_caps_merge (tmp, raw_caps);
+  result =
+      gst_gl_filter_set_caps_features (tmp, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  gst_caps_unref (tmp);
+  tmp = result;
 
-  tmp = gst_caps_merge (tmp, gst_gl_filter_caps_remove_format_info (caps));
-
-  if (filter) {
-    result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
+  if (filter_caps) {
+    result =
+        gst_caps_intersect_full (filter_caps, tmp, GST_CAPS_INTERSECT_FIRST);
     gst_caps_unref (tmp);
   } else {
     result = tmp;
   }
 
-  /* if output still intersects input then prefer the intersection */
-  f = gst_caps_get_features (caps, 0);
-
-  if (!gst_caps_features_is_any (f)
-      && !gst_caps_features_is_equal (f,
-          GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)) {
-    tmp = gst_caps_intersect_full (result, caps, GST_CAPS_INTERSECT_FIRST);
-    result = gst_caps_merge (tmp, result);
-  }
-
   GST_DEBUG_OBJECT (bt, "returning caps: %" GST_PTR_FORMAT, result);
 
   return result;
 }
 
-
 static gboolean
 gst_gl_filter_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
     gsize * size)
@@ -849,126 +718,59 @@
     GstQuery * decide_query, GstQuery * query)
 {
   GstGLFilter *filter = GST_GL_FILTER (trans);
-  GstBufferPool *pool;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstStructure *config;
-  GstCaps *caps, *decide_caps;
+  GstCaps *caps;
   guint size;
   gboolean need_pool;
-  GError *error = NULL;
-  GstStructure *gl_context;
-  gchar *platform, *gl_apis;
-  gpointer handle;
-  GstAllocator *allocator = NULL;
-  GstAllocationParams params;
 
   gst_query_parse_allocation (query, &caps, &need_pool);
 
   if (caps == NULL)
     goto no_caps;
 
-  if ((pool = filter->pool))
-    gst_object_ref (pool);
+  if (need_pool) {
+    if (filter->pool) {
+      GstCaps *pcaps;
 
-  if (pool != NULL) {
-    GstCaps *pcaps;
+      /* we had a pool, check caps */
+      GST_DEBUG_OBJECT (filter, "check existing pool caps");
+      config = gst_buffer_pool_get_config (filter->pool);
+      gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
 
-    /* we had a pool, check caps */
-    GST_DEBUG_OBJECT (filter, "check existing pool caps");
-    config = gst_buffer_pool_get_config (pool);
-    gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
-
-    if (!gst_caps_is_equal (caps, pcaps)) {
-      GST_DEBUG_OBJECT (filter, "pool has different caps");
-      /* different caps, we can't use this pool */
-      gst_object_unref (pool);
-      pool = NULL;
-    }
-    gst_structure_free (config);
-  }
-
-  if (!gst_gl_ensure_display (filter, &filter->display))
-    return FALSE;
-
-  if (!filter->context) {
-    filter->context = gst_gl_context_new (filter->display);
-    if (!gst_gl_context_create (filter->context, filter->other_context, &error))
-      goto context_error;
-  }
-
-  if (pool == NULL && need_pool) {
-    GstVideoInfo info;
-    GstBufferPool *decide_pool = NULL;
-
-    if (!gst_video_info_from_caps (&info, caps))
-      goto invalid_caps;
-
-    if (decide_query) {
-      gst_query_parse_allocation (decide_query, &decide_caps, NULL);
-      decide_pool = gst_base_transform_get_buffer_pool (trans);
-    }
-
-    if (decide_pool && GST_IS_GL_BUFFER_POOL (decide_pool)
-        && gst_caps_is_equal_fixed (decide_caps, caps)) {
-      config = gst_buffer_pool_get_config (pool);
-      gst_buffer_pool_config_get_params (config, NULL, &size, NULL, NULL);
+      if (!gst_caps_is_equal (caps, pcaps)) {
+        GST_DEBUG_OBJECT (filter, "pool has different caps");
+        /* different caps, we can't use this pool */
+        gst_object_unref (filter->pool);
+        filter->pool = NULL;
+      }
       gst_structure_free (config);
+    }
 
-      pool = decide_pool;
-    } else {
-      GST_DEBUG_OBJECT (filter, "create new pool");
-      if (decide_pool)
-        gst_object_unref (decide_pool);
-      pool = gst_gl_buffer_pool_new (filter->context);
+    if (filter->pool == NULL) {
+      GstVideoInfo info;
+
+      if (!gst_video_info_from_caps (&info, caps))
+        goto invalid_caps;
 
       /* the normal size of a frame */
       size = info.size;
 
-      config = gst_buffer_pool_get_config (pool);
+      GST_DEBUG_OBJECT (filter, "create new pool");
+      filter->pool = gst_gl_buffer_pool_new (context);
+
+      config = gst_buffer_pool_get_config (filter->pool);
       gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
-      if (!gst_buffer_pool_set_config (pool, config))
+
+      if (!gst_buffer_pool_set_config (filter->pool, config))
         goto config_failed;
     }
-  }
-  /* we need at least 2 buffer because we hold on to the last one */
-  if (pool) {
-    gst_query_add_allocation_pool (query, pool, size, 1, 0);
-    gst_object_unref (pool);
+
+    gst_query_add_allocation_pool (query, filter->pool, size, 1, 0);
   }
 
-  /* we also support various metadata */
-  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
-
-  gl_apis = gst_gl_api_to_string (gst_gl_context_get_gl_api (filter->context));
-  platform =
-      gst_gl_platform_to_string (gst_gl_context_get_gl_platform
-      (filter->context));
-  handle = (gpointer) gst_gl_context_get_gl_context (filter->context);
-
-  gl_context =
-      gst_structure_new ("GstVideoGLTextureUploadMeta", "gst.gl.GstGLContext",
-      GST_GL_TYPE_CONTEXT, filter->context, "gst.gl.context.handle",
-      G_TYPE_POINTER, handle, "gst.gl.context.type", G_TYPE_STRING, platform,
-      "gst.gl.context.apis", G_TYPE_STRING, gl_apis, NULL);
-  gst_query_add_allocation_meta (query,
-      GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, gl_context);
-
-  g_free (gl_apis);
-  g_free (platform);
-  gst_structure_free (gl_context);
-
-  gst_allocation_params_init (&params);
-
-  allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
-  gst_query_add_allocation_param (query, allocator, &params);
-  gst_object_unref (allocator);
-
-#if GST_GL_HAVE_PLATFORM_EGL
-  if (gst_gl_context_check_feature (filter->context, "EGL_KHR_image_base")) {
-    allocator = gst_allocator_find (GST_EGL_IMAGE_MEMORY_TYPE);
-    gst_query_add_allocation_param (query, allocator, &params);
-    gst_object_unref (allocator);
-  }
-#endif
+  if (context->gl_vtable->FenceSync)
+    gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
 
   return TRUE;
 
@@ -988,127 +790,28 @@
     GST_DEBUG_OBJECT (trans, "failed setting config");
     return FALSE;
   }
-context_error:
-  {
-    GST_ELEMENT_ERROR (trans, RESOURCE, NOT_FOUND, ("%s", error->message),
-        (NULL));
-    return FALSE;
-  }
 }
 
 static gboolean
 gst_gl_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query)
 {
-  GstGLFilter *filter = GST_GL_FILTER (trans);
-  GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
+  GstGLContext *context;
   GstBufferPool *pool = NULL;
   GstStructure *config;
   GstCaps *caps;
   guint min, max, size;
   gboolean update_pool;
-  guint idx;
-  GError *error = NULL;
-  guint in_width, in_height, out_width, out_height;
-  GstGLContext *other_context = NULL;
-
-  if (!gst_gl_ensure_display (filter, &filter->display))
-    return FALSE;
-
-  if (gst_query_find_allocation_meta (query,
-          GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx)) {
-    GstGLContext *context;
-    const GstStructure *upload_meta_params;
-    gpointer handle;
-    gchar *type;
-    gchar *apis;
-
-    gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params);
-    if (upload_meta_params) {
-      if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext",
-              GST_GL_TYPE_CONTEXT, &context, NULL) && context) {
-        GstGLContext *old = filter->context;
-
-        filter->context = context;
-        if (old)
-          gst_object_unref (old);
-      } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle",
-              G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING,
-              &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL)
-          && handle) {
-        GstGLPlatform platform = GST_GL_PLATFORM_NONE;
-        GstGLAPI gl_apis;
-
-        GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s",
-            handle, type, apis);
-
-        platform = gst_gl_platform_from_string (type);
-        gl_apis = gst_gl_api_from_string (apis);
-
-        if (gl_apis && platform)
-          other_context =
-              gst_gl_context_new_wrapped (filter->display, (guintptr) handle,
-              platform, gl_apis);
-      }
-    }
-  }
-
-  if (filter->other_context) {
-    if (!other_context) {
-      other_context = filter->other_context;
-    } else {
-      GST_ELEMENT_WARNING (filter, LIBRARY, SETTINGS,
-          ("%s", "Cannot share with more than one GL context"),
-          ("%s", "Cannot share with more than one GL context"));
-    }
-  }
-
-  if (!filter->context) {
-    filter->context = gst_gl_context_new (filter->display);
-    if (!gst_gl_context_create (filter->context, other_context, &error))
-      goto context_error;
-  }
-
-  in_width = GST_VIDEO_INFO_WIDTH (&filter->in_info);
-  in_height = GST_VIDEO_INFO_HEIGHT (&filter->in_info);
-  out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
-  out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
-
-  if (filter->fbo) {
-    gst_gl_context_del_fbo (filter->context, filter->fbo, filter->depthbuffer);
-    filter->fbo = 0;
-    filter->depthbuffer = 0;
-  }
-
-  if (filter->in_tex_id) {
-    gst_gl_context_del_texture (filter->context, &filter->in_tex_id);
-    filter->in_tex_id = 0;
-  }
-
-  if (filter->out_tex_id) {
-    gst_gl_context_del_texture (filter->context, &filter->out_tex_id);
-    filter->out_tex_id = 0;
-  }
-  //blocking call, generate a FBO
-  if (!gst_gl_context_gen_fbo (filter->context, out_width, out_height,
-          &filter->fbo, &filter->depthbuffer))
-    goto context_error;
-
-  gst_gl_context_gen_texture (filter->context, &filter->in_tex_id,
-      GST_VIDEO_FORMAT_RGBA, in_width, in_height);
-
-  gst_gl_context_gen_texture (filter->context, &filter->out_tex_id,
-      GST_VIDEO_FORMAT_RGBA, out_width, out_height);
-
-  if (filter_class->display_init_cb != NULL) {
-    gst_gl_context_thread_add (filter->context, gst_gl_filter_start_gl, filter);
-  }
-
-  if (filter_class->onInitFBO) {
-    if (!filter_class->onInitFBO (filter))
-      goto error;
-  }
 
   gst_query_parse_allocation (query, &caps, NULL);
+  if (!caps)
+    return FALSE;
+
+  /* get gl context */
+  if (!GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans,
+          query))
+    return FALSE;
+
+  context = GST_GL_BASE_FILTER (trans)->context;
 
   if (gst_query_get_n_allocation_pools (query) > 0) {
     gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
@@ -1124,18 +827,21 @@
     update_pool = FALSE;
   }
 
-  if (!pool)
-    pool = gst_gl_buffer_pool_new (filter->context);
+  if (!pool || !GST_IS_GL_BUFFER_POOL (pool)) {
+    if (pool)
+      gst_object_unref (pool);
+    pool = gst_gl_buffer_pool_new (context);
+  }
 
   config = gst_buffer_pool_get_config (pool);
+
   gst_buffer_pool_config_set_params (config, caps, size, min, max);
   gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
-  gst_buffer_pool_set_config (pool, config);
+  if (gst_query_find_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL))
+    gst_buffer_pool_config_add_option (config,
+        GST_BUFFER_POOL_OPTION_GL_SYNC_META);
 
-  if (filter->upload) {
-    gst_object_unref (filter->upload);
-    filter->upload = NULL;
-  }
+  gst_buffer_pool_set_config (pool, config);
 
   if (update_pool)
     gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
@@ -1145,19 +851,6 @@
   gst_object_unref (pool);
 
   return TRUE;
-
-context_error:
-  {
-    GST_ELEMENT_ERROR (trans, RESOURCE, NOT_FOUND, ("%s", error->message),
-        (NULL));
-    return FALSE;
-  }
-error:
-  {
-    GST_ELEMENT_ERROR (trans, LIBRARY, INIT,
-        ("Subclass failed to initialize."), (NULL));
-    return FALSE;
-  }
 }
 
 /**
@@ -1177,63 +870,37 @@
 {
   GstGLFilterClass *filter_class;
   guint in_tex, out_tex;
-  GstVideoFrame out_frame;
+  GstVideoFrame gl_frame, out_frame;
   gboolean ret;
-  gboolean to_download =
-      gst_caps_features_is_equal (GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY,
-      gst_caps_get_features (filter->out_caps, 0));
-  GstMapFlags out_map_flags = GST_MAP_WRITE;
 
   filter_class = GST_GL_FILTER_GET_CLASS (filter);
 
-  if (!gst_gl_upload_perform_with_buffer (filter->upload, inbuf, &in_tex))
-    return FALSE;
-
-  to_download |= !gst_is_gl_memory (gst_buffer_peek_memory (outbuf, 0));
-
-  if (!to_download)
-    out_map_flags |= GST_MAP_GL;
-
-  if (!gst_video_frame_map (&out_frame, &filter->out_info, outbuf,
-          out_map_flags)) {
+  if (!gst_video_frame_map (&gl_frame, &filter->in_info, inbuf,
+          GST_MAP_READ | GST_MAP_GL)) {
     ret = FALSE;
     goto inbuf_error;
   }
 
-  if (!to_download) {
-    out_tex = *(guint *) out_frame.data[0];
-  } else {
-    GST_LOG ("Output Buffer does not contain correct memory, "
-        "attempting to wrap for download");
+  in_tex = *(guint *) gl_frame.data[0];
 
-    if (!filter->download)
-      filter->download = gst_gl_download_new (filter->context);
-
-    gst_gl_download_set_format (filter->download, &out_frame.info);
-
-    out_tex = filter->out_tex_id;
+  if (!gst_video_frame_map (&out_frame, &filter->out_info, outbuf,
+          GST_MAP_WRITE | GST_MAP_GL)) {
+    ret = FALSE;
+    goto unmap_out_error;
   }
 
+  out_tex = *(guint *) out_frame.data[0];
+
   GST_DEBUG ("calling filter_texture with textures in:%i out:%i", in_tex,
       out_tex);
 
   g_assert (filter_class->filter_texture);
   ret = filter_class->filter_texture (filter, in_tex, out_tex);
 
-  if (to_download) {
-    if (!gst_gl_download_perform_with_data (filter->download, out_tex,
-            out_frame.data)) {
-      GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
-          ("%s", "Failed to download video frame"), (NULL));
-      ret = FALSE;
-      goto error;
-    }
-  }
-
-error:
   gst_video_frame_unmap (&out_frame);
+unmap_out_error:
+  gst_video_frame_unmap (&gl_frame);
 inbuf_error:
-  gst_gl_upload_release_buffer (filter->upload);
 
   return ret;
 }
@@ -1242,31 +909,51 @@
 gst_gl_filter_transform (GstBaseTransform * bt, GstBuffer * inbuf,
     GstBuffer * outbuf)
 {
-  GstGLFilter *filter;
-  GstGLFilterClass *filter_class;
+  GstGLFilter *filter = GST_GL_FILTER (bt);
+  GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (bt);
+  GstGLDisplay *display = GST_GL_BASE_FILTER (bt)->display;
+  GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
+  GstGLSyncMeta *out_sync_meta, *in_sync_meta;
 
-  filter = GST_GL_FILTER (bt);
-  filter_class = GST_GL_FILTER_GET_CLASS (bt);
-
-  if (!gst_gl_ensure_display (filter, &filter->display))
+  if (!display)
     return GST_FLOW_NOT_NEGOTIATED;
 
-  if (!filter->upload) {
-    filter->upload = gst_gl_upload_new (filter->context);
-    gst_gl_upload_set_format (filter->upload, &filter->in_info);
-  }
-
   g_assert (filter_class->filter || filter_class->filter_texture);
 
+  in_sync_meta = gst_buffer_get_gl_sync_meta (inbuf);
+  if (in_sync_meta)
+    gst_gl_sync_meta_wait (in_sync_meta, context);
+
   if (filter_class->filter)
     filter_class->filter (filter, inbuf, outbuf);
   else if (filter_class->filter_texture)
     gst_gl_filter_filter_texture (filter, inbuf, outbuf);
 
+  out_sync_meta = gst_buffer_get_gl_sync_meta (outbuf);
+  if (out_sync_meta)
+    gst_gl_sync_meta_set_sync_point (out_sync_meta, context);
+
   return GST_FLOW_OK;
 }
 
+struct glcb2
+{
+  GLCB func;
+  gpointer data;
+  guint texture;
+  guint width;
+  guint height;
+};
+
 /* convenience functions to simplify filter development */
+static void
+_glcb2 (gpointer data)
+{
+  struct glcb2 *cb = data;
+
+  cb->func (cb->width, cb->height, cb->texture, cb->data);
+}
+
 /**
  * gst_gl_filter_render_to_target:
  * @filter: a #GstGLFilter
@@ -1284,7 +971,9 @@
 gst_gl_filter_render_to_target (GstGLFilter * filter, gboolean resize,
     GLuint input, GLuint target, GLCB func, gpointer data)
 {
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   guint in_width, in_height, out_width, out_height;
+  struct glcb2 cb;
 
   out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
   out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
@@ -1299,21 +988,25 @@
   GST_LOG ("rendering to target. in %u, %ux%u out %u, %ux%u", input, in_width,
       in_height, target, out_width, out_height);
 
-  gst_gl_context_use_fbo (filter->context,
-      out_width, out_height,
-      filter->fbo, filter->depthbuffer, target,
-      func, in_width, in_height, input, 0,
-      in_width, 0, in_height, GST_GL_DISPLAY_PROJECTION_ORTHO2D, data);
+  cb.func = func;
+  cb.data = data;
+  cb.texture = input;
+  cb.width = in_width;
+  cb.height = in_height;
+
+  gst_gl_context_use_fbo_v2 (context, out_width, out_height,
+      filter->fbo, filter->depthbuffer, target, _glcb2, &cb);
 }
 
 static void
 _draw_with_shader_cb (gint width, gint height, guint texture, gpointer stuff)
 {
   GstGLFilter *filter = GST_GL_FILTER (stuff);
-  GstGLFuncs *gl = filter->context->gl_vtable;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
+  GstGLFuncs *gl = context->gl_vtable;
 
 #if GST_GL_HAVE_OPENGL
-  if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
+  if (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL) {
     gl->MatrixMode (GL_PROJECTION);
     gl->LoadIdentity ();
   }
@@ -1331,6 +1024,23 @@
   gst_gl_filter_draw_texture (filter, texture, width, height);
 }
 
+static void
+_get_attributes (GstGLFilter * filter)
+{
+  if (!filter->default_shader)
+    return;
+
+  if (filter->draw_attr_position_loc == -1)
+    filter->draw_attr_position_loc =
+        gst_gl_shader_get_attribute_location (filter->default_shader,
+        "a_position");
+
+  if (filter->draw_attr_texture_loc == -1)
+    filter->draw_attr_texture_loc =
+        gst_gl_shader_get_attribute_location (filter->default_shader,
+        "a_texcoord");
+}
+
 /**
  * gst_gl_filter_render_to_target_with_shader:
  * @filter: a #GstGLFilter
@@ -1352,10 +1062,55 @@
     gboolean resize, GLuint input, GLuint target, GstGLShader * shader)
 {
   filter->default_shader = shader;
+  _get_attributes (filter);
+
   gst_gl_filter_render_to_target (filter, resize, input, target,
       _draw_with_shader_cb, filter);
 }
 
+/* *INDENT-OFF* */
+static const GLfloat vertices[] = {
+  -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
+   1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
+   1.0f,  1.0f, 0.0f, 1.0f, 1.0f,
+  -1.0f,  1.0f, 0.0f, 0.0f, 1.0f
+};
+/* *INDENT-ON* */
+
+static void
+_bind_buffer (GstGLFilter * filter)
+{
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
+  const GstGLFuncs *gl = context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, filter->vertex_buffer);
+
+  _get_attributes (filter);
+  /* Load the vertex position */
+  gl->VertexAttribPointer (filter->draw_attr_position_loc, 3, GL_FLOAT,
+      GL_FALSE, 5 * sizeof (GLfloat), (void *) 0);
+
+  /* Load the texture coordinate */
+  gl->VertexAttribPointer (filter->draw_attr_texture_loc, 2, GL_FLOAT, GL_FALSE,
+      5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
+
+
+  gl->EnableVertexAttribArray (filter->draw_attr_position_loc);
+  gl->EnableVertexAttribArray (filter->draw_attr_texture_loc);
+}
+
+static void
+_unbind_buffer (GstGLFilter * filter)
+{
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
+  const GstGLFuncs *gl = context->gl_vtable;
+
+  gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+  gl->DisableVertexAttribArray (filter->draw_attr_position_loc);
+  gl->DisableVertexAttribArray (filter->draw_attr_texture_loc);
+}
+
 /**
  * gst_gl_filter_draw_texture:
  * @filter: a #GstGLFilter
@@ -1369,7 +1124,7 @@
 gst_gl_filter_draw_texture (GstGLFilter * filter, GLuint texture,
     guint width, guint height)
 {
-  GstGLContext *context = filter->context;
+  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
   GstGLFuncs *gl = context->gl_vtable;
 
   GST_DEBUG ("drawing texture:%u dimensions:%ux%u", texture, width, height);
@@ -1406,35 +1161,37 @@
     gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
   }
 #endif
-#if GST_GL_HAVE_GLES2
-  if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2) {
-    const GLfloat vVertices[] = {
-      -1.0f, -1.0f, 0.0f,
-      0.0f, 0.0f,
-      1.0, -1.0f, 0.0f,
-      1.0f, 0.0f,
-      1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f
-    };
-
+  if (gst_gl_context_get_gl_api (context) & (GST_GL_API_GLES2 |
+          GST_GL_API_OPENGL3)) {
     GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
 
-    /* glClear (GL_COLOR_BUFFER_BIT); */
+    if (!filter->vertex_buffer) {
+      if (gl->GenVertexArrays) {
+        gl->GenVertexArrays (1, &filter->vao);
+        gl->BindVertexArray (filter->vao);
+      }
 
-    /* Load the vertex position */
-    gl->VertexAttribPointer (filter->draw_attr_position_loc, 3, GL_FLOAT,
-        GL_FALSE, 5 * sizeof (GLfloat), vVertices);
+      gl->GenBuffers (1, &filter->vertex_buffer);
+      gl->BindBuffer (GL_ARRAY_BUFFER, filter->vertex_buffer);
+      gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
+          GL_STATIC_DRAW);
 
-    /* Load the texture coordinate */
-    gl->VertexAttribPointer (filter->draw_attr_texture_loc, 2, GL_FLOAT,
-        GL_FALSE, 5 * sizeof (GLfloat), &vVertices[3]);
+      if (gl->GenVertexArrays) {
+        _bind_buffer (filter);
+        gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+      }
+    }
 
-    gl->EnableVertexAttribArray (filter->draw_attr_position_loc);
-    gl->EnableVertexAttribArray (filter->draw_attr_texture_loc);
+    if (gl->GenVertexArrays)
+      gl->BindVertexArray (filter->vao);
+    else
+      _bind_buffer (filter);
 
     gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
 
-    gl->DisableVertexAttribArray (filter->draw_attr_position_loc);
-    gl->DisableVertexAttribArray (filter->draw_attr_texture_loc);
+    if (gl->GenVertexArrays)
+      gl->BindVertexArray (0);
+    else
+      _unbind_buffer (filter);
   }
-#endif
 }
diff --git a/gst-libs/gst/gl/gstglfilter.h b/gst-libs/gst/gl/gstglfilter.h
index c786493..fcca308 100644
--- a/gst-libs/gst/gl/gstglfilter.h
+++ b/gst-libs/gst/gl/gstglfilter.h
@@ -24,7 +24,6 @@
 #define _GST_GL_FILTER_H_
 
 #include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
 #include <gst/video/video.h>
 
 #include <gst/gl/gl.h>
@@ -39,9 +38,6 @@
 #define GST_IS_GL_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER))
 #define GST_GL_FILTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER,GstGLFilterClass))
 
-typedef struct _GstGLFilter GstGLFilter;
-typedef struct _GstGLFilterClass GstGLFilterClass;
-
 /**
  * GstGLFilter:
  * @base_transform: parent #GstBaseTransform
@@ -60,36 +56,28 @@
  */
 struct _GstGLFilter
 {
-  GstBaseTransform   base_transform;
+  GstGLBaseFilter    parent;
 
   GstBufferPool     *pool;
 
-  GstGLDisplay      *display;
-
   GstVideoInfo       in_info;
   GstVideoInfo       out_info;
 
   GstCaps           *out_caps;
 
+  /* <private> */
   GLuint             fbo;
   GLuint             depthbuffer;
 
-  GstGLUpload       *upload;
-  GstGLDownload     *download;
-
-  /* <private> */
   GLuint             in_tex_id;
   GLuint             out_tex_id;
 
   GstGLShader       *default_shader;
 
-  GstGLContext      *context;
-  GstGLContext      *other_context;
-
-#if GST_GL_HAVE_GLES2
-  GLint draw_attr_position_loc;
-  GLint draw_attr_texture_loc;
-#endif
+  GLuint             vao;
+  GLuint             vertex_buffer;
+  GLint              draw_attr_position_loc;
+  GLint              draw_attr_texture_loc;
 };
 
 /**
@@ -111,7 +99,7 @@
  */
 struct _GstGLFilterClass
 {
-  GstBaseTransformClass base_transform_class;
+  GstGLBaseFilterClass parent_class;
 
   gboolean (*set_caps)          (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
   gboolean (*filter)            (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
diff --git a/gst-libs/gst/gl/gstglframebuffer.c b/gst-libs/gst/gl/gstglframebuffer.c
index 6cde96c..0446c00 100644
--- a/gst-libs/gst/gl/gstglframebuffer.c
+++ b/gst-libs/gst/gl/gstglframebuffer.c
@@ -112,11 +112,12 @@
   gl->GenRenderbuffers (1, depth);
   gl->BindRenderbuffer (GL_RENDERBUFFER, *depth);
 
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
-    gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT,
-        width, height);
-    gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
-        width, height);
+  if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
+          GST_GL_API_OPENGL3)) {
+    gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width,
+        height);
+    gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width,
+        height);
   }
   if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_GLES2) {
     gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
@@ -141,7 +142,8 @@
   gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
       GL_RENDERBUFFER, *depth);
 
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
+  if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
+          GST_GL_API_OPENGL3)) {
     gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
         GL_RENDERBUFFER, *depth);
   }
@@ -164,110 +166,6 @@
 }
 
 gboolean
-gst_gl_framebuffer_use (GstGLFramebuffer * frame, gint texture_fbo_width,
-    gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
-    GLuint texture_fbo, GLCB cb, gint input_tex_width,
-    gint input_tex_height, GLuint input_tex, gdouble proj_param1,
-    gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
-    GstGLDisplayProjection projection, gpointer stuff)
-{
-  const GstGLFuncs *gl;
-#if GST_GL_HAVE_GLES2
-  GLint viewport_dim[4];
-#endif
-
-  g_return_val_if_fail (GST_IS_GL_FRAMEBUFFER (frame), FALSE);
-  g_return_val_if_fail (input_tex_width > 0 && input_tex_height > 0, FALSE);
-  g_return_val_if_fail (texture_fbo_width > 0 && texture_fbo_height > 0, FALSE);
-  g_return_val_if_fail (input_tex != 0, FALSE);
-  g_return_val_if_fail (fbo != 0, FALSE);
-  g_return_val_if_fail (texture_fbo != 0, FALSE);
-  g_return_val_if_fail (cb != NULL, FALSE);
-
-  gl = frame->context->gl_vtable;
-
-  GST_TRACE ("Binding v1 FBO %u dimensions:%ux%u with texture:%u "
-      "dimensions:%ux%u", fbo, texture_fbo_width,
-      texture_fbo_height, texture_fbo, input_tex_width, input_tex_height);
-
-  gl->BindFramebuffer (GL_FRAMEBUFFER, fbo);
-
-  /*setup a texture to render to */
-  gl->BindTexture (GL_TEXTURE_2D, texture_fbo);
-
-  /* attach the texture to the FBO to renderer to */
-  gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-      GL_TEXTURE_2D, texture_fbo, 0);
-
-  gst_gl_context_clear_shader (frame->context);
-
-#if GST_GL_HAVE_OPENGL
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
-    gl->PushAttrib (GL_VIEWPORT_BIT);
-    gl->MatrixMode (GL_PROJECTION);
-    gl->PushMatrix ();
-    gl->LoadIdentity ();
-
-    switch (projection) {
-      case GST_GL_DISPLAY_PROJECTION_ORTHO2D:
-        gluOrtho2D (proj_param1, proj_param2, proj_param3, proj_param4);
-        break;
-      case GST_GL_DISPLAY_PROJECTION_PERSPECTIVE:
-        gluPerspective (proj_param1, proj_param2, proj_param3, proj_param4);
-        break;
-      default:
-        gst_gl_context_set_error (frame->context, "Unknow fbo projection %d",
-            projection);
-    }
-
-    gl->MatrixMode (GL_MODELVIEW);
-    gl->PushMatrix ();
-    gl->LoadIdentity ();
-  }
-#endif
-#if GST_GL_HAVE_GLES2
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_GLES2)
-    gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
-#endif
-
-  gl->Viewport (0, 0, texture_fbo_width, texture_fbo_height);
-
-#if GST_GL_HAVE_OPENGL
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
-    const GLenum rt[] = { GL_COLOR_ATTACHMENT0 };
-    gl->DrawBuffers (1, rt);
-  }
-#endif
-
-  gl->ClearColor (0.0, 0.0, 0.0, 0.0);
-  gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-  cb (input_tex_width, input_tex_height, input_tex, stuff);
-
-#if GST_GL_HAVE_OPENGL
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
-    const GLenum rt[] = { GL_NONE };
-    gl->DrawBuffers (1, rt);
-    gl->MatrixMode (GL_PROJECTION);
-    gl->PopMatrix ();
-    gl->MatrixMode (GL_MODELVIEW);
-    gl->PopMatrix ();
-    gl->PopAttrib ();
-  }
-#endif
-#if GST_GL_HAVE_GLES2
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_GLES2) {
-    gl->Viewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
-        viewport_dim[3]);
-  }
-#endif
-
-  gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
-
-  return TRUE;
-}
-
-gboolean
 gst_gl_framebuffer_use_v2 (GstGLFramebuffer * frame, gint texture_fbo_width,
     gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
     GLuint texture_fbo, GLCB_V2 cb, gpointer stuff)
@@ -299,7 +197,8 @@
 
   gl->Viewport (0, 0, texture_fbo_width, texture_fbo_height);
 
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL)
+  if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
+          GST_GL_API_OPENGL3))
     gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
 
   gl->ClearColor (0.0, 0.0, 0.0, 0.0);
@@ -308,7 +207,8 @@
   /* the opengl scene */
   cb (stuff);
 
-  if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL)
+  if (gst_gl_context_get_gl_api (frame->context) & (GST_GL_API_OPENGL |
+          GST_GL_API_OPENGL3))
     gl->DrawBuffer (GL_NONE);
 
   gl->Viewport (viewport_dim[0], viewport_dim[1],
diff --git a/gst-libs/gst/gl/gstglframebuffer.h b/gst-libs/gst/gl/gstglframebuffer.h
index 7f1f261..1fc9222 100644
--- a/gst-libs/gst/gl/gstglframebuffer.h
+++ b/gst-libs/gst/gl/gstglframebuffer.h
@@ -58,13 +58,6 @@
 gboolean gst_gl_framebuffer_generate (GstGLFramebuffer *frame, gint width, gint height,
     guint * fbo, guint * depthbuffer);
 
-gboolean gst_gl_framebuffer_use (GstGLFramebuffer * frame, gint texture_fbo_width,
-    gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
-    GLuint texture_fbo, GLCB cb, gint input_tex_width,
-    gint input_tex_height, GLuint input_tex, gdouble proj_param1,
-    gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
-    GstGLDisplayProjection projection, gpointer stuff);
-
 gboolean gst_gl_framebuffer_use_v2 (GstGLFramebuffer * frame, gint texture_fbo_width,
     gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
     GLuint texture_fbo, GLCB_V2 cb, gpointer stuff);
diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c
index 87d57cb..397d216 100644
--- a/gst-libs/gst/gl/gstglmemory.c
+++ b/gst-libs/gst/gl/gstglmemory.c
@@ -27,6 +27,7 @@
 #include <gst/video/video.h>
 
 #include "gstglmemory.h"
+#include "gstglutils.h"
 
 /**
  * SECTION:gstglmemory
@@ -48,8 +49,20 @@
 #define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
 #define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
 
+#define GL_MEM_WIDTH(gl_mem) _get_plane_width (&gl_mem->info, gl_mem->plane)
+#define GL_MEM_HEIGHT(gl_mem) _get_plane_height (&gl_mem->info, gl_mem->plane)
+#define GL_MEM_STRIDE(gl_mem) GST_VIDEO_INFO_PLANE_STRIDE (&gl_mem->info, gl_mem->plane)
+
+#define CONTEXT_SUPPORTS_PBO_UPLOAD(context) \
+    (gst_gl_context_check_gl_version (context, \
+        GST_GL_API_OPENGL | GST_GL_API_OPENGL3, 2, 1) \
+        || gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
+#define CONTEXT_SUPPORTS_PBO_DOWNLOAD(context) \
+    (gst_gl_context_check_gl_version (context, \
+        GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2, 3, 0))
+
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
-#define GST_CAT_DEFUALT GST_CAT_GL_MEMORY
+#define GST_CAT_DEFAULT GST_CAT_GL_MEMORY
 
 static GstAllocator *_gl_allocator;
 
@@ -72,12 +85,24 @@
 #ifndef GL_PIXEL_UNPACK_BUFFER
 #define GL_PIXEL_UNPACK_BUFFER 0x88EC
 #endif
+#ifndef GL_STREAM_READ
+#define GL_STREAM_READ 0x88E1
+#endif
+#ifndef GL_STREAM_DRAW
+#define GL_STREAM_DRAW 0x88E0
+#endif
 #ifndef GL_STREAM_COPY
 #define GL_STREAM_COPY 0x88E2
 #endif
 #ifndef GL_UNPACK_ROW_LENGTH
 #define GL_UNPACK_ROW_LENGTH 0x0CF2
 #endif
+#ifndef GL_MAP_READ_BIT
+#define GL_MAP_READ_BIT 0x0001
+#endif
+#ifndef GL_MAP_WRITE_BIT
+#define GL_MAP_WRITE_BIT 0x0002
+#endif
 
 typedef struct
 {
@@ -87,6 +112,7 @@
   guint out_width, out_height;
   guint out_stride;
   gboolean respecify;
+  guint tex_target;
   /* inout */
   guint tex_id;
   /* out */
@@ -198,7 +224,9 @@
 #else
   gboolean texture_rg =
       gst_gl_context_check_feature (context, "GL_EXT_texture_rg")
-      || gst_gl_context_check_feature (context, "GL_ARB_texture_rg");
+      || gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0)
+      || gst_gl_context_check_feature (context, "GL_ARB_texture_rg")
+      || gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 0);
 #endif
   guint n_plane_components;
 
@@ -218,6 +246,9 @@
     case GST_VIDEO_FORMAT_BGR:
       n_plane_components = 3;
       break;
+    case GST_VIDEO_FORMAT_RGB16:
+    case GST_VIDEO_FORMAT_BGR16:
+      return GST_VIDEO_GL_TEXTURE_TYPE_RGB16;
     case GST_VIDEO_FORMAT_GRAY16_BE:
     case GST_VIDEO_FORMAT_GRAY16_LE:
     case GST_VIDEO_FORMAT_YUY2:
@@ -266,8 +297,12 @@
 }
 
 static inline GLenum
-_sized_gl_format_from_gl_format_type (GLenum format, GLenum type)
+_sized_gl_format_from_gl_format_type (GstGLContext * context, GLenum format,
+    GLenum type)
 {
+  gboolean ext_texture_rg =
+      gst_gl_context_check_feature (context, "GL_EXT_texture_rg");
+
   switch (format) {
     case GL_RGBA:
       switch (type) {
@@ -289,6 +324,8 @@
     case GL_RG:
       switch (type) {
         case GL_UNSIGNED_BYTE:
+          if (ext_texture_rg)
+            return GL_RG;
           return GL_RG8;
           break;
       }
@@ -296,6 +333,8 @@
     case GL_RED:
       switch (type) {
         case GL_UNSIGNED_BYTE:
+          if (ext_texture_rg)
+            return GL_RED;
           return GL_R8;
           break;
       }
@@ -344,6 +383,7 @@
 typedef struct _GenTexture
 {
   guint width, height;
+  GLenum gl_target;
   GLenum gl_format;
   GLenum gl_type;
   guint result;
@@ -355,31 +395,53 @@
   const GstGLFuncs *gl = context->gl_vtable;
   GLenum internal_format;
 
-  GST_CAT_TRACE (GST_CAT_GL_MEMORY,
-      "Generating texture format:%u type:%u dimensions:%ux%u", data->gl_format,
-      data->gl_type, data->width, data->height);
+  GST_TRACE ("Generating texture format:%u type:%u dimensions:%ux%u",
+      data->gl_format, data->gl_type, data->width, data->height);
 
   internal_format =
-      _sized_gl_format_from_gl_format_type (data->gl_format, data->gl_type);
+      _sized_gl_format_from_gl_format_type (context, data->gl_format,
+      data->gl_type);
 
   gl->GenTextures (1, &data->result);
-  gl->BindTexture (GL_TEXTURE_2D, data->result);
-  gl->TexImage2D (GL_TEXTURE_2D, 0, internal_format, data->width,
+  gl->BindTexture (data->gl_target, data->result);
+  gl->TexImage2D (data->gl_target, 0, internal_format, data->width,
       data->height, 0, data->gl_format, data->gl_type, NULL);
 
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+  gl->TexParameteri (data->gl_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+  gl->TexParameteri (data->gl_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+  gl->TexParameteri (data->gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+  gl->TexParameteri (data->gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
-  GST_CAT_LOG (GST_CAT_GL_MEMORY, "generated texture id:%d", data->result);
+  GST_LOG ("generated texture id:%d", data->result);
+}
+
+/* find the difference between the start of the plane and where the video
+ * data starts in the plane */
+static gsize
+_find_plane_frame_start (GstGLMemory * gl_mem)
+{
+  gsize plane_start;
+  gint i;
+
+  /* find the start of the plane data including padding */
+  plane_start = 0;
+  for (i = 0; i < gl_mem->plane; i++) {
+    plane_start +=
+        gst_gl_get_plane_data_size (&gl_mem->info, &gl_mem->valign, i);
+  }
+
+  /* offset between the plane data start and where the video frame starts */
+  return (GST_VIDEO_INFO_PLANE_OFFSET (&gl_mem->info,
+          gl_mem->plane)) - plane_start + gl_mem->mem.offset;
 }
 
 static void
 _upload_memory (GstGLContext * context, GstGLMemory * gl_mem)
 {
   const GstGLFuncs *gl;
-  GLenum gl_format, gl_type;
+  GLenum gl_format, gl_type, gl_target;
+  gpointer data;
+  gsize plane_start;
 
   if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
     return;
@@ -392,19 +454,35 @@
     gl_type = GL_UNSIGNED_SHORT_5_6_5;
 
   gl_format = _gst_gl_format_from_gl_texture_type (gl_mem->tex_type);
+  gl_target = gl_mem->tex_target;
 
-  if (USING_OPENGL (context) || USING_GLES3 (context)) {
+  if (USING_OPENGL (context) || USING_GLES3 (context)
+      || USING_OPENGL3 (context)) {
     gl->PixelStorei (GL_UNPACK_ROW_LENGTH, gl_mem->unpack_length);
   } else if (USING_GLES2 (context)) {
     gl->PixelStorei (GL_UNPACK_ALIGNMENT, gl_mem->unpack_length);
   }
 
-  GST_CAT_LOG (GST_CAT_GL_MEMORY, "upload for texture id:%u, %ux%u",
-      gl_mem->tex_id, gl_mem->width, gl_mem->height);
+  GST_LOG ("upload for texture id:%u, with pbo %u %ux%u",
+      gl_mem->tex_id, gl_mem->transfer_pbo, gl_mem->tex_width,
+      GL_MEM_HEIGHT (gl_mem));
 
-  gl->BindTexture (GL_TEXTURE_2D, gl_mem->tex_id);
-  gl->TexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, gl_mem->width, gl_mem->height,
-      gl_format, gl_type, gl_mem->data);
+  /* find the start of the plane data including padding */
+  plane_start = _find_plane_frame_start (gl_mem);
+
+  if (gl_mem->transfer_pbo && CONTEXT_SUPPORTS_PBO_UPLOAD (context)) {
+    gl->BindBuffer (GL_PIXEL_UNPACK_BUFFER, gl_mem->transfer_pbo);
+    data = (void *) plane_start;
+  } else {
+    data = (gpointer) ((gintptr) plane_start + (gintptr) gl_mem->data);
+  }
+
+  gl->BindTexture (gl_target, gl_mem->tex_id);
+  gl->TexSubImage2D (gl_target, 0, 0, 0, gl_mem->tex_width,
+      GL_MEM_HEIGHT (gl_mem), gl_format, gl_type, data);
+
+  if (gl_mem->transfer_pbo && CONTEXT_SUPPORTS_PBO_UPLOAD (context))
+    gl->BindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
 
   /* Reset to default values */
   if (USING_OPENGL (context) || USING_GLES3 (context)) {
@@ -413,7 +491,7 @@
     gl->PixelStorei (GL_UNPACK_ALIGNMENT, 4);
   }
 
-  gl->BindTexture (GL_TEXTURE_2D, 0);
+  gl->BindTexture (gl_target, 0);
 
   GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
 }
@@ -426,28 +504,31 @@
   gl_mem->tex_scaling[0] = 1.0f;
   gl_mem->tex_scaling[1] = 1.0f;
   gl_mem->unpack_length = 1;
+  gl_mem->tex_width = GL_MEM_WIDTH (gl_mem);
 
   n_gl_bytes = _gl_texture_type_n_bytes (gl_mem->tex_type);
   if (n_gl_bytes == 0) {
-    GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Unsupported texture type %d",
-        gl_mem->tex_type);
+    GST_ERROR ("Unsupported texture type %d", gl_mem->tex_type);
     return;
   }
 
-  if (USING_OPENGL (gl_mem->context) || USING_GLES3 (gl_mem->context)) {
-    gl_mem->unpack_length = gl_mem->stride / n_gl_bytes;
+  if (USING_OPENGL (gl_mem->context) || USING_GLES3 (gl_mem->context)
+      || USING_OPENGL3 (gl_mem->context)) {
+    gl_mem->unpack_length = GL_MEM_STRIDE (gl_mem) / n_gl_bytes;
   } else if (USING_GLES2 (gl_mem->context)) {
     guint j = 8;
 
     while (j >= n_gl_bytes) {
-      /* GST_ROUND_UP_j(gl_mem->width * n_gl_bytes) */
-      guint round_up_j = ((gl_mem->width * n_gl_bytes) + j - 1) & ~(j - 1);
+      /* GST_ROUND_UP_j(GL_MEM_WIDTH (gl_mem) * n_gl_bytes) */
+      guint round_up_j =
+          ((GL_MEM_WIDTH (gl_mem) * n_gl_bytes) + j - 1) & ~(j - 1);
 
-      if (round_up_j == gl_mem->stride) {
-        GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based on width "
+      if (round_up_j == GL_MEM_STRIDE (gl_mem)) {
+        GST_LOG ("Found alignment of %u based on width "
             "(with plane width:%u, plane stride:%u and pixel stride:%u. "
-            "RU%u(%u*%u) = %u)", j, gl_mem->width, gl_mem->stride, n_gl_bytes,
-            j, gl_mem->width, n_gl_bytes, round_up_j);
+            "RU%u(%u*%u) = %u)", j, GL_MEM_WIDTH (gl_mem),
+            GL_MEM_STRIDE (gl_mem), n_gl_bytes, j, GL_MEM_WIDTH (gl_mem),
+            n_gl_bytes, round_up_j);
 
         gl_mem->unpack_length = j;
         break;
@@ -462,35 +543,94 @@
       j = 8;
 
       while (j >= n_gl_bytes) {
-        /* GST_ROUND_UP_j(gl_mem->stride) */
-        guint round_up_j = ((gl_mem->stride) + j - 1) & ~(j - 1);
+        /* GST_ROUND_UP_j((GL_MEM_STRIDE (gl_mem)) */
+        guint round_up_j = ((GL_MEM_STRIDE (gl_mem)) + j - 1) & ~(j - 1);
 
-        if (round_up_j == gl_mem->stride) {
-          GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based on "
+        if (round_up_j == (GL_MEM_STRIDE (gl_mem))) {
+          GST_LOG ("Found alignment of %u based on "
               "stride (with plane stride:%u and pixel stride:%u. "
-              "RU%u(%u) = %u)", j, gl_mem->stride, n_gl_bytes, j,
-              gl_mem->stride, round_up_j);
+              "RU%u(%u) = %u)", j, GL_MEM_STRIDE (gl_mem), n_gl_bytes, j,
+              GL_MEM_STRIDE (gl_mem), round_up_j);
 
           gl_mem->unpack_length = j;
           gl_mem->tex_scaling[0] =
-              (gfloat) (gl_mem->width * n_gl_bytes) / (gfloat) gl_mem->stride;
-          gl_mem->width = gl_mem->stride / n_gl_bytes;
+              (gfloat) (GL_MEM_WIDTH (gl_mem) * n_gl_bytes) /
+              (gfloat) GL_MEM_STRIDE (gl_mem);
+          gl_mem->tex_width = GL_MEM_STRIDE (gl_mem) / n_gl_bytes;
           break;
         }
         j >>= 1;
       }
 
       if (j < n_gl_bytes) {
-        GST_CAT_ERROR
-            (GST_CAT_GL_MEMORY, "Failed to find matching alignment. Image may "
+        GST_ERROR
+            ("Failed to find matching alignment. Image may "
             "look corrupted. plane width:%u, plane stride:%u and pixel "
-            "stride:%u", gl_mem->width, gl_mem->stride, n_gl_bytes);
+            "stride:%u", GL_MEM_WIDTH (gl_mem), GL_MEM_STRIDE (gl_mem),
+            n_gl_bytes);
       }
     }
   }
 }
 
 static void
+_transfer_download (GstGLContext * context, GstGLMemory * gl_mem)
+{
+  const GstGLFuncs *gl;
+  gsize plane_start;
+  gsize size;
+  guint format, type;
+  guint fboId;
+
+  if (!CONTEXT_SUPPORTS_PBO_DOWNLOAD (context)
+      || gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
+      || gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA)
+    /* not supported */
+    return;
+
+  gl = context->gl_vtable;
+
+  if (!gl_mem->transfer_pbo)
+    gl->GenBuffers (1, &gl_mem->transfer_pbo);
+
+  GST_DEBUG ("downloading texture %u using pbo %u",
+      gl_mem->tex_id, gl_mem->transfer_pbo);
+
+  size = gst_gl_get_plane_data_size (&gl_mem->info, &gl_mem->valign,
+      gl_mem->plane);
+  plane_start = _find_plane_frame_start (gl_mem);
+  format = _gst_gl_format_from_gl_texture_type (gl_mem->tex_type);
+  type = GL_UNSIGNED_BYTE;
+  if (gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
+    type = GL_UNSIGNED_SHORT_5_6_5;
+
+  gl->BindBuffer (GL_PIXEL_PACK_BUFFER, gl_mem->transfer_pbo);
+  gl->BufferData (GL_PIXEL_PACK_BUFFER, size, NULL, GL_STREAM_READ);
+
+  /* FIXME: try and avoid creating and destroying fbo's every download... */
+  /* create a framebuffer object */
+  gl->GenFramebuffers (1, &fboId);
+  gl->BindFramebuffer (GL_FRAMEBUFFER, fboId);
+
+  gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+      GL_TEXTURE_2D, gl_mem->tex_id, 0);
+
+  if (!gst_gl_context_check_framebuffer_status (context)) {
+    GST_ERROR ("failed to download texture");
+    goto fbo_error;
+  }
+
+  gl->ReadPixels (0, 0, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem), format,
+      type, (void *) plane_start);
+
+fbo_error:
+  gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
+  gl->DeleteFramebuffers (1, &fboId);
+
+  gl->BindBuffer (GL_PIXEL_PACK_BUFFER, 0);
+}
+
+static void
 _download_memory (GstGLContext * context, GstGLMemory * gl_mem)
 {
   const GstGLFuncs *gl;
@@ -517,28 +657,51 @@
     goto error;
   }
 
-  GST_CAT_LOG (GST_CAT_GL_MEMORY, "downloading memory %p, tex %u into %p",
+  GST_LOG ("downloading memory %p, tex %u into %p",
       gl_mem, gl_mem->tex_id, gl_mem->data);
 
   if (gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
       || gl_mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA) {
-    gl->BindTexture (GL_TEXTURE_2D, gl_mem->tex_id);
-    gl->GetTexImage (GL_TEXTURE_2D, 0, format, type, gl_mem->data);
-    gl->BindTexture (GL_TEXTURE_2D, 0);
+    gl->BindTexture (gl_mem->tex_target, gl_mem->tex_id);
+    gl->GetTexImage (gl_mem->tex_target, 0, format, type, gl_mem->data);
+    gl->BindTexture (gl_mem->tex_target, 0);
+  } else if (gl_mem->transfer_pbo && CONTEXT_SUPPORTS_PBO_DOWNLOAD (context)) {
+    gsize size, plane_start;
+    gpointer map_data = NULL;
+
+    size = gst_gl_get_plane_data_size (&gl_mem->info, &gl_mem->valign,
+        gl_mem->plane);
+
+    gl->BindBuffer (GL_PIXEL_PACK_BUFFER, gl_mem->transfer_pbo);
+    map_data =
+        gl->MapBufferRange (GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT);
+    if (!map_data) {
+      GST_WARNING ("error mapping buffer for download");
+      gl->BindBuffer (GL_PIXEL_PACK_BUFFER, 0);
+      goto read_pixels;
+    }
+
+    /* FIXME: COPY! use glMapBuffer + glSync everywhere to remove this */
+    plane_start = _find_plane_frame_start (gl_mem);
+    memcpy ((guint8 *) gl_mem->data + plane_start, map_data, size);
+
+    gl->UnmapBuffer (GL_PIXEL_PACK_BUFFER);
+    gl->BindBuffer (GL_PIXEL_PACK_BUFFER, 0);
   } else {
+  read_pixels:
     /* FIXME: try and avoid creating and destroying fbo's every download... */
     /* create a framebuffer object */
     gl->GenFramebuffers (1, &fboId);
     gl->BindFramebuffer (GL_FRAMEBUFFER, fboId);
 
     gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-        GL_TEXTURE_2D, gl_mem->tex_id, 0);
+        gl_mem->tex_target, gl_mem->tex_id, 0);
 
     if (!gst_gl_context_check_framebuffer_status (context))
       goto fbo_error;
 
-    gl->ReadPixels (0, 0, gl_mem->width, gl_mem->height, format, type,
-        gl_mem->data);
+    gl->ReadPixels (0, 0, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem), format,
+        type, gl_mem->data);
 
     gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
 
@@ -552,60 +715,110 @@
 
 static void
 _gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
-    GstGLContext * context, GstVideoGLTextureType tex_type, gint width,
-    gint height, gint stride, gpointer user_data, GDestroyNotify notify)
+    GstGLContext * context, GstAllocationParams * params, GstVideoInfo * info,
+    GstVideoAlignment * valign, guint plane, gpointer user_data,
+    GDestroyNotify notify)
 {
-  gsize maxsize;
+  gsize size, maxsize;
+  gsize align = gst_memory_alignment, offset = 0;
 
-  maxsize = stride * height;
+  g_return_if_fail (plane < GST_VIDEO_INFO_N_PLANES (info));
 
-  gst_memory_init (GST_MEMORY_CAST (mem), GST_MEMORY_FLAG_NO_SHARE,
-      allocator, parent, maxsize, 0, 0, maxsize);
+  mem->info = *info;
+  if (valign)
+    mem->valign = *valign;
+  else
+    gst_video_alignment_reset (&mem->valign);
+
+  size = maxsize = gst_gl_get_plane_data_size (info, valign, plane);
+
+  if (params) {
+    align |= params->align;
+    offset = params->prefix;
+    maxsize += params->prefix + params->padding + align;
+  }
+
+  gst_memory_init (GST_MEMORY_CAST (mem), 0, allocator, parent, maxsize, align,
+      offset, size);
 
   mem->context = gst_object_ref (context);
-  mem->tex_type = tex_type;
-  mem->width = width;
-  mem->height = height;
-  mem->stride = stride;
+  mem->tex_type =
+      gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (info),
+      plane);
+  /* we always operate on 2D textures unless we're dealing with wrapped textures */
+  mem->tex_target = GL_TEXTURE_2D;
+  mem->plane = plane;
   mem->notify = notify;
   mem->user_data = user_data;
-  mem->data_wrapped = FALSE;
   mem->texture_wrapped = FALSE;
 
+  g_mutex_init (&mem->lock);
+
   _calculate_unpack_length (mem);
 
-  GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture memory:%p format:%u "
-      "dimensions:%ux%u", mem, tex_type, width, height);
+  GST_DEBUG ("new GL texture context:%" GST_PTR_FORMAT " memory:%p format:%u "
+      "dimensions:%ux%u stride:%u size:%" G_GSIZE_FORMAT, context, mem,
+      mem->tex_type, mem->tex_width, GL_MEM_HEIGHT (mem), GL_MEM_STRIDE (mem),
+      maxsize);
 }
 
 static GstGLMemory *
 _gl_mem_new (GstAllocator * allocator, GstMemory * parent,
-    GstGLContext * context, GstVideoGLTextureType tex_type, gint width,
-    gint height, gint stride, gpointer user_data, GDestroyNotify notify)
+    GstGLContext * context, GstAllocationParams * params, GstVideoInfo * info,
+    GstVideoAlignment * valign, guint plane, gpointer user_data,
+    GDestroyNotify notify)
 {
   GstGLMemory *mem;
   GenTexture data = { 0, };
   mem = g_slice_new0 (GstGLMemory);
-  _gl_mem_init (mem, allocator, parent, context, tex_type, width, height,
-      stride, user_data, notify);
+  _gl_mem_init (mem, allocator, parent, context, params, info, valign, plane,
+      user_data, notify);
 
-  data.width = mem->width;
-  data.height = mem->height;
-  data.gl_format = _gst_gl_format_from_gl_texture_type (tex_type);
+  data.width = mem->tex_width;
+  data.height = GL_MEM_HEIGHT (mem);
+  data.gl_format = _gst_gl_format_from_gl_texture_type (mem->tex_type);
   data.gl_type = GL_UNSIGNED_BYTE;
-  if (tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
+  data.gl_target = mem->tex_target;
+  if (mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
     data.gl_type = GL_UNSIGNED_SHORT_5_6_5;
 
   gst_gl_context_thread_add (context,
       (GstGLContextThreadFunc) _generate_texture, &data);
   if (!data.result) {
-    GST_CAT_WARNING (GST_CAT_GL_MEMORY,
-        "Could not create GL texture with context:%p", context);
+    GST_WARNING ("Could not create GL texture with context:%" GST_PTR_FORMAT,
+        context);
   }
 
-  GST_CAT_TRACE (GST_CAT_GL_MEMORY, "created texture %u", data.result);
+  GST_TRACE ("created texture %u", data.result);
 
   mem->tex_id = data.result;
+  mem->tex_target = data.gl_target;
+
+  return mem;
+}
+
+static GstGLMemory *
+_gl_mem_alloc_data (GstGLMemory * mem)
+{
+  guint8 *data;
+  gsize align, aoffset;
+
+  data = g_try_malloc (mem->mem.maxsize);
+  mem->alloc_data = mem->data = data;
+
+  if (data == NULL) {
+    gst_memory_unref ((GstMemory *) mem);
+    return NULL;
+  }
+
+  /* do alignment */
+  align = mem->mem.align;
+  if ((aoffset = ((guintptr) data & align))) {
+    aoffset = (align + 1) - aoffset;
+    data += aoffset;
+    mem->mem.maxsize -= aoffset;
+    mem->data = data;
+  }
 
   return mem;
 }
@@ -617,58 +830,75 @@
 
   g_return_val_if_fail (maxsize == gl_mem->mem.maxsize, NULL);
 
+  g_mutex_lock (&gl_mem->lock);
+
   if ((flags & GST_MAP_GL) == GST_MAP_GL) {
     if ((flags & GST_MAP_READ) == GST_MAP_READ) {
-      GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for reading",
-          gl_mem->tex_id);
+      GST_TRACE ("mapping GL texture:%u for reading", gl_mem->tex_id);
       if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
         gst_gl_context_thread_add (gl_mem->context,
             (GstGLContextThreadFunc) _upload_memory, gl_mem);
         GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
       }
-    } else {
-      GST_CAT_TRACE (GST_CAT_GL_MEMORY, "mapping GL texture:%u for writing",
-          gl_mem->tex_id);
+    }
+
+    if ((flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
+      GST_TRACE ("mapping GL texture:%u for writing", gl_mem->tex_id);
+      GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
+      GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
     }
 
     data = &gl_mem->tex_id;
   } else {                      /* not GL */
     if ((flags & GST_MAP_READ) == GST_MAP_READ) {
-      GST_CAT_TRACE (GST_CAT_GL_MEMORY,
-          "mapping GL texture:%u for reading from system memory",
+      GST_TRACE ("mapping GL texture:%u for reading from system memory",
           gl_mem->tex_id);
       if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD)) {
         gst_gl_context_thread_add (gl_mem->context,
             (GstGLContextThreadFunc) _download_memory, gl_mem);
         GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
       }
-    } else {
-      GST_CAT_TRACE (GST_CAT_GL_MEMORY,
-          "mapping GL texture:%u for writing to system memory", gl_mem->tex_id);
+    }
+
+    if ((flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
+      GST_TRACE ("mapping GL texture:%u for writing to system memory",
+          gl_mem->tex_id);
+      GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
+      GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
     }
 
     data = gl_mem->data;
   }
 
-  gl_mem->map_flags = flags;
+  /* only store the first map flags, subsequent maps must be a subset of this */
+  if (gl_mem->map_count++ == 0)
+    gl_mem->map_flags = flags;
+
+  g_mutex_unlock (&gl_mem->lock);
 
   return data;
 }
 
+void
+gst_gl_memory_download_transfer (GstGLMemory * gl_mem)
+{
+  g_mutex_lock (&gl_mem->lock);
+
+  gst_gl_context_thread_add (gl_mem->context,
+      (GstGLContextThreadFunc) _transfer_download, gl_mem);
+
+  g_mutex_unlock (&gl_mem->lock);
+}
+
 static void
 _gl_mem_unmap (GstGLMemory * gl_mem)
 {
-  if ((gl_mem->map_flags & GST_MAP_WRITE) == GST_MAP_WRITE) {
-    if ((gl_mem->map_flags & GST_MAP_GL) == GST_MAP_GL) {
-      GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
-      GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
-    } else {
-      GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
-      GST_GL_MEMORY_FLAG_UNSET (gl_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
-    }
-  }
+  g_mutex_lock (&gl_mem->lock);
 
-  gl_mem->map_flags = 0;
+  if (--gl_mem->map_count <= 0)
+    gl_mem->map_flags = 0;
+
+  g_mutex_unlock (&gl_mem->lock);
 }
 
 static void
@@ -678,6 +908,7 @@
   GstGLMemoryCopyParams *copy_params;
   GstGLMemory *src;
   guint tex_id;
+  GLuint out_tex_target;
   GLuint fboId;
   gsize out_width, out_height, out_stride;
   GLuint out_gl_format, out_gl_type;
@@ -687,6 +918,7 @@
   copy_params = (GstGLMemoryCopyParams *) data;
   src = copy_params->src;
   tex_id = copy_params->tex_id;
+  out_tex_target = copy_params->tex_target;
   out_width = copy_params->out_width;
   out_height = copy_params->out_height;
   out_stride = copy_params->out_stride;
@@ -707,7 +939,7 @@
     goto error;
   }
 
-  in_size = src->height * src->stride;
+  in_size = GL_MEM_HEIGHT (src) * GL_MEM_STRIDE (src);
   out_size = out_height * out_stride;
 
   if (copy_params->respecify) {
@@ -723,6 +955,7 @@
     GenTexture data = { 0, };
     data.width = copy_params->out_width;
     data.height = copy_params->out_height;
+    data.gl_target = out_tex_target;
     data.gl_format = out_gl_format;
     data.gl_type = GL_UNSIGNED_BYTE;
     if (copy_params->out_format == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
@@ -733,11 +966,10 @@
   }
 
   if (!tex_id) {
-    GST_CAT_WARNING (GST_CAT_GL_MEMORY,
-        "Could not create GL texture with context:%p", src->context);
+    GST_WARNING ("Could not create GL texture with context:%p", src->context);
   }
 
-  GST_CAT_LOG (GST_CAT_GL_MEMORY, "copying memory %p, tex %u into texture %i",
+  GST_LOG ("copying memory %p, tex %u into texture %i",
       src, src->tex_id, tex_id);
 
   /* FIXME: try and avoid creating and destroying fbo's every copy... */
@@ -746,17 +978,17 @@
   gl->BindFramebuffer (GL_FRAMEBUFFER, fboId);
 
   gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-      GL_TEXTURE_2D, src->tex_id, 0);
+      src->tex_target, src->tex_id, 0);
 
 //  if (!gst_gl_context_check_framebuffer_status (src->context))
 //    goto fbo_error;
 
-  gl->BindTexture (GL_TEXTURE_2D, tex_id);
+  gl->BindTexture (out_tex_target, tex_id);
   if (copy_params->respecify) {
     if (!gl->GenBuffers) {
       gst_gl_context_set_error (context, "Cannot reinterpret texture contents "
           "without buffer objects");
-      gl->BindTexture (GL_TEXTURE_2D, 0);
+      gl->BindTexture (out_tex_target, 0);
       goto fbo_error;
     }
 
@@ -764,7 +996,7 @@
         && (in_gl_format != GL_RGBA || in_gl_type != GL_UNSIGNED_BYTE)) {
       gst_gl_context_set_error (context, "Cannot copy non RGBA/UNSIGNED_BYTE "
           "textures on GLES2");
-      gl->BindTexture (GL_TEXTURE_2D, 0);
+      gl->BindTexture (out_tex_target, 0);
       goto fbo_error;
     }
 
@@ -772,26 +1004,27 @@
       gl->GenBuffers (1, &src->pbo);
 
     GST_TRACE ("copying texture data with size of %u*%u*%u",
-        _gl_format_type_n_bytes (in_gl_format, in_gl_type), src->width,
-        src->height);
+        _gl_format_type_n_bytes (in_gl_format, in_gl_type), src->tex_width,
+        GL_MEM_HEIGHT (src));
 
     /* copy tex */
     gl->BindBuffer (GL_PIXEL_PACK_BUFFER, src->pbo);
     gl->BufferData (GL_PIXEL_PACK_BUFFER, in_size, NULL, GL_STREAM_COPY);
-    gl->ReadPixels (0, 0, src->width, src->height, in_gl_format, in_gl_type, 0);
+    gl->ReadPixels (0, 0, src->tex_width, GL_MEM_HEIGHT (src), in_gl_format,
+        in_gl_type, 0);
     gl->BindBuffer (GL_PIXEL_PACK_BUFFER, 0);
 
     gl->BindBuffer (GL_PIXEL_UNPACK_BUFFER, src->pbo);
-    gl->TexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, out_width, out_height,
+    gl->TexSubImage2D (out_tex_target, 0, 0, 0, out_width, out_height,
         out_gl_format, out_gl_type, 0);
 
     gl->BindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
   } else {                      /* different sizes */
-    gl->CopyTexImage2D (GL_TEXTURE_2D, 0, out_gl_format, 0, 0, out_width,
+    gl->CopyTexImage2D (out_tex_target, 0, out_gl_format, 0, 0, out_width,
         out_height, 0);
   }
 
-  gl->BindTexture (GL_TEXTURE_2D, 0);
+  gl->BindTexture (out_tex_target, 0);
   gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
 
   gl->DeleteFramebuffers (1, &fboId);
@@ -821,48 +1054,68 @@
 static GstMemory *
 _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
 {
-  GstGLMemory *dest;
+  GstGLAllocator *allocator = (GstGLAllocator *) src->mem.allocator;
+  GstMemory *ret = NULL;
 
-  if (GST_GL_MEMORY_FLAG_IS_SET (src, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
-    dest = _gl_mem_new (src->mem.allocator, NULL, src->context, src->tex_type,
-        src->width, src->height, src->stride, NULL, NULL);
-    dest->data = g_malloc (src->mem.maxsize);
-    memcpy (dest->data, src->data, src->mem.maxsize);
+  g_mutex_lock (&((GstGLMemory *) src)->lock);
+
+  /* If not doing a full copy, then copy to sysmem, the 2D represention of the
+   * texture would become wrong */
+  if (offset > 0 || size < src->mem.size) {
+    ret = allocator->fallback_mem_copy (&src->mem, offset, size);
+  } else if (GST_GL_MEMORY_FLAG_IS_SET (src, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
+    GstAllocationParams params = { 0, src->mem.align, 0, 0 };
+    GstGLMemory *dest;
+
+    dest = _gl_mem_new (src->mem.allocator, NULL, src->context, &params,
+        &src->info, &src->valign, src->plane, NULL, NULL);
+    dest = _gl_mem_alloc_data (dest);
+
+    if (dest == NULL) {
+      GST_WARNING ("Could not copy GL Memory");
+      gst_memory_unref ((GstMemory *) dest);
+      goto done;
+    }
+
+    memcpy (dest->data, (guint8 *) src->data + src->mem.offset, src->mem.size);
     GST_GL_MEMORY_FLAG_SET (dest, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
+    ret = (GstMemory *) dest;
   } else {
+    GstAllocationParams params = { 0, src->mem.align, 0, 0 };
     GstGLMemoryCopyParams copy_params;
+    GstGLMemory *dest;
 
     copy_params.src = src;
     copy_params.tex_id = 0;
     copy_params.out_format = src->tex_type;
-    copy_params.out_width = src->width;
-    copy_params.out_height = src->height;
-    copy_params.out_stride = src->height;
+    copy_params.tex_target = src->tex_target;
+    copy_params.out_width = src->tex_width;
+    copy_params.out_height = GL_MEM_HEIGHT (src);
+    copy_params.out_stride = GL_MEM_STRIDE (src);
     copy_params.respecify = FALSE;
 
     gst_gl_context_thread_add (src->context, _gl_mem_copy_thread, &copy_params);
 
-    dest = g_slice_new0 (GstGLMemory);
-    _gl_mem_init (dest, src->mem.allocator, NULL, src->context, src->tex_type,
-        src->width, src->height, src->stride, NULL, NULL);
-
     if (!copy_params.result) {
-      GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
-      gst_memory_unref ((GstMemory *) dest);
-      return NULL;
+      GST_WARNING ("Could not copy GL Memory");
+      goto done;
     }
 
+    dest = g_slice_new0 (GstGLMemory);
+    _gl_mem_init (dest, src->mem.allocator, NULL, src->context, &params,
+        &src->info, &src->valign, src->plane, NULL, NULL);
+
     dest->tex_id = copy_params.tex_id;
-    dest->data = g_malloc (src->mem.maxsize);
-    if (dest->data == NULL) {
-      GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
-      gst_memory_unref ((GstMemory *) dest);
-      return NULL;
-    }
+    dest->tex_target = copy_params.tex_target;
+    dest = _gl_mem_alloc_data (dest);
     GST_GL_MEMORY_FLAG_SET (dest, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
+    ret = (GstMemory *) dest;
   }
 
-  return (GstMemory *) dest;
+done:
+  g_mutex_unlock (&((GstGLMemory *) src)->lock);
+
+  return ret;
 }
 
 static GstMemory *
@@ -897,6 +1150,8 @@
 
   if (gl_mem->pbo)
     gl->DeleteBuffers (1, &gl_mem->pbo);
+  if (gl_mem->transfer_pbo)
+    gl->DeleteBuffers (1, &gl_mem->transfer_pbo);
 }
 
 static void
@@ -904,17 +1159,22 @@
 {
   GstGLMemory *gl_mem = (GstGLMemory *) mem;
 
+  GST_TRACE ("freeing texture %u", gl_mem->tex_id);
+
   gst_gl_context_thread_add (gl_mem->context,
       (GstGLContextThreadFunc) _destroy_gl_objects, gl_mem);
 
   if (gl_mem->notify)
     gl_mem->notify (gl_mem->user_data);
 
-  if (gl_mem->data && !gl_mem->data_wrapped) {
-    g_free (gl_mem->data);
+  if (gl_mem->alloc_data) {
+    g_free (gl_mem->alloc_data);
+    gl_mem->alloc_data = NULL;
     gl_mem->data = NULL;
   }
 
+  g_mutex_clear (&gl_mem->lock);
+
   gst_object_unref (gl_mem->context);
   g_slice_free (GstGLMemory, gl_mem);
 }
@@ -953,6 +1213,7 @@
   GstGLMemoryCopyParams copy_params;
 
   copy_params.src = gl_mem;
+  copy_params.tex_target = gl_mem->tex_target;
   copy_params.tex_id = tex_id;
   copy_params.out_format = tex_type;
   copy_params.out_width = width;
@@ -966,26 +1227,37 @@
   return copy_params.result;
 }
 
+/**
+ * gst_gl_memory_wrapped_texture:
+ * @context: a #GstGLContext
+ * @texture_id: the GL texture handle
+ * @texture_target: the GL texture target
+ * @info: the #GstVideoInfo of the memory
+ * @plane: The plane this memory will represent
+ * @user_data: user data
+ * @notify: Destroy callback for the user data
+ *
+ * Wraps a texture handle into a #GstGLMemory.
+ *
+ * Returns: a newly allocated #GstGLMemory
+ */
 GstGLMemory *
-gst_gl_memory_wrapped_texture (GstGLContext * context, guint texture_id,
-    GstVideoGLTextureType tex_type, gint width, gint height, gpointer user_data,
-    GDestroyNotify notify)
+gst_gl_memory_wrapped_texture (GstGLContext * context,
+    guint texture_id, guint texture_target,
+    GstVideoInfo * info, guint plane, GstVideoAlignment * valign,
+    gpointer user_data, GDestroyNotify notify)
 {
   GstGLMemory *mem;
-  guint n_gl_bytes = _gl_texture_type_n_bytes (tex_type);
 
   mem = g_slice_new0 (GstGLMemory);
-  _gl_mem_init (mem, _gl_allocator, NULL, context, tex_type, width, height,
-      width * n_gl_bytes, NULL, NULL);
+  _gl_mem_init (mem, _gl_allocator, NULL, context, NULL, info, valign, plane,
+      user_data, notify);
 
   mem->tex_id = texture_id;
+  mem->tex_target = texture_target;
   mem->texture_wrapped = TRUE;
-  mem->data = g_malloc (mem->mem.maxsize);
-  if (mem->data == NULL) {
-    gst_memory_unref ((GstMemory *) mem);
-    return NULL;
-  }
 
+  mem = _gl_mem_alloc_data (mem);
   GST_GL_MEMORY_FLAG_SET (mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
 
   return mem;
@@ -994,58 +1266,78 @@
 /**
  * gst_gl_memory_alloc:
  * @context:a #GstGLContext
- * @v_info: the #GstVideoInfo of the memory
+ * @params: a #GstAllocationParams
+ * @info: the #GstVideoInfo of the memory
+ * @plane: the plane this memory will represent
+ * @valign: the #GstVideoAlignment applied to @info
  *
- * Returns: a #GstMemory object with a GL texture specified by @v_info
+ * Allocated a new #GstGlMemory.
+ *
+ * Returns: a #GstMemory object with a GL texture specified by @vinfo
  *          from @context
  */
 GstMemory *
-gst_gl_memory_alloc (GstGLContext * context, GstVideoGLTextureType tex_type,
-    gint width, gint height, gint stride)
+gst_gl_memory_alloc (GstGLContext * context, GstAllocationParams * params,
+    GstVideoInfo * info, guint plane, GstVideoAlignment * valign)
 {
   GstGLMemory *mem;
 
-  mem = _gl_mem_new (_gl_allocator, NULL, context, tex_type, width, height,
-      stride, NULL, NULL);
-
-  mem->data = g_malloc (mem->mem.maxsize);
-  if (mem->data == NULL) {
-    gst_memory_unref ((GstMemory *) mem);
-    return NULL;
-  }
+  mem = _gl_mem_new (_gl_allocator, NULL, context, params, info, valign, plane,
+      NULL, NULL);
+  mem = _gl_mem_alloc_data (mem);
 
   return (GstMemory *) mem;
 }
 
 /**
- * gst_gl_memory_wrapped
+ * gst_gl_memory_wrapped:
  * @context:a #GstGLContext
- * @v_info: the #GstVideoInfo of the memory and data
+ * @info: the #GstVideoInfo of the memory and data
+ * @plane: the plane this memory will represent
+ * @valign: the #GstVideoAlignment applied to @info
  * @data: the data to wrap
  * @user_data: data called with for @notify
  * @notify: function called with @user_data when @data needs to be freed
  * 
+ * Wrapped @data into a #GstGLMemory. This version will account for padding
+ * added to the allocation and expressed through @valign.
+ *
  * Returns: a #GstGLMemory object with a GL texture specified by @v_info
  *          from @context and contents specified by @data
  */
 GstGLMemory *
-gst_gl_memory_wrapped (GstGLContext * context, GstVideoGLTextureType tex_type,
-    gint width, gint height, gint stride, gpointer data, gpointer user_data,
+gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo * info,
+    guint plane, GstVideoAlignment * valign, gpointer data, gpointer user_data,
     GDestroyNotify notify)
 {
   GstGLMemory *mem;
 
-  mem = _gl_mem_new (_gl_allocator, NULL, context, tex_type, width, height,
-      stride, user_data, notify);
+  mem = _gl_mem_new (_gl_allocator, NULL, context, NULL, info, valign, plane,
+      user_data, notify);
 
   mem->data = data;
-  mem->data_wrapped = TRUE;
 
   GST_GL_MEMORY_FLAG_SET (mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
 
   return mem;
 }
 
+gint
+gst_gl_memory_get_texture_width (GstGLMemory * gl_mem)
+{
+  g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
+
+  return gl_mem->tex_width;
+}
+
+gint
+gst_gl_memory_get_texture_height (GstGLMemory * gl_mem)
+{
+  g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
+
+  return _get_plane_height (&gl_mem->info, gl_mem->plane);
+}
+
 G_DEFINE_TYPE (GstGLAllocator, gst_gl_allocator, GST_TYPE_ALLOCATOR);
 
 static void
@@ -1064,12 +1356,18 @@
 {
   GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
 
+  /* Keep the fallback copy function around, we will need it when copying with
+   * at an offset or smaller size */
+  allocator->fallback_mem_copy = alloc->mem_copy;
+
   alloc->mem_type = GST_GL_MEMORY_ALLOCATOR;
   alloc->mem_map = (GstMemoryMapFunction) _gl_mem_map;
   alloc->mem_unmap = (GstMemoryUnmapFunction) _gl_mem_unmap;
   alloc->mem_copy = (GstMemoryCopyFunction) _gl_mem_copy;
   alloc->mem_share = (GstMemoryShareFunction) _gl_mem_share;
   alloc->mem_is_span = (GstMemoryIsSpanFunction) _gl_mem_is_span;
+
+  GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
 }
 
 /**
@@ -1109,32 +1407,31 @@
 /**
  * gst_gl_memory_setup_buffer:
  * @context: a #GstGLContext
+ * @param: a #GstAllocationParams
  * @info: a #GstVideoInfo
+ * @valign: the #GstVideoAlignment applied to @info
  * @buffer: a #GstBuffer
  *
  * Adds the required #GstGLMemory<!--  -->s with the correct configuration to
- * @buffer based on @info.
+ * @buffer based on @info. This version handles padding through @valign.
  *
  * Returns: whether the memory's were sucessfully added.
  */
 gboolean
-gst_gl_memory_setup_buffer (GstGLContext * context, GstVideoInfo * info,
-    GstBuffer * buffer)
+gst_gl_memory_setup_buffer (GstGLContext * context,
+    GstAllocationParams * params, GstVideoInfo * info,
+    GstVideoAlignment * valign, GstBuffer * buffer)
 {
   GstGLMemory *gl_mem[GST_VIDEO_MAX_PLANES] = { NULL, };
-  GstVideoGLTextureType tex_type;
   guint n_mem, i;
 
   n_mem = GST_VIDEO_INFO_N_PLANES (info);
 
   for (i = 0; i < n_mem; i++) {
-    tex_type =
-        gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (info),
-        i);
     gl_mem[i] =
-        (GstGLMemory *) gst_gl_memory_alloc (context, tex_type,
-        _get_plane_width (info, i), _get_plane_height (info, i),
-        GST_VIDEO_INFO_PLANE_STRIDE (info, i));
+        (GstGLMemory *) gst_gl_memory_alloc (context, params, info, i, valign);
+    if (gl_mem[i] == NULL)
+      return FALSE;
 
     gst_buffer_append_memory (buffer, (GstMemory *) gl_mem[i]);
   }
@@ -1150,30 +1447,25 @@
  * gst_gl_memory_setup_wrapped:
  * @context: a #GstGLContext
  * @info: a #GstVideoInfo
+ * @valign: a #GstVideoInfo
  * @data: a list of per plane data pointers
  * @textures: (transfer out): a list of #GstGLMemory
  *
  * Wraps per plane data pointer in @data into the corresponding entry in
- * @textures based on @info.
+ * @textures based on @info and padding from @valign.
  *
  * Returns: whether the memory's were sucessfully created.
  */
 gboolean
 gst_gl_memory_setup_wrapped (GstGLContext * context, GstVideoInfo * info,
-    gpointer data[GST_VIDEO_MAX_PLANES],
+    GstVideoAlignment * valign, gpointer data[GST_VIDEO_MAX_PLANES],
     GstGLMemory * textures[GST_VIDEO_MAX_PLANES])
 {
-  GstVideoGLTextureType tex_type;
   gint i;
 
   for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) {
-    tex_type =
-        gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (info),
-        i);
-
-    textures[i] = (GstGLMemory *) gst_gl_memory_wrapped (context, tex_type,
-        _get_plane_width (info, i), _get_plane_height (info, i),
-        GST_VIDEO_INFO_PLANE_STRIDE (info, i), data[i], NULL, NULL);
+    textures[i] = (GstGLMemory *) gst_gl_memory_wrapped (context, info, i,
+        valign, data[i], NULL, NULL);
   }
 
   return TRUE;
diff --git a/gst-libs/gst/gl/gstglmemory.h b/gst-libs/gst/gl/gstglmemory.h
index 82c9e88..87033c0 100644
--- a/gst-libs/gst/gl/gstglmemory.h
+++ b/gst-libs/gst/gl/gstglmemory.h
@@ -84,24 +84,28 @@
 
   GstGLContext         *context;
   guint                 tex_id;
+  guint                 tex_target;
   GstVideoGLTextureType tex_type;
-  gint                  width;
-  gint                  height;
-  gint                  stride;
+  GstVideoInfo          info;
+  GstVideoAlignment     valign;
+  guint                 plane;
   gfloat                tex_scaling[2];
 
   /* <private> */
-  GstMapFlags           map_flags;
+  gpointer              alloc_data;
   gpointer              data;
 
-  gboolean              data_wrapped;
   gboolean              texture_wrapped;
   GDestroyNotify        notify;
   gpointer              user_data;
   guint                 pbo;
   guint                 unpack_length;
+  guint                 tex_width;
+  guint                 transfer_pbo;
+  GstMapFlags           map_flags;
+  guint                 map_count;
 
-  gpointer              _gst_reserved[GST_PADDING];
+  GMutex                lock;
 };
 
 #define GST_CAPS_FEATURE_MEMORY_GL_MEMORY "memory:GLMemory"
@@ -151,30 +155,33 @@
 void          gst_gl_memory_init (void);
 gboolean      gst_is_gl_memory (GstMemory * mem);
 
-GstMemory *   gst_gl_memory_alloc   (GstGLContext * context, GstVideoGLTextureType tex_type, 
-                                     gint width, gint height, gint stride);
-GstGLMemory * gst_gl_memory_wrapped (GstGLContext * context, GstVideoGLTextureType tex_type, 
-                                     gint width, gint height, gint stride,
-                                     gpointer data, gpointer user_data,
-                                     GDestroyNotify notify);
-GstGLMemory * gst_gl_memory_wrapped_texture (GstGLContext * context, guint texture_id,
-                                             GstVideoGLTextureType tex_type, 
-                                             gint width, gint height,
+GstMemory *   gst_gl_memory_alloc   (GstGLContext * context, GstAllocationParams *params,
+                                     GstVideoInfo * info, guint plane, GstVideoAlignment *valign);
+GstGLMemory * gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo * info, guint plane,
+                                     GstVideoAlignment *valign, gpointer data,
+                                     gpointer user_data, GDestroyNotify notify);
+GstGLMemory * gst_gl_memory_wrapped_texture (GstGLContext * context, guint texture_id, guint texture_target,
+                                             GstVideoInfo * info, guint plane, GstVideoAlignment *valign,
                                              gpointer user_data, GDestroyNotify notify);
 
 gboolean      gst_gl_memory_copy_into_texture (GstGLMemory *gl_mem, guint tex_id,
-                                               GstVideoGLTextureType tex_type, 
+                                               GstVideoGLTextureType tex_type,
                                                gint width, gint height, gint stride,
                                                gboolean respecify);
 
-gboolean      gst_gl_memory_setup_buffer  (GstGLContext * context, GstVideoInfo * info,
-                                           GstBuffer * buffer);
-gboolean      gst_gl_memory_setup_wrapped (GstGLContext * context, GstVideoInfo * info,
+gboolean      gst_gl_memory_setup_buffer  (GstGLContext * context, GstAllocationParams * params,
+                                           GstVideoInfo * info, GstVideoAlignment *valign, GstBuffer * buffer);
+gboolean      gst_gl_memory_setup_wrapped (GstGLContext * context, GstVideoInfo * info, GstVideoAlignment *valign,
                                            gpointer data[GST_VIDEO_MAX_PLANES],
                                            GstGLMemory *textures[GST_VIDEO_MAX_PLANES]);
 
+gint          gst_gl_memory_get_texture_width  (GstGLMemory * gl_mem);
+gint          gst_gl_memory_get_texture_height (GstGLMemory * gl_mem);
+
 GstVideoGLTextureType gst_gl_texture_type_from_format (GstGLContext *context, GstVideoFormat v_format, guint plane);
 
+void gst_gl_memory_download_transfer (GstGLMemory * gl_mem);
+
 /**
  * GstGLAllocator
  *
@@ -183,6 +190,7 @@
 struct _GstGLAllocator
 {
   GstAllocator parent;
+  GstMemoryCopyFunction fallback_mem_copy;
 };
 
 /**
diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c
index de56223..fa16698 100644
--- a/gst-libs/gst/gl/gstglshader.c
+++ b/gst-libs/gst/gl/gstglshader.c
@@ -26,28 +26,49 @@
 #include "gl.h"
 #include "gstglshader.h"
 
-#if GST_GL_HAVE_GLES2
 /* *INDENT-OFF* */
 static const gchar *simple_vertex_shader_str_gles2 =
-      "attribute vec4 a_position;   \n"
-      "attribute vec2 a_texCoord;   \n"
-      "varying vec2 v_texCoord;     \n"
-      "void main()                  \n"
-      "{                            \n"
-      "   gl_Position = a_position; \n"
-      "   v_texCoord = a_texCoord;  \n"
-      "}                            \n";
+      "attribute vec4 a_position;\n"
+      "attribute vec2 a_texcoord;\n"
+      "varying vec2 v_texcoord;\n"
+      "void main()\n"
+      "{\n"
+      "   gl_Position = a_position;\n"
+      "   v_texcoord = a_texcoord;\n"
+      "}\n";
 
 static const gchar *simple_fragment_shader_str_gles2 =
-      "precision mediump float;                            \n"
-      "varying vec2 v_texCoord;                            \n"
-      "uniform sampler2D tex;                              \n"
-      "void main()                                         \n"
-      "{                                                   \n"
-      "  gl_FragColor = texture2D( tex, v_texCoord );      \n"
-      "}                                                   \n";
+      "#ifdef GL_ES\n"
+      "precision mediump float;\n"
+      "#endif\n"
+      "varying vec2 v_texcoord;\n"
+      "uniform sampler2D tex;\n"
+      "void main()\n"
+      "{\n"
+      "  gl_FragColor = texture2D(tex, v_texcoord);\n"
+      "}";
+
+static const gchar *simple_vertex_shader_str_gl3 =
+      "#version 130\n"
+      "in vec4 a_position;\n"
+      "in vec2 a_texcoord;\n"
+      "out vec2 v_texcoord;\n"
+      "void main()\n"
+      "{\n"
+      "   gl_Position = a_position;\n"
+      "   v_texcoord = a_texcoord;\n"
+      "}\n";
+
+static const gchar *simple_fragment_shader_str_gl3 =
+      "#version 130\n"
+      "in vec2 v_texcoord;\n"
+      "out vec4 frag_color;\n"
+      "uniform sampler2D tex;\n"
+      "void main()\n"
+      "{\n"
+      "  frag_color = texture(tex, v_texcoord);\n"
+      "}\n";
 /* *INDENT-ON* */
-#endif
 
 #ifndef GL_COMPILE_STATUS
 #define GL_COMPILE_STATUS             0x8B81
@@ -149,7 +170,7 @@
   shader = GST_GL_SHADER (object);
   priv = shader->priv;
 
-  GST_TRACE ("finalizing shader %u", priv->program_handle);
+  GST_TRACE_OBJECT (shader, "finalizing shader %u", priv->program_handle);
 
   g_free (priv->vertex_src);
   g_free (priv->fragment_src);
@@ -212,6 +233,13 @@
 
 }
 
+int
+gst_gl_shader_get_program_handle (GstGLShader * shader)
+{
+  GstGLShaderPrivate *priv = shader->priv;
+  return (int) priv->program_handle;
+}
+
 static void
 gst_gl_shader_class_init (GstGLShaderClass * klass)
 {
@@ -374,6 +402,9 @@
   shader = g_object_new (GST_GL_TYPE_SHADER, NULL);
   shader->context = gst_object_ref (context);
 
+  GST_DEBUG_OBJECT (shader, "Created new GLShader for context %" GST_PTR_FORMAT,
+      context);
+
   return shader;
 }
 
@@ -627,27 +658,35 @@
   return TRUE;
 }
 
-#if GST_GL_HAVE_GLES2
 gboolean
 gst_gl_shader_compile_with_default_f_and_check (GstGLShader * shader,
     const gchar * v_src, const gint n_attribs, const gchar * attrib_names[],
     GLint attrib_locs[])
 {
-  return gst_gl_shader_compile_all_with_attribs_and_check (shader, v_src,
-      simple_fragment_shader_str_gles2, n_attribs, attrib_names, attrib_locs);
+  if (gst_gl_context_get_gl_api (shader->context) & GST_GL_API_OPENGL3)
+    return gst_gl_shader_compile_all_with_attribs_and_check (shader, v_src,
+        simple_fragment_shader_str_gl3, n_attribs, attrib_names, attrib_locs);
+  else
+    return gst_gl_shader_compile_all_with_attribs_and_check (shader, v_src,
+        simple_fragment_shader_str_gles2, n_attribs, attrib_names, attrib_locs);
 }
 
 gboolean
 gst_gl_shader_compile_with_default_v_and_check (GstGLShader * shader,
     const gchar * f_src, GLint * pos_loc, GLint * tex_loc)
 {
-  const gchar *attrib_names[2] = { "a_position", "a_texCoord" };
+  const gchar *attrib_names[2] = { "a_position", "a_texcoord" };
   GLint attrib_locs[2] = { 0 };
   gboolean ret = TRUE;
 
-  ret =
-      gst_gl_shader_compile_all_with_attribs_and_check (shader,
-      simple_vertex_shader_str_gles2, f_src, 2, attrib_names, attrib_locs);
+  if (gst_gl_context_get_gl_api (shader->context) & GST_GL_API_OPENGL3)
+    ret =
+        gst_gl_shader_compile_all_with_attribs_and_check (shader,
+        simple_vertex_shader_str_gl3, f_src, 2, attrib_names, attrib_locs);
+  else
+    ret =
+        gst_gl_shader_compile_all_with_attribs_and_check (shader,
+        simple_vertex_shader_str_gles2, f_src, 2, attrib_names, attrib_locs);
 
   if (ret) {
     *pos_loc = attrib_locs[0];
@@ -661,10 +700,13 @@
 gst_gl_shader_compile_with_default_vf_and_check (GstGLShader * shader,
     GLint * pos_loc, GLint * tex_loc)
 {
-  return gst_gl_shader_compile_with_default_v_and_check (shader,
-      simple_fragment_shader_str_gles2, pos_loc, tex_loc);
+  if (gst_gl_context_get_gl_api (shader->context) & GST_GL_API_OPENGL3)
+    return gst_gl_shader_compile_with_default_v_and_check (shader,
+        simple_fragment_shader_str_gl3, pos_loc, tex_loc);
+  else
+    return gst_gl_shader_compile_with_default_v_and_check (shader,
+        simple_fragment_shader_str_gles2, pos_loc, tex_loc);
 }
-#endif
 
 void
 gst_gl_shader_set_uniform_1f (GstGLShader * shader, const gchar * name,
@@ -1125,9 +1167,12 @@
   GstGLShaderPrivate *priv;
   GstGLFuncs *gl;
 
-  g_return_val_if_fail (shader != NULL, 0);
+  g_return_val_if_fail (shader != NULL, -1);
   priv = shader->priv;
-  g_return_val_if_fail (priv->program_handle != 0, 0);
+  g_return_val_if_fail (priv->program_handle != 0, -1);
+  if (0 == priv->vertex_handle)
+    return -1;
+
   gl = shader->context->gl_vtable;
 
   return gl->GetAttribLocation (priv->program_handle, name);
diff --git a/gst-libs/gst/gl/gstglshader.h b/gst-libs/gst/gl/gstglshader.h
index a56b642..97f98fc 100644
--- a/gst-libs/gst/gl/gstglshader.h
+++ b/gst-libs/gst/gl/gstglshader.h
@@ -67,6 +67,8 @@
 
 GstGLShader * gst_gl_shader_new (GstGLContext *context);
 
+int gst_gl_shader_get_program_handle(GstGLShader * shader);
+
 void          gst_gl_shader_set_vertex_source   (GstGLShader *shader, const gchar *src);
 void          gst_gl_shader_set_fragment_source (GstGLShader *shader, const gchar *src);
 const gchar * gst_gl_shader_get_vertex_source   (GstGLShader *shader);
@@ -77,11 +79,10 @@
 gboolean gst_gl_shader_compile           (GstGLShader *shader, GError **error);
 gboolean gst_gl_shader_compile_and_check (GstGLShader *shader, const gchar *source, GstGLShaderSourceType type);
 gboolean gst_gl_shader_compile_all_with_attribs_and_check (GstGLShader *shader, const gchar *v_src, const gchar *f_src, const gint n_attribs, const gchar *attrib_names[], GLint attrib_locs[]);
-#if GST_GL_HAVE_GLES2
+
 gboolean gst_gl_shader_compile_with_default_f_and_check   (GstGLShader *shader, const gchar *v_src, const gint n_attribs, const gchar *attrib_names[], GLint attrib_locs[]);
 gboolean gst_gl_shader_compile_with_default_v_and_check   (GstGLShader *shader, const gchar *f_src, GLint *pos_loc, GLint *tex_loc);
 gboolean gst_gl_shader_compile_with_default_vf_and_check  (GstGLShader *shader, GLint *pos_loc, GLint *tex_loc);
-#endif
 
 void gst_gl_shader_release       (GstGLShader *shader);
 void gst_gl_shader_use           (GstGLShader *shader);
diff --git a/gst-libs/gst/gl/gstglshadervariables.c b/gst-libs/gst/gl/gstglshadervariables.c
index 4ca2efe..be04c94 100644
--- a/gst-libs/gst/gl/gstglshadervariables.c
+++ b/gst-libs/gst/gl/gstglshadervariables.c
@@ -184,7 +184,7 @@
     return 0;
 
   p0 = variables;
-  trimright (p0, " \t\n");
+  trimright (p0, " \t\r\n");
   lim = variables + strlen (variables);
   e = strchr (p0, ';');
   while (p0 < lim) {
@@ -201,13 +201,13 @@
     e[1] = e1;
 
     trimright (p, " \t");
-    trimleft (p, " \t\n");
+    trimleft (p, " \t\r\n");
 
     t = strtok_r (p, " \t", &saveptr);
     if (!t)
       goto parse_error;
     trimleft (t, " \t");
-    trimright (t, " \t\n");
+    trimright (t, " \t\r\n");
 
     if (t[0]) {
 
@@ -318,7 +318,7 @@
     t = p = p0;
   } else {
     e[1] = 0;
-    trimleft (p0, " \t\n");
+    trimleft (p0, " \t\r\n");
     GST_ERROR ("\n%s", p0);
     e[1] = e1;
   }
@@ -741,7 +741,7 @@
             return _saveptr + j;
         }
         ret->value = (void *) g_malloc (sizeof (float));
-        *((float *) ret->value) = (float) strtod (value, NULL);
+        *((float *) ret->value) = (float) g_ascii_strtod (value, NULL);
 
       } else {
         ret->value = g_malloc (sizeof (float) * ret->count);
@@ -762,7 +762,7 @@
               return _saveptr + (saveptr - t) + j;
           }
 
-          ((float *) ret->value)[i] = (float) strtod (t, NULL);
+          ((float *) ret->value)[i] = (float) g_ascii_strtod (t, NULL);
           t = strtok_r (0, ",", &saveptr);
         }
       }
@@ -925,7 +925,7 @@
           return _saveptr + (saveptr - t) + j;
       }
 
-      ((float *) ret->value)[i] = (float) strtod (t, NULL);
+      ((float *) ret->value)[i] = (float) g_ascii_strtod (t, NULL);
       t = strtok_r (0, ",", &saveptr);
     }
 
@@ -975,7 +975,7 @@
             return _saveptr + (t - value) + j;
         }
 
-        ((float *) ret->value)[k * n + i] = (float) strtod (t, NULL);
+        ((float *) ret->value)[k * n + i] = (float) g_ascii_strtod (t, NULL);
         t = strtok_r (0, ",", &saveptr);
         if (i < (n - 1) && !t)
           return _saveptr + (saveptr - value);
@@ -1424,7 +1424,7 @@
           return _saveptr + (saveptr - t) + j;
       }
 
-      ((float *) ret->value)[i] = (float) strtod (t, NULL);
+      ((float *) ret->value)[i] = (float) g_ascii_strtod (t, NULL);
       t = strtok_r (0, ",", &saveptr);
     }
 
@@ -1474,7 +1474,8 @@
             return _saveptr + (t - value) + j;
         }
 
-        ((float *) ret->value)[k * n * m + i] = (float) strtod (t, NULL);
+        ((float *) ret->value)[k * n * m + i] =
+            (float) g_ascii_strtod (t, NULL);
         t = strtok_r (0, ",", &saveptr);
         if (i < (n * m - 1) && !t)
           return _saveptr + (saveptr - value);
diff --git a/gst-libs/gst/gl/gstglsyncmeta.c b/gst-libs/gst/gl/gstglsyncmeta.c
new file mode 100644
index 0000000..1391a6d
--- /dev/null
+++ b/gst-libs/gst/gl/gstglsyncmeta.c
@@ -0,0 +1,205 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gl.h"
+#include "gstglsyncmeta.h"
+
+#define GST_CAT_DEFAULT gst_gl_sync_meta_debug
+GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
+
+#ifndef GL_SYNC_GPU_COMMANDS_COMPLETE
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#endif
+#ifndef GL_SYNC_FLUSH_COMMANDS_BIT
+#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001
+#endif
+#ifndef GL_TIMEOUT_EXPIRED
+#define GL_TIMEOUT_EXPIRED 0x911B
+#endif
+
+GstGLSyncMeta *
+gst_buffer_add_gl_sync_meta (GstGLContext * context, GstBuffer * buffer)
+{
+  GstGLSyncMeta *meta;
+
+  g_return_val_if_fail (GST_GL_IS_CONTEXT (context), NULL);
+
+  meta =
+      (GstGLSyncMeta *) gst_buffer_add_meta ((buffer), GST_GL_SYNC_META_INFO,
+      NULL);
+
+  if (!meta)
+    return NULL;
+
+  meta->context = gst_object_ref (context);
+  meta->glsync = NULL;
+
+  return meta;
+}
+
+static void
+_set_sync_point (GstGLContext * context, GstGLSyncMeta * sync_meta)
+{
+  const GstGLFuncs *gl = context->gl_vtable;
+
+  if (gl->FenceSync) {
+    if (sync_meta->glsync)
+      gl->DeleteSync (sync_meta->glsync);
+    sync_meta->glsync = gl->FenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+    GST_LOG ("setting sync object %p", sync_meta->glsync);
+  } else {
+    gl->Flush ();
+  }
+}
+
+void
+gst_gl_sync_meta_set_sync_point (GstGLSyncMeta * sync_meta,
+    GstGLContext * context)
+{
+  gst_gl_context_thread_add (context,
+      (GstGLContextThreadFunc) _set_sync_point, sync_meta);
+}
+
+static void
+_wait (GstGLContext * context, GstGLSyncMeta * sync_meta)
+{
+  const GstGLFuncs *gl = context->gl_vtable;
+  GLenum res;
+
+  if (gl->ClientWaitSync) {
+    do {
+      GST_LOG ("waiting on sync object %p", sync_meta->glsync);
+      res =
+          gl->ClientWaitSync (sync_meta->glsync, GL_SYNC_FLUSH_COMMANDS_BIT,
+          1000000000 /* 1s */ );
+    } while (res == GL_TIMEOUT_EXPIRED);
+  }
+}
+
+void
+gst_gl_sync_meta_wait (GstGLSyncMeta * sync_meta, GstGLContext * context)
+{
+  if (sync_meta->context == context)
+    return;
+
+  if (sync_meta->glsync) {
+    gst_gl_context_thread_add (context,
+        (GstGLContextThreadFunc) _wait, sync_meta);
+  }
+}
+
+static gboolean
+_gst_gl_sync_meta_transform (GstBuffer * dest, GstMeta * meta,
+    GstBuffer * buffer, GQuark type, gpointer data)
+{
+  GstGLSyncMeta *dmeta, *smeta;
+
+  smeta = (GstGLSyncMeta *) meta;
+
+  if (GST_META_TRANSFORM_IS_COPY (type)) {
+    GstMetaTransformCopy *copy = data;
+
+    if (!copy->region) {
+      /* only copy if the complete data is copied as well */
+      dmeta = gst_buffer_add_gl_sync_meta (smeta->context, dest);
+
+      if (!dmeta)
+        return FALSE;
+
+      GST_DEBUG ("copy gl sync metadata");
+
+      dmeta->glsync = smeta->glsync;
+    }
+  }
+  return TRUE;
+}
+
+static void
+_free_gl_sync_meta (GstGLContext * context, GstGLSyncMeta * sync_meta)
+{
+  const GstGLFuncs *gl = context->gl_vtable;
+
+  if (sync_meta->glsync)
+    gl->DeleteSync (sync_meta->glsync);
+  sync_meta->glsync = NULL;
+}
+
+static void
+_gst_gl_sync_meta_free (GstGLSyncMeta * sync_meta, GstBuffer * buffer)
+{
+  if (sync_meta->glsync) {
+    gst_gl_context_thread_add (sync_meta->context,
+        (GstGLContextThreadFunc) _free_gl_sync_meta, sync_meta);
+  }
+  gst_object_unref (sync_meta->context);
+}
+
+static gboolean
+_gst_gl_sync_meta_init (GstGLSyncMeta * sync_meta, gpointer params,
+    GstBuffer * buffer)
+{
+  static volatile gsize _init;
+
+  if (g_once_init_enter (&_init)) {
+    GST_DEBUG_CATEGORY_INIT (gst_gl_sync_meta_debug, "glsyncmeta", 0,
+        "glsyncmeta");
+    g_once_init_leave (&_init, 1);
+  }
+
+  sync_meta->context = NULL;
+  sync_meta->glsync = NULL;
+
+  return TRUE;
+}
+
+GType
+gst_gl_sync_meta_api_get_type (void)
+{
+  static volatile GType type = 0;
+  static const gchar *tags[] = { NULL };
+
+  if (g_once_init_enter (&type)) {
+    GType _type = gst_meta_api_type_register ("GstGLSyncMetaAPI", tags);
+    g_once_init_leave (&type, _type);
+  }
+
+  return type;
+}
+
+const GstMetaInfo *
+gst_gl_sync_meta_get_info (void)
+{
+  static const GstMetaInfo *meta_info = NULL;
+
+  if (g_once_init_enter (&meta_info)) {
+    const GstMetaInfo *meta =
+        gst_meta_register (GST_GL_SYNC_META_API_TYPE, "GstGLSyncMeta",
+        sizeof (GstVideoMeta), (GstMetaInitFunction) _gst_gl_sync_meta_init,
+        (GstMetaFreeFunction) _gst_gl_sync_meta_free,
+        _gst_gl_sync_meta_transform);
+    g_once_init_leave (&meta_info, meta);
+  }
+
+  return meta_info;
+}
diff --git a/gst-libs/gst/gl/gstglsyncmeta.h b/gst-libs/gst/gl/gstglsyncmeta.h
new file mode 100644
index 0000000..9d79435
--- /dev/null
+++ b/gst-libs/gst/gl/gstglsyncmeta.h
@@ -0,0 +1,54 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_GL_SYNC_META_H__
+#define __GST_GL_SYNC_META_H__
+
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+#define GST_GL_SYNC_META_API_TYPE (gst_gl_sync_meta_api_get_type())
+#define GST_GL_SYNC_META_INFO     (gst_gl_sync_meta_get_info())
+typedef struct _GstGLSyncMeta GstGLSyncMeta;
+
+#define GST_BUFFER_POOL_OPTION_GL_SYNC_META "GstBufferPoolOptionGLSyncMeta"
+
+struct _GstGLSyncMeta {
+  /*< private >*/
+  GstMeta parent;
+
+  GstGLContext *context;
+
+  GLsync        glsync;
+};
+
+GType gst_gl_sync_meta_api_get_type (void);
+const GstMetaInfo * gst_gl_sync_meta_get_info (void);
+
+#define gst_buffer_get_gl_sync_meta(b) ((GstGLSyncMeta*)gst_buffer_get_meta((b),GST_GL_SYNC_META_API_TYPE))
+
+GstGLSyncMeta *     gst_buffer_add_gl_sync_meta         (GstGLContext * context, GstBuffer *buffer);
+void                gst_gl_sync_meta_set_sync_point     (GstGLSyncMeta * sync, GstGLContext * context);
+void                gst_gl_sync_meta_wait               (GstGLSyncMeta * sync, GstGLContext * context);
+
+G_END_DECLS
+
+#endif /* __GST_GL_SYNC_META_H__ */
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
index ecf6ebb..635477f 100644
--- a/gst-libs/gst/gl/gstglupload.c
+++ b/gst-libs/gst/gl/gstglupload.c
@@ -47,29 +47,754 @@
 #define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
 #define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
 
-static gboolean _upload_memory (GstGLUpload * upload);
-static gboolean _init_upload (GstGLUpload * upload);
-static gboolean _gst_gl_upload_perform_with_data_unlocked (GstGLUpload * upload,
-    GLuint * texture_id, gpointer data[GST_VIDEO_MAX_PLANES]);
-static void _do_upload_with_meta (GstGLContext * context, GstGLUpload * upload);
-static void gst_gl_upload_reset (GstGLUpload * upload);
+GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
+#define GST_CAT_DEFAULT gst_gl_upload_debug
+
+typedef struct _UploadMethod UploadMethod;
 
 struct _GstGLUploadPrivate
 {
-  gboolean result;
-  guint tex_id;
-
-  gboolean mapped;
-  GstVideoFrame frame;
-
-  GstVideoGLTextureUploadMeta *meta;
+  GstVideoInfo in_info;
+  GstVideoInfo out_info;
+  GstCaps *in_caps;
+  GstCaps *out_caps;
 
   GstBuffer *outbuf;
-  gboolean released;
+
+  /* all method impl pointers */
+  gpointer *upload_impl;
+
+  /* current method */
+  const UploadMethod *method;
+  gpointer method_impl;
+  int method_i;
 };
 
-GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
-#define GST_CAT_DEFAULT gst_gl_upload_debug
+static GstCaps *
+_set_caps_features (const GstCaps * caps, const gchar * feature_name)
+{
+  GstCaps *tmp = gst_caps_copy (caps);
+  guint n = gst_caps_get_size (tmp);
+  guint i = 0;
+
+  for (i = 0; i < n; i++) {
+    GstCapsFeatures *features;
+
+    features = gst_caps_features_new (feature_name, NULL);
+    gst_caps_set_features (tmp, i, features);
+  }
+
+  return tmp;
+}
+
+typedef enum
+{
+  METHOD_FLAG_CAN_SHARE_CONTEXT = 1,
+} GstGLUploadMethodFlags;
+
+struct _UploadMethod
+{
+  const gchar *name;
+  GstGLUploadMethodFlags flags;
+
+    gpointer (*new) (GstGLUpload * upload);
+  GstCaps *(*transform_caps) (GstGLContext * context,
+      GstPadDirection direction, GstCaps * caps);
+    gboolean (*accept) (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
+      GstCaps * out_caps);
+  void (*propose_allocation) (gpointer impl, GstQuery * decide_query,
+      GstQuery * query);
+    GstGLUploadReturn (*perform) (gpointer impl, GstBuffer * buffer,
+      GstBuffer ** outbuf);
+  void (*release) (gpointer impl, GstBuffer * buffer);
+  void (*free) (gpointer impl);
+} _UploadMethod;
+
+struct GLMemoryUpload
+{
+  GstGLUpload *upload;
+};
+
+static gpointer
+_gl_memory_upload_new (GstGLUpload * upload)
+{
+  struct GLMemoryUpload *mem = g_new0 (struct GLMemoryUpload, 1);
+
+  mem->upload = upload;
+
+  return mem;
+}
+
+static GstCaps *
+_gl_memory_upload_transform_caps (GstGLContext * context,
+    GstPadDirection direction, GstCaps * caps)
+{
+  return _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+}
+
+static gboolean
+_gl_memory_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
+    GstCaps * out_caps)
+{
+  struct GLMemoryUpload *upload = impl;
+  GstCapsFeatures *features, *gl_features;
+  gboolean ret = TRUE;
+  int i;
+
+  gl_features =
+      gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+
+  features = gst_caps_get_features (out_caps, 0);
+  if (!gst_caps_features_is_equal (features, gl_features))
+    ret = FALSE;
+
+  features = gst_caps_get_features (in_caps, 0);
+  if (!gst_caps_features_is_equal (features, gl_features)
+      && !gst_caps_features_is_equal (features,
+          GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))
+    ret = FALSE;
+
+  gst_caps_features_free (gl_features);
+
+  if (!ret)
+    return FALSE;
+
+  if (buffer) {
+    if (gst_buffer_n_memory (buffer) !=
+        GST_VIDEO_INFO_N_PLANES (&upload->upload->priv->in_info))
+      return FALSE;
+
+    for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->upload->priv->in_info);
+        i++) {
+      GstMemory *mem = gst_buffer_peek_memory (buffer, i);
+
+      if (!gst_is_gl_memory (mem))
+        return FALSE;
+    }
+  }
+
+  return TRUE;
+}
+
+static void
+_gl_memory_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
+    GstQuery * query)
+{
+  struct GLMemoryUpload *upload = impl;
+  GstAllocationParams params;
+  GstAllocator *allocator;
+  GstBufferPool *pool = NULL;
+  guint n_pools, i;
+
+  gst_allocation_params_init (&params);
+
+  allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
+  gst_query_add_allocation_param (query, allocator, &params);
+  gst_object_unref (allocator);
+
+  n_pools = gst_query_get_n_allocation_pools (query);
+  for (i = 0; i < n_pools; i++) {
+    gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL);
+    if (!GST_IS_GL_BUFFER_POOL (pool)) {
+      gst_object_unref (pool);
+      pool = NULL;
+    }
+  }
+
+  if (!pool) {
+    GstStructure *config;
+    GstVideoInfo info;
+    GstCaps *caps;
+    gsize size;
+
+    gst_query_parse_allocation (query, &caps, NULL);
+
+    if (!gst_video_info_from_caps (&info, caps))
+      goto invalid_caps;
+
+    pool = gst_gl_buffer_pool_new (upload->upload->context);
+    config = gst_buffer_pool_get_config (pool);
+
+    /* the normal size of a frame */
+    size = info.size;
+    gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
+
+    if (!gst_buffer_pool_set_config (pool, config))
+      goto config_failed;
+
+    gst_query_add_allocation_pool (query, pool, size, 1, 0);
+  }
+
+  if (pool)
+    gst_object_unref (pool);
+
+  return;
+
+invalid_caps:
+  {
+    GST_WARNING_OBJECT (upload->upload, "invalid caps specified");
+    return;
+  }
+config_failed:
+  {
+    GST_WARNING_OBJECT (upload->upload, "failed setting config");
+    return;
+  }
+}
+
+static GstGLUploadReturn
+_gl_memory_upload_perform (gpointer impl, GstBuffer * buffer,
+    GstBuffer ** outbuf)
+{
+  struct GLMemoryUpload *upload = impl;
+  GstGLMemory *gl_mem;
+  int i;
+
+  for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->upload->priv->in_info); i++) {
+    GstMemory *mem = gst_buffer_peek_memory (buffer, i);
+
+    gl_mem = (GstGLMemory *) mem;
+    if (!gst_gl_context_can_share (upload->upload->context, gl_mem->context))
+      return GST_GL_UPLOAD_UNSHARED_GL_CONTEXT;
+  }
+
+  *outbuf = gst_buffer_ref (buffer);
+
+  return GST_GL_UPLOAD_DONE;
+}
+
+static void
+_gl_memory_upload_release (gpointer impl, GstBuffer * buffer)
+{
+}
+
+static void
+_gl_memory_upload_free (gpointer impl)
+{
+  g_free (impl);
+}
+
+static const UploadMethod _gl_memory_upload = {
+  "GLMemory",
+  METHOD_FLAG_CAN_SHARE_CONTEXT,
+  &_gl_memory_upload_new,
+  &_gl_memory_upload_transform_caps,
+  &_gl_memory_upload_accept,
+  &_gl_memory_upload_propose_allocation,
+  &_gl_memory_upload_perform,
+  &_gl_memory_upload_release,
+  &_gl_memory_upload_free
+};
+
+#if GST_GL_HAVE_PLATFORM_EGL
+struct EGLImageUpload
+{
+  GstGLUpload *upload;
+  GstBuffer *buffer;
+  GstBuffer **outbuf;
+};
+
+static gpointer
+_egl_image_upload_new (GstGLUpload * upload)
+{
+  struct EGLImageUpload *image = g_new0 (struct EGLImageUpload, 1);
+
+  image->upload = upload;
+
+  return image;
+}
+
+static GstCaps *
+_egl_image_upload_transform_caps (GstGLContext * context,
+    GstPadDirection direction, GstCaps * caps)
+{
+  GstCaps *ret;
+
+  if (direction == GST_PAD_SINK) {
+    ret = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  } else {
+    ret = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_EGL_IMAGE);
+    gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
+  }
+
+  return ret;
+}
+
+static gboolean
+_egl_image_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
+    GstCaps * out_caps)
+{
+  struct EGLImageUpload *image = impl;
+  GstCapsFeatures *features, *gl_features;
+  gboolean ret = TRUE;
+  int i;
+
+  gl_features =
+      gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_EGL_IMAGE);
+  features = gst_caps_get_features (in_caps, 0);
+  if (!gst_caps_features_is_equal (features, gl_features))
+    ret = FALSE;
+
+  gst_caps_features_free (gl_features);
+
+  gl_features =
+      gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  features = gst_caps_get_features (out_caps, 0);
+  if (!gst_caps_features_is_equal (features, gl_features))
+    ret = FALSE;
+
+  gst_caps_features_free (gl_features);
+
+  if (!ret)
+    return FALSE;
+
+  if (buffer) {
+    if (gst_buffer_n_memory (buffer) !=
+        GST_VIDEO_INFO_N_PLANES (&image->upload->priv->in_info))
+      return FALSE;
+
+    for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&image->upload->priv->in_info);
+        i++) {
+      GstMemory *mem = gst_buffer_peek_memory (buffer, i);
+
+      if (!gst_is_egl_image_memory (mem))
+        return FALSE;
+    }
+  }
+
+  return TRUE;
+}
+
+static void
+_egl_image_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
+    GstQuery * query)
+{
+  struct EGLImageUpload *image = impl;
+  GstAllocationParams params;
+  GstAllocator *allocator;
+
+  gst_allocation_params_init (&params);
+
+  if (gst_gl_context_check_feature (image->upload->context,
+          "EGL_KHR_image_base")) {
+    allocator = gst_allocator_find (GST_EGL_IMAGE_MEMORY_TYPE);
+    gst_query_add_allocation_param (query, allocator, &params);
+    gst_object_unref (allocator);
+  }
+}
+
+static void
+_egl_image_upload_perform_gl_thread (GstGLContext * context,
+    struct EGLImageUpload *image)
+{
+  guint i;
+
+  /* FIXME: buffer pool */
+  *image->outbuf = gst_buffer_new ();
+  gst_gl_memory_setup_buffer (image->upload->context,
+      NULL, &image->upload->priv->out_info, NULL, *image->outbuf);
+
+  for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&image->upload->priv->in_info); i++) {
+    GstMemory *mem = gst_buffer_peek_memory (image->buffer, i);
+    GstGLMemory *out_gl_mem =
+        (GstGLMemory *) gst_buffer_peek_memory (*image->outbuf, i);
+    const GstGLFuncs *gl = NULL;
+
+    gl = GST_GL_CONTEXT (((GstEGLImageMemory *) mem)->context)->gl_vtable;
+
+    gl->ActiveTexture (GL_TEXTURE0 + i);
+    gl->BindTexture (GL_TEXTURE_2D, out_gl_mem->tex_id);
+    gl->EGLImageTargetTexture2D (GL_TEXTURE_2D,
+        gst_egl_image_memory_get_image (mem));
+  }
+
+  if (GST_IS_GL_BUFFER_POOL (image->buffer->pool))
+    gst_gl_buffer_pool_replace_last_buffer (GST_GL_BUFFER_POOL (image->buffer->
+            pool), image->buffer);
+}
+
+static GstGLUploadReturn
+_egl_image_upload_perform (gpointer impl, GstBuffer * buffer,
+    GstBuffer ** outbuf)
+{
+  struct EGLImageUpload *image = impl;
+
+  image->buffer = buffer;
+  image->outbuf = outbuf;
+
+  gst_gl_context_thread_add (image->upload->context,
+      (GstGLContextThreadFunc) _egl_image_upload_perform_gl_thread, image);
+
+  if (!*image->outbuf)
+    return GST_GL_UPLOAD_ERROR;
+
+  return GST_GL_UPLOAD_DONE;
+}
+
+static void
+_egl_image_upload_release (gpointer impl, GstBuffer * buffer)
+{
+}
+
+static void
+_egl_image_upload_free (gpointer impl)
+{
+  g_free (impl);
+}
+
+static const UploadMethod _egl_image_upload = {
+  "EGLImage",
+  0,
+  &_egl_image_upload_new,
+  &_egl_image_upload_transform_caps,
+  &_egl_image_upload_accept,
+  &_egl_image_upload_propose_allocation,
+  &_egl_image_upload_perform,
+  &_egl_image_upload_release,
+  &_egl_image_upload_free
+};
+#endif
+
+struct GLUploadMeta
+{
+  GstGLUpload *upload;
+
+  gboolean result;
+  GstVideoGLTextureUploadMeta *meta;
+  guint texture_ids[GST_VIDEO_MAX_PLANES];
+};
+
+static gpointer
+_upload_meta_upload_new (GstGLUpload * upload)
+{
+  struct GLUploadMeta *meta = g_new0 (struct GLUploadMeta, 1);
+
+  meta->upload = upload;
+
+  return meta;
+}
+
+static GstCaps *
+_upload_meta_upload_transform_caps (GstGLContext * context,
+    GstPadDirection direction, GstCaps * caps)
+{
+  GstCaps *ret;
+
+  if (direction == GST_PAD_SINK) {
+    ret = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  } else {
+    ret =
+        _set_caps_features (caps,
+        GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META);
+    gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
+  }
+
+  return ret;
+}
+
+static gboolean
+_upload_meta_upload_accept (gpointer impl, GstBuffer * buffer,
+    GstCaps * in_caps, GstCaps * out_caps)
+{
+  struct GLUploadMeta *upload = impl;
+  GstCapsFeatures *features, *gl_features;
+  GstVideoGLTextureUploadMeta *meta;
+  gboolean ret = TRUE;
+
+  features = gst_caps_get_features (in_caps, 0);
+  gl_features =
+      gst_caps_features_from_string
+      (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META);
+
+  if (!gst_caps_features_is_equal (features, gl_features))
+    ret = FALSE;
+
+  gst_caps_features_free (gl_features);
+
+  gl_features =
+      gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  features = gst_caps_get_features (out_caps, 0);
+  if (!gst_caps_features_is_equal (features, gl_features))
+    ret = FALSE;
+
+  gst_caps_features_free (gl_features);
+
+  if (!ret)
+    return ret;
+
+  if (buffer) {
+    if ((meta = gst_buffer_get_video_gl_texture_upload_meta (buffer)) == NULL)
+      return FALSE;
+
+    if (meta->texture_type[0] != GST_VIDEO_GL_TEXTURE_TYPE_RGBA) {
+      GST_FIXME_OBJECT (upload, "only single rgba texture supported");
+      return FALSE;
+    }
+
+    if (meta->texture_orientation !=
+        GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL) {
+      GST_FIXME_OBJECT (upload, "only x-normal, y-normal textures supported");
+      return FALSE;
+    }
+  }
+
+  return TRUE;
+}
+
+static void
+_upload_meta_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
+    GstQuery * query)
+{
+  struct GLUploadMeta *upload = impl;
+  GstStructure *gl_context;
+  gchar *platform, *gl_apis;
+  gpointer handle;
+
+  gl_apis =
+      gst_gl_api_to_string (gst_gl_context_get_gl_api (upload->
+          upload->context));
+  platform =
+      gst_gl_platform_to_string (gst_gl_context_get_gl_platform
+      (upload->upload->context));
+  handle = (gpointer) gst_gl_context_get_gl_context (upload->upload->context);
+
+  gl_context =
+      gst_structure_new ("GstVideoGLTextureUploadMeta", "gst.gl.GstGLContext",
+      GST_GL_TYPE_CONTEXT, upload->upload->context, "gst.gl.context.handle",
+      G_TYPE_POINTER, handle, "gst.gl.context.type", G_TYPE_STRING, platform,
+      "gst.gl.context.apis", G_TYPE_STRING, gl_apis, NULL);
+  gst_query_add_allocation_meta (query,
+      GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, gl_context);
+
+  g_free (gl_apis);
+  g_free (platform);
+  gst_structure_free (gl_context);
+}
+
+/*
+ * Uploads using gst_video_gl_texture_upload_meta_upload().
+ * i.e. consumer of GstVideoGLTextureUploadMeta
+ */
+static void
+_do_upload_with_meta (GstGLContext * context, struct GLUploadMeta *upload)
+{
+  if (!gst_video_gl_texture_upload_meta_upload (upload->meta,
+          upload->texture_ids)) {
+    upload->result = FALSE;
+    return;
+  }
+
+  upload->result = TRUE;
+}
+
+static GstGLUploadReturn
+_upload_meta_upload_perform (gpointer impl, GstBuffer * buffer,
+    GstBuffer ** outbuf)
+{
+  struct GLUploadMeta *upload = impl;
+  int i;
+
+  GST_LOG_OBJECT (upload, "Attempting upload with GstVideoGLTextureUploadMeta");
+
+  upload->meta = gst_buffer_get_video_gl_texture_upload_meta (buffer);
+
+  /* FIXME: buffer pool */
+  *outbuf = gst_buffer_new ();
+  gst_gl_memory_setup_buffer (upload->upload->context,
+      NULL, &upload->upload->priv->in_info, NULL, *outbuf);
+
+  for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
+    guint tex_id = 0;
+
+    if (i < GST_VIDEO_INFO_N_PLANES (&upload->upload->priv->in_info)) {
+      GstMemory *mem = gst_buffer_peek_memory (*outbuf, i);
+      tex_id = ((GstGLMemory *) mem)->tex_id;
+    }
+
+    upload->texture_ids[i] = tex_id;
+  }
+
+  GST_LOG ("Uploading with GLTextureUploadMeta with textures %i,%i,%i,%i",
+      upload->texture_ids[0], upload->texture_ids[1], upload->texture_ids[2],
+      upload->texture_ids[3]);
+
+  gst_gl_context_thread_add (upload->upload->context,
+      (GstGLContextThreadFunc) _do_upload_with_meta, upload);
+
+  if (!upload->result)
+    return GST_GL_UPLOAD_ERROR;
+
+  return GST_GL_UPLOAD_DONE;
+}
+
+static void
+_upload_meta_upload_release (gpointer impl, GstBuffer * buffer)
+{
+}
+
+static void
+_upload_meta_upload_free (gpointer impl)
+{
+  struct GLUploadMeta *upload = impl;
+  gint i;
+
+  g_return_if_fail (impl != NULL);
+
+  for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
+    if (upload->texture_ids[i])
+      gst_gl_context_del_texture (upload->upload->context,
+          &upload->texture_ids[i]);
+  }
+  g_free (upload);
+}
+
+static const UploadMethod _upload_meta_upload = {
+  "UploadMeta",
+  METHOD_FLAG_CAN_SHARE_CONTEXT,
+  &_upload_meta_upload_new,
+  &_upload_meta_upload_transform_caps,
+  &_upload_meta_upload_accept,
+  &_upload_meta_upload_propose_allocation,
+  &_upload_meta_upload_perform,
+  &_upload_meta_upload_release,
+  &_upload_meta_upload_free
+};
+
+struct RawUpload
+{
+  GstGLUpload *upload;
+  GstGLMemory *in_tex[GST_VIDEO_MAX_PLANES];
+  GstVideoFrame in_frame;
+};
+
+static gpointer
+_raw_data_upload_new (GstGLUpload * upload)
+{
+  struct RawUpload *raw = g_new0 (struct RawUpload, 1);
+
+  raw->upload = upload;
+
+  return raw;
+}
+
+static GstCaps *
+_raw_data_upload_transform_caps (GstGLContext * context,
+    GstPadDirection direction, GstCaps * caps)
+{
+  GstCaps *ret;
+
+  if (direction == GST_PAD_SINK) {
+    ret = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  } else {
+    ret = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
+  }
+
+  return ret;
+}
+
+static gboolean
+_raw_data_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
+    GstCaps * out_caps)
+{
+  struct RawUpload *raw = impl;
+  GstCapsFeatures *features, *gl_features;
+  gboolean ret = TRUE;
+
+  gl_features =
+      gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  features = gst_caps_get_features (out_caps, 0);
+  if (!gst_caps_features_is_equal (features, gl_features))
+    ret = FALSE;
+
+  gst_caps_features_free (gl_features);
+
+  if (!ret)
+    return ret;
+
+  if (buffer) {
+    if (!gst_video_frame_map (&raw->in_frame, &raw->upload->priv->in_info,
+            buffer, GST_MAP_READ))
+      return FALSE;
+
+    raw->upload->priv->in_info = raw->in_frame.info;
+  }
+
+  return TRUE;
+}
+
+static void
+_raw_data_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
+    GstQuery * query)
+{
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
+}
+
+static GstGLUploadReturn
+_raw_data_upload_perform (gpointer impl, GstBuffer * buffer,
+    GstBuffer ** outbuf)
+{
+  struct RawUpload *raw = impl;
+  int i;
+
+  if (!raw->in_tex[0])
+    gst_gl_memory_setup_wrapped (raw->upload->context,
+        &raw->upload->priv->in_info, NULL, raw->in_frame.data, raw->in_tex);
+
+  for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
+    if (raw->in_tex[i]) {
+      raw->in_tex[i]->data = raw->in_frame.data[i];
+      GST_GL_MEMORY_FLAG_SET (raw->in_tex[i], GST_GL_MEMORY_FLAG_NEED_UPLOAD);
+    }
+  }
+
+  *outbuf = gst_buffer_new ();
+  for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&raw->upload->priv->in_info); i++) {
+    gst_buffer_append_memory (*outbuf,
+        gst_memory_ref ((GstMemory *) raw->in_tex[i]));
+  }
+
+  return GST_GL_UPLOAD_DONE;
+}
+
+static void
+_raw_data_upload_release (gpointer impl, GstBuffer * buffer)
+{
+  struct RawUpload *raw = impl;
+
+  gst_video_frame_unmap (&raw->in_frame);
+}
+
+static void
+_raw_data_upload_free (gpointer impl)
+{
+  struct RawUpload *raw = impl;
+  int i;
+
+  for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
+    if (raw->in_tex[i])
+      gst_memory_unref ((GstMemory *) raw->in_tex[i]);
+  }
+  g_free (raw);
+}
+
+static const UploadMethod _raw_data_upload = {
+  "Raw Data",
+  0,
+  &_raw_data_upload_new,
+  &_raw_data_upload_transform_caps,
+  &_raw_data_upload_accept,
+  &_raw_data_upload_propose_allocation,
+  &_raw_data_upload_perform,
+  &_raw_data_upload_release,
+  &_raw_data_upload_free
+};
+
+static const UploadMethod *upload_methods[] = { &_gl_memory_upload,
+#if GST_GL_HAVE_PLATFORM_EGL
+  &_egl_image_upload,
+#endif
+  &_upload_meta_upload, &_raw_data_upload
+};
 
 #define DEBUG_INIT \
   GST_DEBUG_CATEGORY_INIT (gst_gl_upload_debug, "glupload", 0, "upload");
@@ -77,6 +802,7 @@
 G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT,
     DEBUG_INIT);
 static void gst_gl_upload_finalize (GObject * object);
+static void gst_gl_upload_release_buffer_unlocked (GstGLUpload * upload);
 
 #define GST_GL_UPLOAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
     GST_TYPE_GL_UPLOAD, GstGLUploadPrivate))
@@ -93,11 +819,6 @@
 gst_gl_upload_init (GstGLUpload * upload)
 {
   upload->priv = GST_GL_UPLOAD_GET_PRIVATE (upload);
-
-  upload->context = NULL;
-  upload->priv->tex_id = 0;
-
-  gst_video_info_set_format (&upload->in_info, GST_VIDEO_FORMAT_ENCODED, 0, 0);
 }
 
 /**
@@ -109,12 +830,19 @@
 GstGLUpload *
 gst_gl_upload_new (GstGLContext * context)
 {
-  GstGLUpload *upload;
-
-  upload = g_object_new (GST_TYPE_GL_UPLOAD, NULL);
+  GstGLUpload *upload = g_object_new (GST_TYPE_GL_UPLOAD, NULL);
+  gint i, n;
 
   upload->context = gst_object_ref (context);
-  upload->convert = gst_gl_color_convert_new (context);
+
+  n = G_N_ELEMENTS (upload_methods);
+  upload->priv->upload_impl = g_malloc (sizeof (gpointer) * n);
+  for (i = 0; i < n; i++) {
+    upload->priv->upload_impl[i] = upload_methods[i]->new (upload);
+  }
+
+  GST_DEBUG_OBJECT (upload, "Created new GLUpload for context %" GST_PTR_FORMAT,
+      context);
 
   return upload;
 }
@@ -123,436 +851,274 @@
 gst_gl_upload_finalize (GObject * object)
 {
   GstGLUpload *upload;
+  gint i, n;
 
   upload = GST_GL_UPLOAD (object);
 
-  gst_gl_upload_reset (upload);
+  gst_gl_upload_release_buffer_unlocked (upload);
+
+  if (upload->priv->method_impl)
+    upload->priv->method->free (upload->priv->method_impl);
+  upload->priv->method_i = 0;
 
   if (upload->context) {
     gst_object_unref (upload->context);
     upload->context = NULL;
   }
 
+  if (upload->priv->in_caps) {
+    gst_caps_unref (upload->priv->in_caps);
+    upload->priv->in_caps = NULL;
+  }
+
+  if (upload->priv->out_caps) {
+    gst_caps_unref (upload->priv->out_caps);
+    upload->priv->out_caps = NULL;
+  }
+
+  n = G_N_ELEMENTS (upload_methods);
+  for (i = 0; i < n; i++) {
+    if (upload->priv->upload_impl[i])
+      upload_methods[i]->free (upload->priv->upload_impl[i]);
+  }
+  g_free (upload->priv->upload_impl);
+
   G_OBJECT_CLASS (gst_gl_upload_parent_class)->finalize (object);
 }
 
-static void
-gst_gl_upload_reset (GstGLUpload * upload)
+GstCaps *
+gst_gl_upload_transform_caps (GstGLContext * context, GstPadDirection direction,
+    GstCaps * caps, GstCaps * filter)
 {
-  guint i;
+  GstCaps *result, *tmp;
+  gint i;
 
-  if (upload->priv->tex_id) {
-    gst_gl_context_del_texture (upload->context, &upload->priv->tex_id);
-    upload->priv->tex_id = 0;
+  tmp = gst_caps_new_empty ();
+
+  for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) {
+    GstCaps *tmp2 =
+        upload_methods[i]->transform_caps (context, direction, caps);
+
+    if (tmp2)
+      tmp = gst_caps_merge (tmp, tmp2);
   }
 
-  if (upload->convert) {
-    gst_object_unref (upload->convert);
-    upload->convert = NULL;
+  if (filter) {
+    result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+  } else {
+    result = tmp;
   }
 
-  if (upload->out_tex) {
-    gst_memory_unref ((GstMemory *) upload->out_tex);
-    upload->out_tex = NULL;
-  }
-
-  for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
-    if (upload->in_tex[i]) {
-      gst_memory_unref ((GstMemory *) upload->in_tex[i]);
-      upload->in_tex[i] = NULL;
-    }
-  }
-
-  gst_gl_upload_release_buffer (upload);
-}
-
-static void
-_gst_gl_upload_set_format_unlocked (GstGLUpload * upload,
-    GstVideoInfo * in_info)
-{
-  g_return_if_fail (upload != NULL);
-  g_return_if_fail (GST_VIDEO_INFO_FORMAT (in_info) !=
-      GST_VIDEO_FORMAT_UNKNOWN);
-  g_return_if_fail (GST_VIDEO_INFO_FORMAT (in_info) !=
-      GST_VIDEO_FORMAT_ENCODED);
-
-  if (gst_video_info_is_equal (&upload->in_info, in_info))
-    return;
-
-  gst_gl_upload_reset (upload);
-  upload->convert = gst_gl_color_convert_new (upload->context);
-  upload->in_info = *in_info;
-  upload->initted = FALSE;
+  return result;
 }
 
 /**
- * gst_gl_upload_set_format:
+ * gst_gl_upload_propose_allocation:
  * @upload: a #GstGLUpload
- * @in_info: input #GstVideoInfo
+ * @decide_query: (allow-none): a #GstQuery from a decide allocation
+ * @query: the proposed allocation query
  *
- * Initializes @upload with the information required for upload.
+ * Adds the required allocation parameters to support uploading.
  */
 void
-gst_gl_upload_set_format (GstGLUpload * upload, GstVideoInfo * in_info)
+gst_gl_upload_propose_allocation (GstGLUpload * upload, GstQuery * decide_query,
+    GstQuery * query)
 {
-  GST_OBJECT_LOCK (upload);
-  _gst_gl_upload_set_format_unlocked (upload, in_info);
-  GST_OBJECT_UNLOCK (upload);
+  gint i;
+
+  for (i = 0; i < G_N_ELEMENTS (upload_methods); i++)
+    upload_methods[i]->propose_allocation (upload->priv->upload_impl[i],
+        decide_query, query);
+}
+
+static gboolean
+_gst_gl_upload_set_caps_unlocked (GstGLUpload * upload, GstCaps * in_caps,
+    GstCaps * out_caps)
+{
+  g_return_val_if_fail (upload != NULL, FALSE);
+  g_return_val_if_fail (gst_caps_is_fixed (in_caps), FALSE);
+
+  if (upload->priv->in_caps && upload->priv->out_caps
+      && gst_caps_is_equal (upload->priv->in_caps, in_caps)
+      && gst_caps_is_equal (upload->priv->out_caps, out_caps))
+    return TRUE;
+
+  gst_caps_replace (&upload->priv->in_caps, in_caps);
+  gst_caps_replace (&upload->priv->out_caps, out_caps);
+
+  gst_video_info_from_caps (&upload->priv->in_info, in_caps);
+  gst_video_info_from_caps (&upload->priv->out_info, out_caps);
+
+  if (upload->priv->method_impl)
+    upload->priv->method->free (upload->priv->method_impl);
+  upload->priv->method_impl = NULL;
+  upload->priv->method_i = 0;
+
+  return TRUE;
 }
 
 /**
- * gst_gl_upload_get_format:
+ * gst_gl_upload_set_caps:
  * @upload: a #GstGLUpload
+ * @in_caps: input #GstCaps
+ * @out_caps: output #GstCaps
  *
- * Returns: (transfer none): The #GstVideoInfo set by gst_gl_upload_set_format()
+ * Initializes @upload with the information required for upload.
+ *
+ * Returns: whether @in_caps and @out_caps could be set on @upload
  */
-GstVideoInfo *
-gst_gl_upload_get_format (GstGLUpload * upload)
+gboolean
+gst_gl_upload_set_caps (GstGLUpload * upload, GstCaps * in_caps,
+    GstCaps * out_caps)
 {
-  GstVideoInfo *ret;
+  gboolean ret;
 
   GST_OBJECT_LOCK (upload);
-  ret = &upload->in_info;
+  ret = _gst_gl_upload_set_caps_unlocked (upload, in_caps, out_caps);
   GST_OBJECT_UNLOCK (upload);
 
   return ret;
 }
 
 /**
+ * gst_gl_upload_get_caps:
+ * @upload: a #GstGLUpload
+ * @in_caps: (transfer full): (allow-none): (out): the input #GstCaps
+ * @ou_caps: (transfer full): (allow-none): (out): the output #GstCaps
+ *
+ * Returns: (transfer none): The #GstCaps set by gst_gl_upload_set_caps()
+ */
+void
+gst_gl_upload_get_caps (GstGLUpload * upload, GstCaps ** in_caps,
+    GstCaps ** out_caps)
+{
+  GST_OBJECT_LOCK (upload);
+  if (in_caps)
+    *in_caps =
+        upload->priv->in_caps ? gst_caps_ref (upload->priv->in_caps) : NULL;
+  if (out_caps)
+    *out_caps =
+        upload->priv->out_caps ? gst_caps_ref (upload->priv->out_caps) : NULL;
+  GST_OBJECT_UNLOCK (upload);
+}
+
+static void
+gst_gl_upload_release_buffer_unlocked (GstGLUpload * upload)
+{
+  if (upload->priv->outbuf && upload->priv->method_impl) {
+    upload->priv->method->release (upload->priv->method_impl,
+        upload->priv->outbuf);
+    gst_buffer_replace (&upload->priv->outbuf, NULL);
+  }
+}
+
+/**
+ * gst_gl_upload_release_buffer:
+ * @upload: a #GstGLUpload
+ *
+ * Releases any buffers currently referenced by @upload
+ */
+void
+gst_gl_upload_release_buffer (GstGLUpload * upload)
+{
+  g_return_if_fail (upload != NULL);
+
+  GST_OBJECT_LOCK (upload);
+  gst_gl_upload_release_buffer_unlocked (upload);
+  GST_OBJECT_UNLOCK (upload);
+}
+
+static gboolean
+_upload_find_method (GstGLUpload * upload)
+{
+  if (upload->priv->method_i >= G_N_ELEMENTS (upload_methods))
+    return FALSE;
+
+  if (upload->priv->method_impl) {
+    upload->priv->method->free (upload->priv->method_impl);
+    upload->priv->method_impl = NULL;
+  }
+
+  upload->priv->method = upload_methods[upload->priv->method_i];
+  upload->priv->method_impl = upload->priv->method->new (upload);
+
+  GST_DEBUG_OBJECT (upload, "attempting upload with uploader %s",
+      upload->priv->method->name);
+
+  upload->priv->method_i++;
+
+  return TRUE;
+}
+
+/**
  * gst_gl_upload_perform_with_buffer:
  * @upload: a #GstGLUpload
  * @buffer: a #GstBuffer
- * @tex_id: resulting texture
+ * @outbuf_ptr: (allow-none): resulting buffer
  *
  * Uploads @buffer to the texture given by @tex_id.  @tex_id is valid
  * until gst_gl_upload_release_buffer() is called.
  *
  * Returns: whether the upload was successful
  */
-gboolean
+GstGLUploadReturn
 gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
-    guint * tex_id)
+    GstBuffer ** outbuf_ptr)
 {
-  GstMemory *mem;
-  GstVideoGLTextureUploadMeta *gl_tex_upload_meta;
-  guint texture_ids[] = { 0, 0, 0, 0 };
-  gint i;
-  gboolean ret;
+  GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
 
-  g_return_val_if_fail (upload != NULL, FALSE);
-  g_return_val_if_fail (buffer != NULL, FALSE);
-  g_return_val_if_fail (tex_id != NULL, FALSE);
-  g_return_val_if_fail (gst_buffer_n_memory (buffer) > 0, FALSE);
-
-  gst_gl_upload_release_buffer (upload);
-
-  /* GstGLMemory */
-  mem = gst_buffer_peek_memory (buffer, 0);
-
-  if (gst_is_gl_memory (mem)) {
-    GstGLMemory *gl_mem = (GstGLMemory *) gst_buffer_peek_memory (buffer, 0);
-
-    if (!gst_gl_context_can_share (upload->context, gl_mem->context))
-      goto raw_data_upload;
-
-    if (GST_VIDEO_INFO_FORMAT (&upload->in_info) == GST_VIDEO_FORMAT_RGBA) {
-      GstMapInfo map_info;
-
-      gst_memory_map (mem, &map_info, GST_MAP_READ | GST_MAP_GL);
-      gst_memory_unmap (mem, &map_info);
-
-      *tex_id = ((GstGLMemory *) mem)->tex_id;
-      return TRUE;
-    }
-
-    GST_LOG_OBJECT (upload, "Attempting upload with GstGLMemory");
-    for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->in_info); i++) {
-      upload->in_tex[i] = (GstGLMemory *) gst_buffer_peek_memory (buffer, i);
-    }
-
-    ret = _upload_memory (upload);
-
-    *tex_id = upload->out_tex->tex_id;
-    for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->in_info); i++) {
-      upload->in_tex[i] = NULL;
-    }
-    return ret;
-  }
-#if GST_GL_HAVE_PLATFORM_EGL
-  if (!upload->priv->tex_id && gst_is_egl_image_memory (mem))
-    gst_gl_context_gen_texture (upload->context, &upload->priv->tex_id,
-        GST_VIDEO_FORMAT_RGBA, 0, 0);
-#endif
-
-  if (!upload->priv->tex_id)
-    gst_gl_context_gen_texture (upload->context, &upload->priv->tex_id,
-        GST_VIDEO_FORMAT_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),
-        GST_VIDEO_INFO_HEIGHT (&upload->in_info));
-
-  /* GstVideoGLTextureUploadMeta */
-  gl_tex_upload_meta = gst_buffer_get_video_gl_texture_upload_meta (buffer);
-  if (gl_tex_upload_meta) {
-    GST_LOG_OBJECT (upload, "Attempting upload with "
-        "GstVideoGLTextureUploadMeta");
-    texture_ids[0] = upload->priv->tex_id;
-
-    if (!gst_gl_upload_perform_with_gl_texture_upload_meta (upload,
-            gl_tex_upload_meta, texture_ids)) {
-      GST_DEBUG_OBJECT (upload, "Upload with GstVideoGLTextureUploadMeta "
-          "failed");
-    } else {
-      upload->priv->mapped = FALSE;
-      *tex_id = upload->priv->tex_id;
-      return TRUE;
-    }
-  }
-
-raw_data_upload:
-  GST_LOG_OBJECT (upload, "Attempting upload with raw data");
-  /* GstVideoMeta map */
-  if (!gst_video_frame_map (&upload->priv->frame, &upload->in_info, buffer,
-          GST_MAP_READ)) {
-    GST_ERROR_OBJECT (upload, "Failed to map memory");
-    return FALSE;
-  }
-  upload->priv->mapped = TRUE;
-
-  /* update the video info from the one updated by frame_map using video meta */
-  gst_gl_upload_set_format (upload, &upload->priv->frame.info);
-
-  if (!gst_gl_upload_perform_with_data (upload, tex_id,
-          upload->priv->frame.data)) {
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-void
-gst_gl_upload_release_buffer (GstGLUpload * upload)
-{
-  g_return_if_fail (upload != NULL);
-
-  if (upload->priv->mapped)
-    gst_video_frame_unmap (&upload->priv->frame);
-  upload->priv->mapped = FALSE;
-
-  if (upload->priv->outbuf) {
-    gst_buffer_unref (upload->priv->outbuf);
-    upload->priv->outbuf = NULL;
-  }
-
-  upload->priv->released = TRUE;
-}
-
-/*
- * Uploads using gst_video_gl_texture_upload_meta_upload().
- * i.e. consumer of GstVideoGLTextureUploadMeta
- */
-static void
-_do_upload_with_meta (GstGLContext * context, GstGLUpload * upload)
-{
-  guint texture_ids[] = { upload->priv->tex_id, 0, 0, 0 };
-
-  if (!gst_video_gl_texture_upload_meta_upload (upload->priv->meta,
-          texture_ids))
-    goto error;
-
-  upload->priv->result = TRUE;
-  return;
-
-error:
-  upload->priv->result = FALSE;
-}
-
-/**
- * gst_gl_upload_perform_with_gl_texture_upload_meta:
- * @upload: a #GstGLUpload
- * @meta: a #GstVideoGLTextureUploadMeta
- * @texture_id: resulting GL textures to place the data into.
- *
- * Uploads @meta into @texture_id.
- *
- * Returns: whether the upload was successful
- */
-gboolean
-gst_gl_upload_perform_with_gl_texture_upload_meta (GstGLUpload * upload,
-    GstVideoGLTextureUploadMeta * meta, guint texture_id[4])
-{
-  gboolean ret;
-
-  g_return_val_if_fail (upload != NULL, FALSE);
-  g_return_val_if_fail (meta != NULL, FALSE);
-
-  if (meta->texture_orientation !=
-      GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL)
-    GST_FIXME_OBJECT (upload, "only x-normal,y-normal textures supported, "
-        "the images will not appear the right way up");
-  if (meta->texture_type[0] != GST_VIDEO_GL_TEXTURE_TYPE_RGBA) {
-    GST_FIXME_OBJECT (upload, "only single rgba texture supported");
-    return FALSE;
-  }
+  g_return_val_if_fail (GST_IS_GL_UPLOAD (upload), FALSE);
+  g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
 
   GST_OBJECT_LOCK (upload);
 
-  upload->priv->meta = meta;
-  if (!upload->priv->tex_id)
-    gst_gl_context_gen_texture (upload->context, &upload->priv->tex_id,
-        GST_VIDEO_FORMAT_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),
-        GST_VIDEO_INFO_HEIGHT (&upload->in_info));
+  gst_gl_upload_release_buffer_unlocked (upload);
 
-  GST_LOG ("Uploading with GLTextureUploadMeta with textures %i,%i,%i,%i",
-      texture_id[0], texture_id[1], texture_id[2], texture_id[3]);
+#define NEXT_METHOD \
+do { \
+  if (!_upload_find_method (upload)) { \
+    GST_OBJECT_UNLOCK (upload); \
+    return FALSE; \
+  } \
+  goto restart; \
+} while (0)
 
-  gst_gl_context_thread_add (upload->context,
-      (GstGLContextThreadFunc) _do_upload_with_meta, upload);
+  if (!upload->priv->method_impl)
+    _upload_find_method (upload);
 
-  ret = upload->priv->result;
+restart:
+  if (!upload->priv->method->accept (upload->priv->method_impl, buffer,
+          upload->priv->in_caps, upload->priv->out_caps))
+    NEXT_METHOD;
+
+  ret =
+      upload->priv->method->perform (upload->priv->method_impl, buffer,
+      &upload->priv->outbuf);
+  if (ret == GST_GL_UPLOAD_UNSHARED_GL_CONTEXT) {
+    upload->priv->method->free (upload->priv->method_impl);
+    upload->priv->method = &_raw_data_upload;
+    upload->priv->method_impl = upload->priv->method->new (upload);
+    goto restart;
+  } else if (ret == GST_GL_UPLOAD_DONE) {
+    /* we are done */
+  } else {
+    gst_gl_upload_release_buffer_unlocked (upload);
+    upload->priv->method->free (upload->priv->method_impl);
+    upload->priv->method_impl = NULL;
+    NEXT_METHOD;
+  }
+
+  if (outbuf_ptr) {
+    if (buffer != upload->priv->outbuf)
+      gst_buffer_copy_into (upload->priv->outbuf, buffer,
+          GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
+    *outbuf_ptr = gst_buffer_ref (upload->priv->outbuf);
+  }
 
   GST_OBJECT_UNLOCK (upload);
 
   return ret;
-}
 
-/**
- * gst_gl_upload_perform_with_data:
- * @upload: a #GstGLUpload
- * @texture_id: (out): the texture id to upload into
- * @data: where the downloaded data should go
- *
- * Uploads @data into @texture_id. data size and format is specified by
- * the #GstVideoInfo<!--  -->s passed to gst_gl_upload_set_format() 
- *
- * Returns: whether the upload was successful
- */
-gboolean
-gst_gl_upload_perform_with_data (GstGLUpload * upload, GLuint * texture_id,
-    gpointer data[GST_VIDEO_MAX_PLANES])
-{
-  gboolean ret;
-
-  g_return_val_if_fail (upload != NULL, FALSE);
-
-  GST_OBJECT_LOCK (upload);
-  ret = _gst_gl_upload_perform_with_data_unlocked (upload, texture_id, data);
-  GST_OBJECT_UNLOCK (upload);
-
-  return ret;
-}
-
-static gboolean
-_gst_gl_upload_perform_with_data_unlocked (GstGLUpload * upload,
-    GLuint * texture_id, gpointer data[GST_VIDEO_MAX_PLANES])
-{
-  gboolean ret;
-  guint i;
-
-  g_return_val_if_fail (upload != NULL, FALSE);
-  g_return_val_if_fail (texture_id != NULL, FALSE);
-
-  if (!upload->in_tex[0])
-    gst_gl_memory_setup_wrapped (upload->context, &upload->in_info, data,
-        upload->in_tex);
-
-  for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
-    if (upload->in_tex[i]) {
-      upload->in_tex[i]->data = data[i];
-      GST_GL_MEMORY_FLAG_SET (upload->in_tex[i],
-          GST_GL_MEMORY_FLAG_NEED_UPLOAD);
-    }
-  }
-
-  ret = _upload_memory (upload);
-  *texture_id = upload->out_tex->tex_id;
-
-  return ret;
-}
-
-/* Called in the gl thread */
-static gboolean
-_init_upload (GstGLUpload * upload)
-{
-  GstGLFuncs *gl;
-  GstVideoFormat v_format;
-  GstVideoInfo out_info;
-
-  gl = upload->context->gl_vtable;
-
-  v_format = GST_VIDEO_INFO_FORMAT (&upload->in_info);
-
-  GST_INFO ("Initializing texture upload for format:%s",
-      gst_video_format_to_string (v_format));
-
-  if (!gl->CreateProgramObject && !gl->CreateProgram) {
-    gst_gl_context_set_error (upload->context,
-        "Cannot upload YUV formats without OpenGL shaders");
-    goto error;
-  }
-
-  gst_video_info_set_format (&out_info, GST_VIDEO_FORMAT_RGBA,
-      GST_VIDEO_INFO_WIDTH (&upload->in_info),
-      GST_VIDEO_INFO_HEIGHT (&upload->in_info));
-
-  gst_gl_color_convert_set_format (upload->convert, &upload->in_info,
-      &out_info);
-
-  upload->out_tex = gst_gl_memory_wrapped_texture (upload->context, 0,
-      GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),
-      GST_VIDEO_INFO_HEIGHT (&upload->in_info), NULL, NULL);
-
-  upload->initted = TRUE;
-
-  return TRUE;
-
-error:
-  return FALSE;
-}
-
-static gboolean
-_upload_memory (GstGLUpload * upload)
-{
-  guint in_width, in_height;
-  guint in_texture[GST_VIDEO_MAX_PLANES];
-  GstBuffer *inbuf;
-  GstVideoFrame out_frame;
-  GstVideoInfo out_info;
-  gint i;
-
-  in_width = GST_VIDEO_INFO_WIDTH (&upload->in_info);
-  in_height = GST_VIDEO_INFO_HEIGHT (&upload->in_info);
-
-  if (!upload->initted) {
-    if (!_init_upload (upload)) {
-      return FALSE;
-    }
-  }
-
-  inbuf = gst_buffer_new ();
-  for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->in_info); i++) {
-    in_texture[i] = upload->in_tex[i]->tex_id;
-    gst_buffer_append_memory (inbuf,
-        gst_memory_ref ((GstMemory *) upload->in_tex[i]));
-  }
-
-  GST_TRACE ("uploading with textures:%u,%u,%u dimensions:%ux%u",
-      in_texture[0], in_texture[1], in_texture[2], in_width, in_height);
-
-  upload->priv->outbuf = gst_gl_color_convert_perform (upload->convert, inbuf);
-  gst_buffer_unref (inbuf);
-
-  gst_video_info_set_format (&out_info, GST_VIDEO_FORMAT_RGBA, in_width,
-      in_height);
-  if (!gst_video_frame_map (&out_frame, &out_info, upload->priv->outbuf,
-          GST_MAP_READ | GST_MAP_GL)) {
-    gst_buffer_unref (upload->priv->outbuf);
-    upload->priv->outbuf = NULL;
-    return FALSE;
-  }
-
-  upload->out_tex->tex_id = *(guint *) out_frame.data[0];
-
-  gst_video_frame_unmap (&out_frame);
-  upload->priv->released = FALSE;
-
-  return TRUE;
+#undef NEXT_METHOD
 }
diff --git a/gst-libs/gst/gl/gstglupload.h b/gst-libs/gst/gl/gstglupload.h
index 21943b9..8652891 100644
--- a/gst-libs/gst/gl/gstglupload.h
+++ b/gst-libs/gst/gl/gstglupload.h
@@ -22,7 +22,6 @@
 #define __GST_GL_UPLOAD_H__
 
 #include <gst/video/video.h>
-#include <gst/gstmemory.h>
 
 #include <gst/gl/gstgl_fwd.h>
 
@@ -37,6 +36,22 @@
 #define GST_GL_UPLOAD_CAST(obj) ((GstGLUpload*)(obj))
 
 /**
+ * GstGLUploadReturn:
+ * @GST_GL_UPLOAD_DONE: No further processing required
+ * @GST_GL_UPLOAD_ERROR: An unspecified error occured
+ * @GST_GL_UPLOAD_UNSUPPORTED: The configuration is unsupported.
+ */
+typedef enum
+{
+  GST_GL_UPLOAD_DONE = 1,
+
+  GST_GL_UPLOAD_ERROR = -1,
+  GST_GL_UPLOAD_UNSUPPORTED = -2,
+  /* <private> */
+  GST_GL_UPLOAD_UNSHARED_GL_CONTEXT = -3,
+} GstGLUploadReturn;
+
+/**
  * GstGLUpload
  *
  * Opaque #GstGLUpload object
@@ -47,17 +62,7 @@
   GstObject        parent;
 
   GstGLContext    *context;
-  GstGLColorConvert *convert;
 
-  /* input data */
-  GstVideoInfo     in_info;
-
-  gboolean         initted;
-
-  GstGLMemory     *in_tex[GST_VIDEO_MAX_PLANES];
-  GstGLMemory     *out_tex;
-
-  /* <private> */
   GstGLUploadPrivate *priv;
 
   gpointer _reserved[GST_PADDING];
@@ -73,17 +78,26 @@
   GstObjectClass object_class;
 };
 
-GstGLUpload * gst_gl_upload_new            (GstGLContext * context);
+GstGLUpload * gst_gl_upload_new                    (GstGLContext * context);
 
-void           gst_gl_upload_set_format    (GstGLUpload * upload, GstVideoInfo * in_info);
-GstVideoInfo * gst_gl_upload_get_format    (GstGLUpload * upload);
+GstCaps *     gst_gl_upload_transform_caps         (GstGLContext * context,
+                                                    GstPadDirection direction,
+                                                    GstCaps * caps,
+                                                    GstCaps * filter);
+gboolean      gst_gl_upload_set_caps               (GstGLUpload * upload,
+                                                    GstCaps * in_caps,
+                                                    GstCaps * out_caps);
+void          gst_gl_upload_get_caps               (GstGLUpload * upload,
+                                                    GstCaps ** in_caps,
+                                                    GstCaps ** out_caps);
+void          gst_gl_upload_propose_allocation     (GstGLUpload * upload,
+                                                    GstQuery * decide_query,
+                                                    GstQuery * query);
 
-gboolean gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer, guint * tex_id);
-void gst_gl_upload_release_buffer (GstGLUpload * upload);
-gboolean gst_gl_upload_perform_with_data          (GstGLUpload * upload, GLuint * texture_id,
-                                                   gpointer data[GST_VIDEO_MAX_PLANES]);
-
-gboolean gst_gl_upload_perform_with_gl_texture_upload_meta (GstGLUpload *upload, GstVideoGLTextureUploadMeta *meta, guint texture_id[4]);
+GstGLUploadReturn gst_gl_upload_perform_with_buffer (GstGLUpload * upload,
+                                                    GstBuffer * buffer,
+                                                    GstBuffer ** outbuf);
+void              gst_gl_upload_release_buffer     (GstGLUpload * upload);
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/gl/gstgluploadmeta.c b/gst-libs/gst/gl/gstgluploadmeta.c
index fe70d28..5edf29b 100644
--- a/gst-libs/gst/gl/gstgluploadmeta.c
+++ b/gst-libs/gst/gl/gstgluploadmeta.c
@@ -100,6 +100,8 @@
 
   upload->context = gst_object_ref (context);
 
+  GST_DEBUG_OBJECT (upload, "Created upload for context %"GST_PTR_FORMAT, upload->context);
+  
   return upload;
 }
 
@@ -108,6 +110,7 @@
 {
   GstGLUploadMeta *upload;
 
+  GST_DEBUG_OBJECT (object, "Finalizing");
   upload = GST_GL_UPLOAD_META (object);
 
   gst_gl_upload_meta_reset (upload);
@@ -219,12 +222,13 @@
       GST_GL_MEMORY_FLAG_SET (in_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
     } else {
       GstGLMemory *out_mem;
+      gint mem_width, mem_height;
 
-      if (!upload->priv->out_tex[i])
+      if (!upload->priv->out_tex[i]) {
+        /* the GL upload meta creates GL_TEXTURE_2D textures */
         upload->priv->out_tex[i] = gst_gl_memory_wrapped_texture (upload->context,
-            texture_id[i], meta->texture_type[i],
-            GST_VIDEO_INFO_WIDTH (&upload->info),
-            GST_VIDEO_INFO_HEIGHT (&upload->info), NULL, NULL);
+            texture_id[i], GL_TEXTURE_2D, &upload->info, i, NULL, NULL, NULL);
+      }
 
       out_mem = upload->priv->out_tex[i];
 
@@ -233,8 +237,12 @@
         GST_GL_MEMORY_FLAG_SET (out_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
       }
 
+      mem_width = gst_gl_memory_get_texture_width (out_mem);
+      mem_height = gst_gl_memory_get_texture_height (out_mem);
+
       if (!(res = gst_gl_memory_copy_into_texture (in_mem, out_mem->tex_id,
-            out_mem->tex_type, out_mem->width, out_mem->height, out_mem->stride,
+            out_mem->tex_type, mem_width, mem_height,
+            GST_VIDEO_INFO_PLANE_STRIDE (&out_mem->info, out_mem->plane),
             FALSE)))
         break;
     }
@@ -253,9 +261,7 @@
   for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->info); i++) {
     if (!upload->priv->in_tex[i])
       upload->priv->in_tex[i] = gst_gl_memory_wrapped (upload->context,
-          meta->texture_type[i], GST_VIDEO_INFO_WIDTH (&upload->info),
-          GST_VIDEO_INFO_HEIGHT (&upload->info),
-          GST_VIDEO_INFO_PLANE_STRIDE (&upload->info, i), data[i], NULL, NULL);
+          &upload->info, i, NULL, data[i], NULL, NULL);
 
     upload->priv->in_tex[i]->data = data[i];
   }
diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c
index c2ea06f..e4d9cad 100644
--- a/gst-libs/gst/gl/gstglutils.c
+++ b/gst-libs/gst/gl/gstglutils.c
@@ -290,7 +290,7 @@
     case GST_VIDEO_FORMAT_Y42B:
     case GST_VIDEO_FORMAT_Y41B:
     {
-      stride[comp] = GST_ROUND_UP_4 (GST_VIDEO_INFO_COMP_WIDTH (info, comp));;
+      stride[comp] = GST_ROUND_UP_4 (GST_VIDEO_INFO_COMP_WIDTH (info, comp));
       size[comp] = stride[comp] * GST_VIDEO_INFO_COMP_HEIGHT (info, comp);
       if (comp == 0)
         offset[0] = 0;
@@ -341,68 +341,6 @@
   return TRUE;
 }
 
-typedef struct _UseFBO
-{
-  GstGLFramebuffer *frame;
-  gint texture_fbo_width;
-  gint texture_fbo_height;
-  GLuint fbo;
-  GLuint depth_buffer;
-  GLuint texture_fbo;
-  GLCB cb;
-  gint input_tex_width;
-  gint input_tex_height;
-  GLuint input_tex;
-  gdouble proj_param1;
-  gdouble proj_param2;
-  gdouble proj_param3;
-  gdouble proj_param4;
-  GstGLDisplayProjection projection;
-  gpointer stuff;
-} UseFBO;
-
-static void
-_use_fbo (GstGLContext * context, UseFBO * data)
-{
-  gst_gl_framebuffer_use (data->frame, data->texture_fbo_width,
-      data->texture_fbo_height, data->fbo, data->depth_buffer,
-      data->texture_fbo, data->cb, data->input_tex_width,
-      data->input_tex_height, data->input_tex, data->proj_param1,
-      data->proj_param2, data->proj_param3, data->proj_param4, data->projection,
-      data->stuff);
-}
-
-/* Called by glfilter */
-/* this function really has to be simplified...  do we really need to
-   set projection this way? Wouldn't be better a set_projection
-   separate call? or just make glut functions available out of
-   gst-libs and call it if needed on drawcallback? -- Filippo */
-/* GLCB too.. I think that only needed parameters should be
- * GstGLDisplay *display and gpointer data, or just gpointer data */
-/* ..everything here has to be simplified! */
-gboolean
-gst_gl_context_use_fbo (GstGLContext * context, gint texture_fbo_width,
-    gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
-    GLuint texture_fbo, GLCB cb, gint input_tex_width,
-    gint input_tex_height, GLuint input_tex, gdouble proj_param1,
-    gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
-    GstGLDisplayProjection projection, gpointer stuff)
-{
-  GstGLFramebuffer *frame = gst_gl_framebuffer_new (context);
-
-  UseFBO data =
-      { frame, texture_fbo_width, texture_fbo_height, fbo, depth_buffer,
-    texture_fbo, cb, input_tex_width, input_tex_height, input_tex,
-    proj_param1, proj_param2, proj_param3, proj_param4, projection, stuff
-  };
-
-  gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _use_fbo, &data);
-
-  gst_object_unref (frame);
-
-  return TRUE;
-}
-
 typedef struct _UseFBO2
 {
   GstGLFramebuffer *frame;
@@ -549,7 +487,7 @@
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
 
 static gboolean
-context_pad_query (const GValue * item, GValue * value, gpointer user_data)
+pad_query (const GValue * item, GValue * value, gpointer user_data)
 {
   GstPad *pad = g_value_get_object (item);
   GstQuery *query = user_data;
@@ -562,16 +500,16 @@
     return FALSE;
   }
 
-  GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "context pad peer query failed");
+  GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "pad peer query failed");
   return TRUE;
 }
 
-static gboolean
-run_context_query (GstElement * element, GstQuery * query,
+gboolean
+gst_gl_run_query (GstElement * element, GstQuery * query,
     GstPadDirection direction)
 {
   GstIterator *it;
-  GstIteratorFoldFunction func = context_pad_query;
+  GstIteratorFoldFunction func = pad_query;
   GValue res = { 0 };
 
   g_value_init (&res, G_TYPE_BOOLEAN);
@@ -592,8 +530,8 @@
 }
 
 static GstQuery *
-_gst_gl_display_context_query (GstElement * element,
-    GstGLDisplay ** display_ptr, const gchar * display_type)
+_gst_context_query (GstElement * element,
+    gpointer ptr, const gchar * display_type)
 {
   GstQuery *query;
   GstContext *ctxt;
@@ -603,11 +541,11 @@
    *  2b) Query upstream as above.
    */
   query = gst_query_new_context (display_type);
-  if (run_context_query (element, query, GST_PAD_SRC)) {
+  if (gst_gl_run_query (element, query, GST_PAD_SRC)) {
     gst_query_parse_context (query, &ctxt);
     GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
         "found context (%p) in downstream query", ctxt);
-  } else if (run_context_query (element, query, GST_PAD_SINK)) {
+  } else if (gst_gl_run_query (element, query, GST_PAD_SINK)) {
     gst_query_parse_context (query, &ctxt);
     GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
         "found context (%p) in upstream query", ctxt);
@@ -623,7 +561,7 @@
     GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
         "posting need context message");
     msg = gst_message_new_need_context (GST_OBJECT_CAST (element),
-        GST_GL_DISPLAY_CONTEXT_TYPE);
+        display_type);
     gst_element_post_message (element, msg);
   }
 
@@ -637,11 +575,10 @@
 }
 
 static void
-gst_gl_display_context_prepare (GstElement * element,
-    GstGLDisplay ** display_ptr)
+gst_gl_display_context_query (GstElement * element, GstGLDisplay ** display_ptr)
 {
-  GstContext *ctxt;
-  GstQuery *query;
+  GstContext *ctxt = NULL;
+  GstQuery *query = NULL;
 
 #ifndef GST_DISABLE_GST_DEBUG
   if (!GST_CAT_CONTEXT)
@@ -649,19 +586,21 @@
 #endif
 
   query =
-      _gst_gl_display_context_query (element, display_ptr,
-      GST_GL_DISPLAY_CONTEXT_TYPE);
+      _gst_context_query (element, display_ptr, GST_GL_DISPLAY_CONTEXT_TYPE);
   gst_query_parse_context (query, &ctxt);
+
   if (ctxt && gst_context_has_context_type (ctxt, GST_GL_DISPLAY_CONTEXT_TYPE)) {
-    gst_context_get_gl_display (ctxt, display_ptr);
-    if (*display_ptr)
-      goto out;
+    GstGLDisplay *tmp_disp = NULL;
+    if (gst_context_get_gl_display (ctxt, &tmp_disp) && tmp_disp)
+      *display_ptr = tmp_disp;
   }
+
+  if (*display_ptr)
+    goto out;
+
 #if GST_GL_HAVE_WINDOW_X11
   gst_query_unref (query);
-  query =
-      _gst_gl_display_context_query (element, display_ptr,
-      "gst.x11.display.handle");
+  query = _gst_context_query (element, display_ptr, "gst.x11.display.handle");
   gst_query_parse_context (query, &ctxt);
   if (ctxt && gst_context_has_context_type (ctxt, "gst.x11.display.handle")) {
     const GstStructure *s;
@@ -672,15 +611,41 @@
         && display) {
       *display_ptr =
           (GstGLDisplay *) gst_gl_display_x11_new_with_display (display);
-      goto out;
     }
   }
+
+  if (*display_ptr)
+    goto out;
 #endif
 
 out:
   gst_query_unref (query);
 }
 
+static void
+gst_gl_context_query (GstElement * element, GstGLContext ** context_ptr)
+{
+  GstContext *ctxt;
+  GstQuery *query;
+
+#ifndef GST_DISABLE_GST_DEBUG
+  if (!GST_CAT_CONTEXT)
+    GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
+#endif
+
+  query = _gst_context_query (element, context_ptr, "gst.gl.app_context");
+  gst_query_parse_context (query, &ctxt);
+  if (ctxt && gst_context_has_context_type (ctxt, "gst.gl.app_context")) {
+    const GstStructure *s = gst_context_get_structure (ctxt);
+    GstGLContext *tmp_ctx = NULL;
+    if (gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, &tmp_ctx, NULL)
+        && tmp_ctx)
+      *context_ptr = tmp_ctx;
+  }
+
+  gst_query_unref (query);
+}
+
 /*  4) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT
  *     message.
  */
@@ -705,25 +670,27 @@
 }
 
 gboolean
-gst_gl_ensure_display (gpointer element, GstGLDisplay ** display_ptr)
+gst_gl_ensure_element_data (gpointer element, GstGLDisplay ** display_ptr,
+    GstGLContext ** context_ptr)
 {
   GstGLDisplay *display;
 
   g_return_val_if_fail (element != NULL, FALSE);
   g_return_val_if_fail (display_ptr != NULL, FALSE);
+  g_return_val_if_fail (context_ptr != NULL, FALSE);
 
   /*  1) Check if the element already has a context of the specific
    *     type.
    */
   display = *display_ptr;
   if (gst_gl_display_found (element, display))
-    return TRUE;
+    goto done;
 
-  gst_gl_display_context_prepare (element, display_ptr);
+  gst_gl_display_context_query (element, display_ptr);
 
   /* Neighbour found and it updated the display */
   if (gst_gl_display_found (element, *display_ptr))
-    return TRUE;
+    goto get_gl_context;
 
   /* If no neighboor, or application not interested, use system default */
   display = gst_gl_display_new ();
@@ -732,17 +699,26 @@
 
   gst_gl_display_context_propagate (element, display);
 
-  return display != NULL;
+get_gl_context:
+  if (*context_ptr)
+    goto done;
+
+  gst_gl_context_query (element, context_ptr);
+
+done:
+  return *display_ptr != NULL;
 }
 
 gboolean
 gst_gl_handle_set_context (GstElement * element, GstContext * context,
-    GstGLDisplay ** display)
+    GstGLDisplay ** display, GstGLContext ** other_context)
 {
-  GstGLDisplay *replacement = NULL;
+  GstGLDisplay *display_replacement = NULL;
+  GstGLContext *context_replacement = NULL;
   const gchar *context_type;
 
-  g_return_val_if_fail (display, FALSE);
+  g_return_val_if_fail (display != NULL, FALSE);
+  g_return_val_if_fail (other_context != NULL, FALSE);
 
   if (!context)
     return FALSE;
@@ -750,7 +726,7 @@
   context_type = gst_context_get_context_type (context);
 
   if (g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
-    if (!gst_context_get_gl_display (context, &replacement)) {
+    if (!gst_context_get_gl_display (context, &display_replacement)) {
       GST_WARNING_OBJECT (element, "Failed to get display from context");
       return FALSE;
     }
@@ -762,14 +738,43 @@
 
     s = gst_context_get_structure (context);
     if (gst_structure_get (s, "display", G_TYPE_POINTER, &display, NULL))
-      replacement =
+      display_replacement =
           (GstGLDisplay *) gst_gl_display_x11_new_with_display (display);
   }
 #endif
+  else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
+    const GstStructure *s = gst_context_get_structure (context);
+    GstGLDisplay *context_display;
+    GstGLDisplay *element_display;
 
-  if (replacement) {
+    if (gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT,
+            &context_replacement, NULL)) {
+      context_display = gst_gl_context_get_display (context_replacement);
+      element_display = display_replacement ? display_replacement : *display;
+      if (element_display
+          && (gst_gl_display_get_handle_type (element_display) &
+              gst_gl_display_get_handle_type (context_display)) == 0) {
+        GST_ELEMENT_WARNING (element, LIBRARY, SETTINGS, ("%s",
+                "Cannot set a GL context with a different display type"), ("%s",
+                "Cannot set a GL context with a different display type"));
+        gst_object_unref (context_replacement);
+        context_replacement = NULL;
+      }
+      gst_object_unref (context_display);
+    }
+  }
+
+  if (display_replacement) {
     GstGLDisplay *old = *display;
-    *display = replacement;
+    *display = display_replacement;
+
+    if (old)
+      gst_object_unref (old);
+  }
+
+  if (context_replacement) {
+    GstGLContext *old = *other_context;
+    *other_context = context_replacement;
 
     if (old)
       gst_object_unref (old);
@@ -780,7 +785,7 @@
 
 gboolean
 gst_gl_handle_context_query (GstElement * element, GstQuery * query,
-    GstGLDisplay ** display)
+    GstGLDisplay ** display, GstGLContext ** other_context)
 {
   gboolean res = FALSE;
   const gchar *context_type;
@@ -789,6 +794,7 @@
   g_return_val_if_fail (element != NULL, FALSE);
   g_return_val_if_fail (query != NULL, FALSE);
   g_return_val_if_fail (display != NULL, FALSE);
+  g_return_val_if_fail (other_context != NULL, FALSE);
 
   gst_query_parse_context_type (query, &context_type);
 
@@ -833,6 +839,68 @@
     res = x11_display != NULL;
   }
 #endif
+  else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
+    GstStructure *s;
+
+    gst_query_parse_context (query, &old_context);
+
+    if (old_context)
+      context = gst_context_copy (old_context);
+    else
+      context = gst_context_new ("gst.gl.app_context", TRUE);
+
+    s = gst_context_writable_structure (context);
+    gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, *other_context, NULL);
+    gst_query_set_context (query, context);
+    gst_context_unref (context);
+
+    res = *other_context != NULL;
+  }
 
   return res;
 }
+
+gsize
+gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
+    guint plane)
+{
+  gint padded_height;
+  gsize plane_size;
+
+  padded_height = info->height;
+
+  if (align)
+    padded_height += align->padding_top + align->padding_bottom;
+
+  padded_height =
+      GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info->finfo, plane, padded_height);
+
+  plane_size = GST_VIDEO_INFO_PLANE_STRIDE (info, plane) * padded_height;
+
+  return plane_size;
+}
+
+GstCaps *
+gst_gl_caps_replace_all_caps_features (const GstCaps * caps,
+    const gchar * feature_name)
+{
+  GstCaps *tmp = gst_caps_copy (caps);
+  guint n = gst_caps_get_size (tmp);
+  guint i = 0;
+
+  for (i = 0; i < n; i++) {
+    GstCapsFeatures *features = gst_caps_get_features (tmp, i);
+    if (features) {
+      guint n_f = gst_caps_features_get_size (features);
+      guint j = 0;
+      for (j = 0; j < n_f; j++) {
+        gst_caps_features_remove_id (features,
+            gst_caps_features_get_nth_id (features, j));
+      }
+    }
+
+    gst_caps_features_add (features, feature_name);
+  }
+
+  return tmp;
+}
diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h
index 13c39ea..c915bfb 100644
--- a/gst-libs/gst/gl/gstglutils.h
+++ b/gst-libs/gst/gl/gstglutils.h
@@ -76,12 +76,6 @@
 
 gboolean gst_gl_context_gen_fbo (GstGLContext * context, gint width, gint height,
     GLuint * fbo, GLuint * depthbuffer);
-gboolean gst_gl_context_use_fbo (GstGLContext * context, gint texture_fbo_width,
-    gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
-    GLuint texture_fbo, GLCB cb, gint input_texture_width,
-    gint input_texture_height, GLuint input_texture, gdouble proj_param1,
-    gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
-    GstGLDisplayProjection projection, gpointer stuff);
 gboolean gst_gl_context_use_fbo_v2 (GstGLContext * context, gint texture_fbo_width,
     gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
     GLuint texture_fbo, GLCB_V2 cb, gpointer stuff);
@@ -98,11 +92,19 @@
 void gst_gl_context_set_error (GstGLContext * context, const char * format, ...);
 gchar *gst_gl_context_get_error (void);
 
-gboolean gst_gl_ensure_display (gpointer element, GstGLDisplay **display_ptr);
+gboolean gst_gl_ensure_element_data (gpointer element,
+    GstGLDisplay **display_ptr, GstGLContext ** other_context_ptr);
 gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context, 
-    GstGLDisplay ** display);
+    GstGLDisplay ** display, GstGLContext ** other_context);
 gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query, 
-    GstGLDisplay ** display);
+    GstGLDisplay ** display, GstGLContext ** other_context);
+
+gboolean gst_gl_run_query (GstElement * element,
+    GstQuery * query, GstPadDirection direction);
+gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
+    guint plane);
+GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps,
+    const gchar * feature_name);
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
index a35ca05..984033a 100644
--- a/gst-libs/gst/gl/gstglwindow.c
+++ b/gst-libs/gst/gl/gstglwindow.c
@@ -79,10 +79,16 @@
 
 static void gst_gl_window_default_send_message (GstGLWindow * window,
     GstGLWindowCB callback, gpointer data);
+static gpointer gst_gl_window_navigation_thread (GstGLWindow * window);
+void gst_gl_window_run_navigation (GstGLWindow * window);
+void gst_gl_window_open_navigation (GstGLWindow * window);
+void gst_gl_window_close_navigation (GstGLWindow * window);
+void gst_gl_window_quit_navigation (GstGLWindow * window);
 
 struct _GstGLWindowPrivate
 {
   GThread *gl_thread;
+  GThread *navigation_thread;
 
   gboolean alive;
 };
@@ -106,6 +112,16 @@
 
 GstGLDummyWindow *gst_gl_dummy_window_new (void);
 
+enum
+{
+  SIGNAL_0,
+  EVENT_MOUSE_SIGNAL,
+  EVENT_KEY_SIGNAL,
+  LAST_SIGNAL
+};
+
+static guint gst_gl_window_signals[LAST_SIGNAL] = { 0 };
+
 GQuark
 gst_gl_window_error_quark (void)
 {
@@ -118,6 +134,11 @@
   window->priv = GST_GL_WINDOW_GET_PRIVATE (window);
 
   g_mutex_init (&window->lock);
+  g_mutex_init (&window->nav_lock);
+  g_cond_init (&window->nav_create_cond);
+  g_cond_init (&window->nav_destroy_cond);
+  window->nav_created = FALSE;
+  window->nav_alive = FALSE;
   window->is_drawing = FALSE;
 
   g_weak_ref_init (&window->context_ref, NULL);
@@ -131,6 +152,38 @@
   klass->send_message = GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message);
 
   G_OBJECT_CLASS (klass)->finalize = gst_gl_window_finalize;
+
+  /**
+   * GstGLWindow::mouse-event:
+   * @object: the #GstGLWindow
+   * @id: the name of the event
+   * @button: the id of the button
+   * @x: the x coordinate of the mouse event
+   * @y: the y coordinate of the mouse event
+   *
+   * Will be emitted when a mouse event is received by the GstGLwindow.
+   *
+   * Since: 1.6
+   */
+  gst_gl_window_signals[EVENT_MOUSE_SIGNAL] =
+      g_signal_new ("mouse-event", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
+
+  /**
+   * GstGLWindow::key-event:
+   * @object: the #GstGLWindow
+   * @id: the name of the event
+   * @key: the id of the key pressed
+   *
+   * Will be emitted when a key event is received by the GstGLwindow.
+   *
+   * Since: 1.6
+   */
+  gst_gl_window_signals[EVENT_KEY_SIGNAL] =
+      g_signal_new ("key-event", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
+      G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
 }
 
 /**
@@ -197,6 +250,17 @@
 
   window->display = gst_object_ref (display);
 
+  g_mutex_lock (&window->nav_lock);
+
+  if (!window->nav_created) {
+    window->priv->navigation_thread = g_thread_new ("gstglnavigation",
+        (GThreadFunc) gst_gl_window_navigation_thread, window);
+
+    g_cond_wait (&window->nav_create_cond, &window->nav_lock);
+    window->nav_created = TRUE;
+  }
+  g_mutex_unlock (&window->nav_lock);
+
   return window;
 }
 
@@ -205,14 +269,53 @@
 {
   GstGLWindow *window = GST_GL_WINDOW (object);
 
+  if (window->nav_alive) {
+    g_mutex_lock (&window->nav_lock);
+    GST_INFO ("send quit navigation loop");
+    gst_gl_window_quit_navigation (window);
+    while (window->nav_alive) {
+      g_cond_wait (&window->nav_destroy_cond, &window->nav_lock);
+    }
+    g_mutex_unlock (&window->nav_lock);
+  }
+
   g_weak_ref_clear (&window->context_ref);
 
   g_mutex_clear (&window->lock);
+  g_mutex_clear (&window->nav_lock);
+  g_cond_clear (&window->nav_create_cond);
+  g_cond_clear (&window->nav_destroy_cond);
   gst_object_unref (window->display);
 
   G_OBJECT_CLASS (gst_gl_window_parent_class)->finalize (object);
 }
 
+typedef struct _GstSetWindowHandleCb
+{
+  GstGLWindow *window;
+  guintptr handle;
+} GstSetWindowHandleCb;
+
+static void
+_set_window_handle_cb (GstSetWindowHandleCb * data)
+{
+  GstGLContext *context = gst_gl_window_get_context (data->window);
+  GstGLWindowClass *window_class = GST_GL_WINDOW_GET_CLASS (data->window);
+
+  gst_gl_context_activate (context, FALSE);
+  window_class->set_window_handle (data->window, data->handle);
+  gst_gl_context_activate (context, TRUE);
+
+  gst_object_unref (context);
+}
+
+static void
+_free_swh_cb (GstSetWindowHandleCb * data)
+{
+  gst_object_unref (data->window);
+  g_slice_free (GstSetWindowHandleCb, data);
+}
+
 /**
  * gst_gl_window_set_window_handle:
  * @window: a #GstGLWindow
@@ -227,27 +330,35 @@
 gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle)
 {
   GstGLWindowClass *window_class;
+  GstSetWindowHandleCb *data;
 
   g_return_if_fail (GST_GL_IS_WINDOW (window));
   g_return_if_fail (handle != 0);
   window_class = GST_GL_WINDOW_GET_CLASS (window);
   g_return_if_fail (window_class->set_window_handle != NULL);
 
-  window_class->set_window_handle (window, handle);
+  data = g_slice_new (GstSetWindowHandleCb);
+  data->window = gst_object_ref (window);
+  data->handle = handle;
+
+  /* FIXME: Move to a message which deactivates, calls implementation, activates */
+  gst_gl_window_send_message_async (window,
+      (GstGLWindowCB) _set_window_handle_cb, data,
+      (GDestroyNotify) _free_swh_cb);
+
+  /* window_class->set_window_handle (window, handle); */
 }
 
 /**
  * gst_gl_window_draw_unlocked:
  * @window: a #GstGLWindow
- * @width: requested width of the window
- * @height: requested height of the window
  *
  * Redraw the window contents.  Implementations should invoke the draw callback.
  *
  * Since: 1.4
  */
 void
-gst_gl_window_draw_unlocked (GstGLWindow * window, guint width, guint height)
+gst_gl_window_draw_unlocked (GstGLWindow * window)
 {
   GstGLWindowClass *window_class;
 
@@ -255,21 +366,19 @@
   window_class = GST_GL_WINDOW_GET_CLASS (window);
   g_return_if_fail (window_class->draw_unlocked != NULL);
 
-  window_class->draw_unlocked (window, width, height);
+  window_class->draw_unlocked (window);
 }
 
 /**
  * gst_gl_window_draw:
  * @window: a #GstGLWindow
- * @width: requested width of the window
- * @height: requested height of the window
  *
  * Redraw the window contents.  Implementations should invoke the draw callback.
  *
  * Since: 1.4
  */
 void
-gst_gl_window_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_window_draw (GstGLWindow * window)
 {
   GstGLWindowClass *window_class;
 
@@ -282,7 +391,50 @@
     return;
   }
 
-  window_class->draw (window, width, height);
+  window_class->draw (window);
+}
+
+/**
+ * gst_gl_window_set_preferred_size:
+ * @window: a #GstGLWindow
+ * @width: new preferred width
+ * @height: new preferred height
+ *
+ * Set the preferred width and height of the window.  Implementations are free
+ * to ignore this information.
+ *
+ * Since: 1.6
+ */
+void
+gst_gl_window_set_preferred_size (GstGLWindow * window, gint width, gint height)
+{
+  GstGLWindowClass *window_class;
+
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+  window_class = GST_GL_WINDOW_GET_CLASS (window);
+
+  if (window_class->set_preferred_size)
+    window_class->set_preferred_size (window, width, height);
+}
+
+/**
+ * gst_gl_window_show:
+ * @window: a #GstGLWindow
+ *
+ * Present the window to the screen.
+ *
+ * Since: 1.6
+ */
+void
+gst_gl_window_show (GstGLWindow * window)
+{
+  GstGLWindowClass *window_class;
+
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+  window_class = GST_GL_WINDOW_GET_CLASS (window);
+
+  if (window_class->show)
+    window_class->show (window);
 }
 
 /**
@@ -307,6 +459,23 @@
 }
 
 /**
+ * gst_gl_window_run_navigation:
+ * @window: a #GstGLWindow
+ *
+ * Start the execution of the navigation runloop.
+ *
+ * Since: 1.6
+ */
+void
+gst_gl_window_run_navigation (GstGLWindow * window)
+{
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+  g_return_if_fail (window->navigation_context != NULL);
+  g_return_if_fail (window->navigation_loop != NULL);
+  g_main_loop_run (window->navigation_loop);
+}
+
+/**
  * gst_gl_window_quit:
  * @window: a #GstGLWindow
  *
@@ -591,6 +760,25 @@
   return (GstGLContext *) g_weak_ref_get (&window->context_ref);
 }
 
+/**
+ * gst_gl_window_get_surface_dimensions:
+ * @window: a #GstGLWindow
+ * @width: (out): resulting surface width
+ * @height: (out): resulting surface height
+ *
+ * Since: 1.6
+ */
+void
+gst_gl_window_get_surface_dimensions (GstGLWindow * window, guint * width,
+    guint * height)
+{
+  GstGLWindowClass *window_class;
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+  window_class = GST_GL_WINDOW_GET_CLASS (window);
+  g_return_if_fail (window_class->get_surface_dimensions != NULL);
+  window_class->get_surface_dimensions (window, width, height);
+}
+
 GType gst_gl_dummy_window_get_type (void);
 
 G_DEFINE_TYPE (GstGLDummyWindow, gst_gl_dummy_window, GST_GL_TYPE_WINDOW);
@@ -631,6 +819,54 @@
   g_main_loop_run (dummy->loop);
 }
 
+void
+gst_gl_window_open_navigation (GstGLWindow * window)
+{
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+  g_mutex_lock (&window->nav_lock);
+  window->navigation_context = g_main_context_new ();
+  window->navigation_loop = g_main_loop_new (window->navigation_context, FALSE);
+  g_main_context_push_thread_default (window->navigation_context);
+  window->nav_alive = TRUE;
+  g_cond_signal (&window->nav_create_cond);
+  g_mutex_unlock (&window->nav_lock);
+}
+
+void
+gst_gl_window_close_navigation (GstGLWindow * window)
+{
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+  g_return_if_fail (window->navigation_context != NULL);
+  g_return_if_fail (window->navigation_loop != NULL);
+
+  g_mutex_lock (&window->nav_lock);
+  window->nav_alive = FALSE;
+  g_main_context_pop_thread_default (window->navigation_context);
+  g_main_loop_unref (window->navigation_loop);
+  g_main_context_unref (window->navigation_context);
+  g_cond_signal (&window->nav_destroy_cond);
+  g_mutex_unlock (&window->nav_lock);
+}
+
+void
+gst_gl_window_quit_navigation (GstGLWindow * window)
+{
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+
+  g_main_loop_quit (window->navigation_loop);
+}
+
+static gpointer
+gst_gl_window_navigation_thread (GstGLWindow * window)
+{
+  gst_gl_window_open_navigation (window);
+  gst_gl_window_run_navigation (window);
+  GST_INFO ("navigation loop exited\n");
+  gst_gl_window_close_navigation (window);
+
+  return NULL;
+}
+
 typedef struct _GstGLMessage
 {
   GstGLWindowCB callback;
@@ -686,17 +922,10 @@
   return (guintptr) dummy->handle;
 }
 
-struct draw
-{
-  GstGLDummyWindow *window;
-  guint width, height;
-};
-
 static void
 draw_cb (gpointer data)
 {
-  struct draw *draw_data = data;
-  GstGLDummyWindow *dummy = draw_data->window;
+  GstGLDummyWindow *dummy = data;
   GstGLWindow *window = GST_GL_WINDOW (dummy);
   GstGLContext *context = gst_gl_window_get_context (window);
   GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
@@ -710,15 +939,9 @@
 }
 
 static void
-gst_gl_dummy_window_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_dummy_window_draw (GstGLWindow * window)
 {
-  struct draw draw_data;
-
-  draw_data.window = (GstGLDummyWindow *) window;
-  draw_data.width = width;
-  draw_data.height = height;
-
-  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
 }
 
 static guintptr
@@ -728,6 +951,12 @@
 }
 
 static void
+gst_gl_dummy_window_get_surface_dimensions (GstGLWindow * window, guint * width,
+    guint * height)
+{
+}
+
+static void
 gst_gl_dummy_window_class_init (GstGLDummyWindowClass * klass)
 {
   GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
@@ -746,6 +975,8 @@
       GST_DEBUG_FUNCPTR (gst_gl_dummy_window_send_message_async);
   window_class->open = GST_DEBUG_FUNCPTR (gst_gl_dummy_window_open);
   window_class->close = GST_DEBUG_FUNCPTR (gst_gl_dummy_window_close);
+  window_class->get_surface_dimensions =
+      GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_surface_dimensions);
 }
 
 static void
@@ -759,3 +990,70 @@
 {
   return g_object_new (gst_gl_dummy_window_get_type (), NULL);
 }
+
+gboolean
+gst_gl_window_key_event_cb (gpointer data)
+{
+  struct key_event *key_data = (struct key_event *) data;
+  GST_DEBUG
+      ("%s called data struct %p window %p key %s event %s ",
+      __func__, key_data, key_data->window, key_data->key_str,
+      key_data->event_type);
+  gst_gl_window_send_key_event (GST_GL_WINDOW (key_data->window),
+      key_data->event_type, key_data->key_str);
+  g_slice_free (struct key_event, key_data);
+  return G_SOURCE_REMOVE;
+}
+
+void
+gst_gl_window_send_key_event (GstGLWindow * window, const char *event_type,
+    const char *key_str)
+{
+  g_signal_emit (window, gst_gl_window_signals[EVENT_KEY_SIGNAL], 0,
+      event_type, key_str);
+}
+
+gboolean
+gst_gl_window_mouse_event_cb (gpointer data)
+{
+  struct mouse_event *mouse_data = (struct mouse_event *) data;
+  GST_DEBUG ("%s called data struct %p mouse event %s button %d at %g, %g",
+      __func__, mouse_data, mouse_data->event_type, mouse_data->button,
+      mouse_data->posx, mouse_data->posy);
+  gst_gl_window_send_mouse_event (GST_GL_WINDOW (mouse_data->window),
+      mouse_data->event_type, mouse_data->button, mouse_data->posx,
+      mouse_data->posy);
+  g_slice_free (struct mouse_event, mouse_data);
+  return G_SOURCE_REMOVE;
+}
+
+void
+gst_gl_window_send_mouse_event (GstGLWindow * window, const char *event_type,
+    int button, double posx, double posy)
+{
+  g_signal_emit (window, gst_gl_window_signals[EVENT_MOUSE_SIGNAL], 0,
+      event_type, button, posx, posy);
+}
+
+/**
+ * gst_gl_window_handle_events:
+ * @window: a #GstGLWindow
+ * @handle_events: a #gboolean indicating if events should be handled or not.
+ *
+ * Tell a @window that it should handle events from the window system. These
+ * events are forwarded upstream as navigation events. In some window systems
+ * events are not propagated in the window hierarchy if a client is listening
+ * for them. This method allows you to disable events handling completely
+ * from the @window.
+ */
+void
+gst_gl_window_handle_events (GstGLWindow * window, gboolean handle_events)
+{
+  GstGLWindowClass *window_class;
+
+  g_return_if_fail (GST_GL_IS_WINDOW (window));
+  window_class = GST_GL_WINDOW_GET_CLASS (window);
+
+  if (window_class->handle_events)
+    window_class->handle_events (window, handle_events);
+}
diff --git a/gst-libs/gst/gl/gstglwindow.h b/gst-libs/gst/gl/gstglwindow.h
index 518661f..bd13417 100644
--- a/gst-libs/gst/gl/gstglwindow.h
+++ b/gst-libs/gst/gl/gstglwindow.h
@@ -67,6 +67,11 @@
   GstObject parent;
 
   GMutex        lock;
+  GMutex        nav_lock;
+  GCond         nav_create_cond;
+  GCond         nav_destroy_cond;
+  gboolean      nav_created;
+  gboolean      nav_alive;
 
   GstGLDisplay *display;
   GWeakRef      context_ref;
@@ -86,9 +91,12 @@
   GDestroyNotify        resize_notify;
 
   /*< private >*/
-  gpointer _reserved[GST_PADDING];
+  GMainContext *navigation_context;
+  GMainLoop *navigation_loop;
 
   GstGLWindowPrivate *priv;
+
+  gpointer _reserved[GST_PADDING];
 };
 
 /**
@@ -107,6 +115,13 @@
  *                      not have been called.  Required to be reentrant.
  * @open: open the connection to the display
  * @close: close the connection to the display
+ * @get_surface_dimensions: get the width and height of the surface we are
+ *                          rendering into.
+ * @handle_events: whether to handle 'extra' events from the windowing system.
+ *                 Basic events like surface moves and resizes are still valid
+ *                 things to listen for.
+ * @set_preferred_size: request that the window change surface size.  The
+ *                      implementation is free to ignore this information.
  */
 struct _GstGLWindowClass {
   GstObjectClass parent_class;
@@ -114,8 +129,8 @@
   guintptr (*get_display)        (GstGLWindow *window);
   void     (*set_window_handle)  (GstGLWindow *window, guintptr id);
   guintptr (*get_window_handle)  (GstGLWindow *window);
-  void     (*draw_unlocked)      (GstGLWindow *window, guint width, guint height);
-  void     (*draw)               (GstGLWindow *window, guint width, guint height);
+  void     (*draw_unlocked)      (GstGLWindow *window);
+  void     (*draw)               (GstGLWindow *window);
   void     (*run)                (GstGLWindow *window);
   void     (*quit)               (GstGLWindow *window);
   void     (*send_message)       (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
@@ -123,35 +138,92 @@
 
   gboolean (*open)               (GstGLWindow *window, GError **error);
   void     (*close)              (GstGLWindow *window);
+  void     (*get_surface_dimensions)  (GstGLWindow *window, guint *width, guint *height);
+  void     (*handle_events)      (GstGLWindow *window, gboolean handle_events);
+  void     (*set_preferred_size) (GstGLWindow *window, gint width, gint height);
+  void     (*show)               (GstGLWindow *window);
 
   /*< private >*/
   gpointer _reserved[GST_PADDING];
 };
 
-/* methods */
+struct key_event
+{
+  GstGLWindow *window;
+  const char *event_type;
+  const char *key_str;
+};
+
+struct mouse_event
+{
+  GstGLWindow *window;
+  const char *event_type;
+  int button;
+  double posx;
+  double posy;
+};
 
 GQuark gst_gl_window_error_quark (void);
 GType gst_gl_window_get_type     (void);
 
 GstGLWindow * gst_gl_window_new  (GstGLDisplay *display);
 
-void     gst_gl_window_set_draw_callback    (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify);
-void     gst_gl_window_set_resize_callback  (GstGLWindow *window, GstGLWindowResizeCB callback, gpointer data, GDestroyNotify destroy_notify);
-void     gst_gl_window_set_close_callback   (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify);
+/* callbacks */
+void     gst_gl_window_set_draw_callback    (GstGLWindow *window,
+                                             GstGLWindowCB callback,
+                                             gpointer data,
+                                             GDestroyNotify destroy_notify);
+void     gst_gl_window_set_resize_callback  (GstGLWindow *window,
+                                             GstGLWindowResizeCB callback,
+                                             gpointer data,
+                                             GDestroyNotify destroy_notify);
+void     gst_gl_window_set_close_callback   (GstGLWindow *window,
+                                             GstGLWindowCB callback,
+                                             gpointer data,
+                                             GDestroyNotify destroy_notify);
 
 void     gst_gl_window_set_window_handle    (GstGLWindow *window, guintptr handle);
 guintptr gst_gl_window_get_window_handle    (GstGLWindow *window);
-void     gst_gl_window_draw_unlocked        (GstGLWindow *window, guint width, guint height);
-void     gst_gl_window_draw                 (GstGLWindow *window, guint width, guint height);
+
+/* loop/events */
 void     gst_gl_window_run                  (GstGLWindow *window);
 void     gst_gl_window_quit                 (GstGLWindow *window);
-void     gst_gl_window_send_message         (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
-void     gst_gl_window_send_message_async   (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
-guintptr gst_gl_window_get_display          (GstGLWindow *window);
+gboolean gst_gl_window_is_running           (GstGLWindow *window);
+void     gst_gl_window_send_message         (GstGLWindow *window,
+                                             GstGLWindowCB callback,
+                                             gpointer data);
+void     gst_gl_window_send_message_async   (GstGLWindow *window,
+                                             GstGLWindowCB callback,
+                                             gpointer data,
+                                             GDestroyNotify destroy);
 
-GstGLContext * gst_gl_window_get_context (GstGLWindow *window);
+/* navigation */
+void     gst_gl_window_handle_events        (GstGLWindow * window,
+                                             gboolean handle_events);
+gboolean gst_gl_window_key_event_cb         (gpointer data);
+gboolean gst_gl_window_mouse_event_cb       (gpointer data);
+void     gst_gl_window_send_key_event       (GstGLWindow * window,
+                                             const char * event_type,
+                                             const char * key_str);
+void     gst_gl_window_send_mouse_event     (GstGLWindow * window,
+                                             const char * event_type,
+                                             int button,
+                                             double posx,
+                                             double posy);
 
-gboolean gst_gl_window_is_running (GstGLWindow *window);
+/* surfaces/rendering */
+void     gst_gl_window_draw_unlocked        (GstGLWindow *window);
+void     gst_gl_window_draw                 (GstGLWindow *window);
+void     gst_gl_window_show                 (GstGLWindow *window);
+void     gst_gl_window_set_preferred_size   (GstGLWindow * window,
+                                             gint width,
+                                             gint height);
+void     gst_gl_window_get_surface_dimensions (GstGLWindow * window,
+                                               guint * width,
+                                               guint * height);
+
+GstGLContext * gst_gl_window_get_context    (GstGLWindow *window);
+guintptr       gst_gl_window_get_display    (GstGLWindow *window);
 
 GST_DEBUG_CATEGORY_EXTERN (gst_gl_window_debug);
 
diff --git a/gst-libs/gst/gl/wayland/Makefile.in b/gst-libs/gst/gl/wayland/Makefile.in
index 8ff9ecf..3265600 100644
--- a/gst-libs/gst/gl/wayland/Makefile.in
+++ b/gst-libs/gst/gl/wayland/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -216,8 +216,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -256,7 +260,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -264,6 +267,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -313,8 +318,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -393,7 +396,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -402,7 +404,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -415,7 +416,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -440,6 +440,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -513,10 +515,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -542,6 +548,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -578,6 +587,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -618,17 +628,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -645,6 +654,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
index d5853b0..271a677 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -41,13 +41,13 @@
 #define gst_gl_window_wayland_egl_parent_class parent_class
 G_DEFINE_TYPE (GstGLWindowWaylandEGL, gst_gl_window_wayland_egl,
     GST_GL_TYPE_WINDOW);
+static void gst_gl_window_wayland_egl_finalize (GObject * object);
 
 static guintptr gst_gl_window_wayland_egl_get_window_handle (GstGLWindow *
     window);
 static void gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
     guintptr handle);
-static void gst_gl_window_wayland_egl_draw (GstGLWindow * window, guint width,
-    guint height);
+static void gst_gl_window_wayland_egl_draw (GstGLWindow * window);
 static void gst_gl_window_wayland_egl_run (GstGLWindow * window);
 static void gst_gl_window_wayland_egl_quit (GstGLWindow * window);
 static void gst_gl_window_wayland_egl_send_message_async (GstGLWindow * window,
@@ -91,6 +91,40 @@
 pointer_handle_motion (void *data, struct wl_pointer *pointer, uint32_t time,
     wl_fixed_t sx_w, wl_fixed_t sy_w)
 {
+  GstGLWindowWaylandEGL *window_egl = data;
+
+  window_egl->display.pointer_x = wl_fixed_to_double (sx_w);
+  window_egl->display.pointer_y = wl_fixed_to_double (sy_w);
+}
+
+enum wl_edges
+{
+  WL_EDGE_NONE = 0,
+  WL_EDGE_TOP = 1,
+  WL_EDGE_BOTTOM = 2,
+  WL_EDGE_LEFT = 4,
+  WL_EDGE_RIGHT = 8,
+};
+
+static guint
+_get_closest_pointer_corner (GstGLWindowWaylandEGL * window_egl)
+{
+  guint edges = 0;
+  gdouble win_width, win_height;
+  gdouble p_x, p_y;
+
+  win_width = (gdouble) window_egl->window.window_width;
+  win_height = (gdouble) window_egl->window.window_height;
+  p_x = window_egl->display.pointer_x;
+  p_y = window_egl->display.pointer_y;
+
+  if (win_width == 0.0 || win_height == 0.0)
+    return WL_EDGE_NONE;
+
+  edges |= win_width / 2.0 - p_x < 0.0 ? WL_EDGE_RIGHT : WL_EDGE_LEFT;
+  edges |= win_height / 2.0 - p_y < 0.0 ? WL_EDGE_BOTTOM : WL_EDGE_TOP;
+
+  return edges;
 }
 
 static void
@@ -98,11 +132,16 @@
     uint32_t time, uint32_t button, uint32_t state_w)
 {
   GstGLWindowWaylandEGL *window_egl = data;
+  guint edges = _get_closest_pointer_corner (window_egl);
   window_egl->display.serial = serial;
 
   if (button == BTN_LEFT && state_w == WL_POINTER_BUTTON_STATE_PRESSED)
     wl_shell_surface_move (window_egl->window.shell_surface,
         window_egl->display.seat, serial);
+
+  if (button == BTN_RIGHT && state_w == WL_POINTER_BUTTON_STATE_PRESSED)
+    wl_shell_surface_resize (window_egl->window.shell_surface,
+        window_egl->display.seat, serial, edges);
 }
 
 static void
@@ -154,6 +193,10 @@
 handle_ping (void *data, struct wl_shell_surface *shell_surface,
     uint32_t serial)
 {
+  GstGLWindowWaylandEGL *window_egl = data;
+
+  GST_TRACE_OBJECT (window_egl, "ping received serial %u", serial);
+
   wl_shell_surface_pong (shell_surface, serial);
 }
 
@@ -166,7 +209,8 @@
 {
   GstGLWindowWaylandEGL *window_egl = data;
 
-  GST_DEBUG ("configure event %ix%i", width, height);
+  GST_DEBUG ("configure event on surface %p, %ix%i", shell_surface, width,
+      height);
 
   window_resize (window_egl, width, height);
 }
@@ -225,13 +269,6 @@
 
   if (window_egl->window.callback)
     wl_callback_destroy (window_egl->window.callback);
-
-  g_source_destroy (window_egl->wl_source);
-  g_source_unref (window_egl->wl_source);
-  window_egl->wl_source = NULL;
-  g_main_loop_unref (window_egl->loop);
-  window_egl->loop = NULL, g_main_context_unref (window_egl->main_context);
-  window_egl->main_context = NULL;
 }
 
 static void
@@ -241,6 +278,9 @@
   GstGLWindowWaylandEGL *window_egl = data;
   struct display *d = &window_egl->display;
 
+  GST_TRACE_OBJECT (window_egl, "registry_handle_global with registry %p, "
+      "interface %s, version %u", registry, interface, version);
+
   if (g_strcmp0 (interface, "wl_compositor") == 0) {
     d->compositor =
         wl_registry_bind (registry, name, &wl_compositor_interface, 1);
@@ -265,6 +305,7 @@
 gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass)
 {
   GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
+  GObjectClass *gobject_class = (GObjectClass *) klass;
 
   window_class->get_window_handle =
       GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_window_handle);
@@ -281,11 +322,26 @@
   window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_open);
   window_class->get_display =
       GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_display);
+
+  gobject_class->finalize = gst_gl_window_wayland_egl_finalize;
 }
 
 static void
 gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
 {
+  window->main_context = g_main_context_new ();
+  window->loop = g_main_loop_new (window->main_context, FALSE);
+}
+
+static void
+gst_gl_window_wayland_egl_finalize (GObject * object)
+{
+  GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (object);
+
+  g_main_loop_unref (window_egl->loop);
+  g_main_context_unref (window_egl->main_context);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 /* Must be called in the gl thread */
@@ -326,6 +382,10 @@
     wl_display_flush (window_egl->display.display);
     wl_display_disconnect (window_egl->display.display);
   }
+
+  g_source_destroy (window_egl->wl_source);
+  g_source_unref (window_egl->wl_source);
+  window_egl->wl_source = NULL;
 }
 
 static gboolean
@@ -355,8 +415,6 @@
 
   window_egl->wl_source =
       wayland_event_source_new (window_egl->display.display);
-  window_egl->main_context = g_main_context_new ();
-  window_egl->loop = g_main_loop_new (window_egl->main_context, FALSE);
 
   g_source_attach (window_egl->wl_source, window_egl->main_context);
 
@@ -461,34 +519,16 @@
 
   window_egl->window.window_width = width;
   window_egl->window.window_height = height;
-
-#if 0
-  wl_shell_surface_resize (window_egl->window.shell_surface,
-      window_egl->display.seat, window_egl->display.serial, 0);
-#endif
 }
 
-struct draw
-{
-  GstGLWindowWaylandEGL *window;
-  guint width, height;
-};
-
 static void
 draw_cb (gpointer data)
 {
-  struct draw *draw_data = data;
-  GstGLWindowWaylandEGL *window_egl = draw_data->window;
+  GstGLWindowWaylandEGL *window_egl = data;
   GstGLWindow *window = GST_GL_WINDOW (window_egl);
   GstGLContext *context = gst_gl_window_get_context (window);
   GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
 
-  if (window_egl->window.window_width != draw_data->width
-      || window_egl->window.window_height != draw_data->height) {
-    GST_DEBUG ("dimensions don't match, attempting resize");
-    window_resize (window_egl, draw_data->width, draw_data->height);
-  }
-
   if (window->draw)
     window->draw (window->draw_data);
 
@@ -498,15 +538,9 @@
 }
 
 static void
-gst_gl_window_wayland_egl_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_window_wayland_egl_draw (GstGLWindow * window)
 {
-  struct draw draw_data;
-
-  draw_data.window = GST_GL_WINDOW_WAYLAND_EGL (window);
-  draw_data.width = width;
-  draw_data.height = height;
-
-  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
 }
 
 static guintptr
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
index 21b82da..b4f66d0 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
@@ -55,6 +55,9 @@
   struct wl_surface      *cursor_surface;
   struct window          *window;
   guint32                 serial;
+
+  gdouble pointer_x;
+  gdouble pointer_y;
 };
 
 struct window {
diff --git a/gst-libs/gst/gl/win32/Makefile.in b/gst-libs/gst/gl/win32/Makefile.in
index e6bdb8d..3f237f8 100644
--- a/gst-libs/gst/gl/win32/Makefile.in
+++ b/gst-libs/gst/gl/win32/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -221,8 +221,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -261,7 +265,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -269,6 +272,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -318,8 +323,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -398,7 +401,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -407,7 +409,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -420,7 +421,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -445,6 +445,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -518,10 +520,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -547,6 +553,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -583,6 +592,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -623,17 +633,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -650,6 +659,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/gl/win32/gstglcontext_wgl.c b/gst-libs/gst/gl/win32/gstglcontext_wgl.c
index 4886e9a..a2570fc 100644
--- a/gst-libs/gst/gl/win32/gstglcontext_wgl.c
+++ b/gst-libs/gst/gl/win32/gstglcontext_wgl.c
@@ -46,8 +46,6 @@
 GstGLAPI gst_gl_context_wgl_get_gl_api (GstGLContext * context);
 static GstGLPlatform gst_gl_context_wgl_get_gl_platform (GstGLContext *
     context);
-static gpointer gst_gl_context_wgl_get_proc_address (GstGLContext * context,
-    const gchar * name);
 
 static void
 gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass)
@@ -285,14 +283,21 @@
   return GST_GL_PLATFORM_WGL;
 }
 
-static gpointer
+gpointer
 gst_gl_context_wgl_get_proc_address (GstGLContext * context, const gchar * name)
 {
   gpointer result;
+  GstGLAPI gl_api = gst_gl_context_get_gl_api (context);
 
-  if (!(result = gst_gl_context_default_get_proc_address (context, name))) {
+  if (!(result = gst_gl_context_default_get_proc_address (gl_api, name))) {
     result = wglGetProcAddress ((LPCSTR) name);
   }
 
   return result;
 }
+
+guintptr
+gst_gl_context_wgl_get_current_context (void)
+{
+  return (guintptr) wglGetCurrentContext ();
+}
diff --git a/gst-libs/gst/gl/win32/gstglcontext_wgl.h b/gst-libs/gst/gl/win32/gstglcontext_wgl.h
index b996dc7..8d9758c 100644
--- a/gst-libs/gst/gl/win32/gstglcontext_wgl.h
+++ b/gst-libs/gst/gl/win32/gstglcontext_wgl.h
@@ -55,7 +55,9 @@
 
 GType gst_gl_context_wgl_get_type     (void);
 
-GstGLContextWGL * gst_gl_context_wgl_new  (void);
+GstGLContextWGL *   gst_gl_context_wgl_new                  (void);
+guintptr            gst_gl_context_wgl_get_current_context  (void);
+gpointer            gst_gl_context_wgl_get_proc_address     (GstGLContext * context, const gchar * name);
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/gl/win32/gstglwindow_win32.c b/gst-libs/gst/gl/win32/gstglwindow_win32.c
index 328c3dd..4191b07 100644
--- a/gst-libs/gst/gl/win32/gstglwindow_win32.c
+++ b/gst-libs/gst/gl/win32/gstglwindow_win32.c
@@ -44,6 +44,9 @@
 struct _GstGLWindowWin32Private
 {
   GThread *thread;
+
+  gint preferred_width;
+  gint preferred_height;
 };
 
 #define GST_CAT_DEFAULT gst_gl_window_win32_debug
@@ -58,8 +61,10 @@
 static void gst_gl_window_win32_set_window_handle (GstGLWindow * window,
     guintptr handle);
 static guintptr gst_gl_window_win32_get_display (GstGLWindow * window);
-static void gst_gl_window_win32_draw (GstGLWindow * window, guint width,
-    guint height);
+static void gst_gl_window_win32_set_preferred_size (GstGLWindow * window,
+    gint width, gint height);
+static void gst_gl_window_win32_show (GstGLWindow * window);
+static void gst_gl_window_win32_draw (GstGLWindow * window);
 static void gst_gl_window_win32_run (GstGLWindow * window);
 static void gst_gl_window_win32_quit (GstGLWindow * window);
 static void gst_gl_window_win32_send_message_async (GstGLWindow * window,
@@ -82,6 +87,9 @@
       GST_DEBUG_FUNCPTR (gst_gl_window_win32_send_message_async);
   window_class->get_display =
       GST_DEBUG_FUNCPTR (gst_gl_window_win32_get_display);
+  window_class->set_preferred_size =
+      GST_DEBUG_FUNCPTR (gst_gl_window_win32_set_preferred_size);
+  window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_win32_show);
 }
 
 static void
@@ -256,11 +264,12 @@
   window_win32->parent_win_id = (HWND) id;
 }
 
-/* Thread safe */
 static void
-gst_gl_window_win32_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_window_win32_show (GstGLWindow * window)
 {
   GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
+  gint width = window_win32->priv->preferred_width;
+  gint height = window_win32->priv->preferred_height;
 
   if (!window_win32->visible) {
     HWND parent_id = window_win32->parent_win_id;
@@ -277,10 +286,27 @@
       MoveWindow (window_win32->internal_win_id, rect.left, rect.top, width,
           height, FALSE);
     }
-    ShowWindowAsync (window_win32->internal_win_id, SW_SHOW);
 
+    ShowWindowAsync (window_win32->internal_win_id, SW_SHOW);
     window_win32->visible = TRUE;
   }
+}
+
+static void
+gst_gl_window_win32_set_preferred_size (GstGLWindow * window, gint width,
+    gint height)
+{
+  GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
+
+  window_win32->priv->preferred_width = width;
+  window_win32->priv->preferred_height = height;
+}
+
+/* Thread safe */
+static void
+gst_gl_window_win32_draw (GstGLWindow * window)
+{
+  GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
 
   RedrawWindow (window_win32->internal_win_id, NULL, NULL,
       RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE);
diff --git a/gst-libs/gst/gl/x11/Makefile.in b/gst-libs/gst/gl/x11/Makefile.in
index bafc411..df7fd6b 100644
--- a/gst-libs/gst/gl/x11/Makefile.in
+++ b/gst-libs/gst/gl/x11/Makefile.in
@@ -93,6 +93,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -106,7 +107,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -252,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -292,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -300,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -349,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -429,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -438,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -451,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -476,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -549,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -578,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -614,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -654,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -681,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.c b/gst-libs/gst/gl/x11/gstglcontext_glx.c
index 7487faf..7c3c23e 100644
--- a/gst-libs/gst/gl/x11/gstglcontext_glx.c
+++ b/gst-libs/gst/gl/x11/gstglcontext_glx.c
@@ -57,8 +57,6 @@
 GstGLAPI gst_gl_context_glx_get_gl_api (GstGLContext * context);
 static GstGLPlatform gst_gl_context_glx_get_gl_platform (GstGLContext *
     context);
-static gpointer gst_gl_context_glx_get_proc_address (GstGLContext * context,
-    const gchar * name);
 
 struct _GstGLContextGLXPrivate
 {
@@ -96,6 +94,8 @@
       GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_gl_platform);
   context_class->get_proc_address =
       GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_proc_address);
+  context_class->get_current_context =
+      GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_current_context);
 }
 
 static void
@@ -145,7 +145,7 @@
   GstGLDisplay *display;
   gboolean create_context;
   const char *glx_exts;
-  int x_error;
+  int x_error = 0;
   Display *device;
   guintptr external_gl_context = 0;
 
@@ -176,8 +176,11 @@
   if (create_context && context_glx->priv->glXCreateContextAttribsARB) {
     int context_attribs_3[] = {
       GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
-      GLX_CONTEXT_MINOR_VERSION_ARB, 0,
-      //GLX_CONTEXT_FLAGS_ARB        , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
+      GLX_CONTEXT_MINOR_VERSION_ARB, 1,
+      GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
+#if !defined(GST_DISABLE_GST_DEBUG)
+      GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
+#endif
       None
     };
 
@@ -187,17 +190,23 @@
       None
     };
 
-    gst_gl_window_x11_trap_x_errors ();
-    context_glx->glx_context =
-        context_glx->priv->glXCreateContextAttribsARB (device,
-        context_glx->priv->fbconfigs[0], (GLXContext) external_gl_context, True,
-        context_attribs_3);
+    if (gl_api & GST_GL_API_OPENGL3) {
+      GST_DEBUG_OBJECT (window, "trying to create a GL 3.1 core context");
+      gst_gl_window_x11_trap_x_errors ();
+      context_glx->glx_context =
+          context_glx->priv->glXCreateContextAttribsARB (device,
+          context_glx->priv->fbconfigs[0], (GLXContext) external_gl_context,
+          True, context_attribs_3);
 
-    x_error = gst_gl_window_x11_untrap_x_errors ();
-    context_glx->priv->context_api = GST_GL_API_OPENGL3 | GST_GL_API_OPENGL;
+      x_error = gst_gl_window_x11_untrap_x_errors ();
 
-    if (!context_glx->glx_context || x_error != 0) {
-      GST_DEBUG ("Failed to create an Opengl 3 context. trying a legacy one");
+      if (x_error != 0)
+        context_glx->glx_context = NULL;
+      context_glx->priv->context_api = GST_GL_API_OPENGL3;
+    }
+
+    if (gl_api & GST_GL_API_OPENGL && context_glx->glx_context == NULL) {
+      GST_DEBUG_OBJECT (window, "trying to create a GL 1.4 context");
 
       gst_gl_window_x11_trap_x_errors ();
       context_glx->glx_context =
@@ -416,14 +425,21 @@
   return GST_GL_PLATFORM_GLX;
 }
 
-static gpointer
+gpointer
 gst_gl_context_glx_get_proc_address (GstGLContext * context, const gchar * name)
 {
   gpointer result;
+  GstGLAPI gl_api = gst_gl_context_get_gl_api (context);
 
-  if (!(result = gst_gl_context_default_get_proc_address (context, name))) {
+  if (!(result = gst_gl_context_default_get_proc_address (gl_api, name))) {
     result = glXGetProcAddressARB ((const GLubyte *) name);
   }
 
   return result;
 }
+
+guintptr
+gst_gl_context_glx_get_current_context (void)
+{
+  return (guintptr) glXGetCurrentContext ();
+}
diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.h b/gst-libs/gst/gl/x11/gstglcontext_glx.h
index eca8d7f..9b8c890 100644
--- a/gst-libs/gst/gl/x11/gstglcontext_glx.h
+++ b/gst-libs/gst/gl/x11/gstglcontext_glx.h
@@ -59,7 +59,9 @@
 
 GType gst_gl_context_glx_get_type     (void);
 
-GstGLContextGLX * gst_gl_context_glx_new (void);
+GstGLContextGLX *   gst_gl_context_glx_new                  (void);
+guintptr            gst_gl_context_glx_get_current_context  (void);
+gpointer            gst_gl_context_glx_get_proc_address     (GstGLContext * context, const gchar * name);
 
 G_END_DECLS
 
diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c
index d097012..0686d59 100644
--- a/gst-libs/gst/gl/x11/gstglwindow_x11.c
+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c
@@ -31,6 +31,8 @@
 #include "x11_event_source.h"
 #include "gstglwindow_x11.h"
 #include "gstgldisplay_x11.h"
+/* for XkbKeycodeToKeysym */
+#include <X11/XKBlib.h>
 
 #define GST_GL_WINDOW_X11_GET_PRIVATE(o)  \
   (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_WINDOW_X11, GstGLWindowX11Private))
@@ -56,6 +58,9 @@
 {
   gboolean activate;
   gboolean activate_result;
+
+  gint preferred_width;
+  gint preferred_height;
 };
 
 guintptr gst_gl_window_x11_get_display (GstGLWindow * window);
@@ -64,9 +69,11 @@
 void gst_gl_window_x11_set_window_handle (GstGLWindow * window,
     guintptr handle);
 guintptr gst_gl_window_x11_get_window_handle (GstGLWindow * window);
-void gst_gl_window_x11_draw_unlocked (GstGLWindow * window, guint width,
-    guint height);
-void gst_gl_window_x11_draw (GstGLWindow * window, guint width, guint height);
+static void gst_gl_window_x11_set_preferred_size (GstGLWindow * window,
+    gint width, gint height);
+void gst_gl_window_x11_show (GstGLWindow * window);
+void gst_gl_window_x11_draw_unlocked (GstGLWindow * window);
+void gst_gl_window_x11_draw (GstGLWindow * window);
 void gst_gl_window_x11_run (GstGLWindow * window);
 void gst_gl_window_x11_quit (GstGLWindow * window);
 void gst_gl_window_x11_send_message_async (GstGLWindow * window,
@@ -75,11 +82,25 @@
     GstGLAPI gl_api, guintptr external_gl_context, GError ** error);
 gboolean gst_gl_window_x11_open (GstGLWindow * window, GError ** error);
 void gst_gl_window_x11_close (GstGLWindow * window);
+static void gst_gl_window_x11_get_surface_dimensions (GstGLWindow * window,
+    guint * width, guint * height);
+void gst_gl_window_x11_handle_events (GstGLWindow * window,
+    gboolean handle_events);
 
 static void
 gst_gl_window_x11_finalize (GObject * object)
 {
-  g_return_if_fail (GST_GL_IS_WINDOW_X11 (object));
+  GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (object);
+
+  if (window_x11->loop) {
+    g_main_loop_unref (window_x11->loop);
+    window_x11->loop = NULL;
+  }
+  if (window_x11->main_context) {
+    g_main_context_unref (window_x11->main_context);
+    window_x11->main_context = NULL;
+  }
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -107,12 +128,22 @@
       GST_DEBUG_FUNCPTR (gst_gl_window_x11_send_message_async);
   window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_x11_open);
   window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_x11_close);
+  window_class->get_surface_dimensions =
+      GST_DEBUG_FUNCPTR (gst_gl_window_x11_get_surface_dimensions);
+  window_class->handle_events =
+      GST_DEBUG_FUNCPTR (gst_gl_window_x11_handle_events);
+  window_class->set_preferred_size =
+      GST_DEBUG_FUNCPTR (gst_gl_window_x11_set_preferred_size);
+  window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_x11_show);
 }
 
 static void
 gst_gl_window_x11_init (GstGLWindowX11 * window)
 {
   window->priv = GST_GL_WINDOW_X11_GET_PRIVATE (window);
+
+  window->main_context = g_main_context_new ();
+  window->loop = g_main_loop_new (window->main_context, FALSE);
 }
 
 /* Must be called in the gl thread */
@@ -168,8 +199,6 @@
       DisplayHeight (window_x11->device, window_x11->screen_num);
 
   window_x11->x11_source = x11_event_source_new (window_x11);
-  window_x11->main_context = g_main_context_new ();
-  window_x11->loop = g_main_loop_new (window_x11->main_context, FALSE);
 
   g_source_attach (window_x11->x11_source, window_x11->main_context);
 
@@ -288,20 +317,21 @@
   g_source_destroy (window_x11->x11_source);
   g_source_unref (window_x11->x11_source);
   window_x11->x11_source = NULL;
-  g_main_loop_unref (window_x11->loop);
-  window_x11->loop = NULL;
-  g_main_context_unref (window_x11->main_context);
-  window_x11->main_context = NULL;
 
   window_x11->running = FALSE;
 }
 
-static void
-set_window_handle_cb (gpointer data)
+/* called by the gl thread */
+void
+gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id)
 {
-  GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (data);
+  GstGLWindowX11 *window_x11;
   XWindowAttributes attr;
 
+  window_x11 = GST_GL_WINDOW_X11 (window);
+
+  window_x11->parent_win = (Window) id;
+
   XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
 
   XResizeWindow (window_x11->device, window_x11->internal_win_id,
@@ -313,28 +343,6 @@
   XSync (window_x11->device, FALSE);
 }
 
-/* Not called by the gl thread */
-void
-gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id)
-{
-  GstGLWindowX11 *window_x11;
-
-  window_x11 = GST_GL_WINDOW_X11 (window);
-
-  window_x11->parent_win = (Window) id;
-
-  /* The loop may not exist yet because it's created in GstGLWindow::open
-   * which is only called when going from READY to PAUSED state.
-   * If no loop then the parent is directly set in XCreateWindow
-   */
-  if (window_x11->loop && g_main_loop_is_running (window_x11->loop)) {
-    GST_LOG ("set parent window id: %" G_GUINTPTR_FORMAT, id);
-
-    gst_gl_window_send_message (window, (GstGLWindowCB) set_window_handle_cb,
-        window_x11);
-  }
-}
-
 guintptr
 gst_gl_window_x11_get_window_handle (GstGLWindow * window)
 {
@@ -345,10 +353,50 @@
   return window_x11->internal_win_id;
 }
 
+static void
+gst_gl_window_x11_set_preferred_size (GstGLWindow * window, gint width,
+    gint height)
+{
+  GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
+
+  window_x11->priv->preferred_width = width;
+  window_x11->priv->preferred_height = height;
+}
+
+static void
+_show_window (GstGLWindow * window)
+{
+  GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
+  guint width = window_x11->priv->preferred_width;
+  guint height = window_x11->priv->preferred_height;
+  XWindowAttributes attr;
+
+  XGetWindowAttributes (window_x11->device, window_x11->internal_win_id, &attr);
+
+  if (!window_x11->visible) {
+
+    if (!window_x11->parent_win) {
+      attr.width = width;
+      attr.height = height;
+      XResizeWindow (window_x11->device, window_x11->internal_win_id,
+          attr.width, attr.height);
+      XSync (window_x11->device, FALSE);
+    }
+
+    XMapWindow (window_x11->device, window_x11->internal_win_id);
+    window_x11->visible = TRUE;
+  }
+}
+
+void
+gst_gl_window_x11_show (GstGLWindow * window)
+{
+  gst_gl_window_send_message (window, (GstGLWindowCB) _show_window, window);
+}
+
 /* Called in the gl thread */
 void
-gst_gl_window_x11_draw_unlocked (GstGLWindow * window, guint width,
-    guint height)
+gst_gl_window_x11_draw_unlocked (GstGLWindow * window)
 {
   GstGLWindowX11 *window_x11;
 
@@ -368,19 +416,10 @@
   }
 }
 
-struct draw
-{
-  GstGLWindowX11 *window;
-  guint width, height;
-};
-
 static void
 draw_cb (gpointer data)
 {
-  struct draw *draw_data = data;
-  GstGLWindowX11 *window_x11 = draw_data->window;
-  guint width = draw_data->width;
-  guint height = draw_data->height;
+  GstGLWindowX11 *window_x11 = data;
 
   if (g_main_loop_is_running (window_x11->loop)) {
     XWindowAttributes attr;
@@ -388,20 +427,6 @@
     XGetWindowAttributes (window_x11->device, window_x11->internal_win_id,
         &attr);
 
-    if (!window_x11->visible) {
-
-      if (!window_x11->parent_win) {
-        attr.width = width;
-        attr.height = height;
-        XResizeWindow (window_x11->device, window_x11->internal_win_id,
-            attr.width, attr.height);
-        XSync (window_x11->device, FALSE);
-      }
-
-      XMapWindow (window_x11->device, window_x11->internal_win_id);
-      window_x11->visible = TRUE;
-    }
-
     if (window_x11->parent_win) {
       XWindowAttributes attr_parent;
       XGetWindowAttributes (window_x11->device, window_x11->parent_win,
@@ -420,22 +445,15 @@
       }
     }
 
-    gst_gl_window_x11_draw_unlocked (GST_GL_WINDOW (window_x11), width, height);
+    gst_gl_window_x11_draw_unlocked (GST_GL_WINDOW (window_x11));
   }
 }
 
 /* Not called by the gl thread */
 void
-gst_gl_window_x11_draw (GstGLWindow * window, guint width, guint height)
+gst_gl_window_x11_draw (GstGLWindow * window)
 {
-  struct draw draw_data;
-
-  draw_data.window = GST_GL_WINDOW_X11 (window);
-  draw_data.width = width;
-  draw_data.height = height;
-
-  /* Call from the GL thread */
-  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+  gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
 }
 
 void
@@ -476,11 +494,40 @@
       return "SelectionRequest";
     case ClientMessage:
       return "ClientMessage";
+    case KeyPress:
+      return "KeyPress";
+    case KeyRelease:
+      return "KeyRelease";
+    case ButtonPress:
+      return "ButtonPress";
+    case ButtonRelease:
+      return "ButtonRelease";
+    case MotionNotify:
+      return "MotionNotify";
     default:
       return "unknown";
   }
 }
 
+void
+gst_gl_window_x11_handle_events (GstGLWindow * window, gboolean handle_events)
+{
+  GstGLWindowX11 *window_x11;
+
+  g_return_if_fail (window != NULL);
+
+  window_x11 = GST_GL_WINDOW_X11 (window);
+
+  if (handle_events) {
+    XSelectInput (window_x11->device, window_x11->internal_win_id,
+        StructureNotifyMask | ExposureMask | VisibilityChangeMask |
+        PointerMotionMask | KeyPressMask | KeyReleaseMask);
+  } else {
+    XSelectInput (window_x11->device, window_x11->internal_win_id,
+        StructureNotifyMask | ExposureMask | VisibilityChangeMask);
+  }
+}
+
 gboolean
 gst_gl_window_x11_handle_event (GstGLWindowX11 * window_x11)
 {
@@ -488,6 +535,10 @@
   GstGLContextClass *context_class;
   GstGLWindow *window;
   gboolean ret = TRUE;
+  const char *key_str = NULL;
+  KeySym keysym;
+  struct mouse_event *mouse_data;
+  struct key_event *key_data;
 
   window = GST_GL_WINDOW (window_x11);
 
@@ -529,6 +580,9 @@
         if (window->resize)
           window->resize (window->resize_data, event.xconfigure.width,
               event.xconfigure.height);
+
+        window_x11->current_width = event.xconfigure.width;
+        window_x11->current_height = event.xconfigure.width;
         break;
       }
 
@@ -554,12 +608,58 @@
 
           gst_object_unref (context);
         }
+
+        window_x11->current_width = event.xexpose.width;
+        window_x11->current_height = event.xexpose.width;
         break;
 
       case VisibilityNotify:
         /* actually nothing to do here */
         break;
+      case KeyPress:
+      case KeyRelease:
+        keysym = XkbKeycodeToKeysym (window_x11->device,
+            event.xkey.keycode, 0, 0);
+        key_str = XKeysymToString (keysym);
+        key_data = g_slice_new (struct key_event);
+        key_data->window = window;
+        key_data->key_str = XKeysymToString (keysym);
+        key_data->event_type =
+            event.type == KeyPress ? "key-press" : "key-release";
+        GST_DEBUG ("input event key %d pressed over window at %d,%d (%s)",
+            event.xkey.keycode, event.xkey.x, event.xkey.y, key_str);
+        g_main_context_invoke (window->navigation_context,
+            (GSourceFunc) gst_gl_window_key_event_cb, key_data);
+        break;
+      case ButtonPress:
+      case ButtonRelease:
+        GST_DEBUG ("input event mouse button %d pressed over window at %d,%d",
+            event.xbutton.button, event.xbutton.x, event.xbutton.y);
+        mouse_data = g_slice_new (struct mouse_event);
+        mouse_data->window = window;
+        mouse_data->event_type =
+            event.type ==
+            ButtonPress ? "mouse-button-press" : "mouse-button-release";
+        mouse_data->button = event.xbutton.button;
+        mouse_data->posx = (double) event.xbutton.x;
+        mouse_data->posy = (double) event.xbutton.y;
 
+        g_main_context_invoke (window->navigation_context,
+            (GSourceFunc) gst_gl_window_mouse_event_cb, mouse_data);
+        break;
+      case MotionNotify:
+        GST_DEBUG ("input event pointer moved over window at %d,%d",
+            event.xmotion.x, event.xmotion.y);
+        mouse_data = g_slice_new (struct mouse_event);
+        mouse_data->window = window;
+        mouse_data->event_type = "mouse-move";
+        mouse_data->button = 0;
+        mouse_data->posx = (double) event.xbutton.x;
+        mouse_data->posy = (double) event.xbutton.y;
+
+        g_main_context_invoke (window->navigation_context, (GSourceFunc)
+            gst_gl_window_mouse_event_cb, mouse_data);
+        break;
       default:
         GST_DEBUG ("unknown XEvent type: %u", event.type);
         break;
@@ -579,7 +679,8 @@
 
   GST_LOG ("sending quit");
 
-  g_main_loop_quit (window_x11->loop);
+  if (window_x11->loop)
+    g_main_loop_quit (window_x11->loop);
 
   GST_LOG ("quit sent");
 }
@@ -664,3 +765,14 @@
 
   return (guintptr) window_x11->device;
 }
+
+static void
+gst_gl_window_x11_get_surface_dimensions (GstGLWindow * window, guint * width,
+    guint * height)
+{
+  GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
+  if (width != NULL)
+    *width = window_x11->current_width;
+  if (height != NULL)
+    *height = window_x11->current_height;
+}
diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.h b/gst-libs/gst/gl/x11/gstglwindow_x11.h
index 02a3aaa..56e876d 100644
--- a/gst-libs/gst/gl/x11/gstglwindow_x11.h
+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.h
@@ -64,6 +64,8 @@
   gint          depth;
   gint          device_width;
   gint          device_height;
+  gint          current_width;
+  gint          current_height;
   gint          connection;
   XVisualInfo  *visual_info;
   Window        parent_win;
diff --git a/gst-libs/gst/insertbin/Makefile.in b/gst-libs/gst/insertbin/Makefile.in
index ad6a6e3..714cb43 100644
--- a/gst-libs/gst/insertbin/Makefile.in
+++ b/gst-libs/gst/insertbin/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -234,8 +234,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -274,7 +278,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -282,6 +285,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -331,8 +336,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -411,7 +414,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -420,7 +422,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -433,7 +434,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -458,6 +458,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -531,10 +533,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -560,6 +566,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -596,6 +605,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -636,17 +646,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -663,6 +672,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/insertbin/gstinsertbin.c b/gst-libs/gst/insertbin/gstinsertbin.c
index efa0e5b..57f030a 100644
--- a/gst-libs/gst/insertbin/gstinsertbin.c
+++ b/gst-libs/gst/insertbin/gstinsertbin.c
@@ -149,6 +149,7 @@
    * @callback: the callback to call when the element has been added or not, or
    *  %NULL
    * @user_data: The data to pass to the callback
+   * @user_data2: The user data of the signal (ignored)
    *
    * This action signal adds the filter like element before any other element
    * in the bin.
@@ -168,6 +169,7 @@
    * @callback: the callback to call when the element has been added or not, or
    *  %NULL
    * @user_data: The data to pass to the callback
+   * @user_data2: The user data of the signal (ignored)
    *
    * This action signal adds the filter like element after any other element
    * in the bin.
@@ -188,6 +190,7 @@
    * @callback: the callback to call when the element has been added or not, or
    *  %NULL
    * @user_data: The data to pass to the callback
+   * @user_data2: The user data of the signal (ignored)
    *
    * This action signal adds the filter like element before the @sibling
    * element in the bin.
@@ -209,6 +212,7 @@
    * @callback: the callback to call when the element has been added or not, or
    *  %NULL
    * @user_data: The data to pass to the callback
+   * @user_data2: The user data of the signal (ignored)
    *
    * This action signal adds the filter like element after the @sibling
    * element in the bin.
@@ -231,6 +235,7 @@
    * @callback: the callback to call when the element has been removed or not,
    * or %NULL
    * @user_data: The data to pass to the callback
+   * @user_data2: The user data of the signal (ignored)
    *
    * This action signal removed the filter like element from the bin.
    *
@@ -305,7 +310,7 @@
 static gboolean
 validate_element (GstInsertBin * self, GstElement * element)
 {
-  gboolean valid = TRUE;;
+  gboolean valid = TRUE;
 
   GST_OBJECT_LOCK (element);
   if (element->numsrcpads != 1 || element->numsinkpads != 1) {
diff --git a/gst-libs/gst/interfaces/Makefile.in b/gst-libs/gst/interfaces/Makefile.in
index bfc9323..b17b882 100644
--- a/gst-libs/gst/interfaces/Makefile.in
+++ b/gst-libs/gst/interfaces/Makefile.in
@@ -99,6 +99,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -112,7 +113,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -264,8 +264,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -304,7 +308,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -312,6 +315,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -361,8 +366,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -441,7 +444,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -450,7 +452,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -463,7 +464,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -488,6 +488,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -561,10 +563,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -590,6 +596,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -626,6 +635,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -666,17 +676,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -693,6 +702,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/mpegts/Makefile.in b/gst-libs/gst/mpegts/Makefile.in
index 0d9b027..a0207c7 100644
--- a/gst-libs/gst/mpegts/Makefile.in
+++ b/gst-libs/gst/mpegts/Makefile.in
@@ -103,6 +103,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -116,7 +117,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -273,8 +273,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -313,7 +317,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -321,6 +324,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -370,8 +375,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -450,7 +453,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -459,7 +461,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -472,7 +473,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -497,6 +497,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -570,10 +572,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -599,6 +605,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -635,6 +644,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -675,17 +685,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -702,6 +711,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/mpegts/gst-atsc-section.c b/gst-libs/gst/mpegts/gst-atsc-section.c
index 459a323..7532548 100644
--- a/gst-libs/gst/mpegts/gst-atsc-section.c
+++ b/gst-libs/gst/mpegts/gst-atsc-section.c
@@ -193,7 +193,6 @@
       gst_mpegts_parse_descriptors (data, descriptors_loop_length);
   if (vct->descriptors == NULL)
     goto error;
-  data += descriptors_loop_length;
 
   return (gpointer) vct;
 
@@ -361,7 +360,6 @@
   }
   mgt->descriptors =
       gst_mpegts_parse_descriptors (data, descriptors_loop_length);
-  data += descriptors_loop_length;
 
   return (gpointer) mgt;
 
diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c
index 29b2442..ea33a1d 100644
--- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c
+++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c
@@ -178,7 +178,7 @@
   guint8 *data;
 
   g_return_val_if_fail (descriptor != NULL && stuffing_bytes != NULL, FALSE);
-  __common_desc_checks (descriptor, GST_MTS_DESC_DVB_STUFFING, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DVB_STUFFING, FALSE);
 
   data = (guint8 *) descriptor->data + 2;
 
@@ -872,7 +872,7 @@
   guint8 *data;
 
   g_return_val_if_fail (descriptor != NULL, FALSE);
-  __common_desc_checks (descriptor, GST_MTS_DESC_DVB_TELETEXT, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DVB_TELETEXT, FALSE);
 
   if (descriptor->length / 5 <= idx)
     return FALSE;
@@ -907,7 +907,7 @@
     descriptor)
 {
   g_return_val_if_fail (descriptor != NULL, 0);
-  __common_desc_checks (descriptor, GST_MTS_DESC_DVB_TELETEXT, 0, 0);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DVB_TELETEXT, FALSE);
 
   return descriptor->length / 5;
 }
@@ -938,7 +938,7 @@
   guint8 *data;
 
   g_return_val_if_fail (descriptor != NULL && lang != NULL, FALSE);
-  __common_desc_checks (descriptor, GST_MTS_DESC_DVB_SUBTITLING, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DVB_SUBTITLING, FALSE);
 
   /* If we went too far, return FALSE */
   if (descriptor->length / 8 <= idx)
@@ -973,7 +973,7 @@
     descriptor)
 {
   g_return_val_if_fail (descriptor != NULL, FALSE);
-  __common_desc_checks (descriptor, GST_MTS_DESC_DVB_SUBTITLING, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DVB_SUBTITLING, FALSE);
 
   return descriptor->length / 8;
 }
@@ -1281,7 +1281,7 @@
   guint8 i;
 
   g_return_val_if_fail (descriptor != NULL && content != NULL, FALSE);
-  __common_desc_checks (descriptor, GST_MTS_DESC_DVB_CONTENT, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DVB_CONTENT, FALSE);
 
   data = (guint8 *) descriptor->data + 2;
   len = descriptor->length;
@@ -1330,7 +1330,8 @@
   guint i;
 
   g_return_val_if_fail (descriptor != NULL && rating != NULL, FALSE);
-  __common_desc_checks (descriptor, GST_MTS_DESC_DVB_PARENTAL_RATING, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DVB_PARENTAL_RATING,
+      FALSE);
 
   data = (guint8 *) descriptor->data + 2;
 
diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.h b/gst-libs/gst/mpegts/gst-dvb-descriptor.h
index ac7d9d4..e7f6e70 100644
--- a/gst-libs/gst/mpegts/gst-dvb-descriptor.h
+++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.h
@@ -483,7 +483,7 @@
 
 /**
  * GstMpegtsExtendedEventDescriptor:
- * @desctiptor_number:
+ * @descriptor_number:
  * @last_descriptor_number:
  * @language_code: NULL terminated language code.
  * @items: (element-type GstMpegtsExtendedEventItem): the #GstMpegtsExtendedEventItem
diff --git a/gst-libs/gst/mpegts/gst-dvb-section.c b/gst-libs/gst/mpegts/gst-dvb-section.c
index 03615b4..46fc634 100644
--- a/gst-libs/gst/mpegts/gst-dvb-section.c
+++ b/gst-libs/gst/mpegts/gst-dvb-section.c
@@ -13,7 +13,7 @@
  *   Zaheer Abbas Merali <zaheerabbas at merali dot org>
  *   Edward Hervey <edward@collabora.com>
  *
- * This library is free softwagre; you can redistribute it and/or
+ * 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.
@@ -360,7 +360,7 @@
     g_ptr_array_add (bat->streams, stream);
 
     if (transport_stream_loop_length < 6) {
-      /* each entry must be at least 6 bytes (+ 4bytes CRC) */
+      /* each entry must be at least 6 bytes (+ 4 bytes CRC) */
       GST_WARNING ("PID %d invalid BAT entry size %d",
           section->pid, transport_stream_loop_length);
       goto error;
@@ -383,7 +383,7 @@
       GST_WARNING
           ("PID %d invalid BAT entry %d descriptors loop length %d (only have %"
           G_GSIZE_FORMAT ")", section->pid, section->subtable_extension,
-          descriptors_loop_length, end - 4 - data);
+          descriptors_loop_length, (gsize) (end - 4 - data));
       goto error;
     }
     stream->descriptors =
@@ -541,7 +541,7 @@
     g_ptr_array_add (nit->streams, stream);
 
     if (transport_stream_loop_length < 6) {
-      /* each entry must be at least 6 bytes (+ 4bytes CRC) */
+      /* each entry must be at least 6 bytes (+ 4 bytes CRC) */
       GST_WARNING ("PID %d invalid NIT entry size %d",
           section->pid, transport_stream_loop_length);
       goto error;
@@ -564,7 +564,7 @@
       GST_WARNING
           ("PID %d invalid NIT entry %d descriptors loop length %d (only have %"
           G_GSIZE_FORMAT ")", section->pid, section->subtable_extension,
-          descriptors_loop_length, end - 4 - data);
+          descriptors_loop_length, (gsize) (end - 4 - data));
       goto error;
     }
     stream->descriptors =
diff --git a/gst-libs/gst/mpegts/gstmpegts-private.h b/gst-libs/gst/mpegts/gstmpegts-private.h
index 5dcbe56..41f7509 100644
--- a/gst-libs/gst/mpegts/gstmpegts-private.h
+++ b/gst-libs/gst/mpegts/gstmpegts-private.h
@@ -5,7 +5,7 @@
  * Authors:
  *   Edward Hervey <edward@collabora.com>
  *
- * This library is free softwagre; you can redistribute it and/or
+ * 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.
diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
index 06c9f33..da8419c 100644
--- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
+++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
@@ -190,7 +190,7 @@
       if (table < 17)
         encoding = _ICONV_UNKNOWN + table;
       else
-        encoding = _ICONV_UNKNOWN;;
+        encoding = _ICONV_UNKNOWN;
       *start_text = 3;
       break;
     }
@@ -775,7 +775,7 @@
   }
 
   GST_DEBUG ("Saw %d descriptors, read %" G_GSIZE_FORMAT " bytes",
-      nb_desc, data - buffer);
+      nb_desc, (gsize) (data - buffer));
 
   if (data - buffer != buf_len) {
     GST_WARNING ("descriptors size %d expected %" G_GSIZE_FORMAT,
@@ -969,7 +969,7 @@
 
   g_return_val_if_fail (descriptor != NULL && desc != NULL, FALSE);
   /* This descriptor can be empty, no size check needed */
-  __common_desc_checks (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, FALSE);
 
   data = (guint8 *) descriptor->data + 2;
 
@@ -1011,7 +1011,7 @@
 
   g_return_val_if_fail (descriptor != NULL && lang != NULL, FALSE);
   /* This descriptor can be empty, no size check needed */
-  __common_desc_checks (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, FALSE);
 
   if (descriptor->length / 4 <= idx)
     return FALSE;
@@ -1040,7 +1040,7 @@
 {
   g_return_val_if_fail (descriptor != NULL, 0);
   /* This descriptor can be empty, no size check needed */
-  __common_desc_checks (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, FALSE);
 
   return descriptor->length / 4;
 }
@@ -1063,7 +1063,8 @@
 
   g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE);
   /* This descriptor loop can be empty, no size check required */
-  __common_desc_checks (descriptor, GST_MTS_DESC_DTG_LOGICAL_CHANNEL, 0, FALSE);
+  __common_desc_check_base (descriptor, GST_MTS_DESC_DTG_LOGICAL_CHANNEL,
+      FALSE);
 
   data = (guint8 *) descriptor->data + 2;
 
diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c
index 527ff38..319b5b0 100644
--- a/gst-libs/gst/mpegts/gstmpegtssection.c
+++ b/gst-libs/gst/mpegts/gstmpegtssection.c
@@ -13,7 +13,7 @@
  *   Zaheer Abbas Merali <zaheerabbas at merali dot org>
  *   Edward Hervey <edward@collabora.com>
  *
- * This library is free softwagre; you can redistribute it and/or
+ * 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.
@@ -49,7 +49,7 @@
  * @include: gst/mpegts/mpegts.h
  *
  * For more details, refer to the ITU H.222.0 or ISO/IEC 13818-1 specifications
- * and other specifications mentionned in the documentation.
+ * and other specifications mentioned in the documentation.
  */
 
 /*
@@ -127,7 +127,7 @@
   0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
 };
 
-/* _calc_crc32 relicenced to LGPL from fluendo ts demuxer */
+/* _calc_crc32 relicensed to LGPL from fluendo ts demuxer */
 guint32
 _calc_crc32 (const guint8 * data, guint datalen)
 {
@@ -656,7 +656,7 @@
 
   GST_DEBUG ("Parsing %d Program Map Table", section->subtable_extension);
 
-  /* Assign program number from subtable extenstion,
+  /* Assign program number from subtable extension,
      and skip already parsed data */
   pmt->program_number = section->subtable_extension;
   data += 8;
@@ -929,7 +929,7 @@
  * gst_mpegts_section_get_cat:
  * @section: a #GstMpegtsSection of type %GST_MPEGTS_SECTION_CAT
  *
- * Returns the array of #GstMpegtsDescriptor contained in the Condtional
+ * Returns the array of #GstMpegtsDescriptor contained in the Conditional
  * Access Table.
  *
  * Returns: (transfer container) (element-type GstMpegtsDescriptor): The
@@ -1232,7 +1232,7 @@
  * @section: (transfer none): the #GstMpegtsSection that holds the data
  * @output_size: (out): #gsize to hold the size of the data
  *
- * If the data in @section has aldready been packetized, the data pointer is returned
+ * If the data in @section has already been packetized, the data pointer is returned
  * immediately. Otherwise, the data field is allocated and populated.
  *
  * Returns: (transfer none): pointer to section data, or %NULL on fail
diff --git a/gst-libs/gst/mpegts/mpegts.h b/gst-libs/gst/mpegts/mpegts.h
index f87cff7..aaca081 100644
--- a/gst-libs/gst/mpegts/mpegts.h
+++ b/gst-libs/gst/mpegts/mpegts.h
@@ -5,7 +5,7 @@
  * Authors:
  *   Edward Hervey <edward@collabora.com>
  *
- * This library is free softwagre; you can redistribute it and/or
+ * 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.
diff --git a/gst-libs/gst/uridownloader/Makefile.in b/gst-libs/gst/uridownloader/Makefile.in
index f5e788a..f63ea01 100644
--- a/gst-libs/gst/uridownloader/Makefile.in
+++ b/gst-libs/gst/uridownloader/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -232,8 +232,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -272,7 +276,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -280,6 +283,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -329,8 +334,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -409,7 +412,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -418,7 +420,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -431,7 +432,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -456,6 +456,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -529,10 +531,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -558,6 +564,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -594,6 +603,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -634,17 +644,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -661,6 +670,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-libs/gst/uridownloader/gstfragment.c b/gst-libs/gst/uridownloader/gstfragment.c
index 2060ea2..3f9552b 100644
--- a/gst-libs/gst/uridownloader/gstfragment.c
+++ b/gst-libs/gst/uridownloader/gstfragment.c
@@ -95,11 +95,11 @@
       break;
 
     case PROP_BUFFER:
-      g_value_set_boxed (value, gst_fragment_get_buffer (fragment));
+      g_value_take_boxed (value, gst_fragment_get_buffer (fragment));
       break;
 
     case PROP_CAPS:
-      g_value_set_boxed (value, gst_fragment_get_caps (fragment));
+      g_value_take_boxed (value, gst_fragment_get_caps (fragment));
       break;
 
     default:
diff --git a/gst-libs/gst/uridownloader/gsturidownloader.c b/gst-libs/gst/uridownloader/gsturidownloader.c
index 6f2c6b0..3d5a215 100644
--- a/gst-libs/gst/uridownloader/gsturidownloader.c
+++ b/gst-libs/gst/uridownloader/gsturidownloader.c
@@ -261,6 +261,7 @@
   GST_OBJECT_LOCK (downloader);
   if (downloader->priv->download == NULL) {
     /* Download cancelled, quit */
+    gst_buffer_unref (buf);
     GST_OBJECT_UNLOCK (downloader);
     goto done;
   }
@@ -268,8 +269,10 @@
   GST_LOG_OBJECT (downloader, "The uri fetcher received a new buffer "
       "of size %" G_GSIZE_FORMAT, gst_buffer_get_size (buf));
   downloader->priv->got_buffer = TRUE;
-  if (!gst_fragment_add_buffer (downloader->priv->download, buf))
+  if (!gst_fragment_add_buffer (downloader->priv->download, buf)) {
     GST_WARNING_OBJECT (downloader, "Could not add buffer to fragment");
+    gst_buffer_unref (buf);
+  }
   GST_OBJECT_UNLOCK (downloader);
 
 done:
@@ -471,6 +474,8 @@
   }
 
   gst_bus_set_flushing (downloader->priv->bus, FALSE);
+  if (downloader->priv->download)
+    g_object_unref (downloader->priv->download);
   downloader->priv->download = gst_fragment_new ();
   GST_OBJECT_UNLOCK (downloader);
   ret = gst_element_set_state (downloader->priv->urisrc, GST_STATE_READY);
diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am
index 4f0f09f..2d16768 100644
--- a/gst-libs/gst/video/Makefile.am
+++ b/gst-libs/gst/video/Makefile.am
@@ -1,13 +1,10 @@
 # variables used for enum generation
-ORC_SOURCE=bad-video-orc
-include $(top_srcdir)/common/orc.mak
-
 lib_LTLIBRARIES = libgstbadvideo-@GST_API_VERSION@.la
 
 CLEANFILES =
 
 libgstbadvideo_@GST_API_VERSION@_la_SOURCES = \
-	videoconvert.c gstvideoaggregator.c gstcms.c
+	gstvideoaggregator.c
 
 nodist_libgstbadvideo_@GST_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
 
@@ -17,10 +14,13 @@
 	-I$(top_builddir)/gst-libs \
 	$(GST_CFLAGS) $(ORC_CFLAGS) \
 	$(GST_PLUGINS_BASE_CFLAGS) \
-	$(GST_BASE_CFLAGS)
+	$(GST_BASE_CFLAGS) \
+	$(GST_VIDEO_CFLAGS)
 
-libgstbadvideo_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) -lgstvideo-$(GST_API_VERSION)\
-	$(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la $(LIBM)
+libgstbadvideo_@GST_API_VERSION@_la_LIBADD = \
+	$(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la \
+	$(GST_VIDEO_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
+
 libgstbadvideo_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
 
-noinst_HEADERS = gstcms.h videoconvert.h gstvideoaggregatorpad.h gstvideoaggregator.h
+noinst_HEADERS = gstvideoaggregatorpad.h gstvideoaggregator.h
diff --git a/gst-libs/gst/video/Makefile.in b/gst-libs/gst/video/Makefile.in
index 6e9c443..a2915dd 100644
--- a/gst-libs/gst/video/Makefile.in
+++ b/gst-libs/gst/video/Makefile.in
@@ -14,28 +14,6 @@
 
 @SET_MAKE@
 
-#
-# This is a makefile.am fragment to build Orc code.
-#
-# Define ORC_SOURCE and then include this file, such as:
-#
-#  ORC_SOURCE=gstadderorc
-#  include $(top_srcdir)/common/orc.mak
-#
-# This fragment will create tmp-orc.c and gstadderorc.h from
-# gstadderorc.orc.
-#
-# When 'make dist' is run at the top level, or 'make orc-update'
-# in a directory including this fragment, the generated source 
-# files will be copied to $(ORC_SOURCE)-dist.[ch].  These files
-# should be checked in to git, since they are used if Orc is
-# disabled.
-# 
-# Note that this file defines BUILT_SOURCES, so any later usage
-# of BUILT_SOURCES in the Makefile.am that includes this file
-# must use '+='.
-#
-
 
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
@@ -102,9 +80,9 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-DIST_COMMON = $(top_srcdir)/common/orc.mak $(srcdir)/Makefile.in \
-	$(srcdir)/Makefile.am $(top_srcdir)/depcomp $(noinst_HEADERS)
 subdir = gst-libs/gst/video
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
 	$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -112,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -125,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -176,17 +154,13 @@
 am__installdirs = "$(DESTDIR)$(libdir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstbadvideo_@GST_API_VERSION@_la_DEPENDENCIES =  \
+libgstbadvideo_@GST_API_VERSION@_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1) \
-	$(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 am_libgstbadvideo_@GST_API_VERSION@_la_OBJECTS =  \
-	libgstbadvideo_@GST_API_VERSION@_la-videoconvert.lo \
-	libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.lo \
-	libgstbadvideo_@GST_API_VERSION@_la-gstcms.lo
-am__objects_1 = libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.lo
-nodist_libgstbadvideo_@GST_API_VERSION@_la_OBJECTS = $(am__objects_1)
+	libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.lo
+nodist_libgstbadvideo_@GST_API_VERSION@_la_OBJECTS =
 libgstbadvideo_@GST_API_VERSION@_la_OBJECTS =  \
 	$(am_libgstbadvideo_@GST_API_VERSION@_la_OBJECTS) \
 	$(nodist_libgstbadvideo_@GST_API_VERSION@_la_OBJECTS)
@@ -278,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -318,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -326,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -375,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -455,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -464,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -477,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -502,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -575,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -604,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -640,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -680,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -707,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -760,20 +744,10 @@
 wayland_scanner = @wayland_scanner@
 
 # variables used for enum generation
-ORC_SOURCE = bad-video-orc
-EXTRA_DIST = $(ORC_SOURCE).orc
-ORC_NODIST_SOURCES = tmp-orc.c $(ORC_SOURCE).h
-BUILT_SOURCES = tmp-orc.c $(ORC_SOURCE).h
-orcc_v_gen = $(orcc_v_gen_$(V))
-orcc_v_gen_ = $(orcc_v_gen_$(AM_DEFAULT_VERBOSITY))
-orcc_v_gen_0 = @echo "  ORCC   $@";
-cp_v_gen = $(cp_v_gen_$(V))
-cp_v_gen_ = $(cp_v_gen_$(AM_DEFAULT_VERBOSITY))
-cp_v_gen_0 = @echo "  CP     $@";
 lib_LTLIBRARIES = libgstbadvideo-@GST_API_VERSION@.la
 CLEANFILES = 
 libgstbadvideo_@GST_API_VERSION@_la_SOURCES = \
-	videoconvert.c gstvideoaggregator.c gstcms.c
+	gstvideoaggregator.c
 
 nodist_libgstbadvideo_@GST_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
 libgstbadvideo_@GST_API_VERSION@_la_CFLAGS = \
@@ -782,19 +756,20 @@
 	-I$(top_builddir)/gst-libs \
 	$(GST_CFLAGS) $(ORC_CFLAGS) \
 	$(GST_PLUGINS_BASE_CFLAGS) \
-	$(GST_BASE_CFLAGS)
+	$(GST_BASE_CFLAGS) \
+	$(GST_VIDEO_CFLAGS)
 
-libgstbadvideo_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) -lgstvideo-$(GST_API_VERSION)\
-	$(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la $(LIBM)
+libgstbadvideo_@GST_API_VERSION@_la_LIBADD = \
+	$(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la \
+	$(GST_VIDEO_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
 
 libgstbadvideo_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-noinst_HEADERS = gstcms.h videoconvert.h gstvideoaggregatorpad.h gstvideoaggregator.h
-all: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) all-am
+noinst_HEADERS = gstvideoaggregatorpad.h gstvideoaggregator.h
+all: all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/common/orc.mak $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
@@ -815,7 +790,6 @@
 	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
 	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
 	esac;
-$(top_srcdir)/common/orc.mak:
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -870,10 +844,7 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstcms.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-videoconvert.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -899,13 +870,6 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstbadvideo_@GST_API_VERSION@_la-videoconvert.lo: videoconvert.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstbadvideo_@GST_API_VERSION@_la-videoconvert.lo -MD -MP -MF $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-videoconvert.Tpo -c -o libgstbadvideo_@GST_API_VERSION@_la-videoconvert.lo `test -f 'videoconvert.c' || echo '$(srcdir)/'`videoconvert.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-videoconvert.Tpo $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-videoconvert.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='videoconvert.c' object='libgstbadvideo_@GST_API_VERSION@_la-videoconvert.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstbadvideo_@GST_API_VERSION@_la-videoconvert.lo `test -f 'videoconvert.c' || echo '$(srcdir)/'`videoconvert.c
-
 libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.lo: gstvideoaggregator.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.lo -MD -MP -MF $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.Tpo -c -o libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.lo `test -f 'gstvideoaggregator.c' || echo '$(srcdir)/'`gstvideoaggregator.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.Tpo $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.Plo
@@ -913,20 +877,6 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstbadvideo_@GST_API_VERSION@_la-gstvideoaggregator.lo `test -f 'gstvideoaggregator.c' || echo '$(srcdir)/'`gstvideoaggregator.c
 
-libgstbadvideo_@GST_API_VERSION@_la-gstcms.lo: gstcms.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstbadvideo_@GST_API_VERSION@_la-gstcms.lo -MD -MP -MF $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstcms.Tpo -c -o libgstbadvideo_@GST_API_VERSION@_la-gstcms.lo `test -f 'gstcms.c' || echo '$(srcdir)/'`gstcms.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstcms.Tpo $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-gstcms.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstcms.c' object='libgstbadvideo_@GST_API_VERSION@_la-gstcms.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstbadvideo_@GST_API_VERSION@_la-gstcms.lo `test -f 'gstcms.c' || echo '$(srcdir)/'`gstcms.c
-
-libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.lo: tmp-orc.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -MT libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.lo -MD -MP -MF $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.Tpo -c -o libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.lo `test -f 'tmp-orc.c' || echo '$(srcdir)/'`tmp-orc.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.Tpo $(DEPDIR)/libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='tmp-orc.c' object='libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstbadvideo_@GST_API_VERSION@_la_CFLAGS) $(CFLAGS) -c -o libgstbadvideo_@GST_API_VERSION@_la-tmp-orc.lo `test -f 'tmp-orc.c' || echo '$(srcdir)/'`tmp-orc.c
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -1015,19 +965,14 @@
 	    || exit 1; \
 	  fi; \
 	done
-	$(MAKE) $(AM_MAKEFLAGS) \
-	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
-	  dist-hook
 check-am: all-am
-check: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) check-am
+check: check-am
 all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
 	for dir in "$(DESTDIR)$(libdir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
-install: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) install-am
+install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -1058,10 +1003,9 @@
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -1130,60 +1074,23 @@
 
 uninstall-am: uninstall-libLTLIBRARIES
 
-.MAKE: all check install install-am install-strip
+.MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libLTLIBRARIES clean-libtool clean-local cscopelist-am \
-	ctags ctags-am dist-hook distclean distclean-compile \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-libLTLIBRARIES \
-	install-man install-pdf install-pdf-am install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installdirs maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am uninstall-libLTLIBRARIES
+	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
+	ctags-am distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
 
 
-orc-update: tmp-orc.c $(ORC_SOURCE).h
-	$(top_srcdir)/common/gst-indent tmp-orc.c
-	cp tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c
-	cp $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h
-
-@HAVE_ORCC_TRUE@tmp-orc.c: $(srcdir)/$(ORC_SOURCE).orc
-@HAVE_ORCC_TRUE@	$(orcc_v_gen)$(ORCC) $(ORCC_FLAGS) --implementation --include glib.h -o tmp-orc.c $(srcdir)/$(ORC_SOURCE).orc
-
-@HAVE_ORCC_TRUE@$(ORC_SOURCE).h: $(srcdir)/$(ORC_SOURCE).orc
-@HAVE_ORCC_TRUE@	$(orcc_v_gen)$(ORCC) $(ORCC_FLAGS) --header --include glib.h -o $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE).orc
-@HAVE_ORCC_FALSE@tmp-orc.c: $(srcdir)/$(ORC_SOURCE).orc $(srcdir)/$(ORC_SOURCE)-dist.c
-@HAVE_ORCC_FALSE@	$(cp_v_gen)cp $(srcdir)/$(ORC_SOURCE)-dist.c tmp-orc.c
-
-@HAVE_ORCC_FALSE@$(ORC_SOURCE).h: $(srcdir)/$(ORC_SOURCE).orc $(srcdir)/$(ORC_SOURCE)-dist.c
-@HAVE_ORCC_FALSE@	$(cp_v_gen)cp $(srcdir)/$(ORC_SOURCE)-dist.h $(ORC_SOURCE).h
-
-clean-local: clean-orc
-.PHONY: clean-orc
-clean-orc:
-	rm -f tmp-orc.c $(ORC_SOURCE).h
-
-dist-hook: dist-hook-orc
-.PHONY: dist-hook-orc
-
-# we try and copy updated orc -dist files below, but don't fail if it
-# doesn't work as the srcdir might not be writable
-dist-hook-orc: tmp-orc.c $(ORC_SOURCE).h
-	$(top_srcdir)/common/gst-indent tmp-orc.c
-	rm -f tmp-orc.c~
-	cmp -s tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c || \
-	  cp tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c || true
-	cmp -s $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h || \
-	  cp $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h || true
-	cp -p tmp-orc.c $(distdir)/$(ORC_SOURCE)-dist.c
-	cp -p $(ORC_SOURCE).h $(distdir)/$(ORC_SOURCE)-dist.h
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/gst-libs/gst/video/bad-video-orc-dist.c b/gst-libs/gst/video/bad-video-orc-dist.c
deleted file mode 100644
index 743f799..0000000
--- a/gst-libs/gst/video/bad-video-orc-dist.c
+++ /dev/null
@@ -1,8898 +0,0 @@
-
-/* autogenerated from bad-video-orc.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 ORC_INTERNAL
-#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
-#define ORC_INTERNAL __hidden
-#elif defined (__GNUC__)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#else
-#define ORC_INTERNAL
-#endif
-#endif
-
-
-#ifndef DISABLE_ORC
-#include <orc/orc.h>
-#endif
-void bad_video_convert_orc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride,
-    const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_I420_BGRA (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);
-
-
-/* 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)&0xffU)<<8) | (((x)&0xff00U)>>8))
-#define ORC_SWAP_L(x) ((((x)&0xffU)<<24) | (((x)&0xff00U)<<8) | (((x)&0xff0000U)>>8) | (((x)&0xff000000U)>>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 */
-
-
-
-/* bad_video_convert_orc_memcpy_2d */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 31, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 109, 101, 109, 99, 112,
-            121,
-        95, 50, 100, 11, 1, 1, 12, 1, 1, 42, 0, 4, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_memcpy_2d);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_memcpy_2d");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_I420_UYVY */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111, 110,
-        118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101, 114,
-            116,
-        95, 73, 52, 50, 48, 95, 85, 89, 86, 89, 11, 4, 4, 11, 4, 4,
-        12, 2, 2, 12, 2, 2, 12, 1, 1, 12, 1, 1, 20, 2, 196, 32,
-        6, 7, 21, 1, 196, 0, 32, 4, 21, 1, 196, 1, 32, 5, 2, 0,
-
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_I420_UYVY);
-#else
-      p = orc_program_new ();
-      orc_program_set_name (p, "bad_video_convert_orc_convert_I420_UYVY");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_I420_YUY2 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111, 110,
-        118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101, 114,
-            116,
-        95, 73, 52, 50, 48, 95, 89, 85, 89, 50, 11, 4, 4, 11, 4, 4,
-        12, 2, 2, 12, 2, 2, 12, 1, 1, 12, 1, 1, 20, 2, 196, 32,
-        6, 7, 21, 1, 196, 0, 4, 32, 21, 1, 196, 1, 5, 32, 2, 0,
-
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_I420_YUY2);
-#else
-      p = orc_program_new ();
-      orc_program_set_name (p, "bad_video_convert_orc_convert_I420_YUY2");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_I420_AYUV */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var36;
-#else
-  orc_int8 var36;
-#endif
-  orc_int8 var37;
-  orc_union32 var38;
-  orc_int8 var39;
-  orc_union32 var40;
-  orc_int8 var41;
-  orc_int8 var42;
-  orc_union16 var43;
-  orc_union16 var44;
-  orc_union16 var45;
-
-  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 */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadupdb */
-    var41 = ptr6[i >> 1];
-    /* 1: loadupdb */
-    var42 = ptr7[i >> 1];
-    /* 2: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var41;
-      _dest.x2[1] = var42;
-      var43.i = _dest.i;
-    }
-    /* 4: loadb */
-    var37 = ptr4[i];
-    /* 5: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var36;
-      _dest.x2[1] = var37;
-      var44.i = _dest.i;
-    }
-    /* 6: mergewl */
-    {
-      orc_union32 _dest;
-      _dest.x2[0] = var44.i;
-      _dest.x2[1] = var43.i;
-      var38.i = _dest.i;
-    }
-    /* 7: storel */
-    ptr0[i] = var38;
-    /* 8: loadb */
-    var39 = ptr5[i];
-    /* 9: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var36;
-      _dest.x2[1] = var39;
-      var45.i = _dest.i;
-    }
-    /* 10: mergewl */
-    {
-      orc_union32 _dest;
-      _dest.x2[0] = var45.i;
-      _dest.x2[1] = var43.i;
-      var40.i = _dest.i;
-    }
-    /* 11: storel */
-    ptr1[i] = var40;
-  }
-
-}
-
-#else
-static void
-_backup_bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var36;
-#else
-  orc_int8 var36;
-#endif
-  orc_int8 var37;
-  orc_union32 var38;
-  orc_int8 var39;
-  orc_union32 var40;
-  orc_int8 var41;
-  orc_int8 var42;
-  orc_union16 var43;
-  orc_union16 var44;
-  orc_union16 var45;
-
-  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 */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadupdb */
-    var41 = ptr6[i >> 1];
-    /* 1: loadupdb */
-    var42 = ptr7[i >> 1];
-    /* 2: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var41;
-      _dest.x2[1] = var42;
-      var43.i = _dest.i;
-    }
-    /* 4: loadb */
-    var37 = ptr4[i];
-    /* 5: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var36;
-      _dest.x2[1] = var37;
-      var44.i = _dest.i;
-    }
-    /* 6: mergewl */
-    {
-      orc_union32 _dest;
-      _dest.x2[0] = var44.i;
-      _dest.x2[1] = var43.i;
-      var38.i = _dest.i;
-    }
-    /* 7: storel */
-    ptr0[i] = var38;
-    /* 8: loadb */
-    var39 = ptr5[i];
-    /* 9: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var36;
-      _dest.x2[1] = var39;
-      var45.i = _dest.i;
-    }
-    /* 10: mergewl */
-    {
-      orc_union32 _dest;
-      _dest.x2[0] = var45.i;
-      _dest.x2[1] = var43.i;
-      var40.i = _dest.i;
-    }
-    /* 11: storel */
-    ptr1[i] = var40;
-  }
-
-}
-
-void
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111, 110,
-        118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101, 114,
-            116,
-        95, 73, 52, 50, 48, 95, 65, 89, 85, 86, 11, 4, 4, 11, 4, 4,
-        12, 1, 1, 12, 1, 1, 12, 1, 1, 12, 1, 1, 14, 1, 255, 0,
-        0, 0, 20, 2, 20, 2, 20, 1, 20, 1, 45, 34, 6, 45, 35, 7,
-        196, 32, 34, 35, 196, 33, 16, 4, 195, 0, 33, 32, 196, 33, 16, 5,
-        195, 1, 33, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_I420_AYUV);
-#else
-      p = orc_program_new ();
-      orc_program_set_name (p, "bad_video_convert_orc_convert_I420_AYUV");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_YUY2_I420 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111, 110,
-        118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101, 114,
-            116,
-        95, 89, 85, 89, 50, 95, 73, 52, 50, 48, 11, 2, 2, 11, 2, 2,
-        11, 1, 1, 11, 1, 1, 12, 4, 4, 12, 4, 4, 20, 2, 20, 2,
-        20, 2, 21, 1, 199, 32, 34, 4, 97, 0, 34, 21, 1, 199, 33, 34,
-        5, 97, 1, 34, 21, 1, 39, 32, 32, 33, 199, 3, 2, 32, 2, 0,
-
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_YUY2_I420);
-#else
-      p = orc_program_new ();
-      orc_program_set_name (p, "bad_video_convert_orc_convert_YUY2_I420");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_UYVY_YUY2 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 85, 89, 86, 89, 95, 89, 85, 89, 50, 11, 4, 4, 12, 4,
-        4, 21, 1, 183, 0, 4, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_UYVY_YUY2);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_UYVY_YUY2");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_planar_chroma_420_422 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 43, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 112, 108, 97, 110, 97,
-            114,
-        95, 99, 104, 114, 111, 109, 97, 95, 52, 50, 48, 95, 52, 50, 50, 11,
-        1, 1, 11, 1, 1, 12, 1, 1, 42, 0, 4, 42, 1, 4, 2, 0,
-
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_planar_chroma_420_422);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_planar_chroma_420_422");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_planar_chroma_420_444 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 43, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 112, 108, 97, 110, 97,
-            114,
-        95, 99, 104, 114, 111, 109, 97, 95, 52, 50, 48, 95, 52, 52, 52, 11,
-        2, 2, 11, 2, 2, 12, 1, 1, 20, 2, 151, 32, 4, 97, 0, 32,
-        97, 1, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_planar_chroma_420_444);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_planar_chroma_420_444");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_planar_chroma_422_444 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 43, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 112, 108, 97, 110, 97,
-            114,
-        95, 99, 104, 114, 111, 109, 97, 95, 52, 50, 50, 95, 52, 52, 52, 11,
-        2, 2, 12, 1, 1, 20, 2, 151, 32, 4, 97, 0, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_planar_chroma_422_444);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_planar_chroma_422_444");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_planar_chroma_444_422 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 43, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 112, 108, 97, 110, 97,
-            114,
-        95, 99, 104, 114, 111, 109, 97, 95, 52, 52, 52, 95, 52, 50, 50, 11,
-        1, 1, 12, 2, 2, 20, 1, 20, 1, 199, 32, 33, 4, 39, 0, 32,
-        33, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_planar_chroma_444_422);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_planar_chroma_444_422");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_planar_chroma_444_420 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 43, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 112, 108, 97, 110, 97,
-            114,
-        95, 99, 104, 114, 111, 109, 97, 95, 52, 52, 52, 95, 52, 50, 48, 11,
-        1, 1, 12, 2, 2, 12, 2, 2, 20, 2, 20, 1, 20, 1, 21, 1,
-        39, 32, 4, 5, 199, 33, 34, 32, 39, 0, 33, 34, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_planar_chroma_444_420);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_planar_chroma_444_420");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_planar_chroma_422_420 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 43, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 112, 108, 97, 110, 97,
-            114,
-        95, 99, 104, 114, 111, 109, 97, 95, 52, 50, 50, 95, 52, 50, 48, 11,
-        1, 1, 12, 1, 1, 12, 1, 1, 39, 0, 4, 5, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_planar_chroma_422_420);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_planar_chroma_422_420");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_YUY2_AYUV */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union16 var37;
-#else
-  orc_union16 var37;
-#endif
-  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_bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union16 var37;
-#else
-  orc_union16 var37;
-#endif
-  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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 85, 89, 50, 95, 65, 89, 85, 86, 11, 8, 8, 12, 4,
-        4, 14, 2, 255, 0, 0, 0, 20, 2, 20, 2, 20, 4, 20, 4, 21,
-        1, 199, 33, 32, 4, 21, 1, 196, 34, 16, 32, 195, 35, 33, 33, 21,
-        1, 195, 0, 34, 35, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_YUY2_AYUV);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_YUY2_AYUV");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_UYVY_AYUV */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union16 var37;
-#else
-  orc_union16 var37;
-#endif
-  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_bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union16 var37;
-#else
-  orc_union16 var37;
-#endif
-  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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 85, 89, 86, 89, 95, 65, 89, 85, 86, 11, 8, 8, 12, 4,
-        4, 14, 2, 255, 0, 0, 0, 20, 2, 20, 2, 20, 4, 20, 4, 21,
-        1, 199, 32, 33, 4, 21, 1, 196, 34, 16, 32, 195, 35, 33, 33, 21,
-        1, 195, 0, 34, 35, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_UYVY_AYUV);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_UYVY_AYUV");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_YUY2_Y42B */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 85, 89, 50, 95, 89, 52, 50, 66, 11, 2, 2, 11, 1,
-        1, 11, 1, 1, 12, 4, 4, 20, 2, 21, 1, 199, 32, 0, 4, 199,
-        2, 1, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_YUY2_Y42B);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_YUY2_Y42B");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_UYVY_Y42B */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 85, 89, 86, 89, 95, 89, 52, 50, 66, 11, 2, 2, 11, 1,
-        1, 11, 1, 1, 12, 4, 4, 20, 2, 21, 1, 199, 0, 32, 4, 199,
-        2, 1, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_UYVY_Y42B);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_UYVY_Y42B");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_YUY2_Y444 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 85, 89, 50, 95, 89, 52, 52, 52, 11, 2, 2, 11, 2,
-        2, 11, 2, 2, 12, 4, 4, 20, 2, 20, 1, 20, 1, 21, 1, 199,
-        32, 0, 4, 199, 34, 33, 32, 151, 1, 33, 151, 2, 34, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_YUY2_Y444);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_YUY2_Y444");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_UYVY_Y444 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 85, 89, 86, 89, 95, 89, 52, 52, 52, 11, 2, 2, 11, 2,
-        2, 11, 2, 2, 12, 4, 4, 20, 2, 20, 1, 20, 1, 21, 1, 199,
-        0, 32, 4, 199, 34, 33, 32, 151, 1, 33, 151, 2, 34, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_UYVY_Y444);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_UYVY_Y444");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_UYVY_I420 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111, 110,
-        118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101, 114,
-            116,
-        95, 85, 89, 86, 89, 95, 73, 52, 50, 48, 11, 2, 2, 11, 2, 2,
-        11, 1, 1, 11, 1, 1, 12, 4, 4, 12, 4, 4, 20, 2, 20, 2,
-        20, 2, 21, 1, 199, 34, 32, 4, 97, 0, 34, 21, 1, 199, 34, 33,
-        5, 97, 1, 34, 21, 1, 39, 32, 32, 33, 199, 3, 2, 32, 2, 0,
-
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_UYVY_I420);
-#else
-      p = orc_program_new ();
-      orc_program_set_name (p, "bad_video_convert_orc_convert_UYVY_I420");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_I420 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 73, 52, 50, 48, 11, 2, 2, 11, 2,
-        2, 11, 1, 1, 11, 1, 1, 12, 8, 8, 12, 8, 8, 20, 4, 20,
-        4, 20, 4, 20, 4, 20, 2, 20, 2, 20, 1, 20, 1, 21, 1, 198,
-        33, 32, 4, 21, 1, 189, 0, 32, 21, 1, 198, 34, 32, 5, 21, 1,
-        189, 1, 32, 21, 2, 39, 35, 33, 34, 21, 1, 199, 37, 36, 35, 199,
-        38, 39, 36, 39, 2, 38, 39, 199, 38, 39, 37, 39, 3, 38, 39, 2,
-        0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_I420);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_I420");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_YUY2 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 89, 85, 89, 50, 11, 4, 4, 12, 8,
-        8, 20, 2, 20, 2, 20, 2, 20, 4, 20, 4, 21, 1, 198, 36, 35,
-        4, 198, 33, 34, 36, 21, 1, 39, 33, 33, 34, 21, 1, 189, 32, 35,
-        21, 1, 196, 0, 32, 33, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_YUY2);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_YUY2");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_UYVY */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 85, 89, 86, 89, 11, 4, 4, 12, 8,
-        8, 20, 2, 20, 2, 20, 2, 20, 4, 20, 4, 21, 1, 198, 36, 35,
-        4, 198, 33, 34, 36, 21, 1, 39, 33, 33, 34, 21, 1, 189, 32, 35,
-        21, 1, 196, 0, 33, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_UYVY);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_UYVY");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_Y42B */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 89, 52, 50, 66, 11, 2, 2, 11, 1,
-        1, 11, 1, 1, 12, 8, 8, 20, 4, 20, 4, 20, 2, 20, 2, 21,
-        1, 198, 33, 32, 4, 198, 34, 35, 33, 21, 1, 39, 34, 34, 35, 199,
-        2, 1, 34, 21, 1, 189, 0, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_Y42B);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_Y42B");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_Y444 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 89, 52, 52, 52, 11, 1, 1, 11, 1,
-        1, 11, 1, 1, 12, 4, 4, 20, 2, 20, 2, 198, 33, 32, 4, 199,
-        2, 1, 33, 189, 0, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_Y444);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_Y444");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_Y42B_YUY2 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 52, 50, 66, 95, 89, 85, 89, 50, 11, 4, 4, 12, 2,
-        2, 12, 1, 1, 12, 1, 1, 20, 2, 196, 32, 5, 6, 21, 1, 196,
-        0, 4, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_Y42B_YUY2);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_Y42B_YUY2");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_Y42B_UYVY */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 52, 50, 66, 95, 85, 89, 86, 89, 11, 4, 4, 12, 2,
-        2, 12, 1, 1, 12, 1, 1, 20, 2, 196, 32, 5, 6, 21, 1, 196,
-        0, 32, 4, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_Y42B_UYVY);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_Y42B_UYVY");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_Y42B_AYUV */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union16 var38;
-#else
-  orc_union16 var38;
-#endif
-  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_bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union16 var38;
-#else
-  orc_union16 var38;
-#endif
-  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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 52, 50, 66, 95, 65, 89, 85, 86, 11, 8, 8, 12, 2,
-        2, 12, 1, 1, 12, 1, 1, 14, 1, 255, 0, 0, 0, 20, 2, 20,
-        2, 20, 4, 20, 4, 196, 32, 5, 6, 21, 1, 196, 35, 16, 4, 195,
-        34, 32, 32, 21, 1, 195, 0, 35, 34, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_Y42B_AYUV);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_Y42B_AYUV");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_Y444_YUY2 */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 52, 52, 52, 95, 89, 85, 89, 50, 11, 4, 4, 12, 2,
-        2, 12, 2, 2, 12, 2, 2, 20, 2, 20, 4, 20, 2, 20, 2, 21,
-        1, 196, 33, 5, 6, 198, 34, 35, 33, 21, 1, 39, 32, 34, 35, 21,
-        1, 196, 0, 4, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_Y444_YUY2);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_Y444_YUY2");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_Y444_UYVY */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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_bad_video_convert_orc_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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 52, 52, 52, 95, 85, 89, 86, 89, 11, 4, 4, 12, 2,
-        2, 12, 2, 2, 12, 2, 2, 20, 2, 20, 4, 20, 2, 20, 2, 21,
-        1, 196, 33, 5, 6, 198, 34, 35, 33, 21, 1, 39, 32, 34, 35, 21,
-        1, 196, 0, 32, 4, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_Y444_UYVY);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_Y444_UYVY");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_Y444_AYUV */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var36;
-#else
-  orc_int8 var36;
-#endif
-  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_bad_video_convert_orc_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;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var36;
-#else
-  orc_int8 var36;
-#endif
-  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
-bad_video_convert_orc_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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 89, 52, 52, 52, 95, 65, 89, 85, 86, 11, 4, 4, 12, 1,
-        1, 12, 1, 1, 12, 1, 1, 14, 1, 255, 0, 0, 0, 20, 2, 20,
-        2, 196, 32, 5, 6, 196, 33, 16, 4, 195, 0, 33, 32, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_Y444_AYUV);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_Y444_AYUV");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_ARGB */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  int i;
-  int j;
-  orc_union32 *ORC_RESTRICT ptr0;
-  const orc_union32 *ORC_RESTRICT ptr4;
-  orc_union32 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  for (j = 0; j < m; j++) {
-    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
-    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
-
-    /* 1: loadpb */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = p1;
-    /* 11: loadpw */
-    var49.i = p2;
-    /* 14: loadpw */
-    var50.i = p3;
-    /* 17: loadpw */
-    var51.i = p4;
-    /* 20: loadpw */
-    var52.i = p5;
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var58;
-        _dest.x2[1] = var73;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var74;
-        _dest.x2[1] = var75;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-#else
-static void
-_backup_bad_video_convert_orc_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 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  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 */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = ex->params[24];
-    /* 11: loadpw */
-    var49.i = ex->params[25];
-    /* 14: loadpw */
-    var50.i = ex->params[26];
-    /* 17: loadpw */
-    var51.i = ex->params[27];
-    /* 20: loadpw */
-    var52.i = ex->params[28];
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var58;
-        _dest.x2[1] = var73;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var74;
-        _dest.x2[1] = var75;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-void
-bad_video_convert_orc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  OrcExecutor _ex, *ex = &_ex;
-  static volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 65, 82, 71, 66, 11, 4, 4, 12, 4,
-        4, 14, 1, 128, 0, 0, 0, 16, 2, 16, 2, 16, 2, 16, 2, 16,
-        2, 20, 1, 20, 1, 20, 1, 20, 1, 20, 2, 20, 2, 20, 2, 20,
-        2, 20, 2, 20, 2, 20, 1, 20, 1, 20, 1, 20, 4, 21, 2, 65,
-        45, 4, 16, 198, 38, 36, 45, 199, 33, 32, 36, 199, 35, 34, 38, 151,
-        36, 33, 151, 37, 34, 151, 38, 35, 90, 36, 36, 24, 90, 39, 38, 25,
-        71, 39, 36, 39, 90, 41, 37, 26, 71, 41, 36, 41, 90, 40, 37, 27,
-        71, 40, 36, 40, 90, 36, 38, 28, 71, 40, 40, 36, 159, 42, 39, 159,
-        43, 40, 159, 44, 41, 196, 39, 32, 42, 196, 41, 43, 44, 195, 45, 39,
-        41, 21, 2, 33, 0, 45, 16, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_ARGB);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_ARGB");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_ARGB);
-      orc_program_add_destination (p, 4, "d1");
-      orc_program_add_source (p, 4, "s1");
-      orc_program_add_constant (p, 1, 0x00000080, "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_parameter (p, 2, "p5");
-      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_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", 2, ORC_VAR_T14, ORC_VAR_S1, ORC_VAR_C1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T7, ORC_VAR_T5,
-          ORC_VAR_T14, ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T5,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T7,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_P1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_P2,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_T8,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T10, ORC_VAR_T6, ORC_VAR_P3,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T5,
-          ORC_VAR_T10, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_P4,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T5, ORC_VAR_T9,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T7, ORC_VAR_P5,
-          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, "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_T8, ORC_VAR_T1,
-          ORC_VAR_T11, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T10, ORC_VAR_T12,
-          ORC_VAR_T13, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T14, ORC_VAR_T8,
-          ORC_VAR_T10, ORC_VAR_D1);
-      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, ORC_VAR_C1,
-          ORC_VAR_D1);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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->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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_BGRA */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  int i;
-  int j;
-  orc_union32 *ORC_RESTRICT ptr0;
-  const orc_union32 *ORC_RESTRICT ptr4;
-  orc_union32 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  for (j = 0; j < m; j++) {
-    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
-    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
-
-    /* 1: loadpb */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = p1;
-    /* 11: loadpw */
-    var49.i = p2;
-    /* 14: loadpw */
-    var50.i = p3;
-    /* 17: loadpw */
-    var51.i = p4;
-    /* 20: loadpw */
-    var52.i = p5;
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var75;
-        _dest.x2[1] = var74;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var73;
-        _dest.x2[1] = var58;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-#else
-static void
-_backup_bad_video_convert_orc_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 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  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 */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = ex->params[24];
-    /* 11: loadpw */
-    var49.i = ex->params[25];
-    /* 14: loadpw */
-    var50.i = ex->params[26];
-    /* 17: loadpw */
-    var51.i = ex->params[27];
-    /* 20: loadpw */
-    var52.i = ex->params[28];
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var75;
-        _dest.x2[1] = var74;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var73;
-        _dest.x2[1] = var58;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-void
-bad_video_convert_orc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  OrcExecutor _ex, *ex = &_ex;
-  static volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 66, 71, 82, 65, 11, 4, 4, 12, 4,
-        4, 14, 1, 128, 0, 0, 0, 16, 2, 16, 2, 16, 2, 16, 2, 16,
-        2, 20, 1, 20, 1, 20, 1, 20, 1, 20, 2, 20, 2, 20, 2, 20,
-        2, 20, 2, 20, 2, 20, 1, 20, 1, 20, 1, 20, 4, 21, 2, 65,
-        45, 4, 16, 198, 38, 36, 45, 199, 33, 32, 36, 199, 35, 34, 38, 151,
-        36, 33, 151, 37, 34, 151, 38, 35, 90, 36, 36, 24, 90, 39, 38, 25,
-        71, 39, 36, 39, 90, 41, 37, 26, 71, 41, 36, 41, 90, 40, 37, 27,
-        71, 40, 36, 40, 90, 36, 38, 28, 71, 40, 40, 36, 159, 42, 39, 159,
-        43, 40, 159, 44, 41, 196, 41, 44, 43, 196, 39, 42, 32, 195, 45, 41,
-        39, 21, 2, 33, 0, 45, 16, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_BGRA);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_BGRA");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_BGRA);
-      orc_program_add_destination (p, 4, "d1");
-      orc_program_add_source (p, 4, "s1");
-      orc_program_add_constant (p, 1, 0x00000080, "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_parameter (p, 2, "p5");
-      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_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", 2, ORC_VAR_T14, ORC_VAR_S1, ORC_VAR_C1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T7, ORC_VAR_T5,
-          ORC_VAR_T14, ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T5,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T7,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_P1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_P2,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_T8,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T10, ORC_VAR_T6, ORC_VAR_P3,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T5,
-          ORC_VAR_T10, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_P4,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T5, ORC_VAR_T9,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T7, ORC_VAR_P5,
-          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, "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_T10, ORC_VAR_T13,
-          ORC_VAR_T12, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T8, ORC_VAR_T11,
-          ORC_VAR_T1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T14, ORC_VAR_T10,
-          ORC_VAR_T8, ORC_VAR_D1);
-      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, ORC_VAR_C1,
-          ORC_VAR_D1);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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->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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_ABGR */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  int i;
-  int j;
-  orc_union32 *ORC_RESTRICT ptr0;
-  const orc_union32 *ORC_RESTRICT ptr4;
-  orc_union32 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  for (j = 0; j < m; j++) {
-    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
-    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
-
-    /* 1: loadpb */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = p1;
-    /* 11: loadpw */
-    var49.i = p2;
-    /* 14: loadpw */
-    var50.i = p3;
-    /* 17: loadpw */
-    var51.i = p4;
-    /* 20: loadpw */
-    var52.i = p5;
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var58;
-        _dest.x2[1] = var75;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var74;
-        _dest.x2[1] = var73;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-#else
-static void
-_backup_bad_video_convert_orc_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 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  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 */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = ex->params[24];
-    /* 11: loadpw */
-    var49.i = ex->params[25];
-    /* 14: loadpw */
-    var50.i = ex->params[26];
-    /* 17: loadpw */
-    var51.i = ex->params[27];
-    /* 20: loadpw */
-    var52.i = ex->params[28];
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var58;
-        _dest.x2[1] = var75;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var74;
-        _dest.x2[1] = var73;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-void
-bad_video_convert_orc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  OrcExecutor _ex, *ex = &_ex;
-  static volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 65, 66, 71, 82, 11, 4, 4, 12, 4,
-        4, 14, 1, 128, 0, 0, 0, 16, 2, 16, 2, 16, 2, 16, 2, 16,
-        2, 20, 1, 20, 1, 20, 1, 20, 1, 20, 2, 20, 2, 20, 2, 20,
-        2, 20, 2, 20, 2, 20, 1, 20, 1, 20, 1, 20, 4, 21, 2, 65,
-        45, 4, 16, 198, 38, 36, 45, 199, 33, 32, 36, 199, 35, 34, 38, 151,
-        36, 33, 151, 37, 34, 151, 38, 35, 90, 36, 36, 24, 90, 39, 38, 25,
-        71, 39, 36, 39, 90, 41, 37, 26, 71, 41, 36, 41, 90, 40, 37, 27,
-        71, 40, 36, 40, 90, 36, 38, 28, 71, 40, 40, 36, 159, 42, 39, 159,
-        43, 40, 159, 44, 41, 196, 41, 32, 44, 196, 39, 43, 42, 195, 45, 41,
-        39, 21, 2, 33, 0, 45, 16, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_ABGR);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_ABGR");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_ABGR);
-      orc_program_add_destination (p, 4, "d1");
-      orc_program_add_source (p, 4, "s1");
-      orc_program_add_constant (p, 1, 0x00000080, "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_parameter (p, 2, "p5");
-      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_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", 2, ORC_VAR_T14, ORC_VAR_S1, ORC_VAR_C1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T7, ORC_VAR_T5,
-          ORC_VAR_T14, ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T5,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T7,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_P1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_P2,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_T8,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T10, ORC_VAR_T6, ORC_VAR_P3,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T5,
-          ORC_VAR_T10, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_P4,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T5, ORC_VAR_T9,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T7, ORC_VAR_P5,
-          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, "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_T10, ORC_VAR_T1,
-          ORC_VAR_T13, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T8, ORC_VAR_T12,
-          ORC_VAR_T11, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T14, ORC_VAR_T10,
-          ORC_VAR_T8, ORC_VAR_D1);
-      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, ORC_VAR_C1,
-          ORC_VAR_D1);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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->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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_AYUV_RGBA */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  int i;
-  int j;
-  orc_union32 *ORC_RESTRICT ptr0;
-  const orc_union32 *ORC_RESTRICT ptr4;
-  orc_union32 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  for (j = 0; j < m; j++) {
-    ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j);
-    ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j);
-
-    /* 1: loadpb */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = p1;
-    /* 11: loadpw */
-    var49.i = p2;
-    /* 14: loadpw */
-    var50.i = p3;
-    /* 17: loadpw */
-    var51.i = p4;
-    /* 20: loadpw */
-    var52.i = p5;
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var73;
-        _dest.x2[1] = var74;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var75;
-        _dest.x2[1] = var58;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-#else
-static void
-_backup_bad_video_convert_orc_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 var46;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var47;
-#else
-  orc_union32 var47;
-#endif
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-  orc_union16 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_int8 var59;
-  orc_int8 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 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_int8 var73;
-  orc_int8 var74;
-  orc_int8 var75;
-  orc_union16 var76;
-  orc_union16 var77;
-  orc_union32 var78;
-
-  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 */
-    var47.x4[0] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[1] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[2] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    var47.x4[3] = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-    /* 9: loadpw */
-    var48.i = ex->params[24];
-    /* 11: loadpw */
-    var49.i = ex->params[25];
-    /* 14: loadpw */
-    var50.i = ex->params[26];
-    /* 17: loadpw */
-    var51.i = ex->params[27];
-    /* 20: loadpw */
-    var52.i = ex->params[28];
-
-    for (i = 0; i < n; i++) {
-      /* 0: loadl */
-      var46 = ptr4[i];
-      /* 2: subb */
-      var54.x4[0] = var46.x4[0] - var47.x4[0];
-      var54.x4[1] = var46.x4[1] - var47.x4[1];
-      var54.x4[2] = var46.x4[2] - var47.x4[2];
-      var54.x4[3] = var46.x4[3] - var47.x4[3];
-      /* 3: splitlw */
-      {
-        orc_union32 _src;
-        _src.i = var54.i;
-        var55.i = _src.x2[1];
-        var56.i = _src.x2[0];
-      }
-      /* 4: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var56.i;
-        var57 = _src.x2[1];
-        var58 = _src.x2[0];
-      }
-      /* 5: splitwb */
-      {
-        orc_union16 _src;
-        _src.i = var55.i;
-        var59 = _src.x2[1];
-        var60 = _src.x2[0];
-      }
-      /* 6: splatbw */
-      var61.i = ((var57 & 0xff) << 8) | (var57 & 0xff);
-      /* 7: splatbw */
-      var62.i = ((var60 & 0xff) << 8) | (var60 & 0xff);
-      /* 8: splatbw */
-      var63.i = ((var59 & 0xff) << 8) | (var59 & 0xff);
-      /* 10: mulhsw */
-      var64.i = (var61.i * var48.i) >> 16;
-      /* 12: mulhsw */
-      var65.i = (var63.i * var49.i) >> 16;
-      /* 13: addssw */
-      var66.i = ORC_CLAMP_SW (var64.i + var65.i);
-      /* 15: mulhsw */
-      var67.i = (var62.i * var50.i) >> 16;
-      /* 16: addssw */
-      var68.i = ORC_CLAMP_SW (var64.i + var67.i);
-      /* 18: mulhsw */
-      var69.i = (var62.i * var51.i) >> 16;
-      /* 19: addssw */
-      var70.i = ORC_CLAMP_SW (var64.i + var69.i);
-      /* 21: mulhsw */
-      var71.i = (var63.i * var52.i) >> 16;
-      /* 22: addssw */
-      var72.i = ORC_CLAMP_SW (var70.i + var71.i);
-      /* 23: convssswb */
-      var73 = ORC_CLAMP_SB (var66.i);
-      /* 24: convssswb */
-      var74 = ORC_CLAMP_SB (var72.i);
-      /* 25: convssswb */
-      var75 = ORC_CLAMP_SB (var68.i);
-      /* 26: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var73;
-        _dest.x2[1] = var74;
-        var76.i = _dest.i;
-      }
-      /* 27: mergebw */
-      {
-        orc_union16 _dest;
-        _dest.x2[0] = var75;
-        _dest.x2[1] = var58;
-        var77.i = _dest.i;
-      }
-      /* 28: mergewl */
-      {
-        orc_union32 _dest;
-        _dest.x2[0] = var76.i;
-        _dest.x2[1] = var77.i;
-        var78.i = _dest.i;
-      }
-      /* 29: addb */
-      var53.x4[0] = var78.x4[0] + var47.x4[0];
-      var53.x4[1] = var78.x4[1] + var47.x4[1];
-      var53.x4[2] = var78.x4[2] + var47.x4[2];
-      var53.x4[3] = var78.x4[3] + var47.x4[3];
-      /* 30: storel */
-      ptr0[i] = var53;
-    }
-  }
-
-}
-
-void
-bad_video_convert_orc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1,
-    int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1,
-    int p2, int p3, int p4, int p5, int n, int m)
-{
-  OrcExecutor _ex, *ex = &_ex;
-  static volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 7, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111,
-        110, 118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101,
-            114,
-        116, 95, 65, 89, 85, 86, 95, 82, 71, 66, 65, 11, 4, 4, 12, 4,
-        4, 14, 1, 128, 0, 0, 0, 16, 2, 16, 2, 16, 2, 16, 2, 16,
-        2, 20, 1, 20, 1, 20, 1, 20, 1, 20, 2, 20, 2, 20, 2, 20,
-        2, 20, 2, 20, 2, 20, 1, 20, 1, 20, 1, 20, 4, 21, 2, 65,
-        45, 4, 16, 198, 38, 36, 45, 199, 33, 32, 36, 199, 35, 34, 38, 151,
-        36, 33, 151, 37, 34, 151, 38, 35, 90, 36, 36, 24, 90, 39, 38, 25,
-        71, 39, 36, 39, 90, 41, 37, 26, 71, 41, 36, 41, 90, 40, 37, 27,
-        71, 40, 36, 40, 90, 36, 38, 28, 71, 40, 40, 36, 159, 42, 39, 159,
-        43, 40, 159, 44, 41, 196, 39, 42, 43, 196, 41, 44, 32, 195, 45, 39,
-        41, 21, 2, 33, 0, 45, 16, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_RGBA);
-#else
-      p = orc_program_new ();
-      orc_program_set_2d (p);
-      orc_program_set_name (p, "bad_video_convert_orc_convert_AYUV_RGBA");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_AYUV_RGBA);
-      orc_program_add_destination (p, 4, "d1");
-      orc_program_add_source (p, 4, "s1");
-      orc_program_add_constant (p, 1, 0x00000080, "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_parameter (p, 2, "p5");
-      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_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", 2, ORC_VAR_T14, ORC_VAR_S1, ORC_VAR_C1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T7, ORC_VAR_T5,
-          ORC_VAR_T14, ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T5,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T7,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_P1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_P2,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_T8,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T10, ORC_VAR_T6, ORC_VAR_P3,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T5,
-          ORC_VAR_T10, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_P4,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T5, ORC_VAR_T9,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T7, ORC_VAR_P5,
-          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, "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_T8, ORC_VAR_T11,
-          ORC_VAR_T12, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T10, ORC_VAR_T13,
-          ORC_VAR_T1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T14, ORC_VAR_T8,
-          ORC_VAR_T10, ORC_VAR_D1);
-      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, ORC_VAR_C1,
-          ORC_VAR_D1);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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->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 = c->exec;
-  func (ex);
-}
-#endif
-
-
-/* bad_video_convert_orc_convert_I420_BGRA */
-#ifdef DISABLE_ORC
-void
-bad_video_convert_orc_convert_I420_BGRA (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_union32 *ORC_RESTRICT ptr0;
-  const orc_int8 *ORC_RESTRICT ptr4;
-  const orc_int8 *ORC_RESTRICT ptr5;
-  const orc_int8 *ORC_RESTRICT ptr6;
-  orc_int8 var42;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var43;
-#else
-  orc_int8 var43;
-#endif
-  orc_union16 var44;
-  orc_union16 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var49;
-#else
-  orc_int8 var49;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var50;
-#else
-  orc_union32 var50;
-#endif
-  orc_union32 var51;
-  orc_int8 var52;
-  orc_union16 var53;
-  orc_int8 var54;
-  orc_int8 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_union16 var59;
-  orc_union16 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 var63;
-  orc_union16 var64;
-  orc_union16 var65;
-  orc_union16 var66;
-  orc_union16 var67;
-  orc_union16 var68;
-  orc_int8 var69;
-  orc_int8 var70;
-  orc_int8 var71;
-  orc_union16 var72;
-  orc_union16 var73;
-  orc_union32 var74;
-
-  ptr0 = (orc_union32 *) d1;
-  ptr4 = (orc_int8 *) s1;
-  ptr5 = (orc_int8 *) s2;
-  ptr6 = (orc_int8 *) s3;
-
-  /* 1: loadpb */
-  var43 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-  /* 10: loadpw */
-  var44.i = p1;
-  /* 12: loadpw */
-  var45.i = p2;
-  /* 15: loadpw */
-  var46.i = p3;
-  /* 18: loadpw */
-  var47.i = p4;
-  /* 21: loadpw */
-  var48.i = p5;
-  /* 28: loadpb */
-  var49 = (int) 0x0000007f;     /* 127 or 6.27463e-322f */
-  /* 31: loadpb */
-  var50.x4[0] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-  var50.x4[1] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-  var50.x4[2] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-  var50.x4[3] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadb */
-    var42 = ptr4[i];
-    /* 2: subb */
-    var52 = var42 - var43;
-    /* 3: splatbw */
-    var53.i = ((var52 & 0xff) << 8) | (var52 & 0xff);
-    /* 4: loadupdb */
-    var54 = ptr5[i >> 1];
-    /* 5: subb */
-    var55 = var54 - var43;
-    /* 6: splatbw */
-    var56.i = ((var55 & 0xff) << 8) | (var55 & 0xff);
-    /* 7: loadupdb */
-    var57 = ptr6[i >> 1];
-    /* 8: subb */
-    var58 = var57 - var43;
-    /* 9: splatbw */
-    var59.i = ((var58 & 0xff) << 8) | (var58 & 0xff);
-    /* 11: mulhsw */
-    var60.i = (var53.i * var44.i) >> 16;
-    /* 13: mulhsw */
-    var61.i = (var59.i * var45.i) >> 16;
-    /* 14: addssw */
-    var62.i = ORC_CLAMP_SW (var60.i + var61.i);
-    /* 16: mulhsw */
-    var63.i = (var56.i * var46.i) >> 16;
-    /* 17: addssw */
-    var64.i = ORC_CLAMP_SW (var60.i + var63.i);
-    /* 19: mulhsw */
-    var65.i = (var56.i * var47.i) >> 16;
-    /* 20: addssw */
-    var66.i = ORC_CLAMP_SW (var60.i + var65.i);
-    /* 22: mulhsw */
-    var67.i = (var59.i * var48.i) >> 16;
-    /* 23: addssw */
-    var68.i = ORC_CLAMP_SW (var66.i + var67.i);
-    /* 24: convssswb */
-    var69 = ORC_CLAMP_SB (var62.i);
-    /* 25: convssswb */
-    var70 = ORC_CLAMP_SB (var68.i);
-    /* 26: convssswb */
-    var71 = ORC_CLAMP_SB (var64.i);
-    /* 27: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var71;
-      _dest.x2[1] = var70;
-      var72.i = _dest.i;
-    }
-    /* 29: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var69;
-      _dest.x2[1] = var49;
-      var73.i = _dest.i;
-    }
-    /* 30: mergewl */
-    {
-      orc_union32 _dest;
-      _dest.x2[0] = var72.i;
-      _dest.x2[1] = var73.i;
-      var74.i = _dest.i;
-    }
-    /* 32: addb */
-    var51.x4[0] = var74.x4[0] + var50.x4[0];
-    var51.x4[1] = var74.x4[1] + var50.x4[1];
-    var51.x4[2] = var74.x4[2] + var50.x4[2];
-    var51.x4[3] = var74.x4[3] + var50.x4[3];
-    /* 33: storel */
-    ptr0[i] = var51;
-  }
-
-}
-
-#else
-static void
-_backup_bad_video_convert_orc_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 var42;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var43;
-#else
-  orc_int8 var43;
-#endif
-  orc_union16 var44;
-  orc_union16 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_int8 var49;
-#else
-  orc_int8 var49;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
-  volatile orc_union32 var50;
-#else
-  orc_union32 var50;
-#endif
-  orc_union32 var51;
-  orc_int8 var52;
-  orc_union16 var53;
-  orc_int8 var54;
-  orc_int8 var55;
-  orc_union16 var56;
-  orc_int8 var57;
-  orc_int8 var58;
-  orc_union16 var59;
-  orc_union16 var60;
-  orc_union16 var61;
-  orc_union16 var62;
-  orc_union16 var63;
-  orc_union16 var64;
-  orc_union16 var65;
-  orc_union16 var66;
-  orc_union16 var67;
-  orc_union16 var68;
-  orc_int8 var69;
-  orc_int8 var70;
-  orc_int8 var71;
-  orc_union16 var72;
-  orc_union16 var73;
-  orc_union32 var74;
-
-  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 */
-  var43 = (int) 0x00000080;     /* 128 or 6.32404e-322f */
-  /* 10: loadpw */
-  var44.i = ex->params[24];
-  /* 12: loadpw */
-  var45.i = ex->params[25];
-  /* 15: loadpw */
-  var46.i = ex->params[26];
-  /* 18: loadpw */
-  var47.i = ex->params[27];
-  /* 21: loadpw */
-  var48.i = ex->params[28];
-  /* 28: loadpb */
-  var49 = (int) 0x0000007f;     /* 127 or 6.27463e-322f */
-  /* 31: loadpb */
-  var50.x4[0] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-  var50.x4[1] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-  var50.x4[2] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-  var50.x4[3] = (int) 0x00000080;       /* 128 or 6.32404e-322f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadb */
-    var42 = ptr4[i];
-    /* 2: subb */
-    var52 = var42 - var43;
-    /* 3: splatbw */
-    var53.i = ((var52 & 0xff) << 8) | (var52 & 0xff);
-    /* 4: loadupdb */
-    var54 = ptr5[i >> 1];
-    /* 5: subb */
-    var55 = var54 - var43;
-    /* 6: splatbw */
-    var56.i = ((var55 & 0xff) << 8) | (var55 & 0xff);
-    /* 7: loadupdb */
-    var57 = ptr6[i >> 1];
-    /* 8: subb */
-    var58 = var57 - var43;
-    /* 9: splatbw */
-    var59.i = ((var58 & 0xff) << 8) | (var58 & 0xff);
-    /* 11: mulhsw */
-    var60.i = (var53.i * var44.i) >> 16;
-    /* 13: mulhsw */
-    var61.i = (var59.i * var45.i) >> 16;
-    /* 14: addssw */
-    var62.i = ORC_CLAMP_SW (var60.i + var61.i);
-    /* 16: mulhsw */
-    var63.i = (var56.i * var46.i) >> 16;
-    /* 17: addssw */
-    var64.i = ORC_CLAMP_SW (var60.i + var63.i);
-    /* 19: mulhsw */
-    var65.i = (var56.i * var47.i) >> 16;
-    /* 20: addssw */
-    var66.i = ORC_CLAMP_SW (var60.i + var65.i);
-    /* 22: mulhsw */
-    var67.i = (var59.i * var48.i) >> 16;
-    /* 23: addssw */
-    var68.i = ORC_CLAMP_SW (var66.i + var67.i);
-    /* 24: convssswb */
-    var69 = ORC_CLAMP_SB (var62.i);
-    /* 25: convssswb */
-    var70 = ORC_CLAMP_SB (var68.i);
-    /* 26: convssswb */
-    var71 = ORC_CLAMP_SB (var64.i);
-    /* 27: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var71;
-      _dest.x2[1] = var70;
-      var72.i = _dest.i;
-    }
-    /* 29: mergebw */
-    {
-      orc_union16 _dest;
-      _dest.x2[0] = var69;
-      _dest.x2[1] = var49;
-      var73.i = _dest.i;
-    }
-    /* 30: mergewl */
-    {
-      orc_union32 _dest;
-      _dest.x2[0] = var72.i;
-      _dest.x2[1] = var73.i;
-      var74.i = _dest.i;
-    }
-    /* 32: addb */
-    var51.x4[0] = var74.x4[0] + var50.x4[0];
-    var51.x4[1] = var74.x4[1] + var50.x4[1];
-    var51.x4[2] = var74.x4[2] + var50.x4[2];
-    var51.x4[3] = var74.x4[3] + var50.x4[3];
-    /* 33: storel */
-    ptr0[i] = var51;
-  }
-
-}
-
-void
-bad_video_convert_orc_convert_I420_BGRA (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 volatile int p_inited = 0;
-  static OrcCode *c = 0;
-  void (*func) (OrcExecutor *);
-
-  if (!p_inited) {
-    orc_once_mutex_lock ();
-    if (!p_inited) {
-      OrcProgram *p;
-
-#if 1
-      static const orc_uint8 bc[] = {
-        1, 9, 39, 98, 97, 100, 95, 118, 105, 100, 101, 111, 95, 99, 111, 110,
-        118, 101, 114, 116, 95, 111, 114, 99, 95, 99, 111, 110, 118, 101, 114,
-            116,
-        95, 73, 52, 50, 48, 95, 66, 71, 82, 65, 11, 4, 4, 12, 1, 1,
-        12, 1, 1, 12, 1, 1, 14, 1, 128, 0, 0, 0, 14, 1, 127, 0,
-        0, 0, 16, 2, 16, 2, 16, 2, 16, 2, 16, 2, 20, 2, 20, 2,
-        20, 2, 20, 2, 20, 2, 20, 2, 20, 1, 20, 1, 20, 1, 20, 4,
-        65, 38, 4, 16, 151, 32, 38, 45, 38, 5, 65, 38, 38, 16, 151, 33,
-        38, 45, 38, 6, 65, 38, 38, 16, 151, 34, 38, 90, 32, 32, 24, 90,
-        35, 34, 25, 71, 35, 32, 35, 90, 37, 33, 26, 71, 37, 32, 37, 90,
-        36, 33, 27, 71, 36, 32, 36, 90, 32, 34, 28, 71, 36, 36, 32, 159,
-        38, 35, 159, 39, 36, 159, 40, 37, 196, 37, 40, 39, 196, 35, 38, 17,
-        195, 41, 37, 35, 21, 2, 33, 0, 41, 16, 2, 0,
-      };
-      p = orc_program_new_from_static_bytecode (bc);
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_convert_I420_BGRA);
-#else
-      p = orc_program_new ();
-      orc_program_set_name (p, "bad_video_convert_orc_convert_I420_BGRA");
-      orc_program_set_backup_function (p,
-          _backup_bad_video_convert_orc_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, 0x00000080, "c1");
-      orc_program_add_constant (p, 1, 0x0000007f, "c2");
-      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_add_temporary (p, 2, "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_add_temporary (p, 1, "t9");
-      orc_program_add_temporary (p, 4, "t10");
-
-      orc_program_append_2 (p, "subb", 0, ORC_VAR_T7, ORC_VAR_S1, ORC_VAR_C1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T7, ORC_VAR_S2,
-          ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "subb", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_C1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T2, ORC_VAR_T7, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T7, ORC_VAR_S3,
-          ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "subb", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_C1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T3, ORC_VAR_T7, ORC_VAR_D1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_P2,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T4, ORC_VAR_T1, ORC_VAR_T4,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T6, ORC_VAR_T2, ORC_VAR_P3,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T6, ORC_VAR_T1, ORC_VAR_T6,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_P4,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_T5, ORC_VAR_T1, ORC_VAR_T5,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mulhsw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_P5,
-          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, "convssswb", 0, ORC_VAR_T7, ORC_VAR_T4,
-          ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T8, ORC_VAR_T5,
-          ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T9, ORC_VAR_T6,
-          ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T6, ORC_VAR_T9, ORC_VAR_T8,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T4, ORC_VAR_T7, ORC_VAR_C2,
-          ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T10, ORC_VAR_T6,
-          ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T10, ORC_VAR_C1,
-          ORC_VAR_D1);
-#endif
-
-      orc_program_compile (p);
-      c = orc_program_take_code (p);
-      orc_program_free (p);
-    }
-    p_inited = TRUE;
-    orc_once_mutex_unlock ();
-  }
-  ex->arrays[ORC_VAR_A2] = c;
-  ex->program = 0;
-
-  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 = c->exec;
-  func (ex);
-}
-#endif
diff --git a/gst-libs/gst/video/bad-video-orc-dist.h b/gst-libs/gst/video/bad-video-orc-dist.h
deleted file mode 100644
index 73dae9b..0000000
--- a/gst-libs/gst/video/bad-video-orc-dist.h
+++ /dev/null
@@ -1,124 +0,0 @@
-
-/* autogenerated from bad-video-orc.orc */
-
-#ifndef _BAD_VIDEO_ORC_H_
-#define _BAD_VIDEO_ORC_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
-
-#ifndef ORC_INTERNAL
-#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
-#define ORC_INTERNAL __hidden
-#elif defined (__GNUC__)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#else
-#define ORC_INTERNAL
-#endif
-#endif
-
-void bad_video_convert_orc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
-void bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
-void bad_video_convert_orc_convert_I420_BGRA (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);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/gst-libs/gst/video/bad-video-orc.orc b/gst-libs/gst/video/bad-video-orc.orc
deleted file mode 100644
index 9fc1efa..0000000
--- a/gst-libs/gst/video/bad-video-orc.orc
+++ /dev/null
@@ -1,729 +0,0 @@
-.function bad_video_convert_orc_memcpy_2d
-.flags 2d
-.dest 1 d1 guint8
-.source 1 s1 guint8
-
-copyb d1, s1
-
-.function bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_UYVY_YUY2
-.flags 2d
-.dest 4 yuy2 guint8
-.source 4 uyvy guint8
-
-x2 swapw yuy2, uyvy
-
-
-.function bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_planar_chroma_422_444
-.flags 2d
-.dest 2 d1 guint8
-.source 1 s guint8
-.temp 2 t
-
-splatbw t, s
-storew d1, t
-
-
-.function bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_planar_chroma_422_420
-.flags 2d
-.dest 1 d guint8
-.source 1 s1 guint8
-.source 1 s2 guint8
-
-avgub d, s1, s2
-
-
-.function bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_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 bad_video_convert_orc_convert_AYUV_ARGB
-.flags 2d
-.dest 4 argb guint8
-.source 4 ayuv guint8
-.param 2 p1
-.param 2 p2
-.param 2 p3
-.param 2 p4
-.param 2 p5
-.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 c128 128
-
-x4 subb x, ayuv, c128 
-splitlw wv, wy, x
-splitwb y, a, wy
-splitwb v, u, wv
-
-splatbw wy, y
-splatbw wu, u
-splatbw wv, v
-
-mulhsw wy, wy, p1
-
-mulhsw wr, wv, p2
-addssw wr, wy, wr
-
-mulhsw wb, wu, p3
-addssw wb, wy, wb
-
-mulhsw wg, wu, p4
-addssw wg, wy, wg
-mulhsw wy, wv, p5
-addssw wg, wg, wy
-
-convssswb r, wr
-convssswb g, wg
-convssswb b, wb
-
-mergebw wr, a, r
-mergebw wb, g, b
-mergewl x, wr, wb
-x4 addb argb, x, c128
-
-.function bad_video_convert_orc_convert_AYUV_BGRA
-.flags 2d
-.dest 4 bgra guint8
-.source 4 ayuv guint8
-.param 2 p1
-.param 2 p2
-.param 2 p3
-.param 2 p4
-.param 2 p5
-.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 c128 128
-
-x4 subb x, ayuv, c128 
-splitlw wv, wy, x
-splitwb y, a, wy
-splitwb v, u, wv
-
-splatbw wy, y
-splatbw wu, u
-splatbw wv, v
-
-mulhsw wy, wy, p1
-
-mulhsw wr, wv, p2
-addssw wr, wy, wr
-
-mulhsw wb, wu, p3
-addssw wb, wy, wb
-
-mulhsw wg, wu, p4
-addssw wg, wy, wg
-mulhsw wy, wv, p5
-addssw wg, wg, wy
-
-convssswb r, wr
-convssswb g, wg
-convssswb b, wb
-
-mergebw wb, b, g
-mergebw wr, r, a
-mergewl x, wb, wr
-x4 addb bgra, x, c128
-
-
-.function bad_video_convert_orc_convert_AYUV_ABGR
-.flags 2d
-.dest 4 argb guint8
-.source 4 ayuv guint8
-.param 2 p1
-.param 2 p2
-.param 2 p3
-.param 2 p4
-.param 2 p5
-.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 c128 128
-
-x4 subb x, ayuv, c128 
-splitlw wv, wy, x
-splitwb y, a, wy
-splitwb v, u, wv
-
-splatbw wy, y
-splatbw wu, u
-splatbw wv, v
-
-mulhsw wy, wy, p1
-
-mulhsw wr, wv, p2
-addssw wr, wy, wr
-
-mulhsw wb, wu, p3
-addssw wb, wy, wb
-
-mulhsw wg, wu, p4
-addssw wg, wy, wg
-mulhsw wy, wv, p5
-addssw wg, wg, wy
-
-convssswb r, wr
-convssswb g, wg
-convssswb b, wb
-
-mergebw wb, a, b
-mergebw wr, g, r
-mergewl x, wb, wr
-x4 addb argb, x, c128
-
-.function bad_video_convert_orc_convert_AYUV_RGBA
-.flags 2d
-.dest 4 argb guint8
-.source 4 ayuv guint8
-.param 2 p1
-.param 2 p2
-.param 2 p3
-.param 2 p4
-.param 2 p5
-.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 c128 128
-
-x4 subb x, ayuv, c128 
-splitlw wv, wy, x
-splitwb y, a, wy
-splitwb v, u, wv
-
-splatbw wy, y
-splatbw wu, u
-splatbw wv, v
-
-mulhsw wy, wy, p1
-
-mulhsw wr, wv, p2
-addssw wr, wy, wr
-
-mulhsw wb, wu, p3
-addssw wb, wy, wb
-
-mulhsw wg, wu, p4
-addssw wg, wy, wg
-mulhsw wy, wv, p5
-addssw wg, wg, wy
-
-convssswb r, wr
-convssswb g, wg
-convssswb b, wb
-
-mergebw wr, r, g
-mergebw wb, b, a
-mergewl x, wr, wb
-x4 addb argb, x, c128
-
-
-
-.function bad_video_convert_orc_convert_I420_BGRA
-.dest 4 argb guint8
-.source 1 y guint8
-.source 1 u guint8
-.source 1 v guint8
-.param 2 p1
-.param 2 p2
-.param 2 p3
-.param 2 p4
-.param 2 p5
-.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 c128 128
-
-subb r, y, c128
-splatbw wy, r
-loadupdb r, u
-subb r, r, c128
-splatbw wu, r
-loadupdb r, v
-subb r, r, c128
-splatbw wv, r
-
-mulhsw wy, wy, p1
-
-mulhsw wr, wv, p2
-addssw wr, wy, wr
-
-mulhsw wb, wu, p3
-addssw wb, wy, wb
-
-mulhsw wg, wu, p4
-addssw wg, wy, wg
-mulhsw wy, wv, p5
-addssw wg, wg, wy
-
-convssswb r, wr
-convssswb g, wg
-convssswb b, wb
-
-mergebw wb, b, g
-mergebw wr, r, 127
-mergewl x, wb, wr
-x4 addb argb, x, c128
-
-
diff --git a/gst-libs/gst/video/gstcms.c b/gst-libs/gst/video/gstcms.c
deleted file mode 100644
index 580b7c1..0000000
--- a/gst-libs/gst/video/gstcms.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 David Schleef <ds@entropywave.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/math-compat.h>
-#include "gstcms.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-
-/* our simple CMS */
-
-void
-bad_color_xyY_to_XYZ (Color * c)
-{
-  if (c->v[1] == 0) {
-    c->v[0] = 0;
-    c->v[1] = 0;
-    c->v[2] = 0;
-  } else {
-    double X, Y, Z;
-    X = c->v[0] * c->v[2] / c->v[1];
-    Y = c->v[2];
-    Z = (1.0 - c->v[0] - c->v[1]) * c->v[2] / c->v[1];
-    c->v[0] = X;
-    c->v[1] = Y;
-    c->v[2] = Z;
-  }
-}
-
-void
-bad_color_XYZ_to_xyY (Color * c)
-{
-  double d;
-  d = c->v[0] + c->v[1] + c->v[2];
-  if (d == 0) {
-    c->v[0] = 0.3128;
-    c->v[1] = 0.3290;
-    c->v[2] = 0;
-  } else {
-    double x, y, Y;
-    x = c->v[0] / d;
-    y = c->v[1] / d;
-    Y = c->v[1];
-    c->v[0] = x;
-    c->v[1] = y;
-    c->v[2] = Y;
-  }
-}
-
-void
-bad_color_set (Color * c, double x, double y, double z)
-{
-  c->v[0] = x;
-  c->v[1] = y;
-  c->v[2] = z;
-}
-
-void
-bad_color_matrix_set_identity (ColorMatrix * m)
-{
-  int i, j;
-
-  for (i = 0; i < 4; i++) {
-    for (j = 0; j < 4; j++) {
-      m->m[i][j] = (i == j);
-    }
-  }
-}
-
-/* Prettyprint a 4x4 matrix @m@ */
-void
-bad_color_matrix_dump (ColorMatrix * m)
-{
-  int i, j;
-
-  printf ("[\n");
-  for (i = 0; i < 4; i++) {
-    printf ("  ");
-    for (j = 0; j < 4; j++) {
-      printf (" %8.5g", m->m[i][j]);
-    }
-    printf ("\n");
-  }
-  printf ("]\n");
-}
-
-/* Perform 4x4 matrix multiplication:
- *  - @dst@ = @a@ * @b@
- *  - @dst@ may be a pointer to @a@ andor @b@
- */
-void
-bad_color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b)
-{
-  ColorMatrix tmp;
-  int i, j, k;
-
-  for (i = 0; i < 4; i++) {
-    for (j = 0; j < 4; j++) {
-      double x = 0;
-      for (k = 0; k < 4; k++) {
-        x += a->m[i][k] * b->m[k][j];
-      }
-      tmp.m[i][j] = x;
-    }
-  }
-
-  memcpy (dst, &tmp, sizeof (ColorMatrix));
-}
-
-void
-bad_color_matrix_apply (ColorMatrix * m, Color * dest, Color * src)
-{
-  int i;
-  Color tmp;
-
-  for (i = 0; i < 3; i++) {
-    double x = 0;
-    x += m->m[i][0] * src->v[0];
-    x += m->m[i][1] * src->v[1];
-    x += m->m[i][2] * src->v[2];
-    x += m->m[i][3];
-    tmp.v[i] = x;
-  }
-  memcpy (dest, &tmp, sizeof (tmp));
-}
-
-void
-bad_color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
-    double a3)
-{
-  ColorMatrix a;
-
-  bad_color_matrix_set_identity (&a);
-  a.m[0][3] = a1;
-  a.m[1][3] = a2;
-  a.m[2][3] = a3;
-  bad_color_matrix_multiply (m, &a, m);
-}
-
-void
-bad_color_matrix_scale_components (ColorMatrix * m, double a1, double a2,
-    double a3)
-{
-  ColorMatrix a;
-
-  bad_color_matrix_set_identity (&a);
-  a.m[0][0] = a1;
-  a.m[1][1] = a2;
-  a.m[2][2] = a3;
-  bad_color_matrix_multiply (m, &a, m);
-}
-
-void
-bad_color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb)
-{
-  double Kg = 1.0 - Kr - Kb;
-  ColorMatrix k = {
-    {
-          {1., 0., 2 * (1 - Kr), 0.},
-          {1., -2 * Kb * (1 - Kb) / Kg, -2 * Kr * (1 - Kr) / Kg, 0.},
-          {1., 2 * (1 - Kb), 0., 0.},
-          {0., 0., 0., 1.},
-        }
-  };
-
-  bad_color_matrix_multiply (m, &k, m);
-}
-
-void
-bad_color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb)
-{
-  double Kg = 1.0 - Kr - Kb;
-  ColorMatrix k;
-  double x;
-
-  k.m[0][0] = Kr;
-  k.m[0][1] = Kg;
-  k.m[0][2] = Kb;
-  k.m[0][3] = 0;
-
-  x = 1 / (2 * (1 - Kb));
-  k.m[1][0] = -x * Kr;
-  k.m[1][1] = -x * Kg;
-  k.m[1][2] = x * (1 - Kb);
-  k.m[1][3] = 0;
-
-  x = 1 / (2 * (1 - Kr));
-  k.m[2][0] = x * (1 - Kr);
-  k.m[2][1] = -x * Kg;
-  k.m[2][2] = -x * Kb;
-  k.m[2][3] = 0;
-
-  k.m[3][0] = 0;
-  k.m[3][1] = 0;
-  k.m[3][2] = 0;
-  k.m[3][3] = 1;
-
-  bad_color_matrix_multiply (m, &k, m);
-}
-
-void
-bad_color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst)
-{
-  /*
-   * At this point, everything is in YCbCr
-   * All components are in the range [0,255]
-   */
-  bad_color_matrix_set_identity (dst);
-
-  /* offset required to get input video black to (0.,0.,0.) */
-  bad_color_matrix_offset_components (dst, -16, -128, -128);
-
-  /* scale required to get input video black to (0.,0.,0.) */
-  bad_color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0),
-      (1 / 224.0));
-
-  /* colour matrix, YCbCr -> RGB */
-  /* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
-  bad_color_matrix_YCbCr_to_RGB (dst, 0.2990, 0.1140);  /* SD */
-
-  /*
-   * We are now in RGB space
-   */
-
-#if 0
-  /* scale to output range. */
-  bad_color_matrix_scale_components (dst, 255.0, 255.0, 255.0);
-#endif
-}
-
-void
-bad_color_matrix_build_bt709_to_bt601 (ColorMatrix * dst)
-{
-  bad_color_matrix_set_identity (dst);
-
-  /* offset required to get input video black to (0.,0.,0.) */
-  bad_color_matrix_offset_components (dst, -16, -128, -128);
-
-  /* scale required to get input video black to (0.,0.,0.) */
-  bad_color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0),
-      (1 / 224.0));
-
-  /* colour matrix, YCbCr -> RGB */
-  /* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
-  bad_color_matrix_YCbCr_to_RGB (dst, 0.2126, 0.0722);  /* HD */
-
-  bad_color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140);  /* SD */
-
-  bad_color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
-
-  bad_color_matrix_offset_components (dst, 16, 128, 128);
-}
-
-void
-bad_color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst)
-{
-  bad_color_matrix_set_identity (dst);
-
-  bad_color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140);  /* SD */
-
-  bad_color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
-
-  bad_color_matrix_offset_components (dst, 16, 128, 128);
-
-  {
-    Color c;
-    int i;
-    for (i = 7; i >= 0; i--) {
-      bad_color_set (&c, (i & 2) ? 0.75 : 0.0, (i & 4) ? 0.75 : 0.0,
-          (i & 1) ? 0.75 : 0.0);
-      bad_color_matrix_apply (dst, &c, &c);
-      g_print ("  { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
-          rint (c.v[2]));
-    }
-    bad_color_set (&c, -0.075, -0.075, -0.075);
-    bad_color_matrix_apply (dst, &c, &c);
-    g_print ("  { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
-        rint (c.v[2]));
-    bad_color_set (&c, 0.075, 0.075, 0.075);
-    bad_color_matrix_apply (dst, &c, &c);
-    g_print ("  { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
-        rint (c.v[2]));
-  }
-}
-
-void
-bad_color_matrix_invert (ColorMatrix * m)
-{
-  ColorMatrix tmp;
-  int i, j;
-  double det;
-
-  bad_color_matrix_set_identity (&tmp);
-  for (j = 0; j < 3; j++) {
-    for (i = 0; i < 3; i++) {
-      tmp.m[j][i] =
-          m->m[(i + 1) % 3][(j + 1) % 3] * m->m[(i + 2) % 3][(j + 2) % 3] -
-          m->m[(i + 1) % 3][(j + 2) % 3] * m->m[(i + 2) % 3][(j + 1) % 3];
-    }
-  }
-  det =
-      tmp.m[0][0] * m->m[0][0] + tmp.m[0][1] * m->m[1][0] +
-      tmp.m[0][2] * m->m[2][0];
-  for (j = 0; j < 3; j++) {
-    for (i = 0; i < 3; i++) {
-      tmp.m[i][j] /= det;
-    }
-  }
-  memcpy (m, &tmp, sizeof (tmp));
-}
-
-void
-bad_color_matrix_copy (ColorMatrix * dest, ColorMatrix * src)
-{
-  memcpy (dest, src, sizeof (ColorMatrix));
-}
-
-void
-bad_color_matrix_transpose (ColorMatrix * m)
-{
-  int i, j;
-  ColorMatrix tmp;
-
-  bad_color_matrix_set_identity (&tmp);
-  for (i = 0; i < 3; i++) {
-    for (j = 0; j < 3; j++) {
-      tmp.m[i][j] = m->m[j][i];
-    }
-  }
-  memcpy (m, &tmp, sizeof (ColorMatrix));
-}
-
-void
-bad_color_matrix_build_XYZ (ColorMatrix * dst,
-    double rx, double ry,
-    double gx, double gy, double bx, double by, double wx, double wy)
-{
-  Color r, g, b, w, scale;
-  ColorMatrix m;
-
-  bad_color_set (&r, rx, ry, 1.0);
-  bad_color_xyY_to_XYZ (&r);
-  bad_color_set (&g, gx, gy, 1.0);
-  bad_color_xyY_to_XYZ (&g);
-  bad_color_set (&b, bx, by, 1.0);
-  bad_color_xyY_to_XYZ (&b);
-  bad_color_set (&w, wx, wy, 1.0);
-  bad_color_xyY_to_XYZ (&w);
-
-  bad_color_matrix_set_identity (dst);
-
-  dst->m[0][0] = r.v[0];
-  dst->m[0][1] = r.v[1];
-  dst->m[0][2] = r.v[2];
-  dst->m[1][0] = g.v[0];
-  dst->m[1][1] = g.v[1];
-  dst->m[1][2] = g.v[2];
-  dst->m[2][0] = b.v[0];
-  dst->m[2][1] = b.v[1];
-  dst->m[2][2] = b.v[2];
-
-  bad_color_matrix_dump (dst);
-  bad_color_matrix_copy (&m, dst);
-  bad_color_matrix_invert (&m);
-  bad_color_matrix_dump (&m);
-
-  bad_color_matrix_transpose (&m);
-  bad_color_matrix_apply (&m, &scale, &w);
-  g_print ("%g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
-
-  dst->m[0][0] = r.v[0] * scale.v[0];
-  dst->m[0][1] = r.v[1] * scale.v[0];
-  dst->m[0][2] = r.v[2] * scale.v[0];
-  dst->m[1][0] = g.v[0] * scale.v[1];
-  dst->m[1][1] = g.v[1] * scale.v[1];
-  dst->m[1][2] = g.v[2] * scale.v[1];
-  dst->m[2][0] = b.v[0] * scale.v[2];
-  dst->m[2][1] = b.v[1] * scale.v[2];
-  dst->m[2][2] = b.v[2] * scale.v[2];
-
-  bad_color_matrix_transpose (dst);
-  bad_color_matrix_dump (dst);
-
-  bad_color_set (&scale, 1, 1, 1);
-  bad_color_matrix_apply (dst, &scale, &scale);
-  bad_color_XYZ_to_xyY (&scale);
-  g_print ("white %g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
-
-}
-
-void
-bad_color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst)
-{
-  /* SMPTE C primaries, SMPTE 170M-2004 */
-  bad_color_matrix_build_XYZ (dst,
-      0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
-#if 0
-  /* NTSC 1953 primaries, SMPTE 170M-2004 */
-  bad_color_matrix_build_XYZ (dst,
-      0.67, 0.33, 0.21, 0.71, 0.14, 0.08, 0.3127, 0.3290);
-#endif
-}
-
-void
-bad_color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst)
-{
-  /* Rec. ITU-R BT.709-5 */
-  bad_color_matrix_build_XYZ (dst,
-      0.640, 0.330, 0.300, 0.600, 0.150, 0.060, 0.3127, 0.3290);
-}
-
-void
-bad_color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst)
-{
-  /* Dell monitor */
-#if 1
-  bad_color_matrix_build_XYZ (dst,
-      0.662, 0.329, 0.205, 0.683, 0.146, 0.077, 0.3135, 0.3290);
-#endif
-#if 0
-  bad_color_matrix_build_XYZ (dst,
-      0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
-#endif
-  bad_color_matrix_invert (dst);
-}
-
-void
-bad_color_transfer_function_apply (Color * dest, Color * src)
-{
-  int i;
-
-  for (i = 0; i < 3; i++) {
-    if (src->v[i] < 0.0812) {
-      dest->v[i] = src->v[i] / 4.500;
-    } else {
-      dest->v[i] = pow (src->v[i] + 0.099, 1 / 0.4500);
-    }
-  }
-}
-
-void
-bad_color_transfer_function_unapply (Color * dest, Color * src)
-{
-  int i;
-
-  for (i = 0; i < 3; i++) {
-    if (src->v[i] < 0.0812 / 4.500) {
-      dest->v[i] = src->v[i] * 4.500;
-    } else {
-      dest->v[i] = pow (src->v[i], 0.4500) - 0.099;
-    }
-  }
-}
-
-void
-bad_color_gamut_clamp (Color * dest, Color * src)
-{
-  dest->v[0] = CLAMP (src->v[0], 0.0, 1.0);
-  dest->v[1] = CLAMP (src->v[1], 0.0, 1.0);
-  dest->v[2] = CLAMP (src->v[2], 0.0, 1.0);
-}
-
-#if 0
-static guint8 *
-get_bad_color_transform_table (void)
-{
-  static guint8 *bad_color_transform_table = NULL;
-
-#if 1
-  if (!bad_color_transform_table) {
-    ColorMatrix bt601_to_rgb;
-    ColorMatrix bt601_to_yuv;
-    ColorMatrix bt601_rgb_to_XYZ;
-    ColorMatrix dell_XYZ_to_rgb;
-    guint8 *table_y;
-    guint8 *table_u;
-    guint8 *table_v;
-    int y, u, v;
-
-    bad_color_matrix_build_yuv_to_rgb_601 (&bt601_to_rgb);
-    bad_color_matrix_build_rgb_to_yuv_601 (&bt601_to_yuv);
-    bad_color_matrix_build_rgb_to_XYZ_601 (&bt601_rgb_to_XYZ);
-    bad_color_matrix_build_XYZ_to_rgb_dell (&dell_XYZ_to_rgb);
-
-    bad_color_transform_table = g_malloc (0x1000000 * 3);
-
-    table_y = COG_OFFSET (bad_color_transform_table, 0 * 0x1000000);
-    table_u = COG_OFFSET (bad_color_transform_table, 1 * 0x1000000);
-    table_v = COG_OFFSET (bad_color_transform_table, 2 * 0x1000000);
-
-    for (y = 0; y < 256; y++) {
-      for (u = 0; u < 256; u++) {
-        for (v = 0; v < 256; v++) {
-          Color c;
-
-          c.v[0] = y;
-          c.v[1] = u;
-          c.v[2] = v;
-          bad_color_matrix_apply (&bt601_to_rgb, &c, &c);
-          bad_color_gamut_clamp (&c, &c);
-          bad_color_transfer_function_apply (&c, &c);
-          bad_color_matrix_apply (&bt601_rgb_to_XYZ, &c, &c);
-          bad_color_matrix_apply (&dell_XYZ_to_rgb, &c, &c);
-          bad_color_transfer_function_unapply (&c, &c);
-          bad_color_gamut_clamp (&c, &c);
-          bad_color_matrix_apply (&bt601_to_yuv, &c, &c);
-
-          table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
-          table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
-          table_v[(y << 16) | (u << 8) | (v)] = rint (c.v[2]);
-        }
-      }
-    }
-  }
-#endif
-#if 0
-  if (!bad_color_transform_table) {
-    ColorMatrix bt709_to_bt601;
-    guint8 *table_y;
-    guint8 *table_u;
-    guint8 *table_v;
-    int y, u, v;
-
-    bad_color_matrix_build_bt709_to_bt601 (&bt709_to_bt601);
-
-    bad_color_transform_table = g_malloc (0x1000000 * 3);
-
-    table_y = COG_OFFSET (bad_color_transform_table, 0 * 0x1000000);
-    table_u = COG_OFFSET (bad_color_transform_table, 1 * 0x1000000);
-    table_v = COG_OFFSET (bad_color_transform_table, 2 * 0x1000000);
-
-    for (y = 0; y < 256; y++) {
-      for (u = 0; u < 256; u++) {
-        for (v = 0; v < 256; v++) {
-          Color c;
-
-          c.v[0] = y;
-          c.v[1] = u;
-          c.v[2] = v;
-          bad_color_matrix_apply (&bt709_to_bt601, &c, &c);
-
-          table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
-          table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
-          table_v[(y << 16) | (u << 8) | (v)] = rint (c.v[2]);
-        }
-      }
-    }
-  }
-#endif
-
-  return bad_color_transform_table;
-}
-#endif
diff --git a/gst-libs/gst/video/gstcms.h b/gst-libs/gst/video/gstcms.h
deleted file mode 100644
index 35b1b11..0000000
--- a/gst-libs/gst/video/gstcms.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 David Schleef <ds@entropywave.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_CMS_H_
-#define _GST_CMS_H_
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-typedef struct _Color Color;
-typedef struct _ColorMatrix ColorMatrix;
-
-struct _Color
-{
-  double v[3];
-};
-
-struct _ColorMatrix
-{
-  double m[4][4];
-};
-
-void bad_color_xyY_to_XYZ (Color * c);
-void bad_color_XYZ_to_xyY (Color * c);
-void bad_color_set (Color * c, double x, double y, double z);
-void bad_color_matrix_set_identity (ColorMatrix * m);
-void bad_color_matrix_dump (ColorMatrix * m);
-void bad_color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b);
-void bad_color_matrix_apply (ColorMatrix * m, Color * dest, Color * src);
-void bad_color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
-    double a3);
-void bad_color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3);
-void bad_color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb);
-void bad_color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb);
-void bad_color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst);
-void bad_color_matrix_build_bt709_to_bt601 (ColorMatrix * dst);
-void bad_color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst);
-void bad_color_matrix_invert (ColorMatrix * m);
-void bad_color_matrix_copy (ColorMatrix * dest, ColorMatrix * src);
-void bad_color_matrix_transpose (ColorMatrix * m);
-void bad_color_matrix_build_XYZ (ColorMatrix * dst,
-    double rx, double ry,
-    double gx, double gy, double bx, double by, double wx, double wy);
-void bad_color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst);
-void bad_color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst);
-void bad_color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst);
-void bad_color_transfer_function_apply (Color * dest, Color * src);
-void bad_color_transfer_function_unapply (Color * dest, Color * src);
-void bad_color_gamut_clamp (Color * dest, Color * src);
-
-G_END_DECLS
-
-#endif
-
diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c
index 5d2e3f0..24ab93f 100644
--- a/gst-libs/gst/video/gstvideoaggregator.c
+++ b/gst-libs/gst/video/gstvideoaggregator.c
@@ -40,8 +40,6 @@
 
 #include <string.h>
 
-#include "videoconvert.h"
-
 #include "gstvideoaggregator.h"
 #include "gstvideoaggregatorpad.h"
 
@@ -66,7 +64,14 @@
 struct _GstVideoAggregatorPadPrivate
 {
   /* Converter, if NULL no conversion is done */
-  VideoConvert *convert;
+  GstVideoConverter *convert;
+
+  /* caps used for conversion if needed */
+  GstVideoInfo conversion_info;
+  GstBuffer *converted_buffer;
+
+  GstClockTime start_time;
+  GstClockTime end_time;
 };
 
 G_DEFINE_TYPE (GstVideoAggregatorPad, gst_videoaggregator_pad,
@@ -127,8 +132,77 @@
 
   gst_videoaggregator_reset_qos (vagg);
   gst_buffer_replace (&pad->buffer, NULL);
-  pad->start_time = -1;
-  pad->end_time = -1;
+  pad->priv->start_time = -1;
+  pad->priv->end_time = -1;
+
+  return TRUE;
+}
+
+static gboolean
+gst_video_aggregator_pad_set_info (GstVideoAggregatorPad * pad,
+    GstVideoAggregator * vagg G_GNUC_UNUSED,
+    GstVideoInfo * current_info, GstVideoInfo * wanted_info)
+{
+  gchar *colorimetry, *best_colorimetry;
+  const gchar *chroma, *best_chroma;
+
+  if (!current_info->finfo)
+    return TRUE;
+
+  if (GST_VIDEO_INFO_FORMAT (current_info) == GST_VIDEO_FORMAT_UNKNOWN)
+    return TRUE;
+
+  if (pad->priv->convert)
+    gst_video_converter_free (pad->priv->convert);
+
+  pad->priv->convert = NULL;
+
+  colorimetry = gst_video_colorimetry_to_string (&(current_info->colorimetry));
+  chroma = gst_video_chroma_to_string (current_info->chroma_site);
+
+  best_colorimetry =
+      gst_video_colorimetry_to_string (&(wanted_info->colorimetry));
+  best_chroma = gst_video_chroma_to_string (wanted_info->chroma_site);
+
+  if (GST_VIDEO_INFO_FORMAT (wanted_info) !=
+      GST_VIDEO_INFO_FORMAT (current_info)
+      || g_strcmp0 (colorimetry, best_colorimetry)
+      || g_strcmp0 (chroma, best_chroma)) {
+    GstVideoInfo tmp_info;
+
+    /* Initialize with the wanted video format and our original width and
+     * height as we don't want to rescale. Then copy over the wanted
+     * colorimetry, and chroma-site and our current pixel-aspect-ratio
+     * and other relevant fields.
+     */
+    gst_video_info_set_format (&tmp_info, GST_VIDEO_INFO_FORMAT (wanted_info),
+        current_info->width, current_info->height);
+    tmp_info.chroma_site = wanted_info->chroma_site;
+    tmp_info.colorimetry = wanted_info->colorimetry;
+    tmp_info.par_n = current_info->par_n;
+    tmp_info.par_d = current_info->par_d;
+    tmp_info.fps_n = current_info->fps_n;
+    tmp_info.fps_d = current_info->fps_d;
+    tmp_info.flags = current_info->flags;
+    tmp_info.interlace_mode = current_info->interlace_mode;
+
+    GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d",
+        GST_VIDEO_INFO_FORMAT (current_info),
+        GST_VIDEO_INFO_FORMAT (&tmp_info));
+    pad->priv->convert =
+        gst_video_converter_new (current_info, &tmp_info, NULL);
+    pad->priv->conversion_info = tmp_info;
+    if (!pad->priv->convert) {
+      g_free (colorimetry);
+      g_free (best_colorimetry);
+      GST_WARNING_OBJECT (pad, "No path found for conversion");
+      return FALSE;
+    }
+  } else {
+    GST_DEBUG_OBJECT (pad, "This pad will not need conversion");
+  }
+  g_free (colorimetry);
+  g_free (best_colorimetry);
 
   return TRUE;
 }
@@ -139,12 +213,83 @@
   GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (o);
 
   if (vaggpad->priv->convert)
-    badvideoconvert_convert_free (vaggpad->priv->convert);
+    gst_video_converter_free (vaggpad->priv->convert);
   vaggpad->priv->convert = NULL;
 
   G_OBJECT_CLASS (gst_videoaggregator_pad_parent_class)->finalize (o);
 }
 
+static gboolean
+gst_video_aggregator_pad_prepare_frame (GstVideoAggregatorPad * pad,
+    GstVideoAggregator * vagg)
+{
+  guint outsize;
+  GstVideoFrame *converted_frame;
+  GstBuffer *converted_buf = NULL;
+  GstVideoFrame *frame;
+  static GstAllocationParams params = { 0, 15, 0, 0, };
+
+  if (!pad->buffer)
+    return TRUE;
+
+  frame = g_slice_new0 (GstVideoFrame);
+
+  if (!gst_video_frame_map (frame, &pad->buffer_vinfo, pad->buffer,
+          GST_MAP_READ)) {
+    GST_WARNING_OBJECT (vagg, "Could not map input buffer");
+    return FALSE;
+  }
+
+  if (pad->priv->convert) {
+    gint converted_size;
+
+    converted_frame = g_slice_new0 (GstVideoFrame);
+
+    /* We wait until here to set the conversion infos, in case vagg->info changed */
+    converted_size = pad->priv->conversion_info.size;
+    outsize = GST_VIDEO_INFO_SIZE (&vagg->info);
+    converted_size = converted_size > outsize ? converted_size : outsize;
+    converted_buf = gst_buffer_new_allocate (NULL, converted_size, &params);
+
+    if (!gst_video_frame_map (converted_frame, &(pad->priv->conversion_info),
+            converted_buf, GST_MAP_READWRITE)) {
+      GST_WARNING_OBJECT (vagg, "Could not map converted frame");
+
+      g_slice_free (GstVideoFrame, converted_frame);
+      gst_video_frame_unmap (frame);
+      g_slice_free (GstVideoFrame, frame);
+      return FALSE;
+    }
+
+    gst_video_converter_frame (pad->priv->convert, frame, converted_frame);
+    pad->priv->converted_buffer = converted_buf;
+    gst_video_frame_unmap (frame);
+    g_slice_free (GstVideoFrame, frame);
+  } else {
+    converted_frame = frame;
+  }
+
+  pad->aggregated_frame = converted_frame;
+
+  return TRUE;
+}
+
+static void
+gst_video_aggregator_pad_clean_frame (GstVideoAggregatorPad * pad,
+    GstVideoAggregator * vagg)
+{
+  if (pad->aggregated_frame) {
+    gst_video_frame_unmap (pad->aggregated_frame);
+    g_slice_free (GstVideoFrame, pad->aggregated_frame);
+    pad->aggregated_frame = NULL;
+  }
+
+  if (pad->priv->converted_buffer) {
+    gst_buffer_unref (pad->priv->converted_buffer);
+    pad->priv->converted_buffer = NULL;
+  }
+}
+
 static void
 gst_videoaggregator_pad_class_init (GstVideoAggregatorPadClass * klass)
 {
@@ -163,6 +308,10 @@
   g_type_class_add_private (klass, sizeof (GstVideoAggregatorPadPrivate));
 
   aggpadclass->flush = GST_DEBUG_FUNCPTR (_flush_pad);
+  klass->set_info = GST_DEBUG_FUNCPTR (gst_video_aggregator_pad_set_info);
+  klass->prepare_frame =
+      GST_DEBUG_FUNCPTR (gst_video_aggregator_pad_prepare_frame);
+  klass->clean_frame = GST_DEBUG_FUNCPTR (gst_video_aggregator_pad_clean_frame);
 }
 
 static void
@@ -173,9 +322,8 @@
       GstVideoAggregatorPadPrivate);
 
   vaggpad->zorder = DEFAULT_PAD_ZORDER;
-  vaggpad->need_conversion_update = FALSE;
   vaggpad->aggregated_frame = NULL;
-  vaggpad->converted_buffer = NULL;
+  vaggpad->priv->converted_buffer = NULL;
 
   vaggpad->priv->convert = NULL;
 }
@@ -247,31 +395,11 @@
   } G_STMT_END
 
 
-#define GST_VIDEO_AGGREGATOR_GET_SETCAPS_LOCK(vagg) (&GST_VIDEO_AGGREGATOR(vagg)->priv->setcaps_lock)
-#define GST_VIDEO_AGGREGATOR_SETCAPS_LOCK(vagg)   G_STMT_START {  \
-  GST_LOG_OBJECT (vagg, "Taking SETCAPS lock from thread %p",     \
-        g_thread_self());                                         \
-  g_mutex_lock(GST_VIDEO_AGGREGATOR_GET_SETCAPS_LOCK(vagg));      \
-  GST_LOG_OBJECT (vagg, "Took SETCAPS lock from thread %p",       \
-        g_thread_self());                                         \
-  } G_STMT_END
-
-#define GST_VIDEO_AGGREGATOR_SETCAPS_UNLOCK(vagg)   G_STMT_START {  \
-  GST_LOG_OBJECT (vagg, "Releasing SETCAPS lock from thread %p",    \
-        g_thread_self());                                           \
-  g_mutex_unlock(GST_VIDEO_AGGREGATOR_GET_SETCAPS_LOCK(vagg));      \
-  GST_LOG_OBJECT (vagg, "Took SETCAPS lock from thread %p",         \
-        g_thread_self());                                           \
-  } G_STMT_END
-
 struct _GstVideoAggregatorPrivate
 {
   /* Lock to prevent the state to change while aggregating */
   GMutex lock;
 
-  /* Lock to prevent two src setcaps from happening at the same time  */
-  GMutex setcaps_lock;
-
   /* Current downstream segment */
   GstClockTime ts_offset;
   guint64 nframes;
@@ -283,7 +411,6 @@
 
   /* current caps */
   GstCaps *current_caps;
-  gboolean send_caps;
 };
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstVideoAggregator, gst_videoaggregator,
@@ -291,8 +418,8 @@
         gst_videoaggregator_child_proxy_init));
 
 static void
-_find_best_video_format (GstVideoAggregator * vagg, GstCaps * downstream_caps,
-    GstVideoInfo * best_info, GstVideoFormat * best_format,
+gst_videoaggreagator_find_best_format (GstVideoAggregator * vagg,
+    GstCaps * downstream_caps, GstVideoInfo * best_info,
     gboolean * at_least_one_alpha)
 {
   GList *tmp;
@@ -349,11 +476,9 @@
     /* If that pad is the first with alpha, set it as the new best format */
     if (!need_alpha && (pad->info.finfo->flags & GST_VIDEO_FORMAT_FLAG_ALPHA)) {
       need_alpha = TRUE;
-      *best_format = GST_VIDEO_INFO_FORMAT (&pad->info);
       *best_info = pad->info;
       best_format_number = format_number;
     } else if (format_number > best_format_number) {
-      *best_format = GST_VIDEO_INFO_FORMAT (&pad->info);
       *best_info = pad->info;
       best_format_number = format_number;
     }
@@ -363,21 +488,25 @@
   g_hash_table_unref (formats_table);
 }
 
+/* WITH GST_VIDEO_AGGREGATOR_LOCK TAKEN
+ * NOTE: After calling that method you **have to** call
+ *       gst_videoaggregator_update_src_caps (without releasing
+ *       the GST_VIDEO_AGGREGATOR_LOCK in between)
+ */
 static gboolean
 gst_videoaggregator_update_converters (GstVideoAggregator * vagg)
 {
   GList *tmp;
-  GstVideoAggregatorPad *pad;
   GstVideoFormat best_format;
   GstVideoInfo best_info;
   gboolean at_least_one_alpha = FALSE;
   GstCaps *downstream_caps;
-  gchar *best_colorimetry;
-  const gchar *best_chroma;
-  GstElementClass *klass = GST_ELEMENT_GET_CLASS (vagg);
-  GstVideoAggregatorClass *vagg_klass = (GstVideoAggregatorClass *) klass;
   GstAggregator *agg = GST_AGGREGATOR (vagg);
 
+  GstVideoAggregatorClass *vagg_class = GST_VIDEO_AGGREGATOR_GET_CLASS (vagg);
+  GstVideoAggregatorPadClass *vaggpad_class = g_type_class_peek
+      (GST_AGGREGATOR_GET_CLASS (vagg)->sinkpads_type);
+
   best_format = GST_VIDEO_FORMAT_UNKNOWN;
   gst_video_info_init (&best_info);
 
@@ -392,10 +521,13 @@
   }
 
 
-  if (vagg_klass->disable_frame_conversion == FALSE)
-    _find_best_video_format (vagg, downstream_caps, &best_info, &best_format,
+  if (vagg_class->find_best_format) {
+    vagg_class->find_best_format (vagg, downstream_caps, &best_info,
         &at_least_one_alpha);
 
+    best_format = GST_VIDEO_INFO_FORMAT (&best_info);
+  }
+
   if (best_format == GST_VIDEO_FORMAT_UNKNOWN) {
     downstream_caps = gst_caps_fixate (downstream_caps);
     gst_video_info_from_caps (&best_info, downstream_caps);
@@ -412,62 +544,31 @@
     return FALSE;
   }
 
-  best_colorimetry = gst_video_colorimetry_to_string (&(best_info.colorimetry));
-  best_chroma = gst_video_chroma_to_string (best_info.chroma_site);
   vagg->info = best_info;
 
   GST_DEBUG_OBJECT (vagg,
-      "The output format will now be : %d with colorimetry : %s and chroma : %s",
-      best_format, best_colorimetry, best_chroma);
+      "The output format will now be : %d with chroma : %s",
+      best_format, gst_video_chroma_to_string (best_info.chroma_site));
 
-  /* Then browse the sinks once more, setting or unsetting conversion if needed */
-  GST_OBJECT_LOCK (vagg);
-  for (tmp = GST_ELEMENT (vagg)->sinkpads; tmp; tmp = tmp->next) {
-    gchar *colorimetry;
-    const gchar *chroma;
+  if (vaggpad_class->set_info) {
+    GST_OBJECT_LOCK (vagg);
+    /* Then browse the sinks once more, setting or unsetting conversion if needed */
+    for (tmp = GST_ELEMENT (vagg)->sinkpads; tmp; tmp = tmp->next) {
+      GstVideoAggregatorPad *pad = GST_VIDEO_AGGREGATOR_PAD (tmp->data);
 
-    pad = tmp->data;
-
-    if (!pad->info.finfo)
-      continue;
-
-    if (GST_VIDEO_INFO_FORMAT (&pad->info) == GST_VIDEO_FORMAT_UNKNOWN)
-      continue;
-
-    if (pad->priv->convert)
-      badvideoconvert_convert_free (pad->priv->convert);
-
-    pad->priv->convert = NULL;
-
-    colorimetry = gst_video_colorimetry_to_string (&(pad->info.colorimetry));
-    chroma = gst_video_chroma_to_string (pad->info.chroma_site);
-
-    if (best_format != GST_VIDEO_INFO_FORMAT (&pad->info) ||
-        g_strcmp0 (colorimetry, best_colorimetry) ||
-        g_strcmp0 (chroma, best_chroma)) {
-      GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d",
-          GST_VIDEO_INFO_FORMAT (&pad->info),
-          GST_VIDEO_INFO_FORMAT (&best_info));
-      pad->priv->convert = badvideoconvert_convert_new (&pad->info, &best_info);
-      pad->need_conversion_update = TRUE;
-      if (!pad->priv->convert) {
-        g_free (colorimetry);
-        g_free (best_colorimetry);
-        GST_WARNING ("No path found for conversion");
+      if (!vaggpad_class->set_info (pad, vagg, &pad->info, &best_info)) {
         GST_OBJECT_UNLOCK (vagg);
+
         return FALSE;
       }
-    } else {
-      GST_DEBUG_OBJECT (pad, "This pad will not need conversion");
     }
-    g_free (colorimetry);
+    GST_OBJECT_UNLOCK (vagg);
   }
-  GST_OBJECT_UNLOCK (vagg);
 
-  g_free (best_colorimetry);
   return TRUE;
 }
 
+/* WITH GST_VIDEO_AGGREGATOR_LOCK TAKEN */
 static gboolean
 gst_videoaggregator_src_setcaps (GstVideoAggregator * vagg, GstCaps * caps)
 {
@@ -484,8 +585,6 @@
 
   ret = TRUE;
 
-  GST_VIDEO_AGGREGATOR_LOCK (vagg);
-
   if (GST_VIDEO_INFO_FPS_N (&vagg->info) != GST_VIDEO_INFO_FPS_N (&info) ||
       GST_VIDEO_INFO_FPS_D (&vagg->info) != GST_VIDEO_INFO_FPS_D (&info)) {
     if (agg->segment.position != -1) {
@@ -497,18 +596,26 @@
 
   vagg->info = info;
 
-  GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
-
   if (vagg->priv->current_caps == NULL ||
       gst_caps_is_equal (caps, vagg->priv->current_caps) == FALSE) {
+    GstClockTime latency;
+
     gst_caps_replace (&vagg->priv->current_caps, caps);
-    vagg->priv->send_caps = TRUE;
+    GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
+
+    gst_aggregator_set_src_caps (agg, caps);
+    latency = gst_util_uint64_scale (GST_SECOND,
+        GST_VIDEO_INFO_FPS_D (&info), GST_VIDEO_INFO_FPS_N (&info));
+    gst_aggregator_set_latency (agg, latency, latency);
+
+    GST_VIDEO_AGGREGATOR_LOCK (vagg);
   }
 
 done:
   return ret;
 }
 
+/* WITH GST_VIDEO_AGGREGATOR_LOCK TAKEN */
 static gboolean
 gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
 {
@@ -521,8 +628,6 @@
   GstVideoAggregatorClass *vagg_klass = (GstVideoAggregatorClass *) klass;
   GstAggregator *agg = GST_AGGREGATOR (vagg);
 
-  GST_VIDEO_AGGREGATOR_SETCAPS_LOCK (vagg);
-  GST_VIDEO_AGGREGATOR_LOCK (vagg);
   GST_OBJECT_LOCK (vagg);
   for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
     GstVideoAggregatorPad *mpad = l->data;
@@ -566,7 +671,7 @@
   }
 
   if (best_width > 0 && best_height > 0 && best_fps > 0) {
-    GstCaps *caps, *peercaps;
+    GstCaps *caps, *peercaps, *info_caps;
     GstStructure *s;
     GstVideoInfo info;
 
@@ -577,61 +682,80 @@
         vagg->priv->nframes = 0;
       }
     }
-    gst_video_info_init (&info);
+
+    /* Initialize the video info with our target format and
+     * the best width and height and framerate. Then copy over
+     * all other fields as we negotiated them before
+     */
     gst_video_info_set_format (&info, GST_VIDEO_INFO_FORMAT (&vagg->info),
         best_width, best_height);
     info.fps_n = best_fps_n;
     info.fps_d = best_fps_d;
-    info.par_n = GST_VIDEO_INFO_PAR_N (&vagg->info);
-    info.par_d = GST_VIDEO_INFO_PAR_D (&vagg->info);
+    info.chroma_site = vagg->info.chroma_site;
+    info.par_n = vagg->info.par_n;
+    info.par_d = vagg->info.par_d;
+    info.colorimetry = vagg->info.colorimetry;
+    info.flags = vagg->info.flags;
+    info.interlace_mode = vagg->info.interlace_mode;
 
-    if (vagg_klass->update_info) {
-      if (!vagg_klass->update_info (vagg, &info)) {
+    info_caps = gst_video_info_to_caps (&info);
+
+    if (vagg_klass->update_caps) {
+      if (!(caps = vagg_klass->update_caps (vagg, info_caps))) {
+        gst_caps_unref (info_caps);
         ret = FALSE;
-        GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
         goto done;
       }
+      gst_caps_unref (info_caps);
+    } else {
+      caps = info_caps;
     }
 
-    caps = gst_video_info_to_caps (&info);
-
     peercaps = gst_pad_peer_query_caps (agg->srcpad, NULL);
     if (peercaps) {
       GstCaps *tmp;
+      int i;
 
       s = gst_caps_get_structure (caps, 0);
-      gst_structure_set (s, "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);
+      gst_structure_get (s, "width", G_TYPE_INT, &best_width, "height",
+          G_TYPE_INT, &best_height, NULL);
+
+      for (i = 0; i < gst_caps_get_size (caps); i++) {
+        s = gst_caps_get_structure (caps, i);
+        gst_structure_set (s, "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);
+      }
 
       tmp = gst_caps_intersect (caps, peercaps);
+      GST_DEBUG_OBJECT (vagg, "intersecting %" GST_PTR_FORMAT
+          " with peer caps %" GST_PTR_FORMAT " result %" GST_PTR_FORMAT, caps,
+          peercaps, tmp);
+
       gst_caps_unref (caps);
       gst_caps_unref (peercaps);
       caps = tmp;
       if (gst_caps_is_empty (caps)) {
         GST_DEBUG_OBJECT (vagg, "empty caps");
         ret = FALSE;
-        GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
         goto done;
       }
 
       caps = gst_caps_truncate (caps);
       s = gst_caps_get_structure (caps, 0);
-      gst_structure_fixate_field_nearest_int (s, "width", info.width);
-      gst_structure_fixate_field_nearest_int (s, "height", info.height);
+      gst_structure_fixate_field_nearest_int (s, "width", best_width);
+      gst_structure_fixate_field_nearest_int (s, "height", best_height);
       gst_structure_fixate_field_nearest_fraction (s, "framerate", best_fps_n,
           best_fps_d);
 
+      /* fixate the the rest of the fields */
+      caps = gst_caps_fixate (caps);
+
       gst_structure_get_int (s, "width", &info.width);
       gst_structure_get_int (s, "height", &info.height);
       gst_structure_get_fraction (s, "framerate", &info.fps_n, &info.fps_d);
     }
 
-    gst_caps_unref (caps);
-    caps = gst_video_info_to_caps (&info);
-
-    GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
-
     if (gst_videoaggregator_src_setcaps (vagg, caps)) {
       if (vagg_klass->negotiated_caps)
         ret =
@@ -639,12 +763,15 @@
     }
     gst_caps_unref (caps);
   } else {
-    GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
+    /* We couldn't decide the output video info because the sinkpads don't have
+     * all the caps yet, so we mark the pad as needing a reconfigure. This
+     * allows aggregate() to skip ahead a bit and try again later. */
+    GST_DEBUG_OBJECT (vagg, "Couldn't decide output video info");
+    gst_pad_mark_reconfigure (agg->srcpad);
+    ret = FALSE;
   }
 
 done:
-  GST_VIDEO_AGGREGATOR_SETCAPS_UNLOCK (vagg);
-
   return ret;
 }
 
@@ -682,13 +809,11 @@
   }
 
   vaggpad->info = info;
+  gst_pad_mark_reconfigure (vagg->aggregator.srcpad);
+  ret = TRUE;
 
-  ret = gst_videoaggregator_update_converters (vagg);
   GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
 
-  if (ret)
-    ret = gst_videoaggregator_update_src_caps (vagg);
-
 beach:
   return ret;
 }
@@ -748,15 +873,20 @@
 gst_videoaggregator_update_qos (GstVideoAggregator * vagg, gdouble proportion,
     GstClockTimeDiff diff, GstClockTime timestamp)
 {
+  gboolean live;
+
   GST_DEBUG_OBJECT (vagg,
       "Updating QoS: proportion %lf, diff %s%" GST_TIME_FORMAT ", timestamp %"
       GST_TIME_FORMAT, proportion, (diff < 0) ? "-" : "",
       GST_TIME_ARGS (ABS (diff)), GST_TIME_ARGS (timestamp));
 
   GST_OBJECT_LOCK (vagg);
+  gst_aggregator_get_latency_unlocked (GST_AGGREGATOR (vagg), &live, NULL,
+      NULL);
+
   vagg->priv->proportion = proportion;
   if (G_LIKELY (timestamp != GST_CLOCK_TIME_NONE)) {
-    if (G_UNLIKELY (diff > 0))
+    if (!live && G_UNLIKELY (diff > 0))
       vagg->priv->earliest_time =
           timestamp + 2 * diff + gst_util_uint64_scale_int_round (GST_SECOND,
           GST_VIDEO_INFO_FPS_D (&vagg->info),
@@ -796,7 +926,6 @@
   vagg->priv->ts_offset = 0;
   vagg->priv->nframes = 0;
 
-  gst_segment_init (&agg->segment, GST_FORMAT_TIME);
   agg->segment.position = -1;
 
   gst_videoaggregator_reset_qos (vagg);
@@ -806,9 +935,8 @@
     GstVideoAggregatorPad *p = l->data;
 
     gst_buffer_replace (&p->buffer, NULL);
-    gst_buffer_replace (&p->queued, NULL);
-    p->start_time = -1;
-    p->end_time = -1;
+    p->priv->start_time = -1;
+    p->priv->end_time = -1;
 
     gst_video_info_init (&p->info);
   }
@@ -825,18 +953,26 @@
   gboolean eos = TRUE;
   gboolean need_more_data = FALSE;
 
+  /* get a set of buffers into pad->buffer that are within output_start_time
+   * and output_end_time taking into account finished and unresponsive pads */
+
   GST_OBJECT_LOCK (vagg);
   for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
     GstVideoAggregatorPad *pad = l->data;
-    GstSegment *segment;
+    GstSegment segment;
     GstAggregatorPad *bpad;
     GstBuffer *buf;
     GstVideoInfo *vinfo;
     gboolean is_eos;
 
     bpad = GST_AGGREGATOR_PAD (pad);
-    segment = &bpad->segment;
-    is_eos = bpad->eos;
+    GST_OBJECT_LOCK (bpad);
+    segment = bpad->segment;
+    GST_OBJECT_UNLOCK (bpad);
+    is_eos = gst_aggregator_pad_is_eos (bpad);
+
+    if (!is_eos)
+      eos = FALSE;
     buf = gst_aggregator_pad_get_buffer (bpad);
     if (buf) {
       GstClockTime start_time, end_time;
@@ -853,69 +989,73 @@
 
       /* FIXME: Make all this work with negative rates */
 
-      if ((pad->buffer && start_time < GST_BUFFER_TIMESTAMP (pad->buffer))
-          || (pad->queued && start_time < GST_BUFFER_TIMESTAMP (pad->queued))) {
+      if ((start_time < GST_BUFFER_TIMESTAMP (buf))
+          || (pad->buffer && start_time < GST_BUFFER_TIMESTAMP (pad->buffer))) {
         GST_DEBUG_OBJECT (pad, "Buffer from the past, dropping");
         gst_buffer_unref (buf);
-        buf = gst_aggregator_pad_steal_buffer (bpad);
-        gst_buffer_unref (buf);
+        gst_aggregator_pad_drop_buffer (bpad);
         need_more_data = TRUE;
         continue;
       }
 
-      if (pad->queued) {
-        end_time = start_time - GST_BUFFER_TIMESTAMP (pad->queued);
-        start_time = GST_BUFFER_TIMESTAMP (pad->queued);
-        gst_buffer_unref (buf);
-        buf = gst_buffer_ref (pad->queued);
-        vinfo = &pad->queued_vinfo;
-      } else {
-        end_time = GST_BUFFER_DURATION (buf);
+      end_time = GST_BUFFER_DURATION (buf);
 
-        if (end_time == -1) {
-          pad->queued = buf;
-          buf = gst_aggregator_pad_steal_buffer (bpad);
+      if (end_time == -1) {
+        start_time = MAX (start_time, segment.start);
+        start_time =
+            gst_segment_to_running_time (&segment, GST_FORMAT_TIME, start_time);
+
+        if (start_time >= output_end_time) {
+          GST_DEBUG_OBJECT (pad, "buffer duration is -1, start_time >= "
+              "output_end_time.  Keeping previous buffer");
           gst_buffer_unref (buf);
-          pad->queued_vinfo = pad->info;
-          GST_DEBUG ("end time is -1 and nothing queued");
+          continue;
+        } else if (start_time < output_start_time) {
+          GST_DEBUG_OBJECT (pad, "buffer duration is -1, start_time < "
+              "output_start_time.  Discarding old buffer");
+          gst_buffer_replace (&pad->buffer, buf);
+          gst_buffer_unref (buf);
+          gst_aggregator_pad_drop_buffer (bpad);
           need_more_data = TRUE;
           continue;
         }
+        gst_buffer_unref (buf);
+        buf = gst_aggregator_pad_steal_buffer (bpad);
+        gst_buffer_replace (&pad->buffer, buf);
+        pad->buffer_vinfo = *vinfo;
+        /* FIXME: Set start_time and end_time to something here? */
+        gst_buffer_unref (buf);
+        GST_DEBUG_OBJECT (pad, "buffer duration is -1");
+        continue;
       }
 
       g_assert (start_time != -1 && end_time != -1);
       end_time += start_time;   /* convert from duration to position */
 
       /* Check if it's inside the segment */
-      if (start_time >= segment->stop || end_time < segment->start) {
+      if (start_time >= segment.stop || end_time < segment.start) {
         GST_DEBUG_OBJECT (pad,
             "Buffer outside the segment : segment: [%" GST_TIME_FORMAT " -- %"
             GST_TIME_FORMAT "]" " Buffer [%" GST_TIME_FORMAT " -- %"
-            GST_TIME_FORMAT "]", GST_TIME_ARGS (segment->stop),
-            GST_TIME_ARGS (segment->start), GST_TIME_ARGS (start_time),
+            GST_TIME_FORMAT "]", GST_TIME_ARGS (segment.stop),
+            GST_TIME_ARGS (segment.start), GST_TIME_ARGS (start_time),
             GST_TIME_ARGS (end_time));
 
-        if (buf == pad->queued) {
-          gst_buffer_unref (buf);
-          gst_buffer_replace (&pad->queued, NULL);
-        } else {
-          gst_buffer_unref (buf);
-          buf = gst_aggregator_pad_steal_buffer (bpad);
-          gst_buffer_unref (buf);
-        }
+        gst_buffer_unref (buf);
+        gst_aggregator_pad_drop_buffer (bpad);
 
         need_more_data = TRUE;
         continue;
       }
 
       /* Clip to segment and convert to running time */
-      start_time = MAX (start_time, segment->start);
-      if (segment->stop != -1)
-        end_time = MIN (end_time, segment->stop);
+      start_time = MAX (start_time, segment.start);
+      if (segment.stop != -1)
+        end_time = MIN (end_time, segment.stop);
       start_time =
-          gst_segment_to_running_time (segment, GST_FORMAT_TIME, start_time);
+          gst_segment_to_running_time (&segment, GST_FORMAT_TIME, start_time);
       end_time =
-          gst_segment_to_running_time (segment, GST_FORMAT_TIME, end_time);
+          gst_segment_to_running_time (&segment, GST_FORMAT_TIME, end_time);
       g_assert (start_time != -1 && end_time != -1);
 
       /* Convert to the output segment rate */
@@ -924,18 +1064,16 @@
         end_time *= ABS (agg->segment.rate);
       }
 
-      if (pad->end_time != -1 && pad->end_time > end_time) {
-        GST_DEBUG_OBJECT (pad, "Buffer from the past, dropping");
-        if (buf == pad->queued) {
-          gst_buffer_unref (buf);
-          gst_buffer_replace (&pad->queued, NULL);
-        } else {
-          gst_buffer_unref (buf);
-          buf = gst_aggregator_pad_steal_buffer (bpad);
-          gst_buffer_unref (buf);
-        }
+      GST_TRACE_OBJECT (pad, "dealing with buffer %p start %" GST_TIME_FORMAT
+          " end %" GST_TIME_FORMAT " out start %" GST_TIME_FORMAT
+          " out end %" GST_TIME_FORMAT, buf, GST_TIME_ARGS (start_time),
+          GST_TIME_ARGS (end_time), GST_TIME_ARGS (output_start_time),
+          GST_TIME_ARGS (output_end_time));
 
-        need_more_data = TRUE;
+      if (pad->priv->end_time != -1 && pad->priv->end_time > end_time) {
+        GST_DEBUG_OBJECT (pad, "Buffer from the past, dropping");
+        gst_buffer_unref (buf);
+        gst_aggregator_pad_drop_buffer (bpad);
         continue;
       }
 
@@ -945,17 +1083,11 @@
             GST_TIME_ARGS (start_time));
         gst_buffer_replace (&pad->buffer, buf);
         pad->buffer_vinfo = *vinfo;
-        pad->start_time = start_time;
-        pad->end_time = end_time;
+        pad->priv->start_time = start_time;
+        pad->priv->end_time = end_time;
 
-        if (buf == pad->queued) {
-          gst_buffer_unref (buf);
-          gst_buffer_replace (&pad->queued, NULL);
-        } else {
-          gst_buffer_unref (buf);
-          buf = gst_aggregator_pad_steal_buffer (bpad);
-          gst_buffer_unref (buf);
-        }
+        gst_buffer_unref (buf);
+        gst_aggregator_pad_drop_buffer (bpad);
         eos = FALSE;
       } else if (start_time >= output_end_time) {
         GST_DEBUG_OBJECT (pad, "Keeping buffer until %" GST_TIME_FORMAT,
@@ -963,24 +1095,24 @@
         gst_buffer_unref (buf);
         eos = FALSE;
       } else {
-        GST_DEBUG_OBJECT (pad, "Too old buffer -- dropping");
-        if (buf == pad->queued) {
-          gst_buffer_unref (buf);
-          gst_buffer_replace (&pad->queued, NULL);
-        } else {
-          gst_buffer_unref (buf);
-          buf = gst_aggregator_pad_steal_buffer (bpad);
-          gst_buffer_unref (buf);
-        }
+        gst_buffer_replace (&pad->buffer, buf);
+        pad->buffer_vinfo = *vinfo;
+        pad->priv->start_time = start_time;
+        pad->priv->end_time = end_time;
+        GST_DEBUG_OBJECT (pad,
+            "replacing old buffer with a newer buffer, start %" GST_TIME_FORMAT
+            " out end %" GST_TIME_FORMAT, GST_TIME_ARGS (start_time),
+            GST_TIME_ARGS (output_end_time));
+        gst_buffer_unref (buf);
+        gst_aggregator_pad_drop_buffer (bpad);
 
         need_more_data = TRUE;
         continue;
       }
     } else {
-      if (pad->end_time != -1) {
-        if (pad->end_time <= output_start_time) {
-          gst_buffer_replace (&pad->buffer, NULL);
-          pad->start_time = pad->end_time = -1;
+      if (pad->priv->end_time != -1) {
+        if (pad->priv->end_time <= output_start_time) {
+          pad->priv->start_time = pad->priv->end_time = -1;
           if (is_eos) {
             GST_DEBUG ("I just need more data");
             need_more_data = TRUE;
@@ -988,6 +1120,8 @@
         } else if (is_eos) {
           eos = FALSE;
         }
+      } else if (is_eos) {
+        gst_buffer_replace (&pad->buffer, NULL);
       }
     }
   }
@@ -1002,95 +1136,47 @@
 }
 
 static gboolean
-prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
+sync_pad_values (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
 {
   GstAggregatorPad *bpad = GST_AGGREGATOR_PAD (pad);
+  GstClockTime timestamp;
+  gint64 stream_time;
 
-  static GstAllocationParams params = { 0, 15, 0, 0, };
+  if (pad->buffer == NULL)
+    return TRUE;
 
-  if (pad->buffer != NULL) {
-    guint outsize;
-    GstClockTime timestamp;
-    gint64 stream_time;
-    GstSegment *seg;
-    GstVideoFrame *converted_frame;
-    GstBuffer *converted_buf = NULL;
-    GstVideoFrame *frame = g_slice_new0 (GstVideoFrame);
+  timestamp = GST_BUFFER_TIMESTAMP (pad->buffer);
+  GST_OBJECT_LOCK (bpad);
+  stream_time = gst_segment_to_stream_time (&bpad->segment, GST_FORMAT_TIME,
+      timestamp);
+  GST_OBJECT_UNLOCK (bpad);
 
-    seg = &bpad->segment;
-
-    timestamp = GST_BUFFER_TIMESTAMP (pad->buffer);
-
-    stream_time = gst_segment_to_stream_time (seg, GST_FORMAT_TIME, timestamp);
-
-    /* sync object properties on stream time */
-    if (GST_CLOCK_TIME_IS_VALID (stream_time))
-      gst_object_sync_values (GST_OBJECT (pad), stream_time);
-
-
-    if (!gst_video_frame_map (frame, &pad->buffer_vinfo, pad->buffer,
-            GST_MAP_READ)) {
-      GST_WARNING_OBJECT (vagg, "Could not map input buffer");
-    }
-
-    if (pad->priv->convert) {
-      gint converted_size;
-
-      converted_frame = g_slice_new0 (GstVideoFrame);
-
-      /* We wait until here to set the conversion infos, in case vagg->info changed */
-      if (pad->need_conversion_update) {
-        pad->conversion_info = vagg->info;
-        gst_video_info_set_format (&(pad->conversion_info),
-            GST_VIDEO_INFO_FORMAT (&vagg->info), pad->info.width,
-            pad->info.height);
-        pad->need_conversion_update = FALSE;
-      }
-
-      converted_size = pad->conversion_info.size;
-      outsize = GST_VIDEO_INFO_SIZE (&vagg->info);
-      converted_size = converted_size > outsize ? converted_size : outsize;
-      converted_buf = gst_buffer_new_allocate (NULL, converted_size, &params);
-
-      if (!gst_video_frame_map (converted_frame, &(pad->conversion_info),
-              converted_buf, GST_MAP_READWRITE)) {
-        GST_WARNING_OBJECT (vagg, "Could not map converted frame");
-
-        g_slice_free (GstVideoFrame, converted_frame);
-        gst_video_frame_unmap (frame);
-        g_slice_free (GstVideoFrame, frame);
-        return FALSE;
-      }
-
-      badvideoconvert_convert_convert (pad->priv->convert, converted_frame,
-          frame);
-      pad->converted_buffer = converted_buf;
-      gst_video_frame_unmap (frame);
-      g_slice_free (GstVideoFrame, frame);
-    } else {
-      converted_frame = frame;
-      converted_buf = pad->buffer;
-    }
-
-    pad->aggregated_frame = converted_frame;
-  }
+  /* sync object properties on stream time */
+  if (GST_CLOCK_TIME_IS_VALID (stream_time))
+    gst_object_sync_values (GST_OBJECT (pad), stream_time);
 
   return TRUE;
 }
 
 static gboolean
+prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
+{
+  GstVideoAggregatorPadClass *vaggpad_class =
+      GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad);
+
+  if (pad->buffer == NULL || !vaggpad_class->prepare_frame)
+    return TRUE;
+
+  return vaggpad_class->prepare_frame (pad, vagg);
+}
+
+static gboolean
 clean_pad (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad)
 {
-  if (pad->aggregated_frame) {
-    gst_video_frame_unmap (pad->aggregated_frame);
-    g_slice_free (GstVideoFrame, pad->aggregated_frame);
-    pad->aggregated_frame = NULL;
-  }
+  GstVideoAggregatorPadClass *vaggpad_class =
+      GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad);
 
-  if (pad->converted_buffer) {
-    gst_buffer_unref (pad->converted_buffer);
-    pad->converted_buffer = NULL;
-  }
+  vaggpad_class->clean_frame (pad, vagg);
 
   return TRUE;
 }
@@ -1103,6 +1189,8 @@
   GstFlowReturn ret = GST_FLOW_OK;
   GstElementClass *klass = GST_ELEMENT_GET_CLASS (vagg);
   GstVideoAggregatorClass *vagg_klass = (GstVideoAggregatorClass *) klass;
+  GstVideoAggregatorPadClass *vaggpad_class = g_type_class_peek
+      (GST_AGGREGATOR_CLASS (klass)->sinkpads_type);
 
   g_assert (vagg_klass->aggregate_frames != NULL);
   g_assert (vagg_klass->get_output_buffer != NULL);
@@ -1116,16 +1204,20 @@
   GST_BUFFER_TIMESTAMP (*outbuf) = output_start_time;
   GST_BUFFER_DURATION (*outbuf) = output_end_time - output_start_time;
 
-  if (vagg_klass->disable_frame_conversion == FALSE) {
-    /* Here we convert all the frames the subclass will have to aggregate */
-    gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (vagg),
-        (GstAggregatorPadForeachFunc) prepare_frames, NULL);
-  }
+  /* Sync pad properties to the stream time */
+  gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (vagg),
+      (GstAggregatorPadForeachFunc) sync_pad_values, NULL);
+
+  /* Convert all the frames the subclass has before aggregating */
+  gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (vagg),
+      (GstAggregatorPadForeachFunc) prepare_frames, NULL);
 
   ret = vagg_klass->aggregate_frames (vagg, *outbuf);
 
-  gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (vagg),
-      (GstAggregatorPadForeachFunc) clean_pad, NULL);
+  if (vaggpad_class->clean_frame) {
+    gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (vagg),
+        (GstAggregatorPadForeachFunc) clean_pad, NULL);
+  }
 
   return ret;
 }
@@ -1173,8 +1265,17 @@
   return jitter;
 }
 
+static GstClockTime
+gst_videoaggregator_get_next_time (GstAggregator * agg)
+{
+  if (agg->segment.position == -1)
+    return agg->segment.start;
+  else
+    return agg->segment.position;
+}
+
 static GstFlowReturn
-gst_videoaggregator_aggregate (GstAggregator * agg)
+gst_videoaggregator_aggregate (GstAggregator * agg, gboolean timeout)
 {
   GstFlowReturn ret;
   GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (agg);
@@ -1183,40 +1284,75 @@
   gint res;
   gint64 jitter;
 
-  /* If we're not negotiated_caps yet... */
-  if (GST_VIDEO_INFO_FORMAT (&vagg->info) == GST_VIDEO_FORMAT_UNKNOWN) {
-    GST_INFO_OBJECT (agg, "Not negotiated yet!");
-    return GST_FLOW_NOT_NEGOTIATED;
-  }
-
-  if (gst_pad_check_reconfigure (agg->srcpad))
-    gst_videoaggregator_update_src_caps (vagg);
-
-  if (vagg->priv->send_caps) {
-    gst_aggregator_set_src_caps (agg, vagg->priv->current_caps);
-    vagg->priv->send_caps = FALSE;
-  }
-
   GST_VIDEO_AGGREGATOR_LOCK (vagg);
 
-  if (agg->segment.position == -1)
-    output_start_time = agg->segment.start;
-  else
-    output_start_time = agg->segment.position;
+  if (GST_VIDEO_INFO_FORMAT (&vagg->info) == GST_VIDEO_FORMAT_UNKNOWN
+      || gst_pad_check_reconfigure (agg->srcpad)) {
+    ret = gst_videoaggregator_update_converters (vagg);
+    if (ret)
+      ret = gst_videoaggregator_update_src_caps (vagg);
 
-  output_end_time =
-      vagg->priv->ts_offset + gst_util_uint64_scale_round (vagg->priv->nframes +
-      1, GST_SECOND * GST_VIDEO_INFO_FPS_D (&vagg->info),
-      GST_VIDEO_INFO_FPS_N (&vagg->info)) + agg->segment.start;
+    if (!ret) {
+      if (timeout && gst_pad_needs_reconfigure (agg->srcpad)) {
+        guint64 frame_duration;
+        gint fps_d, fps_n;
+
+        GST_DEBUG_OBJECT (vagg,
+            "Got timeout before receiving any caps, don't output anything");
+
+        if (agg->segment.position == -1) {
+          if (agg->segment.rate > 0.0)
+            agg->segment.position = agg->segment.start;
+          else
+            agg->segment.position = agg->segment.stop;
+        }
+
+        /* Advance position */
+        fps_d = GST_VIDEO_INFO_FPS_D (&vagg->info) ?
+            GST_VIDEO_INFO_FPS_D (&vagg->info) : 1;
+        fps_n = GST_VIDEO_INFO_FPS_N (&vagg->info) ?
+            GST_VIDEO_INFO_FPS_N (&vagg->info) : 25;
+        /* Default to 25/1 if no "best fps" is known */
+        frame_duration = gst_util_uint64_scale (GST_SECOND, fps_d, fps_n);
+        if (agg->segment.rate > 0.0)
+          agg->segment.position += frame_duration;
+        else if (agg->segment.position > frame_duration)
+          agg->segment.position -= frame_duration;
+        else
+          agg->segment.position = 0;
+        vagg->priv->nframes++;
+        GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
+        return GST_FLOW_OK;
+      } else {
+        GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
+        return GST_FLOW_NOT_NEGOTIATED;
+      }
+    }
+  }
+
+  output_start_time = gst_videoaggregator_get_next_time (agg);
+
+  if (GST_VIDEO_INFO_FPS_N (&vagg->info) == 0)
+    output_end_time = -1;
+  else
+    output_end_time =
+        vagg->priv->ts_offset +
+        gst_util_uint64_scale_round (vagg->priv->nframes + 1,
+        GST_SECOND * GST_VIDEO_INFO_FPS_D (&vagg->info),
+        GST_VIDEO_INFO_FPS_N (&vagg->info)) + agg->segment.start;
 
   if (agg->segment.stop != -1)
     output_end_time = MIN (output_end_time, agg->segment.stop);
 
-  res =
-      gst_videoaggregator_fill_queues (vagg, output_start_time,
-      output_end_time);
+  if (output_end_time == output_start_time) {
+    res = GST_FLOW_EOS;
+  } else {
+    res =
+        gst_videoaggregator_fill_queues (vagg, output_start_time,
+        output_end_time);
+  }
 
-  if (res == GST_FLOW_NEEDS_DATA) {
+  if (res == GST_FLOW_NEEDS_DATA && !timeout) {
     GST_DEBUG_OBJECT (vagg, "Need more data for decisions");
     ret = GST_FLOW_OK;
     goto done;
@@ -1365,87 +1501,6 @@
 }
 
 static gboolean
-gst_videoaggregator_query_latency (GstVideoAggregator * vagg, GstQuery * query)
-{
-  GstClockTime min, max;
-  gboolean live;
-  gboolean res;
-  GstIterator *it;
-  gboolean done;
-  GValue item = { 0 };
-
-  res = TRUE;
-  done = FALSE;
-  live = FALSE;
-  min = 0;
-  max = GST_CLOCK_TIME_NONE;
-
-  /* Take maximum of all latency values */
-  it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (vagg));
-  while (!done) {
-    switch (gst_iterator_next (it, &item)) {
-      case GST_ITERATOR_DONE:
-        done = TRUE;
-        break;
-      case GST_ITERATOR_OK:
-      {
-        GstPad *pad = g_value_get_object (&item);
-        GstQuery *peerquery;
-        GstClockTime min_cur, max_cur;
-        gboolean live_cur;
-
-        peerquery = gst_query_new_latency ();
-
-        /* Ask peer for latency */
-        res &= gst_pad_peer_query (pad, peerquery);
-
-        /* take max from all valid return values */
-        if (res) {
-          gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
-
-          if (min_cur > min)
-            min = min_cur;
-
-          if (max_cur != GST_CLOCK_TIME_NONE &&
-              ((max != GST_CLOCK_TIME_NONE && max_cur > max) ||
-                  (max == GST_CLOCK_TIME_NONE)))
-            max = max_cur;
-
-          live = live || live_cur;
-        }
-
-        gst_query_unref (peerquery);
-        g_value_reset (&item);
-        break;
-      }
-      case GST_ITERATOR_RESYNC:
-        live = FALSE;
-        min = 0;
-        max = GST_CLOCK_TIME_NONE;
-        res = TRUE;
-        gst_iterator_resync (it);
-        break;
-      default:
-        res = FALSE;
-        done = TRUE;
-        break;
-    }
-  }
-  g_value_unset (&item);
-  gst_iterator_free (it);
-
-  if (res) {
-    /* store the results */
-    GST_DEBUG_OBJECT (vagg, "Calculated total latency: live %s, min %"
-        GST_TIME_FORMAT ", max %" GST_TIME_FORMAT,
-        (live ? "yes" : "no"), GST_TIME_ARGS (min), GST_TIME_ARGS (max));
-    gst_query_set_latency (query, live, min, max);
-  }
-
-  return res;
-}
-
-static gboolean
 gst_videoaggregator_src_query (GstAggregator * agg, GstQuery * query)
 {
   GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (agg);
@@ -1473,19 +1528,11 @@
     case GST_QUERY_DURATION:
       res = gst_videoaggregator_query_duration (vagg, query);
       break;
-    case GST_QUERY_LATENCY:
-      res = gst_videoaggregator_query_latency (vagg, query);
-      break;
-    case GST_QUERY_CAPS:
+    default:
       res =
           GST_AGGREGATOR_CLASS (gst_videoaggregator_parent_class)->src_query
           (agg, query);
       break;
-    default:
-      /* FIXME, needs a custom query handler because we have multiple
-       * sinkpads */
-      res = FALSE;
-      break;
   }
   return res;
 }
@@ -1526,11 +1573,13 @@
 {
   GstVideoAggregatorPad *pad = GST_VIDEO_AGGREGATOR_PAD (bpad);
   GstClockTime start_time, end_time;
+  GstBuffer *pbuf;
 
   start_time = GST_BUFFER_TIMESTAMP (buf);
   if (start_time == -1) {
-    GST_DEBUG_OBJECT (pad, "Timestamped buffers required!");
+    GST_WARNING_OBJECT (pad, "Timestamped buffers required!");
     gst_buffer_unref (buf);
+    *outbuf = NULL;
     return GST_FLOW_ERROR;
   }
 
@@ -1544,6 +1593,8 @@
     return GST_FLOW_OK;
   }
 
+  GST_OBJECT_LOCK (bpad);
+
   start_time = MAX (start_time, bpad->segment.start);
   start_time =
       gst_segment_to_running_time (&bpad->segment, GST_FORMAT_TIME, start_time);
@@ -1556,17 +1607,25 @@
 
   /* Convert to the output segment rate */
   if (ABS (agg->segment.rate) != 1.0) {
-    start_time *= ABS (agg->segment.rate);
     end_time *= ABS (agg->segment.rate);
   }
 
-  if (bpad->buffer != NULL && end_time < pad->end_time) {
-    gst_buffer_unref (buf);
-    *outbuf = NULL;
-    return GST_FLOW_OK;
+  pbuf = gst_aggregator_pad_get_buffer (bpad);
+  if (pbuf != NULL) {
+    gst_buffer_unref (pbuf);
+
+    if (end_time < pad->priv->end_time) {
+      gst_buffer_unref (buf);
+      *outbuf = NULL;
+      goto done;
+    }
   }
 
   *outbuf = buf;
+
+done:
+
+  GST_OBJECT_UNLOCK (bpad);
   return GST_FLOW_OK;
 }
 
@@ -1578,20 +1637,20 @@
   GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (agg);
 
   GST_INFO_OBJECT (agg, "Flushing");
-  abs_rate = ABS (agg->segment.rate);
   GST_OBJECT_LOCK (vagg);
+  abs_rate = ABS (agg->segment.rate);
   for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
     GstVideoAggregatorPad *p = l->data;
 
     /* Convert to the output segment rate */
     if (ABS (agg->segment.rate) != abs_rate) {
       if (ABS (agg->segment.rate) != 1.0 && p->buffer) {
-        p->start_time /= ABS (agg->segment.rate);
-        p->end_time /= ABS (agg->segment.rate);
+        p->priv->start_time /= ABS (agg->segment.rate);
+        p->priv->end_time /= ABS (agg->segment.rate);
       }
       if (abs_rate != 1.0 && p->buffer) {
-        p->start_time *= abs_rate;
-        p->end_time *= abs_rate;
+        p->priv->start_time *= abs_rate;
+        p->priv->end_time *= abs_rate;
       }
     }
   }
@@ -1653,11 +1712,6 @@
 {
   GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (agg);
 
-  if (!GST_AGGREGATOR_CLASS (gst_videoaggregator_parent_class)->start (agg))
-    return FALSE;
-
-  vagg->priv->send_caps = TRUE;
-  gst_segment_init (&agg->segment, GST_FORMAT_TIME);
   gst_caps_replace (&vagg->priv->current_caps, NULL);
 
   return TRUE;
@@ -1668,9 +1722,6 @@
 {
   GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (agg);
 
-  if (!GST_AGGREGATOR_CLASS (gst_videoaggregator_parent_class)->stop (agg))
-    return FALSE;
-
   gst_videoaggregator_reset (vagg);
 
   return TRUE;
@@ -1695,8 +1746,8 @@
 
   GST_OBJECT_LOCK (vagg);
   vaggpad->zorder = GST_ELEMENT (vagg)->numsinkpads;
-  vaggpad->start_time = -1;
-  vaggpad->end_time = -1;
+  vaggpad->priv->start_time = -1;
+  vaggpad->priv->end_time = -1;
   element->sinkpads = g_list_sort (element->sinkpads,
       (GCompareFunc) pad_zorder_compare);
   GST_OBJECT_UNLOCK (vagg);
@@ -1712,16 +1763,21 @@
 {
   GstVideoAggregator *vagg = NULL;
   GstVideoAggregatorPad *vaggpad;
-  gboolean update_caps;
+  gboolean last_pad;
 
   vagg = GST_VIDEO_AGGREGATOR (element);
   vaggpad = GST_VIDEO_AGGREGATOR_PAD (pad);
 
   GST_VIDEO_AGGREGATOR_LOCK (vagg);
-  gst_videoaggregator_update_converters (vagg);
+
+  GST_OBJECT_LOCK (vagg);
+  last_pad = (GST_ELEMENT (vagg)->numsinkpads - 1 == 0);
+  GST_OBJECT_UNLOCK (vagg);
+
+  if (last_pad)
+    gst_videoaggregator_reset (vagg);
+
   gst_buffer_replace (&vaggpad->buffer, NULL);
-  update_caps = GST_VIDEO_INFO_FORMAT (&vagg->info) != GST_VIDEO_FORMAT_UNKNOWN;
-  GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
 
   gst_child_proxy_child_removed (GST_CHILD_PROXY (vagg), G_OBJECT (vaggpad),
       GST_OBJECT_NAME (vaggpad));
@@ -1729,9 +1785,9 @@
   GST_ELEMENT_CLASS (gst_videoaggregator_parent_class)->release_pad (GST_ELEMENT
       (vagg), pad);
 
-  if (update_caps)
-    gst_videoaggregator_update_src_caps (vagg);
+  gst_pad_mark_reconfigure (vagg->aggregator.srcpad);
 
+  GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
   return;
 }
 
@@ -1853,7 +1909,6 @@
   GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (o);
 
   g_mutex_clear (&vagg->priv->lock);
-  g_mutex_clear (&vagg->priv->setcaps_lock);
 
   G_OBJECT_CLASS (gst_videoaggregator_parent_class)->finalize (o);
 }
@@ -1914,14 +1969,6 @@
   gstelement_class->release_pad =
       GST_DEBUG_FUNCPTR (gst_videoaggregator_release_pad);
 
-  gst_element_class_set_static_metadata (gstelement_class,
-      "Video aggregator base class", "Filter/Editor/Video",
-      "Aggregate multiple video streams",
-      "Wim Taymans <wim@fluendo.com>, "
-      "Sebastian Dröge <sebastian.droege@collabora.co.uk>, "
-      "Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>, "
-      "Thibault Saunier <tsaunier@gnome.org>");
-
   agg_class->sinkpads_type = GST_TYPE_VIDEO_AGGREGATOR_PAD;
   agg_class->start = gst_videoaggregator_start;
   agg_class->stop = gst_videoaggregator_stop;
@@ -1932,7 +1979,9 @@
   agg_class->aggregate = gst_videoaggregator_aggregate;
   agg_class->src_event = gst_videoaggregator_src_event;
   agg_class->src_query = gst_videoaggregator_src_query;
+  agg_class->get_next_time = gst_videoaggregator_get_next_time;
 
+  klass->find_best_format = gst_videoaggreagator_find_best_format;
   klass->get_output_buffer = gst_videoaggregator_get_output_buffer;
 
   /* Register the pad class */
@@ -1949,7 +1998,6 @@
   vagg->priv->current_caps = NULL;
 
   g_mutex_init (&vagg->priv->lock);
-  g_mutex_init (&vagg->priv->setcaps_lock);
   /* initialize variables */
   gst_videoaggregator_reset (vagg);
 }
diff --git a/gst-libs/gst/video/gstvideoaggregator.h b/gst-libs/gst/video/gstvideoaggregator.h
index b9fd531..2be7eb6 100644
--- a/gst-libs/gst/video/gstvideoaggregator.h
+++ b/gst-libs/gst/video/gstvideoaggregator.h
@@ -30,8 +30,6 @@
 #include <gst/video/video.h>
 #include <gst/base/gstaggregator.h>
 
-#include "gstvideoaggregatorpad.h"
-
 G_BEGIN_DECLS
 
 #define GST_TYPE_VIDEO_AGGREGATOR (gst_videoaggregator_get_type())
@@ -50,6 +48,8 @@
 typedef struct _GstVideoAggregatorClass GstVideoAggregatorClass;
 typedef struct _GstVideoAggregatorPrivate GstVideoAggregatorPrivate;
 
+#include "gstvideoaggregatorpad.h"
+
 /**
  * GstVideoAggregator:
  * @info: The #GstVideoInfo representing the currently set
@@ -65,17 +65,14 @@
 
   /* < private > */
   GstVideoAggregatorPrivate *priv;
-  gpointer          _gst_reserved[GST_PADDING];
+  gpointer          _gst_reserved[GST_PADDING_LARGE];
 };
 
 /**
  * GstVideoAggregatorClass:
- * @disable_frame_conversion: Optional.
- *                            Allows subclasses to disable the frame colorspace
- *                            conversion feature
- * @update_info:              Optional.
- *                            Lets subclasses update the src #GstVideoInfo representing
- *                            the src pad caps before usage.
+ * @update_caps:              Optional.
+ *                            Lets subclasses update the #GstCaps representing
+ *                            the src pad caps before usage.  Return %NULL to indicate failure.
  * @aggregate_frames:         Lets subclasses aggregate frames that are ready. Subclasses
  *                            should iterate the GstElement.sinkpads and use the already
  *                            mapped #GstVideoFrame from GstVideoAggregatorPad.aggregated_frame
@@ -87,6 +84,8 @@
  *                            the #aggregate_frames vmethod.
  * @negotiated_caps:          Optional.
  *                            Notifies subclasses what caps format has been negotiated
+ * @find_best_format:         Optional.
+ *                            Lets subclasses decide of the best common format to use.
  **/
 struct _GstVideoAggregatorClass
 {
@@ -94,18 +93,20 @@
   GstAggregatorClass parent_class;
 
   /*< public >*/
-  gboolean           disable_frame_conversion;
-
-  gboolean           (*update_info)               (GstVideoAggregator *  videoaggregator,
-                                                   GstVideoInfo       *  info);
+  GstCaps *          (*update_caps)               (GstVideoAggregator *  videoaggregator,
+                                                   GstCaps            *  caps);
   GstFlowReturn      (*aggregate_frames)          (GstVideoAggregator *  videoaggregator,
                                                    GstBuffer          *  outbuffer);
   GstFlowReturn      (*get_output_buffer)         (GstVideoAggregator *  videoaggregator,
                                                    GstBuffer          ** outbuffer);
   gboolean           (*negotiated_caps)           (GstVideoAggregator *  videoaggregator,
                                                    GstCaps            *  caps);
+  void               (*find_best_format)          (GstVideoAggregator *  vagg,
+                                                   GstCaps            *  downstream_caps,
+                                                   GstVideoInfo       *  best_info,
+                                                   gboolean           *  at_least_one_alpha);
   /* < private > */
-  gpointer            _gst_reserved[GST_PADDING];
+  gpointer            _gst_reserved[GST_PADDING_LARGE];
 };
 
 GType gst_videoaggregator_get_type       (void);
diff --git a/gst-libs/gst/video/gstvideoaggregatorpad.h b/gst-libs/gst/video/gstvideoaggregatorpad.h
index 8f7f8ad..8fd061b 100644
--- a/gst-libs/gst/video/gstvideoaggregatorpad.h
+++ b/gst-libs/gst/video/gstvideoaggregatorpad.h
@@ -17,7 +17,7 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
- 
+
 #ifndef __GST_VIDEO_AGGREGATOR_PAD_H__
 #define __GST_VIDEO_AGGREGATOR_PAD_H__
 
@@ -25,6 +25,7 @@
 #include <gst/video/video.h>
 
 #include <gst/base/gstaggregator.h>
+#include "gstvideoaggregator.h"
 
 G_BEGIN_DECLS
 
@@ -37,6 +38,8 @@
         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR_PAD))
 #define GST_IS_VIDEO_AGGREGATOR_PAD_CLASS(klass) \
         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR_PAD))
+#define GST_VIDEO_AGGREGATOR_PAD_GET_CLASS(obj) \
+        (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VIDEO_AGGREGATOR_PAD,GstVideoAggregatorPadClass))
 
 typedef struct _GstVideoAggregatorPad GstVideoAggregatorPad;
 typedef struct _GstVideoAggregatorPadClass GstVideoAggregatorPadClass;
@@ -44,46 +47,56 @@
 
 /**
  * GstVideoAggregatorPad:
- *
- * The opaque #GstVideoAggregatorPad structure.
+ * @info: The #GstVideoInfo currently set on the pad
+ * @buffer_vinfo: The #GstVideoInfo representing the type contained
+ *                in @buffer
+ * @aggregated_frame: The #GstVideoFrame ready to be used for aggregation
+ *                    inside the aggregate_frames vmethod.
+ * @zorder: The zorder of this pad
  */
 struct _GstVideoAggregatorPad
 {
   GstAggregatorPad parent;
 
-  /* < private > */
-
-  /* caps */
   GstVideoInfo info;
 
+  GstBuffer *buffer;
+  GstVideoInfo buffer_vinfo;
+
+  GstVideoFrame *aggregated_frame;
+
   /* properties */
   guint zorder;
 
-  /* caps used for conversion if needed */
-  GstVideoInfo conversion_info;
-
-  gboolean need_conversion_update;
-  GstBuffer *converted_buffer;
-
-  GstBuffer *buffer;
-  GstVideoInfo queued_vinfo;
-  GstBuffer *queued;
-  GstVideoInfo buffer_vinfo;
-
-  GstClockTime start_time;
-  GstClockTime end_time;
-  GstVideoFrame *aggregated_frame;
-
   /* < private > */
   GstVideoAggregatorPadPrivate *priv;
   gpointer          _gst_reserved[GST_PADDING];
 };
 
+/**
+ * GstVideoAggregatorPadClass:
+ *
+ * @set_info: Lets subclass set a converter on the pad,
+ *                 right after a new format has been negotiated.
+ * @prepare_frame: Prepare the frame from the pad buffer (if any)
+ *                 and sets it to @aggregated_frame
+ * @clean_frame:   clean the frame previously prepared in prepare_frame
+ */
 struct _GstVideoAggregatorPadClass
 {
   GstAggregatorPadClass parent_class;
+  gboolean           (*set_info)              (GstVideoAggregatorPad * pad,
+                                               GstVideoAggregator    * videoaggregator,
+                                               GstVideoInfo          * current_info,
+                                               GstVideoInfo          * wanted_info);
 
-  gpointer          _gst_reserved[GST_PADDING];
+  gboolean           (*prepare_frame)         (GstVideoAggregatorPad * pad,
+                                               GstVideoAggregator    * videoaggregator);
+
+  void               (*clean_frame)           (GstVideoAggregatorPad * pad,
+                                               GstVideoAggregator    * videoaggregator);
+
+  gpointer          _gst_reserved[GST_PADDING_LARGE];
 };
 
 GType gst_videoaggregator_pad_get_type (void);
diff --git a/gst-libs/gst/video/videoconvert.c b/gst-libs/gst/video/videoconvert.c
deleted file mode 100644
index 57d865f..0000000
--- a/gst-libs/gst/video/videoconvert.c
+++ /dev/null
@@ -1,1502 +0,0 @@
-/* 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "videoconvert.h"
-
-#include <glib.h>
-#include <string.h>
-#include <math.h>
-
-#include "bad-video-orc.h"
-
-
-static void videoconvert_convert_generic (VideoConvert * convert,
-    GstVideoFrame * dest, const GstVideoFrame * src);
-static void videoconvert_convert_matrix8 (VideoConvert * convert,
-    gpointer pixels);
-static void videoconvert_convert_matrix16 (VideoConvert * convert,
-    gpointer pixels);
-static gboolean videoconvert_convert_lookup_fastpath (VideoConvert * convert);
-static gboolean videoconvert_convert_compute_matrix (VideoConvert * convert);
-static gboolean videoconvert_convert_compute_resample (VideoConvert * convert);
-static void videoconvert_dither_verterr (VideoConvert * convert,
-    guint16 * pixels, int j);
-static void videoconvert_dither_halftone (VideoConvert * convert,
-    guint16 * pixels, int j);
-
-
-VideoConvert *
-badvideoconvert_convert_new (GstVideoInfo * in_info, GstVideoInfo * out_info)
-{
-  VideoConvert *convert;
-  gint width;
-
-  convert = g_malloc0 (sizeof (VideoConvert));
-
-  convert->in_info = *in_info;
-  convert->out_info = *out_info;
-  convert->dither16 = NULL;
-
-  convert->width = GST_VIDEO_INFO_WIDTH (in_info);
-  convert->height = GST_VIDEO_INFO_HEIGHT (in_info);
-
-  if (!videoconvert_convert_lookup_fastpath (convert)) {
-    convert->convert = videoconvert_convert_generic;
-    if (!videoconvert_convert_compute_matrix (convert))
-      goto no_convert;
-
-    if (!videoconvert_convert_compute_resample (convert))
-      goto no_convert;
-  }
-
-  width = convert->width;
-
-  convert->lines = out_info->finfo->pack_lines;
-  convert->errline = g_malloc0 (sizeof (guint16) * width * 4);
-
-  return convert;
-
-  /* ERRORS */
-no_convert:
-  {
-    badvideoconvert_convert_free (convert);
-    return NULL;
-  }
-}
-
-void
-badvideoconvert_convert_free (VideoConvert * convert)
-{
-  gint i;
-
-  if (convert->upsample)
-    gst_video_chroma_resample_free (convert->upsample);
-  if (convert->downsample)
-    gst_video_chroma_resample_free (convert->downsample);
-
-  for (i = 0; i < convert->n_tmplines; i++)
-    g_free (convert->tmplines[i]);
-  g_free (convert->tmplines);
-  g_free (convert->errline);
-
-  g_free (convert);
-}
-
-void
-badvideoconvert_convert_set_dither (VideoConvert * convert, int type)
-{
-  switch (type) {
-    case 0:
-    default:
-      convert->dither16 = NULL;
-      break;
-    case 1:
-      convert->dither16 = videoconvert_dither_verterr;
-      break;
-    case 2:
-      convert->dither16 = videoconvert_dither_halftone;
-      break;
-  }
-}
-
-void
-badvideoconvert_convert_convert (VideoConvert * convert,
-    GstVideoFrame * dest, const GstVideoFrame * src)
-{
-  convert->convert (convert, dest, src);
-}
-
-#define SCALE    (8)
-#define SCALE_F  ((float) (1 << SCALE))
-
-static void
-videoconvert_convert_matrix8 (VideoConvert * convert, gpointer pixels)
-{
-  int i;
-  int r, g, b;
-  int y, u, v;
-  guint8 *p = pixels;
-
-  for (i = 0; i < convert->width; i++) {
-    r = p[i * 4 + 1];
-    g = p[i * 4 + 2];
-    b = p[i * 4 + 3];
-
-    y = (convert->cmatrix[0][0] * r + convert->cmatrix[0][1] * g +
-        convert->cmatrix[0][2] * b + convert->cmatrix[0][3]) >> SCALE;
-    u = (convert->cmatrix[1][0] * r + convert->cmatrix[1][1] * g +
-        convert->cmatrix[1][2] * b + convert->cmatrix[1][3]) >> SCALE;
-    v = (convert->cmatrix[2][0] * r + convert->cmatrix[2][1] * g +
-        convert->cmatrix[2][2] * b + convert->cmatrix[2][3]) >> SCALE;
-
-    p[i * 4 + 1] = CLAMP (y, 0, 255);
-    p[i * 4 + 2] = CLAMP (u, 0, 255);
-    p[i * 4 + 3] = CLAMP (v, 0, 255);
-  }
-}
-
-static void
-videoconvert_convert_matrix16 (VideoConvert * convert, gpointer pixels)
-{
-  int i;
-  int r, g, b;
-  int y, u, v;
-  guint16 *p = pixels;
-
-  for (i = 0; i < convert->width; i++) {
-    r = p[i * 4 + 1];
-    g = p[i * 4 + 2];
-    b = p[i * 4 + 3];
-
-    y = (convert->cmatrix[0][0] * r + convert->cmatrix[0][1] * g +
-        convert->cmatrix[0][2] * b + convert->cmatrix[0][3]) >> SCALE;
-    u = (convert->cmatrix[1][0] * r + convert->cmatrix[1][1] * g +
-        convert->cmatrix[1][2] * b + convert->cmatrix[1][3]) >> SCALE;
-    v = (convert->cmatrix[2][0] * r + convert->cmatrix[2][1] * g +
-        convert->cmatrix[2][2] * b + convert->cmatrix[2][3]) >> SCALE;
-
-    p[i * 4 + 1] = CLAMP (y, 0, 65535);
-    p[i * 4 + 2] = CLAMP (u, 0, 65535);
-    p[i * 4 + 3] = CLAMP (v, 0, 65535);
-  }
-}
-
-static gboolean
-get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * Kr, gdouble * Kb)
-{
-  gboolean res = TRUE;
-
-  switch (matrix) {
-      /* RGB */
-    default:
-    case GST_VIDEO_COLOR_MATRIX_RGB:
-      res = FALSE;
-      break;
-      /* YUV */
-    case GST_VIDEO_COLOR_MATRIX_FCC:
-      *Kr = 0.30;
-      *Kb = 0.11;
-      break;
-    case GST_VIDEO_COLOR_MATRIX_BT709:
-      *Kr = 0.2126;
-      *Kb = 0.0722;
-      break;
-    case GST_VIDEO_COLOR_MATRIX_BT601:
-      *Kr = 0.2990;
-      *Kb = 0.1140;
-      break;
-    case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
-      *Kr = 0.212;
-      *Kb = 0.087;
-      break;
-  }
-  GST_DEBUG ("matrix: %d, Kr %f, Kb %f", matrix, *Kr, *Kb);
-  return res;
-}
-
-static gboolean
-videoconvert_convert_compute_matrix (VideoConvert * convert)
-{
-  GstVideoInfo *in_info, *out_info;
-  ColorMatrix dst;
-  gint i, j;
-  const GstVideoFormatInfo *sfinfo, *dfinfo;
-  const GstVideoFormatInfo *suinfo, *duinfo;
-  gint offset[4], scale[4];
-  gdouble Kr = 0, Kb = 0;
-
-  in_info = &convert->in_info;
-  out_info = &convert->out_info;
-
-  sfinfo = in_info->finfo;
-  dfinfo = out_info->finfo;
-
-  if (sfinfo->unpack_func == NULL)
-    goto no_unpack_func;
-
-  if (dfinfo->pack_func == NULL)
-    goto no_pack_func;
-
-  suinfo = gst_video_format_get_info (sfinfo->unpack_format);
-  duinfo = gst_video_format_get_info (dfinfo->unpack_format);
-
-  convert->in_bits = GST_VIDEO_FORMAT_INFO_DEPTH (suinfo, 0);
-  convert->out_bits = GST_VIDEO_FORMAT_INFO_DEPTH (duinfo, 0);
-
-  GST_DEBUG ("in bits %d, out bits %d", convert->in_bits, convert->out_bits);
-
-  if (in_info->colorimetry.range == out_info->colorimetry.range &&
-      in_info->colorimetry.matrix == out_info->colorimetry.matrix) {
-    GST_DEBUG ("using identity color transform");
-    convert->matrix = NULL;
-    return TRUE;
-  }
-
-  /* calculate intermediate format for the matrix. When unpacking, we expand
-   * input to 16 when one of the inputs is 16 bits */
-  if (convert->in_bits == 16 || convert->out_bits == 16) {
-    convert->matrix = videoconvert_convert_matrix16;
-
-    if (GST_VIDEO_FORMAT_INFO_IS_RGB (suinfo))
-      suinfo = gst_video_format_get_info (GST_VIDEO_FORMAT_ARGB64);
-    else
-      suinfo = gst_video_format_get_info (GST_VIDEO_FORMAT_AYUV64);
-
-    if (GST_VIDEO_FORMAT_INFO_IS_RGB (duinfo))
-      duinfo = gst_video_format_get_info (GST_VIDEO_FORMAT_ARGB64);
-    else
-      duinfo = gst_video_format_get_info (GST_VIDEO_FORMAT_AYUV64);
-  } else {
-    convert->matrix = videoconvert_convert_matrix8;
-  }
-
-  bad_color_matrix_set_identity (&dst);
-
-  /* 1, bring color components to [0..1.0] range */
-  gst_video_color_range_offsets (in_info->colorimetry.range, suinfo, offset,
-      scale);
-
-  bad_color_matrix_offset_components (&dst, -offset[0], -offset[1], -offset[2]);
-
-  bad_color_matrix_scale_components (&dst, 1 / ((float) scale[0]),
-      1 / ((float) scale[1]), 1 / ((float) scale[2]));
-
-  /* 2. bring components to R'G'B' space */
-  if (get_Kr_Kb (in_info->colorimetry.matrix, &Kr, &Kb))
-    bad_color_matrix_YCbCr_to_RGB (&dst, Kr, Kb);
-
-  /* 3. inverse transfer function. R'G'B' to linear RGB */
-
-  /* 4. from RGB to XYZ using the primaries */
-
-  /* 5. from XYZ to RGB using the primaries */
-
-  /* 6. transfer function. linear RGB to R'G'B' */
-
-  /* 7. bring components to YCbCr space */
-  if (get_Kr_Kb (out_info->colorimetry.matrix, &Kr, &Kb))
-    bad_color_matrix_RGB_to_YCbCr (&dst, Kr, Kb);
-
-  /* 8, bring color components to nominal range */
-  gst_video_color_range_offsets (out_info->colorimetry.range, duinfo, offset,
-      scale);
-
-  bad_color_matrix_scale_components (&dst, (float) scale[0], (float) scale[1],
-      (float) scale[2]);
-
-  bad_color_matrix_offset_components (&dst, offset[0], offset[1], offset[2]);
-
-  /* because we're doing fixed point matrix coefficients */
-  bad_color_matrix_scale_components (&dst, SCALE_F, SCALE_F, SCALE_F);
-
-  for (i = 0; i < 4; i++)
-    for (j = 0; j < 4; j++)
-      convert->cmatrix[i][j] = rint (dst.m[i][j]);
-
-  GST_DEBUG ("[%6d %6d %6d %6d]", convert->cmatrix[0][0],
-      convert->cmatrix[0][1], convert->cmatrix[0][2], convert->cmatrix[0][3]);
-  GST_DEBUG ("[%6d %6d %6d %6d]", convert->cmatrix[1][0],
-      convert->cmatrix[1][1], convert->cmatrix[1][2], convert->cmatrix[1][3]);
-  GST_DEBUG ("[%6d %6d %6d %6d]", convert->cmatrix[2][0],
-      convert->cmatrix[2][1], convert->cmatrix[2][2], convert->cmatrix[2][3]);
-  GST_DEBUG ("[%6d %6d %6d %6d]", convert->cmatrix[3][0],
-      convert->cmatrix[3][1], convert->cmatrix[3][2], convert->cmatrix[3][3]);
-
-  return TRUE;
-
-  /* ERRORS */
-no_unpack_func:
-  {
-    GST_ERROR ("no unpack_func for format %s",
-        gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (in_info)));
-    return FALSE;
-  }
-no_pack_func:
-  {
-    GST_ERROR ("no pack_func for format %s",
-        gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (out_info)));
-    return FALSE;
-  }
-}
-
-static void
-videoconvert_dither_verterr (VideoConvert * convert, guint16 * pixels, int j)
-{
-  int i;
-  guint16 *errline = convert->errline;
-  unsigned int mask = 0xff;
-
-  for (i = 0; i < 4 * convert->width; i++) {
-    int x = pixels[i] + errline[i];
-    if (x > 65535)
-      x = 65535;
-    pixels[i] = x;
-    errline[i] = x & mask;
-  }
-}
-
-static void
-videoconvert_dither_halftone (VideoConvert * convert, guint16 * pixels, int j)
-{
-  int i;
-  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++) {
-    int x;
-    x = pixels[i] + halftone[(i >> 2) & 7][j & 7];
-    if (x > 65535)
-      x = 65535;
-    pixels[i] = x;
-  }
-}
-
-static void
-alloc_tmplines (VideoConvert * convert, guint lines, gint width)
-{
-  gint i;
-
-  convert->n_tmplines = lines;
-  convert->tmplines = g_malloc (lines * sizeof (gpointer));
-  for (i = 0; i < lines; i++)
-    convert->tmplines[i] = g_malloc (sizeof (guint16) * (width + 8) * 4);
-}
-
-static gboolean
-videoconvert_convert_compute_resample (VideoConvert * convert)
-{
-  GstVideoInfo *in_info, *out_info;
-  const GstVideoFormatInfo *sfinfo, *dfinfo;
-  gint width;
-
-  in_info = &convert->in_info;
-  out_info = &convert->out_info;
-
-  sfinfo = in_info->finfo;
-  dfinfo = out_info->finfo;
-
-  width = convert->width;
-
-  if (sfinfo->w_sub[2] != dfinfo->w_sub[2] ||
-      sfinfo->h_sub[2] != dfinfo->h_sub[2] ||
-      in_info->chroma_site != out_info->chroma_site) {
-    convert->upsample = gst_video_chroma_resample_new (0,
-        in_info->chroma_site, 0, sfinfo->unpack_format, sfinfo->w_sub[2],
-        sfinfo->h_sub[2]);
-
-
-    convert->downsample = gst_video_chroma_resample_new (0,
-        out_info->chroma_site, 0, dfinfo->unpack_format, -dfinfo->w_sub[2],
-        -dfinfo->h_sub[2]);
-
-  } else {
-    convert->upsample = NULL;
-    convert->downsample = NULL;
-  }
-
-  if (convert->upsample) {
-    gst_video_chroma_resample_get_info (convert->upsample,
-        &convert->up_n_lines, &convert->up_offset);
-  } else {
-    convert->up_n_lines = 1;
-    convert->up_offset = 0;
-  }
-  if (convert->downsample) {
-    gst_video_chroma_resample_get_info (convert->downsample,
-        &convert->down_n_lines, &convert->down_offset);
-  } else {
-    convert->down_n_lines = 1;
-    convert->down_offset = 0;
-  }
-  GST_DEBUG ("upsample: %p, site: %d, offset %d, n_lines %d", convert->upsample,
-      in_info->chroma_site, convert->up_offset, convert->up_n_lines);
-  GST_DEBUG ("downsample: %p, site: %d, offset %d, n_lines %d",
-      convert->downsample, out_info->chroma_site, convert->down_offset,
-      convert->down_n_lines);
-
-  alloc_tmplines (convert, convert->down_n_lines + convert->up_n_lines, width);
-
-  return TRUE;
-}
-
-#define TO_16(x) (((x)<<8) | (x))
-
-static void
-convert_to16 (gpointer line, gint width)
-{
-  guint8 *line8 = line;
-  guint16 *line16 = line;
-  gint i;
-
-  for (i = (width - 1) * 4; i >= 0; i--)
-    line16[i] = TO_16 (line8[i]);
-}
-
-static void
-convert_to8 (gpointer line, gint width)
-{
-  guint8 *line8 = line;
-  guint16 *line16 = line;
-  gint i;
-
-  for (i = 0; i < width * 4; i++)
-    line8[i] = line16[i] >> 8;
-}
-
-#define UNPACK_FRAME(frame,dest,line,width)          \
-  frame->info.finfo->unpack_func (frame->info.finfo, \
-      (GST_VIDEO_FRAME_IS_INTERLACED (frame) ?       \
-        GST_VIDEO_PACK_FLAG_INTERLACED :             \
-        GST_VIDEO_PACK_FLAG_NONE),                   \
-      dest, frame->data, frame->info.stride, 0,      \
-      line, width)
-#define PACK_FRAME(frame,dest,line,width)            \
-  frame->info.finfo->pack_func (frame->info.finfo,   \
-      (GST_VIDEO_FRAME_IS_INTERLACED (frame) ?       \
-        GST_VIDEO_PACK_FLAG_INTERLACED :             \
-        GST_VIDEO_PACK_FLAG_NONE),                   \
-      dest, 0, frame->data, frame->info.stride,      \
-      frame->info.chroma_site, line, width);
-
-static void
-videoconvert_convert_generic (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  int j, k;
-  gint width, height, lines, max_lines;
-  guint in_bits, out_bits;
-  gconstpointer pal;
-  gsize palsize;
-  guint up_n_lines, down_n_lines;
-  gint up_offset, down_offset;
-  gint in_lines, out_lines;
-  gint up_line, down_line;
-  gint start_offset, stop_offset;
-  gpointer in_tmplines[8];
-  gpointer out_tmplines[8];
-
-  height = convert->height;
-  width = convert->width;
-
-  in_bits = convert->in_bits;
-  out_bits = convert->out_bits;
-
-  lines = convert->lines;
-  up_n_lines = convert->up_n_lines;
-  up_offset = convert->up_offset;
-  down_n_lines = convert->down_n_lines;
-  down_offset = convert->down_offset;
-  max_lines = convert->n_tmplines;
-
-  in_lines = 0;
-  out_lines = 0;
-
-  GST_DEBUG ("up_offset %d, up_n_lines %u", up_offset, up_n_lines);
-
-  start_offset = MIN (up_offset, down_offset);
-  stop_offset = height + start_offset + MAX (up_n_lines, down_n_lines);
-
-  for (; start_offset < stop_offset; start_offset++) {
-    guint idx, start;
-
-    idx = CLAMP (start_offset, 0, height);
-    in_tmplines[in_lines] = convert->tmplines[idx % max_lines];
-    out_tmplines[out_lines] = in_tmplines[in_lines];
-    GST_DEBUG ("start_offset %d/%d, %d, idx %u, in %d, out %d", start_offset,
-        stop_offset, up_offset, idx, in_lines, out_lines);
-
-    up_line = up_offset + in_lines;
-
-    /* extract the next line */
-    if (up_line >= 0 && up_line < height) {
-      GST_DEBUG ("unpack line %d into %d", up_line, in_lines);
-      UNPACK_FRAME (src, in_tmplines[in_lines], up_line, width);
-    }
-
-    if (start_offset >= up_offset)
-      in_lines++;
-
-    if (start_offset >= down_offset)
-      out_lines++;
-
-    if (in_lines < up_n_lines)
-      continue;
-
-    in_lines = 0;
-
-    /* we have enough lines to upsample */
-    if (convert->upsample) {
-      GST_DEBUG ("doing upsample");
-      gst_video_chroma_resample (convert->upsample, in_tmplines, width);
-    }
-
-    /* convert upsampled lines */
-    for (k = 0; k < up_n_lines; k++) {
-      down_line = up_offset + k;
-
-      /* only takes lines with valid output */
-      if (down_line < 0 || down_line >= height)
-        continue;
-
-      GST_DEBUG ("handle line %d, %d/%d, down_line %d", k, out_lines,
-          down_n_lines, down_line);
-
-      if (out_bits == 16 || in_bits == 16) {
-        /* FIXME, we can scale in the conversion matrix */
-        if (in_bits == 8)
-          convert_to16 (in_tmplines[k], width);
-
-        if (convert->matrix)
-          convert->matrix (convert, in_tmplines[k]);
-        if (convert->dither16)
-          convert->dither16 (convert, in_tmplines[k], down_line);
-
-        if (out_bits == 8)
-          convert_to8 (in_tmplines[k], width);
-      } else {
-        if (convert->matrix)
-          convert->matrix (convert, in_tmplines[k]);
-      }
-    }
-
-    start = 0;
-    while (out_lines >= down_n_lines) {
-      if (convert->downsample) {
-        GST_DEBUG ("doing downsample %u", start);
-        gst_video_chroma_resample (convert->downsample,
-            &out_tmplines[start], width);
-      }
-
-      for (j = 0; j < down_n_lines; j += lines) {
-        idx = down_offset + j;
-
-        if (idx < height) {
-          GST_DEBUG ("packing line %d %d %d", j + start, down_offset, idx);
-          /* FIXME, not correct if lines > 1 */
-          PACK_FRAME (dest, out_tmplines[j + start], idx, width);
-        }
-      }
-      down_offset += down_n_lines;
-      start += down_n_lines;
-      out_lines -= down_n_lines;
-    }
-    /* we didn't process these lines, move them up for the next round */
-    for (j = 0; j < out_lines; j++) {
-      GST_DEBUG ("move line %d->%d", j + start, j);
-      out_tmplines[j] = out_tmplines[j + start];
-    }
-
-    up_offset += up_n_lines;
-  }
-  if ((pal =
-          gst_video_format_get_palette (GST_VIDEO_FRAME_FORMAT (dest),
-              &palsize))) {
-    memcpy (GST_VIDEO_FRAME_PLANE_DATA (dest, 1), pal, palsize);
-  }
-}
-
-#define FRAME_GET_PLANE_STRIDE(frame, plane) \
-  GST_VIDEO_FRAME_PLANE_STRIDE (frame, plane)
-#define FRAME_GET_PLANE_LINE(frame, plane, line) \
-  (gpointer)(((guint8*)(GST_VIDEO_FRAME_PLANE_DATA (frame, plane))) + \
-      FRAME_GET_PLANE_STRIDE (frame, plane) * (line))
-
-#define FRAME_GET_COMP_STRIDE(frame, comp) \
-  GST_VIDEO_FRAME_COMP_STRIDE (frame, comp)
-#define FRAME_GET_COMP_LINE(frame, comp, line) \
-  (gpointer)(((guint8*)(GST_VIDEO_FRAME_COMP_DATA (frame, comp))) + \
-      FRAME_GET_COMP_STRIDE (frame, comp) * (line))
-
-#define FRAME_GET_STRIDE(frame)      FRAME_GET_PLANE_STRIDE (frame, 0)
-#define FRAME_GET_LINE(frame,line)   FRAME_GET_PLANE_LINE (frame, 0, line)
-
-#define FRAME_GET_Y_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_Y, line)
-#define FRAME_GET_U_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_U, line)
-#define FRAME_GET_V_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_V, line)
-#define FRAME_GET_A_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_A, line)
-
-#define FRAME_GET_Y_STRIDE(frame)    FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_Y)
-#define FRAME_GET_U_STRIDE(frame)    FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_U)
-#define FRAME_GET_V_STRIDE(frame)    FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_V)
-#define FRAME_GET_A_STRIDE(frame)    FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_A)
-
-/* Fast paths */
-
-#define GET_LINE_OFFSETS(interlaced,line,l1,l2) \
-    if (interlaced) {                           \
-      l1 = (line & 2 ? line - 1 : line);        \
-      l2 = l1 + 2;                              \
-    } else {                                    \
-      l1 = line;                                \
-      l2 = l1 + 1;                              \
-    }
-
-
-static void
-convert_I420_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  int i;
-  gint width = convert->width;
-  gint height = convert->height;
-  gboolean interlaced = GST_VIDEO_FRAME_IS_INTERLACED (src);
-  gint l1, l2;
-
-  for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
-    GET_LINE_OFFSETS (interlaced, i, l1, l2);
-
-    bad_video_convert_orc_convert_I420_YUY2 (FRAME_GET_LINE (dest, l1),
-        FRAME_GET_LINE (dest, l2),
-        FRAME_GET_Y_LINE (src, l1),
-        FRAME_GET_Y_LINE (src, l2),
-        FRAME_GET_U_LINE (src, i >> 1),
-        FRAME_GET_V_LINE (src, i >> 1), (width + 1) / 2);
-  }
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_I420_UYVY (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  int i;
-  gint width = convert->width;
-  gint height = convert->height;
-  gboolean interlaced = GST_VIDEO_FRAME_IS_INTERLACED (src);
-  gint l1, l2;
-
-  for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
-    GET_LINE_OFFSETS (interlaced, i, l1, l2);
-
-    bad_video_convert_orc_convert_I420_UYVY (FRAME_GET_LINE (dest, l1),
-        FRAME_GET_LINE (dest, l2),
-        FRAME_GET_Y_LINE (src, l1),
-        FRAME_GET_Y_LINE (src, l2),
-        FRAME_GET_U_LINE (src, i >> 1),
-        FRAME_GET_V_LINE (src, i >> 1), (width + 1) / 2);
-  }
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_I420_AYUV (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  int i;
-  gint width = convert->width;
-  gint height = convert->height;
-  gboolean interlaced = GST_VIDEO_FRAME_IS_INTERLACED (src);
-  gint l1, l2;
-
-  for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
-    GET_LINE_OFFSETS (interlaced, i, l1, l2);
-
-    bad_video_convert_orc_convert_I420_AYUV (FRAME_GET_LINE (dest, l1),
-        FRAME_GET_LINE (dest, l2),
-        FRAME_GET_Y_LINE (src, l1),
-        FRAME_GET_Y_LINE (src, l2),
-        FRAME_GET_U_LINE (src, i >> 1), FRAME_GET_V_LINE (src, i >> 1), width);
-  }
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_I420_Y42B (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), width, height);
-
-  bad_video_convert_orc_planar_chroma_420_422 (FRAME_GET_U_LINE (dest, 0),
-      2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1),
-      2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
-
-  bad_video_convert_orc_planar_chroma_420_422 (FRAME_GET_V_LINE (dest, 0),
-      2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1),
-      2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
-}
-
-static void
-convert_I420_Y444 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), width, height);
-
-  bad_video_convert_orc_planar_chroma_420_444 (FRAME_GET_U_LINE (dest, 0),
-      2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1),
-      2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
-
-  bad_video_convert_orc_planar_chroma_420_444 (FRAME_GET_V_LINE (dest, 0),
-      2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1),
-      2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_YUY2_I420 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  int i;
-  gint width = convert->width;
-  gint height = convert->height;
-  gboolean interlaced = GST_VIDEO_FRAME_IS_INTERLACED (src);
-  gint l1, l2;
-
-  for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
-    GET_LINE_OFFSETS (interlaced, i, l1, l2);
-
-    bad_video_convert_orc_convert_YUY2_I420 (FRAME_GET_Y_LINE (dest, l1),
-        FRAME_GET_Y_LINE (dest, l2),
-        FRAME_GET_U_LINE (dest, i >> 1),
-        FRAME_GET_V_LINE (dest, i >> 1),
-        FRAME_GET_LINE (src, l1), FRAME_GET_LINE (src, l2), (width + 1) / 2);
-  }
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_YUY2_AYUV (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_YUY2_AYUV (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_YUY2_Y42B (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_YUY2_Y42B (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_YUY2_Y444 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_YUY2_Y444 (FRAME_GET_COMP_LINE (dest, 0, 0),
-      FRAME_GET_COMP_STRIDE (dest, 0), FRAME_GET_COMP_LINE (dest, 1, 0),
-      FRAME_GET_COMP_STRIDE (dest, 1), FRAME_GET_COMP_LINE (dest, 2, 0),
-      FRAME_GET_COMP_STRIDE (dest, 2), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), (width + 1) / 2, height);
-}
-
-
-static void
-convert_UYVY_I420 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  int i;
-  gint width = convert->width;
-  gint height = convert->height;
-  gboolean interlaced = GST_VIDEO_FRAME_IS_INTERLACED (src);
-  gint l1, l2;
-
-  for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
-    GET_LINE_OFFSETS (interlaced, i, l1, l2);
-
-    bad_video_convert_orc_convert_UYVY_I420 (FRAME_GET_COMP_LINE (dest, 0, l1),
-        FRAME_GET_COMP_LINE (dest, 0, l2),
-        FRAME_GET_COMP_LINE (dest, 1, i >> 1),
-        FRAME_GET_COMP_LINE (dest, 2, i >> 1),
-        FRAME_GET_LINE (src, l1), FRAME_GET_LINE (src, l2), (width + 1) / 2);
-  }
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_UYVY_AYUV (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_UYVY_AYUV (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_UYVY_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_UYVY_YUY2 (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_UYVY_Y42B (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_UYVY_Y42B (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_UYVY_Y444 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_UYVY_Y444 (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_AYUV_I420 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  /* only for even width/height */
-  bad_video_convert_orc_convert_AYUV_I420 (FRAME_GET_Y_LINE (dest, 0),
-      2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (dest, 1),
-      2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      2 * FRAME_GET_STRIDE (src), FRAME_GET_LINE (src, 1),
-      2 * FRAME_GET_STRIDE (src), width / 2, height / 2);
-}
-
-static void
-convert_AYUV_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  /* only for even width */
-  bad_video_convert_orc_convert_AYUV_YUY2 (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), width / 2, height);
-}
-
-static void
-convert_AYUV_UYVY (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  /* only for even width */
-  bad_video_convert_orc_convert_AYUV_UYVY (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), width / 2, height);
-}
-
-static void
-convert_AYUV_Y42B (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  /* only works for even width */
-  bad_video_convert_orc_convert_AYUV_Y42B (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), width / 2, height);
-}
-
-static void
-convert_AYUV_Y444 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_AYUV_Y444 (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), width, height);
-}
-
-static void
-convert_Y42B_I420 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), width, height);
-
-  bad_video_convert_orc_planar_chroma_422_420 (FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
-      2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1),
-      2 * FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
-
-  bad_video_convert_orc_planar_chroma_422_420 (FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
-      2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1),
-      2 * FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_Y42B_Y444 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), width, height);
-
-  bad_video_convert_orc_planar_chroma_422_444 (FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), (width + 1) / 2, height);
-
-  bad_video_convert_orc_planar_chroma_422_444 (FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_Y42B_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_Y42B_YUY2 (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_Y42B_UYVY (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_Y42B_UYVY (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
-}
-
-static void
-convert_Y42B_AYUV (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  /* only for even width */
-  bad_video_convert_orc_convert_Y42B_AYUV (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), width / 2, height);
-}
-
-static void
-convert_Y444_I420 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), width, height);
-
-  bad_video_convert_orc_planar_chroma_444_420 (FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
-      2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1),
-      2 * FRAME_GET_U_STRIDE (src), width / 2, height / 2);
-
-  bad_video_convert_orc_planar_chroma_444_420 (FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
-      2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1),
-      2 * FRAME_GET_V_STRIDE (src), width / 2, height / 2);
-
-  /* now handle last line */
-  if (height & 1) {
-    UNPACK_FRAME (src, convert->tmplines[0], height - 1, width);
-    PACK_FRAME (dest, convert->tmplines[0], height - 1, width);
-  }
-}
-
-static void
-convert_Y444_Y42B (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0),
-      FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), width, height);
-
-  bad_video_convert_orc_planar_chroma_444_422 (FRAME_GET_U_LINE (dest, 0),
-      FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), width / 2, height);
-
-  bad_video_convert_orc_planar_chroma_444_422 (FRAME_GET_V_LINE (dest, 0),
-      FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), width / 2, height);
-}
-
-static void
-convert_Y444_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_Y444_YUY2 (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), width / 2, height);
-}
-
-static void
-convert_Y444_UYVY (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_Y444_UYVY (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), width / 2, height);
-}
-
-static void
-convert_Y444_AYUV (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_Y444_AYUV (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
-      FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
-      FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
-      FRAME_GET_V_STRIDE (src), width, height);
-}
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-static void
-convert_AYUV_ARGB (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_AYUV_ARGB (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
-      convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
-      width, height);
-}
-
-static void
-convert_AYUV_BGRA (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_AYUV_BGRA (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
-      convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
-      width, height);
-}
-
-static void
-convert_AYUV_ABGR (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_AYUV_ABGR (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
-      convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
-      width, height);
-}
-
-static void
-convert_AYUV_RGBA (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  gint width = convert->width;
-  gint height = convert->height;
-
-  bad_video_convert_orc_convert_AYUV_RGBA (FRAME_GET_LINE (dest, 0),
-      FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
-      FRAME_GET_STRIDE (src), convert->cmatrix[0][0], convert->cmatrix[0][2],
-      convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
-      width, height);
-}
-
-static void
-convert_I420_BGRA (VideoConvert * convert, GstVideoFrame * dest,
-    const GstVideoFrame * src)
-{
-  int i;
-  gint width = convert->width;
-  gint height = convert->height;
-
-  for (i = 0; i < height; i++) {
-    bad_video_convert_orc_convert_I420_BGRA (FRAME_GET_LINE (dest, i),
-        FRAME_GET_Y_LINE (src, i),
-        FRAME_GET_U_LINE (src, i >> 1), FRAME_GET_V_LINE (src, i >> 1),
-        convert->cmatrix[0][0], convert->cmatrix[0][2],
-        convert->cmatrix[2][1], convert->cmatrix[1][1], convert->cmatrix[1][2],
-        width);
-  }
-}
-#endif
-
-
-
-/* Fast paths */
-
-typedef struct
-{
-  GstVideoFormat in_format;
-  GstVideoColorMatrix in_matrix;
-  GstVideoFormat out_format;
-  GstVideoColorMatrix out_matrix;
-  gboolean keeps_bad_color_matrix;
-  gboolean keeps_interlaced;
-  gboolean needs_bad_color_matrix;
-  gint width_align, height_align;
-  void (*convert) (VideoConvert * convert, GstVideoFrame * dest,
-      const GstVideoFrame * src);
-} VideoTransform;
-
-static const VideoTransform transforms[] = {
-  {GST_VIDEO_FORMAT_I420, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YUY2,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_I420_YUY2},
-  {GST_VIDEO_FORMAT_I420, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_UYVY,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_I420_UYVY},
-  {GST_VIDEO_FORMAT_I420, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_AYUV,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_I420_AYUV},
-  {GST_VIDEO_FORMAT_I420, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y42B,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 0, 0,
-      convert_I420_Y42B},
-  {GST_VIDEO_FORMAT_I420, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y444,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 0, 0,
-      convert_I420_Y444},
-
-  {GST_VIDEO_FORMAT_YV12, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YUY2,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_I420_YUY2},
-  {GST_VIDEO_FORMAT_YV12, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_UYVY,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_I420_UYVY},
-  {GST_VIDEO_FORMAT_YV12, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_AYUV,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_I420_AYUV},
-  {GST_VIDEO_FORMAT_YV12, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y42B,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 0, 0,
-      convert_I420_Y42B},
-  {GST_VIDEO_FORMAT_YV12, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y444,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 0, 0,
-      convert_I420_Y444},
-
-  {GST_VIDEO_FORMAT_YUY2, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_I420,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_YUY2_I420},
-  {GST_VIDEO_FORMAT_YUY2, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YV12,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_YUY2_I420},
-  {GST_VIDEO_FORMAT_YUY2, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_UYVY,
-      GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0, convert_UYVY_YUY2},      /* alias */
-  {GST_VIDEO_FORMAT_YUY2, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_AYUV,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_YUY2_AYUV},
-  {GST_VIDEO_FORMAT_YUY2, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y42B,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_YUY2_Y42B},
-  {GST_VIDEO_FORMAT_YUY2, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y444,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_YUY2_Y444},
-
-  {GST_VIDEO_FORMAT_UYVY, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_I420,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_UYVY_I420},
-  {GST_VIDEO_FORMAT_UYVY, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YV12,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_UYVY_I420},
-  {GST_VIDEO_FORMAT_UYVY, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YUY2,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_UYVY_YUY2},
-  {GST_VIDEO_FORMAT_UYVY, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_AYUV,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_UYVY_AYUV},
-  {GST_VIDEO_FORMAT_UYVY, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y42B,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_UYVY_Y42B},
-  {GST_VIDEO_FORMAT_UYVY, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y444,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_UYVY_Y444},
-
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_I420,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 1, 1,
-      convert_AYUV_I420},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YV12,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 1, 1,
-      convert_AYUV_I420},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YUY2,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 1, 0,
-      convert_AYUV_YUY2},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_UYVY,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 1, 0,
-      convert_AYUV_UYVY},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y42B,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 1, 0,
-      convert_AYUV_Y42B},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y444,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_AYUV_Y444},
-
-  {GST_VIDEO_FORMAT_Y42B, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_I420,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 0, 0,
-      convert_Y42B_I420},
-  {GST_VIDEO_FORMAT_Y42B, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YV12,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 0, 0,
-      convert_Y42B_I420},
-  {GST_VIDEO_FORMAT_Y42B, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YUY2,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_Y42B_YUY2},
-  {GST_VIDEO_FORMAT_Y42B, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_UYVY,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_Y42B_UYVY},
-  {GST_VIDEO_FORMAT_Y42B, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_AYUV,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 1, 0,
-      convert_Y42B_AYUV},
-  {GST_VIDEO_FORMAT_Y42B, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y444,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_Y42B_Y444},
-
-  {GST_VIDEO_FORMAT_Y444, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_I420,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 1, 0,
-      convert_Y444_I420},
-  {GST_VIDEO_FORMAT_Y444, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YV12,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, FALSE, 1, 0,
-      convert_Y444_I420},
-  {GST_VIDEO_FORMAT_Y444, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_YUY2,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 1, 0,
-      convert_Y444_YUY2},
-  {GST_VIDEO_FORMAT_Y444, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_UYVY,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 1, 0,
-      convert_Y444_UYVY},
-  {GST_VIDEO_FORMAT_Y444, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_AYUV,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 0, 0,
-      convert_Y444_AYUV},
-  {GST_VIDEO_FORMAT_Y444, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_Y42B,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, FALSE, 1, 0,
-      convert_Y444_Y42B},
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_ARGB,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0,
-      convert_AYUV_ARGB},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_BGRA,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0,
-      convert_AYUV_BGRA},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_xRGB,
-      GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0, convert_AYUV_ARGB},       /* alias */
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_BGRx,
-      GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0, convert_AYUV_BGRA},       /* alias */
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_ABGR,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0,
-      convert_AYUV_ABGR},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_RGBA,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0,
-      convert_AYUV_RGBA},
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_xBGR,
-      GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0, convert_AYUV_ABGR},       /* alias */
-  {GST_VIDEO_FORMAT_AYUV, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_RGBx,
-      GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, TRUE, TRUE, 0, 0, convert_AYUV_RGBA},       /* alias */
-
-  {GST_VIDEO_FORMAT_I420, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_BGRA,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, TRUE, 0, 0,
-      convert_I420_BGRA},
-  {GST_VIDEO_FORMAT_I420, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_BGRx,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, TRUE, 0, 0,
-      convert_I420_BGRA},
-  {GST_VIDEO_FORMAT_YV12, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_BGRA,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, TRUE, 0, 0,
-      convert_I420_BGRA},
-  {GST_VIDEO_FORMAT_YV12, GST_VIDEO_COLOR_MATRIX_UNKNOWN, GST_VIDEO_FORMAT_BGRx,
-        GST_VIDEO_COLOR_MATRIX_UNKNOWN, TRUE, FALSE, TRUE, 0, 0,
-      convert_I420_BGRA},
-#endif
-};
-
-static gboolean
-videoconvert_convert_lookup_fastpath (VideoConvert * convert)
-{
-  int i;
-  GstVideoFormat in_format, out_format;
-  GstVideoColorMatrix in_matrix, out_matrix;
-  gboolean interlaced;
-  gint width, height;
-
-  in_format = GST_VIDEO_INFO_FORMAT (&convert->in_info);
-  out_format = GST_VIDEO_INFO_FORMAT (&convert->out_info);
-
-  width = GST_VIDEO_INFO_WIDTH (&convert->in_info);
-  height = GST_VIDEO_INFO_HEIGHT (&convert->in_info);
-
-  in_matrix = convert->in_info.colorimetry.matrix;
-  out_matrix = convert->out_info.colorimetry.matrix;
-
-  interlaced = GST_VIDEO_INFO_IS_INTERLACED (&convert->in_info);
-  interlaced |= GST_VIDEO_INFO_IS_INTERLACED (&convert->out_info);
-
-  for (i = 0; i < sizeof (transforms) / sizeof (transforms[0]); i++) {
-    if (transforms[i].in_format == in_format &&
-        transforms[i].out_format == out_format &&
-        (transforms[i].keeps_bad_color_matrix ||
-            (transforms[i].in_matrix == in_matrix &&
-                transforms[i].out_matrix == out_matrix)) &&
-        (transforms[i].keeps_interlaced || !interlaced) &&
-        (transforms[i].width_align & width) == 0 &&
-        (transforms[i].height_align & height) == 0) {
-      GST_DEBUG ("using fastpath");
-      if (transforms[i].needs_bad_color_matrix)
-        if (!videoconvert_convert_compute_matrix (convert))
-          goto no_convert;
-      convert->convert = transforms[i].convert;
-      alloc_tmplines (convert, 1, GST_VIDEO_INFO_WIDTH (&convert->in_info));
-      return TRUE;
-    }
-  }
-  GST_DEBUG ("no fastpath found");
-  return FALSE;
-
-no_convert:
-  {
-    GST_DEBUG ("can't create matrix");
-    return FALSE;
-  }
-}
diff --git a/gst-libs/gst/video/videoconvert.h b/gst-libs/gst/video/videoconvert.h
deleted file mode 100644
index 48eda2a..0000000
--- a/gst-libs/gst/video/videoconvert.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __COLORSPACE_H__
-#define __COLORSPACE_H__
-
-typedef struct _VideoConvert VideoConvert;
-
-#include <gst/video/video.h>
-#include "gstcms.h"
-
-G_BEGIN_DECLS
-
-typedef enum {
-  DITHER_NONE,
-  DITHER_VERTERR,
-  DITHER_HALFTONE
-} ColorSpaceDitherMethod;
-
-struct _VideoConvert {
-  GstVideoInfo in_info;
-  GstVideoInfo out_info;
-
-  gint width;
-  gint height;
-
-  gint in_bits;
-  gint out_bits;
-  gint cmatrix[4][4];
-
-  ColorSpaceDitherMethod dither;
-
-  guint lines;
-
-  guint n_tmplines;
-  gpointer *tmplines;
-  guint16 *errline;
-
-  GstVideoChromaResample *upsample;
-  guint up_n_lines;
-  gint up_offset;
-  GstVideoChromaResample *downsample;
-  guint down_n_lines;
-  gint down_offset;
-
-  void (*convert)      (VideoConvert *convert, GstVideoFrame *dest, const GstVideoFrame *src);
-  void (*matrix)       (VideoConvert *convert, gpointer pixels);
-  void (*dither16)     (VideoConvert *convert, guint16 * pixels, int j);
-
-};
-
-VideoConvert *   badvideoconvert_convert_new            (GstVideoInfo *in_info,
-                                                      GstVideoInfo *out_info);
-void             badvideoconvert_convert_free           (VideoConvert * convert);
-
-void             badvideoconvert_convert_set_dither     (VideoConvert * convert, int type);
-
-void             badvideoconvert_convert_convert        (VideoConvert * convert,
-                                                      GstVideoFrame *dest, const GstVideoFrame *src);
-
-
-G_END_DECLS
-
-#endif /* __GST_COLORSPACE_H__ */
diff --git a/gst-libs/gst/wayland/Makefile.in b/gst-libs/gst/wayland/Makefile.in
index adee5e2..b6c3efb 100644
--- a/gst-libs/gst/wayland/Makefile.in
+++ b/gst-libs/gst/wayland/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst-plugins-bad.doap b/gst-plugins-bad.doap
index a764e61..75af4f3 100644
--- a/gst-plugins-bad.doap
+++ b/gst-plugins-bad.doap
@@ -35,56 +35,6 @@
 
  <release>
   <Version>
-   <revision>1.4.5</revision>
-   <branch>1.4</branch>
-   <name></name>
-   <created>2014-12-18</created>
-   <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.4.5.tar.xz" />
-  </Version>
- </release>
-
- <release>
-  <Version>
-   <revision>1.4.4</revision>
-   <branch>1.4</branch>
-   <name></name>
-   <created>2014-11-06</created>
-   <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.4.4.tar.xz" />
-  </Version>
- </release>
-
- <release>
-  <Version>
-   <revision>1.4.3</revision>
-   <branch>1.4</branch>
-   <name></name>
-   <created>2014-09-24</created>
-   <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.4.3.tar.xz" />
-  </Version>
- </release>
-
- <release>
-  <Version>
-   <revision>1.4.2</revision>
-   <branch>1.4</branch>
-   <name></name>
-   <created>2014-09-19</created>
-   <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.4.2.tar.xz" />
-  </Version>
- </release>
-
- <release>
-  <Version>
-   <revision>1.4.1</revision>
-   <branch>1.4</branch>
-   <name></name>
-   <created>2014-08-27</created>
-   <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.4.1.tar.xz" />
-  </Version>
- </release>
-
- <release>
-  <Version>
    <revision>1.4.0</revision>
    <branch>1.4</branch>
    <name></name>
diff --git a/gst-plugins-bad.spec b/gst-plugins-bad.spec
index fd27f20..9d57408 100644
--- a/gst-plugins-bad.spec
+++ b/gst-plugins-bad.spec
@@ -6,8 +6,8 @@
 
 Summary: GStreamer streaming media framework "bad" plug-ins
 Name: %{gstreamer}-plugins-bad
-Version: 1.4.5
-Release: 1.gst
+Version: 1.5.0.1
+Release: 0.20150316.190059.gst
 # The freeze and nfs plugins are LGPLv2 (only)
 License: LGPLv2+ and LGPLv2
 Group: Applications/Multimedia
@@ -31,6 +31,7 @@
 %ifnarch s390 s390x
 BuildRequires: libdc1394-devel
 %endif
+BuildRequires: libde265-devel
 BuildRequires: libdvdnav-devel
 BuildRequires: libexif-devel
 BuildRequires: libiptcdata-devel
@@ -102,7 +103,7 @@
 tested well enough, or the code is not of good enough quality.
 
 This package (gstreamer-plugins-bad-extras) contains extra "bad" plugins for
-sources (mythtv), sinks (jack) and effects (pitch) which are not used
+sources, sinks (jack) and effects (pitch) which are not used
 very much and require additional libraries to be installed.
 
 
@@ -266,6 +267,7 @@
 # %{_libdir}/gstreamer-%{majorminor}/libgstgsm.so
 %{_libdir}/gstreamer-%{majorminor}/libgstkate.so
 %{_libdir}/gstreamer-%{majorminor}/libgstladspa.so
+%{_libdir}/gstreamer-%{majorminor}/libgstlibde265.so
 %{_libdir}/gstreamer-%{majorminor}/libgstmodplug.so
 %{_libdir}/gstreamer-%{majorminor}/libgstofa.so
 %{_libdir}/gstreamer-%{majorminor}/libgstresindvd.so
@@ -301,7 +303,6 @@
 %defattr(-,root,root,-)
 # Plugins with external dependencies
 # %{_libdir}/gstreamer-%{majorminor}/libgstjack.so
-# %{_libdir}/gstreamer-%{majorminor}/libgstmythtvsrc.so
 # %{_libdir}/gstreamer-%{majorminor}/libgstsdl.so
 # %{_libdir}/gstreamer-%{majorminor}/libgstsoundtouch.so
 # %{_libdir}/gstreamer-%{majorminor}/libgsttimidity.so
diff --git a/gst-plugins-bad.spec.in b/gst-plugins-bad.spec.in
index c011bec..907c632 100644
--- a/gst-plugins-bad.spec.in
+++ b/gst-plugins-bad.spec.in
@@ -31,6 +31,7 @@
 %ifnarch s390 s390x
 BuildRequires: libdc1394-devel
 %endif
+BuildRequires: libde265-devel
 BuildRequires: libdvdnav-devel
 BuildRequires: libexif-devel
 BuildRequires: libiptcdata-devel
@@ -102,7 +103,7 @@
 tested well enough, or the code is not of good enough quality.
 
 This package (gstreamer-plugins-bad-extras) contains extra "bad" plugins for
-sources (mythtv), sinks (jack) and effects (pitch) which are not used
+sources, sinks (jack) and effects (pitch) which are not used
 very much and require additional libraries to be installed.
 
 
@@ -266,6 +267,7 @@
 # %{_libdir}/gstreamer-%{majorminor}/libgstgsm.so
 %{_libdir}/gstreamer-%{majorminor}/libgstkate.so
 %{_libdir}/gstreamer-%{majorminor}/libgstladspa.so
+%{_libdir}/gstreamer-%{majorminor}/libgstlibde265.so
 %{_libdir}/gstreamer-%{majorminor}/libgstmodplug.so
 %{_libdir}/gstreamer-%{majorminor}/libgstofa.so
 %{_libdir}/gstreamer-%{majorminor}/libgstresindvd.so
@@ -301,7 +303,6 @@
 %defattr(-,root,root,-)
 # Plugins with external dependencies
 # %{_libdir}/gstreamer-%{majorminor}/libgstjack.so
-# %{_libdir}/gstreamer-%{majorminor}/libgstmythtvsrc.so
 # %{_libdir}/gstreamer-%{majorminor}/libgstsdl.so
 # %{_libdir}/gstreamer-%{majorminor}/libgstsoundtouch.so
 # %{_libdir}/gstreamer-%{majorminor}/libgsttimidity.so
diff --git a/gst/Makefile.in b/gst/Makefile.in
index 9c5b671..f52fc1b 100644
--- a/gst/Makefile.in
+++ b/gst/Makefile.in
@@ -93,6 +93,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -106,7 +107,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -223,8 +223,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -263,7 +267,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -271,6 +274,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -320,8 +325,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -400,7 +403,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -409,7 +411,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -422,7 +423,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -447,6 +447,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -520,10 +522,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -549,6 +555,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -585,6 +594,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -625,17 +635,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -652,6 +661,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/accurip/Makefile.in b/gst/accurip/Makefile.in
index a35c907..f4677e8 100644
--- a/gst/accurip/Makefile.in
+++ b/gst/accurip/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/adpcmdec/Makefile.in b/gst/adpcmdec/Makefile.in
index 0ffbfbe..00ccfee 100644
--- a/gst/adpcmdec/Makefile.in
+++ b/gst/adpcmdec/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -242,8 +242,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -282,7 +286,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -290,6 +293,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -339,8 +344,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -419,7 +422,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -428,7 +430,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -441,7 +442,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -466,6 +466,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -539,10 +541,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -568,6 +574,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -604,6 +613,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -644,17 +654,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -671,6 +680,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/adpcmenc/Makefile.in b/gst/adpcmenc/Makefile.in
index 2161620..c80443a 100644
--- a/gst/adpcmenc/Makefile.in
+++ b/gst/adpcmenc/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -242,8 +242,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -282,7 +286,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -290,6 +293,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -339,8 +344,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -419,7 +422,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -428,7 +430,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -441,7 +442,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -466,6 +466,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -539,10 +541,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -568,6 +574,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -604,6 +613,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -644,17 +654,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -671,6 +680,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/adpcmenc/adpcmenc.c b/gst/adpcmenc/adpcmenc.c
index 9e5085d..7a8faab 100644
--- a/gst/adpcmenc/adpcmenc.c
+++ b/gst/adpcmenc/adpcmenc.c
@@ -57,7 +57,7 @@
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS ("audio/x-adpcm, "
-        " layout=(string){dvi}, "
+        " layout=(string)dvi, "
         " block_align = (int) [64, 8192], "
         " rate = (int)[ 1, MAX ], " "channels = (int)[1,2];")
     );
@@ -100,7 +100,7 @@
   static GType adpcmenc_layout_type = 0;
 
   if (!adpcmenc_layout_type) {
-    static GEnumValue layout_types[] = {
+    static const GEnumValue layout_types[] = {
       {LAYOUT_ADPCM_DVI, "DVI/IMA APDCM", "dvi"},
       {0, NULL, NULL},
     };
diff --git a/gst/aiff/Makefile.in b/gst/aiff/Makefile.in
index 42a8a2e..a123f54 100644
--- a/gst/aiff/Makefile.in
+++ b/gst/aiff/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/aiff/aiffmux.c b/gst/aiff/aiffmux.c
index 5938884..5d5fded 100644
--- a/gst/aiff/aiffmux.c
+++ b/gst/aiff/aiffmux.c
@@ -132,12 +132,19 @@
 gst_aiff_mux_write_form_header (GstAiffMux * aiffmux, guint32 audio_data_size,
     GstByteWriter * writer)
 {
+  guint64 cur_size;
+
   /* ckID == 'FORM' */
   gst_byte_writer_put_uint32_le_unchecked (writer,
       GST_MAKE_FOURCC ('F', 'O', 'R', 'M'));
-  /* ckSize is currently bogus but we'll know what it is later */
-  gst_byte_writer_put_uint32_be_unchecked (writer,
-      audio_data_size + AIFF_HEADER_LEN - 8);
+
+  /* AIFF chunks must be even aligned */
+  cur_size = AIFF_HEADER_LEN - 8 + audio_data_size;
+  if ((cur_size & 1) && cur_size + 1 < G_MAXUINT32) {
+    cur_size += 1;
+  }
+
+  gst_byte_writer_put_uint32_be_unchecked (writer, cur_size);
   /* formType == 'AIFF' */
   gst_byte_writer_put_uint32_le_unchecked (writer,
       GST_MAKE_FOURCC ('A', 'I', 'F', 'F'));
@@ -242,7 +249,7 @@
 {
   GstFlowReturn ret;
   GstBuffer *outbuf;
-  GstByteWriter *writer;
+  GstByteWriter writer;
   GstSegment seg;
 
   /* seek to beginning of file */
@@ -258,13 +265,13 @@
   GST_DEBUG_OBJECT (aiffmux, "writing header with datasize=%u",
       audio_data_size);
 
-  writer = gst_byte_writer_new_with_size (AIFF_HEADER_LEN, TRUE);
+  gst_byte_writer_init_with_size (&writer, AIFF_HEADER_LEN, TRUE);
 
-  gst_aiff_mux_write_form_header (aiffmux, audio_data_size, writer);
-  gst_aiff_mux_write_comm_header (aiffmux, audio_data_size, writer);
-  gst_aiff_mux_write_ssnd_header (aiffmux, audio_data_size, writer);
+  gst_aiff_mux_write_form_header (aiffmux, audio_data_size, &writer);
+  gst_aiff_mux_write_comm_header (aiffmux, audio_data_size, &writer);
+  gst_aiff_mux_write_ssnd_header (aiffmux, audio_data_size, &writer);
 
-  outbuf = gst_byte_writer_free_and_get_buffer (writer);
+  outbuf = gst_byte_writer_reset_and_get_buffer (&writer);
 
   ret = gst_pad_push (aiffmux->srcpad, outbuf);
 
@@ -395,8 +402,25 @@
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_EOS:{
+      guint64 cur_size;
       GST_DEBUG_OBJECT (aiffmux, "got EOS");
 
+      cur_size = aiffmux->length + AIFF_HEADER_LEN - 8;
+
+      /* ID3 chunk must be even aligned */
+      if ((aiffmux->length & 1) && cur_size + 1 < G_MAXUINT32) {
+        GstFlowReturn ret;
+        guint8 *data = g_new0 (guint8, 1);
+        GstBuffer *buffer = gst_buffer_new_wrapped (data, 1);
+        GST_BUFFER_OFFSET (buffer) = AIFF_HEADER_LEN + aiffmux->length;
+        GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
+        ret = gst_pad_push (aiffmux->srcpad, buffer);
+        if (ret != GST_FLOW_OK) {
+          GST_WARNING_OBJECT (aiffmux, "failed to push padding byte: %s",
+              gst_flow_get_name (ret));
+        }
+      }
+
       /* write header with correct length values */
       gst_aiff_mux_push_header (aiffmux, aiffmux->length);
 
diff --git a/gst/aiff/aiffparse.c b/gst/aiff/aiffparse.c
index 6d77e7c..78854ae 100644
--- a/gst/aiff/aiffparse.c
+++ b/gst/aiff/aiffparse.c
@@ -53,10 +53,6 @@
 #include "config.h"
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include <string.h>
 #include <math.h>
 
@@ -1822,15 +1818,13 @@
         }
         if (stop > 0) {
           end_offset = stop;
-          segment.stop -= aiff->datastart;
-          segment.stop = MAX (stop, 0);
+          stop -= aiff->datastart;
+          stop = MAX (stop, 0);
         }
         if (aiff->state == AIFF_PARSE_DATA &&
             aiff->segment.format == GST_FORMAT_TIME) {
-          guint64 bps = aiff->bps;
-
           /* operating in format TIME, so we can convert */
-          if (bps) {
+          if (aiff->bps) {
             if (start >= 0)
               start =
                   gst_util_uint64_scale_ceil (start, GST_SECOND,
diff --git a/gst/asfmux/Makefile.in b/gst/asfmux/Makefile.in
index 7134589..0ff4f01 100644
--- a/gst/asfmux/Makefile.in
+++ b/gst/asfmux/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -249,8 +249,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -289,7 +293,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -297,6 +300,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -346,8 +351,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -426,7 +429,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -435,7 +437,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -448,7 +449,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -473,6 +473,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -546,10 +548,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -575,6 +581,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -611,6 +620,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -651,17 +661,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -678,6 +687,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/asfmux/gstasfmux.c b/gst/asfmux/gstasfmux.c
index 791193e..8bcf0a0 100644
--- a/gst/asfmux/gstasfmux.c
+++ b/gst/asfmux/gstasfmux.c
@@ -708,11 +708,7 @@
   else
     gst_asf_put_guid (*buf + 24, guids[ASF_VIDEO_MEDIA_INDEX]);
   /* error correction */
-  if (asfpad->is_audio) {
-    gst_asf_put_guid (*buf + 40, guids[ASF_NO_ERROR_CORRECTION_INDEX]);
-  } else {
-    gst_asf_put_guid (*buf + 40, guids[ASF_NO_ERROR_CORRECTION_INDEX]);
-  }
+  gst_asf_put_guid (*buf + 40, guids[ASF_NO_ERROR_CORRECTION_INDEX]);
   GST_WRITE_UINT64_LE (*buf + 56, 0);   /* time offset */
 
   GST_WRITE_UINT32_LE (*buf + 64, codec_data_length + media_specific_data_length);      /* type specific data length */
diff --git a/gst/asfmux/gstasfobjects.c b/gst/asfmux/gstasfobjects.c
index 0719f5c..c2b1129 100644
--- a/gst/asfmux/gstasfobjects.c
+++ b/gst/asfmux/gstasfobjects.c
@@ -564,7 +564,7 @@
   guint8 mo_number_len_type;
   guint8 mo_offset_type;
 */
-  GstByteReader *reader;
+  GstByteReader reader;
   gboolean ret = TRUE;
   guint8 first = 0;
   guint8 err_length = 0;        /* length of the error fields */
@@ -584,10 +584,10 @@
     return FALSE;
   }
 
-  reader = gst_byte_reader_new (data, size);
+  gst_byte_reader_init (&reader, data, size);
 
   GST_LOG ("Starting packet parsing, size: %" G_GSIZE_FORMAT, size);
-  if (!gst_byte_reader_get_uint8 (reader, &first))
+  if (!gst_byte_reader_get_uint8 (&reader, &first))
     goto error;
 
   if (first & 0x80) {           /* error correction present */
@@ -602,11 +602,11 @@
     err_cor_len = (first & 0x0F);
     err_length += err_cor_len;
     GST_DEBUG ("Error correction data length: %d", (gint) err_cor_len);
-    if (!gst_byte_reader_skip (reader, err_cor_len))
+    if (!gst_byte_reader_skip (&reader, err_cor_len))
       goto error;
 
     /* put payload parsing info first byte in aux var */
-    if (!gst_byte_reader_get_uint8 (reader, &aux))
+    if (!gst_byte_reader_get_uint8 (&reader, &aux))
       goto error;
   } else {
     aux = first;
@@ -626,7 +626,7 @@
     GST_DEBUG ("Packet contains multiple payloads");
   }
 
-  if (!gst_byte_reader_get_uint8 (reader, &aux))
+  if (!gst_byte_reader_get_uint8 (&reader, &aux))
     goto error;
 
 /*
@@ -637,13 +637,13 @@
 
   /* gets the fields lengths */
   GST_LOG ("Getting packet and padding length");
-  if (!gst_byte_reader_get_asf_var_size_field (reader,
+  if (!gst_byte_reader_get_asf_var_size_field (&reader,
           packet_len_type, &packet_len))
     goto error;
-  if (!gst_byte_reader_skip (reader,
+  if (!gst_byte_reader_skip (&reader,
           gst_asf_get_var_size_field_len (seq_len_type)))
     goto error;
-  if (!gst_byte_reader_get_asf_var_size_field (reader,
+  if (!gst_byte_reader_get_asf_var_size_field (&reader,
           padding_len_type, &padd_len))
     goto error;
 
@@ -674,9 +674,9 @@
   }
 
   GST_LOG ("Getting send time and duration");
-  if (!gst_byte_reader_get_uint32_le (reader, &send_time))
+  if (!gst_byte_reader_get_uint32_le (&reader, &send_time))
     goto error;
-  if (!gst_byte_reader_get_uint16_le (reader, &duration))
+  if (!gst_byte_reader_get_uint16_le (&reader, &duration))
     goto error;
 
   has_keyframe = FALSE;
@@ -685,9 +685,9 @@
     has_keyframe = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
   } else {
     if (mult_payloads) {
-      ret = gst_asf_parse_mult_payload (reader, &has_keyframe);
+      ret = gst_asf_parse_mult_payload (&reader, &has_keyframe);
     } else {
-      ret = gst_asf_parse_single_payload (reader, &has_keyframe);
+      ret = gst_asf_parse_single_payload (&reader, &has_keyframe);
     }
   }
 
@@ -712,14 +712,12 @@
   packet->seq_field_type = seq_len_type;
   packet->err_cor_len = err_length;
 
-  gst_byte_reader_free (reader);
   return ret;
 
 error:
   ret = FALSE;
   GST_WARNING ("Error while parsing data packet");
 end:
-  gst_byte_reader_free (reader);
   return ret;
 }
 
@@ -789,7 +787,7 @@
   gboolean ret = TRUE;
   guint32 header_objects = 0;
   guint32 i;
-  GstByteReader *reader;
+  GstByteReader reader;
   guint64 object_size;
 
   object_size = gst_asf_match_and_peek_obj_size (data,
@@ -800,32 +798,33 @@
     return FALSE;
   }
 
-  reader = gst_byte_reader_new (data, size);
+  gst_byte_reader_init (&reader, data, size);
 
-  if (!gst_byte_reader_skip (reader, ASF_GUID_OBJSIZE_SIZE))
+  if (!gst_byte_reader_skip (&reader, ASF_GUID_OBJSIZE_SIZE))
     goto error;
-  if (!gst_byte_reader_get_uint32_le (reader, &header_objects))
+  if (!gst_byte_reader_get_uint32_le (&reader, &header_objects))
     goto error;
   GST_DEBUG ("ASF: Header has %" G_GUINT32_FORMAT " child"
       " objects", header_objects);
   /* skip reserved bytes */
-  if (!gst_byte_reader_skip (reader, 2))
+  if (!gst_byte_reader_skip (&reader, 2))
     goto error;
 
   /* iterate through childs of header object */
   for (i = 0; i < header_objects; i++) {
     const guint8 *guid = NULL;
     guint64 obj_size = 0;
-    if (!gst_byte_reader_get_data (reader, ASF_GUID_SIZE, &guid))
+
+    if (!gst_byte_reader_get_data (&reader, ASF_GUID_SIZE, &guid))
       goto error;
-    if (!gst_byte_reader_get_uint64_le (reader, &obj_size))
+    if (!gst_byte_reader_get_uint64_le (&reader, &obj_size))
       goto error;
 
     if (gst_asf_match_guid (guid, &guids[ASF_FILE_PROPERTIES_OBJECT_INDEX])) {
-      ret = gst_asf_parse_file_properties_obj (reader, file_info);
+      ret = gst_asf_parse_file_properties_obj (&reader, file_info);
     } else {
       /* we don't know/care about this object */
-      if (!gst_byte_reader_skip (reader, obj_size - ASF_GUID_OBJSIZE_SIZE))
+      if (!gst_byte_reader_skip (&reader, obj_size - ASF_GUID_OBJSIZE_SIZE))
         goto error;
     }
 
@@ -838,7 +837,6 @@
   ret = FALSE;
   GST_WARNING ("ASF: Error while parsing headers");
 end:
-  gst_byte_reader_free (reader);
   return ret;
 }
 
diff --git a/gst/asfmux/gstasfparse.c b/gst/asfmux/gstasfparse.c
index fe869e8..c288266 100644
--- a/gst/asfmux/gstasfparse.c
+++ b/gst/asfmux/gstasfparse.c
@@ -75,17 +75,17 @@
 gst_asf_parse_parse_data_object (GstAsfParse * asfparse, guint8 * data,
     gsize size)
 {
-  GstByteReader *reader;
+  GstByteReader reader;
   GstFlowReturn ret = GST_FLOW_OK;
   guint64 packet_count = 0;
 
   GST_DEBUG_OBJECT (asfparse, "Parsing data object");
 
-  reader = gst_byte_reader_new (data, size);
+  gst_byte_reader_init (&reader, data, size);
   /* skip to packet count */
-  if (!gst_byte_reader_skip (reader, 40))
+  if (!gst_byte_reader_skip (&reader, 40))
     goto error;
-  if (!gst_byte_reader_get_uint64_le (reader, &packet_count))
+  if (!gst_byte_reader_get_uint64_le (&reader, &packet_count))
     goto error;
 
   if (asfparse->asfinfo->packets_count != packet_count) {
@@ -97,13 +97,11 @@
         packet_count);
   }
 
-  gst_byte_reader_free (reader);
   return GST_FLOW_OK;
 
 error:
   ret = GST_FLOW_ERROR;
   GST_ERROR_OBJECT (asfparse, "Error while parsing data object headers");
-  gst_byte_reader_free (reader);
   return ret;
 }
 
diff --git a/gst/audiofxbad/Makefile.in b/gst/audiofxbad/Makefile.in
index f18306d..5b8284e 100644
--- a/gst/audiofxbad/Makefile.in
+++ b/gst/audiofxbad/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/audiomixer/Makefile.am b/gst/audiomixer/Makefile.am
index 90328bc..a126f90 100644
--- a/gst/audiomixer/Makefile.am
+++ b/gst/audiomixer/Makefile.am
@@ -4,15 +4,19 @@
 include $(top_srcdir)/common/orc.mak
 
 
-libgstaudiomixer_la_SOURCES = gstaudiomixer.c
+libgstaudiomixer_la_SOURCES = gstaudiomixer.c gstaudioaggregator.c gstaudiointerleave.c
 nodist_libgstaudiomixer_la_SOURCES = $(ORC_NODIST_SOURCES)
-libgstaudiomixer_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
+libgstaudiomixer_la_CFLAGS = \
+	-I$(top_srcdir)/gst-libs \
+	-I$(top_builddir)/gst-libs \
+  $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
+	$(GST_CFLAGS) $(ORC_CFLAGS)
 libgstaudiomixer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstaudiomixer_la_LIBADD =  \
-		$(GST_PLUGINS_BASE_LIBS) \
-	        -lgstaudio-@GST_API_VERSION@ \
+		$(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la \
+		$(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_API_VERSION@ \
 		$(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS)
 libgstaudiomixer_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
 
-noinst_HEADERS = gstaudiomixer.h
+noinst_HEADERS = gstaudiomixer.h gstaudioaggregator.h gstaudiointerleave.h
 
diff --git a/gst/audiomixer/Makefile.in b/gst/audiomixer/Makefile.in
index 056161d..bd5b859 100644
--- a/gst/audiomixer/Makefile.in
+++ b/gst/audiomixer/Makefile.in
@@ -112,6 +112,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -125,7 +126,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -176,10 +176,12 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstaudiomixer_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+libgstaudiomixer_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
-am_libgstaudiomixer_la_OBJECTS = libgstaudiomixer_la-gstaudiomixer.lo
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libgstaudiomixer_la_OBJECTS = libgstaudiomixer_la-gstaudiomixer.lo \
+	libgstaudiomixer_la-gstaudioaggregator.lo \
+	libgstaudiomixer_la-gstaudiointerleave.lo
 am__objects_1 = libgstaudiomixer_la-tmp-orc.lo
 nodist_libgstaudiomixer_la_OBJECTS = $(am__objects_1)
 libgstaudiomixer_la_OBJECTS = $(am_libgstaudiomixer_la_OBJECTS) \
@@ -271,8 +273,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -311,7 +317,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -319,6 +324,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -368,8 +375,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -448,7 +453,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -457,7 +461,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -470,7 +473,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -495,6 +497,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -568,10 +572,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -597,6 +605,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -633,6 +644,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -673,17 +685,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -700,6 +711,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -762,17 +774,22 @@
 cp_v_gen = $(cp_v_gen_$(V))
 cp_v_gen_ = $(cp_v_gen_$(AM_DEFAULT_VERBOSITY))
 cp_v_gen_0 = @echo "  CP     $@";
-libgstaudiomixer_la_SOURCES = gstaudiomixer.c
+libgstaudiomixer_la_SOURCES = gstaudiomixer.c gstaudioaggregator.c gstaudiointerleave.c
 nodist_libgstaudiomixer_la_SOURCES = $(ORC_NODIST_SOURCES)
-libgstaudiomixer_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
+libgstaudiomixer_la_CFLAGS = \
+	-I$(top_srcdir)/gst-libs \
+	-I$(top_builddir)/gst-libs \
+  $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
+	$(GST_CFLAGS) $(ORC_CFLAGS)
+
 libgstaudiomixer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstaudiomixer_la_LIBADD = \
-		$(GST_PLUGINS_BASE_LIBS) \
-	        -lgstaudio-@GST_API_VERSION@ \
+		$(top_builddir)/gst-libs/gst/base/libgstbadbase-$(GST_API_VERSION).la \
+		$(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_API_VERSION@ \
 		$(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS)
 
 libgstaudiomixer_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-noinst_HEADERS = gstaudiomixer.h
+noinst_HEADERS = gstaudiomixer.h gstaudioaggregator.h gstaudiointerleave.h
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-am
 
@@ -854,6 +871,8 @@
 distclean-compile:
 	-rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstaudiomixer_la-gstaudioaggregator.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstaudiomixer_la-gstaudiointerleave.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstaudiomixer_la-gstaudiomixer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstaudiomixer_la-tmp-orc.Plo@am__quote@
 
@@ -888,6 +907,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstaudiomixer_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstaudiomixer_la_CFLAGS) $(CFLAGS) -c -o libgstaudiomixer_la-gstaudiomixer.lo `test -f 'gstaudiomixer.c' || echo '$(srcdir)/'`gstaudiomixer.c
 
+libgstaudiomixer_la-gstaudioaggregator.lo: gstaudioaggregator.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstaudiomixer_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstaudiomixer_la_CFLAGS) $(CFLAGS) -MT libgstaudiomixer_la-gstaudioaggregator.lo -MD -MP -MF $(DEPDIR)/libgstaudiomixer_la-gstaudioaggregator.Tpo -c -o libgstaudiomixer_la-gstaudioaggregator.lo `test -f 'gstaudioaggregator.c' || echo '$(srcdir)/'`gstaudioaggregator.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstaudiomixer_la-gstaudioaggregator.Tpo $(DEPDIR)/libgstaudiomixer_la-gstaudioaggregator.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstaudioaggregator.c' object='libgstaudiomixer_la-gstaudioaggregator.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstaudiomixer_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstaudiomixer_la_CFLAGS) $(CFLAGS) -c -o libgstaudiomixer_la-gstaudioaggregator.lo `test -f 'gstaudioaggregator.c' || echo '$(srcdir)/'`gstaudioaggregator.c
+
+libgstaudiomixer_la-gstaudiointerleave.lo: gstaudiointerleave.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstaudiomixer_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstaudiomixer_la_CFLAGS) $(CFLAGS) -MT libgstaudiomixer_la-gstaudiointerleave.lo -MD -MP -MF $(DEPDIR)/libgstaudiomixer_la-gstaudiointerleave.Tpo -c -o libgstaudiomixer_la-gstaudiointerleave.lo `test -f 'gstaudiointerleave.c' || echo '$(srcdir)/'`gstaudiointerleave.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstaudiomixer_la-gstaudiointerleave.Tpo $(DEPDIR)/libgstaudiomixer_la-gstaudiointerleave.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstaudiointerleave.c' object='libgstaudiomixer_la-gstaudiointerleave.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstaudiomixer_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstaudiomixer_la_CFLAGS) $(CFLAGS) -c -o libgstaudiomixer_la-gstaudiointerleave.lo `test -f 'gstaudiointerleave.c' || echo '$(srcdir)/'`gstaudiointerleave.c
+
 libgstaudiomixer_la-tmp-orc.lo: tmp-orc.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstaudiomixer_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstaudiomixer_la_CFLAGS) $(CFLAGS) -MT libgstaudiomixer_la-tmp-orc.lo -MD -MP -MF $(DEPDIR)/libgstaudiomixer_la-tmp-orc.Tpo -c -o libgstaudiomixer_la-tmp-orc.lo `test -f 'tmp-orc.c' || echo '$(srcdir)/'`tmp-orc.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstaudiomixer_la-tmp-orc.Tpo $(DEPDIR)/libgstaudiomixer_la-tmp-orc.Plo
diff --git a/gst/audiomixer/gstaudioaggregator.c b/gst/audiomixer/gstaudioaggregator.c
new file mode 100644
index 0000000..b526350
--- /dev/null
+++ b/gst/audiomixer/gstaudioaggregator.c
@@ -0,0 +1,1278 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2001 Thomas <thomas@apestaart.org>
+ *               2005,2006 Wim Taymans <wim@fluendo.com>
+ *                    2013 Sebastian Dröge <sebastian@centricular.com>
+ *                    2014 Collabora
+ *                             Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstaudioaggregator.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/**
+ * SECTION: gstaudioaggregator
+ * @short_description: manages a set of pads with the purpose of
+ * aggregating their buffers for raw audio
+ * @see_also: #GstAggregator
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "gstaudioaggregator.h"
+
+#include <string.h>
+
+GST_DEBUG_CATEGORY_STATIC (audio_aggregator_debug);
+#define GST_CAT_DEFAULT audio_aggregator_debug
+
+struct _GstAudioAggregatorPadPrivate
+{
+  /* All members are protected by the pad object lock */
+
+  GstBuffer *buffer;            /* current buffer we're mixing,
+                                   for comparison with collect.buffer
+                                   to see if we need to update our
+                                   cached values. */
+  guint position, size;
+
+  guint64 output_offset;        /* Offset in output segment that
+                                   collect.pos refers to in the
+                                   current buffer. */
+
+  guint64 next_offset;          /* Next expected offset in the input segment */
+
+  /* Last time we noticed a discont */
+  GstClockTime discont_time;
+
+  /* A new unhandled segment event has been received */
+  gboolean new_segment;
+};
+
+
+/*****************************************
+ * GstAudioAggregatorPad implementation  *
+ *****************************************/
+G_DEFINE_TYPE (GstAudioAggregatorPad, gst_audio_aggregator_pad,
+    GST_TYPE_AGGREGATOR_PAD);
+
+static gboolean
+gst_audio_aggregator_pad_flush_pad (GstAggregatorPad * aggpad,
+    GstAggregator * aggregator);
+
+static void
+gst_audio_aggregator_pad_class_init (GstAudioAggregatorPadClass * klass)
+{
+  GstAggregatorPadClass *aggpadclass = (GstAggregatorPadClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (GstAudioAggregatorPadPrivate));
+
+  aggpadclass->flush = GST_DEBUG_FUNCPTR (gst_audio_aggregator_pad_flush_pad);
+}
+
+static void
+gst_audio_aggregator_pad_init (GstAudioAggregatorPad * pad)
+{
+  pad->priv =
+      G_TYPE_INSTANCE_GET_PRIVATE (pad, GST_TYPE_AUDIO_AGGREGATOR_PAD,
+      GstAudioAggregatorPadPrivate);
+
+  gst_audio_info_init (&pad->info);
+
+  pad->priv->buffer = NULL;
+  pad->priv->position = 0;
+  pad->priv->size = 0;
+  pad->priv->output_offset = -1;
+  pad->priv->next_offset = -1;
+  pad->priv->discont_time = GST_CLOCK_TIME_NONE;
+}
+
+
+static gboolean
+gst_audio_aggregator_pad_flush_pad (GstAggregatorPad * aggpad,
+    GstAggregator * aggregator)
+{
+  GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (aggpad);
+
+  GST_OBJECT_LOCK (aggpad);
+  pad->priv->position = pad->priv->size = 0;
+  pad->priv->output_offset = pad->priv->next_offset = -1;
+  pad->priv->discont_time = GST_CLOCK_TIME_NONE;
+  gst_buffer_replace (&pad->priv->buffer, NULL);
+  GST_OBJECT_UNLOCK (aggpad);
+
+  return TRUE;
+}
+
+
+
+/**************************************
+ * GstAudioAggregator implementation  *
+ **************************************/
+
+struct _GstAudioAggregatorPrivate
+{
+  GMutex mutex;
+
+  gboolean send_caps;           /* aagg lock */
+
+  /* All three properties are unprotected, can't be modified while streaming */
+  /* Size in frames that is output per buffer */
+  GstClockTime output_buffer_duration;
+  GstClockTime alignment_threshold;
+  GstClockTime discont_wait;
+
+  /* Protected by srcpad stream clock */
+  /* Buffer starting at offset containing block_size frames */
+  GstBuffer *current_buffer;
+
+  /* counters to keep track of timestamps */
+  /* Readable with object lock, writable with both aag lock and object lock */
+  gint64 offset;
+};
+
+#define GST_AUDIO_AGGREGATOR_LOCK(self)   g_mutex_lock (&(self)->priv->mutex);
+#define GST_AUDIO_AGGREGATOR_UNLOCK(self) g_mutex_unlock (&(self)->priv->mutex);
+
+static void gst_audio_aggregator_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_audio_aggregator_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void gst_audio_aggregator_dispose (GObject * object);
+
+static gboolean gst_audio_aggregator_src_event (GstAggregator * agg,
+    GstEvent * event);
+static gboolean gst_audio_aggregator_sink_event (GstAggregator * agg,
+    GstAggregatorPad * aggpad, GstEvent * event);
+static gboolean gst_audio_aggregator_src_query (GstAggregator * agg,
+    GstQuery * query);
+static gboolean gst_audio_aggregator_start (GstAggregator * agg);
+static gboolean gst_audio_aggregator_stop (GstAggregator * agg);
+static GstFlowReturn gst_audio_aggregator_flush (GstAggregator * agg);
+
+static GstBuffer *gst_audio_aggregator_create_output_buffer (GstAudioAggregator
+    * aagg, guint num_frames);
+static GstFlowReturn gst_audio_aggregator_do_clip (GstAggregator * agg,
+    GstAggregatorPad * bpad, GstBuffer * buffer, GstBuffer ** outbuf);
+static GstFlowReturn gst_audio_aggregator_aggregate (GstAggregator * agg,
+    gboolean timeout);
+
+#define DEFAULT_OUTPUT_BUFFER_DURATION (10 * GST_MSECOND)
+#define DEFAULT_ALIGNMENT_THRESHOLD   (40 * GST_MSECOND)
+#define DEFAULT_DISCONT_WAIT (1 * GST_SECOND)
+
+enum
+{
+  PROP_0,
+  PROP_OUTPUT_BUFFER_DURATION,
+  PROP_ALIGNMENT_THRESHOLD,
+  PROP_DISCONT_WAIT,
+};
+
+G_DEFINE_ABSTRACT_TYPE (GstAudioAggregator, gst_audio_aggregator,
+    GST_TYPE_AGGREGATOR);
+
+static GstClockTime
+gst_audio_aggregator_get_next_time (GstAggregator * agg)
+{
+  GstClockTime next_time;
+
+  GST_OBJECT_LOCK (agg);
+  if (agg->segment.position == -1)
+    next_time = agg->segment.start;
+  else
+    next_time = agg->segment.position;
+  GST_OBJECT_UNLOCK (agg);
+
+  return next_time;
+}
+
+static void
+gst_audio_aggregator_class_init (GstAudioAggregatorClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstAggregatorClass *gstaggregator_class = (GstAggregatorClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (GstAudioAggregatorPrivate));
+
+  gobject_class->set_property = gst_audio_aggregator_set_property;
+  gobject_class->get_property = gst_audio_aggregator_get_property;
+  gobject_class->dispose = gst_audio_aggregator_dispose;
+
+  gstaggregator_class->src_event =
+      GST_DEBUG_FUNCPTR (gst_audio_aggregator_src_event);
+  gstaggregator_class->sink_event =
+      GST_DEBUG_FUNCPTR (gst_audio_aggregator_sink_event);
+  gstaggregator_class->src_query =
+      GST_DEBUG_FUNCPTR (gst_audio_aggregator_src_query);
+  gstaggregator_class->start = gst_audio_aggregator_start;
+  gstaggregator_class->stop = gst_audio_aggregator_stop;
+  gstaggregator_class->flush = gst_audio_aggregator_flush;
+  gstaggregator_class->aggregate =
+      GST_DEBUG_FUNCPTR (gst_audio_aggregator_aggregate);
+  gstaggregator_class->clip = GST_DEBUG_FUNCPTR (gst_audio_aggregator_do_clip);
+  gstaggregator_class->get_next_time = gst_audio_aggregator_get_next_time;
+
+  klass->create_output_buffer = gst_audio_aggregator_create_output_buffer;
+
+  GST_DEBUG_CATEGORY_INIT (audio_aggregator_debug, "audioaggregator",
+      GST_DEBUG_FG_MAGENTA, "GstAudioAggregator");
+
+  g_object_class_install_property (gobject_class, PROP_OUTPUT_BUFFER_DURATION,
+      g_param_spec_uint64 ("output-buffer-duration", "Output Buffer Duration",
+          "Output block size in nanoseconds", 1,
+          G_MAXUINT64, DEFAULT_OUTPUT_BUFFER_DURATION,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_ALIGNMENT_THRESHOLD,
+      g_param_spec_uint64 ("alignment-threshold", "Alignment Threshold",
+          "Timestamp alignment threshold in nanoseconds", 0,
+          G_MAXUINT64 - 1, DEFAULT_ALIGNMENT_THRESHOLD,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_DISCONT_WAIT,
+      g_param_spec_uint64 ("discont-wait", "Discont Wait",
+          "Window of time in nanoseconds to wait before "
+          "creating a discontinuity", 0,
+          G_MAXUINT64 - 1, DEFAULT_DISCONT_WAIT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_audio_aggregator_init (GstAudioAggregator * aagg)
+{
+  aagg->priv =
+      G_TYPE_INSTANCE_GET_PRIVATE (aagg, GST_TYPE_AUDIO_AGGREGATOR,
+      GstAudioAggregatorPrivate);
+
+  g_mutex_init (&aagg->priv->mutex);
+
+  aagg->priv->output_buffer_duration = DEFAULT_OUTPUT_BUFFER_DURATION;
+  aagg->priv->alignment_threshold = DEFAULT_ALIGNMENT_THRESHOLD;
+  aagg->priv->discont_wait = DEFAULT_DISCONT_WAIT;
+
+  aagg->current_caps = NULL;
+  gst_audio_info_init (&aagg->info);
+
+  gst_aggregator_set_latency (GST_AGGREGATOR (aagg),
+      aagg->priv->output_buffer_duration, aagg->priv->output_buffer_duration);
+}
+
+static void
+gst_audio_aggregator_dispose (GObject * object)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (object);
+
+  gst_caps_replace (&aagg->current_caps, NULL);
+
+  g_mutex_clear (&aagg->priv->mutex);
+
+  G_OBJECT_CLASS (gst_audio_aggregator_parent_class)->dispose (object);
+}
+
+static void
+gst_audio_aggregator_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (object);
+
+  switch (prop_id) {
+    case PROP_OUTPUT_BUFFER_DURATION:
+      aagg->priv->output_buffer_duration = g_value_get_uint64 (value);
+      gst_aggregator_set_latency (GST_AGGREGATOR (aagg),
+          aagg->priv->output_buffer_duration,
+          aagg->priv->output_buffer_duration);
+      break;
+    case PROP_ALIGNMENT_THRESHOLD:
+      aagg->priv->alignment_threshold = g_value_get_uint64 (value);
+      break;
+    case PROP_DISCONT_WAIT:
+      aagg->priv->discont_wait = g_value_get_uint64 (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_audio_aggregator_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (object);
+
+  switch (prop_id) {
+    case PROP_OUTPUT_BUFFER_DURATION:
+      g_value_set_uint64 (value, aagg->priv->output_buffer_duration);
+      break;
+    case PROP_ALIGNMENT_THRESHOLD:
+      g_value_set_uint64 (value, aagg->priv->alignment_threshold);
+      break;
+    case PROP_DISCONT_WAIT:
+      g_value_set_uint64 (value, aagg->priv->discont_wait);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+
+/* event handling */
+
+static gboolean
+gst_audio_aggregator_src_event (GstAggregator * agg, GstEvent * event)
+{
+  gboolean result;
+
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (agg);
+  GST_DEBUG_OBJECT (agg->srcpad, "Got %s event on src pad",
+      GST_EVENT_TYPE_NAME (event));
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_QOS:
+      /* QoS might be tricky */
+      gst_event_unref (event);
+      return FALSE;
+    case GST_EVENT_NAVIGATION:
+      /* navigation is rather pointless. */
+      gst_event_unref (event);
+      return FALSE;
+      break;
+    case GST_EVENT_SEEK:
+    {
+      GstSeekFlags flags;
+      gdouble rate;
+      GstSeekType start_type, stop_type;
+      gint64 start, stop;
+      GstFormat seek_format, dest_format;
+
+      /* parse the seek parameters */
+      gst_event_parse_seek (event, &rate, &seek_format, &flags, &start_type,
+          &start, &stop_type, &stop);
+
+      /* Check the seeking parametters before linking up */
+      if ((start_type != GST_SEEK_TYPE_NONE)
+          && (start_type != GST_SEEK_TYPE_SET)) {
+        result = FALSE;
+        GST_DEBUG_OBJECT (aagg,
+            "seeking failed, unhandled seek type for start: %d", start_type);
+        goto done;
+      }
+      if ((stop_type != GST_SEEK_TYPE_NONE) && (stop_type != GST_SEEK_TYPE_SET)) {
+        result = FALSE;
+        GST_DEBUG_OBJECT (aagg,
+            "seeking failed, unhandled seek type for end: %d", stop_type);
+        goto done;
+      }
+
+      GST_OBJECT_LOCK (agg);
+      dest_format = agg->segment.format;
+      GST_OBJECT_UNLOCK (agg);
+      if (seek_format != dest_format) {
+        result = FALSE;
+        GST_DEBUG_OBJECT (aagg,
+            "seeking failed, unhandled seek format: %s",
+            gst_format_get_name (seek_format));
+        goto done;
+      }
+    }
+      break;
+    default:
+      break;
+  }
+
+  return
+      GST_AGGREGATOR_CLASS (gst_audio_aggregator_parent_class)->src_event (agg,
+      event);
+
+done:
+  return result;
+}
+
+
+static gboolean
+gst_audio_aggregator_sink_event (GstAggregator * agg,
+    GstAggregatorPad * aggpad, GstEvent * event)
+{
+  gboolean res = TRUE;
+
+  GST_DEBUG_OBJECT (aggpad, "Got %s event on sink pad",
+      GST_EVENT_TYPE_NAME (event));
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_SEGMENT:
+    {
+      const GstSegment *segment;
+      gst_event_parse_segment (event, &segment);
+
+      if (segment->format != GST_FORMAT_TIME) {
+        GST_ERROR_OBJECT (agg, "Segment of type %s are not supported,"
+            " only TIME segments are supported",
+            gst_format_get_name (segment->format));
+        gst_event_unref (event);
+        event = NULL;
+        res = FALSE;
+        break;
+      }
+
+      GST_OBJECT_LOCK (agg);
+      if (segment->rate != agg->segment.rate) {
+        GST_ERROR_OBJECT (aggpad,
+            "Got segment event with wrong rate %lf, expected %lf",
+            segment->rate, agg->segment.rate);
+        res = FALSE;
+        gst_event_unref (event);
+        event = NULL;
+      } else if (segment->rate < 0.0) {
+        GST_ERROR_OBJECT (aggpad, "Negative rates not supported yet");
+        res = FALSE;
+        gst_event_unref (event);
+        event = NULL;
+      } else {
+        GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (aggpad);
+
+        GST_OBJECT_LOCK (pad);
+        pad->priv->new_segment = TRUE;
+        GST_OBJECT_UNLOCK (pad);
+      }
+      GST_OBJECT_UNLOCK (agg);
+
+      break;
+    }
+    default:
+      break;
+  }
+
+  if (event != NULL)
+    return
+        GST_AGGREGATOR_CLASS (gst_audio_aggregator_parent_class)->sink_event
+        (agg, aggpad, event);
+
+  return res;
+}
+
+/* FIXME, the duration query should reflect how long you will produce
+ * data, that is the amount of stream time until you will emit EOS.
+ *
+ * For synchronized mixing this is always the max of all the durations
+ * of upstream since we emit EOS when all of them finished.
+ *
+ * We don't do synchronized mixing so this really depends on where the
+ * streams where punched in and what their relative offsets are against
+ * eachother which we can get from the first timestamps we see.
+ *
+ * When we add a new stream (or remove a stream) the duration might
+ * also become invalid again and we need to post a new DURATION
+ * message to notify this fact to the parent.
+ * For now we take the max of all the upstream elements so the simple
+ * cases work at least somewhat.
+ */
+static gboolean
+gst_audio_aggregator_query_duration (GstAudioAggregator * aagg,
+    GstQuery * query)
+{
+  gint64 max;
+  gboolean res;
+  GstFormat format;
+  GstIterator *it;
+  gboolean done;
+  GValue item = { 0, };
+
+  /* parse format */
+  gst_query_parse_duration (query, &format, NULL);
+
+  max = -1;
+  res = TRUE;
+  done = FALSE;
+
+  it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (aagg));
+  while (!done) {
+    GstIteratorResult ires;
+
+    ires = gst_iterator_next (it, &item);
+    switch (ires) {
+      case GST_ITERATOR_DONE:
+        done = TRUE;
+        break;
+      case GST_ITERATOR_OK:
+      {
+        GstPad *pad = g_value_get_object (&item);
+        gint64 duration;
+
+        /* ask sink peer for duration */
+        res &= gst_pad_peer_query_duration (pad, format, &duration);
+        /* take max from all valid return values */
+        if (res) {
+          /* valid unknown length, stop searching */
+          if (duration == -1) {
+            max = duration;
+            done = TRUE;
+          }
+          /* else see if bigger than current max */
+          else if (duration > max)
+            max = duration;
+        }
+        g_value_reset (&item);
+        break;
+      }
+      case GST_ITERATOR_RESYNC:
+        max = -1;
+        res = TRUE;
+        gst_iterator_resync (it);
+        break;
+      default:
+        res = FALSE;
+        done = TRUE;
+        break;
+    }
+  }
+  g_value_unset (&item);
+  gst_iterator_free (it);
+
+  if (res) {
+    /* and store the max */
+    GST_DEBUG_OBJECT (aagg, "Total duration in format %s: %"
+        GST_TIME_FORMAT, gst_format_get_name (format), GST_TIME_ARGS (max));
+    gst_query_set_duration (query, format, max);
+  }
+
+  return res;
+}
+
+
+static gboolean
+gst_audio_aggregator_src_query (GstAggregator * agg, GstQuery * query)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (agg);
+  gboolean res = FALSE;
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_DURATION:
+      res = gst_audio_aggregator_query_duration (aagg, query);
+      break;
+    case GST_QUERY_POSITION:
+    {
+      GstFormat format;
+
+      gst_query_parse_position (query, &format, NULL);
+
+      GST_OBJECT_LOCK (aagg);
+
+      switch (format) {
+        case GST_FORMAT_TIME:
+          /* FIXME, bring to stream time, might be tricky */
+          gst_query_set_position (query, format, agg->segment.position);
+          res = TRUE;
+          break;
+        case GST_FORMAT_BYTES:
+          if (GST_AUDIO_INFO_BPF (&aagg->info)) {
+            gst_query_set_position (query, format, aagg->priv->offset *
+                GST_AUDIO_INFO_BPF (&aagg->info));
+            res = TRUE;
+          }
+          break;
+        case GST_FORMAT_DEFAULT:
+          gst_query_set_position (query, format, aagg->priv->offset);
+          res = TRUE;
+          break;
+        default:
+          break;
+      }
+
+      GST_OBJECT_UNLOCK (aagg);
+
+      break;
+    }
+    default:
+      res =
+          GST_AGGREGATOR_CLASS (gst_audio_aggregator_parent_class)->src_query
+          (agg, query);
+      break;
+  }
+
+  return res;
+}
+
+
+void
+gst_audio_aggregator_set_sink_caps (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * pad, GstCaps * caps)
+{
+  GST_OBJECT_LOCK (pad);
+  gst_audio_info_from_caps (&pad->info, caps);
+  GST_OBJECT_UNLOCK (pad);
+}
+
+
+gboolean
+gst_audio_aggregator_set_src_caps (GstAudioAggregator * aagg, GstCaps * caps)
+{
+  GstAudioInfo info;
+
+  if (!gst_audio_info_from_caps (&info, caps)) {
+    GST_WARNING_OBJECT (aagg, "Rejecting invalid caps: %" GST_PTR_FORMAT, caps);
+    return FALSE;
+  }
+
+  GST_AUDIO_AGGREGATOR_LOCK (aagg);
+  GST_OBJECT_LOCK (aagg);
+
+  if (!gst_audio_info_is_equal (&info, &aagg->info)) {
+    GST_INFO_OBJECT (aagg, "setting caps to %" GST_PTR_FORMAT, caps);
+    gst_caps_replace (&aagg->current_caps, caps);
+
+    memcpy (&aagg->info, &info, sizeof (info));
+    aagg->priv->send_caps = TRUE;
+
+  }
+
+  GST_OBJECT_UNLOCK (aagg);
+  GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+
+  /* send caps event later, after stream-start event */
+
+  return TRUE;
+}
+
+
+/* Must hold object lock and aagg lock to call */
+
+static void
+gst_audio_aggregator_reset (GstAudioAggregator * aagg)
+{
+  GstAggregator *agg = GST_AGGREGATOR (aagg);
+
+  GST_AUDIO_AGGREGATOR_LOCK (aagg);
+  GST_OBJECT_LOCK (aagg);
+  agg->segment.position = -1;
+  aagg->priv->offset = 0;
+  gst_audio_info_init (&aagg->info);
+  gst_caps_replace (&aagg->current_caps, NULL);
+  gst_buffer_replace (&aagg->priv->current_buffer, NULL);
+  GST_OBJECT_UNLOCK (aagg);
+  GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+}
+
+static gboolean
+gst_audio_aggregator_start (GstAggregator * agg)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (agg);
+
+  gst_audio_aggregator_reset (aagg);
+
+  return TRUE;
+}
+
+static gboolean
+gst_audio_aggregator_stop (GstAggregator * agg)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (agg);
+
+  gst_audio_aggregator_reset (aagg);
+
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_audio_aggregator_flush (GstAggregator * agg)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (agg);
+
+  GST_AUDIO_AGGREGATOR_LOCK (aagg);
+  GST_OBJECT_LOCK (aagg);
+  agg->segment.position = -1;
+  aagg->priv->offset = 0;
+  gst_buffer_replace (&aagg->priv->current_buffer, NULL);
+  GST_OBJECT_UNLOCK (aagg);
+  GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+gst_audio_aggregator_do_clip (GstAggregator * agg,
+    GstAggregatorPad * bpad, GstBuffer * buffer, GstBuffer ** out)
+{
+  GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (bpad);
+  gint rate, bpf;
+
+
+  rate = GST_AUDIO_INFO_RATE (&pad->info);
+  bpf = GST_AUDIO_INFO_BPF (&pad->info);
+
+  GST_OBJECT_LOCK (bpad);
+  *out = gst_audio_buffer_clip (buffer, &bpad->segment, rate, bpf);
+  GST_OBJECT_UNLOCK (bpad);
+
+  return GST_FLOW_OK;
+}
+
+/* Called with the object lock for both the element and pad held,
+ * as well as the aagg lock
+ */
+static gboolean
+gst_audio_aggregator_fill_buffer (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * pad, GstBuffer * inbuf)
+{
+  GstClockTime start_time, end_time;
+  gboolean discont = FALSE;
+  guint64 start_offset, end_offset;
+  GstClockTime timestamp, stream_time = GST_CLOCK_TIME_NONE;
+  gint rate, bpf;
+
+  GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
+
+  g_assert (pad->priv->buffer == NULL);
+
+  rate = GST_AUDIO_INFO_RATE (&pad->info);
+  bpf = GST_AUDIO_INFO_BPF (&pad->info);
+
+  pad->priv->position = 0;
+  pad->priv->size = gst_buffer_get_size (inbuf) / bpf;
+
+  if (!GST_BUFFER_PTS_IS_VALID (inbuf)) {
+    if (pad->priv->output_offset == -1)
+      pad->priv->output_offset = aagg->priv->offset;
+    if (pad->priv->next_offset == -1)
+      pad->priv->next_offset = pad->priv->size;
+    else
+      pad->priv->next_offset += pad->priv->size;
+    goto done;
+  }
+
+  timestamp = GST_BUFFER_PTS (inbuf);
+  stream_time = gst_segment_to_stream_time (&aggpad->segment, GST_FORMAT_TIME,
+      timestamp);
+
+  /* sync object properties on stream time */
+  /* TODO: Ideally we would want to do that on every sample */
+  if (GST_CLOCK_TIME_IS_VALID (stream_time))
+    gst_object_sync_values (GST_OBJECT (pad), stream_time);
+
+  start_time = GST_BUFFER_PTS (inbuf);
+  end_time =
+      start_time + gst_util_uint64_scale_ceil (pad->priv->size, GST_SECOND,
+      rate);
+
+  start_offset = gst_util_uint64_scale (start_time, rate, GST_SECOND);
+  end_offset = start_offset + pad->priv->size;
+
+  if (GST_BUFFER_IS_DISCONT (inbuf)
+      || GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_RESYNC)
+      || pad->priv->new_segment || pad->priv->next_offset == -1) {
+    discont = TRUE;
+    pad->priv->new_segment = FALSE;
+  } else {
+    guint64 diff, max_sample_diff;
+
+    /* Check discont, based on audiobasesink */
+    if (start_offset <= pad->priv->next_offset)
+      diff = pad->priv->next_offset - start_offset;
+    else
+      diff = start_offset - pad->priv->next_offset;
+
+    max_sample_diff =
+        gst_util_uint64_scale_int (aagg->priv->alignment_threshold, rate,
+        GST_SECOND);
+
+    /* Discont! */
+    if (G_UNLIKELY (diff >= max_sample_diff)) {
+      if (aagg->priv->discont_wait > 0) {
+        if (pad->priv->discont_time == GST_CLOCK_TIME_NONE) {
+          pad->priv->discont_time = start_time;
+        } else if (start_time - pad->priv->discont_time >=
+            aagg->priv->discont_wait) {
+          discont = TRUE;
+          pad->priv->discont_time = GST_CLOCK_TIME_NONE;
+        }
+      } else {
+        discont = TRUE;
+      }
+    } else if (G_UNLIKELY (pad->priv->discont_time != GST_CLOCK_TIME_NONE)) {
+      /* we have had a discont, but are now back on track! */
+      pad->priv->discont_time = GST_CLOCK_TIME_NONE;
+    }
+  }
+
+  if (discont) {
+    /* Have discont, need resync */
+    if (pad->priv->next_offset != -1)
+      GST_INFO_OBJECT (pad, "Have discont. Expected %"
+          G_GUINT64_FORMAT ", got %" G_GUINT64_FORMAT,
+          pad->priv->next_offset, start_offset);
+    pad->priv->output_offset = -1;
+    pad->priv->next_offset = end_offset;
+  } else {
+    pad->priv->next_offset += pad->priv->size;
+  }
+
+  if (pad->priv->output_offset == -1) {
+    GstClockTime start_running_time;
+    GstClockTime end_running_time;
+    guint64 start_running_time_offset;
+    guint64 end_running_time_offset;
+
+    start_running_time =
+        gst_segment_to_running_time (&aggpad->segment,
+        GST_FORMAT_TIME, start_time);
+    end_running_time =
+        gst_segment_to_running_time (&aggpad->segment,
+        GST_FORMAT_TIME, end_time);
+    start_running_time_offset =
+        gst_util_uint64_scale (start_running_time, rate, GST_SECOND);
+    end_running_time_offset =
+        gst_util_uint64_scale (end_running_time, rate, GST_SECOND);
+
+    if (end_running_time_offset < aagg->priv->offset) {
+      /* Before output segment, drop */
+      gst_buffer_unref (inbuf);
+      pad->priv->buffer = NULL;
+      pad->priv->position = 0;
+      pad->priv->size = 0;
+      pad->priv->output_offset = -1;
+      GST_DEBUG_OBJECT (pad,
+          "Buffer before segment or current position: %" G_GUINT64_FORMAT " < %"
+          G_GUINT64_FORMAT, end_running_time_offset, aagg->priv->offset);
+      return FALSE;
+    }
+
+    if (start_running_time_offset < aagg->priv->offset) {
+      guint diff = aagg->priv->offset - start_running_time_offset;
+
+      pad->priv->position += diff;
+      if (pad->priv->position >= pad->priv->size) {
+        /* Empty buffer, drop */
+        gst_buffer_unref (inbuf);
+        pad->priv->buffer = NULL;
+        pad->priv->position = 0;
+        pad->priv->size = 0;
+        pad->priv->output_offset = -1;
+        GST_DEBUG_OBJECT (pad,
+            "Buffer before segment or current position: %" G_GUINT64_FORMAT
+            " < %" G_GUINT64_FORMAT, end_running_time_offset,
+            aagg->priv->offset);
+        return FALSE;
+      }
+    }
+
+    pad->priv->output_offset =
+        MAX (start_running_time_offset, aagg->priv->offset);
+    GST_DEBUG_OBJECT (pad,
+        "Buffer resynced: Pad offset %" G_GUINT64_FORMAT
+        ", current audio aggregator offset %" G_GUINT64_FORMAT,
+        pad->priv->output_offset, aagg->priv->offset);
+  }
+
+done:
+
+  GST_LOG_OBJECT (pad,
+      "Queued new buffer at offset %" G_GUINT64_FORMAT,
+      pad->priv->output_offset);
+  pad->priv->buffer = inbuf;
+
+  return TRUE;
+}
+
+/* Called with pad object lock held */
+
+static gboolean
+gst_audio_aggregator_mix_buffer (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * pad, GstBuffer * inbuf, GstBuffer * outbuf)
+{
+  guint overlap;
+  guint out_start;
+  gboolean filled;
+  guint blocksize;
+
+  blocksize = gst_util_uint64_scale (aagg->priv->output_buffer_duration,
+      GST_AUDIO_INFO_RATE (&aagg->info), GST_SECOND);
+  blocksize = MAX (1, blocksize);
+
+  /* Overlap => mix */
+  if (aagg->priv->offset < pad->priv->output_offset)
+    out_start = pad->priv->output_offset - aagg->priv->offset;
+  else
+    out_start = 0;
+
+  overlap = pad->priv->size - pad->priv->position;
+  if (overlap > blocksize - out_start)
+    overlap = blocksize - out_start;
+
+  if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
+    /* skip gap buffer */
+    GST_LOG_OBJECT (pad, "skipping GAP buffer");
+    pad->priv->output_offset += pad->priv->size;
+    pad->priv->position = pad->priv->size;
+
+    gst_buffer_replace (&pad->priv->buffer, NULL);
+    return FALSE;
+  }
+
+  filled = GST_AUDIO_AGGREGATOR_GET_CLASS (aagg)->aggregate_one_buffer (aagg,
+      pad, inbuf, pad->priv->position, outbuf, out_start, overlap);
+
+  if (filled)
+    GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_GAP);
+
+  pad->priv->position += overlap;
+  pad->priv->output_offset += overlap;
+
+  if (pad->priv->position == pad->priv->size) {
+    /* Buffer done, drop it */
+    gst_buffer_replace (&pad->priv->buffer, NULL);
+    GST_DEBUG_OBJECT (pad, "Finished mixing buffer, waiting for next");
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+static GstBuffer *
+gst_audio_aggregator_create_output_buffer (GstAudioAggregator * aagg,
+    guint num_frames)
+{
+  GstBuffer *outbuf = gst_buffer_new_and_alloc (num_frames *
+      GST_AUDIO_INFO_BPF (&aagg->info));
+  GstMapInfo outmap;
+
+  gst_buffer_map (outbuf, &outmap, GST_MAP_WRITE);
+  gst_audio_format_fill_silence (aagg->info.finfo, outmap.data, outmap.size);
+  gst_buffer_unmap (outbuf, &outmap);
+
+  return outbuf;
+}
+
+static GstFlowReturn
+gst_audio_aggregator_aggregate (GstAggregator * agg, gboolean timeout)
+{
+  /* Get all pads that have data for us and store them in a
+   * new list.
+   *
+   * Calculate the current output offset/timestamp and
+   * offset_end/timestamp_end. Allocate a silence buffer
+   * for this and store it.
+   *
+   * For all pads:
+   * 1) Once per input buffer (cached)
+   *   1) Check discont (flag and timestamp with tolerance)
+   *   2) If discont or new, resync. That means:
+   *     1) Drop all start data of the buffer that comes before
+   *        the current position/offset.
+   *     2) Calculate the offset (output segment!) that the first
+   *        frame of the input buffer corresponds to. Base this on
+   *        the running time.
+   *
+   * 2) If the current pad's offset/offset_end overlaps with the output
+   *    offset/offset_end, mix it at the appropiate position in the output
+   *    buffer and advance the pad's position. Remember if this pad needs
+   *    a new buffer to advance behind the output offset_end.
+   *
+   * 3) If we had no pad with a buffer, go EOS.
+   *
+   * 4) If we had at least one pad that did not advance behind output
+   *    offset_end, let collected be called again for the current
+   *    output offset/offset_end.
+   */
+  GstElement *element;
+  GstAudioAggregator *aagg;
+  GList *iter;
+  GstFlowReturn ret;
+  GstBuffer *outbuf = NULL;
+  gint64 next_offset;
+  gint64 next_timestamp;
+  gint rate, bpf;
+  gboolean dropped = FALSE;
+  gboolean is_eos = TRUE;
+  gboolean is_done = TRUE;
+  guint blocksize;
+
+  element = GST_ELEMENT (agg);
+  aagg = GST_AUDIO_AGGREGATOR (agg);
+
+  blocksize = gst_util_uint64_scale (aagg->priv->output_buffer_duration,
+      GST_AUDIO_INFO_RATE (&aagg->info), GST_SECOND);
+  blocksize = MAX (1, blocksize);
+
+  GST_AUDIO_AGGREGATOR_LOCK (aagg);
+  GST_OBJECT_LOCK (agg);
+
+  /* Update position from the segment start/stop if needed */
+  if (agg->segment.position == -1) {
+    if (agg->segment.rate > 0.0)
+      agg->segment.position = agg->segment.start;
+    else
+      agg->segment.position = agg->segment.stop;
+  }
+
+  if (G_UNLIKELY (aagg->info.finfo->format == GST_AUDIO_FORMAT_UNKNOWN)) {
+    if (timeout) {
+      GST_DEBUG_OBJECT (aagg,
+          "Got timeout before receiving any caps, don't output anything");
+
+      /* Advance position */
+      if (agg->segment.rate > 0.0)
+        agg->segment.position += aagg->priv->output_buffer_duration;
+      else if (agg->segment.position > aagg->priv->output_buffer_duration)
+        agg->segment.position -= aagg->priv->output_buffer_duration;
+      else
+        agg->segment.position = 0;
+
+      GST_OBJECT_UNLOCK (agg);
+      GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+      return GST_FLOW_OK;
+    } else {
+      GST_OBJECT_UNLOCK (agg);
+      goto not_negotiated;
+    }
+  }
+
+  if (aagg->priv->send_caps) {
+    GST_OBJECT_UNLOCK (agg);
+    gst_aggregator_set_src_caps (agg, aagg->current_caps);
+    GST_OBJECT_LOCK (agg);
+    aagg->priv->offset = gst_util_uint64_scale (agg->segment.position,
+        GST_AUDIO_INFO_RATE (&aagg->info), GST_SECOND);
+
+    aagg->priv->send_caps = FALSE;
+  }
+
+
+  rate = GST_AUDIO_INFO_RATE (&aagg->info);
+  bpf = GST_AUDIO_INFO_BPF (&aagg->info);
+
+
+  /* for the next timestamp, use the sample counter, which will
+   * never accumulate rounding errors */
+
+  /* FIXME: Reverse mixing does not work at all yet */
+  if (agg->segment.rate > 0.0) {
+    next_offset = aagg->priv->offset + blocksize;
+  } else {
+    next_offset = aagg->priv->offset - blocksize;
+  }
+
+  next_timestamp = gst_util_uint64_scale (next_offset, GST_SECOND, rate);
+
+  if (aagg->priv->current_buffer == NULL) {
+    GST_OBJECT_UNLOCK (agg);
+    aagg->priv->current_buffer =
+        GST_AUDIO_AGGREGATOR_GET_CLASS (aagg)->create_output_buffer (aagg,
+        blocksize);
+    /* Be careful, some things could have changed ? */
+    GST_OBJECT_LOCK (agg);
+    GST_BUFFER_FLAG_SET (aagg->priv->current_buffer, GST_BUFFER_FLAG_GAP);
+  }
+  outbuf = aagg->priv->current_buffer;
+
+  GST_LOG_OBJECT (agg,
+      "Starting to mix %u samples for offset %" G_GUINT64_FORMAT
+      " with timestamp %" GST_TIME_FORMAT, blocksize,
+      aagg->priv->offset, GST_TIME_ARGS (agg->segment.position));
+
+  for (iter = element->sinkpads; iter; iter = iter->next) {
+    GstBuffer *inbuf;
+    GstAudioAggregatorPad *pad = (GstAudioAggregatorPad *) iter->data;
+    GstAggregatorPad *aggpad = (GstAggregatorPad *) iter->data;
+    gboolean drop_buf = FALSE;
+    gboolean pad_eos = gst_aggregator_pad_is_eos (aggpad);
+
+    if (!pad_eos)
+      is_eos = FALSE;
+
+    inbuf = gst_aggregator_pad_get_buffer (aggpad);
+
+    GST_OBJECT_LOCK (pad);
+    if (!inbuf) {
+      if (timeout) {
+        if (pad->priv->output_offset < next_offset) {
+          gint64 diff = next_offset - pad->priv->output_offset;
+          GST_LOG_OBJECT (pad, "Timeout, missing %" G_GINT64_FORMAT " frames (%"
+              GST_TIME_FORMAT ")", diff,
+              GST_TIME_ARGS (gst_util_uint64_scale (diff, GST_SECOND,
+                      GST_AUDIO_INFO_RATE (&aagg->info))));
+        }
+      } else if (!pad_eos) {
+        is_done = FALSE;
+      }
+      GST_OBJECT_UNLOCK (pad);
+      continue;
+    }
+
+    g_assert (!pad->priv->buffer || pad->priv->buffer == inbuf);
+
+    /* New buffer? */
+    if (!pad->priv->buffer) {
+      /* Takes ownership of buffer */
+      if (!gst_audio_aggregator_fill_buffer (aagg, pad, inbuf)) {
+        dropped = TRUE;
+        GST_OBJECT_UNLOCK (pad);
+        gst_aggregator_pad_drop_buffer (aggpad);
+        continue;
+      }
+    } else {
+      gst_buffer_unref (inbuf);
+    }
+
+    if (!pad->priv->buffer && !dropped && pad_eos) {
+      GST_DEBUG_OBJECT (aggpad, "Pad is in EOS state");
+      GST_OBJECT_UNLOCK (pad);
+      continue;
+    }
+
+    g_assert (pad->priv->buffer);
+
+    /* This pad is lacking behind, we need to update the offset
+     * and maybe drop the current buffer */
+    if (pad->priv->output_offset < aagg->priv->offset) {
+      gint64 diff = aagg->priv->offset - pad->priv->output_offset;
+      gint64 odiff = diff;
+
+      if (pad->priv->position + diff > pad->priv->size)
+        diff = pad->priv->size - pad->priv->position;
+      pad->priv->position += diff;
+      pad->priv->output_offset += diff;
+
+      if (pad->priv->position == pad->priv->size) {
+        GST_LOG_OBJECT (pad, "Buffer was late by %" GST_TIME_FORMAT
+            ", dropping %" GST_PTR_FORMAT,
+            GST_TIME_ARGS (gst_util_uint64_scale (odiff, GST_SECOND,
+                    GST_AUDIO_INFO_RATE (&aagg->info))), pad->priv->buffer);
+        /* Buffer done, drop it */
+        gst_buffer_replace (&pad->priv->buffer, NULL);
+        dropped = TRUE;
+        GST_OBJECT_UNLOCK (pad);
+        gst_aggregator_pad_drop_buffer (aggpad);
+        continue;
+      }
+    }
+
+
+    if (pad->priv->output_offset >= aagg->priv->offset
+        && pad->priv->output_offset <
+        aagg->priv->offset + blocksize && pad->priv->buffer) {
+      GST_LOG_OBJECT (aggpad, "Mixing buffer for current offset");
+      drop_buf = !gst_audio_aggregator_mix_buffer (aagg, pad, pad->priv->buffer,
+          outbuf);
+      if (pad->priv->output_offset >= next_offset) {
+        GST_DEBUG_OBJECT (pad,
+            "Pad is after current offset: %" G_GUINT64_FORMAT " >= %"
+            G_GUINT64_FORMAT, pad->priv->output_offset, next_offset);
+      } else {
+        is_done = FALSE;
+      }
+    }
+
+    GST_OBJECT_UNLOCK (pad);
+    if (drop_buf)
+      gst_aggregator_pad_drop_buffer (aggpad);
+
+  }
+  GST_OBJECT_UNLOCK (agg);
+
+  if (dropped) {
+    /* We dropped a buffer, retry */
+    GST_INFO_OBJECT (aagg, "A pad dropped a buffer, wait for the next one");
+    GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+    return GST_FLOW_OK;
+  }
+
+  if (!is_done && !is_eos) {
+    /* Get more buffers */
+    GST_INFO_OBJECT (aagg,
+        "We're not done yet for the current offset," " waiting for more data");
+    GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+    return GST_FLOW_OK;
+  }
+
+  if (is_eos) {
+    gint64 max_offset = 0;
+
+    GST_DEBUG_OBJECT (aagg, "We're EOS");
+
+    GST_OBJECT_LOCK (agg);
+    for (iter = GST_ELEMENT (agg)->sinkpads; iter; iter = iter->next) {
+      GstAudioAggregatorPad *pad = GST_AUDIO_AGGREGATOR_PAD (iter->data);
+
+      max_offset = MAX ((gint64) max_offset, (gint64) pad->priv->output_offset);
+    }
+    GST_OBJECT_UNLOCK (agg);
+
+    /* This means EOS or nothing mixed in at all */
+    if (aagg->priv->offset == max_offset) {
+      gst_buffer_replace (&aagg->priv->current_buffer, NULL);
+      GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+      return GST_FLOW_EOS;
+    }
+
+    if (max_offset <= next_offset) {
+      GST_DEBUG_OBJECT (aagg,
+          "Last buffer is incomplete: %" G_GUINT64_FORMAT " <= %"
+          G_GUINT64_FORMAT, max_offset, next_offset);
+      next_offset = max_offset;
+      next_timestamp = gst_util_uint64_scale (next_offset, GST_SECOND, rate);
+
+      if (next_offset > aagg->priv->offset)
+        gst_buffer_resize (outbuf, 0, (next_offset - aagg->priv->offset) * bpf);
+    }
+  }
+
+  /* set timestamps on the output buffer */
+  GST_OBJECT_LOCK (agg);
+  if (agg->segment.rate > 0.0) {
+    GST_BUFFER_PTS (outbuf) = agg->segment.position;
+    GST_BUFFER_OFFSET (outbuf) = aagg->priv->offset;
+    GST_BUFFER_OFFSET_END (outbuf) = next_offset;
+    GST_BUFFER_DURATION (outbuf) = next_timestamp - agg->segment.position;
+  } else {
+    GST_BUFFER_PTS (outbuf) = next_timestamp;
+    GST_BUFFER_OFFSET (outbuf) = next_offset;
+    GST_BUFFER_OFFSET_END (outbuf) = aagg->priv->offset;
+    GST_BUFFER_DURATION (outbuf) = agg->segment.position - next_timestamp;
+  }
+
+  aagg->priv->offset = next_offset;
+  agg->segment.position = next_timestamp;
+
+  GST_OBJECT_UNLOCK (agg);
+
+  /* send it out */
+  GST_LOG_OBJECT (aagg,
+      "pushing outbuf %p, timestamp %" GST_TIME_FORMAT " offset %"
+      G_GINT64_FORMAT, outbuf, GST_TIME_ARGS (GST_BUFFER_PTS (outbuf)),
+      GST_BUFFER_OFFSET (outbuf));
+
+  GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+
+  ret = gst_aggregator_finish_buffer (agg, aagg->priv->current_buffer);
+  aagg->priv->current_buffer = NULL;
+
+  GST_LOG_OBJECT (aagg, "pushed outbuf, result = %s", gst_flow_get_name (ret));
+
+  return ret;
+  /* ERRORS */
+not_negotiated:
+  {
+    GST_AUDIO_AGGREGATOR_UNLOCK (aagg);
+    GST_ELEMENT_ERROR (aagg, STREAM, FORMAT, (NULL),
+        ("Unknown data received, not negotiated"));
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+}
diff --git a/gst/audiomixer/gstaudioaggregator.h b/gst/audiomixer/gstaudioaggregator.h
new file mode 100644
index 0000000..304bad2
--- /dev/null
+++ b/gst/audiomixer/gstaudioaggregator.h
@@ -0,0 +1,171 @@
+/* GStreamer
+ * Copyright (C) 2014 Collabora
+ *   Author: Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstaudioaggregator.h:
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_AGGREGATOR_H__
+#define __GST_AUDIO_AGGREGATOR_H__
+
+#ifndef GST_USE_UNSTABLE_API
+#warning "The Base library from gst-plugins-bad is unstable API and may change in future."
+#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
+#endif
+
+#include <gst/gst.h>
+#include <gst/base/gstaggregator.h>
+#include <gst/audio/audio.h>
+
+G_BEGIN_DECLS
+
+/*******************************
+ * GstAudioAggregator Structs  *
+ *******************************/
+
+typedef struct _GstAudioAggregator GstAudioAggregator;
+typedef struct _GstAudioAggregatorPrivate GstAudioAggregatorPrivate;
+typedef struct _GstAudioAggregatorClass GstAudioAggregatorClass;
+
+
+/************************
+ * GstAudioAggregatorPad API *
+ ***********************/
+
+#define GST_TYPE_AUDIO_AGGREGATOR_PAD            (gst_audio_aggregator_pad_get_type())
+#define GST_AUDIO_AGGREGATOR_PAD(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPad))
+#define GST_AUDIO_AGGREGATOR_PAD_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
+#define GST_AUDIO_AGGREGATOR_PAD_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
+#define GST_IS_AUDIO_AGGREGATOR_PAD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD))
+#define GST_IS_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD))
+
+/****************************
+ * GstAudioAggregatorPad Structs *
+ ***************************/
+
+typedef struct _GstAudioAggregatorPad GstAudioAggregatorPad;
+typedef struct _GstAudioAggregatorPadClass GstAudioAggregatorPadClass;
+typedef struct _GstAudioAggregatorPadPrivate GstAudioAggregatorPadPrivate;
+
+/**
+ * GstAudioAggregatorPad:
+ * @parent: The parent #GstAggregatorPad
+ * @info: The audio info for this pad set from the incoming caps
+ *
+ * The implementation the GstPad to use with #GstAudioAggregator
+ */
+struct _GstAudioAggregatorPad
+{
+  GstAggregatorPad                  parent;
+
+  GstAudioInfo                      info;
+
+  /*< private >*/
+  GstAudioAggregatorPadPrivate   *  priv;
+
+  gpointer _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioAggregatorPadClass:
+ *
+ */
+struct _GstAudioAggregatorPadClass
+{
+  GstAggregatorPadClass   parent_class;
+
+  /*< private >*/
+  gpointer      _gst_reserved[GST_PADDING];
+};
+
+GType gst_audio_aggregator_pad_get_type           (void);
+
+/**************************
+ * GstAudioAggregator API *
+ **************************/
+
+#define GST_TYPE_AUDIO_AGGREGATOR            (gst_audio_aggregator_get_type())
+#define GST_AUDIO_AGGREGATOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregator))
+#define GST_AUDIO_AGGREGATOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
+#define GST_AUDIO_AGGREGATOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
+#define GST_IS_AUDIO_AGGREGATOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR))
+#define GST_IS_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR))
+
+#define GST_FLOW_CUSTOM_SUCCESS        GST_FLOW_NOT_HANDLED
+
+/**
+ * GstAudioAggregator:
+ * @parent: The parent #GstAggregator
+ * @info: The information parsed from the current caps
+ * @current_caps: The caps set by the subclass
+ *
+ * GstAudioAggregator object
+ */
+struct _GstAudioAggregator
+{
+  GstAggregator            parent;
+
+  /* All member are read only for subclasses, must hold OBJECT lock  */
+  GstAudioInfo    info;
+
+  GstCaps *current_caps;
+
+  /*< private >*/
+  GstAudioAggregatorPrivate *priv;
+
+  gpointer                 _gst_reserved[GST_PADDING];
+};
+
+/**
+ * GstAudioAggregatorClass:
+ * @create_output_buffer: Create a new output buffer contains num_frames frames.
+ * @aggregate_one_buffer: Aggregates one input buffer to the output
+ *  buffer.  The in_offset and out_offset are in "frames", which is
+ *  the size of a sample times the number of channels. Returns TRUE if
+ *  any non-silence was added to the buffer
+ */
+struct _GstAudioAggregatorClass {
+  GstAggregatorClass   parent_class;
+
+  GstBuffer * (* create_output_buffer) (GstAudioAggregator * aagg,
+      guint num_frames);
+  gboolean (* aggregate_one_buffer) (GstAudioAggregator * aagg,
+      GstAudioAggregatorPad * pad, GstBuffer * inbuf, guint in_offset,
+      GstBuffer * outbuf, guint out_offset, guint num_frames);
+
+  /*< private >*/
+  gpointer          _gst_reserved[GST_PADDING];
+};
+
+/*************************
+ * GstAggregator methods *
+ ************************/
+
+GType gst_audio_aggregator_get_type(void);
+
+void
+gst_audio_aggregator_set_sink_caps (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * pad, GstCaps * caps);
+
+gboolean
+gst_audio_aggregator_set_src_caps (GstAudioAggregator * aagg, GstCaps * caps);
+
+
+G_END_DECLS
+
+#endif /* __GST_AUDIO_AGGREGATOR_H__ */
diff --git a/gst/audiomixer/gstaudiointerleave.c b/gst/audiomixer/gstaudiointerleave.c
new file mode 100644
index 0000000..fc98429
--- /dev/null
+++ b/gst/audiomixer/gstaudiointerleave.c
@@ -0,0 +1,895 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2005 Wim Taymans <wim@fluendo.com>
+ *                    2007 Andy Wingo <wingo at pobox.com>
+ *                    2008 Sebastian Dröge <slomo@circular-chaos.org>
+ *                    2014 Collabora
+ *                        Olivier Crete <olivier.crete@collabora.com>
+ *
+ * gstaudiointerleave.c: audiointerleave element, N in, one out,
+ * samples are added
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+/**
+ * SECTION:element-audiointerleave
+ *
+ *
+ */
+
+/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstaudiointerleave.h"
+#include <gst/audio/audio.h>
+
+#include <string.h>
+
+#define GST_CAT_DEFAULT gst_audio_interleave_debug
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
+
+enum
+{
+  PROP_PAD_0,
+  PROP_PAD_CHANNEL
+};
+
+G_DEFINE_TYPE (GstAudioInterleavePad, gst_audio_interleave_pad,
+    GST_TYPE_AUDIO_AGGREGATOR_PAD);
+
+static void
+gst_audio_interleave_pad_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstAudioInterleavePad *pad = GST_AUDIO_INTERLEAVE_PAD (object);
+
+  switch (prop_id) {
+    case PROP_PAD_CHANNEL:
+      g_value_set_uint (value, pad->channel);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+
+static void
+gst_audio_interleave_pad_class_init (GstAudioInterleavePadClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+
+  gobject_class->get_property = gst_audio_interleave_pad_get_property;
+
+  g_object_class_install_property (gobject_class,
+      PROP_PAD_CHANNEL,
+      g_param_spec_uint ("channel",
+          "Channel number",
+          "Number of the channel of this pad in the output", 0, G_MAXUINT, 0,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_audio_interleave_pad_init (GstAudioInterleavePad * pad)
+{
+}
+
+enum
+{
+  PROP_0,
+  PROP_CHANNEL_POSITIONS,
+  PROP_CHANNEL_POSITIONS_FROM_INPUT
+};
+
+/* elementfactory information */
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define CAPS \
+  GST_AUDIO_CAPS_MAKE ("{ S32LE, U32LE, S16LE, U16LE, S8, U8, F32LE, F64LE }") \
+  ", layout = (string) { interleaved, non-interleaved }"
+#else
+#define CAPS \
+  GST_AUDIO_CAPS_MAKE ("{ S32BE, U32BE, S16BE, U16BE, S8, U8, F32BE, F64BE }") \
+  ", layout = (string) { interleaved, non-interleaved }"
+#endif
+
+static GstStaticPadTemplate gst_audio_interleave_sink_template =
+GST_STATIC_PAD_TEMPLATE ("sink_%u",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "rate = (int) [ 1, MAX ], "
+        "channels = (int) 1, "
+        "format = (string) " GST_AUDIO_FORMATS_ALL ", "
+        "layout = (string) {non-interleaved, interleaved}")
+    );
+
+static GstStaticPadTemplate gst_audio_interleave_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "rate = (int) [ 1, MAX ], "
+        "channels = (int) [ 1, MAX ], "
+        "format = (string) " GST_AUDIO_FORMATS_ALL ", "
+        "layout = (string) interleaved")
+    );
+
+static void gst_audio_interleave_child_proxy_init (gpointer g_iface,
+    gpointer iface_data);
+
+#define gst_audio_interleave_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAudioInterleave, gst_audio_interleave,
+    GST_TYPE_AUDIO_AGGREGATOR, G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
+        gst_audio_interleave_child_proxy_init));
+
+static void gst_audio_interleave_finalize (GObject * object);
+static void gst_audio_interleave_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_audio_interleave_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+static gboolean gst_audio_interleave_setcaps (GstAudioInterleave * self,
+    GstPad * pad, GstCaps * caps);
+static GstPad *gst_audio_interleave_request_new_pad (GstElement * element,
+    GstPadTemplate * temp, const gchar * req_name, const GstCaps * caps);
+static void gst_audio_interleave_release_pad (GstElement * element,
+    GstPad * pad);
+
+static gboolean gst_audio_interleave_stop (GstAggregator * agg);
+
+static gboolean
+gst_audio_interleave_aggregate_one_buffer (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * aaggpad, GstBuffer * inbuf, guint in_offset,
+    GstBuffer * outbuf, guint out_offset, guint num_samples);
+
+
+static void
+__remove_channels (GstCaps * caps)
+{
+  GstStructure *s;
+  gint i, size;
+
+  size = gst_caps_get_size (caps);
+  for (i = 0; i < size; i++) {
+    s = gst_caps_get_structure (caps, i);
+    gst_structure_remove_field (s, "channel-mask");
+    gst_structure_remove_field (s, "channels");
+  }
+}
+
+static void
+__set_channels (GstCaps * caps, gint channels)
+{
+  GstStructure *s;
+  gint i, size;
+
+  size = gst_caps_get_size (caps);
+  for (i = 0; i < size; i++) {
+    s = gst_caps_get_structure (caps, i);
+    if (channels > 0)
+      gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
+    else
+      gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+  }
+}
+
+/* we can only accept caps that we and downstream can handle.
+ * if we have filtercaps set, use those to constrain the target caps.
+ */
+static GstCaps *
+gst_audio_interleave_sink_getcaps (GstAggregator * agg, GstPad * pad,
+    GstCaps * filter)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (agg);
+  GstCaps *result = NULL, *peercaps, *sinkcaps;
+
+  GST_OBJECT_LOCK (self);
+  /* If we already have caps on one of the sink pads return them */
+  if (self->sinkcaps)
+    result = gst_caps_copy (self->sinkcaps);
+  GST_OBJECT_UNLOCK (self);
+
+  if (result == NULL) {
+    /* get the downstream possible caps */
+    peercaps = gst_pad_peer_query_caps (agg->srcpad, NULL);
+
+    /* get the allowed caps on this sinkpad */
+    sinkcaps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+    __remove_channels (sinkcaps);
+    if (peercaps) {
+      peercaps = gst_caps_make_writable (peercaps);
+      __remove_channels (peercaps);
+      /* if the peer has caps, intersect */
+      GST_DEBUG_OBJECT (pad, "intersecting peer and template caps");
+      result = gst_caps_intersect (peercaps, sinkcaps);
+      gst_caps_unref (peercaps);
+      gst_caps_unref (sinkcaps);
+    } else {
+      /* the peer has no caps (or there is no peer), just use the allowed caps
+       * of this sinkpad. */
+      GST_DEBUG_OBJECT (pad, "no peer caps, using sinkcaps");
+      result = sinkcaps;
+    }
+    __set_channels (result, 1);
+  }
+
+  if (filter != NULL) {
+    GstCaps *caps = result;
+
+    GST_LOG_OBJECT (pad, "intersecting filter caps %" GST_PTR_FORMAT " with "
+        "preliminary result %" GST_PTR_FORMAT, filter, caps);
+
+    result = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+  }
+
+  GST_DEBUG_OBJECT (pad, "Returning caps %" GST_PTR_FORMAT, result);
+
+  return result;
+}
+
+static gboolean
+gst_audio_interleave_sink_query (GstAggregator * agg, GstAggregatorPad * aggpad,
+    GstQuery * query)
+{
+  gboolean res = FALSE;
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_CAPS:
+    {
+      GstCaps *filter, *caps;
+
+      gst_query_parse_caps (query, &filter);
+      caps = gst_audio_interleave_sink_getcaps (agg, GST_PAD (aggpad), filter);
+      gst_query_set_caps_result (query, caps);
+      gst_caps_unref (caps);
+      res = TRUE;
+      break;
+    }
+    default:
+      res =
+          GST_AGGREGATOR_CLASS (parent_class)->sink_query (agg, aggpad, query);
+      break;
+  }
+
+  return res;
+}
+
+static gint
+compare_positions (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+  const gint i = *(const gint *) a;
+  const gint j = *(const gint *) b;
+  const gint *pos = (const gint *) user_data;
+
+  if (pos[i] < pos[j])
+    return -1;
+  else if (pos[i] > pos[j])
+    return 1;
+  else
+    return 0;
+}
+
+static gboolean
+gst_audio_interleave_channel_positions_to_mask (GValueArray * positions,
+    gint default_ordering_map[64], guint64 * mask)
+{
+  gint i;
+  guint channels;
+  GstAudioChannelPosition *pos;
+  gboolean ret;
+
+  channels = positions->n_values;
+  pos = g_new (GstAudioChannelPosition, channels);
+
+  for (i = 0; i < channels; i++) {
+    GValue *val;
+
+    val = g_value_array_get_nth (positions, i);
+    pos[i] = g_value_get_enum (val);
+  }
+
+  /* sort the default ordering map according to the position order */
+  for (i = 0; i < channels; i++) {
+    default_ordering_map[i] = i;
+  }
+  g_qsort_with_data (default_ordering_map, channels,
+      sizeof (*default_ordering_map), compare_positions, pos);
+
+  ret = gst_audio_channel_positions_to_mask (pos, channels, FALSE, mask);
+  g_free (pos);
+
+  return ret;
+}
+
+
+/* Must be called with the object lock held */
+
+static guint64
+gst_audio_interleave_get_channel_mask (GstAudioInterleave * self)
+{
+  guint64 channel_mask = 0;
+
+  if (self->channel_positions != NULL &&
+      self->channels == self->channel_positions->n_values) {
+    if (!gst_audio_interleave_channel_positions_to_mask
+        (self->channel_positions, self->default_channels_ordering_map,
+            &channel_mask)) {
+      GST_WARNING_OBJECT (self, "Invalid channel positions, using NONE");
+      channel_mask = 0;
+    }
+  } else {
+    GST_WARNING_OBJECT (self, "Using NONE channel positions");
+  }
+
+  return channel_mask;
+}
+
+
+#define MAKE_FUNC(type) \
+static void interleave_##type (guint##type *out, guint##type *in, \
+    guint stride, guint nframes) \
+{ \
+  gint i; \
+  \
+  for (i = 0; i < nframes; i++) { \
+    *out = in[i]; \
+    out += stride; \
+  } \
+}
+
+MAKE_FUNC (8);
+MAKE_FUNC (16);
+MAKE_FUNC (32);
+MAKE_FUNC (64);
+
+static void
+interleave_24 (guint8 * out, guint8 * in, guint stride, guint nframes)
+{
+  gint i;
+
+  for (i = 0; i < nframes; i++) {
+    memcpy (out, in, 3);
+    out += stride * 3;
+    in += 3;
+  }
+}
+
+static void
+gst_audio_interleave_set_process_function (GstAudioInterleave * self,
+    GstAudioInfo * info)
+{
+  switch (GST_AUDIO_INFO_WIDTH (info)) {
+    case 8:
+      self->func = (GstInterleaveFunc) interleave_8;
+      break;
+    case 16:
+      self->func = (GstInterleaveFunc) interleave_16;
+      break;
+    case 24:
+      self->func = (GstInterleaveFunc) interleave_24;
+      break;
+    case 32:
+      self->func = (GstInterleaveFunc) interleave_32;
+      break;
+    case 64:
+      self->func = (GstInterleaveFunc) interleave_64;
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+}
+
+
+/* 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_audio_interleave_setcaps (GstAudioInterleave * self, GstPad * pad,
+    GstCaps * caps)
+{
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (self);
+  GstAudioInfo info;
+  GValue *val;
+  guint channel;
+  gboolean new = FALSE;
+
+  if (!gst_audio_info_from_caps (&info, caps))
+    goto invalid_format;
+
+  GST_OBJECT_LOCK (self);
+  if (self->sinkcaps && !gst_caps_is_subset (caps, self->sinkcaps))
+    goto cannot_change_caps;
+
+  if (!self->sinkcaps) {
+    GstCaps *sinkcaps = gst_caps_copy (caps);
+    GstStructure *s = gst_caps_get_structure (sinkcaps, 0);
+
+    gst_structure_remove_field (s, "channel-mask");
+
+    GST_DEBUG_OBJECT (self, "setting sinkcaps %" GST_PTR_FORMAT, sinkcaps);
+
+    gst_caps_replace (&self->sinkcaps, sinkcaps);
+
+    gst_caps_unref (sinkcaps);
+    new = TRUE;
+    self->new_caps = TRUE;
+  }
+
+  if (self->channel_positions_from_input
+      && GST_AUDIO_INFO_CHANNELS (&info) == 1) {
+    channel = GST_AUDIO_INTERLEAVE_PAD (pad)->channel;
+    val = g_value_array_get_nth (self->input_channel_positions, channel);
+    g_value_set_enum (val, GST_AUDIO_INFO_POSITION (&info, 0));
+  }
+  GST_OBJECT_UNLOCK (self);
+
+  gst_audio_aggregator_set_sink_caps (aagg, GST_AUDIO_AGGREGATOR_PAD (pad),
+      caps);
+
+  if (!new)
+    return TRUE;
+
+  GST_INFO_OBJECT (pad, "handle caps change to %" GST_PTR_FORMAT, caps);
+
+  return TRUE;
+
+  /* ERRORS */
+invalid_format:
+  {
+    GST_WARNING_OBJECT (self, "invalid format set as caps: %" GST_PTR_FORMAT,
+        caps);
+    return FALSE;
+  }
+cannot_change_caps:
+  {
+    GST_OBJECT_UNLOCK (self);
+    GST_WARNING_OBJECT (self, "caps of %" GST_PTR_FORMAT " already set, can't "
+        "change", self->sinkcaps);
+    return FALSE;
+  }
+}
+
+static gboolean
+gst_audio_interleave_sink_event (GstAggregator * agg, GstAggregatorPad * aggpad,
+    GstEvent * event)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (agg);
+  gboolean res = TRUE;
+
+  GST_DEBUG_OBJECT (aggpad, "Got %s event on sink pad",
+      GST_EVENT_TYPE_NAME (event));
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+    {
+      GstCaps *caps;
+
+      gst_event_parse_caps (event, &caps);
+      res = gst_audio_interleave_setcaps (self, GST_PAD_CAST (aggpad), caps);
+      gst_event_unref (event);
+      event = NULL;
+      break;
+    }
+    default:
+      break;
+  }
+
+  if (event != NULL)
+    return GST_AGGREGATOR_CLASS (parent_class)->sink_event (agg, aggpad, event);
+
+  return res;
+}
+
+static GstFlowReturn
+gst_audio_interleave_aggregate (GstAggregator * aggregator, gboolean timeout)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (aggregator);
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (aggregator);
+
+  GST_OBJECT_LOCK (aggregator);
+  if (self->new_caps) {
+    GstCaps *srccaps;
+    GstStructure *s;
+    gboolean ret;
+
+    srccaps = gst_caps_copy (self->sinkcaps);
+    s = gst_caps_get_structure (srccaps, 0);
+
+    gst_structure_set (s, "channels", G_TYPE_INT, self->channels, "layout",
+        G_TYPE_STRING, "interleaved", "channel-mask", GST_TYPE_BITMASK,
+        gst_audio_interleave_get_channel_mask (self), NULL);
+
+
+    GST_OBJECT_UNLOCK (aggregator);
+    ret = gst_audio_aggregator_set_src_caps (aagg, srccaps);
+    gst_caps_unref (srccaps);
+
+    if (!ret)
+      goto src_did_not_accept;
+
+    GST_OBJECT_LOCK (aggregator);
+
+    gst_audio_interleave_set_process_function (self, &aagg->info);
+
+    self->new_caps = FALSE;
+  }
+  GST_OBJECT_UNLOCK (aggregator);
+
+  return GST_AGGREGATOR_CLASS (parent_class)->aggregate (aggregator, timeout);
+
+src_did_not_accept:
+  GST_WARNING_OBJECT (self, "src did not accept setcaps()");
+  return GST_FLOW_NOT_NEGOTIATED;;
+}
+
+static void
+gst_audio_interleave_class_init (GstAudioInterleaveClass * klass)
+{
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstElementClass *gstelement_class = (GstElementClass *) klass;
+  GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
+  GstAudioAggregatorClass *aagg_class = (GstAudioAggregatorClass *) klass;
+
+  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "audiointerleave", 0,
+      "audio interleaving element");
+
+  gobject_class->set_property = gst_audio_interleave_set_property;
+  gobject_class->get_property = gst_audio_interleave_get_property;
+  gobject_class->finalize = gst_audio_interleave_finalize;
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_audio_interleave_src_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_audio_interleave_sink_template));
+  gst_element_class_set_static_metadata (gstelement_class, "AudioInterleave",
+      "Generic/Audio",
+      "Mixes multiple audio streams",
+      "Olivier Crete <olivier.crete@collabora.com>");
+
+  gstelement_class->request_new_pad =
+      GST_DEBUG_FUNCPTR (gst_audio_interleave_request_new_pad);
+  gstelement_class->release_pad =
+      GST_DEBUG_FUNCPTR (gst_audio_interleave_release_pad);
+
+
+  agg_class->sinkpads_type = GST_TYPE_AUDIO_INTERLEAVE_PAD;
+
+  agg_class->sink_query = GST_DEBUG_FUNCPTR (gst_audio_interleave_sink_query);
+  agg_class->sink_event = GST_DEBUG_FUNCPTR (gst_audio_interleave_sink_event);
+  agg_class->stop = gst_audio_interleave_stop;
+  agg_class->aggregate = gst_audio_interleave_aggregate;
+
+  aagg_class->aggregate_one_buffer = gst_audio_interleave_aggregate_one_buffer;
+
+
+  /**
+   * GstInterleave:channel-positions
+   * 
+   * Channel positions: This property controls the channel positions
+   * that are used on the src caps. The number of elements should be
+   * the same as the number of sink pads and the array should contain
+   * a valid list of channel positions. The n-th element of the array
+   * is the position of the n-th sink pad.
+   *
+   * These channel positions will only be used if they're valid and the
+   * number of elements is the same as the number of channels. If this
+   * is not given a NONE layout will be used.
+   *
+   */
+  g_object_class_install_property (gobject_class, PROP_CHANNEL_POSITIONS,
+      g_param_spec_value_array ("channel-positions", "Channel positions",
+          "Channel positions used on the output",
+          g_param_spec_enum ("channel-position", "Channel position",
+              "Channel position of the n-th input",
+              GST_TYPE_AUDIO_CHANNEL_POSITION,
+              GST_AUDIO_CHANNEL_POSITION_NONE,
+              G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS),
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstInterleave:channel-positions-from-input
+   * 
+   * Channel positions from input: If this property is set to %TRUE the channel
+   * positions will be taken from the input caps if valid channel positions for
+   * the output can be constructed from them. If this is set to %TRUE setting the
+   * channel-positions property overwrites this property again.
+   *
+   */
+  g_object_class_install_property (gobject_class,
+      PROP_CHANNEL_POSITIONS_FROM_INPUT,
+      g_param_spec_boolean ("channel-positions-from-input",
+          "Channel positions from input",
+          "Take channel positions from the input", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_audio_interleave_init (GstAudioInterleave * self)
+{
+  self->input_channel_positions = g_value_array_new (0);
+  self->channel_positions_from_input = TRUE;
+  self->channel_positions = self->input_channel_positions;
+}
+
+static void
+gst_audio_interleave_finalize (GObject * object)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (object);
+
+  if (self->channel_positions
+      && self->channel_positions != self->input_channel_positions) {
+    g_value_array_free (self->channel_positions);
+    self->channel_positions = NULL;
+  }
+
+  if (self->input_channel_positions) {
+    g_value_array_free (self->input_channel_positions);
+    self->input_channel_positions = NULL;
+  }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_audio_interleave_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (object);
+
+  switch (prop_id) {
+    case PROP_CHANNEL_POSITIONS:
+      g_return_if_fail (
+          ((GValueArray *) g_value_get_boxed (value))->n_values > 0);
+
+      if (self->channel_positions &&
+          self->channel_positions != self->input_channel_positions)
+        g_value_array_free (self->channel_positions);
+
+      self->channel_positions = g_value_dup_boxed (value);
+      self->channel_positions_from_input = FALSE;
+      self->channels = self->channel_positions->n_values;
+      break;
+    case PROP_CHANNEL_POSITIONS_FROM_INPUT:
+      self->channel_positions_from_input = g_value_get_boolean (value);
+
+      if (self->channel_positions_from_input) {
+        if (self->channel_positions &&
+            self->channel_positions != self->input_channel_positions)
+          g_value_array_free (self->channel_positions);
+        self->channel_positions = self->input_channel_positions;
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_audio_interleave_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (object);
+
+  switch (prop_id) {
+    case PROP_CHANNEL_POSITIONS:
+      g_value_set_boxed (value, self->channel_positions);
+      break;
+    case PROP_CHANNEL_POSITIONS_FROM_INPUT:
+      g_value_set_boolean (value, self->channel_positions_from_input);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_audio_interleave_stop (GstAggregator * agg)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (agg);
+
+  if (!GST_AGGREGATOR_CLASS (parent_class)->stop (agg))
+    return FALSE;
+
+  self->new_caps = FALSE;
+  gst_caps_replace (&self->sinkcaps, NULL);
+
+  return TRUE;
+}
+
+static GstPad *
+gst_audio_interleave_request_new_pad (GstElement * element,
+    GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (element);
+  GstAudioInterleavePad *newpad;
+  gchar *pad_name;
+  gint channels, padnumber;
+  GValue val = { 0, };
+
+  /* FIXME: We ignore req_name, this is evil! */
+
+  padnumber = g_atomic_int_add (&self->padcounter, 1);
+  if (self->channel_positions_from_input)
+    channels = g_atomic_int_add (&self->channels, 1);
+  else
+    channels = padnumber;
+
+  pad_name = g_strdup_printf ("sink_%u", padnumber);
+  newpad = (GstAudioInterleavePad *)
+      GST_ELEMENT_CLASS (parent_class)->request_new_pad (element,
+      templ, pad_name, caps);
+  g_free (pad_name);
+  if (newpad == NULL)
+    goto could_not_create;
+
+  newpad->channel = channels;
+  gst_pad_use_fixed_caps (GST_PAD (newpad));
+
+  gst_child_proxy_child_added (GST_CHILD_PROXY (element), G_OBJECT (newpad),
+      GST_OBJECT_NAME (newpad));
+
+
+  g_value_init (&val, GST_TYPE_AUDIO_CHANNEL_POSITION);
+  g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_NONE);
+  self->input_channel_positions =
+      g_value_array_append (self->input_channel_positions, &val);
+  g_value_unset (&val);
+
+  /* Update the src caps if we already have them */
+  GST_OBJECT_LOCK (self);
+  self->new_caps = TRUE;
+  GST_OBJECT_UNLOCK (self);
+
+  return GST_PAD_CAST (newpad);
+
+could_not_create:
+  {
+    GST_DEBUG_OBJECT (element, "could not create/add  pad");
+    return NULL;
+  }
+}
+
+static void
+gst_audio_interleave_release_pad (GstElement * element, GstPad * pad)
+{
+  GstAudioInterleave *self;
+  gint position;
+  GList *l;
+
+  self = GST_AUDIO_INTERLEAVE (element);
+
+  /* Take lock to make sure we're not changing this when processing buffers */
+  GST_OBJECT_LOCK (self);
+
+  g_atomic_int_add (&self->channels, -1);
+
+  position = GST_AUDIO_INTERLEAVE_PAD (pad)->channel;
+  g_value_array_remove (self->input_channel_positions, position);
+
+  /* Update channel numbers */
+  /* Taken above, GST_OBJECT_LOCK (self); */
+  for (l = GST_ELEMENT_CAST (self)->sinkpads; l != NULL; l = l->next) {
+    GstAudioInterleavePad *ipad = GST_AUDIO_INTERLEAVE_PAD (l->data);
+
+    if (GST_AUDIO_INTERLEAVE_PAD (pad)->channel < ipad->channel)
+      ipad->channel--;
+  }
+
+  self->new_caps = TRUE;
+  GST_OBJECT_UNLOCK (self);
+
+
+  GST_DEBUG_OBJECT (self, "release pad %s:%s", GST_DEBUG_PAD_NAME (pad));
+
+  gst_child_proxy_child_removed (GST_CHILD_PROXY (self), G_OBJECT (pad),
+      GST_OBJECT_NAME (pad));
+
+  GST_ELEMENT_CLASS (parent_class)->release_pad (element, pad);
+}
+
+
+/* Called with object lock and pad object lock held */
+static gboolean
+gst_audio_interleave_aggregate_one_buffer (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * aaggpad, GstBuffer * inbuf, guint in_offset,
+    GstBuffer * outbuf, guint out_offset, guint num_frames)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (aagg);
+  GstAudioInterleavePad *pad = GST_AUDIO_INTERLEAVE_PAD (aaggpad);
+  GstMapInfo inmap;
+  GstMapInfo outmap;
+  gint out_width, in_bpf, out_bpf;
+  guint8 *outdata;
+
+  out_width = GST_AUDIO_INFO_WIDTH (&aagg->info) / 8;
+  in_bpf = GST_AUDIO_INFO_BPF (&aaggpad->info);
+  out_bpf = GST_AUDIO_INFO_BPF (&aagg->info);
+
+  gst_buffer_map (outbuf, &outmap, GST_MAP_READWRITE);
+  gst_buffer_map (inbuf, &inmap, GST_MAP_READ);
+  GST_LOG_OBJECT (pad, "interleaves %u frames on channel %d/%d at offset %u"
+      " from offset %u", num_frames, pad->channel, self->channels,
+      out_offset * out_bpf, in_offset * in_bpf);
+
+  outdata = outmap.data + (out_offset * out_bpf) +
+      (out_width * self->default_channels_ordering_map[pad->channel]);
+
+
+  self->func (outdata, inmap.data + (in_offset * in_bpf), self->channels,
+      num_frames);
+
+
+  gst_buffer_unmap (inbuf, &inmap);
+  gst_buffer_unmap (outbuf, &outmap);
+
+  return TRUE;
+}
+
+
+/* GstChildProxy implementation */
+static GObject *
+gst_audio_interleave_child_proxy_get_child_by_index (GstChildProxy *
+    child_proxy, guint index)
+{
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (child_proxy);
+  GObject *obj = NULL;
+
+  GST_OBJECT_LOCK (self);
+  obj = g_list_nth_data (GST_ELEMENT_CAST (self)->sinkpads, index);
+  if (obj)
+    gst_object_ref (obj);
+  GST_OBJECT_UNLOCK (self);
+
+  return obj;
+}
+
+static guint
+gst_audio_interleave_child_proxy_get_children_count (GstChildProxy *
+    child_proxy)
+{
+  guint count = 0;
+  GstAudioInterleave *self = GST_AUDIO_INTERLEAVE (child_proxy);
+
+  GST_OBJECT_LOCK (self);
+  count = GST_ELEMENT_CAST (self)->numsinkpads;
+  GST_OBJECT_UNLOCK (self);
+  GST_INFO_OBJECT (self, "Children Count: %d", count);
+
+  return count;
+}
+
+static void
+gst_audio_interleave_child_proxy_init (gpointer g_iface, gpointer iface_data)
+{
+  GstChildProxyInterface *iface = g_iface;
+
+  GST_INFO ("intializing child proxy interface");
+  iface->get_child_by_index =
+      gst_audio_interleave_child_proxy_get_child_by_index;
+  iface->get_children_count =
+      gst_audio_interleave_child_proxy_get_children_count;
+}
diff --git a/gst/audiomixer/gstaudiointerleave.h b/gst/audiomixer/gstaudiointerleave.h
new file mode 100644
index 0000000..0473b45
--- /dev/null
+++ b/gst/audiomixer/gstaudiointerleave.h
@@ -0,0 +1,101 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ * Copyright (C) 2013      Sebastian Dröge <slomo@circular-chaos.org>
+ *
+ * gstaudiointerleave.h: Header for audiointerleave element
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_AUDIO_INTERLEAVE_H__
+#define __GST_AUDIO_INTERLEAVE_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+
+#include "gstaudioaggregator.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIO_INTERLEAVE            (gst_audio_interleave_get_type())
+#define GST_AUDIO_INTERLEAVE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_INTERLEAVE,GstAudioInterleave))
+#define GST_IS_AUDIO_INTERLEAVE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_INTERLEAVE))
+#define GST_AUDIO_INTERLEAVE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_INTERLEAVE,GstAudioInterleaveClass))
+#define GST_IS_AUDIO_INTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_INTERLEAVE))
+#define GST_AUDIO_INTERLEAVE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_INTERLEAVE,GstAudioInterleaveClass))
+
+typedef struct _GstAudioInterleave             GstAudioInterleave;
+typedef struct _GstAudioInterleaveClass        GstAudioInterleaveClass;
+
+typedef struct _GstAudioInterleavePad GstAudioInterleavePad;
+typedef struct _GstAudioInterleavePadClass GstAudioInterleavePadClass;
+
+typedef void (*GstInterleaveFunc) (gpointer out, gpointer in, guint stride,
+    guint nframes);
+
+/**
+ * GstAudioInterleave:
+ *
+ * The GstAudioInterleave object structure.
+ */
+struct _GstAudioInterleave {
+  GstAudioAggregator parent;
+
+  gint padcounter;
+  guint channels;
+
+  gboolean new_caps;
+  GstCaps *sinkcaps;
+
+  GValueArray *channel_positions;
+  GValueArray *input_channel_positions;
+  gboolean channel_positions_from_input;
+
+  gint default_channels_ordering_map[64];
+
+  GstInterleaveFunc func;
+};
+
+struct _GstAudioInterleaveClass {
+  GstAudioAggregatorClass parent_class;
+};
+
+GType    gst_audio_interleave_get_type (void);
+
+#define GST_TYPE_AUDIO_INTERLEAVE_PAD            (gst_audio_interleave_pad_get_type())
+#define GST_AUDIO_INTERLEAVE_PAD(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_INTERLEAVE_PAD,GstAudioInterleavePad))
+#define GST_IS_AUDIO_INTERLEAVE_PAD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_INTERLEAVE_PAD))
+#define GST_AUDIO_INTERLEAVE_PAD_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_INTERLEAVE_PAD,GstAudioInterleavePadClass))
+#define GST_IS_AUDIO_INTERLEAVE_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_INTERLEAVE_PAD))
+#define GST_AUDIO_INTERLEAVE_PAD_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_INTERLEAVE_PAD,GstAudioInterleavePadClass))
+
+struct _GstAudioInterleavePad {
+  GstAudioAggregatorPad parent;
+
+  guint channel;
+};
+
+struct _GstAudioInterleavePadClass {
+  GstAudioAggregatorPadClass parent_class;
+};
+
+GType gst_audio_interleave_pad_get_type (void);
+
+G_END_DECLS
+
+
+#endif /* __GST_AUDIO_INTERLEAVE_H__ */
diff --git a/gst/audiomixer/gstaudiomixer.c b/gst/audiomixer/gstaudiomixer.c
index 4202f00..40ede84 100644
--- a/gst/audiomixer/gstaudiomixer.c
+++ b/gst/audiomixer/gstaudiomixer.c
@@ -30,6 +30,18 @@
  * The audiomixer currently mixes all data received on the sinkpads as soon as
  * possible without trying to synchronize the streams.
  *
+ * The input pads are from a GstPad subclass and have additional
+ * properties to mute each pad individually and set the volume:
+ *
+ * <itemizedlist>
+ * <listitem>
+ * "mute": Whether to mute the pad or not (#gboolean)
+ * </listitem>
+ * <listitem>
+ * "volume": The volume of the pad, between 0.0 and 10.0 (#gdouble)
+ * </listitem>
+ * </itemizedlist>
+ *
  * <refsect2>
  * <title>Example launch line</title>
  * |[
@@ -48,27 +60,11 @@
 #include <string.h>             /* strcmp */
 #include "gstaudiomixerorc.h"
 
+#include "gstaudiointerleave.h"
+
 #define GST_CAT_DEFAULT gst_audiomixer_debug
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
 
-typedef struct _GstAudioMixerCollect GstAudioMixerCollect;
-struct _GstAudioMixerCollect
-{
-  GstCollectData collect;       /* we extend the CollectData */
-
-  GstBuffer *buffer;            /* current buffer we're mixing,
-                                   for comparison with collect.buffer
-                                   to see if we need to update our
-                                   cached values. */
-  guint position, size;
-
-  guint64 output_offset;        /* Offset in output segment that
-                                   collect.pos refers to in the
-                                   current buffer. */
-
-  guint64 next_offset;          /* Next expected offset in the input segment */
-};
-
 #define DEFAULT_PAD_VOLUME (1.0)
 #define DEFAULT_PAD_MUTE (FALSE)
 
@@ -92,7 +88,8 @@
   PROP_PAD_MUTE
 };
 
-G_DEFINE_TYPE (GstAudioMixerPad, gst_audiomixer_pad, GST_TYPE_PAD);
+G_DEFINE_TYPE (GstAudioMixerPad, gst_audiomixer_pad,
+    GST_TYPE_AUDIO_AGGREGATOR_PAD);
 
 static void
 gst_audiomixer_pad_get_property (GObject * object, guint prop_id,
@@ -164,17 +161,10 @@
   pad->mute = DEFAULT_PAD_MUTE;
 }
 
-#define DEFAULT_ALIGNMENT_THRESHOLD   (40 * GST_MSECOND)
-#define DEFAULT_DISCONT_WAIT (1 * GST_SECOND)
-#define DEFAULT_BLOCKSIZE (1024)
-
 enum
 {
   PROP_0,
-  PROP_FILTER_CAPS,
-  PROP_ALIGNMENT_THRESHOLD,
-  PROP_DISCONT_WAIT,
-  PROP_BLOCKSIZE
+  PROP_FILTER_CAPS
 };
 
 /* elementfactory information */
@@ -207,8 +197,8 @@
     gpointer iface_data);
 
 #define gst_audiomixer_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstAudioMixer, gst_audiomixer, GST_TYPE_ELEMENT,
-    G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
+G_DEFINE_TYPE_WITH_CODE (GstAudioMixer, gst_audiomixer,
+    GST_TYPE_AUDIO_AGGREGATOR, G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
         gst_audiomixer_child_proxy_init));
 
 static void gst_audiomixer_dispose (GObject * object);
@@ -219,40 +209,31 @@
 
 static gboolean gst_audiomixer_setcaps (GstAudioMixer * audiomixer,
     GstPad * pad, GstCaps * caps);
-static gboolean gst_audiomixer_src_query (GstPad * pad, GstObject * parent,
-    GstQuery * query);
-static gboolean gst_audiomixer_sink_query (GstCollectPads * pads,
-    GstCollectData * pad, GstQuery * query, gpointer user_data);
-static gboolean gst_audiomixer_src_event (GstPad * pad, GstObject * parent,
-    GstEvent * event);
-static gboolean gst_audiomixer_sink_event (GstCollectPads * pads,
-    GstCollectData * pad, GstEvent * event, gpointer user_data);
-
 static GstPad *gst_audiomixer_request_new_pad (GstElement * element,
-    GstPadTemplate * temp, const gchar * unused, const GstCaps * caps);
+    GstPadTemplate * temp, const gchar * req_name, const GstCaps * caps);
 static void gst_audiomixer_release_pad (GstElement * element, GstPad * pad);
 
-static GstStateChangeReturn gst_audiomixer_change_state (GstElement * element,
-    GstStateChange transition);
+static gboolean
+gst_audiomixer_aggregate_one_buffer (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * aaggpad, GstBuffer * inbuf, guint in_offset,
+    GstBuffer * outbuf, guint out_offset, guint num_samples);
 
-static GstFlowReturn gst_audiomixer_do_clip (GstCollectPads * pads,
-    GstCollectData * data, GstBuffer * buffer, GstBuffer ** out,
-    gpointer user_data);
-static GstFlowReturn gst_audiomixer_collected (GstCollectPads * pads,
-    gpointer user_data);
 
 /* we can only accept caps that we and downstream can handle.
  * if we have filtercaps set, use those to constrain the target caps.
  */
 static GstCaps *
-gst_audiomixer_sink_getcaps (GstPad * pad, GstCaps * filter)
+gst_audiomixer_sink_getcaps (GstAggregator * agg, GstPad * pad,
+    GstCaps * filter)
 {
+  GstAudioAggregator *aagg;
   GstAudioMixer *audiomixer;
   GstCaps *result, *peercaps, *current_caps, *filter_caps;
   GstStructure *s;
   gint i, n;
 
-  audiomixer = GST_AUDIO_MIXER (GST_PAD_PARENT (pad));
+  audiomixer = GST_AUDIO_MIXER (agg);
+  aagg = GST_AUDIO_AGGREGATOR (agg);
 
   GST_OBJECT_LOCK (audiomixer);
   /* take filter */
@@ -274,12 +255,11 @@
   }
 
   /* get the downstream possible caps */
-  peercaps = gst_pad_peer_query_caps (audiomixer->srcpad, filter_caps);
+  peercaps = gst_pad_peer_query_caps (agg->srcpad, filter_caps);
 
   /* get the allowed caps on this sinkpad */
   GST_OBJECT_LOCK (audiomixer);
-  current_caps =
-      audiomixer->current_caps ? gst_caps_ref (audiomixer->current_caps) : NULL;
+  current_caps = aagg->current_caps ? gst_caps_ref (aagg->current_caps) : NULL;
   if (current_caps == NULL) {
     current_caps = gst_pad_get_pad_template_caps (pad);
     if (!current_caps)
@@ -337,8 +317,8 @@
 }
 
 static gboolean
-gst_audiomixer_sink_query (GstCollectPads * pads, GstCollectData * pad,
-    GstQuery * query, gpointer user_data)
+gst_audiomixer_sink_query (GstAggregator * agg, GstAggregatorPad * aggpad,
+    GstQuery * query)
 {
   gboolean res = FALSE;
 
@@ -348,14 +328,15 @@
       GstCaps *filter, *caps;
 
       gst_query_parse_caps (query, &filter);
-      caps = gst_audiomixer_sink_getcaps (pad->pad, filter);
+      caps = gst_audiomixer_sink_getcaps (agg, GST_PAD (aggpad), filter);
       gst_query_set_caps_result (query, caps);
       gst_caps_unref (caps);
       res = TRUE;
       break;
     }
     default:
-      res = gst_collect_pads_query_default (pads, pad, query, FALSE);
+      res =
+          GST_AGGREGATOR_CLASS (parent_class)->sink_query (agg, aggpad, query);
       break;
   }
 
@@ -369,10 +350,12 @@
 gst_audiomixer_setcaps (GstAudioMixer * audiomixer, GstPad * pad,
     GstCaps * orig_caps)
 {
+  GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (audiomixer);
   GstCaps *caps;
   GstAudioInfo info;
   GstStructure *s;
   gint channels;
+  gboolean ret;
 
   caps = gst_caps_copy (orig_caps);
 
@@ -389,34 +372,35 @@
    * different upstream threads doing query_caps + accept_caps + sending
    * (possibly different) CAPS events, but there's not much we can do about
    * that, upstream needs to deal with it. */
-  if (audiomixer->current_caps != NULL) {
-    if (gst_audio_info_is_equal (&info, &audiomixer->info)) {
+  if (aagg->current_caps != NULL) {
+    if (gst_audio_info_is_equal (&info, &aagg->info)) {
       GST_OBJECT_UNLOCK (audiomixer);
       gst_caps_unref (caps);
+      gst_audio_aggregator_set_sink_caps (aagg, GST_AUDIO_AGGREGATOR_PAD (pad),
+          orig_caps);
       return TRUE;
     } else {
       GST_DEBUG_OBJECT (pad, "got input caps %" GST_PTR_FORMAT ", but "
-          "current caps are %" GST_PTR_FORMAT, caps, audiomixer->current_caps);
+          "current caps are %" GST_PTR_FORMAT, caps, aagg->current_caps);
       GST_OBJECT_UNLOCK (audiomixer);
       gst_pad_push_event (pad, gst_event_new_reconfigure ());
       gst_caps_unref (caps);
       return FALSE;
     }
   }
-
-  GST_INFO_OBJECT (pad, "setting caps to %" GST_PTR_FORMAT, caps);
-  gst_caps_replace (&audiomixer->current_caps, caps);
-
-  memcpy (&audiomixer->info, &info, sizeof (info));
-  audiomixer->send_caps = TRUE;
   GST_OBJECT_UNLOCK (audiomixer);
-  /* send caps event later, after stream-start event */
+
+  ret = gst_audio_aggregator_set_src_caps (aagg, caps);
+
+  if (ret)
+    gst_audio_aggregator_set_sink_caps (aagg, GST_AUDIO_AGGREGATOR_PAD (pad),
+        orig_caps);
 
   GST_INFO_OBJECT (pad, "handle caps change to %" GST_PTR_FORMAT, caps);
 
   gst_caps_unref (caps);
 
-  return TRUE;
+  return ret;
 
   /* ERRORS */
 invalid_format:
@@ -427,465 +411,14 @@
   }
 }
 
-/* FIXME, the duration query should reflect how long you will produce
- * data, that is the amount of stream time until you will emit EOS.
- *
- * For synchronized mixing this is always the max of all the durations
- * of upstream since we emit EOS when all of them finished.
- *
- * We don't do synchronized mixing so this really depends on where the
- * streams where punched in and what their relative offsets are against
- * eachother which we can get from the first timestamps we see.
- *
- * When we add a new stream (or remove a stream) the duration might
- * also become invalid again and we need to post a new DURATION
- * message to notify this fact to the parent.
- * For now we take the max of all the upstream elements so the simple
- * cases work at least somewhat.
- */
 static gboolean
-gst_audiomixer_query_duration (GstAudioMixer * audiomixer, GstQuery * query)
+gst_audiomixer_sink_event (GstAggregator * agg, GstAggregatorPad * aggpad,
+    GstEvent * event)
 {
-  gint64 max;
-  gboolean res;
-  GstFormat format;
-  GstIterator *it;
-  gboolean done;
-  GValue item = { 0, };
+  GstAudioMixer *audiomixer = GST_AUDIO_MIXER (agg);
+  gboolean res = TRUE;
 
-  /* parse format */
-  gst_query_parse_duration (query, &format, NULL);
-
-  max = -1;
-  res = TRUE;
-  done = FALSE;
-
-  it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (audiomixer));
-  while (!done) {
-    GstIteratorResult ires;
-
-    ires = gst_iterator_next (it, &item);
-    switch (ires) {
-      case GST_ITERATOR_DONE:
-        done = TRUE;
-        break;
-      case GST_ITERATOR_OK:
-      {
-        GstPad *pad = g_value_get_object (&item);
-        gint64 duration;
-
-        /* ask sink peer for duration */
-        res &= gst_pad_peer_query_duration (pad, format, &duration);
-        /* take max from all valid return values */
-        if (res) {
-          /* valid unknown length, stop searching */
-          if (duration == -1) {
-            max = duration;
-            done = TRUE;
-          }
-          /* else see if bigger than current max */
-          else if (duration > max)
-            max = duration;
-        }
-        g_value_reset (&item);
-        break;
-      }
-      case GST_ITERATOR_RESYNC:
-        max = -1;
-        res = TRUE;
-        gst_iterator_resync (it);
-        break;
-      default:
-        res = FALSE;
-        done = TRUE;
-        break;
-    }
-  }
-  g_value_unset (&item);
-  gst_iterator_free (it);
-
-  if (res) {
-    /* and store the max */
-    GST_DEBUG_OBJECT (audiomixer, "Total duration in format %s: %"
-        GST_TIME_FORMAT, gst_format_get_name (format), GST_TIME_ARGS (max));
-    gst_query_set_duration (query, format, max);
-  }
-
-  return res;
-}
-
-static gboolean
-gst_audiomixer_query_latency (GstAudioMixer * audiomixer, GstQuery * query)
-{
-  GstClockTime min, max;
-  gboolean live;
-  gboolean res;
-  GstIterator *it;
-  gboolean done;
-  GValue item = { 0, };
-
-  res = TRUE;
-  done = FALSE;
-
-  live = FALSE;
-  min = 0;
-  max = GST_CLOCK_TIME_NONE;
-
-  /* Take maximum of all latency values */
-  it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (audiomixer));
-  while (!done) {
-    GstIteratorResult ires;
-
-    ires = gst_iterator_next (it, &item);
-    switch (ires) {
-      case GST_ITERATOR_DONE:
-        done = TRUE;
-        break;
-      case GST_ITERATOR_OK:
-      {
-        GstPad *pad = g_value_get_object (&item);
-        GstQuery *peerquery;
-        GstClockTime min_cur, max_cur;
-        gboolean live_cur;
-
-        peerquery = gst_query_new_latency ();
-
-        /* Ask peer for latency */
-        res &= gst_pad_peer_query (pad, peerquery);
-
-        /* take max from all valid return values */
-        if (res) {
-          gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
-
-          if (min_cur > min)
-            min = min_cur;
-
-          if (max_cur != GST_CLOCK_TIME_NONE &&
-              ((max != GST_CLOCK_TIME_NONE && max_cur > max) ||
-                  (max == GST_CLOCK_TIME_NONE)))
-            max = max_cur;
-
-          live = live || live_cur;
-        }
-
-        gst_query_unref (peerquery);
-        g_value_reset (&item);
-        break;
-      }
-      case GST_ITERATOR_RESYNC:
-        live = FALSE;
-        min = 0;
-        max = GST_CLOCK_TIME_NONE;
-        res = TRUE;
-        gst_iterator_resync (it);
-        break;
-      default:
-        res = FALSE;
-        done = TRUE;
-        break;
-    }
-  }
-  g_value_unset (&item);
-  gst_iterator_free (it);
-
-  if (res) {
-    /* store the results */
-    GST_DEBUG_OBJECT (audiomixer, "Calculated total latency: live %s, min %"
-        GST_TIME_FORMAT ", max %" GST_TIME_FORMAT,
-        (live ? "yes" : "no"), GST_TIME_ARGS (min), GST_TIME_ARGS (max));
-    gst_query_set_latency (query, live, min, max);
-  }
-
-  return res;
-}
-
-static gboolean
-gst_audiomixer_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
-{
-  GstAudioMixer *audiomixer = GST_AUDIO_MIXER (parent);
-  gboolean res = FALSE;
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_POSITION:
-    {
-      GstFormat format;
-
-      gst_query_parse_position (query, &format, NULL);
-
-      switch (format) {
-        case GST_FORMAT_TIME:
-          /* FIXME, bring to stream time, might be tricky */
-          gst_query_set_position (query, format, audiomixer->segment.position);
-          res = TRUE;
-          break;
-        case GST_FORMAT_DEFAULT:
-          gst_query_set_position (query, format, audiomixer->offset);
-          res = TRUE;
-          break;
-        default:
-          break;
-      }
-      break;
-    }
-    case GST_QUERY_DURATION:
-      res = gst_audiomixer_query_duration (audiomixer, query);
-      break;
-    case GST_QUERY_LATENCY:
-      res = gst_audiomixer_query_latency (audiomixer, query);
-      break;
-    default:
-      /* FIXME, needs a custom query handler because we have multiple
-       * sinkpads */
-      res = gst_pad_query_default (pad, parent, query);
-      break;
-  }
-
-  return res;
-}
-
-/* event handling */
-
-typedef struct
-{
-  GstEvent *event;
-  gboolean flush;
-} EventData;
-
-/* FIXME: What is this supposed to solve? */
-static gboolean
-forward_event_func (const GValue * val, GValue * ret, EventData * data)
-{
-  GstPad *pad = g_value_get_object (val);
-  GstEvent *event = data->event;
-  GstPad *peer;
-
-  gst_event_ref (event);
-  GST_LOG_OBJECT (pad, "About to send event %s", GST_EVENT_TYPE_NAME (event));
-  peer = gst_pad_get_peer (pad);
-  /* collect pad might have been set flushing,
-   * so bypass core checking that and send directly to peer */
-  if (!peer || !gst_pad_send_event (peer, event)) {
-    if (!peer)
-      gst_event_unref (event);
-    GST_WARNING_OBJECT (pad, "Sending event  %p (%s) failed.",
-        event, GST_EVENT_TYPE_NAME (event));
-    /* 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 (TRUE));
-  } else {
-    g_value_set_boolean (ret, TRUE);
-    GST_LOG_OBJECT (pad, "Sent event  %p (%s).",
-        event, GST_EVENT_TYPE_NAME (event));
-  }
-  if (peer)
-    gst_object_unref (peer);
-
-  /* continue on other pads, even if one failed */
-  return TRUE;
-}
-
-/* forwards the event to all sinkpads, takes ownership of the
- * event
- *
- * Returns: TRUE if the event could be forwarded on all
- * sinkpads.
- */
-static gboolean
-forward_event (GstAudioMixer * audiomixer, GstEvent * event, gboolean flush)
-{
-  gboolean ret;
-  GstIterator *it;
-  GstIteratorResult ires;
-  GValue vret = { 0 };
-  EventData data;
-
-  GST_LOG_OBJECT (audiomixer, "Forwarding event %p (%s)", event,
-      GST_EVENT_TYPE_NAME (event));
-
-  data.event = event;
-  data.flush = flush;
-
-  g_value_init (&vret, G_TYPE_BOOLEAN);
-  g_value_set_boolean (&vret, FALSE);
-  it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (audiomixer));
-  while (TRUE) {
-    ires =
-        gst_iterator_fold (it, (GstIteratorFoldFunction) forward_event_func,
-        &vret, &data);
-    switch (ires) {
-      case GST_ITERATOR_RESYNC:
-        GST_WARNING ("resync");
-        gst_iterator_resync (it);
-        g_value_set_boolean (&vret, TRUE);
-        break;
-      case GST_ITERATOR_OK:
-      case GST_ITERATOR_DONE:
-        ret = g_value_get_boolean (&vret);
-        goto done;
-      default:
-        ret = FALSE;
-        goto done;
-    }
-  }
-done:
-  gst_iterator_free (it);
-  GST_LOG_OBJECT (audiomixer, "Forwarded event %p (%s), ret=%d", event,
-      GST_EVENT_TYPE_NAME (event), ret);
-  gst_event_unref (event);
-
-  return ret;
-}
-
-static gboolean
-gst_audiomixer_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  GstAudioMixer *audiomixer;
-  gboolean result;
-
-  audiomixer = GST_AUDIO_MIXER (parent);
-
-  GST_DEBUG_OBJECT (pad, "Got %s event on src pad",
-      GST_EVENT_TYPE_NAME (event));
-
-  switch (GST_EVENT_TYPE (event)) {
-      /* TODO: Update from videomixer */
-    case GST_EVENT_SEEK:
-    {
-      GstSeekFlags flags;
-      gdouble rate;
-      GstSeekType start_type, stop_type;
-      gint64 start, stop;
-      GstFormat seek_format, dest_format;
-      gboolean flush;
-
-      /* parse the seek parameters */
-      gst_event_parse_seek (event, &rate, &seek_format, &flags, &start_type,
-          &start, &stop_type, &stop);
-
-      if ((start_type != GST_SEEK_TYPE_NONE)
-          && (start_type != GST_SEEK_TYPE_SET)) {
-        result = FALSE;
-        GST_DEBUG_OBJECT (audiomixer,
-            "seeking failed, unhandled seek type for start: %d", start_type);
-        goto done;
-      }
-      if ((stop_type != GST_SEEK_TYPE_NONE) && (stop_type != GST_SEEK_TYPE_SET)) {
-        result = FALSE;
-        GST_DEBUG_OBJECT (audiomixer,
-            "seeking failed, unhandled seek type for end: %d", stop_type);
-        goto done;
-      }
-
-      dest_format = audiomixer->segment.format;
-      if (seek_format != dest_format) {
-        result = FALSE;
-        GST_DEBUG_OBJECT (audiomixer,
-            "seeking failed, unhandled seek format: %d", seek_format);
-        goto done;
-      }
-
-      flush = (flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH;
-
-      /* check if we are flushing */
-      if (flush) {
-        /* flushing seek, start flush downstream, the flush will be done
-         * when all pads received a FLUSH_STOP.
-         * Make sure we accept nothing anymore and return WRONG_STATE.
-         * We send a flush-start before, to ensure no streaming is done
-         * as we need to take the stream lock.
-         */
-        gst_pad_push_event (audiomixer->srcpad, gst_event_new_flush_start ());
-        gst_collect_pads_set_flushing (audiomixer->collect, TRUE);
-
-        /* We can't send FLUSH_STOP here since upstream could start pushing data
-         * after we unlock audiomixer->collect.
-         * We set flush_stop_pending to TRUE instead and send FLUSH_STOP after
-         * forwarding the seek upstream or from gst_audiomixer_collected,
-         * whichever happens first.
-         */
-        GST_COLLECT_PADS_STREAM_LOCK (audiomixer->collect);
-        audiomixer->flush_stop_pending = TRUE;
-        GST_COLLECT_PADS_STREAM_UNLOCK (audiomixer->collect);
-        GST_DEBUG_OBJECT (audiomixer, "mark pending flush stop event");
-      }
-      GST_DEBUG_OBJECT (audiomixer, "handling seek event: %" GST_PTR_FORMAT,
-          event);
-
-      /* now wait for the collected to be finished and mark a new
-       * 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_COLLECT_PADS_STREAM_LOCK (audiomixer->collect);
-      /* clip position and update our segment */
-      if (audiomixer->segment.stop != -1) {
-        audiomixer->segment.position = audiomixer->segment.stop;
-      }
-      gst_segment_do_seek (&audiomixer->segment, rate, seek_format, flags,
-          start_type, start, stop_type, stop, NULL);
-
-      if (flush) {
-        /* Yes, we need to call _set_flushing again *WHEN* the streaming threads
-         * have stopped so that the cookie gets properly updated. */
-        gst_collect_pads_set_flushing (audiomixer->collect, TRUE);
-      }
-      GST_COLLECT_PADS_STREAM_UNLOCK (audiomixer->collect);
-      GST_DEBUG_OBJECT (audiomixer, "forwarding seek event: %" GST_PTR_FORMAT,
-          event);
-      GST_DEBUG_OBJECT (audiomixer, "updated segment: %" GST_SEGMENT_FORMAT,
-          &audiomixer->segment);
-
-      /* we're forwarding seek to all upstream peers and wait for one to reply
-       * with a newsegment-event before we send a newsegment-event downstream */
-      g_atomic_int_set (&audiomixer->segment_pending, TRUE);
-      result = forward_event (audiomixer, event, flush);
-      /* FIXME: We should use the seek segment and forward that downstream next time
-       * not any upstream segment event */
-      if (!result) {
-        /* seek failed. maybe source is a live source. */
-        GST_DEBUG_OBJECT (audiomixer, "seeking failed");
-      }
-      if (g_atomic_int_compare_and_exchange (&audiomixer->flush_stop_pending,
-              TRUE, FALSE)) {
-        GST_DEBUG_OBJECT (audiomixer, "pending flush stop");
-        if (!gst_pad_push_event (audiomixer->srcpad,
-                gst_event_new_flush_stop (TRUE))) {
-          GST_WARNING_OBJECT (audiomixer, "Sending flush stop event failed");
-        }
-      }
-      break;
-    }
-    case GST_EVENT_QOS:
-      /* QoS might be tricky */
-      result = FALSE;
-      gst_event_unref (event);
-      break;
-    case GST_EVENT_NAVIGATION:
-      /* navigation is rather pointless. */
-      result = FALSE;
-      gst_event_unref (event);
-      break;
-    default:
-      /* just forward the rest for now */
-      GST_DEBUG_OBJECT (audiomixer, "forward unhandled event: %s",
-          GST_EVENT_TYPE_NAME (event));
-      result = forward_event (audiomixer, event, FALSE);
-      break;
-  }
-
-done:
-
-  return result;
-}
-
-static gboolean
-gst_audiomixer_sink_event (GstCollectPads * pads, GstCollectData * pad,
-    GstEvent * event, gpointer user_data)
-{
-  GstAudioMixer *audiomixer = GST_AUDIO_MIXER (user_data);
-  GstAudioMixerCollect *adata = (GstAudioMixerCollect *) pad;
-  gboolean res = TRUE, discard = FALSE;
-
-  GST_DEBUG_OBJECT (pad->pad, "Got %s event on sink pad",
+  GST_DEBUG_OBJECT (aggpad, "Got %s event on sink pad",
       GST_EVENT_TYPE_NAME (event));
 
   switch (GST_EVENT_TYPE (event)) {
@@ -894,83 +427,19 @@
       GstCaps *caps;
 
       gst_event_parse_caps (event, &caps);
-      res = gst_audiomixer_setcaps (audiomixer, pad->pad, caps);
+      res = gst_audiomixer_setcaps (audiomixer, GST_PAD_CAST (aggpad), caps);
       gst_event_unref (event);
       event = NULL;
       break;
     }
-      /* FIXME: Who cares about flushes from upstream? We should
-       * not forward them at all */
-    case GST_EVENT_FLUSH_START:
-      /* ensure that we will send a flush stop */
-      GST_COLLECT_PADS_STREAM_LOCK (audiomixer->collect);
-      audiomixer->flush_stop_pending = TRUE;
-      res = gst_collect_pads_event_default (pads, pad, event, discard);
-      event = NULL;
-      GST_COLLECT_PADS_STREAM_UNLOCK (audiomixer->collect);
-      break;
-    case GST_EVENT_FLUSH_STOP:
-      /* we received a flush-stop. We will only forward it when
-       * flush_stop_pending is set, and we will unset it then.
-       */
-      g_atomic_int_set (&audiomixer->segment_pending, TRUE);
-      GST_COLLECT_PADS_STREAM_LOCK (audiomixer->collect);
-      if (audiomixer->flush_stop_pending) {
-        GST_DEBUG_OBJECT (pad->pad, "forwarding flush stop");
-        res = gst_collect_pads_event_default (pads, pad, event, discard);
-        audiomixer->flush_stop_pending = FALSE;
-        event = NULL;
-        gst_buffer_replace (&audiomixer->current_buffer, NULL);
-        audiomixer->discont_time = GST_CLOCK_TIME_NONE;
-      } else {
-        discard = TRUE;
-        GST_DEBUG_OBJECT (pad->pad, "eating flush stop");
-      }
-      GST_COLLECT_PADS_STREAM_UNLOCK (audiomixer->collect);
-      /* Clear pending tags */
-      if (audiomixer->pending_events) {
-        g_list_foreach (audiomixer->pending_events, (GFunc) gst_event_unref,
-            NULL);
-        g_list_free (audiomixer->pending_events);
-        audiomixer->pending_events = NULL;
-      }
-      adata->position = adata->size = 0;
-      adata->output_offset = adata->next_offset = -1;
-      gst_buffer_replace (&adata->buffer, NULL);
-      break;
-    case GST_EVENT_TAG:
-      /* collect tags here so we can push them out when we collect data */
-      audiomixer->pending_events =
-          g_list_append (audiomixer->pending_events, event);
-      event = NULL;
-      break;
-    case GST_EVENT_SEGMENT:{
-      const GstSegment *segment;
-      gst_event_parse_segment (event, &segment);
-      if (segment->rate != audiomixer->segment.rate) {
-        GST_ERROR_OBJECT (pad->pad,
-            "Got segment event with wrong rate %lf, expected %lf",
-            segment->rate, audiomixer->segment.rate);
-        res = FALSE;
-        gst_event_unref (event);
-        event = NULL;
-      } else if (segment->rate < 0.0) {
-        GST_ERROR_OBJECT (pad->pad, "Negative rates not supported yet");
-        res = FALSE;
-        gst_event_unref (event);
-        event = NULL;
-      }
-      discard = TRUE;
-      break;
-    }
     default:
       break;
   }
 
-  if (G_LIKELY (event))
-    return gst_collect_pads_event_default (pads, pad, event, discard);
-  else
-    return res;
+  if (event != NULL)
+    return GST_AGGREGATOR_CLASS (parent_class)->sink_event (agg, aggpad, event);
+
+  return res;
 }
 
 static void
@@ -978,6 +447,8 @@
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
   GstElementClass *gstelement_class = (GstElementClass *) klass;
+  GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
+  GstAudioAggregatorClass *aagg_class = (GstAudioAggregatorClass *) klass;
 
   gobject_class->set_property = gst_audiomixer_set_property;
   gobject_class->get_property = gst_audiomixer_get_property;
@@ -989,25 +460,6 @@
           "Setting this property takes a reference to the supplied GstCaps "
           "object", GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  g_object_class_install_property (gobject_class, PROP_ALIGNMENT_THRESHOLD,
-      g_param_spec_uint64 ("alignment-threshold", "Alignment Threshold",
-          "Timestamp alignment threshold in nanoseconds", 0,
-          G_MAXUINT64 - 1, DEFAULT_ALIGNMENT_THRESHOLD,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_DISCONT_WAIT,
-      g_param_spec_uint64 ("discont-wait", "Discont Wait",
-          "Window of time in nanoseconds to wait before "
-          "creating a discontinuity", 0,
-          G_MAXUINT64 - 1, DEFAULT_DISCONT_WAIT,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, PROP_BLOCKSIZE,
-      g_param_spec_uint ("blocksize", "Block Size",
-          "Output block size in number of samples", 0,
-          G_MAXUINT, DEFAULT_BLOCKSIZE,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&gst_audiomixer_src_template));
   gst_element_class_add_pad_template (gstelement_class,
@@ -1021,45 +473,19 @@
       GST_DEBUG_FUNCPTR (gst_audiomixer_request_new_pad);
   gstelement_class->release_pad =
       GST_DEBUG_FUNCPTR (gst_audiomixer_release_pad);
-  gstelement_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_audiomixer_change_state);
+
+  agg_class->sinkpads_type = GST_TYPE_AUDIO_MIXER_PAD;
+
+  agg_class->sink_query = GST_DEBUG_FUNCPTR (gst_audiomixer_sink_query);
+  agg_class->sink_event = GST_DEBUG_FUNCPTR (gst_audiomixer_sink_event);
+
+  aagg_class->aggregate_one_buffer = gst_audiomixer_aggregate_one_buffer;
 }
 
 static void
 gst_audiomixer_init (GstAudioMixer * audiomixer)
 {
-  GstPadTemplate *template;
-
-  template = gst_static_pad_template_get (&gst_audiomixer_src_template);
-  audiomixer->srcpad = gst_pad_new_from_template (template, "src");
-  gst_object_unref (template);
-
-  gst_pad_set_query_function (audiomixer->srcpad,
-      GST_DEBUG_FUNCPTR (gst_audiomixer_src_query));
-  gst_pad_set_event_function (audiomixer->srcpad,
-      GST_DEBUG_FUNCPTR (gst_audiomixer_src_event));
-  GST_PAD_SET_PROXY_CAPS (audiomixer->srcpad);
-  gst_element_add_pad (GST_ELEMENT (audiomixer), audiomixer->srcpad);
-
-  audiomixer->current_caps = NULL;
-  gst_audio_info_init (&audiomixer->info);
-  audiomixer->padcount = 0;
-
   audiomixer->filter_caps = NULL;
-  audiomixer->alignment_threshold = DEFAULT_ALIGNMENT_THRESHOLD;
-  audiomixer->discont_wait = DEFAULT_DISCONT_WAIT;
-  audiomixer->blocksize = DEFAULT_BLOCKSIZE;
-
-  /* keep track of the sinkpads requested */
-  audiomixer->collect = gst_collect_pads_new ();
-  gst_collect_pads_set_function (audiomixer->collect,
-      GST_DEBUG_FUNCPTR (gst_audiomixer_collected), audiomixer);
-  gst_collect_pads_set_clip_function (audiomixer->collect,
-      GST_DEBUG_FUNCPTR (gst_audiomixer_do_clip), audiomixer);
-  gst_collect_pads_set_event_function (audiomixer->collect,
-      GST_DEBUG_FUNCPTR (gst_audiomixer_sink_event), audiomixer);
-  gst_collect_pads_set_query_function (audiomixer->collect,
-      GST_DEBUG_FUNCPTR (gst_audiomixer_sink_query), audiomixer);
 }
 
 static void
@@ -1067,18 +493,7 @@
 {
   GstAudioMixer *audiomixer = GST_AUDIO_MIXER (object);
 
-  if (audiomixer->collect) {
-    gst_object_unref (audiomixer->collect);
-    audiomixer->collect = NULL;
-  }
   gst_caps_replace (&audiomixer->filter_caps, NULL);
-  gst_caps_replace (&audiomixer->current_caps, NULL);
-
-  if (audiomixer->pending_events) {
-    g_list_foreach (audiomixer->pending_events, (GFunc) gst_event_unref, NULL);
-    g_list_free (audiomixer->pending_events);
-    audiomixer->pending_events = NULL;
-  }
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
@@ -1111,15 +526,6 @@
       GST_DEBUG_OBJECT (audiomixer, "set new caps %" GST_PTR_FORMAT, new_caps);
       break;
     }
-    case PROP_ALIGNMENT_THRESHOLD:
-      audiomixer->alignment_threshold = g_value_get_uint64 (value);
-      break;
-    case PROP_DISCONT_WAIT:
-      audiomixer->discont_wait = g_value_get_uint64 (value);
-      break;
-    case PROP_BLOCKSIZE:
-      audiomixer->blocksize = g_value_get_uint (value);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1138,84 +544,33 @@
       gst_value_set_caps (value, audiomixer->filter_caps);
       GST_OBJECT_UNLOCK (audiomixer);
       break;
-    case PROP_ALIGNMENT_THRESHOLD:
-      g_value_set_uint64 (value, audiomixer->alignment_threshold);
-      break;
-    case PROP_DISCONT_WAIT:
-      g_value_set_uint64 (value, audiomixer->discont_wait);
-      break;
-    case PROP_BLOCKSIZE:
-      g_value_set_uint (value, audiomixer->blocksize);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
   }
 }
 
-static void
-free_pad (GstCollectData * data)
-{
-  GstAudioMixerCollect *adata = (GstAudioMixerCollect *) data;
-
-  gst_buffer_replace (&adata->buffer, NULL);
-}
-
 static GstPad *
 gst_audiomixer_request_new_pad (GstElement * element, GstPadTemplate * templ,
-    const gchar * unused, const GstCaps * caps)
+    const gchar * req_name, const GstCaps * caps)
 {
-  gchar *name;
-  GstAudioMixer *audiomixer;
-  GstPad *newpad;
-  gint padcount;
-  GstCollectData *cdata;
-  GstAudioMixerCollect *adata;
+  GstAudioMixerPad *newpad;
 
-  if (templ->direction != GST_PAD_SINK)
-    goto not_sink;
+  newpad = (GstAudioMixerPad *)
+      GST_ELEMENT_CLASS (parent_class)->request_new_pad (element,
+      templ, req_name, caps);
 
-  audiomixer = GST_AUDIO_MIXER (element);
+  if (newpad == NULL)
+    goto could_not_create;
 
-  /* increment pad counter */
-  padcount = g_atomic_int_add (&audiomixer->padcount, 1);
-
-  name = g_strdup_printf ("sink_%u", padcount);
-  newpad = g_object_new (GST_TYPE_AUDIO_MIXER_PAD, "name", name, "direction",
-      templ->direction, "template", templ, NULL);
-  GST_DEBUG_OBJECT (audiomixer, "request new pad %s", name);
-  g_free (name);
-
-  cdata =
-      gst_collect_pads_add_pad (audiomixer->collect, newpad,
-      sizeof (GstAudioMixerCollect), free_pad, TRUE);
-  adata = (GstAudioMixerCollect *) cdata;
-  adata->buffer = NULL;
-  adata->position = 0;
-  adata->size = 0;
-  adata->output_offset = -1;
-  adata->next_offset = -1;
-
-  /* takes ownership of the pad */
-  if (!gst_element_add_pad (GST_ELEMENT (audiomixer), newpad))
-    goto could_not_add;
-
-  gst_child_proxy_child_added (GST_CHILD_PROXY (audiomixer), G_OBJECT (newpad),
+  gst_child_proxy_child_added (GST_CHILD_PROXY (element), G_OBJECT (newpad),
       GST_OBJECT_NAME (newpad));
 
-  return newpad;
+  return GST_PAD_CAST (newpad);
 
-  /* errors */
-not_sink:
+could_not_create:
   {
-    g_warning ("gstaudiomixer: request new pad that is not a SINK pad\n");
-    return NULL;
-  }
-could_not_add:
-  {
-    GST_DEBUG_OBJECT (audiomixer, "could not add pad");
-    gst_collect_pads_remove_pad (audiomixer->collect, newpad);
-    gst_object_unref (newpad);
+    GST_DEBUG_OBJECT (element, "could not create/add  pad");
     return NULL;
   }
 }
@@ -1231,324 +586,122 @@
 
   gst_child_proxy_child_removed (GST_CHILD_PROXY (audiomixer), G_OBJECT (pad),
       GST_OBJECT_NAME (pad));
-  if (audiomixer->collect)
-    gst_collect_pads_remove_pad (audiomixer->collect, pad);
-  gst_element_remove_pad (element, pad);
+
+  GST_ELEMENT_CLASS (parent_class)->release_pad (element, pad);
 }
 
-static GstFlowReturn
-gst_audiomixer_do_clip (GstCollectPads * pads, GstCollectData * data,
-    GstBuffer * buffer, GstBuffer ** out, gpointer user_data)
-{
-  GstAudioMixer *audiomixer = GST_AUDIO_MIXER (user_data);
-  gint rate, bpf;
 
-  rate = GST_AUDIO_INFO_RATE (&audiomixer->info);
-  bpf = GST_AUDIO_INFO_BPF (&audiomixer->info);
-
-  buffer = gst_audio_buffer_clip (buffer, &data->segment, rate, bpf);
-
-  *out = buffer;
-  return GST_FLOW_OK;
-}
-
+/* Called with object lock and pad object lock held */
 static gboolean
-gst_audio_mixer_fill_buffer (GstAudioMixer * audiomixer, GstCollectPads * pads,
-    GstCollectData * collect_data, GstAudioMixerCollect * adata,
-    GstBuffer * inbuf)
+gst_audiomixer_aggregate_one_buffer (GstAudioAggregator * aagg,
+    GstAudioAggregatorPad * aaggpad, GstBuffer * inbuf, guint in_offset,
+    GstBuffer * outbuf, guint out_offset, guint num_frames)
 {
-  GstClockTime start_time, end_time;
-  gboolean discont = FALSE;
-  guint64 start_offset, end_offset;
-  GstClockTime timestamp, stream_time;
-  gint rate, bpf;
-
-  g_assert (adata->buffer == NULL);
-
-  rate = GST_AUDIO_INFO_RATE (&audiomixer->info);
-  bpf = GST_AUDIO_INFO_BPF (&audiomixer->info);
-
-  timestamp = GST_BUFFER_TIMESTAMP (inbuf);
-  stream_time =
-      gst_segment_to_stream_time (&collect_data->segment, GST_FORMAT_TIME,
-      timestamp);
-
-  /* sync object properties on stream time */
-  /* TODO: Ideally we would want to do that on every sample */
-  if (GST_CLOCK_TIME_IS_VALID (stream_time))
-    gst_object_sync_values (GST_OBJECT (collect_data->pad), stream_time);
-
-  adata->position = 0;
-  adata->size = gst_buffer_get_size (inbuf);
-
-  start_time = GST_BUFFER_TIMESTAMP (inbuf);
-  end_time =
-      start_time + gst_util_uint64_scale_ceil (adata->size / bpf,
-      GST_SECOND, rate);
-
-  start_offset = gst_util_uint64_scale (start_time, rate, GST_SECOND);
-  end_offset = start_offset + adata->size / bpf;
-
-  if (GST_BUFFER_IS_DISCONT (inbuf)
-      || GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_RESYNC)
-      || adata->next_offset == -1) {
-    discont = TRUE;
-  } else {
-    guint64 diff, max_sample_diff;
-
-    /* Check discont, based on audiobasesink */
-    if (start_offset <= adata->next_offset)
-      diff = adata->next_offset - start_offset;
-    else
-      diff = start_offset - adata->next_offset;
-
-    max_sample_diff =
-        gst_util_uint64_scale_int (audiomixer->alignment_threshold, rate,
-        GST_SECOND);
-
-    /* Discont! */
-    if (G_UNLIKELY (diff >= max_sample_diff)) {
-      if (audiomixer->discont_wait > 0) {
-        if (audiomixer->discont_time == GST_CLOCK_TIME_NONE) {
-          audiomixer->discont_time = start_time;
-        } else if (start_time - audiomixer->discont_time >=
-            audiomixer->discont_wait) {
-          discont = TRUE;
-          audiomixer->discont_time = GST_CLOCK_TIME_NONE;
-        }
-      } else {
-        discont = TRUE;
-      }
-    } else if (G_UNLIKELY (audiomixer->discont_time != GST_CLOCK_TIME_NONE)) {
-      /* we have had a discont, but are now back on track! */
-      audiomixer->discont_time = GST_CLOCK_TIME_NONE;
-    }
-  }
-
-  if (discont) {
-    /* Have discont, need resync */
-    if (adata->next_offset != -1)
-      GST_INFO_OBJECT (collect_data->pad, "Have discont. Expected %"
-          G_GUINT64_FORMAT ", got %" G_GUINT64_FORMAT,
-          adata->next_offset, start_offset);
-    adata->output_offset = -1;
-  } else {
-    audiomixer->discont_time = GST_CLOCK_TIME_NONE;
-  }
-
-  adata->next_offset = end_offset;
-
-  if (adata->output_offset == -1) {
-    GstClockTime start_running_time;
-    GstClockTime end_running_time;
-    guint64 start_running_time_offset;
-    guint64 end_running_time_offset;
-
-    start_running_time =
-        gst_segment_to_running_time (&collect_data->segment,
-        GST_FORMAT_TIME, start_time);
-    end_running_time =
-        gst_segment_to_running_time (&collect_data->segment,
-        GST_FORMAT_TIME, end_time);
-    start_running_time_offset =
-        gst_util_uint64_scale (start_running_time, rate, GST_SECOND);
-    end_running_time_offset =
-        gst_util_uint64_scale (end_running_time, rate, GST_SECOND);
-
-    if (end_running_time_offset < audiomixer->offset) {
-      /* Before output segment, drop */
-      gst_buffer_unref (inbuf);
-      adata->buffer = NULL;
-      gst_buffer_unref (gst_collect_pads_pop (pads, collect_data));
-      adata->position = 0;
-      adata->size = 0;
-      adata->output_offset = -1;
-      GST_DEBUG_OBJECT (collect_data->pad,
-          "Buffer before segment or current position: %" G_GUINT64_FORMAT " < %"
-          G_GUINT64_FORMAT, end_running_time_offset, audiomixer->offset);
-      return FALSE;
-    }
-
-    if (start_running_time_offset < audiomixer->offset) {
-      guint diff = (audiomixer->offset - start_running_time_offset) * bpf;
-      adata->position += diff;
-      adata->size -= diff;
-      /* FIXME: This could only happen due to rounding errors */
-      if (adata->size == 0) {
-        /* Empty buffer, drop */
-        gst_buffer_unref (inbuf);
-        adata->buffer = NULL;
-        gst_buffer_unref (gst_collect_pads_pop (pads, collect_data));
-        adata->position = 0;
-        adata->size = 0;
-        adata->output_offset = -1;
-        GST_DEBUG_OBJECT (collect_data->pad,
-            "Buffer before segment or current position: %" G_GUINT64_FORMAT
-            " < %" G_GUINT64_FORMAT, end_running_time_offset,
-            audiomixer->offset);
-        return FALSE;
-      }
-    }
-
-    adata->output_offset = MAX (start_running_time_offset, audiomixer->offset);
-    GST_DEBUG_OBJECT (collect_data->pad,
-        "Buffer resynced: Pad offset %" G_GUINT64_FORMAT
-        ", current mixer offset %" G_GUINT64_FORMAT, adata->output_offset,
-        audiomixer->offset);
-  }
-
-  GST_LOG_OBJECT (collect_data->pad,
-      "Queued new buffer at offset %" G_GUINT64_FORMAT, adata->output_offset);
-  adata->buffer = inbuf;
-
-  return TRUE;
-}
-
-static void
-gst_audio_mixer_mix_buffer (GstAudioMixer * audiomixer, GstCollectPads * pads,
-    GstCollectData * collect_data, GstAudioMixerCollect * adata,
-    GstMapInfo * outmap)
-{
-  GstAudioMixerPad *pad = GST_AUDIO_MIXER_PAD (adata->collect.pad);
-  guint overlap;
-  guint out_start;
-  GstBuffer *inbuf;
+  GstAudioMixerPad *pad = GST_AUDIO_MIXER_PAD (aaggpad);
   GstMapInfo inmap;
+  GstMapInfo outmap;
   gint bpf;
 
-  bpf = GST_AUDIO_INFO_BPF (&audiomixer->info);
-
-  /* Overlap => mix */
-  if (audiomixer->offset < adata->output_offset)
-    out_start = adata->output_offset - audiomixer->offset;
-  else
-    out_start = 0;
-
-  overlap = adata->size / bpf - adata->position / bpf;
-  if (overlap > audiomixer->blocksize - out_start)
-    overlap = audiomixer->blocksize - out_start;
-
-  inbuf = gst_collect_pads_peek (pads, collect_data);
-  g_assert (inbuf != NULL && inbuf == adata->buffer);
-
-  GST_OBJECT_LOCK (pad);
   if (pad->mute || pad->volume < G_MINDOUBLE) {
     GST_DEBUG_OBJECT (pad, "Skipping muted pad");
-    gst_buffer_unref (inbuf);
-    adata->position += overlap * bpf;
-    adata->output_offset += overlap;
-    if (adata->position >= adata->size) {
-      /* Buffer done, drop it */
-      gst_buffer_replace (&adata->buffer, NULL);
-      gst_buffer_unref (gst_collect_pads_pop (pads, collect_data));
-    }
-    GST_OBJECT_UNLOCK (pad);
-    return;
+    return FALSE;
   }
 
-  if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
-    /* skip gap buffer */
-    GST_LOG_OBJECT (pad, "skipping GAP buffer");
-    gst_buffer_unref (inbuf);
-    adata->output_offset += adata->size / bpf;
-    /* Buffer done, drop it */
-    gst_buffer_replace (&adata->buffer, NULL);
-    gst_buffer_unref (gst_collect_pads_pop (pads, collect_data));
-    GST_OBJECT_UNLOCK (pad);
-    return;
-  }
+  bpf = GST_AUDIO_INFO_BPF (&aagg->info);
 
+  gst_buffer_map (outbuf, &outmap, GST_MAP_READWRITE);
   gst_buffer_map (inbuf, &inmap, GST_MAP_READ);
   GST_LOG_OBJECT (pad, "mixing %u bytes at offset %u from offset %u",
-      overlap * bpf, out_start * bpf, adata->position);
+      num_frames * bpf, out_offset * bpf, in_offset * bpf);
+
   /* further buffers, need to add them */
   if (pad->volume == 1.0) {
-    switch (audiomixer->info.finfo->format) {
+    switch (aagg->info.finfo->format) {
       case GST_AUDIO_FORMAT_U8:
-        audiomixer_orc_add_u8 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_u8 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_S8:
-        audiomixer_orc_add_s8 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_s8 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_U16:
-        audiomixer_orc_add_u16 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_u16 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_S16:
-        audiomixer_orc_add_s16 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_s16 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_U32:
-        audiomixer_orc_add_u32 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_u32 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_S32:
-        audiomixer_orc_add_s32 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_s32 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_F32:
-        audiomixer_orc_add_f32 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_f32 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_F64:
-        audiomixer_orc_add_f64 ((gpointer) (outmap->data + out_start * bpf),
-            (gpointer) (inmap.data + adata->position),
-            overlap * audiomixer->info.channels);
+        audiomixer_orc_add_f64 ((gpointer) (outmap.data + out_offset * bpf),
+            (gpointer) (inmap.data + in_offset * bpf),
+            num_frames * aagg->info.channels);
         break;
       default:
         g_assert_not_reached ();
         break;
     }
   } else {
-    switch (audiomixer->info.finfo->format) {
+    switch (aagg->info.finfo->format) {
       case GST_AUDIO_FORMAT_U8:
-        audiomixer_orc_add_volume_u8 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume_i8, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_u8 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume_i8, num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_S8:
-        audiomixer_orc_add_volume_s8 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume_i8, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_s8 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume_i8, num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_U16:
-        audiomixer_orc_add_volume_u16 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume_i16, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_u16 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume_i16, num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_S16:
-        audiomixer_orc_add_volume_s16 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume_i16, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_s16 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume_i16, num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_U32:
-        audiomixer_orc_add_volume_u32 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume_i32, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_u32 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume_i32, num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_S32:
-        audiomixer_orc_add_volume_s32 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume_i32, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_s32 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume_i32, num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_F32:
-        audiomixer_orc_add_volume_f32 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_f32 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume, num_frames * aagg->info.channels);
         break;
       case GST_AUDIO_FORMAT_F64:
-        audiomixer_orc_add_volume_f64 ((gpointer) (outmap->data +
-                out_start * bpf), (gpointer) (inmap.data + adata->position),
-            pad->volume, overlap * audiomixer->info.channels);
+        audiomixer_orc_add_volume_f64 ((gpointer) (outmap.data +
+                out_offset * bpf), (gpointer) (inmap.data + in_offset * bpf),
+            pad->volume, num_frames * aagg->info.channels);
         break;
       default:
         g_assert_not_reached ();
@@ -1556,392 +709,11 @@
     }
   }
   gst_buffer_unmap (inbuf, &inmap);
-  gst_buffer_unref (inbuf);
-
-  adata->position += overlap * bpf;
-  adata->output_offset += overlap;
-
-  if (adata->position == adata->size) {
-    /* Buffer done, drop it */
-    gst_buffer_replace (&adata->buffer, NULL);
-    gst_buffer_unref (gst_collect_pads_pop (pads, collect_data));
-    GST_DEBUG_OBJECT (pad, "Finished mixing buffer, waiting for next");
-  }
-
-  GST_OBJECT_UNLOCK (pad);
-}
-
-static GstFlowReturn
-gst_audiomixer_collected (GstCollectPads * pads, gpointer user_data)
-{
-  /* Get all pads that have data for us and store them in a
-   * new list.
-   *
-   * Calculate the current output offset/timestamp and
-   * offset_end/timestamp_end. Allocate a silence buffer
-   * for this and store it.
-   *
-   * For all pads:
-   * 1) Once per input buffer (cached)
-   *   1) Check discont (flag and timestamp with tolerance)
-   *   2) If discont or new, resync. That means:
-   *     1) Drop all start data of the buffer that comes before
-   *        the current position/offset.
-   *     2) Calculate the offset (output segment!) that the first
-   *        frame of the input buffer corresponds to. Base this on
-   *        the running time.
-   *
-   * 2) If the current pad's offset/offset_end overlaps with the output
-   *    offset/offset_end, mix it at the appropiate position in the output
-   *    buffer and advance the pad's position. Remember if this pad needs
-   *    a new buffer to advance behind the output offset_end.
-   *
-   * 3) If we had no pad with a buffer, go EOS.
-   *
-   * 4) If we had at least one pad that did not advance behind output
-   *    offset_end, let collected be called again for the current
-   *    output offset/offset_end.
-   */
-  GstAudioMixer *audiomixer;
-  GSList *collected;
-  GstFlowReturn ret;
-  GstBuffer *outbuf = NULL;
-  GstMapInfo outmap;
-  gint64 next_offset;
-  gint64 next_timestamp;
-  gint rate, bpf;
-  gboolean dropped = FALSE;
-  gboolean is_eos = TRUE;
-  gboolean is_done = TRUE;
-
-  audiomixer = GST_AUDIO_MIXER (user_data);
-
-  /* this is fatal */
-  if (G_UNLIKELY (audiomixer->info.finfo->format == GST_AUDIO_FORMAT_UNKNOWN))
-    goto not_negotiated;
-
-  if (audiomixer->flush_stop_pending == TRUE) {
-    GST_INFO_OBJECT (audiomixer->srcpad, "send pending flush stop event");
-    if (!gst_pad_push_event (audiomixer->srcpad,
-            gst_event_new_flush_stop (TRUE))) {
-      GST_WARNING_OBJECT (audiomixer->srcpad,
-          "Sending flush stop event failed");
-    }
-
-    audiomixer->flush_stop_pending = FALSE;
-    gst_buffer_replace (&audiomixer->current_buffer, NULL);
-    audiomixer->discont_time = GST_CLOCK_TIME_NONE;
-  }
-
-  if (audiomixer->send_stream_start) {
-    gchar s_id[32];
-    GstEvent *event;
-
-    GST_INFO_OBJECT (audiomixer->srcpad, "send pending stream start event");
-    /* FIXME: create id based on input ids, we can't use 
-     * gst_pad_create_stream_id() though as that only handles 0..1 sink-pad
-     */
-    g_snprintf (s_id, sizeof (s_id), "audiomixer-%08x", g_random_int ());
-    event = gst_event_new_stream_start (s_id);
-    gst_event_set_group_id (event, gst_util_group_id_next ());
-
-    if (!gst_pad_push_event (audiomixer->srcpad, event)) {
-      GST_WARNING_OBJECT (audiomixer->srcpad,
-          "Sending stream start event failed");
-    }
-    audiomixer->send_stream_start = FALSE;
-  }
-
-  if (audiomixer->send_caps) {
-    GstEvent *caps_event;
-
-    caps_event = gst_event_new_caps (audiomixer->current_caps);
-    GST_INFO_OBJECT (audiomixer->srcpad,
-        "send pending caps event %" GST_PTR_FORMAT, caps_event);
-    if (!gst_pad_push_event (audiomixer->srcpad, caps_event)) {
-      GST_WARNING_OBJECT (audiomixer->srcpad, "Sending caps event failed");
-    }
-    audiomixer->send_caps = FALSE;
-  }
-
-  rate = GST_AUDIO_INFO_RATE (&audiomixer->info);
-  bpf = GST_AUDIO_INFO_BPF (&audiomixer->info);
-
-  if (g_atomic_int_compare_and_exchange (&audiomixer->segment_pending, TRUE,
-          FALSE)) {
-    GstEvent *event;
-
-    /* 
-     * When seeking we set the start and stop positions as given in the seek
-     * event. We also adjust offset & timestamp accordingly.
-     * This basically ignores all newsegments sent by upstream.
-     *
-     * FIXME: We require that all inputs have the same rate currently
-     * as we do no rate conversion!
-     */
-    event = gst_event_new_segment (&audiomixer->segment);
-    if (audiomixer->segment.rate > 0.0) {
-      audiomixer->segment.position = audiomixer->segment.start;
-    } else {
-      audiomixer->segment.position = audiomixer->segment.stop;
-    }
-    audiomixer->offset = gst_util_uint64_scale (audiomixer->segment.position,
-        rate, GST_SECOND);
-
-    GST_INFO_OBJECT (audiomixer->srcpad, "sending pending new segment event %"
-        GST_SEGMENT_FORMAT, &audiomixer->segment);
-    if (event) {
-      if (!gst_pad_push_event (audiomixer->srcpad, event)) {
-        GST_WARNING_OBJECT (audiomixer->srcpad,
-            "Sending new segment event failed");
-      }
-    } else {
-      GST_WARNING_OBJECT (audiomixer->srcpad, "Creating new segment event for "
-          "start:%" G_GINT64_FORMAT "  end:%" G_GINT64_FORMAT " failed",
-          audiomixer->segment.start, audiomixer->segment.stop);
-    }
-  }
-
-  if (G_UNLIKELY (audiomixer->pending_events)) {
-    GList *tmp = audiomixer->pending_events;
-
-    while (tmp) {
-      GstEvent *ev = (GstEvent *) tmp->data;
-
-      gst_pad_push_event (audiomixer->srcpad, ev);
-      tmp = g_list_next (tmp);
-    }
-    g_list_free (audiomixer->pending_events);
-    audiomixer->pending_events = NULL;
-  }
-
-  /* for the next timestamp, use the sample counter, which will
-   * never accumulate rounding errors */
-
-  /* FIXME: Reverse mixing does not work at all yet */
-  if (audiomixer->segment.rate > 0.0) {
-    next_offset = audiomixer->offset + audiomixer->blocksize;
-  } else {
-    next_offset = audiomixer->offset - audiomixer->blocksize;
-  }
-
-  next_timestamp = gst_util_uint64_scale (next_offset, GST_SECOND, rate);
-
-  if (audiomixer->current_buffer) {
-    outbuf = audiomixer->current_buffer;
-  } else {
-    outbuf = gst_buffer_new_and_alloc (audiomixer->blocksize * bpf);
-    gst_buffer_map (outbuf, &outmap, GST_MAP_WRITE);
-    gst_audio_format_fill_silence (audiomixer->info.finfo, outmap.data,
-        outmap.size);
-    gst_buffer_unmap (outbuf, &outmap);
-    audiomixer->current_buffer = outbuf;
-  }
-
-  GST_LOG_OBJECT (audiomixer,
-      "Starting to mix %u samples for offset %" G_GUINT64_FORMAT
-      " with timestamp %" GST_TIME_FORMAT, audiomixer->blocksize,
-      audiomixer->offset, GST_TIME_ARGS (audiomixer->segment.position));
-
-  gst_buffer_map (outbuf, &outmap, GST_MAP_READWRITE);
-
-  for (collected = pads->data; collected; collected = collected->next) {
-    GstCollectData *collect_data;
-    GstAudioMixerCollect *adata;
-    GstBuffer *inbuf;
-
-    collect_data = (GstCollectData *) collected->data;
-    adata = (GstAudioMixerCollect *) collect_data;
-
-    inbuf = gst_collect_pads_peek (pads, collect_data);
-    if (!inbuf)
-      continue;
-
-    /* New buffer? */
-    if (!adata->buffer || adata->buffer != inbuf) {
-      /* Takes ownership of buffer */
-      if (!gst_audio_mixer_fill_buffer (audiomixer, pads, collect_data, adata,
-              inbuf)) {
-        dropped = TRUE;
-        continue;
-      }
-    } else {
-      gst_buffer_unref (inbuf);
-    }
-
-    if (!adata->buffer && !dropped
-        && GST_COLLECT_PADS_STATE_IS_SET (&adata->collect,
-            GST_COLLECT_PADS_STATE_EOS)) {
-      GST_DEBUG_OBJECT (collect_data->pad, "Pad is in EOS state");
-    } else {
-      is_eos = FALSE;
-    }
-
-    /* At this point adata->output_offset >= audiomixer->offset or we have no buffer anymore */
-    if (adata->output_offset >= audiomixer->offset
-        && adata->output_offset <
-        audiomixer->offset + audiomixer->blocksize && adata->buffer) {
-      GST_LOG_OBJECT (collect_data->pad, "Mixing buffer for current offset");
-      gst_audio_mixer_mix_buffer (audiomixer, pads, collect_data, adata,
-          &outmap);
-      if (adata->output_offset >= next_offset) {
-        GST_DEBUG_OBJECT (collect_data->pad,
-            "Pad is after current offset: %" G_GUINT64_FORMAT " >= %"
-            G_GUINT64_FORMAT, adata->output_offset, next_offset);
-      } else {
-        is_done = FALSE;
-      }
-    }
-  }
-
   gst_buffer_unmap (outbuf, &outmap);
 
-  if (dropped) {
-    /* We dropped a buffer, retry */
-    GST_DEBUG_OBJECT (audiomixer,
-        "A pad dropped a buffer, wait for the next one");
-    return GST_FLOW_OK;
-  }
-
-  if (!is_done && !is_eos) {
-    /* Get more buffers */
-    GST_DEBUG_OBJECT (audiomixer,
-        "We're not done yet for the current offset," " waiting for more data");
-    return GST_FLOW_OK;
-  }
-
-  if (is_eos) {
-    gint64 max_offset = 0;
-    gboolean empty_buffer = TRUE;
-
-    GST_DEBUG_OBJECT (audiomixer, "We're EOS");
-
-
-    for (collected = pads->data; collected; collected = collected->next) {
-      GstCollectData *collect_data;
-      GstAudioMixerCollect *adata;
-
-      collect_data = (GstCollectData *) collected->data;
-      adata = (GstAudioMixerCollect *) collect_data;
-
-      max_offset = MAX (max_offset, adata->output_offset);
-      if (adata->output_offset > audiomixer->offset)
-        empty_buffer = FALSE;
-    }
-
-    /* This means EOS or no pads at all */
-    if (empty_buffer) {
-      gst_buffer_replace (&audiomixer->current_buffer, NULL);
-      goto eos;
-    }
-
-    if (max_offset <= next_offset) {
-      GST_DEBUG_OBJECT (audiomixer,
-          "Last buffer is incomplete: %" G_GUINT64_FORMAT " <= %"
-          G_GUINT64_FORMAT, max_offset, next_offset);
-      next_offset = max_offset;
-      if (next_offset > audiomixer->offset)
-        gst_buffer_resize (outbuf, 0, (next_offset - audiomixer->offset) * bpf);
-
-      next_timestamp = gst_util_uint64_scale (next_offset, GST_SECOND, rate);
-    }
-  }
-
-  /* set timestamps on the output buffer */
-  if (audiomixer->segment.rate > 0.0) {
-    GST_BUFFER_TIMESTAMP (outbuf) = audiomixer->segment.position;
-    GST_BUFFER_OFFSET (outbuf) = audiomixer->offset;
-    GST_BUFFER_OFFSET_END (outbuf) = next_offset;
-    GST_BUFFER_DURATION (outbuf) =
-        next_timestamp - audiomixer->segment.position;
-  } else {
-    GST_BUFFER_TIMESTAMP (outbuf) = next_timestamp;
-    GST_BUFFER_OFFSET (outbuf) = next_offset;
-    GST_BUFFER_OFFSET_END (outbuf) = audiomixer->offset;
-    GST_BUFFER_DURATION (outbuf) =
-        audiomixer->segment.position - next_timestamp;
-  }
-
-  audiomixer->offset = next_offset;
-  audiomixer->segment.position = next_timestamp;
-
-  /* send it out */
-  GST_LOG_OBJECT (audiomixer,
-      "pushing outbuf %p, timestamp %" GST_TIME_FORMAT " offset %"
-      G_GINT64_FORMAT, outbuf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
-      GST_BUFFER_OFFSET (outbuf));
-
-  ret = gst_pad_push (audiomixer->srcpad, outbuf);
-  audiomixer->current_buffer = NULL;
-
-  GST_LOG_OBJECT (audiomixer, "pushed outbuf, result = %s",
-      gst_flow_get_name (ret));
-
-  if (ret == GST_FLOW_OK && is_eos)
-    goto eos;
-
-  return ret;
-  /* ERRORS */
-not_negotiated:
-  {
-    GST_ELEMENT_ERROR (audiomixer, STREAM, FORMAT, (NULL),
-        ("Unknown data received, not negotiated"));
-    return GST_FLOW_NOT_NEGOTIATED;
-  }
-
-eos:
-  {
-    GST_DEBUG_OBJECT (audiomixer, "EOS");
-    gst_pad_push_event (audiomixer->srcpad, gst_event_new_eos ());
-    return GST_FLOW_EOS;
-  }
+  return TRUE;
 }
 
-static GstStateChangeReturn
-gst_audiomixer_change_state (GstElement * element, GstStateChange transition)
-{
-  GstAudioMixer *audiomixer;
-  GstStateChangeReturn ret;
-
-  audiomixer = GST_AUDIO_MIXER (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      break;
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      audiomixer->offset = 0;
-      audiomixer->flush_stop_pending = FALSE;
-      audiomixer->segment_pending = TRUE;
-      audiomixer->send_stream_start = TRUE;
-      audiomixer->send_caps = TRUE;
-      gst_caps_replace (&audiomixer->current_caps, NULL);
-      gst_segment_init (&audiomixer->segment, GST_FORMAT_TIME);
-      gst_collect_pads_start (audiomixer->collect);
-      audiomixer->discont_time = GST_CLOCK_TIME_NONE;
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      /* need to unblock the collectpads before calling the
-       * parent change_state so that streaming can finish */
-      gst_collect_pads_stop (audiomixer->collect);
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      gst_buffer_replace (&audiomixer->current_buffer, NULL);
-      break;
-    default:
-      break;
-  }
-
-  return ret;
-}
 
 /* GstChildProxy implementation */
 static GObject *
@@ -1994,6 +766,10 @@
           GST_TYPE_AUDIO_MIXER))
     return FALSE;
 
+  if (!gst_element_register (plugin, "audiointerleave", GST_RANK_NONE,
+          GST_TYPE_AUDIO_INTERLEAVE))
+    return FALSE;
+
   return TRUE;
 }
 
diff --git a/gst/audiomixer/gstaudiomixer.h b/gst/audiomixer/gstaudiomixer.h
index 40a25c9..add6e32 100644
--- a/gst/audiomixer/gstaudiomixer.h
+++ b/gst/audiomixer/gstaudiomixer.h
@@ -25,8 +25,8 @@
 #define __GST_AUDIO_MIXER_H__
 
 #include <gst/gst.h>
-#include <gst/base/gstcollectpads.h>
 #include <gst/audio/audio.h>
+#include "gstaudioaggregator.h"
 
 G_BEGIN_DECLS
 
@@ -49,50 +49,14 @@
  * The audiomixer object structure.
  */
 struct _GstAudioMixer {
-  GstElement      element;
-
-  GstPad         *srcpad;
-  GstCollectPads *collect;
-  /* pad counter, used for creating unique request pads */
-  gint            padcount;
-
-  /* the next are valid for both int and float */
-  GstAudioInfo    info;
-
-  /* counters to keep track of timestamps */
-  gint64          offset;
-  /* Buffer starting at offset containing block_size samples */
-  GstBuffer      *current_buffer;
-
-  /* sink event handling */
-  GstSegment      segment;
-  volatile gboolean segment_pending;
-  volatile gboolean flush_stop_pending;
-
-  /* current caps */
-  GstCaps *current_caps;
+  GstAudioAggregator element;
 
   /* target caps (set via property) */
   GstCaps *filter_caps;
-
-  GstClockTime alignment_threshold;
-  GstClockTime discont_wait;
-
-  /* Last time we noticed a discont */
-  GstClockTime discont_time;
-
-  /* Size in samples that is output per buffer */
-  guint blocksize;
-
-  /* Pending inline events */
-  GList *pending_events;
-  
-  gboolean send_stream_start;
-  gboolean send_caps;
 };
 
 struct _GstAudioMixerClass {
-  GstElementClass parent_class;
+  GstAudioAggregatorClass parent_class;
 };
 
 GType    gst_audiomixer_get_type (void);
@@ -105,7 +69,7 @@
 #define GST_AUDIO_MIXER_PAD_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_MIXER_PAD,GstAudioMixerPadClass))
 
 struct _GstAudioMixerPad {
-  GstPad parent;
+  GstAudioAggregatorPad parent;
 
   gdouble volume;
   gint volume_i32;
@@ -115,7 +79,7 @@
 };
 
 struct _GstAudioMixerPadClass {
-  GstPadClass parent_class;
+  GstAudioAggregatorPadClass parent_class;
 };
 
 GType gst_audiomixer_pad_get_type (void);
diff --git a/gst/audiovisualizers/Makefile.in b/gst/audiovisualizers/Makefile.in
index f134667..b6f458a 100644
--- a/gst/audiovisualizers/Makefile.in
+++ b/gst/audiovisualizers/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -253,8 +253,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -293,7 +297,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -301,6 +304,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -350,8 +355,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -430,7 +433,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -439,7 +441,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -452,7 +453,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -477,6 +477,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -550,10 +552,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -579,6 +585,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -615,6 +624,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -655,17 +665,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -682,6 +691,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/audiovisualizers/gstaudiovisualizer.c b/gst/audiovisualizers/gstaudiovisualizer.c
index fafece2..0352787 100644
--- a/gst/audiovisualizers/gstaudiovisualizer.c
+++ b/gst/audiovisualizers/gstaudiovisualizer.c
@@ -63,7 +63,7 @@
     guint prop_id, const GValue * value, GParamSpec * pspec);
 static void gst_audio_visualizer_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
-static void gst_audio_visualizer_dispose (GObject * object);
+static void gst_audio_visualizer_finalize (GObject * object);
 
 static gboolean gst_audio_visualizer_src_negotiate (GstAudioVisualizer * scope);
 static gboolean gst_audio_visualizer_src_setcaps (GstAudioVisualizer *
@@ -81,8 +81,6 @@
 
 static gboolean gst_audio_visualizer_src_query (GstPad * pad,
     GstObject * parent, GstQuery * query);
-static gboolean gst_audio_visualizer_sink_query (GstPad * pad,
-    GstObject * parent, GstQuery * query);
 
 static GstStateChangeReturn gst_audio_visualizer_change_state (GstElement *
     element, GstStateChange transition);
@@ -502,6 +500,9 @@
   GstAllocator *allocator;
   GstAllocationParams params;
   GstQuery *query;
+
+  guint dropped;                /* frames dropped / not dropped */
+  guint processed;
 };
 
 GType
@@ -547,7 +548,7 @@
 
   gobject_class->set_property = gst_audio_visualizer_set_property;
   gobject_class->get_property = gst_audio_visualizer_get_property;
-  gobject_class->dispose = gst_audio_visualizer_dispose;
+  gobject_class->finalize = gst_audio_visualizer_finalize;
 
   element_class->change_state =
       GST_DEBUG_FUNCPTR (gst_audio_visualizer_change_state);
@@ -583,8 +584,6 @@
       GST_DEBUG_FUNCPTR (gst_audio_visualizer_chain));
   gst_pad_set_event_function (scope->sinkpad,
       GST_DEBUG_FUNCPTR (gst_audio_visualizer_sink_event));
-  gst_pad_set_query_function (scope->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_audio_visualizer_sink_query));
   gst_element_add_pad (GST_ELEMENT (scope), scope->sinkpad);
 
   pad_template =
@@ -656,7 +655,7 @@
 }
 
 static void
-gst_audio_visualizer_dispose (GObject * object)
+gst_audio_visualizer_finalize (GObject * object)
 {
   GstAudioVisualizer *scope = GST_AUDIO_VISUALIZER (object);
 
@@ -673,11 +672,10 @@
     gst_buffer_unref (scope->tempbuf);
     scope->tempbuf = NULL;
   }
-  if (scope->config_lock.p) {
-    g_mutex_clear (&scope->config_lock);
-    scope->config_lock.p = NULL;
-  }
-  G_OBJECT_CLASS (parent_class)->dispose (object);
+
+  g_mutex_clear (&scope->config_lock);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
@@ -689,6 +687,8 @@
   GST_OBJECT_LOCK (scope);
   scope->proportion = 1.0;
   scope->earliest_time = -1;
+  scope->priv->dropped = 0;
+  scope->priv->processed = 0;
   GST_OBJECT_UNLOCK (scope);
 }
 
@@ -753,8 +753,8 @@
   gst_video_frame_map (&scope->tempframe, &scope->vinfo, scope->tempbuf,
       GST_MAP_READWRITE);
 
-  if (klass->setup)
-    res = klass->setup (scope);
+  if (klass->setup && !klass->setup (scope))
+    goto setup_failed;
 
   GST_DEBUG_OBJECT (scope, "video: dimension %dx%d, framerate %d/%d",
       GST_VIDEO_INFO_WIDTH (&info), GST_VIDEO_INFO_HEIGHT (&info),
@@ -777,6 +777,12 @@
     GST_DEBUG_OBJECT (scope, "error parsing caps");
     return FALSE;
   }
+
+setup_failed:
+  {
+    GST_WARNING_OBJECT (scope, "failed to set up");
+    return FALSE;
+  }
 }
 
 static gboolean
@@ -1092,27 +1098,46 @@
       ts += gst_util_uint64_scale_int (dist, GST_SECOND, rate);
     }
 
+    /* check for QoS, don't compute buffers that are known to be late */
     if (GST_CLOCK_TIME_IS_VALID (ts)) {
+      GstClockTime earliest_time;
+      gdouble proportion;
       gint64 qostime;
-      gboolean need_skip;
 
       qostime =
           gst_segment_to_running_time (&scope->segment, GST_FORMAT_TIME, ts) +
           scope->frame_duration;
 
       GST_OBJECT_LOCK (scope);
-      /* check for QoS, don't compute buffers that are known to be late */
-      need_skip = scope->earliest_time != -1 && qostime <= scope->earliest_time;
+      earliest_time = scope->earliest_time;
+      proportion = scope->proportion;
       GST_OBJECT_UNLOCK (scope);
 
-      if (need_skip) {
-        GST_WARNING_OBJECT (scope,
+      if (GST_CLOCK_TIME_IS_VALID (earliest_time) && qostime <= earliest_time) {
+        GstClockTime stream_time, jitter;
+        GstMessage *qos_msg;
+
+        GST_DEBUG_OBJECT (scope,
             "QoS: skip ts: %" GST_TIME_FORMAT ", earliest: %" GST_TIME_FORMAT,
-            GST_TIME_ARGS (qostime), GST_TIME_ARGS (scope->earliest_time));
+            GST_TIME_ARGS (qostime), GST_TIME_ARGS (earliest_time));
+
+        ++scope->priv->dropped;
+        stream_time = gst_segment_to_stream_time (&scope->segment,
+            GST_FORMAT_TIME, ts);
+        jitter = GST_CLOCK_DIFF (qostime, earliest_time);
+        qos_msg = gst_message_new_qos (GST_OBJECT (scope), FALSE, qostime,
+            stream_time, ts, GST_BUFFER_DURATION (buffer));
+        gst_message_set_qos_values (qos_msg, jitter, proportion, 1000000);
+        gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS,
+            scope->priv->processed, scope->priv->dropped);
+        gst_element_post_message (GST_ELEMENT (scope), qos_msg);
+
         goto skip;
       }
     }
 
+    ++scope->priv->processed;
+
     g_mutex_unlock (&scope->config_lock);
     ret = default_prepare_output_buffer (scope, &outbuf);
     g_mutex_lock (&scope->config_lock);
@@ -1155,6 +1180,8 @@
     if (klass->render) {
       if (!klass->render (scope, inbuf, &outframe)) {
         ret = GST_FLOW_ERROR;
+        gst_video_frame_unmap (&outframe);
+        goto beach;
       } else {
         /* run various post processing (shading and geometric transformation) */
         /* FIXME: SHADER assumes 32bpp */
@@ -1242,7 +1269,7 @@
       res = TRUE;
       break;
     default:
-      res = gst_pad_push_event (scope->sinkpad, event);
+      res = gst_pad_event_default (pad, parent, event);
       break;
   }
 
@@ -1268,9 +1295,6 @@
       gst_event_unref (event);
       break;
     }
-    case GST_EVENT_FLUSH_START:
-      res = gst_pad_push_event (scope->srcpad, event);
-      break;
     case GST_EVENT_FLUSH_STOP:
       gst_audio_visualizer_reset (scope);
       res = gst_pad_push_event (scope->srcpad, event);
@@ -1286,7 +1310,7 @@
       break;
     }
     default:
-      res = gst_pad_push_event (scope->srcpad, event);
+      res = gst_pad_event_default (pad, parent, event);
       break;
   }
 
@@ -1352,20 +1376,6 @@
   return res;
 }
 
-static gboolean
-gst_audio_visualizer_sink_query (GstPad * pad, GstObject * parent,
-    GstQuery * query)
-{
-  gboolean res = FALSE;
-
-  switch (GST_QUERY_TYPE (query)) {
-    default:
-      res = gst_pad_query_default (pad, parent, query);
-      break;
-  }
-  return res;
-}
-
 static GstStateChangeReturn
 gst_audio_visualizer_change_state (GstElement * element,
     GstStateChange transition)
diff --git a/gst/audiovisualizers/gstaudiovisualizer.h b/gst/audiovisualizers/gstaudiovisualizer.h
index 7f8f8d8..f7c6dd8 100644
--- a/gst/audiovisualizers/gstaudiovisualizer.h
+++ b/gst/audiovisualizers/gstaudiovisualizer.h
@@ -29,12 +29,14 @@
 #include <gst/base/gstadapter.h>
 
 G_BEGIN_DECLS
+
 #define GST_TYPE_AUDIO_VISUALIZER            (gst_audio_visualizer_get_type())
 #define GST_AUDIO_VISUALIZER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizer))
 #define GST_AUDIO_VISUALIZER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizerClass))
 #define GST_AUDIO_VISUALIZER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizerClass))
-#define GST_IS_SYNAESTHESIA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_VISUALIZER))
-#define GST_IS_SYNAESTHESIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_VISUALIZER))
+#define GST_IS_AUDIO_VISUALIZER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_VISUALIZER))
+#define GST_IS_AUDIO_VISUALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_VISUALIZER))
+
 typedef struct _GstAudioVisualizer GstAudioVisualizer;
 typedef struct _GstAudioVisualizerClass GstAudioVisualizerClass;
 typedef struct _GstAudioVisualizerPrivate GstAudioVisualizerPrivate;
diff --git a/gst/audiovisualizers/gstwavescope.c b/gst/audiovisualizers/gstwavescope.c
index 6502b88..cd21abd 100644
--- a/gst/audiovisualizers/gstwavescope.c
+++ b/gst/audiovisualizers/gstwavescope.c
@@ -149,8 +149,6 @@
       gst_static_pad_template_get (&gst_wave_scope_src_template));
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&gst_wave_scope_sink_template));
-
-  scope_class->render = GST_DEBUG_FUNCPTR (gst_wave_scope_render);
 }
 
 static void
@@ -325,15 +323,15 @@
       filter ((gfloat) adata[s]);
 
       y = (guint) (oy + flt[0] * dy);
-      y = CLAMP (y, 0, h1);
+      y = MIN (y, h1);
       draw_dot_c (vdata, x, y, w, 0x00FF0000);
 
       y = (guint) (oy + flt[3] * dy);
-      y = CLAMP (y, 0, h1);
+      y = MIN (y, h1);
       draw_dot_c (vdata, x, y, w, 0x0000FF00);
 
       y = (guint) (oy + (flt[4] + flt[5]) * dy);
-      y = CLAMP (y, 0, h1);
+      y = MIN (y, h1);
       draw_dot_c (vdata, x, y, w, 0x000000FF);
 
       s += channels;
@@ -367,30 +365,30 @@
     filter ((gfloat) adata[s]);
 
     y = (guint) (oy + flt[0] * dy);
-    y2 = CLAMP (y, 0, h1);
+    y2 = MIN (y, h1);
 
     y = (guint) (oy + flt[3] * dy);
-    y3 = CLAMP (y, 0, h1);
+    y3 = MIN (y, h1);
 
     y = (guint) (oy + (flt[4] + flt[5]) * dy);
-    y4 = CLAMP (y, 0, h1);
+    y4 = MIN (y, h1);
 
     for (i = 1; i < num_samples; i++) {
       x = (guint) ((gfloat) i * dx);
       filter ((gfloat) adata[s]);
 
       y = (guint) (oy + flt[0] * dy);
-      y = CLAMP (y, 0, h1);
+      y = MIN (y, h1);
       draw_line_aa (vdata, x2, x, y2, y, w, 0x00FF0000);
       y2 = y;
 
       y = (guint) (oy + flt[3] * dy);
-      y = CLAMP (y, 0, h1);
+      y = MIN (y, h1);
       draw_line_aa (vdata, x2, x, y3, y, w, 0x0000FF00);
       y3 = y;
 
       y = (guint) (oy + (flt[4] + flt[5]) * dy);
-      y = CLAMP (y, 0, h1);
+      y = MIN (y, h1);
       draw_line_aa (vdata, x2, x, y4, y, w, 0x000000FF);
       y4 = y;
 
diff --git a/gst/autoconvert/Makefile.in b/gst/autoconvert/Makefile.in
index 4a9e048..bdaddb7 100644
--- a/gst/autoconvert/Makefile.in
+++ b/gst/autoconvert/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/bayer/Makefile.in b/gst/bayer/Makefile.in
index 9c49e57..80f9fae 100644
--- a/gst/bayer/Makefile.in
+++ b/gst/bayer/Makefile.in
@@ -111,6 +111,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -124,7 +125,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -268,8 +268,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -308,7 +312,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -316,6 +319,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -367,8 +372,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -447,7 +450,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -456,7 +458,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -469,7 +470,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -494,6 +494,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -567,10 +569,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -596,6 +602,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -632,6 +641,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -672,17 +682,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -699,6 +708,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/bayer/gstbayer2rgb.c b/gst/bayer/gstbayer2rgb.c
index f076231..036ac2a 100644
--- a/gst/bayer/gstbayer2rgb.c
+++ b/gst/bayer/gstbayer2rgb.c
@@ -286,7 +286,7 @@
   GstCaps *newcaps;
   GstStructure *newstruct;
 
-  GST_DEBUG_OBJECT (caps, "transforming caps (from)");
+  GST_DEBUG_OBJECT (base, "transforming caps from %" GST_PTR_FORMAT, caps);
 
   structure = gst_caps_get_structure (caps, 0);
 
@@ -305,7 +305,17 @@
   gst_structure_set_value (newstruct, "framerate",
       gst_structure_get_value (structure, "framerate"));
 
-  GST_DEBUG_OBJECT (newcaps, "transforming caps (into)");
+  if (filter != NULL) {
+    GstCaps *icaps;
+
+    GST_DEBUG_OBJECT (base, "                filter %" GST_PTR_FORMAT, filter);
+
+    icaps = gst_caps_intersect_full (filter, newcaps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (newcaps);
+    newcaps = icaps;
+  }
+
+  GST_DEBUG_OBJECT (base, "                  into %" GST_PTR_FORMAT, newcaps);
 
   return newcaps;
 }
diff --git a/gst/camerabin2/Makefile.in b/gst/camerabin2/Makefile.in
index 5d9e557..e09c8ff 100644
--- a/gst/camerabin2/Makefile.in
+++ b/gst/camerabin2/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -251,8 +251,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -291,7 +295,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -299,6 +302,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -348,8 +353,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -428,7 +431,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -437,7 +439,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -450,7 +451,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -475,6 +475,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -548,10 +550,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -577,6 +583,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -613,6 +622,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -653,17 +663,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -680,6 +689,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c
index c77585a..7458675 100644
--- a/gst/camerabin2/gstcamerabin2.c
+++ b/gst/camerabin2/gstcamerabin2.c
@@ -167,15 +167,9 @@
 #include <gst/pbutils/pbutils.h>
 #include <gst/glib-compat-private.h>
 
-#if GLIB_CHECK_VERSION(2,29,6)
-#define gst_camerabin2_atomic_int_add g_atomic_int_add
-#else
-#define gst_camerabin2_atomic_int_add g_atomic_int_exchange_and_add
-#endif
-
 #define GST_CAMERA_BIN2_PROCESSING_INC(c)                                \
 {                                                                       \
-  gint bef = gst_camerabin2_atomic_int_add (&c->processing_counter, 1); \
+  gint bef = g_atomic_int_add (&c->processing_counter, 1); \
   if (bef == 0)                                                         \
     g_object_notify (G_OBJECT (c), "idle");                             \
   GST_DEBUG_OBJECT ((c), "Processing counter incremented to: %d",       \
@@ -988,14 +982,7 @@
   if (camerabin->audio_src) {
     gst_element_set_state (camerabin->audio_capsfilter, GST_STATE_READY);
     gst_element_set_state (camerabin->audio_volume, GST_STATE_READY);
-
-    /* FIXME We need to set audiosrc to null to make it resync the ringbuffer
-     * while bug https://bugzilla.gnome.org/show_bug.cgi?id=648359 isn't
-     * fixed.
-     *
-     * Also, we don't reinit the audiosrc to keep audio devices from being open
-     * and running until we really need them */
-    gst_element_set_state (camerabin->audio_src, GST_STATE_NULL);
+    gst_element_set_state (camerabin->audio_src, GST_STATE_READY);
 
     if (camerabin->audio_filter) {
       gst_element_set_state (camerabin->audio_filter, GST_STATE_READY);
@@ -1101,17 +1088,24 @@
 
         g_mutex_lock (&camerabin->video_capture_mutex);
         GST_DEBUG_OBJECT (bin, "EOS from video branch");
-        g_assert (camerabin->video_state == GST_CAMERA_BIN_VIDEO_FINISHING);
-
-        if (!g_thread_try_new ("reset-element-thread",
-                gst_camera_bin_video_reset_elements, gst_object_ref (camerabin),
-                NULL)) {
-          GST_WARNING_OBJECT (camerabin,
-              "Failed to create thread to "
-              "reset video elements' state, video recordings may not work "
-              "anymore");
-          gst_object_unref (camerabin);
-          camerabin->video_state = GST_CAMERA_BIN_VIDEO_IDLE;
+        if (camerabin->video_state == GST_CAMERA_BIN_VIDEO_FINISHING) {
+          if (!g_thread_try_new ("reset-element-thread",
+                  gst_camera_bin_video_reset_elements,
+                  gst_object_ref (camerabin), NULL)) {
+            GST_WARNING_OBJECT (camerabin,
+                "Failed to create thread to "
+                "reset video elements' state, video recordings may not work "
+                "anymore");
+            gst_object_unref (camerabin);
+            camerabin->video_state = GST_CAMERA_BIN_VIDEO_IDLE;
+          }
+        } else if (camerabin->video_state == GST_CAMERA_BIN_VIDEO_IDLE) {
+          GST_DEBUG_OBJECT (camerabin, "Received EOS from video branch but "
+              "video recording is idle, ignoring");
+        } else {
+          GST_WARNING_OBJECT (camerabin, "Received EOS from video branch but "
+              "video is recording and stop-capture wasn't requested");
+          g_assert_not_reached ();
         }
 
         g_mutex_unlock (&camerabin->video_capture_mutex);
@@ -1331,10 +1325,18 @@
 gst_camera_bin_src_notify_max_zoom_cb (GObject * self, GParamSpec * pspec,
     gpointer user_data)
 {
+  GParamSpecFloat *zoom_pspec;
   GstCameraBin2 *camera = (GstCameraBin2 *) user_data;
 
   g_object_get (self, "max-zoom", &camera->max_zoom, NULL);
   GST_DEBUG_OBJECT (camera, "Max zoom updated to %f", camera->max_zoom);
+
+  /* update zoom pspec */
+  zoom_pspec =
+      G_PARAM_SPEC_FLOAT (g_object_class_find_property (G_OBJECT_GET_CLASS
+          (G_OBJECT (camera)), "zoom"));
+  zoom_pspec->maximum = camera->max_zoom;
+
   g_object_notify (G_OBJECT (camera), "max-zoom");
 }
 
@@ -1760,7 +1762,7 @@
         G_CALLBACK (gst_camera_bin_src_notify_readyforcapture), camera);
 
     if (!gst_element_link_pads (camera->src, "vfsrc",
-	    camera->viewfinderbin_queue, "sink")) {
+            camera->viewfinderbin_queue, "sink")) {
       GST_ERROR_OBJECT (camera,
           "Failed to link camera source's vfsrc pad to viewfinder queue");
       goto fail;
@@ -2024,7 +2026,7 @@
     g_object_unref (camera->user_audio_src);
 
   if (src)
-    g_object_ref (src);
+    gst_object_ref (src);
   camera->user_audio_src = src;
 }
 
@@ -2038,7 +2040,7 @@
     g_object_unref (camera->user_src);
 
   if (src)
-    g_object_ref (src);
+    gst_object_ref (src);
   camera->user_src = src;
 }
 
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c
index 3f3a3b9..25643f3 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.c
+++ b/gst/camerabin2/gstwrappercamerabinsrc.c
@@ -31,10 +31,6 @@
 #  include <config.h>
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include <gst/interfaces/photography.h>
 
 #include "gstwrappercamerabinsrc.h"
@@ -80,6 +76,14 @@
 {
   GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (object);
 
+  if (self->outsel_imgpad) {
+    gst_object_unref (self->outsel_imgpad);
+    self->outsel_imgpad = NULL;
+  }
+  if (self->outsel_vidpad) {
+    gst_object_unref (self->outsel_vidpad);
+    self->outsel_vidpad = NULL;
+  }
   if (self->app_vid_src) {
     gst_object_unref (self->app_vid_src);
     self->app_vid_src = NULL;
@@ -88,6 +92,10 @@
     gst_object_unref (self->app_vid_filter);
     self->app_vid_filter = NULL;
   }
+  if (self->srcfilter_pad) {
+    gst_object_unref (self->srcfilter_pad);
+    self->srcfilter_pad = NULL;
+  }
   gst_caps_replace (&self->image_capture_caps, NULL);
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
@@ -165,23 +173,45 @@
 
 static void
 gst_wrapper_camera_bin_reset_video_src_caps (GstWrapperCameraBinSrc * self,
-    GstCaps * caps)
+    GstCaps * new_filter_caps)
 {
-  GST_DEBUG_OBJECT (self, "Resetting src caps to %" GST_PTR_FORMAT, caps);
+  GST_DEBUG_OBJECT (self, "Resetting src caps to %" GST_PTR_FORMAT,
+      new_filter_caps);
   if (self->src_vid_src) {
-    GstCaps *old_caps;
+    GstCaps *src_neg_caps;      /* negotiated caps on src_filter */
+    gboolean ret = FALSE;
 
-    g_object_get (G_OBJECT (self->src_filter), "caps", &old_caps, NULL);
-    if (gst_caps_is_equal (caps, old_caps)) {
-      GST_DEBUG_OBJECT (self, "old and new caps are same, do not reset it");
-      if (old_caps)
-        gst_caps_unref (old_caps);
+    /* After pipe was negotiated src_filter do not have any filter caps.
+     * In this situation we should compare neogotiated caps on capsfilter pad
+     * with requested range of caps. If one of this caps intersect,
+     * then we can avoid reseting.
+     */
+    src_neg_caps = gst_pad_get_current_caps (self->srcfilter_pad);
+    if (src_neg_caps && new_filter_caps && gst_caps_is_fixed (new_filter_caps))
+      ret = gst_caps_can_intersect (src_neg_caps, new_filter_caps);
+    else if (new_filter_caps == NULL) {
+      /* If new_filter_caps = NULL, then some body wont to empty
+       * capsfilter (set to ANY). In this case we will need to reset pipe,
+       * but if capsfilter is actually empthy, then we can avoid
+       * one more reseting.
+       */
+      GstCaps *old_filter_caps; /* range of caps on capsfilter */
+
+      g_object_get (G_OBJECT (self->src_filter),
+          "caps", &old_filter_caps, NULL);
+      ret = gst_caps_is_any (old_filter_caps);
+      gst_caps_unref (old_filter_caps);
+    }
+    if (src_neg_caps)
+      gst_caps_unref (src_neg_caps);
+
+    if (ret) {
+      GST_DEBUG_OBJECT (self, "Negotiated caps on srcfilter intersect "
+          "with requested caps, do not reset it.");
       return;
     }
-    if (old_caps)
-      gst_caps_unref (old_caps);
 
-    set_capsfilter_caps (self, caps);
+    set_capsfilter_caps (self, new_filter_caps);
   }
 }
 
@@ -312,10 +342,6 @@
   GstEvent *evt = GST_EVENT (info->data);
 
   switch (GST_EVENT_TYPE (evt)) {
-    case GST_EVENT_EOS:
-      /* drop */
-      ret = GST_PAD_PROBE_DROP;
-      break;
     case GST_EVENT_SEGMENT:
       if (self->drop_newseg) {
         ret = GST_PAD_PROBE_DROP;
@@ -441,6 +467,7 @@
 {
   GstBin *cbin = GST_BIN_CAST (self);
   GstBaseCameraSrc *bcamsrc = GST_BASE_CAMERA_SRC_CAST (self);
+  GstElement *videoconvert;
 
   if (self->src_vid_src && self->src_vid_src == self->app_vid_src) {
     GST_DEBUG_OBJECT (self, "No need to change current videosrc");
@@ -473,22 +500,20 @@
               "camerasrc-real-src"))) {
     self->src_vid_src = NULL;
     return FALSE;
-  } else {
-    GstElement *videoconvert;
-    if (!gst_bin_add (cbin, self->src_vid_src)) {
+  }
+
+  if (!gst_bin_add (cbin, self->src_vid_src)) {
+    return FALSE;
+  }
+
+  /* check if we already have the next element to link to */
+  videoconvert = gst_bin_get_by_name (cbin, "src-videoconvert");
+  if (videoconvert) {
+    if (!gst_element_link_pads (self->src_vid_src, "src", videoconvert, "sink")) {
+      gst_object_unref (videoconvert);
       return FALSE;
     }
-
-    /* check if we already have the next element to link to */
-    videoconvert = gst_bin_get_by_name (cbin, "src-videoconvert");
-    if (videoconvert) {
-      if (!gst_element_link_pads (self->src_vid_src, "src", videoconvert,
-              "sink")) {
-        gst_object_unref (videoconvert);
-        return FALSE;
-      }
-      gst_object_unref (videoconvert);
-    }
+    gst_object_unref (videoconvert);
   }
 
   /* we listen for changes to max-zoom in the video src so that
@@ -506,8 +531,7 @@
 
     self->src_event_probe_id =
         gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
-        gst_wrapper_camera_src_src_event_probe, gst_object_ref (self),
-        gst_object_unref);
+        gst_wrapper_camera_src_src_event_probe, self, NULL);
     gst_object_unref (pad);
   }
   return TRUE;
@@ -539,7 +563,6 @@
   gboolean ret = FALSE;
   GstPad *vf_pad;
   GstPad *tee_capture_pad;
-  GstPad *src_caps_src_pad;
 
   /* checks and adds a new video src if needed */
   if (!check_and_replace_src (self))
@@ -571,10 +594,9 @@
     /* attach to notify::caps on the first capsfilter and use a callback
      * to recalculate the zoom properties when these caps change and to
      * propagate the caps to the second capsfilter */
-    src_caps_src_pad = gst_element_get_static_pad (self->src_filter, "src");
-    g_signal_connect (src_caps_src_pad, "notify::caps",
+    self->srcfilter_pad = gst_element_get_static_pad (self->src_filter, "src");
+    g_signal_connect (self->srcfilter_pad, "notify::caps",
         G_CALLBACK (gst_wrapper_camera_bin_src_caps_cb), self);
-    gst_object_unref (src_caps_src_pad);
 
     if (!(self->src_zoom_crop =
             gst_camerabin_create_and_add_element (cbin, "videocrop",
@@ -626,11 +648,9 @@
     g_assert (self->outsel_imgpad != NULL);
 
     gst_pad_add_probe (self->outsel_imgpad, GST_PAD_PROBE_TYPE_BUFFER,
-        gst_wrapper_camera_bin_src_imgsrc_probe, gst_object_ref (self),
-        gst_object_unref);
+        gst_wrapper_camera_bin_src_imgsrc_probe, self, NULL);
     gst_pad_add_probe (self->outsel_vidpad, GST_PAD_PROBE_TYPE_BUFFER,
-        gst_wrapper_camera_bin_src_vidsrc_probe, gst_object_ref (self),
-        gst_object_unref);
+        gst_wrapper_camera_bin_src_vidsrc_probe, self, NULL);
     gst_ghost_pad_set_target (GST_GHOST_PAD (self->imgsrc),
         self->outsel_imgpad);
     gst_ghost_pad_set_target (GST_GHOST_PAD (self->vidsrc),
@@ -832,23 +852,26 @@
       GST_TYPE_PHOTOGRAPHY);
   gboolean ret = FALSE;
   GstCaps *caps;
-  GstPad *pad, *peer;
 
   GST_DEBUG_OBJECT (self, "Starting image capture");
 
-  /* FIXME - V4L2 source will not close the device until all buffers have came
-   * back. Flushing the pipeline, will ensure it's properly closed, and that
-   * setting it back to PLAYING will work. This is more a workaround then a
-   * solution to buffer reclaiming. */
-  pad = gst_element_get_static_pad (self->src_vid_src, "src");
-  peer = gst_pad_get_peer (pad);
-  gst_object_unref (pad);
-  gst_pad_send_event (peer, gst_event_new_flush_start ());
-  gst_element_set_state (self->src_vid_src, GST_STATE_READY);
-  gst_pad_send_event (peer, gst_event_new_flush_stop (TRUE));
-  gst_object_unref (peer);
-
+  /* V4L2 source will not close the device until all buffers have came
+   * back. Draining the pipeline, will ensure it's properly closed, and that
+   * setting it back to PLAYING will work. */
   if (self->image_renegotiate) {
+    GstPad *pad, *peer;
+
+    g_mutex_unlock (&bcamsrc->capturing_mutex);
+    pad = gst_element_get_static_pad (self->src_vid_src, "src");
+    peer = gst_pad_get_peer (pad);
+    gst_object_unref (pad);
+    gst_pad_query (peer, gst_query_new_drain ());
+    gst_object_unref (peer);
+
+    self->image_renegotiate = FALSE;
+
+    gst_element_set_state (self->src_vid_src, GST_STATE_READY);
+
     /* clean capsfilter caps so they don't interfere here */
     g_object_set (self->src_filter, "caps", NULL, NULL);
     if (self->src_zoom_filter)
@@ -866,8 +889,7 @@
     /* We caught this event in the src pad event handler and now we want to
      * actually push it upstream */
     gst_pad_send_event (self->outsel_imgpad, gst_event_new_reconfigure ());
-
-    self->image_renegotiate = FALSE;
+    g_mutex_lock (&bcamsrc->capturing_mutex);
   }
 
   if (photography) {
@@ -1186,7 +1208,7 @@
 gst_wrapper_camera_bin_src_change_state (GstElement * element,
     GstStateChange trans)
 {
-  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+  GstStateChangeReturn ret;
   GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (element);
 
   ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, trans);
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.h b/gst/camerabin2/gstwrappercamerabinsrc.h
index 1dee4ca..68be6c5 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.h
+++ b/gst/camerabin2/gstwrappercamerabinsrc.h
@@ -29,6 +29,7 @@
 #include "camerabingeneral.h"
 
 G_BEGIN_DECLS
+
 #define GST_TYPE_WRAPPER_CAMERA_BIN_SRC \
   (gst_wrapper_camera_bin_src_get_type())
 #define GST_WRAPPER_CAMERA_BIN_SRC(obj) \
@@ -62,6 +63,7 @@
 
   GstCameraBinMode mode;
 
+  GstPad *srcfilter_pad;
   GstPad *vfsrc;
   GstPad *imgsrc;
   GstPad *vidsrc;
@@ -127,4 +129,6 @@
 
 gboolean gst_wrapper_camera_bin_src_plugin_init (GstPlugin * plugin);
 
+G_END_DECLS
+
 #endif /* __GST_WRAPPER_CAMERA_BIN_SRC_H__ */
diff --git a/gst/cdxaparse/Makefile.in b/gst/cdxaparse/Makefile.in
index a976d78..b536e8a 100644
--- a/gst/cdxaparse/Makefile.in
+++ b/gst/cdxaparse/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/coloreffects/Makefile.in b/gst/coloreffects/Makefile.in
index cf5efd4..64abf6b 100644
--- a/gst/coloreffects/Makefile.in
+++ b/gst/coloreffects/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/coloreffects/gstchromahold.c b/gst/coloreffects/gstchromahold.c
index e13984b..f4dd9ed 100644
--- a/gst/coloreffects/gstchromahold.c
+++ b/gst/coloreffects/gstchromahold.c
@@ -35,15 +35,10 @@
  * ]| This pipeline only keeps the red color.
  */
 
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include "gstchromahold.h"
 
 #include <stdlib.h>
diff --git a/gst/compositor/Makefile.in b/gst/compositor/Makefile.in
index c656b0d..a174857 100644
--- a/gst/compositor/Makefile.in
+++ b/gst/compositor/Makefile.in
@@ -112,6 +112,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -125,7 +126,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -274,8 +274,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -314,7 +318,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -322,6 +325,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -371,8 +376,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -451,7 +454,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -460,7 +462,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -473,7 +474,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -498,6 +498,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -571,10 +573,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -600,6 +606,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -636,6 +645,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -676,17 +686,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -703,6 +712,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/compositor/blend.c b/gst/compositor/blend.c
index 7fe8e53..721c766 100644
--- a/gst/compositor/blend.c
+++ b/gst/compositor/blend.c
@@ -86,9 +86,11 @@
     src_height = dest_height - ypos; \
   } \
   \
-  dest = dest + 4 * xpos + (ypos * dest_stride); \
+  if (src_height > 0 && src_width > 0) { \
+    dest = dest + 4 * xpos + (ypos * dest_stride); \
   \
-  LOOP (dest, src, src_height, src_width, src_stride, dest_stride, s_alpha); \
+    LOOP (dest, src, src_height, src_width, src_stride, dest_stride, s_alpha); \
+  } \
 }
 
 #define BLEND_A32_LOOP(name, method)			\
@@ -268,23 +270,23 @@
     xpos = 0; \
   } \
   if (ypos < 0) { \
-    yoffset += -ypos; \
+    yoffset = -ypos; \
     b_src_height -= -ypos; \
     ypos = 0; \
   } \
   /* If x or y offset are larger then the source it's outside of the picture */ \
-  if (xoffset > src_width || yoffset > src_height) { \
+  if (xoffset >= src_width || yoffset >= src_height) { \
     return; \
   } \
   \
   /* adjust width/height if the src is bigger than dest */ \
-  if (xpos + src_width > dest_width) { \
+  if (xpos + b_src_width > dest_width) { \
     b_src_width = dest_width - xpos; \
   } \
-  if (ypos + src_height > dest_height) { \
+  if (ypos + b_src_height > dest_height) { \
     b_src_height = dest_height - ypos; \
   } \
-  if (b_src_width < 0 || b_src_height < 0) { \
+  if (b_src_width <= 0 || b_src_height <= 0) { \
     return; \
   } \
   \
diff --git a/gst/compositor/compositor.c b/gst/compositor/compositor.c
index 805b674..ef71d84 100644
--- a/gst/compositor/compositor.c
+++ b/gst/compositor/compositor.c
@@ -31,7 +31,35 @@
  * Compositor will do colorspace conversion.
  * 
  * Individual parameters for each input stream can be configured on the
- * #GstCompositorPad.
+ * #GstCompositorPad:
+ *
+ * <itemizedlist>
+ * <listitem>
+ * "xpos": The x-coordinate position of the top-left corner of the picture
+ * (#gint)
+ * </listitem>
+ * <listitem>
+ * "ypos": The y-coordinate position of the top-left corner of the picture
+ * (#gint)
+ * </listitem>
+ * <listitem>
+ * "width": The width of the picture; the input will be scaled if necessary
+ * (#gint)
+ * </listitem>
+ * <listitem>
+ * "height": The height of the picture; the input will be scaled if necessary
+ * (#gint)
+ * </listitem>
+ * <listitem>
+ * "alpha": The transparency of the picture; between 0.0 and 1.0. The blending
+ * is a simple copy when fully-transparent (0.0) and fully-opaque (1.0).
+ * (#gdouble)
+ * </listitem>
+ * <listitem>
+ * "zorder": The z-order position of the picture in the composition; between
+ * 0 and 10000. (#guint)
+ * </listitem>
+ * </itemizedlist>
  *
  * <refsect2>
  * <title>Sample pipelines</title>
@@ -112,16 +140,18 @@
     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
     );
 
-#define DEFAULT_PAD_ZORDER 0
 #define DEFAULT_PAD_XPOS   0
 #define DEFAULT_PAD_YPOS   0
+#define DEFAULT_PAD_WIDTH  0
+#define DEFAULT_PAD_HEIGHT 0
 #define DEFAULT_PAD_ALPHA  1.0
 enum
 {
   PROP_PAD_0,
-  PROP_PAD_ZORDER,
   PROP_PAD_XPOS,
   PROP_PAD_YPOS,
+  PROP_PAD_WIDTH,
+  PROP_PAD_HEIGHT,
   PROP_PAD_ALPHA
 };
 
@@ -135,15 +165,18 @@
   GstCompositorPad *pad = GST_COMPOSITOR_PAD (object);
 
   switch (prop_id) {
-    case PROP_PAD_ZORDER:
-      g_value_set_uint (value, pad->zorder);
-      break;
     case PROP_PAD_XPOS:
       g_value_set_int (value, pad->xpos);
       break;
     case PROP_PAD_YPOS:
       g_value_set_int (value, pad->ypos);
       break;
+    case PROP_PAD_WIDTH:
+      g_value_set_int (value, pad->width);
+      break;
+    case PROP_PAD_HEIGHT:
+      g_value_set_int (value, pad->height);
+      break;
     case PROP_PAD_ALPHA:
       g_value_set_double (value, pad->alpha);
       break;
@@ -166,6 +199,12 @@
     case PROP_PAD_YPOS:
       pad->ypos = g_value_get_int (value);
       break;
+    case PROP_PAD_WIDTH:
+      pad->width = g_value_get_int (value);
+      break;
+    case PROP_PAD_HEIGHT:
+      pad->height = g_value_get_int (value);
+      break;
     case PROP_PAD_ALPHA:
       pad->alpha = g_value_get_double (value);
       break;
@@ -175,13 +214,265 @@
   }
 }
 
+static gboolean
+gst_compositor_pad_set_info (GstVideoAggregatorPad * pad,
+    GstVideoAggregator * vagg G_GNUC_UNUSED,
+    GstVideoInfo * current_info, GstVideoInfo * wanted_info)
+{
+  GstCompositorPad *cpad = GST_COMPOSITOR_PAD (pad);
+  gchar *colorimetry, *best_colorimetry;
+  const gchar *chroma, *best_chroma;
+  gint width, height;
+
+  if (!current_info->finfo)
+    return TRUE;
+
+  if (GST_VIDEO_INFO_FORMAT (current_info) == GST_VIDEO_FORMAT_UNKNOWN)
+    return TRUE;
+
+  if (cpad->convert)
+    gst_video_converter_free (cpad->convert);
+
+  cpad->convert = NULL;
+
+  colorimetry = gst_video_colorimetry_to_string (&(current_info->colorimetry));
+  chroma = gst_video_chroma_to_string (current_info->chroma_site);
+
+  best_colorimetry =
+      gst_video_colorimetry_to_string (&(wanted_info->colorimetry));
+  best_chroma = gst_video_chroma_to_string (wanted_info->chroma_site);
+
+  if (cpad->width > 0)
+    width = cpad->width;
+  else
+    width = current_info->width;
+
+  if (cpad->height > 0)
+    height = cpad->height;
+  else
+    height = current_info->height;
+
+  if (GST_VIDEO_INFO_FORMAT (wanted_info) !=
+      GST_VIDEO_INFO_FORMAT (current_info)
+      || g_strcmp0 (colorimetry, best_colorimetry)
+      || g_strcmp0 (chroma, best_chroma)
+      || width != current_info->width || height != current_info->height) {
+    GstVideoInfo tmp_info;
+
+    /* Initialize with the wanted video format and our original width and
+     * height as we don't want to rescale. Then copy over the wanted
+     * colorimetry, and chroma-site and our current pixel-aspect-ratio
+     * and other relevant fields.
+     */
+    gst_video_info_set_format (&tmp_info, GST_VIDEO_INFO_FORMAT (wanted_info),
+        width, height);
+    tmp_info.chroma_site = wanted_info->chroma_site;
+    tmp_info.colorimetry = wanted_info->colorimetry;
+    tmp_info.par_n = current_info->par_n;
+    tmp_info.par_d = current_info->par_d;
+    tmp_info.fps_n = current_info->fps_n;
+    tmp_info.fps_d = current_info->fps_d;
+    tmp_info.flags = current_info->flags;
+    tmp_info.interlace_mode = current_info->interlace_mode;
+
+    GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d",
+        GST_VIDEO_INFO_FORMAT (current_info),
+        GST_VIDEO_INFO_FORMAT (&tmp_info));
+    cpad->convert = gst_video_converter_new (current_info, &tmp_info, NULL);
+    cpad->conversion_info = tmp_info;
+    if (!cpad->convert) {
+      g_free (colorimetry);
+      g_free (best_colorimetry);
+      GST_WARNING_OBJECT (pad, "No path found for conversion");
+      return FALSE;
+    }
+  } else {
+    cpad->conversion_info = *current_info;
+    GST_DEBUG_OBJECT (pad, "This pad will not need conversion");
+  }
+  g_free (colorimetry);
+  g_free (best_colorimetry);
+
+  return TRUE;
+}
+
+static gboolean
+gst_compositor_pad_prepare_frame (GstVideoAggregatorPad * pad,
+    GstVideoAggregator * vagg)
+{
+  GstCompositorPad *cpad = GST_COMPOSITOR_PAD (pad);
+  guint outsize;
+  GstVideoFrame *converted_frame;
+  GstBuffer *converted_buf = NULL;
+  GstVideoFrame *frame;
+  static GstAllocationParams params = { 0, 15, 0, 0, };
+  gint width, height;
+
+  if (!pad->buffer)
+    return TRUE;
+
+  frame = g_slice_new0 (GstVideoFrame);
+
+  if (!gst_video_frame_map (frame, &pad->buffer_vinfo, pad->buffer,
+          GST_MAP_READ)) {
+    GST_WARNING_OBJECT (vagg, "Could not map input buffer");
+    return FALSE;
+  }
+
+  if (cpad->width > 0)
+    width = cpad->width;
+  else
+    width = GST_VIDEO_FRAME_WIDTH (frame);
+
+  if (cpad->height > 0)
+    height = cpad->height;
+  else
+    height = GST_VIDEO_FRAME_HEIGHT (frame);
+
+  /* The only thing that can change here is the width
+   * and height, otherwise set_info would've been called */
+  if (cpad->conversion_info.width != width ||
+      cpad->conversion_info.height != height) {
+    gchar *colorimetry, *wanted_colorimetry;
+    const gchar *chroma, *wanted_chroma;
+
+    /* We might end up with no converter afterwards if
+     * the only reason for conversion was a different
+     * width or height
+     */
+    if (cpad->convert)
+      gst_video_converter_free (cpad->convert);
+    cpad->convert = NULL;
+
+    colorimetry = gst_video_colorimetry_to_string (&frame->info.colorimetry);
+    chroma = gst_video_chroma_to_string (frame->info.chroma_site);
+
+    wanted_colorimetry =
+        gst_video_colorimetry_to_string (&cpad->conversion_info.colorimetry);
+    wanted_chroma =
+        gst_video_chroma_to_string (cpad->conversion_info.chroma_site);
+
+    if (GST_VIDEO_INFO_FORMAT (&frame->info) !=
+        GST_VIDEO_INFO_FORMAT (&cpad->conversion_info)
+        || g_strcmp0 (colorimetry, wanted_colorimetry)
+        || g_strcmp0 (chroma, wanted_chroma)
+        || width != GST_VIDEO_FRAME_WIDTH (frame)
+        || height != GST_VIDEO_FRAME_HEIGHT (frame)) {
+      GstVideoInfo tmp_info;
+
+      gst_video_info_set_format (&tmp_info, cpad->conversion_info.finfo->format,
+          width, height);
+      tmp_info.chroma_site = cpad->conversion_info.chroma_site;
+      tmp_info.colorimetry = cpad->conversion_info.colorimetry;
+      tmp_info.par_n = cpad->conversion_info.par_n;
+      tmp_info.par_d = cpad->conversion_info.par_d;
+      tmp_info.fps_n = cpad->conversion_info.fps_n;
+      tmp_info.fps_d = cpad->conversion_info.fps_d;
+      tmp_info.flags = cpad->conversion_info.flags;
+      tmp_info.interlace_mode = cpad->conversion_info.interlace_mode;
+
+      GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d",
+          GST_VIDEO_INFO_FORMAT (&frame->info),
+          GST_VIDEO_INFO_FORMAT (&tmp_info));
+      cpad->convert = gst_video_converter_new (&frame->info, &tmp_info, NULL);
+      cpad->conversion_info = tmp_info;
+
+      if (!cpad->convert) {
+        GST_WARNING_OBJECT (pad, "No path found for conversion");
+        g_free (colorimetry);
+        g_free (wanted_colorimetry);
+        gst_video_frame_unmap (frame);
+        g_slice_free (GstVideoFrame, frame);
+        return FALSE;
+      }
+    } else {
+      cpad->conversion_info.width = width;
+      cpad->conversion_info.height = height;
+    }
+
+    g_free (colorimetry);
+    g_free (wanted_colorimetry);
+  }
+
+  if (cpad->alpha == 0.0) {
+    GST_DEBUG_OBJECT (vagg, "Pad has alpha 0.0, not converting frame");
+    converted_frame = NULL;
+    gst_video_frame_unmap (frame);
+    g_slice_free (GstVideoFrame, frame);
+  } else if (cpad->convert) {
+    gint converted_size;
+
+    converted_frame = g_slice_new0 (GstVideoFrame);
+
+    /* We wait until here to set the conversion infos, in case vagg->info changed */
+    converted_size = cpad->conversion_info.size;
+    outsize = GST_VIDEO_INFO_SIZE (&vagg->info);
+    converted_size = converted_size > outsize ? converted_size : outsize;
+    converted_buf = gst_buffer_new_allocate (NULL, converted_size, &params);
+
+    if (!gst_video_frame_map (converted_frame, &(cpad->conversion_info),
+            converted_buf, GST_MAP_READWRITE)) {
+      GST_WARNING_OBJECT (vagg, "Could not map converted frame");
+
+      g_slice_free (GstVideoFrame, converted_frame);
+      gst_video_frame_unmap (frame);
+      g_slice_free (GstVideoFrame, frame);
+      return FALSE;
+    }
+
+    gst_video_converter_frame (cpad->convert, frame, converted_frame);
+    cpad->converted_buffer = converted_buf;
+    gst_video_frame_unmap (frame);
+    g_slice_free (GstVideoFrame, frame);
+  } else {
+    converted_frame = frame;
+  }
+
+  pad->aggregated_frame = converted_frame;
+
+  return TRUE;
+}
+
+static void
+gst_compositor_pad_clean_frame (GstVideoAggregatorPad * pad,
+    GstVideoAggregator * vagg)
+{
+  GstCompositorPad *cpad = GST_COMPOSITOR_PAD (pad);
+
+  if (pad->aggregated_frame) {
+    gst_video_frame_unmap (pad->aggregated_frame);
+    g_slice_free (GstVideoFrame, pad->aggregated_frame);
+    pad->aggregated_frame = NULL;
+  }
+
+  if (cpad->converted_buffer) {
+    gst_buffer_unref (cpad->converted_buffer);
+    cpad->converted_buffer = NULL;
+  }
+}
+
+static void
+gst_compositor_pad_finalize (GObject * object)
+{
+  GstCompositorPad *pad = GST_COMPOSITOR_PAD (object);
+
+  if (pad->convert)
+    gst_video_converter_free (pad->convert);
+  pad->convert = NULL;
+
+  G_OBJECT_CLASS (gst_compositor_pad_parent_class)->finalize (object);
+}
+
 static void
 gst_compositor_pad_class_init (GstCompositorPadClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
+  GstVideoAggregatorPadClass *vaggpadclass =
+      (GstVideoAggregatorPadClass *) klass;
 
   gobject_class->set_property = gst_compositor_pad_set_property;
   gobject_class->get_property = gst_compositor_pad_get_property;
+  gobject_class->finalize = gst_compositor_pad_finalize;
 
   g_object_class_install_property (gobject_class, PROP_PAD_XPOS,
       g_param_spec_int ("xpos", "X Position", "X Position of the picture",
@@ -191,10 +482,24 @@
       g_param_spec_int ("ypos", "Y Position", "Y Position of the picture",
           G_MININT, G_MAXINT, DEFAULT_PAD_YPOS,
           G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_PAD_WIDTH,
+      g_param_spec_int ("width", "Width", "Width of the picture",
+          G_MININT, G_MAXINT, DEFAULT_PAD_WIDTH,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_PAD_HEIGHT,
+      g_param_spec_int ("height", "Height", "Height of the picture",
+          G_MININT, G_MAXINT, DEFAULT_PAD_HEIGHT,
+          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_PAD_ALPHA,
       g_param_spec_double ("alpha", "Alpha", "Alpha of the picture", 0.0, 1.0,
           DEFAULT_PAD_ALPHA,
           G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
+
+  vaggpadclass->set_info = GST_DEBUG_FUNCPTR (gst_compositor_pad_set_info);
+  vaggpadclass->prepare_frame =
+      GST_DEBUG_FUNCPTR (gst_compositor_pad_prepare_frame);
+  vaggpadclass->clean_frame =
+      GST_DEBUG_FUNCPTR (gst_compositor_pad_clean_frame);
 }
 
 static void
@@ -437,12 +742,15 @@
   return ret;
 }
 
-static gboolean
-_update_info (GstVideoAggregator * vagg, GstVideoInfo * info)
+static GstCaps *
+_update_caps (GstVideoAggregator * vagg, GstCaps * caps)
 {
   GList *l;
   gint best_width = -1, best_height = -1;
-  gboolean ret = FALSE;
+  GstVideoInfo info;
+  GstCaps *ret = NULL;
+
+  gst_video_info_from_caps (&info, caps);
 
   GST_OBJECT_LOCK (vagg);
   for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
@@ -451,8 +759,15 @@
     gint this_width, this_height;
     gint width, height;
 
-    width = GST_VIDEO_INFO_WIDTH (&vaggpad->info);
-    height = GST_VIDEO_INFO_HEIGHT (&vaggpad->info);
+    if (compositor_pad->width > 0)
+      width = compositor_pad->width;
+    else
+      width = GST_VIDEO_INFO_WIDTH (&vaggpad->info);
+
+    if (compositor_pad->height > 0)
+      height = compositor_pad->height;
+    else
+      height = GST_VIDEO_INFO_HEIGHT (&vaggpad->info);
 
     if (width == 0 || height == 0)
       continue;
@@ -468,9 +783,10 @@
   GST_OBJECT_UNLOCK (vagg);
 
   if (best_width > 0 && best_height > 0) {
-    gst_video_info_set_format (info, GST_VIDEO_INFO_FORMAT (info),
-        best_width, best_height);
-    ret = set_functions (GST_COMPOSITOR (vagg), info);
+    info.width = best_width;
+    info.height = best_height;
+    if (set_functions (GST_COMPOSITOR (vagg), &info))
+      ret = gst_video_info_to_caps (&info);
   }
 
   return ret;
@@ -485,7 +801,7 @@
   GstVideoFrame out_frame, *outframe;
 
   if (!gst_video_frame_map (&out_frame, &vagg->info, outbuf, GST_MAP_WRITE)) {
-
+    GST_WARNING_OBJECT (vagg, "Could not map output buffer");
     return GST_FLOW_ERROR;
   }
 
@@ -545,6 +861,48 @@
   return GST_FLOW_OK;
 }
 
+static gboolean
+_sink_query (GstAggregator * agg, GstAggregatorPad * bpad, GstQuery * query)
+{
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_ALLOCATION:{
+      GstCaps *caps;
+      GstVideoInfo info;
+      GstBufferPool *pool;
+      guint size;
+      GstStructure *structure;
+
+      gst_query_parse_allocation (query, &caps, NULL);
+
+      if (caps == NULL)
+        return FALSE;
+
+      if (!gst_video_info_from_caps (&info, caps))
+        return FALSE;
+
+      size = GST_VIDEO_INFO_SIZE (&info);
+
+      pool = gst_video_buffer_pool_new ();
+
+      structure = gst_buffer_pool_get_config (pool);
+      gst_buffer_pool_config_set_params (structure, caps, size, 0, 0);
+
+      if (!gst_buffer_pool_set_config (pool, structure)) {
+        gst_object_unref (pool);
+        return FALSE;
+      }
+
+      gst_query_add_allocation_pool (query, pool, size, 0, 0);
+      gst_object_unref (pool);
+      gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
+
+      return TRUE;
+    }
+    default:
+      return GST_AGGREGATOR_CLASS (parent_class)->sink_query (agg, bpad, query);
+  }
+}
+
 /* GObject boilerplate */
 static void
 gst_compositor_class_init (GstCompositorClass * klass)
@@ -559,7 +917,8 @@
   gobject_class->set_property = gst_compositor_set_property;
 
   agg_class->sinkpads_type = GST_TYPE_COMPOSITOR_PAD;
-  videoaggregator_class->update_info = _update_info;
+  agg_class->sink_query = _sink_query;
+  videoaggregator_class->update_caps = _update_caps;
   videoaggregator_class->aggregate_frames = gst_compositor_aggregate_frames;
 
   g_object_class_install_property (gobject_class, PROP_BACKGROUND,
diff --git a/gst/compositor/compositororc-dist.c b/gst/compositor/compositororc-dist.c
index daee2a7..4174482 100644
--- a/gst/compositor/compositororc-dist.c
+++ b/gst/compositor/compositororc-dist.c
@@ -619,11 +619,19 @@
       var46.x4[1] = (var45.x4[1] * var39.x4[1]) & 0xffff;
       var46.x4[2] = (var45.x4[2] * var39.x4[2]) & 0xffff;
       var46.x4[3] = (var45.x4[3] * var39.x4[3]) & 0xffff;
-      /* 7: shruw */
-      var47.x4[0] = ((orc_uint16) var46.x4[0]) >> 8;
-      var47.x4[1] = ((orc_uint16) var46.x4[1]) >> 8;
-      var47.x4[2] = ((orc_uint16) var46.x4[2]) >> 8;
-      var47.x4[3] = ((orc_uint16) var46.x4[3]) >> 8;
+      /* 7: div255w */
+      var47.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[0] + 128)) +
+              (((orc_uint16) (var46.x4[0] + 128)) >> 8))) >> 8;
+      var47.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[1] + 128)) +
+              (((orc_uint16) (var46.x4[1] + 128)) >> 8))) >> 8;
+      var47.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[2] + 128)) +
+              (((orc_uint16) (var46.x4[2] + 128)) >> 8))) >> 8;
+      var47.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[3] + 128)) +
+              (((orc_uint16) (var46.x4[3] + 128)) >> 8))) >> 8;
       /* 8: convubw */
       var48.x4[0] = (orc_uint8) var41.x4[0];
       var48.x4[1] = (orc_uint8) var41.x4[1];
@@ -745,11 +753,19 @@
       var46.x4[1] = (var45.x4[1] * var39.x4[1]) & 0xffff;
       var46.x4[2] = (var45.x4[2] * var39.x4[2]) & 0xffff;
       var46.x4[3] = (var45.x4[3] * var39.x4[3]) & 0xffff;
-      /* 7: shruw */
-      var47.x4[0] = ((orc_uint16) var46.x4[0]) >> 8;
-      var47.x4[1] = ((orc_uint16) var46.x4[1]) >> 8;
-      var47.x4[2] = ((orc_uint16) var46.x4[2]) >> 8;
-      var47.x4[3] = ((orc_uint16) var46.x4[3]) >> 8;
+      /* 7: div255w */
+      var47.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[0] + 128)) +
+              (((orc_uint16) (var46.x4[0] + 128)) >> 8))) >> 8;
+      var47.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[1] + 128)) +
+              (((orc_uint16) (var46.x4[1] + 128)) >> 8))) >> 8;
+      var47.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[2] + 128)) +
+              (((orc_uint16) (var46.x4[2] + 128)) >> 8))) >> 8;
+      var47.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var46.x4[3] + 128)) +
+              (((orc_uint16) (var46.x4[3] + 128)) >> 8))) >> 8;
       /* 8: convubw */
       var48.x4[0] = (orc_uint8) var41.x4[0];
       var48.x4[1] = (orc_uint8) var41.x4[1];
@@ -822,13 +838,13 @@
       static const orc_uint8 bc[] = {
         1, 7, 9, 25, 99, 111, 109, 112, 111, 115, 105, 116, 111, 114, 95, 111,
         114, 99, 95, 98, 108, 101, 110, 100, 95, 97, 114, 103, 98, 11, 4, 4,
-        12, 4, 4, 14, 4, 255, 0, 0, 0, 14, 2, 8, 0, 0, 0, 16,
-        2, 20, 4, 20, 2, 20, 1, 20, 4, 20, 8, 20, 8, 20, 8, 113,
-        32, 4, 163, 33, 32, 157, 34, 33, 152, 35, 34, 21, 2, 150, 38, 35,
-        21, 2, 89, 38, 38, 24, 21, 2, 95, 38, 38, 17, 21, 2, 150, 37,
-        32, 113, 32, 0, 21, 2, 150, 36, 32, 21, 2, 98, 37, 37, 36, 21,
-        2, 89, 37, 37, 38, 21, 2, 80, 37, 37, 21, 2, 70, 36, 36, 37,
-        21, 2, 157, 32, 36, 123, 32, 32, 16, 128, 0, 32, 2, 0,
+        12, 4, 4, 14, 4, 255, 0, 0, 0, 16, 2, 20, 4, 20, 2, 20,
+        1, 20, 4, 20, 8, 20, 8, 20, 8, 113, 32, 4, 163, 33, 32, 157,
+        34, 33, 152, 35, 34, 21, 2, 150, 38, 35, 21, 2, 89, 38, 38, 24,
+        21, 2, 80, 38, 38, 21, 2, 150, 37, 32, 113, 32, 0, 21, 2, 150,
+        36, 32, 21, 2, 98, 37, 37, 36, 21, 2, 89, 37, 37, 38, 21, 2,
+        80, 37, 37, 21, 2, 70, 36, 36, 37, 21, 2, 157, 32, 36, 123, 32,
+        32, 16, 128, 0, 32, 2, 0,
       };
       p = orc_program_new_from_static_bytecode (bc);
       orc_program_set_backup_function (p, _backup_compositor_orc_blend_argb);
@@ -840,7 +856,6 @@
       orc_program_add_destination (p, 4, "d1");
       orc_program_add_source (p, 4, "s1");
       orc_program_add_constant (p, 4, 0x000000ff, "c1");
-      orc_program_add_constant (p, 2, 0x00000008, "c2");
       orc_program_add_parameter (p, 2, "p1");
       orc_program_add_temporary (p, 4, "t1");
       orc_program_add_temporary (p, 2, "t2");
@@ -862,7 +877,7 @@
           ORC_VAR_D1);
       orc_program_append_2 (p, "mullw", 2, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_P1,
           ORC_VAR_D1);
-      orc_program_append_2 (p, "shruw", 2, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_C2,
+      orc_program_append_2 (p, "div255w", 2, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_D1,
           ORC_VAR_D1);
       orc_program_append_2 (p, "convubw", 2, ORC_VAR_T6, ORC_VAR_T1, ORC_VAR_D1,
           ORC_VAR_D1);
@@ -980,11 +995,19 @@
       var48.x4[1] = (var47.x4[1] * var40.x4[1]) & 0xffff;
       var48.x4[2] = (var47.x4[2] * var40.x4[2]) & 0xffff;
       var48.x4[3] = (var47.x4[3] * var40.x4[3]) & 0xffff;
-      /* 8: shruw */
-      var49.x4[0] = ((orc_uint16) var48.x4[0]) >> 8;
-      var49.x4[1] = ((orc_uint16) var48.x4[1]) >> 8;
-      var49.x4[2] = ((orc_uint16) var48.x4[2]) >> 8;
-      var49.x4[3] = ((orc_uint16) var48.x4[3]) >> 8;
+      /* 8: div255w */
+      var49.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[0] + 128)) +
+              (((orc_uint16) (var48.x4[0] + 128)) >> 8))) >> 8;
+      var49.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[1] + 128)) +
+              (((orc_uint16) (var48.x4[1] + 128)) >> 8))) >> 8;
+      var49.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[2] + 128)) +
+              (((orc_uint16) (var48.x4[2] + 128)) >> 8))) >> 8;
+      var49.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[3] + 128)) +
+              (((orc_uint16) (var48.x4[3] + 128)) >> 8))) >> 8;
       /* 9: convubw */
       var50.x4[0] = (orc_uint8) var42.x4[0];
       var50.x4[1] = (orc_uint8) var42.x4[1];
@@ -1109,11 +1132,19 @@
       var48.x4[1] = (var47.x4[1] * var40.x4[1]) & 0xffff;
       var48.x4[2] = (var47.x4[2] * var40.x4[2]) & 0xffff;
       var48.x4[3] = (var47.x4[3] * var40.x4[3]) & 0xffff;
-      /* 8: shruw */
-      var49.x4[0] = ((orc_uint16) var48.x4[0]) >> 8;
-      var49.x4[1] = ((orc_uint16) var48.x4[1]) >> 8;
-      var49.x4[2] = ((orc_uint16) var48.x4[2]) >> 8;
-      var49.x4[3] = ((orc_uint16) var48.x4[3]) >> 8;
+      /* 8: div255w */
+      var49.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[0] + 128)) +
+              (((orc_uint16) (var48.x4[0] + 128)) >> 8))) >> 8;
+      var49.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[1] + 128)) +
+              (((orc_uint16) (var48.x4[1] + 128)) >> 8))) >> 8;
+      var49.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[2] + 128)) +
+              (((orc_uint16) (var48.x4[2] + 128)) >> 8))) >> 8;
+      var49.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var48.x4[3] + 128)) +
+              (((orc_uint16) (var48.x4[3] + 128)) >> 8))) >> 8;
       /* 9: convubw */
       var50.x4[0] = (orc_uint8) var42.x4[0];
       var50.x4[1] = (orc_uint8) var42.x4[1];
@@ -1186,14 +1217,14 @@
       static const orc_uint8 bc[] = {
         1, 7, 9, 25, 99, 111, 109, 112, 111, 115, 105, 116, 111, 114, 95, 111,
         114, 99, 95, 98, 108, 101, 110, 100, 95, 98, 103, 114, 97, 11, 4, 4,
-        12, 4, 4, 14, 4, 0, 0, 0, 255, 14, 4, 24, 0, 0, 0, 14,
-        2, 8, 0, 0, 0, 16, 2, 20, 4, 20, 4, 20, 2, 20, 1, 20,
-        4, 20, 8, 20, 8, 20, 8, 113, 32, 4, 126, 33, 32, 17, 163, 34,
-        33, 157, 35, 34, 152, 36, 35, 21, 2, 150, 39, 36, 21, 2, 89, 39,
-        39, 24, 21, 2, 95, 39, 39, 18, 21, 2, 150, 38, 32, 113, 32, 0,
-        21, 2, 150, 37, 32, 21, 2, 98, 38, 38, 37, 21, 2, 89, 38, 38,
-        39, 21, 2, 80, 38, 38, 21, 2, 70, 37, 37, 38, 21, 2, 157, 32,
-        37, 123, 32, 32, 16, 128, 0, 32, 2, 0,
+        12, 4, 4, 14, 4, 0, 0, 0, 255, 14, 4, 24, 0, 0, 0, 16,
+        2, 20, 4, 20, 4, 20, 2, 20, 1, 20, 4, 20, 8, 20, 8, 20,
+        8, 113, 32, 4, 126, 33, 32, 17, 163, 34, 33, 157, 35, 34, 152, 36,
+        35, 21, 2, 150, 39, 36, 21, 2, 89, 39, 39, 24, 21, 2, 80, 39,
+        39, 21, 2, 150, 38, 32, 113, 32, 0, 21, 2, 150, 37, 32, 21, 2,
+        98, 38, 38, 37, 21, 2, 89, 38, 38, 39, 21, 2, 80, 38, 38, 21,
+        2, 70, 37, 37, 38, 21, 2, 157, 32, 37, 123, 32, 32, 16, 128, 0,
+        32, 2, 0,
       };
       p = orc_program_new_from_static_bytecode (bc);
       orc_program_set_backup_function (p, _backup_compositor_orc_blend_bgra);
@@ -1206,7 +1237,6 @@
       orc_program_add_source (p, 4, "s1");
       orc_program_add_constant (p, 4, 0xff000000, "c1");
       orc_program_add_constant (p, 4, 0x00000018, "c2");
-      orc_program_add_constant (p, 2, 0x00000008, "c3");
       orc_program_add_parameter (p, 2, "p1");
       orc_program_add_temporary (p, 4, "t1");
       orc_program_add_temporary (p, 4, "t2");
@@ -1231,7 +1261,7 @@
           ORC_VAR_D1);
       orc_program_append_2 (p, "mullw", 2, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_P1,
           ORC_VAR_D1);
-      orc_program_append_2 (p, "shruw", 2, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_C3,
+      orc_program_append_2 (p, "div255w", 2, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_D1,
           ORC_VAR_D1);
       orc_program_append_2 (p, "convubw", 2, ORC_VAR_T7, ORC_VAR_T1, ORC_VAR_D1,
           ORC_VAR_D1);
@@ -1368,11 +1398,19 @@
       var49.x4[1] = (var48.x4[1] * var41.x4[1]) & 0xffff;
       var49.x4[2] = (var48.x4[2] * var41.x4[2]) & 0xffff;
       var49.x4[3] = (var48.x4[3] * var41.x4[3]) & 0xffff;
-      /* 7: shruw */
-      var50.x4[0] = ((orc_uint16) var49.x4[0]) >> 8;
-      var50.x4[1] = ((orc_uint16) var49.x4[1]) >> 8;
-      var50.x4[2] = ((orc_uint16) var49.x4[2]) >> 8;
-      var50.x4[3] = ((orc_uint16) var49.x4[3]) >> 8;
+      /* 7: div255w */
+      var50.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[0] + 128)) +
+              (((orc_uint16) (var49.x4[0] + 128)) >> 8))) >> 8;
+      var50.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[1] + 128)) +
+              (((orc_uint16) (var49.x4[1] + 128)) >> 8))) >> 8;
+      var50.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[2] + 128)) +
+              (((orc_uint16) (var49.x4[2] + 128)) >> 8))) >> 8;
+      var50.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[3] + 128)) +
+              (((orc_uint16) (var49.x4[3] + 128)) >> 8))) >> 8;
       /* 8: convubw */
       var51.x4[0] = (orc_uint8) var44.x4[0];
       var51.x4[1] = (orc_uint8) var44.x4[1];
@@ -1576,11 +1614,19 @@
       var49.x4[1] = (var48.x4[1] * var41.x4[1]) & 0xffff;
       var49.x4[2] = (var48.x4[2] * var41.x4[2]) & 0xffff;
       var49.x4[3] = (var48.x4[3] * var41.x4[3]) & 0xffff;
-      /* 7: shruw */
-      var50.x4[0] = ((orc_uint16) var49.x4[0]) >> 8;
-      var50.x4[1] = ((orc_uint16) var49.x4[1]) >> 8;
-      var50.x4[2] = ((orc_uint16) var49.x4[2]) >> 8;
-      var50.x4[3] = ((orc_uint16) var49.x4[3]) >> 8;
+      /* 7: div255w */
+      var50.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[0] + 128)) +
+              (((orc_uint16) (var49.x4[0] + 128)) >> 8))) >> 8;
+      var50.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[1] + 128)) +
+              (((orc_uint16) (var49.x4[1] + 128)) >> 8))) >> 8;
+      var50.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[2] + 128)) +
+              (((orc_uint16) (var49.x4[2] + 128)) >> 8))) >> 8;
+      var50.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var49.x4[3] + 128)) +
+              (((orc_uint16) (var49.x4[3] + 128)) >> 8))) >> 8;
       /* 8: convubw */
       var51.x4[0] = (orc_uint8) var44.x4[0];
       var51.x4[1] = (orc_uint8) var44.x4[1];
@@ -1714,17 +1760,17 @@
         1, 7, 9, 27, 99, 111, 109, 112, 111, 115, 105, 116, 111, 114, 95, 111,
         114, 99, 95, 111, 118, 101, 114, 108, 97, 121, 95, 97, 114, 103, 98, 11,
         4, 4, 12, 4, 4, 14, 4, 255, 255, 255, 255, 14, 4, 255, 0, 0,
-        0, 14, 4, 0, 255, 255, 255, 14, 2, 8, 0, 0, 0, 16, 2, 20,
-        4, 20, 2, 20, 1, 20, 8, 20, 8, 20, 8, 20, 4, 20, 8, 20,
-        8, 113, 32, 4, 163, 33, 32, 157, 34, 33, 152, 38, 34, 21, 2, 150,
-        35, 38, 21, 2, 89, 35, 35, 24, 21, 2, 95, 35, 35, 19, 21, 2,
-        150, 40, 32, 21, 2, 89, 40, 40, 35, 115, 38, 16, 21, 2, 150, 36,
-        38, 21, 2, 98, 36, 36, 35, 113, 32, 0, 163, 33, 32, 157, 34, 33,
-        152, 38, 34, 21, 2, 150, 37, 38, 21, 2, 89, 37, 37, 36, 21, 2,
-        80, 37, 37, 21, 2, 150, 39, 32, 21, 2, 89, 39, 39, 37, 21, 2,
-        70, 39, 39, 40, 21, 2, 70, 37, 37, 35, 21, 2, 81, 39, 39, 37,
-        21, 2, 157, 32, 39, 106, 32, 32, 18, 21, 2, 157, 38, 37, 106, 38,
-        38, 17, 123, 32, 32, 38, 128, 0, 32, 2, 0,
+        0, 14, 4, 0, 255, 255, 255, 16, 2, 20, 4, 20, 2, 20, 1, 20,
+        8, 20, 8, 20, 8, 20, 4, 20, 8, 20, 8, 113, 32, 4, 163, 33,
+        32, 157, 34, 33, 152, 38, 34, 21, 2, 150, 35, 38, 21, 2, 89, 35,
+        35, 24, 21, 2, 80, 35, 35, 21, 2, 150, 40, 32, 21, 2, 89, 40,
+        40, 35, 115, 38, 16, 21, 2, 150, 36, 38, 21, 2, 98, 36, 36, 35,
+        113, 32, 0, 163, 33, 32, 157, 34, 33, 152, 38, 34, 21, 2, 150, 37,
+        38, 21, 2, 89, 37, 37, 36, 21, 2, 80, 37, 37, 21, 2, 150, 39,
+        32, 21, 2, 89, 39, 39, 37, 21, 2, 70, 39, 39, 40, 21, 2, 70,
+        37, 37, 35, 21, 2, 81, 39, 39, 37, 21, 2, 157, 32, 39, 106, 32,
+        32, 18, 21, 2, 157, 38, 37, 106, 38, 38, 17, 123, 32, 32, 38, 128,
+        0, 32, 2, 0,
       };
       p = orc_program_new_from_static_bytecode (bc);
       orc_program_set_backup_function (p, _backup_compositor_orc_overlay_argb);
@@ -1738,7 +1784,6 @@
       orc_program_add_constant (p, 4, 0xffffffff, "c1");
       orc_program_add_constant (p, 4, 0x000000ff, "c2");
       orc_program_add_constant (p, 4, 0xffffff00, "c3");
-      orc_program_add_constant (p, 2, 0x00000008, "c4");
       orc_program_add_parameter (p, 2, "p1");
       orc_program_add_temporary (p, 4, "t1");
       orc_program_add_temporary (p, 2, "t2");
@@ -1762,7 +1807,7 @@
           ORC_VAR_D1);
       orc_program_append_2 (p, "mullw", 2, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_P1,
           ORC_VAR_D1);
-      orc_program_append_2 (p, "shruw", 2, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C4,
+      orc_program_append_2 (p, "div255w", 2, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_D1,
           ORC_VAR_D1);
       orc_program_append_2 (p, "convubw", 2, ORC_VAR_T9, ORC_VAR_T1, ORC_VAR_D1,
           ORC_VAR_D1);
@@ -1929,11 +1974,19 @@
       var51.x4[1] = (var50.x4[1] * var42.x4[1]) & 0xffff;
       var51.x4[2] = (var50.x4[2] * var42.x4[2]) & 0xffff;
       var51.x4[3] = (var50.x4[3] * var42.x4[3]) & 0xffff;
-      /* 8: shruw */
-      var52.x4[0] = ((orc_uint16) var51.x4[0]) >> 8;
-      var52.x4[1] = ((orc_uint16) var51.x4[1]) >> 8;
-      var52.x4[2] = ((orc_uint16) var51.x4[2]) >> 8;
-      var52.x4[3] = ((orc_uint16) var51.x4[3]) >> 8;
+      /* 8: div255w */
+      var52.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[0] + 128)) +
+              (((orc_uint16) (var51.x4[0] + 128)) >> 8))) >> 8;
+      var52.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[1] + 128)) +
+              (((orc_uint16) (var51.x4[1] + 128)) >> 8))) >> 8;
+      var52.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[2] + 128)) +
+              (((orc_uint16) (var51.x4[2] + 128)) >> 8))) >> 8;
+      var52.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[3] + 128)) +
+              (((orc_uint16) (var51.x4[3] + 128)) >> 8))) >> 8;
       /* 9: convubw */
       var53.x4[0] = (orc_uint8) var45.x4[0];
       var53.x4[1] = (orc_uint8) var45.x4[1];
@@ -2143,11 +2196,19 @@
       var51.x4[1] = (var50.x4[1] * var42.x4[1]) & 0xffff;
       var51.x4[2] = (var50.x4[2] * var42.x4[2]) & 0xffff;
       var51.x4[3] = (var50.x4[3] * var42.x4[3]) & 0xffff;
-      /* 8: shruw */
-      var52.x4[0] = ((orc_uint16) var51.x4[0]) >> 8;
-      var52.x4[1] = ((orc_uint16) var51.x4[1]) >> 8;
-      var52.x4[2] = ((orc_uint16) var51.x4[2]) >> 8;
-      var52.x4[3] = ((orc_uint16) var51.x4[3]) >> 8;
+      /* 8: div255w */
+      var52.x4[0] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[0] + 128)) +
+              (((orc_uint16) (var51.x4[0] + 128)) >> 8))) >> 8;
+      var52.x4[1] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[1] + 128)) +
+              (((orc_uint16) (var51.x4[1] + 128)) >> 8))) >> 8;
+      var52.x4[2] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[2] + 128)) +
+              (((orc_uint16) (var51.x4[2] + 128)) >> 8))) >> 8;
+      var52.x4[3] =
+          ((orc_uint16) (((orc_uint16) (var51.x4[3] + 128)) +
+              (((orc_uint16) (var51.x4[3] + 128)) >> 8))) >> 8;
       /* 9: convubw */
       var53.x4[0] = (orc_uint8) var45.x4[0];
       var53.x4[1] = (orc_uint8) var45.x4[1];
@@ -2283,18 +2344,18 @@
         1, 7, 9, 27, 99, 111, 109, 112, 111, 115, 105, 116, 111, 114, 95, 111,
         114, 99, 95, 111, 118, 101, 114, 108, 97, 121, 95, 98, 103, 114, 97, 11,
         4, 4, 12, 4, 4, 14, 4, 255, 255, 255, 255, 14, 4, 0, 0, 0,
-        255, 14, 4, 255, 255, 255, 0, 14, 4, 24, 0, 0, 0, 14, 2, 8,
-        0, 0, 0, 16, 2, 20, 4, 20, 4, 20, 2, 20, 1, 20, 8, 20,
-        8, 20, 8, 20, 4, 20, 8, 20, 8, 113, 32, 4, 126, 33, 32, 19,
-        163, 34, 33, 157, 35, 34, 152, 39, 35, 21, 2, 150, 36, 39, 21, 2,
-        89, 36, 36, 24, 21, 2, 95, 36, 36, 20, 21, 2, 150, 41, 32, 21,
-        2, 89, 41, 41, 36, 115, 39, 16, 21, 2, 150, 37, 39, 21, 2, 98,
-        37, 37, 36, 113, 32, 0, 126, 33, 32, 19, 163, 34, 33, 157, 35, 34,
-        152, 39, 35, 21, 2, 150, 38, 39, 21, 2, 89, 38, 38, 37, 21, 2,
-        80, 38, 38, 21, 2, 150, 40, 32, 21, 2, 89, 40, 40, 38, 21, 2,
-        70, 40, 40, 41, 21, 2, 70, 38, 38, 36, 21, 2, 81, 40, 40, 38,
-        21, 2, 157, 32, 40, 106, 32, 32, 18, 21, 2, 157, 39, 38, 106, 39,
-        39, 17, 123, 32, 32, 39, 128, 0, 32, 2, 0,
+        255, 14, 4, 255, 255, 255, 0, 14, 4, 24, 0, 0, 0, 16, 2, 20,
+        4, 20, 4, 20, 2, 20, 1, 20, 8, 20, 8, 20, 8, 20, 4, 20,
+        8, 20, 8, 113, 32, 4, 126, 33, 32, 19, 163, 34, 33, 157, 35, 34,
+        152, 39, 35, 21, 2, 150, 36, 39, 21, 2, 89, 36, 36, 24, 21, 2,
+        80, 36, 36, 21, 2, 150, 41, 32, 21, 2, 89, 41, 41, 36, 115, 39,
+        16, 21, 2, 150, 37, 39, 21, 2, 98, 37, 37, 36, 113, 32, 0, 126,
+        33, 32, 19, 163, 34, 33, 157, 35, 34, 152, 39, 35, 21, 2, 150, 38,
+        39, 21, 2, 89, 38, 38, 37, 21, 2, 80, 38, 38, 21, 2, 150, 40,
+        32, 21, 2, 89, 40, 40, 38, 21, 2, 70, 40, 40, 41, 21, 2, 70,
+        38, 38, 36, 21, 2, 81, 40, 40, 38, 21, 2, 157, 32, 40, 106, 32,
+        32, 18, 21, 2, 157, 39, 38, 106, 39, 39, 17, 123, 32, 32, 39, 128,
+        0, 32, 2, 0,
       };
       p = orc_program_new_from_static_bytecode (bc);
       orc_program_set_backup_function (p, _backup_compositor_orc_overlay_bgra);
@@ -2309,7 +2370,6 @@
       orc_program_add_constant (p, 4, 0xff000000, "c2");
       orc_program_add_constant (p, 4, 0x00ffffff, "c3");
       orc_program_add_constant (p, 4, 0x00000018, "c4");
-      orc_program_add_constant (p, 2, 0x00000008, "c5");
       orc_program_add_parameter (p, 2, "p1");
       orc_program_add_temporary (p, 4, "t1");
       orc_program_add_temporary (p, 4, "t2");
@@ -2336,7 +2396,7 @@
           ORC_VAR_D1);
       orc_program_append_2 (p, "mullw", 2, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_P1,
           ORC_VAR_D1);
-      orc_program_append_2 (p, "shruw", 2, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C5,
+      orc_program_append_2 (p, "div255w", 2, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_D1,
           ORC_VAR_D1);
       orc_program_append_2 (p, "convubw", 2, ORC_VAR_T10, ORC_VAR_T1,
           ORC_VAR_D1, ORC_VAR_D1);
diff --git a/gst/compositor/compositororc.orc b/gst/compositor/compositororc.orc
index 5a348b2..234ec21 100644
--- a/gst/compositor/compositororc.orc
+++ b/gst/compositor/compositororc.orc
@@ -17,7 +17,7 @@
 .param 2 p1
 .temp 2 t1
 .temp 2 t2
-.const 1 c1 8 
+.const 1 c1 8
 
 convubw t1, d1
 convubw t2, s1
@@ -49,12 +49,13 @@
 splatbl a, tb
 x4 convubw a_wide, a
 x4 mullw a_wide, a_wide, alpha
-x4 shruw a_wide, a_wide, 8
+x4 div255w a_wide, a_wide
 x4 convubw s_wide, t
 loadl t, d
 x4 convubw d_wide, t
 x4 subw s_wide, s_wide, d_wide
 x4 mullw s_wide, s_wide, a_wide
+
 x4 div255w s_wide, s_wide
 x4 addw d_wide, d_wide, s_wide
 x4 convwb t, d_wide
@@ -83,13 +84,15 @@
 splatbl a, tb
 x4 convubw a_wide, a
 x4 mullw a_wide, a_wide, alpha
-x4 shruw a_wide, a_wide, 8
+x4 div255w a_wide, a_wide
+
 x4 convubw s_wide, t
 loadl t, d
 x4 convubw d_wide, t
 x4 subw s_wide, s_wide, d_wide
 x4 mullw s_wide, s_wide, a_wide
 x4 div255w s_wide, s_wide
+
 x4 addw d_wide, d_wide, s_wide
 x4 convwb t, d_wide
 orl t, t, a_alpha
@@ -114,14 +117,14 @@
 .const 4 a_alpha 0x000000ff
 .const 4 a_alpha_inv 0xffffff00
 
-# calc source alpha as alpha_s = alpha_s * alpha / 256
+# calc source alpha as alpha_s = alpha_s * alpha / 255
 loadl t, s
 convlw tw, t
 convwb tb, tw
 splatbl a, tb
 x4 convubw alpha_s, a
 x4 mullw alpha_s, alpha_s, alpha
-x4 shruw alpha_s, alpha_s, 8
+x4 div255w alpha_s, alpha_s
 x4 convubw s_wide, t
 x4 mullw s_wide, s_wide, alpha_s
 
@@ -175,7 +178,7 @@
 .const 4 a_alpha 0xff000000
 .const 4 a_alpha_inv 0x00ffffff
 
-# calc source alpha as alpha_s = alpha_s * alpha / 256
+# calc source alpha as alpha_s = alpha_s * alpha / 255
 loadl t, s
 shrul t2, t, 24
 convlw tw, t2
@@ -183,7 +186,7 @@
 splatbl a, tb
 x4 convubw alpha_s, a
 x4 mullw alpha_s, alpha_s, alpha
-x4 shruw alpha_s, alpha_s, 8
+x4 div255w alpha_s, alpha_s
 x4 convubw s_wide, t
 x4 mullw s_wide, s_wide, alpha_s
 
diff --git a/gst/compositor/compositorpad.h b/gst/compositor/compositorpad.h
index 0ba580e..cb6f7c7 100644
--- a/gst/compositor/compositorpad.h
+++ b/gst/compositor/compositorpad.h
@@ -50,8 +50,12 @@
 
   /* properties */
   gint xpos, ypos;
-  guint zorder;
+  gint width, height;
   gdouble alpha;
+
+  GstVideoConverter *convert;
+  GstVideoInfo conversion_info;
+  GstBuffer *converted_buffer;
 };
 
 struct _GstCompositorPadClass
diff --git a/gst/dataurisrc/Makefile.in b/gst/dataurisrc/Makefile.in
index 871e1a3..8b1e1bf 100644
--- a/gst/dataurisrc/Makefile.in
+++ b/gst/dataurisrc/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -242,8 +242,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -282,7 +286,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -290,6 +293,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -339,8 +344,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -419,7 +422,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -428,7 +430,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -441,7 +442,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -466,6 +466,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -539,10 +541,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -568,6 +574,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -604,6 +613,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -644,17 +654,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -671,6 +680,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/dccp/Makefile.in b/gst/dccp/Makefile.in
index 0b096ac..2b883b8 100644
--- a/gst/dccp/Makefile.in
+++ b/gst/dccp/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -251,8 +251,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -291,7 +295,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -299,6 +302,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -348,8 +353,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -428,7 +431,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -437,7 +439,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -450,7 +451,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -475,6 +475,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -548,10 +550,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -577,6 +583,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -613,6 +622,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -653,17 +663,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -680,6 +689,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/debugutils/Makefile.in b/gst/debugutils/Makefile.in
index 0ced776..9bb83ae 100644
--- a/gst/debugutils/Makefile.in
+++ b/gst/debugutils/Makefile.in
@@ -99,6 +99,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -112,7 +113,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -266,8 +266,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -306,7 +310,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -314,6 +317,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -363,8 +368,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -443,7 +446,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -452,7 +454,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -465,7 +466,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -490,6 +490,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -563,10 +565,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -592,6 +598,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -628,6 +637,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -668,17 +678,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -695,6 +704,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/debugutils/gstchopmydata.c b/gst/debugutils/gstchopmydata.c
index 97372e3..e7800d5 100644
--- a/gst/debugutils/gstchopmydata.c
+++ b/gst/debugutils/gstchopmydata.c
@@ -284,6 +284,9 @@
     buffer =
         gst_adapter_take_buffer (chopmydata->adapter, chopmydata->next_size);
 
+    GST_BUFFER_PTS (buffer) = gst_adapter_prev_pts (chopmydata->adapter, NULL);
+    GST_BUFFER_DTS (buffer) = gst_adapter_prev_dts (chopmydata->adapter, NULL);
+
     chopmydata->next_size = 0;
 
     ret = gst_pad_push (chopmydata->srcpad, buffer);
diff --git a/gst/debugutils/gstwatchdog.c b/gst/debugutils/gstwatchdog.c
index eb77765..3292b43 100644
--- a/gst/debugutils/gstwatchdog.c
+++ b/gst/debugutils/gstwatchdog.c
@@ -66,7 +66,8 @@
     GstEvent * event);
 static GstFlowReturn gst_watchdog_transform_ip (GstBaseTransform * trans,
     GstBuffer * buf);
-static void gst_watchdog_feed (GstWatchdog * watchdog);
+static void gst_watchdog_feed (GstWatchdog * watchdog, gpointer mini_object,
+    gboolean force);
 
 static GstStateChangeReturn
 gst_watchdog_change_state (GstElement * element, GstStateChange transition);
@@ -140,7 +141,7 @@
     case PROP_TIMEOUT:
       GST_OBJECT_LOCK (watchdog);
       watchdog->timeout = g_value_get_int (value);
-      gst_watchdog_feed (watchdog);
+      gst_watchdog_feed (watchdog, NULL, FALSE);
       GST_OBJECT_UNLOCK (watchdog);
       break;
     default:
@@ -206,19 +207,54 @@
   return FALSE;
 }
 
+/*  Call with OBJECT_LOCK taken */
 static void
-gst_watchdog_feed (GstWatchdog * watchdog)
+gst_watchdog_feed (GstWatchdog * watchdog, gpointer mini_object, gboolean force)
 {
   if (watchdog->source) {
+    if (watchdog->waiting_for_flush_start) {
+      if (mini_object && GST_IS_EVENT (mini_object) &&
+          GST_EVENT_TYPE (mini_object) == GST_EVENT_FLUSH_START) {
+        watchdog->waiting_for_flush_start = FALSE;
+        watchdog->waiting_for_flush_stop = TRUE;
+      }
+
+      force = TRUE;
+    } else if (watchdog->waiting_for_flush_stop) {
+      if (mini_object && GST_IS_EVENT (mini_object) &&
+          GST_EVENT_TYPE (mini_object) == GST_EVENT_FLUSH_STOP) {
+        watchdog->waiting_for_flush_stop = FALSE;
+        watchdog->waiting_for_a_buffer = TRUE;
+      }
+
+      force = TRUE;
+    } else if (watchdog->waiting_for_a_buffer) {
+      if (mini_object && GST_IS_BUFFER (mini_object)) {
+        watchdog->waiting_for_a_buffer = FALSE;
+        GST_DEBUG_OBJECT (watchdog, "Got a buffer \\o/");
+      } else {
+        GST_DEBUG_OBJECT (watchdog, "Waiting for a buffer and did not get it,"
+            " keep trying even in PAUSED state");
+        force = TRUE;
+      }
+    }
     g_source_destroy (watchdog->source);
     g_source_unref (watchdog->source);
     watchdog->source = NULL;
+
   }
 
-  if (watchdog->timeout != 0 && watchdog->main_context) {
+  if (watchdog->timeout == 0) {
+    GST_LOG_OBJECT (watchdog, "Timeout is 0 => nothing to do");
+  } else if (watchdog->main_context == NULL) {
+    GST_LOG_OBJECT (watchdog, "No maincontext => nothing to do");
+  } else if ((GST_STATE (watchdog) != GST_STATE_PLAYING) && force == FALSE) {
+    GST_LOG_OBJECT (watchdog,
+        "Not in playing and force is FALSE => Nothing to do");
+  } else {
     watchdog->source = g_timeout_source_new (watchdog->timeout);
-    g_source_set_callback (watchdog->source, gst_watchdog_trigger, gst_object_ref (watchdog),
-        gst_object_unref);
+    g_source_set_callback (watchdog->source, gst_watchdog_trigger,
+        gst_object_ref (watchdog), gst_object_unref);
     g_source_attach (watchdog->source, watchdog->main_context);
   }
 }
@@ -283,7 +319,7 @@
   GST_DEBUG_OBJECT (watchdog, "sink_event");
 
   GST_OBJECT_LOCK (watchdog);
-  gst_watchdog_feed (watchdog);
+  gst_watchdog_feed (watchdog, event, FALSE);
   GST_OBJECT_UNLOCK (watchdog);
 
   return
@@ -294,12 +330,25 @@
 static gboolean
 gst_watchdog_src_event (GstBaseTransform * trans, GstEvent * event)
 {
+  gboolean force = FALSE;
   GstWatchdog *watchdog = GST_WATCHDOG (trans);
 
   GST_DEBUG_OBJECT (watchdog, "src_event");
 
   GST_OBJECT_LOCK (watchdog);
-  gst_watchdog_feed (watchdog);
+  if (GST_EVENT_TYPE (event) == GST_EVENT_SEEK) {
+    GstSeekFlags flags;
+
+    gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL);
+
+    if (flags & GST_SEEK_FLAG_FLUSH) {
+      force = TRUE;
+      GST_DEBUG_OBJECT (watchdog, "Got a FLUSHING seek, we need a buffer now!");
+      watchdog->waiting_for_flush_start = TRUE;
+    }
+  }
+
+  gst_watchdog_feed (watchdog, event, force);
   GST_OBJECT_UNLOCK (watchdog);
 
   return GST_BASE_TRANSFORM_CLASS (gst_watchdog_parent_class)->src_event (trans,
@@ -314,7 +363,7 @@
   GST_DEBUG_OBJECT (watchdog, "transform_ip");
 
   GST_OBJECT_LOCK (watchdog);
-  gst_watchdog_feed (watchdog);
+  gst_watchdog_feed (watchdog, buf, FALSE);
   GST_OBJECT_UNLOCK (watchdog);
 
   return GST_FLOW_OK;
@@ -332,11 +381,10 @@
   GST_DEBUG_OBJECT (watchdog, "gst_watchdog_change_state");
 
   switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       /* Activate timer */
       GST_OBJECT_LOCK (watchdog);
-      gst_watchdog_feed (watchdog);
+      gst_watchdog_feed (watchdog, NULL, FALSE);
       GST_OBJECT_UNLOCK (watchdog);
       break;
     default:
@@ -348,6 +396,12 @@
       transition);
 
   switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      GST_OBJECT_LOCK (watchdog);
+      watchdog->waiting_for_a_buffer = TRUE;
+      gst_watchdog_feed (watchdog, NULL, TRUE);
+      GST_OBJECT_UNLOCK (watchdog);
+      break;
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
       /* Disable the timer */
       GST_OBJECT_LOCK (watchdog);
diff --git a/gst/debugutils/gstwatchdog.h b/gst/debugutils/gstwatchdog.h
index 40740ef..b296e0f 100644
--- a/gst/debugutils/gstwatchdog.h
+++ b/gst/debugutils/gstwatchdog.h
@@ -45,6 +45,10 @@
   GMainLoop *main_loop;
   GThread *thread;
   GSource *source;
+
+  gboolean waiting_for_a_buffer;
+  gboolean waiting_for_flush_start;
+  gboolean waiting_for_flush_stop;
 };
 
 struct _GstWatchdogClass
diff --git a/gst/dvbsuboverlay/Makefile.in b/gst/dvbsuboverlay/Makefile.in
index b6ee570..ca741da 100644
--- a/gst/dvbsuboverlay/Makefile.in
+++ b/gst/dvbsuboverlay/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c
index 3965b65..5dcdd15 100644
--- a/gst/dvbsuboverlay/gstdvbsuboverlay.c
+++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c
@@ -692,13 +692,8 @@
     overlay_caps = gst_caps_copy (caps);
 
     f = gst_caps_get_features (overlay_caps, 0);
-    if (f == NULL) {
-      f = gst_caps_features_new
-          (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, NULL);
-    } else {
-      gst_caps_features_add (f,
-          GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
-    }
+    gst_caps_features_add (f,
+        GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
 
     ret = gst_pad_peer_query_accept_caps (overlay->srcpad, overlay_caps);
     GST_DEBUG_OBJECT (overlay, "Downstream accepts the overlay meta: %d", ret);
@@ -720,7 +715,7 @@
     GstQuery *query;
 
     /* find supported meta */
-    query = gst_query_new_allocation (caps, TRUE);
+    query = gst_query_new_allocation (caps, FALSE);
 
     if (!gst_pad_peer_query (overlay->srcpad, query)) {
       /* no problem, we use the query defaults */
diff --git a/gst/dvdspu/Makefile.in b/gst/dvdspu/Makefile.in
index 340018b..b2efeb1 100644
--- a/gst/dvdspu/Makefile.in
+++ b/gst/dvdspu/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c
index 2c270fd..f126f34 100644
--- a/gst/dvdspu/gstdvdspu.c
+++ b/gst/dvdspu/gstdvdspu.c
@@ -32,10 +32,6 @@
 #  include <config.h>
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include <gst/gst-i18n-plugin.h>
 #include <gst/video/video.h>
 
@@ -830,6 +826,9 @@
 
   if (dvdspu->spu_state.flags & SPU_STATE_STILL_FRAME) {
 
+    if (dvdspu->video_seg.format != GST_FORMAT_TIME)
+      return;                   /* No video segment or frames yet */
+
     vid_ts = gst_segment_to_running_time (&dvdspu->video_seg,
         GST_FORMAT_TIME, dvdspu->video_seg.position);
     sub_ts = gst_segment_to_running_time (&dvdspu->subp_seg,
@@ -1170,7 +1169,6 @@
        * video might still continue, though */
       gst_event_unref (event);
       goto done;
-      break;
     default:
       res = gst_pad_event_default (pad, parent, event);
       break;
diff --git a/gst/dvdspu/gstspu-vobsub-render.c b/gst/dvdspu/gstspu-vobsub-render.c
index b3b8288..3c5674d 100644
--- a/gst/dvdspu/gstspu-vobsub-render.c
+++ b/gst/dvdspu/gstspu-vobsub-render.c
@@ -168,7 +168,7 @@
   return code;
 }
 
-static inline void
+static inline gboolean
 gstspu_vobsub_draw_rle_run (SpuState * state, gint16 x, gint16 end,
     SpuColour * colour)
 {
@@ -191,7 +191,10 @@
     }
     /* Update the compositing buffer so we know how much to blend later */
     *(state->vobsub.comp_last_x_ptr) = end - 1; /* end is the start of the *next* run */
+
+    return TRUE;
   }
+  return FALSE;
 }
 
 static inline gint16
@@ -204,16 +207,17 @@
     return MIN (end, x + (rle_code >> 2));
 }
 
-static void gstspu_vobsub_render_line_with_chgcol (SpuState * state,
+static gboolean gstspu_vobsub_render_line_with_chgcol (SpuState * state,
     guint8 * planes[3], guint16 * rle_offset);
 static gboolean gstspu_vobsub_update_chgcol (SpuState * state);
 
-static void
+static gboolean
 gstspu_vobsub_render_line (SpuState * state, guint8 * planes[3],
     guint16 * rle_offset)
 {
   gint16 x, next_x, end, rle_code, next_draw_x;
   SpuColour *colour;
+  gboolean visible = FALSE;
 
   /* Check for special case of chg_col info to use (either highlight or
    * ChgCol command */
@@ -222,8 +226,7 @@
       /* Check the top & bottom, because we might not be within the region yet */
       if (state->vobsub.cur_Y >= state->vobsub.cur_chg_col->top &&
           state->vobsub.cur_Y <= state->vobsub.cur_chg_col->bottom) {
-        gstspu_vobsub_render_line_with_chgcol (state, planes, rle_offset);
-        return;
+        return gstspu_vobsub_render_line_with_chgcol (state, planes, rle_offset);
       }
     }
   }
@@ -250,9 +253,11 @@
     /* Now draw the run between [x,next_x) */
     if (state->vobsub.cur_Y >= state->vobsub.clip_rect.top &&
         state->vobsub.cur_Y <= state->vobsub.clip_rect.bottom)
-      gstspu_vobsub_draw_rle_run (state, x, next_draw_x, colour);
+      visible |= gstspu_vobsub_draw_rle_run (state, x, next_draw_x, colour);
     x = next_x;
   }
+
+  return visible;
 }
 
 static gboolean
@@ -282,7 +287,7 @@
   return FALSE;
 }
 
-static void
+static gboolean
 gstspu_vobsub_render_line_with_chgcol (SpuState * state, guint8 * planes[3],
     guint16 * rle_offset)
 {
@@ -294,6 +299,7 @@
   SpuVobsubPixCtrlI *next_pix_ctrl;
   SpuVobsubPixCtrlI *end_pix_ctrl;
   SpuVobsubPixCtrlI dummy_pix_ctrl;
+  gboolean visible = FALSE;
   gint16 cur_reg_end;
   gint i;
 
@@ -342,7 +348,7 @@
 
       if (G_LIKELY (x < run_end)) {
         colour = &cur_pix_ctrl->pal_cache[rle_code & 3];
-        gstspu_vobsub_draw_rle_run (state, x, run_draw_end, colour);
+        visible |= gstspu_vobsub_draw_rle_run (state, x, run_draw_end, colour);
         x = run_end;
       }
 
@@ -358,6 +364,8 @@
       }
     }
   }
+
+  return visible;
 }
 
 static void
@@ -544,7 +552,7 @@
 
   for (state->vobsub.cur_Y = y; state->vobsub.cur_Y <= last_y;
       state->vobsub.cur_Y++) {
-    gboolean clip;
+    gboolean clip, visible = FALSE;
 
     clip = (state->vobsub.cur_Y < state->vobsub.clip_rect.top
         || state->vobsub.cur_Y > state->vobsub.clip_rect.bottom);
@@ -562,9 +570,9 @@
 
     /* Render odd line */
     state->vobsub.comp_last_x_ptr = state->vobsub.comp_last_x + 1;
-    gstspu_vobsub_render_line (state, planes, &state->vobsub.cur_offsets[1]);
+    visible |= gstspu_vobsub_render_line (state, planes, &state->vobsub.cur_offsets[1]);
 
-    if (!clip) {
+    if (visible && !clip) {
       /* Blend the accumulated UV compositing buffers onto the output */
       gstspu_vobsub_blend_comp_buffers (state, planes);
     }
@@ -576,7 +584,7 @@
   }
 
   if (state->vobsub.cur_Y == state->vobsub.disp_rect.bottom) {
-    gboolean clip;
+    gboolean clip, visible = FALSE;
 
     clip = (state->vobsub.cur_Y < state->vobsub.clip_rect.top
         || state->vobsub.cur_Y > state->vobsub.clip_rect.bottom);
@@ -588,8 +596,9 @@
        * after the above loop exited. */
       gstspu_vobsub_clear_comp_buffers (state);
       state->vobsub.comp_last_x_ptr = state->vobsub.comp_last_x;
-      gstspu_vobsub_render_line (state, planes, &state->vobsub.cur_offsets[0]);
-      gstspu_vobsub_blend_comp_buffers (state, planes);
+      visible |= gstspu_vobsub_render_line (state, planes, &state->vobsub.cur_offsets[0]);
+      if (visible)
+        gstspu_vobsub_blend_comp_buffers (state, planes);
     }
   }
 
diff --git a/gst/faceoverlay/Makefile.in b/gst/faceoverlay/Makefile.in
index c383333..e74886d 100644
--- a/gst/faceoverlay/Makefile.in
+++ b/gst/faceoverlay/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/festival/Makefile.in b/gst/festival/Makefile.in
index 49f6073..6411e59 100644
--- a/gst/festival/Makefile.in
+++ b/gst/festival/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/fieldanalysis/Makefile.in b/gst/fieldanalysis/Makefile.in
index bc9e895..76fdb25 100644
--- a/gst/fieldanalysis/Makefile.in
+++ b/gst/fieldanalysis/Makefile.in
@@ -112,6 +112,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -125,7 +126,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -272,8 +272,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -312,7 +316,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -320,6 +323,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -369,8 +374,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -449,7 +452,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -458,7 +460,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -471,7 +472,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -496,6 +496,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -569,10 +571,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -598,6 +604,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -634,6 +643,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -674,17 +684,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -701,6 +710,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/freeverb/GstFreeverb.prs b/gst/freeverb/GstFreeverb.prs
new file mode 100644
index 0000000..ebfdf00
--- /dev/null
+++ b/gst/freeverb/GstFreeverb.prs
@@ -0,0 +1,21 @@
+[_presets_]
+element-name=GstFreeverb
+version=1.5.0.1
+
+[cathedral]
+room-size=0.85
+damping=0
+width=1
+level=0.5
+
+[engine room]
+room-size=1
+damping=0.25
+width=1
+level=1
+
+[small room]
+room-size=0.8
+damping=0.25
+width=0.3
+level=0.3
diff --git a/gst/freeverb/Makefile.am b/gst/freeverb/Makefile.am
index f1a5637..76ca1da 100644
--- a/gst/freeverb/Makefile.am
+++ b/gst/freeverb/Makefile.am
@@ -19,6 +19,11 @@
 # headers we need but don't want installed
 noinst_HEADERS = gstfreeverb.h
 
+presetdir = $(datadir)/gstreamer-$(GST_API_VERSION)/presets
+preset_DATA = GstFreeverb.prs
+
+EXTRA_DIST = $(preset_DATA)
+
 Android.mk: Makefile.am $(BUILT_SOURCES)
 	androgenizer \
 	-:PROJECT libgstfreeverb -:SHARED libgstfreeverb \
diff --git a/gst/freeverb/Makefile.in b/gst/freeverb/Makefile.in
index 946087e..6ac9047 100644
--- a/gst/freeverb/Makefile.in
+++ b/gst/freeverb/Makefile.in
@@ -15,6 +15,7 @@
 @SET_MAKE@
 
 
+
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -90,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -151,7 +152,7 @@
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(plugindir)"
+am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(presetdir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libgstfreeverb_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@@ -208,6 +209,7 @@
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+DATA = $(preset_DATA)
 HEADERS = $(noinst_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
@@ -245,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -747,6 +759,9 @@
 
 # headers we need but don't want installed
 noinst_HEADERS = gstfreeverb.h
+presetdir = $(datadir)/gstreamer-$(GST_API_VERSION)/presets
+preset_DATA = GstFreeverb.prs
+EXTRA_DIST = $(preset_DATA)
 all: all-am
 
 .SUFFIXES:
@@ -864,6 +879,27 @@
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-presetDATA: $(preset_DATA)
+	@$(NORMAL_INSTALL)
+	@list='$(preset_DATA)'; test -n "$(presetdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(presetdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(presetdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(presetdir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(presetdir)" || exit $$?; \
+	done
+
+uninstall-presetDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(preset_DATA)'; test -n "$(presetdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(presetdir)'; $(am__uninstall_files_from_dir)
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -949,9 +985,9 @@
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(plugindir)"; do \
+	for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(presetdir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -1007,7 +1043,7 @@
 
 info-am:
 
-install-data-am: install-pluginLTLIBRARIES
+install-data-am: install-pluginLTLIBRARIES install-presetDATA
 
 install-dvi: install-dvi-am
 
@@ -1053,7 +1089,7 @@
 
 ps-am:
 
-uninstall-am: uninstall-pluginLTLIBRARIES
+uninstall-am: uninstall-pluginLTLIBRARIES uninstall-presetDATA
 
 .MAKE: install-am install-strip
 
@@ -1065,12 +1101,12 @@
 	install-data-am install-dvi install-dvi-am install-exec \
 	install-exec-am install-html install-html-am install-info \
 	install-info-am install-man install-pdf install-pdf-am \
-	install-pluginLTLIBRARIES install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
-	uninstall-pluginLTLIBRARIES
+	install-pluginLTLIBRARIES install-presetDATA install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am uninstall-pluginLTLIBRARIES uninstall-presetDATA
 
 
 Android.mk: Makefile.am $(BUILT_SOURCES)
diff --git a/gst/freeverb/gstfreeverb.c b/gst/freeverb/gstfreeverb.c
index 819d08c..4ee3779 100644
--- a/gst/freeverb/gstfreeverb.c
+++ b/gst/freeverb/gstfreeverb.c
@@ -120,7 +120,7 @@
 
 
 /* Table with processing functions: [channels][format] */
-static GstFreeverbProcessFunc process_functions[2][2] = {
+static const GstFreeverbProcessFunc process_functions[2][2] = {
   {
         (GstFreeverbProcessFunc) gst_freeverb_transform_m2s_int,
         (GstFreeverbProcessFunc) gst_freeverb_transform_m2s_float,
diff --git a/gst/frei0r/Makefile.in b/gst/frei0r/Makefile.in
index b4ecb41..496bbc1 100644
--- a/gst/frei0r/Makefile.in
+++ b/gst/frei0r/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/frei0r/gstfrei0rmixer.c b/gst/frei0r/gstfrei0rmixer.c
index a54d3cf..8d5f59b 100644
--- a/gst/frei0r/gstfrei0rmixer.c
+++ b/gst/frei0r/gstfrei0rmixer.c
@@ -340,15 +340,17 @@
         if (res) {
           gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
 
-          if (min_cur > min)
-            min = min_cur;
+          if (live_cur) {
+            if (min_cur > min)
+              min = min_cur;
 
-          if (max_cur != GST_CLOCK_TIME_NONE &&
-              ((max != GST_CLOCK_TIME_NONE && max_cur > max) ||
-                  (max == GST_CLOCK_TIME_NONE)))
-            max = max_cur;
+            if (max == GST_CLOCK_TIME_NONE)
+              max = max_cur;
+            else if (max_cur < max)
+              max = max_cur;
 
-          live = live || live_cur;
+            live = TRUE;
+          }
         }
 
         gst_query_unref (peerquery);
diff --git a/gst/gaudieffects/Makefile.in b/gst/gaudieffects/Makefile.in
index 7052cee..b5c6aee 100644
--- a/gst/gaudieffects/Makefile.in
+++ b/gst/gaudieffects/Makefile.in
@@ -112,6 +112,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -125,7 +126,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -278,8 +278,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -318,7 +322,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -326,6 +329,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -375,8 +380,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -455,7 +458,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -464,7 +466,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -477,7 +478,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -502,6 +502,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -575,10 +577,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -604,6 +610,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -640,6 +649,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -680,17 +690,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -707,6 +716,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/gaudieffects/gstdilate.c b/gst/gaudieffects/gstdilate.c
index 82a8881..8c3c013 100644
--- a/gst/gaudieffects/gstdilate.c
+++ b/gst/gaudieffects/gstdilate.c
@@ -356,7 +356,6 @@
         left_luminance = get_luminance (*left);
         if (left_luminance < out_luminance) {
           *dest = *left;
-          out_luminance = left_luminance;
         }
 
         src += 1;
@@ -415,7 +414,6 @@
         left_luminance = get_luminance (*left);
         if (left_luminance > out_luminance) {
           *dest = *left;
-          out_luminance = left_luminance;
         }
 
         src += 1;
diff --git a/gst/gaudieffects/gstsolarize.c b/gst/gaudieffects/gstsolarize.c
index 14323cd..932c6cc 100644
--- a/gst/gaudieffects/gstsolarize.c
+++ b/gst/gaudieffects/gstsolarize.c
@@ -314,10 +314,10 @@
   guint32 in;
   guint32 color[3];
   gint x, c;
-  gint floor = 0;
-  gint ceiling = 255;
+  static const guint floor = 0;
+  static const guint ceiling = 255;
 
-  gint period, up_length, down_length, height_scale, param;
+  gint period, up_length, down_length, param;
 
   period = end - start;
   if (period == 0) {
@@ -334,8 +334,6 @@
     down_length = 1;
   }
 
-  height_scale = ceiling - floor;
-
   /* Loop through pixels. */
   for (x = 0; x < video_area; x++) {
     in = *src++;
@@ -344,7 +342,6 @@
     color[1] = (in >> 8) & 0xff;
     color[2] = (in) & 0xff;
 
-
     /* Loop through colors. */
     for (c = 0; c < 3; c++) {
       param = color[c];
@@ -353,20 +350,22 @@
       param %= period;
 
       if (param < up_length) {
-        color[c] = param * height_scale;
+        color[c] = param * ceiling;
         color[c] /= up_length;
         color[c] += floor;
       } else {
         color[c] = down_length - (param - up_length);
-        color[c] *= height_scale;
+        color[c] *= ceiling;
         color[c] /= down_length;
         color[c] += floor;
       }
     }
 
-    color[0] = CLAMP (color[0], 0, 255);
-    color[1] = CLAMP (color[1], 0, 255);
-    color[2] = CLAMP (color[2], 0, 255);
+    /* Clamp colors */
+    for (c = 0; c < 3; c++) {
+      if (G_UNLIKELY (color[c] > 255))
+        color[c] = 255;
+    }
 
     *dest++ = (color[0] << 16) | (color[1] << 8) | color[2];
   }
diff --git a/gst/gdp/Makefile.in b/gst/gdp/Makefile.in
index af837b9..f883b1a 100644
--- a/gst/gdp/Makefile.in
+++ b/gst/gdp/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/gdp/dataprotocol.c b/gst/gdp/dataprotocol.c
index 721cc60..fbb46a6 100644
--- a/gst/gdp/dataprotocol.c
+++ b/gst/gdp/dataprotocol.c
@@ -1,6 +1,7 @@
 /* GStreamer
  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
  * Copyright (C) 2004,2006 Thomas Vander Stichele <thomas at apestaart dot org>
+ * Copyright (C) 2014 Tim-Philipp Müller <tim centricular com>
  *
  * dataprotocol.c: Functions implementing the GStreamer Data Protocol
  *
@@ -56,10 +57,8 @@
  * the event as the payload.  In addition, GDP streams can now start with
  * events as well, as required by the new data stream model in GStreamer 0.10.
  *
- * Converting buffers, caps and events to GDP buffers is done using a
- * #GstDPPacketizer object and invoking its packetizer functions.
- * For backwards-compatibility reasons, the old 0.2 methods are still
- * available but deprecated.
+ * Converting buffers, caps and events to GDP buffers is done using the
+ * appropriate functions.
  *
  * For reference, this image shows the byte layout of the GDP header:
  *
@@ -82,6 +81,13 @@
 #define GST_CAT_DEFAULT data_protocol_debug
 #endif
 
+/* The version of the GDP protocol being used */
+typedef enum
+{
+  GST_DP_VERSION_0_2 = 1,
+  GST_DP_VERSION_1_0,
+} GstDPVersion;
+
 /* helper macros */
 
 /* write first 6 bytes of header */
@@ -125,30 +131,59 @@
 #define POLY       0x1021
 #define CRC_INIT   0xFFFF
 
-/*** HELPER FUNCTIONS ***/
+static guint16 gst_dp_crc (const guint8 * buffer, guint length);
+static guint16 gst_dp_crc_from_memory_maps (const GstMapInfo * maps,
+    guint n_maps);
 
-static gboolean
-gst_dp_header_from_buffer_any (const GstBuffer * buffer, GstDPHeaderFlag flags,
-    guint * length, guint8 ** header, GstDPVersion version)
+/* payloading functions */
+
+GstBuffer *
+gst_dp_payload_buffer (GstBuffer * buffer, GstDPHeaderFlag flags)
 {
+  GstBuffer *ret_buf;
+  GstMapInfo map;
+  GstMemory *mem;
   guint8 *h;
   guint16 flags_mask;
-  GstMapInfo map;
+  guint16 header_crc = 0, crc = 0;
+  gsize buffer_size;
 
-  g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
-  g_return_val_if_fail (length, FALSE);
-  g_return_val_if_fail (header, FALSE);
-
-  *length = GST_DP_HEADER_LENGTH;
-  h = g_malloc0 (GST_DP_HEADER_LENGTH);
+  mem = gst_allocator_alloc (NULL, GST_DP_HEADER_LENGTH, NULL);
+  gst_memory_map (mem, &map, GST_MAP_READWRITE);
+  h = memset (map.data, 0, map.size);
 
   /* version, flags, type */
-  GST_DP_INIT_HEADER (h, version, flags, GST_DP_PAYLOAD_BUFFER);
+  GST_DP_INIT_HEADER (h, GST_DP_VERSION_1_0, flags, GST_DP_PAYLOAD_BUFFER);
 
-  gst_buffer_map ((GstBuffer *) buffer, &map, GST_MAP_READ);
+  if ((flags & GST_DP_HEADER_FLAG_CRC_PAYLOAD)) {
+    GstMapInfo *maps;
+    guint n_maps, i;
+
+    buffer_size = 0;
+
+    n_maps = gst_buffer_n_memory (buffer);
+    if (n_maps > 0) {
+      maps = g_newa (GstMapInfo, n_maps);
+
+      for (i = 0; i < n_maps; ++i) {
+        GstMemory *mem;
+
+        mem = gst_buffer_peek_memory (buffer, i);
+        gst_memory_map (mem, &maps[i], GST_MAP_READ);
+        buffer_size += maps[i].size;
+      }
+
+      crc = gst_dp_crc_from_memory_maps (maps, n_maps);
+
+      for (i = 0; i < n_maps; ++i)
+        gst_memory_unmap (maps[i].memory, &maps[i]);
+    }
+  } else {
+    buffer_size = gst_buffer_get_size (buffer);
+  }
 
   /* buffer properties */
-  GST_WRITE_UINT32_BE (h + 6, map.size);
+  GST_WRITE_UINT32_BE (h + 6, buffer_size);
   GST_WRITE_UINT64_BE (h + 10, GST_BUFFER_TIMESTAMP (buffer));
   GST_WRITE_UINT64_BE (h + 18, GST_BUFFER_DURATION (buffer));
   GST_WRITE_UINT64_BE (h + 26, GST_BUFFER_OFFSET (buffer));
@@ -164,36 +199,53 @@
   /* from gstreamer 1.x, buffers also have the DTS */
   GST_WRITE_UINT64_BE (h + 44, GST_BUFFER_DTS (buffer));
 
-  GST_DP_SET_CRC (h, flags, map.data, map.size);
+  /* header CRC */
+  if ((flags & GST_DP_HEADER_FLAG_CRC_HEADER))
+    /* we don't crc the last four bytes since they are crc's */
+    header_crc = gst_dp_crc (h, 58);
+  else
+    header_crc = 0;
 
-  gst_buffer_unmap ((GstBuffer *) buffer, &map);
+  GST_WRITE_UINT16_BE (h + 58, header_crc);
 
-  GST_MEMDUMP ("created header from buffer", h, GST_DP_HEADER_LENGTH);
-  *header = h;
-  return TRUE;
+  /* payload CRC */
+  GST_WRITE_UINT16_BE (h + 60, crc);
+
+  GST_MEMDUMP ("payload header for buffer", h, GST_DP_HEADER_LENGTH);
+  gst_memory_unmap (mem, &map);
+
+  ret_buf = gst_buffer_new ();
+
+  /* header */
+  gst_buffer_append_memory (ret_buf, mem);
+
+  /* buffer data */
+  return gst_buffer_append (ret_buf, gst_buffer_ref (buffer));
 }
 
-static gboolean
-gst_dp_packet_from_caps_any (const GstCaps * caps, GstDPHeaderFlag flags,
-    guint * length, guint8 ** header, guint8 ** payload, GstDPVersion version)
+GstBuffer *
+gst_dp_payload_caps (const GstCaps * caps, GstDPHeaderFlag flags)
 {
+  GstBuffer *buf;
+  GstMapInfo map;
+  GstMemory *mem;
   guint8 *h;
   guchar *string;
   guint payload_length;
 
-  g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
-  g_return_val_if_fail (length, FALSE);
-  g_return_val_if_fail (header, FALSE);
-  g_return_val_if_fail (payload, FALSE);
+  g_assert (GST_IS_CAPS (caps));
 
-  *length = GST_DP_HEADER_LENGTH;
-  h = g_malloc0 (GST_DP_HEADER_LENGTH);
+  buf = gst_buffer_new ();
+
+  mem = gst_allocator_alloc (NULL, GST_DP_HEADER_LENGTH, NULL);
+  gst_memory_map (mem, &map, GST_MAP_READWRITE);
+  h = memset (map.data, 0, map.size);
 
   string = (guchar *) gst_caps_to_string (caps);
   payload_length = strlen ((gchar *) string) + 1;       /* include trailing 0 */
 
   /* version, flags, type */
-  GST_DP_INIT_HEADER (h, version, flags, GST_DP_PAYLOAD_CAPS);
+  GST_DP_INIT_HEADER (h, GST_DP_VERSION_1_0, flags, GST_DP_PAYLOAD_CAPS);
 
   /* buffer properties */
   GST_WRITE_UINT32_BE (h + 6, payload_length);
@@ -204,12 +256,75 @@
 
   GST_DP_SET_CRC (h, flags, string, payload_length);
 
-  GST_MEMDUMP ("created header from caps", h, GST_DP_HEADER_LENGTH);
-  *header = h;
-  *payload = string;
-  return TRUE;
+  GST_MEMDUMP ("payload header for caps", h, GST_DP_HEADER_LENGTH);
+  gst_memory_unmap (mem, &map);
+
+  /* header */
+  gst_buffer_append_memory (buf, mem);
+
+  /* caps string */
+  gst_buffer_append_memory (buf,
+      gst_memory_new_wrapped (0, string, payload_length, 0, payload_length,
+          string, g_free));
+
+  return buf;
 }
 
+GstBuffer *
+gst_dp_payload_event (const GstEvent * event, GstDPHeaderFlag flags)
+{
+  GstBuffer *buf;
+  GstMapInfo map;
+  GstMemory *mem;
+  guint8 *h;
+  guint32 pl_length;            /* length of payload */
+  guchar *string = NULL;
+  const GstStructure *structure;
+
+  g_assert (GST_IS_EVENT (event));
+
+  buf = gst_buffer_new ();
+
+  mem = gst_allocator_alloc (NULL, GST_DP_HEADER_LENGTH, NULL);
+  gst_memory_map (mem, &map, GST_MAP_READWRITE);
+  h = memset (map.data, 0, map.size);
+
+  structure = gst_event_get_structure ((GstEvent *) event);
+  if (structure) {
+    string = (guchar *) gst_structure_to_string (structure);
+    GST_LOG ("event %p has structure, string %s", event, string);
+    pl_length = strlen ((gchar *) string) + 1;  /* include trailing 0 */
+  } else {
+    GST_LOG ("event %p has no structure", event);
+    pl_length = 0;
+  }
+
+  /* version, flags, type */
+  GST_DP_INIT_HEADER (h, GST_DP_VERSION_1_0, flags,
+      GST_DP_PAYLOAD_EVENT_NONE + GST_EVENT_TYPE (event));
+
+  /* length */
+  GST_WRITE_UINT32_BE (h + 6, pl_length);
+  /* timestamp */
+  GST_WRITE_UINT64_BE (h + 10, GST_EVENT_TIMESTAMP (event));
+
+  GST_DP_SET_CRC (h, flags, string, pl_length);
+
+  GST_MEMDUMP ("payload header for event", h, GST_DP_HEADER_LENGTH);
+  gst_memory_unmap (mem, &map);
+
+  /* header */
+  gst_buffer_append_memory (buf, mem);
+
+  /* event string */
+  if (pl_length > 0) {
+    gst_buffer_append_memory (buf,
+        gst_memory_new_wrapped (0, string, pl_length, 0, pl_length,
+            string, g_free));
+  }
+
+  return buf;
+}
 
 /*** PUBLIC FUNCTIONS ***/
 
@@ -259,12 +374,15 @@
  *
  * Returns: a two-byte CRC checksum.
  */
-guint16
+static guint16
 gst_dp_crc (const guint8 * buffer, guint length)
 {
   guint16 crc_register = CRC_INIT;
 
-  g_return_val_if_fail (buffer != NULL || length == 0, 0);
+  if (length == 0)
+    return 0;
+
+  g_assert (buffer != NULL);
 
   /* calc CRC */
   for (; length--;) {
@@ -274,23 +392,37 @@
   return (0xffff ^ crc_register);
 }
 
-GType
-gst_dp_version_get_type (void)
+static guint16
+gst_dp_crc_from_memory_maps (const GstMapInfo * maps, guint n_maps)
 {
-  static gsize gst_dp_version_type = 0;
-  static const GEnumValue gst_dp_version[] = {
-    {GST_DP_VERSION_0_2, "GST_DP_VERSION_0_2", "0.2"},
-    {GST_DP_VERSION_1_0, "GST_DP_VERSION_1_0", "1.0"},
-    {0, NULL, NULL},
-  };
+  guint16 crc_register = CRC_INIT;
+  gsize total_length = 0;
 
-  if (g_once_init_enter (&gst_dp_version_type)) {
-    GType tmp = g_enum_register_static ("GstDPVersion", gst_dp_version);
-    g_once_init_leave (&gst_dp_version_type, tmp);
+  if (n_maps == 0)
+    return 0;
+
+  g_assert (maps != NULL);
+
+  /* calc CRC */
+  while (n_maps > 0) {
+    guint8 *buffer = maps->data;
+    gsize length = maps->size;
+
+    total_length += length;
+
+    while (length-- > 0) {
+      crc_register = (guint16) ((crc_register << 8) ^
+          gst_dp_crc_table[((crc_register >> 8) & 0x00ff) ^ *buffer++]);
+    }
+    --n_maps;
+    ++maps;
   }
 
-  return (GType) gst_dp_version_type;
-};
+  if (G_UNLIKELY (total_length == 0))
+    return 0;
+
+  return (0xffff ^ crc_register);
+}
 
 /**
  * gst_dp_init:
@@ -303,15 +435,6 @@
 void
 gst_dp_init (void)
 {
-  static gboolean _gst_dp_initialized = FALSE;
-
-  if (_gst_dp_initialized)
-    return;
-
-  _gst_dp_initialized = TRUE;
-
-  g_type_class_ref (gst_dp_version_get_type ());
-
   GST_DEBUG_CATEGORY_INIT (data_protocol_debug, "gdp", 0,
       "GStreamer Data Protocol");
 }
@@ -348,68 +471,6 @@
   return GST_DP_HEADER_PAYLOAD_TYPE (header);
 }
 
-/*** PACKETIZER FUNCTIONS ***/
-
-static gboolean
-gst_dp_header_from_buffer_1_0 (const GstBuffer * buffer, GstDPHeaderFlag flags,
-    guint * length, guint8 ** header)
-{
-  return gst_dp_header_from_buffer_any (buffer, flags, length, header,
-      GST_DP_VERSION_1_0);
-}
-
-static gboolean
-gst_dp_packet_from_caps_1_0 (const GstCaps * caps, GstDPHeaderFlag flags,
-    guint * length, guint8 ** header, guint8 ** payload)
-{
-  return gst_dp_packet_from_caps_any (caps, flags, length, header, payload,
-      GST_DP_VERSION_1_0);
-}
-
-static gboolean
-gst_dp_packet_from_event_1_0 (const GstEvent * event, GstDPHeaderFlag flags,
-    guint * length, guint8 ** header, guint8 ** payload)
-{
-  guint8 *h;
-  guint32 pl_length;            /* length of payload */
-  guchar *string = NULL;
-  const GstStructure *structure;
-
-  g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
-  g_return_val_if_fail (length, FALSE);
-  g_return_val_if_fail (header, FALSE);
-  g_return_val_if_fail (payload, FALSE);
-
-  *length = GST_DP_HEADER_LENGTH;
-  h = g_malloc0 (GST_DP_HEADER_LENGTH);
-
-  structure = gst_event_get_structure ((GstEvent *) event);
-  if (structure) {
-    string = (guchar *) gst_structure_to_string (structure);
-    GST_LOG ("event %p has structure, string %s", event, string);
-    pl_length = strlen ((gchar *) string) + 1;  /* include trailing 0 */
-  } else {
-    GST_LOG ("event %p has no structure", event);
-    pl_length = 0;
-  }
-
-  /* version, flags, type */
-  GST_DP_INIT_HEADER (h, GST_DP_VERSION_1_0, flags,
-      GST_DP_PAYLOAD_EVENT_NONE + GST_EVENT_TYPE (event));
-
-  /* length */
-  GST_WRITE_UINT32_BE (h + 6, pl_length);
-  /* timestamp */
-  GST_WRITE_UINT64_BE (h + 10, GST_EVENT_TIMESTAMP (event));
-
-  GST_DP_SET_CRC (h, flags, string, pl_length);
-
-  GST_MEMDUMP ("created header from event", h, GST_DP_HEADER_LENGTH);
-  *header = h;
-  *payload = string;
-  return TRUE;
-}
-
 /*** DEPACKETIZING FUNCTIONS ***/
 
 /**
@@ -710,46 +771,3 @@
 
   return TRUE;
 }
-
-/**
- * gst_dp_packetizer_new:
- * @version: the #GstDPVersion of the protocol to packetize for.
- *
- * Creates a new packetizer.
- *
- * Returns: a newly allocated #GstDPPacketizer
- */
-GstDPPacketizer *
-gst_dp_packetizer_new (GstDPVersion version)
-{
-  GstDPPacketizer *ret;
-
-  ret = g_malloc0 (sizeof (GstDPPacketizer));
-  ret->version = version;
-
-  switch (version) {
-    case GST_DP_VERSION_1_0:
-      ret->header_from_buffer = gst_dp_header_from_buffer_1_0;
-      ret->packet_from_caps = gst_dp_packet_from_caps_1_0;
-      ret->packet_from_event = gst_dp_packet_from_event_1_0;
-      break;
-    default:
-      g_free (ret);
-      ret = NULL;
-      break;
-  }
-
-  return ret;
-}
-
-/**
- * gst_dp_packetizer_free:
- * @packetizer: the #GstDPPacketizer to free.
- *
- * Free the given packetizer.
- */
-void
-gst_dp_packetizer_free (GstDPPacketizer * packetizer)
-{
-  g_free (packetizer);
-}
diff --git a/gst/gdp/dataprotocol.h b/gst/gdp/dataprotocol.h
index 3812ff0..ac1d010 100644
--- a/gst/gdp/dataprotocol.h
+++ b/gst/gdp/dataprotocol.h
@@ -30,34 +30,6 @@
 G_BEGIN_DECLS
 
 /**
- * GstDPVersion:
- * @GST_DP_VERSION_0_2: protocol version 0.2
- * @GST_DP_VERSION_1_0: protocol version 1.0
- *
- * The version of the GDP protocol being used.
- */
-typedef enum {
-  GST_DP_VERSION_0_2 = 1,
-  GST_DP_VERSION_1_0,
-} GstDPVersion;
-
-GType gst_dp_version_get_type (void);
-#define GST_TYPE_DP_VERSION (gst_dp_version_get_type ())
-
-/**
- * GST_DP_VERSION_MAJOR:
- *
- * The major version number of the GStreamer Data Protocol.
- */
-#define GST_DP_VERSION_MAJOR 0
-/**
- * GST_DP_VERSION_MINOR:
- *
- * The minor version number of the GStreamer Data Protocol.
- */
-#define GST_DP_VERSION_MINOR 2
-
-/**
  * GST_DP_HEADER_LENGTH:
  *
  * The header size in bytes.
@@ -97,53 +69,8 @@
   GST_DP_PAYLOAD_EVENT_NONE      = 64,
 } GstDPPayloadType;
 
-typedef gboolean (*GstDPHeaderFromBufferFunction) (const GstBuffer * buffer,
-                                                   GstDPHeaderFlag flags,
-                                                   guint * length,
-                                                   guint8 ** header);
-typedef gboolean (*GstDPPacketFromCapsFunction)   (const GstCaps * caps,
-                                                   GstDPHeaderFlag flags,
-                                                   guint * length,
-                                                   guint8 ** header,
-                                                   guint8 ** payload);
-typedef gboolean (*GstDPPacketFromEventFunction)  (const GstEvent * event,
-                                                   GstDPHeaderFlag flags,
-                                                   guint * length,
-                                                   guint8 ** header,
-                                                   guint8 ** payload);
-
-/**
- * GstDPPacketizer:
- * @version: the #GstDPVersion of the protocol to be used
- * @header_from_buffer: buffer serializer function
- * @packet_from_caps: caps serializer function
- * @packet_from_event: event serializer function
- *
- * Data protocol packetizer handle.
- */
-typedef struct {
-  GstDPVersion version;
-
-  GstDPHeaderFromBufferFunction header_from_buffer;
-  GstDPPacketFromCapsFunction packet_from_caps;
-  GstDPPacketFromEventFunction packet_from_event;
-
-  /*< private >*/
-  gpointer _gst_reserved[GST_PADDING];
-} GstDPPacketizer;
-
-
 void            gst_dp_init                     (void);
 
-/* packetizer */
-GstDPPacketizer *
-                gst_dp_packetizer_new           (GstDPVersion version);
-void            gst_dp_packetizer_free          (GstDPPacketizer *packetizer);
-
-/* crc checksum */
-guint16         gst_dp_crc                      (const guint8 * buffer,
-                                                 guint length);
-
 /* payload information from header */
 guint32         gst_dp_header_payload_length    (const guint8 * header);
 GstDPPayloadType
@@ -159,6 +86,16 @@
                                                 const guint8 * header,
                                                 const guint8 * payload);
 
+/* payloading GstBuffer/GstEvent/GstCaps */
+GstBuffer *     gst_dp_payload_buffer           (GstBuffer      * buffer,
+                                                 GstDPHeaderFlag  flags);
+
+GstBuffer *     gst_dp_payload_caps             (const GstCaps  * caps,
+                                                 GstDPHeaderFlag  flags);
+
+GstBuffer *     gst_dp_payload_event            (const GstEvent * event,
+                                                 GstDPHeaderFlag  flags);
+
 /* validation */
 gboolean        gst_dp_validate_header          (guint header_length,
                                                 const guint8 * header);
diff --git a/gst/gdp/gstgdppay.c b/gst/gdp/gstgdppay.c
index d8bc818..33ac591 100644
--- a/gst/gdp/gstgdppay.c
+++ b/gst/gdp/gstgdppay.c
@@ -1,5 +1,6 @@
 /* GStreamer
  * Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart dot org>
+ * Copyright (C) 2014 Tim-Philipp Müller <tim centricular com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -57,14 +58,12 @@
 
 #define DEFAULT_CRC_HEADER TRUE
 #define DEFAULT_CRC_PAYLOAD FALSE
-#define DEFAULT_VERSION GST_DP_VERSION_1_0
 
 enum
 {
   PROP_0,
   PROP_CRC_HEADER,
-  PROP_CRC_PAYLOAD,
-  PROP_VERSION,
+  PROP_CRC_PAYLOAD
 };
 
 #define _do_init \
@@ -113,12 +112,6 @@
       g_param_spec_boolean ("crc-payload", "CRC Payload",
           "Calculate and store a CRC checksum on the payload",
           DEFAULT_CRC_PAYLOAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (gobject_class, PROP_VERSION,
-      g_param_spec_enum ("version", "Version",
-          "Version of the GStreamer Data Protocol",
-          GST_TYPE_DP_VERSION, DEFAULT_VERSION,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
   gst_element_class_set_static_metadata (gstelement_class,
       "GDP Payloader", "GDP/Payloader",
       "Payloads GStreamer Data Protocol buffers",
@@ -152,10 +145,7 @@
   gdppay->crc_header = DEFAULT_CRC_HEADER;
   gdppay->crc_payload = DEFAULT_CRC_PAYLOAD;
   gdppay->header_flag = gdppay->crc_header | gdppay->crc_payload;
-  gdppay->version = DEFAULT_VERSION;
   gdppay->offset = 0;
-
-  gdppay->packetizer = gst_dp_packetizer_new (gdppay->version);
 }
 
 static void
@@ -164,7 +154,6 @@
   GstGDPPay *this = GST_GDP_PAY (gobject);
 
   gst_gdp_pay_reset (this);
-  gst_dp_packetizer_free (this->packetizer);
 
   GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (gobject));
 }
@@ -188,23 +177,11 @@
     gst_caps_unref (this->caps);
     this->caps = NULL;
   }
-  if (this->caps_buf) {
-    gst_buffer_unref (this->caps_buf);
-    this->caps_buf = NULL;
-  }
-  if (this->tag_buf) {
-    gst_buffer_unref (this->tag_buf);
-    this->tag_buf = NULL;
-  }
-  if (this->new_segment_buf) {
-    gst_buffer_unref (this->new_segment_buf);
-    this->new_segment_buf = NULL;
-  }
-  if (this->streamstartid_buf) {
-    gst_buffer_unref (this->streamstartid_buf);
-    this->streamstartid_buf = NULL;
-  }
+  this->have_caps = FALSE;
+  this->have_segment = FALSE;
+  this->have_streamstartid = FALSE;
   this->sent_streamheader = FALSE;
+  this->reset_streamheader = FALSE;
   this->offset = 0;
 }
 
@@ -220,94 +197,62 @@
 static GstBuffer *
 gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps)
 {
-  GstBuffer *headerbuf;
-  GstBuffer *payloadbuf;
-  guint8 *header, *payload;
-  guint len, plen;
-
-  if (!this->packetizer->packet_from_caps (caps, this->header_flag, &len,
-          &header, &payload))
-    goto packet_failed;
-
-  GST_LOG_OBJECT (this, "creating GDP header and payload buffer from caps");
-  headerbuf = gst_buffer_new_wrapped (header, len);
-
-  plen = gst_dp_header_payload_length (header);
-  payloadbuf = gst_buffer_new_wrapped (payload, plen);
-
-  return gst_buffer_append (headerbuf, payloadbuf);
-
-  /* ERRORS */
-packet_failed:
-  {
-    GST_WARNING_OBJECT (this, "could not create GDP header from caps");
-    return NULL;
-  }
+  return gst_dp_payload_caps (caps, this->header_flag);
 }
 
 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,
-          &header))
-    goto no_buffer;
-
-  GST_LOG_OBJECT (this, "creating GDP header and payload buffer from buffer");
-  headerbuf = gst_buffer_new_wrapped (header, len);
-
-  /* we do not want to lose the ref on the incoming buffer */
-  gst_buffer_ref (buffer);
-
-  return gst_buffer_append (headerbuf, buffer);
-
-  /* ERRORS */
-no_buffer:
-  {
-    GST_WARNING_OBJECT (this, "could not create GDP header from buffer");
-    return NULL;
-  }
+  return gst_dp_payload_buffer (buffer, this->header_flag);
 }
 
 static GstBuffer *
 gst_gdp_buffer_from_event (GstGDPPay * this, GstEvent * event)
 {
-  GstBuffer *headerbuf;
-  GstBuffer *payloadbuf;
-  guint8 *header, *payload;
-  guint len, plen;
-  gboolean ret;
-
-  ret =
-      this->packetizer->packet_from_event (event, this->header_flag, &len,
-      &header, &payload);
-  if (!ret)
-    goto no_event;
-
-  GST_LOG_OBJECT (this, "creating GDP header and payload buffer from event");
-  headerbuf = gst_buffer_new_wrapped (header, len);
-
-  payloadbuf = gst_buffer_new ();
-  plen = gst_dp_header_payload_length (header);
-  if (plen && payload != NULL) {
-    gst_buffer_append_memory (payloadbuf,
-        gst_memory_new_wrapped (0, payload, plen, 0, plen, payload, g_free));
-  }
-
-  return gst_buffer_append (headerbuf, payloadbuf);
-
-  /* ERRORS */
-no_event:
-  {
-    GST_WARNING_OBJECT (this, "could not create GDP header from event %s (%d)",
-        gst_event_type_get_name (event->type), event->type);
-    return NULL;
-  }
+  return gst_dp_payload_event (event, this->header_flag);
 }
 
+static void
+gdp_streamheader_array_append_take_buffer (GValue * array, GstBuffer * buf)
+{
+  GValue value = { 0, };
+
+  g_value_init (&value, GST_TYPE_BUFFER);
+  gst_value_take_buffer (&value, buf);
+  gst_value_array_append_and_take_value (array, &value);
+}
+
+typedef struct
+{
+  GstGDPPay *gdppay;
+  GValue *array;
+} GstGDPPayAndArray;
+
+static gboolean
+gdp_streamheader_array_store_events (GstPad * pad, GstEvent ** event,
+    gpointer udata)
+{
+  GstGDPPayAndArray *gdp_and_array = udata;
+  GstGDPPay *this = gdp_and_array->gdppay;
+  GValue *array = gdp_and_array->array;
+  GstBuffer *buf;
+
+  /* Need to handle caps differently to keep compatibility with 1.0 */
+  if (GST_EVENT_TYPE (*event) == GST_EVENT_CAPS) {
+    GstCaps *caps;
+
+    gst_event_parse_caps (*event, &caps);
+    buf = gst_gdp_buffer_from_caps (this, caps);
+  } else {
+    buf = gst_gdp_buffer_from_event (this, *event);
+  }
+
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
+  gst_gdp_stamp_buffer (this, buf);
+  gdp_streamheader_array_append_take_buffer (array, buf);
+
+  return TRUE;
+}
 
 /* set our caps with streamheader, based on the latest newsegment and caps,
  * and (possibly) GDP-serialized buffers of the streamheaders on the src pad */
@@ -315,109 +260,53 @@
 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, *streamstartid_buf;
   GstStructure *structure;
   GstFlowReturn r = GST_FLOW_OK;
-  gboolean version_one_zero = TRUE;
+  GstGDPPayAndArray gdp_and_array;
 
   GValue array = { 0 };
-  GValue value = { 0 };
+
+  gdp_and_array.gdppay = this;
+  gdp_and_array.array = &array;
 
   GST_DEBUG_OBJECT (this, "start");
-  /* In version 0.2, we didn't need or send new segment or tags */
-  if (this->version == GST_DP_VERSION_0_2)
-    version_one_zero = FALSE;
 
-  if (version_one_zero) {
-    if (!this->new_segment_buf || !this->caps_buf || !this->streamstartid_buf) {
-      GST_DEBUG_OBJECT (this, "1.0, missing new_segment or caps or stream "
-          "start id, returning");
-      return GST_FLOW_OK;
-    }
-  } else {
-    if (!this->caps_buf) {
-      GST_DEBUG_OBJECT (this, "0.2, missing caps, returning");
-      return GST_FLOW_OK;
-    }
+  if (!this->have_segment || !this->have_caps || !this->have_streamstartid) {
+    GST_DEBUG_OBJECT (this, "1.0, missing new_segment or caps or stream "
+        "start id, returning");
+    return GST_FLOW_OK;
   }
 
   /* put copies of the buffers in a fixed list
    * Stamp the buffers with offset and offset_end as well.
    * We do this here so the offsets match the order the buffers go out in */
   g_value_init (&array, GST_TYPE_ARRAY);
-
-  if (version_one_zero) {
-    gst_gdp_stamp_buffer (this, this->streamstartid_buf);
-    GST_DEBUG_OBJECT (this, "appending copy of stream start id buffer %p",
-        this->streamstartid_buf);
-    streamstartid_buf = gst_buffer_copy (this->streamstartid_buf);
-    g_value_init (&value, GST_TYPE_BUFFER);
-    gst_value_set_buffer (&value, streamstartid_buf);
-    gst_value_array_append_value (&array, &value);
-    g_value_unset (&value);
-    gst_buffer_unref (streamstartid_buf);
-  }
-
-  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);
-  g_value_init (&value, GST_TYPE_BUFFER);
-  gst_value_set_buffer (&value, caps_buf);
-  gst_value_array_append_value (&array, &value);
-  g_value_unset (&value);
-  gst_buffer_unref (caps_buf);
-
-  if (version_one_zero) {
-    gst_gdp_stamp_buffer (this, this->new_segment_buf);
-    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);
-    g_value_init (&value, GST_TYPE_BUFFER);
-    gst_value_set_buffer (&value, new_segment_buf);
-    gst_value_array_append_value (&array, &value);
-    g_value_unset (&value);
-    gst_buffer_unref (new_segment_buf);
-
-    if (this->tag_buf) {
-      gst_gdp_stamp_buffer (this, this->tag_buf);
-      GST_DEBUG_OBJECT (this, "1.0, appending current tags buffer %p",
-          this->tag_buf);
-      tag_buf = this->tag_buf;
-      this->tag_buf = NULL;
-
-      g_value_init (&value, GST_TYPE_BUFFER);
-      gst_value_set_buffer (&value, tag_buf);
-      gst_value_array_append_value (&array, &value);
-      g_value_unset (&value);
-      gst_buffer_unref (tag_buf);
-    }
-  }
+  gst_pad_sticky_events_foreach (this->sinkpad,
+      gdp_streamheader_array_store_events, &gdp_and_array);
 
   /* we also need to add GDP serializations of the streamheaders of the
    * incoming caps */
   structure = gst_caps_get_structure (this->caps, 0);
   if (gst_structure_has_field (structure, "streamheader")) {
     const GValue *sh;
-
-    GArray *buffers;
-
     GstBuffer *buffer;
-
-    int i;
+    int i, num;
 
     sh = gst_structure_get_value (structure, "streamheader");
-    buffers = g_value_peek_pointer (sh);
+    num = gst_value_array_get_size (sh);
     GST_DEBUG_OBJECT (this,
-        "Need to serialize %d incoming streamheader buffers on ours",
-        buffers->len);
-    for (i = 0; i < buffers->len; ++i) {
-      GValue *bufval;
+        "Need to serialize %d incoming streamheader buffers on ours", num);
 
+    for (i = 0; i < num; ++i) {
+      const GValue *bufval;
       GstBuffer *outbuffer;
 
-      bufval = &g_array_index (buffers, GValue, i);
-      buffer = g_value_peek_pointer (bufval);
+      bufval = gst_value_array_get_value (sh, i);
+      buffer = gst_value_get_buffer (bufval);
+
+      /* Make copy before modifying buffer metadata */
+      buffer = gst_buffer_copy (buffer);
+
       /* this buffer is deserialized by gdpdepay as a regular buffer,
          it needs HEADER, because it's a streamheader - otherwise it
          is mixed with regular data buffers */
@@ -427,6 +316,9 @@
       GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
 
       outbuffer = gst_gdp_pay_buffer_from_buffer (this, buffer);
+
+      gst_buffer_unref (buffer);
+
       if (!outbuffer) {
         g_value_unset (&array);
         goto no_buffer;
@@ -440,12 +332,7 @@
       GST_BUFFER_OFFSET_END (outbuffer) = GST_BUFFER_OFFSET_NONE;
       GST_BUFFER_TIMESTAMP (outbuffer) = GST_CLOCK_TIME_NONE;
 
-      g_value_init (&value, GST_TYPE_BUFFER);
-      gst_value_set_buffer (&value, outbuffer);
-      gst_value_array_append_value (&array, &value);
-      g_value_unset (&value);
-
-      gst_buffer_unref (outbuffer);
+      gdp_streamheader_array_append_take_buffer (&array, outbuffer);
     }
   } else {
     GST_DEBUG_OBJECT (this, "no streamheader to serialize");
@@ -478,40 +365,6 @@
     }
   }
 
-  /* push out these streamheader buffers, then flush our internal queue */
-  GST_DEBUG_OBJECT (this, "Pushing GDP stream-start-id buffer %p",
-      this->streamstartid_buf);
-  r = gst_pad_push (this->srcpad, gst_buffer_ref (this->streamstartid_buf));
-  if (r != GST_FLOW_OK) {
-    GST_WARNING_OBJECT (this, "pushing GDP stream-start-id buffer returned %d",
-        r);
-    goto done;
-  }
-  GST_DEBUG_OBJECT (this, "Pushing GDP caps buffer %p", this->caps_buf);
-  r = gst_pad_push (this->srcpad, gst_buffer_ref (this->caps_buf));
-  if (r != GST_FLOW_OK) {
-    GST_WARNING_OBJECT (this, "pushing GDP caps buffer returned %d", r);
-    goto done;
-  }
-  GST_DEBUG_OBJECT (this, "Pushing GDP new_segment buffer %p with offset %"
-      G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT, this->new_segment_buf,
-      GST_BUFFER_OFFSET (this->new_segment_buf),
-      GST_BUFFER_OFFSET_END (this->new_segment_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->new_segment_buf));
-  if (r != GST_FLOW_OK) {
-    GST_WARNING_OBJECT (this, "pushing GDP newsegment buffer returned %d", r);
-    goto done;
-  }
-  if (this->tag_buf) {
-    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));
-    if (r != GST_FLOW_OK) {
-      GST_WARNING_OBJECT (this, "pushing GDP tag buffer returned %d", r);
-      goto done;
-    }
-  }
   this->sent_streamheader = TRUE;
   GST_DEBUG_OBJECT (this, "need to push %d queued buffers",
       g_list_length (this->queue));
@@ -524,7 +377,6 @@
     /* delete buffer from queue now */
     this->queue = g_list_delete_link (this->queue, this->queue);
 
-    /* set caps and push */
     r = gst_pad_push (this->srcpad, buffer);
     if (r != GST_FLOW_OK) {
       GST_WARNING_OBJECT (this, "pushing queued GDP buffer returned %d", r);
@@ -532,6 +384,8 @@
     }
   }
 
+  this->reset_streamheader = FALSE;
+
 done:
   gst_caps_unref (caps);
   GST_DEBUG_OBJECT (this, "stop");
@@ -551,7 +405,7 @@
 static GstFlowReturn
 gst_gdp_queue_buffer (GstGDPPay * this, GstBuffer * buffer)
 {
-  if (this->sent_streamheader) {
+  if (this->sent_streamheader && !this->reset_streamheader) {
     GST_LOG_OBJECT (this, "Pushing GDP buffer %p, caps %" GST_PTR_FORMAT,
         buffer, this->caps);
     return gst_pad_push (this->srcpad, buffer);
@@ -559,12 +413,10 @@
 
   /* store it on an internal queue. buffer remains reffed. */
   this->queue = g_list_append (this->queue, buffer);
-  GST_DEBUG_OBJECT (this, "streamheader not sent yet, "
+  GST_DEBUG_OBJECT (this, "streamheader not sent yet or needs update, "
       "queued buffer %p, now %d buffers queued",
       buffer, g_list_length (this->queue));
 
-  gst_gdp_pay_reset_streamheader (this);
-
   return GST_FLOW_OK;
 }
 
@@ -572,9 +424,6 @@
 gst_gdp_pay_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
 {
   GstGDPPay *this;
-#if 0
-  GstCaps *caps;
-#endif
   GstBuffer *outbuffer;
   GstFlowReturn ret;
 
@@ -582,7 +431,7 @@
 
   /* we should have received a new_segment before, otherwise it's a bug.
    * fake one in that case */
-  if (!this->new_segment_buf) {
+  if (!this->have_segment) {
     GstEvent *event;
     GstSegment segment;
 
@@ -603,7 +452,7 @@
       GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_HEADER);
       GST_DEBUG_OBJECT (this, "Storing buffer %p as new_segment_buf",
           outbuffer);
-      this->new_segment_buf = outbuffer;
+      this->have_segment = TRUE;
     }
   }
   /* make sure we've received caps before */
@@ -629,6 +478,9 @@
   GST_BUFFER_TIMESTAMP (outbuffer) = GST_BUFFER_TIMESTAMP (buffer);
   GST_BUFFER_DURATION (outbuffer) = GST_BUFFER_DURATION (buffer);
 
+  if (this->reset_streamheader)
+    gst_gdp_pay_reset_streamheader (this);
+
   ret = gst_gdp_queue_buffer (this, outbuffer);
 
 done:
@@ -646,16 +498,6 @@
     ret = GST_FLOW_NOT_NEGOTIATED;
     goto done;
   }
-#if 0
-no_caps_buffer:
-  {
-    GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
-        ("Could not create GDP buffer from caps %" GST_PTR_FORMAT, caps));
-    gst_caps_unref (caps);
-    ret = GST_FLOW_ERROR;
-    goto done;
-  }
-#endif
 no_buffer:
   {
     GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
@@ -689,28 +531,16 @@
    * and not send it on */
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_STREAM_START:
-      GST_DEBUG_OBJECT (this, "Storing stream start id in buffer %p",
-          outbuffer);
-
-      if (this->streamstartid_buf)
-        gst_buffer_unref (this->streamstartid_buf);
-      this->streamstartid_buf = outbuffer;
-
-      GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_HEADER);
-      gst_gdp_pay_reset_streamheader (this);
+      GST_DEBUG_OBJECT (this, "Received stream start id");
+      this->have_streamstartid = TRUE;
       break;
     case GST_EVENT_SEGMENT:
-      GST_DEBUG_OBJECT (this, "Storing in caps buffer %p as new_segment_buf",
-          outbuffer);
-
-      if (this->new_segment_buf)
-        gst_buffer_unref (this->new_segment_buf);
-      this->new_segment_buf = outbuffer;
-
-      GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_HEADER);
-      gst_gdp_pay_reset_streamheader (this);
+      GST_DEBUG_OBJECT (this, "Received segment %" GST_PTR_FORMAT, event);
+      this->have_segment = TRUE;
       break;
     case GST_EVENT_CAPS:{
+      GST_DEBUG_OBJECT (this, "Received caps %" GST_PTR_FORMAT, event);
+      this->have_caps = TRUE;
       gst_event_parse_caps (event, &caps);
       gst_buffer_replace (&outbuffer, NULL);
       if (this->caps == NULL || !gst_caps_is_equal (this->caps, caps)) {
@@ -721,34 +551,18 @@
           goto no_buffer_from_caps;
 
         GST_BUFFER_DURATION (outbuffer) = 0;
-        GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_HEADER);
-        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);
-
-      if (this->tag_buf)
-        gst_buffer_unref (this->tag_buf);
-      this->tag_buf = outbuffer;
-
-      GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_HEADER);
-      gst_gdp_pay_reset_streamheader (this);
-      break;
     default:
-      GST_DEBUG_OBJECT (this, "queuing GDP buffer %p of event %p", outbuffer,
-          event);
-      flowret = gst_gdp_queue_buffer (this, outbuffer);
-      if (flowret != GST_FLOW_OK)
-        goto push_error;
       break;
   }
 
+  if (GST_EVENT_IS_STICKY (event)) {
+    GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_HEADER);
+    this->reset_streamheader = TRUE;
+  }
+
   /* if we have EOS, we should send on EOS ourselves */
   if (GST_EVENT_TYPE (event) == GST_EVENT_EOS
       || GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START) {
@@ -757,6 +571,14 @@
     ret = gst_pad_push_event (this->srcpad, gst_event_ref (event));
   }
 
+  if (GST_EVENT_TYPE (event) != GST_EVENT_EOS) {
+    GST_DEBUG_OBJECT (this, "queuing GDP buffer %p of event %p", outbuffer,
+        event);
+    flowret = gst_gdp_queue_buffer (this, outbuffer);
+    if (flowret != GST_FLOW_OK)
+      goto push_error;
+  }
+
 done:
   gst_event_unref (event);
 
@@ -831,9 +653,6 @@
           g_value_get_boolean (value) ? GST_DP_HEADER_FLAG_CRC_PAYLOAD : 0;
       this->header_flag = this->crc_header | this->crc_payload;
       break;
-    case PROP_VERSION:
-      this->version = g_value_get_enum (value);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -856,9 +675,6 @@
     case PROP_CRC_PAYLOAD:
       g_value_set_boolean (value, this->crc_payload);
       break;
-    case PROP_VERSION:
-      g_value_set_enum (value, this->version);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
diff --git a/gst/gdp/gstgdppay.h b/gst/gdp/gstgdppay.h
index d4433ef..2e01eb1 100644
--- a/gst/gdp/gstgdppay.h
+++ b/gst/gdp/gstgdppay.h
@@ -52,10 +52,11 @@
 
   GstCaps *caps; /* incoming caps */
 
-  GstBuffer *streamstartid_buf;
-  GstBuffer *caps_buf;
-  GstBuffer *new_segment_buf;
-  GstBuffer *tag_buf;
+  gboolean  have_streamstartid;
+  gboolean  have_caps;
+  gboolean  have_segment;
+
+  gboolean reset_streamheader;
 
   gboolean sent_streamheader; /* TRUE after the first streamheaders are sent */
   GList *queue; /* list of queued buffers before streamheaders are sent */
@@ -64,8 +65,6 @@
   gboolean crc_header;
   gboolean crc_payload;
   GstDPHeaderFlag header_flag;
-  GstDPVersion version;
-  GstDPPacketizer *packetizer;
 };
 
 struct _GstGDPPayClass
diff --git a/gst/geometrictransform/Makefile.in b/gst/geometrictransform/Makefile.in
index b20d30c..10faea7 100644
--- a/gst/geometrictransform/Makefile.in
+++ b/gst/geometrictransform/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -267,8 +267,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -307,7 +311,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -315,6 +318,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -364,8 +369,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -444,7 +447,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -453,7 +455,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -466,7 +467,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -491,6 +491,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -564,10 +566,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -593,6 +599,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -629,6 +638,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -669,17 +679,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -696,6 +705,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/hdvparse/Makefile.in b/gst/hdvparse/Makefile.in
index af0ce2d..43da119 100644
--- a/gst/hdvparse/Makefile.in
+++ b/gst/hdvparse/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/id3tag/Makefile.in b/gst/id3tag/Makefile.in
index 88171d2..cbc1fa8 100644
--- a/gst/id3tag/Makefile.in
+++ b/gst/id3tag/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/inter/Makefile.in b/gst/inter/Makefile.in
index 5eeae43..ea5cb31 100644
--- a/gst/inter/Makefile.in
+++ b/gst/inter/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -261,8 +261,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -301,7 +305,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -309,6 +312,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -358,8 +363,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -438,7 +441,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -447,7 +449,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -460,7 +461,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -485,6 +485,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -558,10 +560,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -587,6 +593,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -623,6 +632,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -663,17 +673,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -690,6 +699,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/inter/gstinteraudiosink.c b/gst/inter/gstinteraudiosink.c
index 1c6e56d..58e7832 100644
--- a/gst/inter/gstinteraudiosink.c
+++ b/gst/inter/gstinteraudiosink.c
@@ -51,8 +51,6 @@
 #define GST_CAT_DEFAULT gst_inter_audio_sink_debug_category
 
 /* prototypes */
-
-
 static void gst_inter_audio_sink_set_property (GObject * object,
     guint property_id, const GValue * value, GParamSpec * pspec);
 static void gst_inter_audio_sink_get_property (GObject * object,
@@ -63,8 +61,14 @@
     GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
 static gboolean gst_inter_audio_sink_start (GstBaseSink * sink);
 static gboolean gst_inter_audio_sink_stop (GstBaseSink * sink);
+static gboolean gst_inter_audio_sink_set_caps (GstBaseSink * sink,
+    GstCaps * caps);
+static gboolean gst_inter_audio_sink_event (GstBaseSink * sink,
+    GstEvent * event);
 static GstFlowReturn gst_inter_audio_sink_render (GstBaseSink * sink,
     GstBuffer * buffer);
+static gboolean gst_inter_audio_sink_query (GstBaseSink * sink,
+    GstQuery * query);
 
 enum
 {
@@ -72,20 +76,18 @@
   PROP_CHANNEL
 };
 
-/* pad templates */
+#define DEFAULT_CHANNEL ("default")
 
+/* pad templates */
 static GstStaticPadTemplate gst_inter_audio_sink_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw, format = (string) " GST_AUDIO_NE (S16) ", "
-        "rate = (int) 48000, channels = (int) 2")
+    GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL))
     );
 
-
 /* class initialization */
-
-
+#define parent_class gst_inter_audio_sink_parent_class
 G_DEFINE_TYPE (GstInterAudioSink, gst_inter_audio_sink, GST_TYPE_BASE_SINK);
 
 static void
@@ -113,18 +115,22 @@
       GST_DEBUG_FUNCPTR (gst_inter_audio_sink_get_times);
   base_sink_class->start = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_start);
   base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_stop);
+  base_sink_class->event = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_event);
+  base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_set_caps);
   base_sink_class->render = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_render);
+  base_sink_class->query = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_query);
 
   g_object_class_install_property (gobject_class, PROP_CHANNEL,
       g_param_spec_string ("channel", "Channel",
           "Channel name to match inter src and sink elements",
-          "default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
 gst_inter_audio_sink_init (GstInterAudioSink * interaudiosink)
 {
-  interaudiosink->channel = g_strdup ("default");
+  interaudiosink->channel = g_strdup (DEFAULT_CHANNEL);
+  interaudiosink->input_adapter = gst_adapter_new ();
 }
 
 void
@@ -167,11 +173,11 @@
 
   /* clean up object here */
   g_free (interaudiosink->channel);
+  gst_object_unref (interaudiosink->input_adapter);
 
   G_OBJECT_CLASS (gst_inter_audio_sink_parent_class)->finalize (object);
 }
 
-
 static void
 gst_inter_audio_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
     GstClockTime * start, GstClockTime * end)
@@ -183,15 +189,13 @@
     if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
       *end = *start + GST_BUFFER_DURATION (buffer);
     } else {
-      if (interaudiosink->fps_n > 0) {
+      if (interaudiosink->info.rate > 0) {
         *end = *start +
-            gst_util_uint64_scale_int (GST_SECOND, interaudiosink->fps_d,
-            interaudiosink->fps_n);
+            gst_util_uint64_scale_int (gst_buffer_get_size (buffer), GST_SECOND,
+            interaudiosink->info.rate * interaudiosink->info.bpf);
       }
     }
   }
-
-
 }
 
 static gboolean
@@ -199,9 +203,17 @@
 {
   GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
 
-  GST_DEBUG ("start");
+  GST_DEBUG_OBJECT (interaudiosink, "start");
 
   interaudiosink->surface = gst_inter_surface_get (interaudiosink->channel);
+  g_mutex_lock (&interaudiosink->surface->mutex);
+  memset (&interaudiosink->surface->audio_info, 0, sizeof (GstAudioInfo));
+
+  /* We want to write latency-time before syncing has happened */
+  /* FIXME: The other side can change this value when it starts */
+  gst_base_sink_set_render_delay (sink,
+      interaudiosink->surface->audio_latency_time);
+  g_mutex_unlock (&interaudiosink->surface->mutex);
 
   return TRUE;
 }
@@ -211,38 +223,182 @@
 {
   GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
 
-  GST_DEBUG ("stop");
+  GST_DEBUG_OBJECT (interaudiosink, "stop");
 
   g_mutex_lock (&interaudiosink->surface->mutex);
   gst_adapter_clear (interaudiosink->surface->audio_adapter);
+  memset (&interaudiosink->surface->audio_info, 0, sizeof (GstAudioInfo));
   g_mutex_unlock (&interaudiosink->surface->mutex);
 
   gst_inter_surface_unref (interaudiosink->surface);
   interaudiosink->surface = NULL;
 
+  gst_adapter_clear (interaudiosink->input_adapter);
+
   return TRUE;
 }
 
+static gboolean
+gst_inter_audio_sink_set_caps (GstBaseSink * sink, GstCaps * caps)
+{
+  GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
+  GstAudioInfo info;
+
+  if (!gst_audio_info_from_caps (&info, caps)) {
+    GST_ERROR_OBJECT (sink, "Failed to parse caps %" GST_PTR_FORMAT, caps);
+    return FALSE;
+  }
+
+  g_mutex_lock (&interaudiosink->surface->mutex);
+  interaudiosink->surface->audio_info = info;
+  interaudiosink->info = info;
+  /* TODO: Ideally we would drain the source here */
+  gst_adapter_clear (interaudiosink->surface->audio_adapter);
+  g_mutex_unlock (&interaudiosink->surface->mutex);
+
+  return TRUE;
+}
+
+static gboolean
+gst_inter_audio_sink_event (GstBaseSink * sink, GstEvent * event)
+{
+  GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_EOS:{
+      GstBuffer *tmp;
+      guint n;
+
+      if ((n = gst_adapter_available (interaudiosink->input_adapter)) > 0) {
+        g_mutex_lock (&interaudiosink->surface->mutex);
+        tmp = gst_adapter_take_buffer (interaudiosink->input_adapter, n);
+        gst_adapter_push (interaudiosink->surface->audio_adapter, tmp);
+        g_mutex_unlock (&interaudiosink->surface->mutex);
+      }
+      break;
+    }
+    default:
+      break;
+  }
+
+  return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
+}
+
 static GstFlowReturn
 gst_inter_audio_sink_render (GstBaseSink * sink, GstBuffer * buffer)
 {
   GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
-  int n;
+  guint n, bpf;
+  guint64 period_time, buffer_time;
+  guint64 period_samples, buffer_samples;
 
-  GST_DEBUG ("render %" G_GSIZE_FORMAT, gst_buffer_get_size (buffer));
+  GST_DEBUG_OBJECT (interaudiosink, "render %" G_GSIZE_FORMAT,
+      gst_buffer_get_size (buffer));
+  bpf = interaudiosink->info.bpf;
 
   g_mutex_lock (&interaudiosink->surface->mutex);
-  n = gst_adapter_available (interaudiosink->surface->audio_adapter) / 4;
-#define SIZE 1600
-  if (n > (SIZE * 3)) {
-    int n_chunks = (n / (SIZE / 2)) - 4;
-    GST_WARNING ("flushing %d samples", n_chunks * 800);
-    gst_adapter_flush (interaudiosink->surface->audio_adapter,
-        n_chunks * (SIZE / 2) * 4);
+
+  buffer_time = interaudiosink->surface->audio_buffer_time;
+  period_time = interaudiosink->surface->audio_period_time;
+
+  if (buffer_time < period_time) {
+    GST_ERROR_OBJECT (interaudiosink,
+        "Buffer time smaller than period time (%" GST_TIME_FORMAT " < %"
+        GST_TIME_FORMAT ")", GST_TIME_ARGS (buffer_time),
+        GST_TIME_ARGS (period_time));
+    g_mutex_unlock (&interaudiosink->surface->mutex);
+    return GST_FLOW_ERROR;
   }
-  gst_adapter_push (interaudiosink->surface->audio_adapter,
-      gst_buffer_ref (buffer));
+
+  buffer_samples =
+      gst_util_uint64_scale (buffer_time, interaudiosink->info.rate,
+      GST_SECOND);
+  period_samples =
+      gst_util_uint64_scale (period_time, interaudiosink->info.rate,
+      GST_SECOND);
+
+  n = gst_adapter_available (interaudiosink->surface->audio_adapter) / bpf;
+  while (n > buffer_samples) {
+    GST_DEBUG_OBJECT (interaudiosink, "flushing %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (period_time));
+    gst_adapter_flush (interaudiosink->surface->audio_adapter,
+        period_samples * bpf);
+    n -= period_samples;
+  }
+
+  n = gst_adapter_available (interaudiosink->input_adapter);
+  if (period_samples * bpf > gst_buffer_get_size (buffer) + n) {
+    gst_adapter_push (interaudiosink->input_adapter, gst_buffer_ref (buffer));
+  } else {
+    GstBuffer *tmp;
+
+    if (n > 0) {
+      tmp = gst_adapter_take_buffer (interaudiosink->input_adapter, n);
+      gst_adapter_push (interaudiosink->surface->audio_adapter, tmp);
+    }
+    gst_adapter_push (interaudiosink->surface->audio_adapter,
+        gst_buffer_ref (buffer));
+  }
   g_mutex_unlock (&interaudiosink->surface->mutex);
 
   return GST_FLOW_OK;
 }
+
+static gboolean
+gst_inter_audio_sink_query (GstBaseSink * sink, GstQuery * query)
+{
+  GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
+  gboolean ret;
+
+  GST_DEBUG_OBJECT (sink, "query");
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_LATENCY:{
+      gboolean live, us_live;
+      GstClockTime min_l, max_l;
+
+      GST_DEBUG_OBJECT (sink, "latency query");
+
+      if ((ret =
+              gst_base_sink_query_latency (GST_BASE_SINK_CAST (sink), &live,
+                  &us_live, &min_l, &max_l))) {
+        GstClockTime base_latency, min_latency, max_latency;
+
+        /* we and upstream are both live, adjust the min_latency */
+        if (live && us_live) {
+          /* FIXME: The other side can change this value when it starts */
+          base_latency = interaudiosink->surface->audio_latency_time;
+
+          /* we cannot go lower than the buffer size and the min peer latency */
+          min_latency = base_latency + min_l;
+          /* the max latency is the max of the peer, we can delay an infinite
+           * amount of time. */
+          max_latency = (max_l == -1) ? -1 : (base_latency + max_l);
+
+          GST_DEBUG_OBJECT (sink,
+              "peer min %" GST_TIME_FORMAT ", our min latency: %"
+              GST_TIME_FORMAT, GST_TIME_ARGS (min_l),
+              GST_TIME_ARGS (min_latency));
+          GST_DEBUG_OBJECT (sink,
+              "peer max %" GST_TIME_FORMAT ", our max latency: %"
+              GST_TIME_FORMAT, GST_TIME_ARGS (max_l),
+              GST_TIME_ARGS (max_latency));
+        } else {
+          GST_DEBUG_OBJECT (sink,
+              "peer or we are not live, don't care about latency");
+          min_latency = min_l;
+          max_latency = max_l;
+        }
+        gst_query_set_latency (query, live, min_latency, max_latency);
+      }
+      break;
+    }
+    default:
+      ret =
+          GST_BASE_SINK_CLASS (gst_inter_audio_sink_parent_class)->query (sink,
+          query);
+      break;
+  }
+
+  return ret;
+}
diff --git a/gst/inter/gstinteraudiosink.h b/gst/inter/gstinteraudiosink.h
index a85d66a..8f8c9a2 100644
--- a/gst/inter/gstinteraudiosink.h
+++ b/gst/inter/gstinteraudiosink.h
@@ -41,8 +41,8 @@
   GstInterSurface *surface;
   char *channel;
 
-  int fps_n;
-  int fps_d;
+  GstAdapter *input_adapter;
+  GstAudioInfo info;
 };
 
 struct _GstInterAudioSinkClass
diff --git a/gst/inter/gstinteraudiosrc.c b/gst/inter/gstinteraudiosrc.c
index cab0eb6..2eeff65 100644
--- a/gst/inter/gstinteraudiosrc.c
+++ b/gst/inter/gstinteraudiosrc.c
@@ -51,14 +51,14 @@
 #define GST_CAT_DEFAULT gst_inter_audio_src_debug_category
 
 /* prototypes */
-
-
 static void gst_inter_audio_src_set_property (GObject * object,
     guint property_id, const GValue * value, GParamSpec * pspec);
 static void gst_inter_audio_src_get_property (GObject * object,
     guint property_id, GValue * value, GParamSpec * pspec);
 static void gst_inter_audio_src_finalize (GObject * object);
 
+static GstCaps *gst_inter_audio_src_get_caps (GstBaseSrc * src,
+    GstCaps * filter);
 static gboolean gst_inter_audio_src_set_caps (GstBaseSrc * src, GstCaps * caps);
 static gboolean gst_inter_audio_src_start (GstBaseSrc * src);
 static gboolean gst_inter_audio_src_stop (GstBaseSrc * src);
@@ -74,22 +74,26 @@
 enum
 {
   PROP_0,
-  PROP_CHANNEL
+  PROP_CHANNEL,
+  PROP_BUFFER_TIME,
+  PROP_LATENCY_TIME,
+  PROP_PERIOD_TIME
 };
 
-/* pad templates */
+#define DEFAULT_CHANNEL ("default")
 
+/* pad templates */
 static GstStaticPadTemplate gst_inter_audio_src_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw, format = (string) " GST_AUDIO_NE (S16) ", "
-        "rate = (int) 48000, channels = (int) 2")
+    GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL)
+        ", layout = (string) interleaved")
     );
 
 
 /* class initialization */
-
+#define parent_class gst_inter_audio_src_parent_class
 G_DEFINE_TYPE (GstInterAudioSrc, gst_inter_audio_src, GST_TYPE_BASE_SRC);
 
 static void
@@ -114,6 +118,7 @@
   gobject_class->set_property = gst_inter_audio_src_set_property;
   gobject_class->get_property = gst_inter_audio_src_get_property;
   gobject_class->finalize = gst_inter_audio_src_finalize;
+  base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_audio_src_get_caps);
   base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_audio_src_set_caps);
   base_src_class->start = GST_DEBUG_FUNCPTR (gst_inter_audio_src_start);
   base_src_class->stop = GST_DEBUG_FUNCPTR (gst_inter_audio_src_stop);
@@ -125,7 +130,24 @@
   g_object_class_install_property (gobject_class, PROP_CHANNEL,
       g_param_spec_string ("channel", "Channel",
           "Channel name to match inter src and sink elements",
-          "default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_BUFFER_TIME,
+      g_param_spec_uint64 ("buffer-time", "Buffer Time",
+          "Size of audio buffer", 1, G_MAXUINT64, DEFAULT_AUDIO_BUFFER_TIME,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_LATENCY_TIME,
+      g_param_spec_uint64 ("latency-time", "Latency Time",
+          "Latency as reported by the source",
+          1, G_MAXUINT64, DEFAULT_AUDIO_LATENCY_TIME,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_PERIOD_TIME,
+      g_param_spec_uint64 ("period-time", "Period Time",
+          "The minimum amount of data to read in each iteration",
+          1, G_MAXUINT64, DEFAULT_AUDIO_PERIOD_TIME,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -135,7 +157,10 @@
   gst_base_src_set_live (GST_BASE_SRC (interaudiosrc), TRUE);
   gst_base_src_set_blocksize (GST_BASE_SRC (interaudiosrc), -1);
 
-  interaudiosrc->channel = g_strdup ("default");
+  interaudiosrc->channel = g_strdup (DEFAULT_CHANNEL);
+  interaudiosrc->buffer_time = DEFAULT_AUDIO_BUFFER_TIME;
+  interaudiosrc->latency_time = DEFAULT_AUDIO_LATENCY_TIME;
+  interaudiosrc->period_time = DEFAULT_AUDIO_PERIOD_TIME;
 }
 
 void
@@ -149,6 +174,15 @@
       g_free (interaudiosrc->channel);
       interaudiosrc->channel = g_value_dup_string (value);
       break;
+    case PROP_BUFFER_TIME:
+      interaudiosrc->buffer_time = g_value_get_uint64 (value);
+      break;
+    case PROP_LATENCY_TIME:
+      interaudiosrc->latency_time = g_value_get_uint64 (value);
+      break;
+    case PROP_PERIOD_TIME:
+      interaudiosrc->period_time = g_value_get_uint64 (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -165,6 +199,15 @@
     case PROP_CHANNEL:
       g_value_set_string (value, interaudiosrc->channel);
       break;
+    case PROP_BUFFER_TIME:
+      g_value_set_uint64 (value, interaudiosrc->buffer_time);
+      break;
+    case PROP_LATENCY_TIME:
+      g_value_set_uint64 (value, interaudiosrc->latency_time);
+      break;
+    case PROP_PERIOD_TIME:
+      g_value_set_uint64 (value, interaudiosrc->period_time);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -182,39 +225,53 @@
   G_OBJECT_CLASS (gst_inter_audio_src_parent_class)->finalize (object);
 }
 
+static GstCaps *
+gst_inter_audio_src_get_caps (GstBaseSrc * src, GstCaps * filter)
+{
+  GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
+  GstCaps *caps;
+
+  GST_DEBUG_OBJECT (interaudiosrc, "get_caps");
+
+  if (!interaudiosrc->surface)
+    return GST_BASE_SRC_CLASS (parent_class)->get_caps (src, filter);
+
+  g_mutex_lock (&interaudiosrc->surface->mutex);
+  if (interaudiosrc->surface->audio_info.finfo) {
+    caps = gst_audio_info_to_caps (&interaudiosrc->surface->audio_info);
+    if (filter) {
+      GstCaps *tmp;
+
+      tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+      gst_caps_unref (caps);
+      caps = tmp;
+    }
+  } else {
+    caps = NULL;
+  }
+  g_mutex_unlock (&interaudiosrc->surface->mutex);
+
+  if (caps)
+    return caps;
+  else
+    return GST_BASE_SRC_CLASS (parent_class)->get_caps (src, filter);
+}
+
 static gboolean
 gst_inter_audio_src_set_caps (GstBaseSrc * src, GstCaps * caps)
 {
   GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
-  const GstStructure *structure;
-  GstAudioInfo info;
-  gboolean ret;
-  int sample_rate;
 
   GST_DEBUG_OBJECT (interaudiosrc, "set_caps");
 
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (!gst_structure_get_int (structure, "rate", &sample_rate)) {
-    GST_ERROR_OBJECT (src, "Audio caps without rate");
+  if (!gst_audio_info_from_caps (&interaudiosrc->info, caps)) {
+    GST_ERROR_OBJECT (src, "Failed to parse caps %" GST_PTR_FORMAT, caps);
     return FALSE;
   }
 
-  interaudiosrc->sample_rate = sample_rate;
-
-  if (!gst_audio_info_from_caps (&info, caps)) {
-    GST_ERROR_OBJECT (src, "Can't parse audio caps");
-    return FALSE;
-  }
-
-  interaudiosrc->finfo = info.finfo;
-
-  ret = gst_pad_set_caps (src->srcpad, caps);
-
-  return ret;
+  return TRUE;
 }
 
-
 static gboolean
 gst_inter_audio_src_start (GstBaseSrc * src)
 {
@@ -223,6 +280,14 @@
   GST_DEBUG_OBJECT (interaudiosrc, "start");
 
   interaudiosrc->surface = gst_inter_surface_get (interaudiosrc->channel);
+  interaudiosrc->timestamp_offset = 0;
+  interaudiosrc->n_samples = 0;
+
+  g_mutex_lock (&interaudiosrc->surface->mutex);
+  interaudiosrc->surface->audio_buffer_time = interaudiosrc->buffer_time;
+  interaudiosrc->surface->audio_latency_time = interaudiosrc->latency_time;
+  interaudiosrc->surface->audio_period_time = interaudiosrc->period_time;
+  g_mutex_unlock (&interaudiosrc->surface->mutex);
 
   return TRUE;
 }
@@ -236,7 +301,6 @@
 
   gst_inter_surface_unref (interaudiosrc->surface);
   interaudiosrc->surface = NULL;
-  interaudiosrc->finfo = NULL;
 
   return TRUE;
 }
@@ -245,86 +309,117 @@
 gst_inter_audio_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
     GstClockTime * start, GstClockTime * end)
 {
+  GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
+
   GST_DEBUG_OBJECT (src, "get_times");
 
   /* for live sources, sync on the timestamp of the buffer */
   if (gst_base_src_is_live (src)) {
-    GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
-
-    if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
-      /* get duration to calculate end time */
-      GstClockTime duration = GST_BUFFER_DURATION (buffer);
-
-      if (GST_CLOCK_TIME_IS_VALID (duration)) {
-        *end = timestamp + duration;
+    if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
+      *start = GST_BUFFER_TIMESTAMP (buffer);
+      if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
+        *end = *start + GST_BUFFER_DURATION (buffer);
+      } else {
+        if (interaudiosrc->info.rate > 0) {
+          *end = *start +
+              gst_util_uint64_scale_int (gst_buffer_get_size (buffer),
+              GST_SECOND, interaudiosrc->info.rate * interaudiosrc->info.bpf);
+        }
       }
-      *start = timestamp;
     }
-  } else {
-    *start = -1;
-    *end = -1;
   }
 }
 
-
-#define SIZE 1600
-
 static GstFlowReturn
 gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
     GstBuffer ** buf)
 {
   GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
+  GstCaps *caps;
   GstBuffer *buffer;
-  int n;
+  guint n, bpf;
+  guint64 period_time;
+  guint64 period_samples;
 
   GST_DEBUG_OBJECT (interaudiosrc, "create");
 
   buffer = NULL;
+  caps = NULL;
 
   g_mutex_lock (&interaudiosrc->surface->mutex);
-  n = gst_adapter_available (interaudiosrc->surface->audio_adapter) / 4;
-  if (n > SIZE * 3) {
-    GST_WARNING ("flushing %d samples", SIZE / 2);
-    gst_adapter_flush (interaudiosrc->surface->audio_adapter, (SIZE / 2) * 4);
-    n -= (SIZE / 2);
+  if (interaudiosrc->surface->audio_info.finfo) {
+    if (!gst_audio_info_is_equal (&interaudiosrc->surface->audio_info,
+            &interaudiosrc->info)) {
+      caps = gst_audio_info_to_caps (&interaudiosrc->surface->audio_info);
+      interaudiosrc->timestamp_offset +=
+          gst_util_uint64_scale (interaudiosrc->n_samples, GST_SECOND,
+          interaudiosrc->info.rate);
+      interaudiosrc->n_samples = 0;
+    }
   }
-  if (n > SIZE)
-    n = SIZE;
+
+  bpf = interaudiosrc->surface->audio_info.bpf;
+  period_time = interaudiosrc->surface->audio_period_time;
+  period_samples =
+      gst_util_uint64_scale (period_time, interaudiosrc->info.rate, GST_SECOND);
+
+  if (bpf > 0)
+    n = gst_adapter_available (interaudiosrc->surface->audio_adapter) / bpf;
+  else
+    n = 0;
+
+  if (n > period_samples)
+    n = period_samples;
   if (n > 0) {
     buffer = gst_adapter_take_buffer (interaudiosrc->surface->audio_adapter,
-        n * 4);
+        n * bpf);
   } else {
     buffer = gst_buffer_new ();
+    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_GAP);
   }
   g_mutex_unlock (&interaudiosrc->surface->mutex);
 
-  if (n < SIZE) {
+  if (caps) {
+    gboolean ret = gst_base_src_set_caps (src, caps);
+    gst_caps_unref (caps);
+    if (!ret) {
+      GST_ERROR_OBJECT (src, "Failed to set caps %" GST_PTR_FORMAT, caps);
+      if (buffer)
+        gst_buffer_unref (buffer);
+      return GST_FLOW_NOT_NEGOTIATED;
+    }
+  }
+
+  buffer = gst_buffer_make_writable (buffer);
+
+  bpf = interaudiosrc->info.bpf;
+  if (n < period_samples) {
     GstMapInfo map;
     GstMemory *mem;
 
-    GST_WARNING ("creating %d samples of silence", SIZE - n);
-    mem = gst_allocator_alloc (NULL, (SIZE - n) * 4, NULL);
+    GST_DEBUG_OBJECT (interaudiosrc,
+        "creating %" G_GUINT64_FORMAT " samples of silence",
+        period_samples - n);
+    mem = gst_allocator_alloc (NULL, (period_samples - n) * bpf, NULL);
     if (gst_memory_map (mem, &map, GST_MAP_WRITE)) {
-      gst_audio_format_fill_silence (interaudiosrc->finfo, map.data, map.size);
+      gst_audio_format_fill_silence (interaudiosrc->info.finfo, map.data,
+          map.size);
       gst_memory_unmap (mem, &map);
     }
-    buffer = gst_buffer_make_writable (buffer);
     gst_buffer_prepend_memory (buffer, mem);
   }
-  n = SIZE;
+  n = period_samples;
 
   GST_BUFFER_OFFSET (buffer) = interaudiosrc->n_samples;
   GST_BUFFER_OFFSET_END (buffer) = interaudiosrc->n_samples + n;
-  GST_BUFFER_TIMESTAMP (buffer) =
-      gst_util_uint64_scale_int (interaudiosrc->n_samples, GST_SECOND,
-      interaudiosrc->sample_rate);
+  GST_BUFFER_TIMESTAMP (buffer) = interaudiosrc->timestamp_offset +
+      gst_util_uint64_scale (interaudiosrc->n_samples, GST_SECOND,
+      interaudiosrc->info.rate);
   GST_DEBUG_OBJECT (interaudiosrc, "create ts %" GST_TIME_FORMAT,
       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
-  GST_BUFFER_DURATION (buffer) =
-      gst_util_uint64_scale_int (interaudiosrc->n_samples + n, GST_SECOND,
-      interaudiosrc->sample_rate) - GST_BUFFER_TIMESTAMP (buffer);
-  GST_BUFFER_OFFSET (buffer) = interaudiosrc->n_samples;
-  GST_BUFFER_OFFSET_END (buffer) = -1;
+  GST_BUFFER_DURATION (buffer) = interaudiosrc->timestamp_offset +
+      gst_util_uint64_scale (interaudiosrc->n_samples + n, GST_SECOND,
+      interaudiosrc->info.rate) - GST_BUFFER_TIMESTAMP (buffer);
   GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
   if (interaudiosrc->n_samples == 0) {
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
@@ -336,10 +431,10 @@
   return GST_FLOW_OK;
 }
 
-
 static gboolean
 gst_inter_audio_src_query (GstBaseSrc * src, GstQuery * query)
 {
+  GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
   gboolean ret;
 
   GST_DEBUG_OBJECT (src, "query");
@@ -348,11 +443,10 @@
     case GST_QUERY_LATENCY:{
       GstClockTime min_latency, max_latency;
 
-      min_latency = 30 * gst_util_uint64_scale_int (GST_SECOND, SIZE, 48000);
+      min_latency = interaudiosrc->latency_time;
+      max_latency = interaudiosrc->buffer_time;
 
-      max_latency = min_latency;
-
-      GST_ERROR_OBJECT (src,
+      GST_DEBUG_OBJECT (src,
           "report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
           GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
 
@@ -379,11 +473,14 @@
   GST_DEBUG_OBJECT (src, "fixate");
 
   caps = gst_caps_make_writable (caps);
+  caps = gst_caps_truncate (caps);
 
   structure = gst_caps_get_structure (caps, 0);
 
+  gst_structure_fixate_field_string (structure, "format", GST_AUDIO_NE (S16));
   gst_structure_fixate_field_nearest_int (structure, "channels", 2);
   gst_structure_fixate_field_nearest_int (structure, "rate", 48000);
+  gst_structure_fixate_field_string (structure, "layout", "interleaved");
 
   return caps;
 }
diff --git a/gst/inter/gstinteraudiosrc.h b/gst/inter/gstinteraudiosrc.h
index 318bb39..131b2af 100644
--- a/gst/inter/gstinteraudiosrc.h
+++ b/gst/inter/gstinteraudiosrc.h
@@ -43,9 +43,9 @@
   char *channel;
 
   guint64 n_samples;
-  int sample_rate;
-
-  const GstAudioFormatInfo *finfo;
+  GstClockTime timestamp_offset;
+  GstAudioInfo info;
+  guint64 buffer_time, latency_time, period_time;
 };
 
 struct _GstInterAudioSrcClass
diff --git a/gst/inter/gstintersubsink.c b/gst/inter/gstintersubsink.c
index eaa12f7..b907c0a 100644
--- a/gst/inter/gstintersubsink.c
+++ b/gst/inter/gstintersubsink.c
@@ -47,8 +47,6 @@
 #define GST_CAT_DEFAULT gst_inter_sub_sink_debug_category
 
 /* prototypes */
-
-
 static void gst_inter_sub_sink_set_property (GObject * object,
     guint property_id, const GValue * value, GParamSpec * pspec);
 static void gst_inter_sub_sink_get_property (GObject * object,
@@ -68,8 +66,9 @@
   PROP_CHANNEL
 };
 
-/* pad templates */
+#define DEFAULT_CHANNEL ("default")
 
+/* pad templates */
 static GstStaticPadTemplate gst_inter_sub_sink_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
@@ -112,14 +111,13 @@
   g_object_class_install_property (gobject_class, PROP_CHANNEL,
       g_param_spec_string ("channel", "Channel",
           "Channel name to match inter src and sink elements",
-          "default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
+          DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
 gst_inter_sub_sink_init (GstInterSubSink * intersubsink)
 {
-  intersubsink->channel = g_strdup ("default");
+  intersubsink->channel = g_strdup (DEFAULT_CHANNEL);
 
   intersubsink->fps_n = 1;
   intersubsink->fps_d = 1;
@@ -169,7 +167,6 @@
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-
 static void
 gst_inter_sub_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
     GstClockTime * start, GstClockTime * end)
@@ -188,8 +185,6 @@
       }
     }
   }
-
-
 }
 
 static gboolean
diff --git a/gst/inter/gstintersubsrc.c b/gst/inter/gstintersubsrc.c
index 3b6cc60..24efc9f 100644
--- a/gst/inter/gstintersubsrc.c
+++ b/gst/inter/gstintersubsrc.c
@@ -48,8 +48,6 @@
 #define GST_CAT_DEFAULT gst_inter_sub_src_debug_category
 
 /* prototypes */
-
-
 static void gst_inter_sub_src_set_property (GObject * object,
     guint property_id, const GValue * value, GParamSpec * pspec);
 static void gst_inter_sub_src_get_property (GObject * object,
@@ -71,8 +69,9 @@
   PROP_CHANNEL
 };
 
-/* pad templates */
+#define DEFAULT_CHANNEL ("default")
 
+/* pad templates */
 static GstStaticPadTemplate gst_inter_sub_src_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
@@ -114,7 +113,7 @@
   g_object_class_install_property (gobject_class, PROP_CHANNEL,
       g_param_spec_string ("channel", "Channel",
           "Channel name to match inter src and sink elements",
-          "default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -123,7 +122,7 @@
   gst_base_src_set_format (GST_BASE_SRC (intersubsrc), GST_FORMAT_TIME);
   gst_base_src_set_live (GST_BASE_SRC (intersubsrc), TRUE);
 
-  intersubsrc->channel = g_strdup ("default");
+  intersubsrc->channel = g_strdup (DEFAULT_CHANNEL);
 }
 
 void
@@ -220,7 +219,6 @@
   }
 }
 
-
 static GstFlowReturn
 gst_inter_sub_src_create (GstBaseSrc * src, guint64 offset, guint size,
     GstBuffer ** buf)
diff --git a/gst/inter/gstintersurface.c b/gst/inter/gstintersurface.c
index d5b0cbd..70dc0a7 100644
--- a/gst/inter/gstintersurface.c
+++ b/gst/inter/gstintersurface.c
@@ -28,7 +28,6 @@
 static GList *list;
 static GMutex mutex;
 
-
 GstInterSurface *
 gst_inter_surface_get (const char *name)
 {
@@ -36,19 +35,23 @@
   GstInterSurface *surface;
 
   g_mutex_lock (&mutex);
-
   for (g = list; g; g = g_list_next (g)) {
-    surface = (GstInterSurface *) g->data;
+    surface = g->data;
     if (strcmp (name, surface->name) == 0) {
+      surface->ref_count++;
       g_mutex_unlock (&mutex);
       return surface;
     }
   }
 
   surface = g_malloc0 (sizeof (GstInterSurface));
+  surface->ref_count = 1;
   surface->name = g_strdup (name);
   g_mutex_init (&surface->mutex);
   surface->audio_adapter = gst_adapter_new ();
+  surface->audio_buffer_time = DEFAULT_AUDIO_BUFFER_TIME;
+  surface->audio_latency_time = DEFAULT_AUDIO_LATENCY_TIME;
+  surface->audio_period_time = DEFAULT_AUDIO_PERIOD_TIME;
 
   list = g_list_append (list, surface);
   g_mutex_unlock (&mutex);
@@ -59,5 +62,27 @@
 void
 gst_inter_surface_unref (GstInterSurface * surface)
 {
+  /* Mutex needed here, otherwise refcount might become 0
+   * and someone else requests the same surface again before
+   * we remove it from the list */
+  g_mutex_lock (&mutex);
+  if ((--surface->ref_count) == 0) {
+    GList *g;
 
+    for (g = list; g; g = g_list_next (g)) {
+      GstInterSurface *tmp = g->data;
+      if (strcmp (tmp->name, surface->name) == 0) {
+        list = g_list_delete_link (list, g);
+        break;
+      }
+    }
+
+    g_mutex_clear (&surface->mutex);
+    gst_buffer_replace (&surface->video_buffer, NULL);
+    gst_buffer_replace (&surface->sub_buffer, NULL);
+    gst_object_unref (surface->audio_adapter);
+    g_free (surface->name);
+    g_free (surface);
+  }
+  g_mutex_unlock (&mutex);
 }
diff --git a/gst/inter/gstintersurface.h b/gst/inter/gstintersurface.h
index 160f27e..13842f0 100644
--- a/gst/inter/gstintersurface.h
+++ b/gst/inter/gstintersurface.h
@@ -21,6 +21,7 @@
 #define _GST_INTER_SURFACE_H_
 
 #include <gst/base/gstadapter.h>
+#include <gst/audio/audio.h>
 #include <gst/video/video.h>
 
 G_BEGIN_DECLS
@@ -30,26 +31,29 @@
 struct _GstInterSurface
 {
   GMutex mutex;
+  gint ref_count;
+
   char *name;
 
   /* video */
-  GstVideoFormat format;
-  int fps_n;
-  int fps_d;
-  int width;
-  int height;
-  int n_frames;
+  GstVideoInfo video_info;
   int video_buffer_count;
 
   /* audio */
-  int sample_rate;
-  int n_channels;
+  GstAudioInfo audio_info;
+  guint64 audio_buffer_time;
+  guint64 audio_latency_time;
+  guint64 audio_period_time;
 
   GstBuffer *video_buffer;
   GstBuffer *sub_buffer;
   GstAdapter *audio_adapter;
 };
 
+#define DEFAULT_AUDIO_BUFFER_TIME  (GST_SECOND)
+#define DEFAULT_AUDIO_LATENCY_TIME (100 * GST_MSECOND)
+#define DEFAULT_AUDIO_PERIOD_TIME  (25 * GST_MSECOND)
+
 
 GstInterSurface * gst_inter_surface_get (const char *name);
 void gst_inter_surface_unref (GstInterSurface *surface);
diff --git a/gst/inter/gstintertest.c b/gst/inter/gstintertest.c
index 00f0bc0..ee396f6 100644
--- a/gst/inter/gstintertest.c
+++ b/gst/inter/gstintertest.c
@@ -135,6 +135,11 @@
     intertest->sink_element = NULL;
   }
 
+  if (intertest->bus) {
+    gst_object_unref (intertest->bus);
+    intertest->bus = NULL;
+  }
+
   if (intertest->pipeline) {
     gst_element_set_state (intertest->pipeline, GST_STATE_NULL);
     gst_object_unref (intertest->pipeline);
diff --git a/gst/inter/gstintervideosink.c b/gst/inter/gstintervideosink.c
index ca63bce..5891502 100644
--- a/gst/inter/gstintervideosink.c
+++ b/gst/inter/gstintervideosink.c
@@ -45,12 +45,12 @@
 #include <gst/video/video.h>
 #include "gstintervideosink.h"
 
+#include <string.h>
+
 GST_DEBUG_CATEGORY_STATIC (gst_inter_video_sink_debug_category);
 #define GST_CAT_DEFAULT gst_inter_video_sink_debug_category
 
 /* prototypes */
-
-
 static void gst_inter_video_sink_set_property (GObject * object,
     guint property_id, const GValue * value, GParamSpec * pspec);
 static void gst_inter_video_sink_get_property (GObject * object,
@@ -61,6 +61,8 @@
     GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
 static gboolean gst_inter_video_sink_start (GstBaseSink * sink);
 static gboolean gst_inter_video_sink_stop (GstBaseSink * sink);
+static gboolean gst_inter_video_sink_set_caps (GstBaseSink * sink,
+    GstCaps * caps);
 static GstFlowReturn gst_inter_video_sink_render (GstBaseSink * sink,
     GstBuffer * buffer);
 
@@ -70,18 +72,18 @@
   PROP_CHANNEL
 };
 
-/* pad templates */
+#define DEFAULT_CHANNEL ("default")
 
+/* pad templates */
 static GstStaticPadTemplate gst_inter_video_sink_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL))
     );
 
 
 /* class initialization */
-
 G_DEFINE_TYPE (GstInterVideoSink, gst_inter_video_sink, GST_TYPE_BASE_SINK);
 
 static void
@@ -111,17 +113,18 @@
   base_sink_class->start = GST_DEBUG_FUNCPTR (gst_inter_video_sink_start);
   base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_inter_video_sink_stop);
   base_sink_class->render = GST_DEBUG_FUNCPTR (gst_inter_video_sink_render);
+  base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_video_sink_set_caps);
 
   g_object_class_install_property (gobject_class, PROP_CHANNEL,
       g_param_spec_string ("channel", "Channel",
           "Channel name to match inter src and sink elements",
-          "default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
 gst_inter_video_sink_init (GstInterVideoSink * intervideosink)
 {
-  intervideosink->channel = g_strdup ("default");
+  intervideosink->channel = g_strdup (DEFAULT_CHANNEL);
 }
 
 void
@@ -180,15 +183,13 @@
     if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
       *end = *start + GST_BUFFER_DURATION (buffer);
     } else {
-      if (intervideosink->fps_n > 0) {
+      if (intervideosink->info.fps_n > 0) {
         *end = *start +
-            gst_util_uint64_scale_int (GST_SECOND, intervideosink->fps_d,
-            intervideosink->fps_n);
+            gst_util_uint64_scale_int (GST_SECOND, intervideosink->info.fps_d,
+            intervideosink->info.fps_n);
       }
     }
   }
-
-
 }
 
 static gboolean
@@ -197,6 +198,9 @@
   GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink);
 
   intervideosink->surface = gst_inter_surface_get (intervideosink->channel);
+  g_mutex_lock (&intervideosink->surface->mutex);
+  memset (&intervideosink->surface->video_info, 0, sizeof (GstVideoInfo));
+  g_mutex_unlock (&intervideosink->surface->mutex);
 
   return TRUE;
 }
@@ -211,6 +215,7 @@
     gst_buffer_unref (intervideosink->surface->video_buffer);
   }
   intervideosink->surface->video_buffer = NULL;
+  memset (&intervideosink->surface->video_info, 0, sizeof (GstVideoInfo));
   g_mutex_unlock (&intervideosink->surface->mutex);
 
   gst_inter_surface_unref (intervideosink->surface);
@@ -219,11 +224,33 @@
   return TRUE;
 }
 
+static gboolean
+gst_inter_video_sink_set_caps (GstBaseSink * sink, GstCaps * caps)
+{
+  GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink);
+  GstVideoInfo info;
+
+  if (!gst_video_info_from_caps (&info, caps)) {
+    GST_ERROR_OBJECT (sink, "Failed to parse caps %" GST_PTR_FORMAT, caps);
+    return FALSE;
+  }
+
+  g_mutex_lock (&intervideosink->surface->mutex);
+  intervideosink->surface->video_info = info;
+  intervideosink->info = info;
+  g_mutex_unlock (&intervideosink->surface->mutex);
+
+  return TRUE;
+}
+
 static GstFlowReturn
 gst_inter_video_sink_render (GstBaseSink * sink, GstBuffer * buffer)
 {
   GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink);
 
+  GST_DEBUG_OBJECT (intervideosink, "render ts %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (GST_BUFFER_PTS (buffer)));
+
   g_mutex_lock (&intervideosink->surface->mutex);
   if (intervideosink->surface->video_buffer) {
     gst_buffer_unref (intervideosink->surface->video_buffer);
diff --git a/gst/inter/gstintervideosink.h b/gst/inter/gstintervideosink.h
index f7196c5..e476daa 100644
--- a/gst/inter/gstintervideosink.h
+++ b/gst/inter/gstintervideosink.h
@@ -41,8 +41,7 @@
   GstInterSurface *surface;
   char *channel;
 
-  int fps_n;
-  int fps_d;
+  GstVideoInfo info;
 };
 
 struct _GstInterVideoSinkClass
diff --git a/gst/inter/gstintervideosrc.c b/gst/inter/gstintervideosrc.c
index b734801..6553ed1 100644
--- a/gst/inter/gstintervideosrc.c
+++ b/gst/inter/gstintervideosrc.c
@@ -48,15 +48,16 @@
 #define GST_CAT_DEFAULT gst_inter_video_src_debug_category
 
 /* prototypes */
-
-
 static void gst_inter_video_src_set_property (GObject * object,
     guint property_id, const GValue * value, GParamSpec * pspec);
 static void gst_inter_video_src_get_property (GObject * object,
     guint property_id, GValue * value, GParamSpec * pspec);
 static void gst_inter_video_src_finalize (GObject * object);
 
+static GstCaps *gst_inter_video_src_get_caps (GstBaseSrc * src,
+    GstCaps * filter);
 static gboolean gst_inter_video_src_set_caps (GstBaseSrc * src, GstCaps * caps);
+static GstCaps *gst_inter_video_src_fixate (GstBaseSrc * src, GstCaps * caps);
 static gboolean gst_inter_video_src_start (GstBaseSrc * src);
 static gboolean gst_inter_video_src_stop (GstBaseSrc * src);
 static void
@@ -65,26 +66,28 @@
 static GstFlowReturn
 gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
     GstBuffer ** buf);
-static GstCaps *gst_inter_video_src_fixate (GstBaseSrc * src, GstCaps * caps);
 
 enum
 {
   PROP_0,
-  PROP_CHANNEL
+  PROP_CHANNEL,
+  PROP_TIMEOUT
 };
 
-/* pad templates */
+#define DEFAULT_CHANNEL ("default")
+#define DEFAULT_TIMEOUT (GST_SECOND)
 
+/* pad templates */
 static GstStaticPadTemplate gst_inter_video_src_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL))
     );
 
 
 /* class initialization */
-
+#define parent_class gst_inter_video_src_parent_class
 G_DEFINE_TYPE (GstInterVideoSrc, gst_inter_video_src, GST_TYPE_BASE_SRC);
 
 static void
@@ -109,18 +112,24 @@
   gobject_class->set_property = gst_inter_video_src_set_property;
   gobject_class->get_property = gst_inter_video_src_get_property;
   gobject_class->finalize = gst_inter_video_src_finalize;
+  base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_video_src_get_caps);
   base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_video_src_set_caps);
+  base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_inter_video_src_fixate);
   base_src_class->start = GST_DEBUG_FUNCPTR (gst_inter_video_src_start);
   base_src_class->stop = GST_DEBUG_FUNCPTR (gst_inter_video_src_stop);
   base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_inter_video_src_get_times);
   base_src_class->create = GST_DEBUG_FUNCPTR (gst_inter_video_src_create);
-  base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_inter_video_src_fixate);
 
   g_object_class_install_property (gobject_class, PROP_CHANNEL,
       g_param_spec_string ("channel", "Channel",
           "Channel name to match inter src and sink elements",
-          "default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          DEFAULT_CHANNEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  g_object_class_install_property (gobject_class, PROP_TIMEOUT,
+      g_param_spec_uint64 ("timeout", "Timeout",
+          "Timeout after which to start outputting black frames",
+          0, G_MAXUINT64, DEFAULT_TIMEOUT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -129,7 +138,8 @@
   gst_base_src_set_format (GST_BASE_SRC (intervideosrc), GST_FORMAT_TIME);
   gst_base_src_set_live (GST_BASE_SRC (intervideosrc), TRUE);
 
-  intervideosrc->channel = g_strdup ("default");
+  intervideosrc->channel = g_strdup (DEFAULT_CHANNEL);
+  intervideosrc->timeout = DEFAULT_TIMEOUT;
 }
 
 void
@@ -143,6 +153,9 @@
       g_free (intervideosrc->channel);
       intervideosrc->channel = g_value_dup_string (value);
       break;
+    case PROP_TIMEOUT:
+      intervideosrc->timeout = g_value_get_uint64 (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -159,6 +172,9 @@
     case PROP_CHANNEL:
       g_value_set_string (value, intervideosrc->channel);
       break;
+    case PROP_TIMEOUT:
+      g_value_set_uint64 (value, intervideosrc->timeout);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -176,22 +192,80 @@
   G_OBJECT_CLASS (gst_inter_video_src_parent_class)->finalize (object);
 }
 
-
-
-static gboolean
-gst_inter_video_src_set_caps (GstBaseSrc * src, GstCaps * caps)
+static GstCaps *
+gst_inter_video_src_get_caps (GstBaseSrc * src, GstCaps * filter)
 {
   GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
+  GstCaps *caps;
+
+  GST_DEBUG_OBJECT (intervideosrc, "get_caps");
+
+  if (!intervideosrc->surface)
+    return GST_BASE_SRC_CLASS (parent_class)->get_caps (src, filter);
+
+  g_mutex_lock (&intervideosrc->surface->mutex);
+  if (intervideosrc->surface->video_info.finfo) {
+    caps = gst_video_info_to_caps (&intervideosrc->surface->video_info);
+    gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION_RANGE, 1,
+        G_MAXINT, G_MAXINT, 1, NULL);
+
+    if (filter) {
+      GstCaps *tmp;
+
+      tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+      gst_caps_unref (caps);
+      caps = tmp;
+    }
+  } else {
+    caps = NULL;
+  }
+  g_mutex_unlock (&intervideosrc->surface->mutex);
+
+  if (caps)
+    return caps;
+  else
+    return GST_BASE_SRC_CLASS (parent_class)->get_caps (src, filter);
+}
+
+static gboolean
+gst_inter_video_src_set_caps (GstBaseSrc * base, GstCaps * caps)
+{
+  GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (base);
+  GstVideoConverter *converter;
+  GstVideoFrame src_frame, dest_frame;
+  GstBuffer *src, *dest;
+  GstVideoInfo black_info;
 
   GST_DEBUG_OBJECT (intervideosrc, "set_caps");
 
-  if (!gst_video_info_from_caps (&intervideosrc->info, caps))
+  if (!gst_video_info_from_caps (&intervideosrc->info, caps)) {
+    GST_ERROR_OBJECT (intervideosrc, "Failed to parse caps %" GST_PTR_FORMAT,
+        caps);
     return FALSE;
+  }
 
-  return gst_pad_set_caps (src->srcpad, caps);
+  /* Create a black frame */
+  gst_buffer_replace (&intervideosrc->black_frame, NULL);
+  gst_video_info_set_format (&black_info, GST_VIDEO_FORMAT_ARGB,
+      intervideosrc->info.width, intervideosrc->info.height);
+  black_info.fps_n = intervideosrc->info.fps_n;
+  black_info.fps_d = intervideosrc->info.fps_d;
+  src = gst_buffer_new_and_alloc (black_info.size);
+  dest = gst_buffer_new_and_alloc (intervideosrc->info.size);
+  gst_buffer_memset (src, 0, 0, black_info.size);
+  gst_video_frame_map (&src_frame, &black_info, src, GST_MAP_READ);
+  gst_video_frame_map (&dest_frame, &intervideosrc->info, dest, GST_MAP_WRITE);
+  converter = gst_video_converter_new (&black_info, &intervideosrc->info, NULL);
+  gst_video_converter_frame (converter, &src_frame, &dest_frame);
+  gst_video_converter_free (converter);
+  gst_video_frame_unmap (&src_frame);
+  gst_video_frame_unmap (&dest_frame);
+  gst_buffer_unref (src);
+  intervideosrc->black_frame = dest;
+
+  return TRUE;
 }
 
-
 static gboolean
 gst_inter_video_src_start (GstBaseSrc * src)
 {
@@ -200,6 +274,8 @@
   GST_DEBUG_OBJECT (intervideosrc, "start");
 
   intervideosrc->surface = gst_inter_surface_get (intervideosrc->channel);
+  intervideosrc->timestamp_offset = 0;
+  intervideosrc->n_frames = 0;
 
   return TRUE;
 }
@@ -213,6 +289,7 @@
 
   gst_inter_surface_unref (intervideosrc->surface);
   intervideosrc->surface = NULL;
+  gst_buffer_replace (&intervideosrc->black_frame, NULL);
 
   return TRUE;
 }
@@ -242,57 +319,147 @@
   }
 }
 
-
 static GstFlowReturn
 gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
     GstBuffer ** buf)
 {
   GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
+  GstCaps *caps;
   GstBuffer *buffer;
+  guint64 frames;
+  gboolean is_gap = FALSE;
 
   GST_DEBUG_OBJECT (intervideosrc, "create");
 
+  caps = NULL;
   buffer = NULL;
 
+  frames = gst_util_uint64_scale_ceil (intervideosrc->timeout,
+      GST_VIDEO_INFO_FPS_N (&intervideosrc->info),
+      GST_VIDEO_INFO_FPS_D (&intervideosrc->info) * GST_SECOND);
+
   g_mutex_lock (&intervideosrc->surface->mutex);
+  if (intervideosrc->surface->video_info.finfo) {
+    GstVideoInfo tmp_info = intervideosrc->surface->video_info;
+
+    /* We negotiate the framerate ourselves */
+    tmp_info.fps_n = intervideosrc->info.fps_n;
+    tmp_info.fps_d = intervideosrc->info.fps_d;
+    if (intervideosrc->info.flags & GST_VIDEO_FLAG_VARIABLE_FPS)
+      tmp_info.flags |= GST_VIDEO_FLAG_VARIABLE_FPS;
+    else
+      tmp_info.flags &= ~GST_VIDEO_FLAG_VARIABLE_FPS;
+
+    if (!gst_video_info_is_equal (&tmp_info, &intervideosrc->info)) {
+      caps = gst_video_info_to_caps (&tmp_info);
+      intervideosrc->timestamp_offset +=
+          gst_util_uint64_scale (GST_SECOND * intervideosrc->n_frames,
+          GST_VIDEO_INFO_FPS_D (&intervideosrc->info),
+          GST_VIDEO_INFO_FPS_N (&intervideosrc->info));
+      intervideosrc->n_frames = 0;
+    }
+  }
+
   if (intervideosrc->surface->video_buffer) {
+    /* We have a buffer to push */
     buffer = gst_buffer_ref (intervideosrc->surface->video_buffer);
-    intervideosrc->surface->video_buffer_count++;
-    if (intervideosrc->surface->video_buffer_count >= 30) {
+
+    /* Can only be true if timeout > 0 */
+    if (intervideosrc->surface->video_buffer_count == frames) {
       gst_buffer_unref (intervideosrc->surface->video_buffer);
       intervideosrc->surface->video_buffer = NULL;
     }
   }
+
+  if (intervideosrc->surface->video_buffer_count != 0 &&
+      intervideosrc->surface->video_buffer_count != (frames + 1)) {
+    /* This is a repeat of the stored buffer or of a black frame */
+    is_gap = TRUE;
+  }
+
+  intervideosrc->surface->video_buffer_count++;
   g_mutex_unlock (&intervideosrc->surface->mutex);
 
+  if (caps) {
+    gboolean ret;
+    GstStructure *s;
+    GstCaps *downstream_caps;
+    GstCaps *tmp, *negotiated_caps;
+    gint fps_n = 0, fps_d = 1;
+
+    /* Negotiate a framerate with downstream */
+    downstream_caps = gst_pad_get_allowed_caps (GST_BASE_SRC_PAD (src));
+
+    /* Remove all framerates */
+    tmp = gst_caps_copy (caps);
+    s = gst_caps_get_structure (tmp, 0);
+    gst_structure_get_fraction (s, "framerate", &fps_n, &fps_d);
+    if (fps_n == 0)
+      gst_structure_get_fraction (s, "max-framerate", &fps_n, &fps_d);
+    gst_structure_remove_field (s, "framerate");
+    gst_structure_remove_field (s, "max-framerate");
+
+    negotiated_caps =
+        gst_caps_intersect_full (downstream_caps, tmp,
+        GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp);
+    gst_caps_unref (downstream_caps);
+
+    if (gst_caps_is_empty (negotiated_caps)) {
+      GST_ERROR_OBJECT (src, "Failed to negotiate caps %" GST_PTR_FORMAT, caps);
+      if (buffer)
+        gst_buffer_unref (buffer);
+      gst_caps_unref (caps);
+      return GST_FLOW_NOT_NEGOTIATED;
+    }
+    gst_caps_unref (caps);
+    caps = NULL;
+
+    /* Prefer what the source produces, otherwise 30 fps */
+    if (fps_n == 0) {
+      fps_n = 30;
+      fps_d = 1;
+    }
+
+    negotiated_caps = gst_caps_truncate (negotiated_caps);
+    s = gst_caps_get_structure (negotiated_caps, 0);
+    if (!gst_structure_has_field (s, "framerate"))
+      gst_structure_set (s, "framerate", GST_TYPE_FRACTION, fps_n, fps_d, NULL);
+    else
+      gst_structure_fixate_field_nearest_fraction (s, "framerate", fps_n,
+          fps_d);
+
+    ret = gst_base_src_set_caps (src, negotiated_caps);
+    if (!ret) {
+      GST_ERROR_OBJECT (src, "Failed to set caps %" GST_PTR_FORMAT,
+          negotiated_caps);
+      if (buffer)
+        gst_buffer_unref (buffer);
+      gst_caps_unref (negotiated_caps);
+      return GST_FLOW_NOT_NEGOTIATED;
+    }
+    gst_caps_unref (negotiated_caps);
+  }
+
   if (buffer == NULL) {
-    GstMapInfo map;
-
-    buffer =
-        gst_buffer_new_and_alloc (GST_VIDEO_INFO_SIZE (&intervideosrc->info));
-
-    gst_buffer_map (buffer, &map, GST_MAP_WRITE);
-    memset (map.data, 16, GST_VIDEO_INFO_COMP_STRIDE (&intervideosrc->info, 0) *
-        GST_VIDEO_INFO_COMP_HEIGHT (&intervideosrc->info, 0));
-
-    memset (map.data + GST_VIDEO_INFO_COMP_OFFSET (&intervideosrc->info, 1),
-        128,
-        2 * GST_VIDEO_INFO_COMP_STRIDE (&intervideosrc->info, 1) *
-        GST_VIDEO_INFO_COMP_HEIGHT (&intervideosrc->info, 1));
-    gst_buffer_unmap (buffer, &map);
+    GST_DEBUG_OBJECT (intervideosrc, "Creating black frame");
+    buffer = gst_buffer_copy (intervideosrc->black_frame);
   }
 
   buffer = gst_buffer_make_writable (buffer);
 
-  GST_BUFFER_PTS (buffer) =
-      gst_util_uint64_scale_int (GST_SECOND * intervideosrc->n_frames,
+  if (is_gap)
+    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_GAP);
+
+  GST_BUFFER_PTS (buffer) = intervideosrc->timestamp_offset +
+      gst_util_uint64_scale (GST_SECOND * intervideosrc->n_frames,
       GST_VIDEO_INFO_FPS_D (&intervideosrc->info),
       GST_VIDEO_INFO_FPS_N (&intervideosrc->info));
   GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
   GST_DEBUG_OBJECT (intervideosrc, "create ts %" GST_TIME_FORMAT,
       GST_TIME_ARGS (GST_BUFFER_PTS (buffer)));
-  GST_BUFFER_DURATION (buffer) =
-      gst_util_uint64_scale_int (GST_SECOND * (intervideosrc->n_frames + 1),
+  GST_BUFFER_DURATION (buffer) = intervideosrc->timestamp_offset +
+      gst_util_uint64_scale (GST_SECOND * (intervideosrc->n_frames + 1),
       GST_VIDEO_INFO_FPS_D (&intervideosrc->info),
       GST_VIDEO_INFO_FPS_N (&intervideosrc->info)) - GST_BUFFER_PTS (buffer);
   GST_BUFFER_OFFSET (buffer) = intervideosrc->n_frames;
@@ -316,9 +483,10 @@
   GST_DEBUG_OBJECT (src, "fixate");
 
   caps = gst_caps_make_writable (caps);
-
+  caps = gst_caps_truncate (caps);
   structure = gst_caps_get_structure (caps, 0);
 
+  gst_structure_fixate_field_string (structure, "format", "I420");
   gst_structure_fixate_field_nearest_int (structure, "width", 320);
   gst_structure_fixate_field_nearest_int (structure, "height", 240);
   gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
diff --git a/gst/inter/gstintervideosrc.h b/gst/inter/gstintervideosrc.h
index a68af76..0de36f4 100644
--- a/gst/inter/gstintervideosrc.h
+++ b/gst/inter/gstintervideosrc.h
@@ -42,9 +42,12 @@
   GstInterSurface *surface;
 
   char *channel;
+  guint64 timeout;
 
   GstVideoInfo info;
+  GstBuffer *black_frame;
   int n_frames;
+  GstClockTime timestamp_offset;
 };
 
 struct _GstInterVideoSrcClass
diff --git a/gst/interlace/Makefile.in b/gst/interlace/Makefile.in
index 39862f6..1a86cc7 100644
--- a/gst/interlace/Makefile.in
+++ b/gst/interlace/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -242,8 +242,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -282,7 +286,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -290,6 +293,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -339,8 +344,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -419,7 +422,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -428,7 +430,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -441,7 +442,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -466,6 +466,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -539,10 +541,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -568,6 +574,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -604,6 +613,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -644,17 +654,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -671,6 +680,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/ivfparse/Makefile.in b/gst/ivfparse/Makefile.in
index e7b1c0e..19cd46f 100644
--- a/gst/ivfparse/Makefile.in
+++ b/gst/ivfparse/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/ivtc/Makefile.in b/gst/ivtc/Makefile.in
index fe836d8..fdfaacb 100644
--- a/gst/ivtc/Makefile.in
+++ b/gst/ivtc/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -243,8 +243,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -283,7 +287,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -291,6 +294,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -340,8 +345,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -420,7 +423,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -429,7 +431,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -442,7 +443,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -467,6 +467,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -540,10 +542,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -569,6 +575,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -605,6 +614,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -645,17 +655,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -672,6 +681,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/jp2kdecimator/Makefile.in b/gst/jp2kdecimator/Makefile.in
index 83c7cc3..f9d2b74 100644
--- a/gst/jp2kdecimator/Makefile.in
+++ b/gst/jp2kdecimator/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/jp2kdecimator/jp2kcodestream.c b/gst/jp2kdecimator/jp2kcodestream.c
index 943d837..af2c047 100644
--- a/gst/jp2kdecimator/jp2kcodestream.c
+++ b/gst/jp2kdecimator/jp2kcodestream.c
@@ -1152,22 +1152,18 @@
         GST_ERROR_OBJECT (self, "COC marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_POC:
         GST_ERROR_OBJECT (self, "POC marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_RGN:
         GST_ERROR_OBJECT (self, "RGN marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_PPT:
         GST_ERROR_OBJECT (self, "PPT marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_PLT:{
         PacketLengthTilePart *plt = g_slice_new (PacketLengthTilePart);
 
@@ -1521,32 +1517,26 @@
         GST_ERROR_OBJECT (self, "POC marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_COC:
         GST_ERROR_OBJECT (self, "COC marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_RGN:
         GST_ERROR_OBJECT (self, "RGN marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_TLM:
         GST_ERROR_OBJECT (self, "TLM marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_PLM:
         GST_ERROR_OBJECT (self, "PLM marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_PPM:
         GST_ERROR_OBJECT (self, "PPM marker not supported yet");
         ret = GST_FLOW_ERROR;
         goto done;
-        break;
       case MARKER_QCD:
         if (header->qcd.data != NULL) {
           GST_ERROR_OBJECT (self, "Multiple QCD markers");
diff --git a/gst/jpegformat/Makefile.in b/gst/jpegformat/Makefile.in
index e90bba0..e7b4065 100644
--- a/gst/jpegformat/Makefile.in
+++ b/gst/jpegformat/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/jpegformat/gstjifmux.c b/gst/jpegformat/gstjifmux.c
index 28638b7..719067a 100644
--- a/gst/jpegformat/gstjifmux.c
+++ b/gst/jpegformat/gstjifmux.c
@@ -312,7 +312,6 @@
         m = gst_jif_mux_new_marker (marker, 0, NULL, FALSE);
         self->priv->markers = g_list_prepend (self->priv->markers, m);
         goto done;
-        break;
       default:
         if (!gst_byte_reader_get_uint16_be (&reader, &size))
           goto error;
diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c
index a05f9b1..d55b84f 100644
--- a/gst/jpegformat/gstjpegparse.c
+++ b/gst/jpegformat/gstjpegparse.c
@@ -62,7 +62,6 @@
         "format = (string) { I420, Y41B, UYVY, YV12 }, "
         "width = (int) [ 0, MAX ],"
         "height = (int) [ 0, MAX ], "
-        "interlaced = (boolean) { true, false }, "
         "framerate = (fraction) [ 0/1, MAX ], " "parsed = (boolean) true")
     );
 
@@ -78,9 +77,6 @@
 
 struct _GstJpegParsePrivate
 {
-  GstPad *srcpad;
-
-  GstAdapter *adapter;
   guint last_offset;
   guint last_entropy_len;
   gboolean last_resync;
@@ -90,16 +86,9 @@
   gint caps_framerate_numerator;
   gint caps_framerate_denominator;
 
-  /* a new segment arrived */
-  gboolean new_segment;
-  GstSegment segment;
-
   /* the parsed frame size */
   guint16 width, height;
 
-  /* TRUE if the image is interlaced */
-  gboolean interlaced;
-
   /* format color space */
   const gchar *format;
 
@@ -120,34 +109,40 @@
   GstTagList *tags;
 };
 
-static void gst_jpeg_parse_dispose (GObject * object);
-
-static GstFlowReturn gst_jpeg_parse_chain (GstPad * pad, GstObject * parent,
-    GstBuffer * buffer);
-static gboolean gst_jpeg_parse_sink_setcaps (GstJpegParse * parse,
+static GstFlowReturn
+gst_jpeg_parse_handle_frame (GstBaseParse * bparse, GstBaseParseFrame * frame,
+    gint * skipsize);
+static gboolean gst_jpeg_parse_set_sink_caps (GstBaseParse * parse,
     GstCaps * caps);
-static gboolean gst_jpeg_parse_sink_event (GstPad * pad, GstObject * parent,
+static gboolean gst_jpeg_parse_sink_event (GstBaseParse * parse,
     GstEvent * event);
-static GstStateChangeReturn gst_jpeg_parse_change_state (GstElement * element,
-    GstStateChange transition);
+static gboolean gst_jpeg_parse_start (GstBaseParse * parse);
+static gboolean gst_jpeg_parse_stop (GstBaseParse * parse);
+static GstFlowReturn gst_jpeg_parse_pre_push_frame (GstBaseParse * bparse,
+    GstBaseParseFrame * frame);
 
 #define gst_jpeg_parse_parent_class parent_class
-G_DEFINE_TYPE (GstJpegParse, gst_jpeg_parse, GST_TYPE_ELEMENT);
+G_DEFINE_TYPE (GstJpegParse, gst_jpeg_parse, GST_TYPE_BASE_PARSE);
 
 static void
 gst_jpeg_parse_class_init (GstJpegParseClass * klass)
 {
+  GstBaseParseClass *gstbaseparse_class;
   GstElementClass *gstelement_class;
   GObjectClass *gobject_class;
 
+  gstbaseparse_class = (GstBaseParseClass *) klass;
   gstelement_class = (GstElementClass *) klass;
   gobject_class = (GObjectClass *) klass;
 
   g_type_class_add_private (gobject_class, sizeof (GstJpegParsePrivate));
-  gobject_class->dispose = gst_jpeg_parse_dispose;
 
-  gstelement_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_jpeg_parse_change_state);
+  gstbaseparse_class->start = gst_jpeg_parse_start;
+  gstbaseparse_class->stop = gst_jpeg_parse_stop;
+  gstbaseparse_class->set_sink_caps = gst_jpeg_parse_set_sink_caps;
+  gstbaseparse_class->sink_event = gst_jpeg_parse_sink_event;
+  gstbaseparse_class->handle_frame = gst_jpeg_parse_handle_frame;
+  gstbaseparse_class->pre_push_frame = gst_jpeg_parse_pre_push_frame;
 
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&gst_jpeg_parse_src_pad_template));
@@ -166,48 +161,16 @@
 static void
 gst_jpeg_parse_init (GstJpegParse * parse)
 {
-  GstPad *sinkpad;
-
   parse->priv = G_TYPE_INSTANCE_GET_PRIVATE (parse, GST_TYPE_JPEG_PARSE,
       GstJpegParsePrivate);
 
-  /* create the sink and src pads */
-  sinkpad = gst_pad_new_from_static_template (&gst_jpeg_parse_sink_pad_template,
-      "sink");
-  gst_pad_set_chain_function (sinkpad,
-      GST_DEBUG_FUNCPTR (gst_jpeg_parse_chain));
-  gst_pad_set_event_function (sinkpad,
-      GST_DEBUG_FUNCPTR (gst_jpeg_parse_sink_event));
-  gst_element_add_pad (GST_ELEMENT (parse), sinkpad);
-
-  parse->priv->srcpad =
-      gst_pad_new_from_static_template (&gst_jpeg_parse_src_pad_template,
-      "src");
-  gst_pad_use_fixed_caps (parse->priv->srcpad);
-  gst_element_add_pad (GST_ELEMENT (parse), parse->priv->srcpad);
-
   parse->priv->next_ts = GST_CLOCK_TIME_NONE;
-  parse->priv->adapter = gst_adapter_new ();
 }
 
-static void
-gst_jpeg_parse_dispose (GObject * object)
-{
-  GstJpegParse *parse = GST_JPEG_PARSE (object);
-
-  if (parse->priv->adapter != NULL) {
-    gst_adapter_clear (parse->priv->adapter);
-    gst_object_unref (parse->priv->adapter);
-    parse->priv->adapter = NULL;
-  }
-
-  G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-
 static gboolean
-gst_jpeg_parse_sink_setcaps (GstJpegParse * parse, GstCaps * caps)
+gst_jpeg_parse_set_sink_caps (GstBaseParse * bparse, GstCaps * caps)
 {
+  GstJpegParse *parse = GST_JPEG_PARSE_CAST (bparse);
   GstStructure *s = gst_caps_get_structure (caps, 0);
   const GValue *framerate;
 
@@ -238,25 +201,23 @@
  * Returns: TRUE if the header was found, FALSE if more data is needed.
  */
 static gboolean
-gst_jpeg_parse_skip_to_jpeg_header (GstJpegParse * parse)
+gst_jpeg_parse_skip_to_jpeg_header (GstJpegParse * parse, GstMapInfo * mapinfo,
+    gint * skipsize)
 {
-  guint available, flush;
   gboolean ret = TRUE;
+  GstByteReader reader;
 
-  available = gst_adapter_available (parse->priv->adapter);
-  if (available < 4)
+  if (mapinfo->size < 4)
     return FALSE;
 
-  flush = gst_adapter_masked_scan_uint32 (parse->priv->adapter, 0xffffff00,
-      0xffd8ff00, 0, available);
-  if (flush == -1) {
-    flush = available - 3;      /* Last 3 bytes + 1 more may match header. */
+  gst_byte_reader_init (&reader, mapinfo->data, mapinfo->size);
+
+  *skipsize = gst_byte_reader_masked_scan_uint32 (&reader, 0xffffff00,
+      0xffd8ff00, 0, mapinfo->size);
+  if (*skipsize == -1) {
+    *skipsize = mapinfo->size - 3;      /* Last 3 bytes + 1 more may match header. */
     ret = FALSE;
   }
-  if (flush > 0) {
-    GST_LOG_OBJECT (parse, "Skipping %u bytes.", flush);
-    gst_adapter_flush (parse->priv->adapter, flush);
-  }
   return ret;
 }
 
@@ -272,17 +233,21 @@
  * otherwise 0 if more data needed,
  * if < 0 the absolute value needs to be flushed */
 static gint
-gst_jpeg_parse_get_image_length (GstJpegParse * parse)
+gst_jpeg_parse_get_image_length (GstJpegParse * parse, GstMapInfo * mapinfo)
 {
   guint size;
   gboolean resync;
-  GstAdapter *adapter = parse->priv->adapter;
   gint offset, noffset;
+  GstByteReader reader;
 
-  size = gst_adapter_available (adapter);
+  size = mapinfo->size;
+  gst_byte_reader_init (&reader, mapinfo->data, mapinfo->size);
 
+  /* TODO could be removed as previous functions already guarantee this to be
+   * true */
   /* we expect at least 4 bytes, first of which start marker */
-  if (gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0xffd80000, 0, 4))
+  if (gst_byte_reader_masked_scan_uint32 (&reader, 0xffff0000, 0xffd80000, 0,
+          4))
     return 0;
 
   GST_DEBUG ("Parsing jpeg image data (%u bytes)", size);
@@ -303,8 +268,8 @@
     guint32 value;
 
     noffset =
-        gst_adapter_masked_scan_uint32_peek (adapter, 0x0000ff00, 0x0000ff00,
-        offset, size - offset, &value);
+        gst_byte_reader_masked_scan_uint32_peek (&reader, 0x0000ff00,
+        0x0000ff00, offset, size - offset, &value);
     /* lost sync if 0xff marker not where expected */
     if ((resync = (noffset != offset))) {
       GST_DEBUG ("Lost sync at 0x%08x, resyncing", offset + 2);
@@ -315,8 +280,8 @@
     while ((noffset >= 0) && ((value & 0xff) == 0xff)) {
       noffset++;
       noffset =
-          gst_adapter_masked_scan_uint32_peek (adapter, 0x0000ff00, 0x0000ff00,
-          noffset, size - noffset, &value);
+          gst_byte_reader_masked_scan_uint32_peek (&reader, 0x0000ff00,
+          0x0000ff00, noffset, size - noffset, &value);
     }
     /* enough bytes left for marker? (we need 0xNN after the 0xff) */
     if (noffset < 0) {
@@ -349,8 +314,8 @@
       if (offset + 2 + 4 > size)
         goto need_more_data;
       else
-        gst_adapter_masked_scan_uint32_peek (adapter, 0x0, 0x0, offset + 2, 4,
-            &frame_len);
+        gst_byte_reader_masked_scan_uint32_peek (&reader, 0x0, 0x0, offset + 2,
+            4, &frame_len);
       frame_len = frame_len & 0xffff;
     }
     GST_DEBUG ("0x%08x: tag %02x, frame_len=%u", offset + 2, value, frame_len);
@@ -366,7 +331,7 @@
       GST_DEBUG ("0x%08x: finding entropy segment length", offset + 2);
       noffset = offset + 2 + frame_len + eseglen;
       while (1) {
-        noffset = gst_adapter_masked_scan_uint32_peek (adapter, 0x0000ff00,
+        noffset = gst_byte_reader_masked_scan_uint32_peek (&reader, 0x0000ff00,
             0x0000ff00, noffset, size - noffset, &value);
         if (noffset < 0) {
           /* need more data */
@@ -388,7 +353,8 @@
       /* check if we will still be in sync if we interpret
        * this as a sync point and skip this frame */
       noffset = offset + frame_len + 2;
-      noffset = gst_adapter_masked_scan_uint32 (adapter, 0x0000ff00, 0x0000ff00,
+      noffset =
+          gst_byte_reader_masked_scan_uint32 (&reader, 0x0000ff00, 0x0000ff00,
           noffset, 4);
       if (noffset < 0) {
         /* ignore and continue resyncing until we hit the end
@@ -491,32 +457,6 @@
 }
 
 static inline gboolean
-gst_jpeg_parse_remove_marker (GstJpegParse * parse,
-    GstByteReader * reader, guint8 marker, GstBuffer * buffer)
-{
-  guint16 size = 0;
-  guint pos = gst_byte_reader_get_pos (reader);
-  GstMapInfo map;
-
-  if (!gst_byte_reader_peek_uint16_be (reader, &size))
-    return FALSE;
-  if (gst_byte_reader_get_remaining (reader) < size)
-    return FALSE;
-
-  GST_LOG_OBJECT (parse, "unhandled marker %x removing %u bytes", marker, size);
-
-  gst_buffer_map (buffer, &map, GST_MAP_READWRITE);
-  memmove (&map.data[pos], &map.data[pos + size], map.size - (pos + size));
-  gst_buffer_unmap (buffer, &map);
-
-
-  if (!gst_byte_reader_set_pos (reader, pos - size))
-    return FALSE;
-
-  return TRUE;
-}
-
-static inline gboolean
 gst_jpeg_parse_skip_marker (GstJpegParse * parse,
     GstByteReader * reader, guint8 marker)
 {
@@ -679,15 +619,13 @@
 }
 
 static gboolean
-gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer)
+gst_jpeg_parse_read_header (GstJpegParse * parse, GstMapInfo * map, gint len)
 {
   GstByteReader reader;
   guint8 marker = 0;
   gboolean foundSOF = FALSE;
-  GstMapInfo map;
 
-  gst_buffer_map (buffer, &map, GST_MAP_READ);
-  gst_byte_reader_init (&reader, map.data, map.size);
+  gst_byte_reader_init (&reader, map->data, len);
 
   if (!gst_byte_reader_peek_uint8 (&reader, &marker))
     goto error;
@@ -730,9 +668,6 @@
           goto error;
         break;
 
-      case SOF2:
-        parse->priv->interlaced = TRUE;
-        /* fall through */
       case SOF0:
         /* parse Start Of Frame */
         if (!gst_jpeg_parse_sof (parse, &reader))
@@ -742,11 +677,8 @@
         goto done;
 
       default:
-        if (marker == JPG || (marker >= JPG0 && marker <= JPG13)) {
-          /* we'd like to remove them from the buffer */
-          if (!gst_jpeg_parse_remove_marker (parse, &reader, marker, buffer))
-            goto error;
-        } else if (marker >= APP0 && marker <= APP15) {
+        if (marker == JPG || (marker >= JPG0 && marker <= JPG13) ||
+            (marker >= APP0 && marker <= APP15)) {
           if (!gst_jpeg_parse_skip_marker (parse, &reader, marker))
             goto error;
         } else
@@ -757,7 +689,6 @@
       goto error;
   }
 done:
-  gst_buffer_unmap (buffer, &map);
 
   return foundSOF;
 
@@ -767,7 +698,6 @@
     GST_WARNING_OBJECT (parse,
         "Error parsing image header (need more than %u bytes available)",
         gst_byte_reader_get_remaining (&reader));
-    gst_buffer_unmap (buffer, &map);
     return FALSE;
   }
 unhandled:
@@ -775,7 +705,6 @@
     GST_WARNING_OBJECT (parse, "unhandled marker %x, leaving", marker);
     /* Not SOF or SOI.  Must not be a JPEG file (or file pointer
      * is placed wrong).  In either case, it's an error. */
-    gst_buffer_unmap (buffer, &map);
     return FALSE;
   }
 }
@@ -795,7 +724,6 @@
   if (header_ok == TRUE) {
     gst_caps_set_simple (caps,
         "format", G_TYPE_STRING, parse->priv->format,
-        "interlaced", G_TYPE_BOOLEAN, parse->priv->interlaced,
         "width", G_TYPE_INT, parse->priv->width,
         "height", G_TYPE_INT, parse->priv->height, NULL);
   }
@@ -819,8 +747,8 @@
 
   GST_DEBUG_OBJECT (parse,
       "setting downstream caps on %s:%s to %" GST_PTR_FORMAT,
-      GST_DEBUG_PAD_NAME (parse->priv->srcpad), caps);
-  res = gst_pad_set_caps (parse->priv->srcpad, caps);
+      GST_DEBUG_PAD_NAME (GST_BASE_PARSE_SRC_PAD (parse)), caps);
+  res = gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps);
   gst_caps_unref (caps);
 
   return res;
@@ -828,56 +756,10 @@
 }
 
 static GstFlowReturn
-gst_jpeg_parse_push_buffer (GstJpegParse * parse, guint len)
+gst_jpeg_parse_pre_push_frame (GstBaseParse * bparse, GstBaseParseFrame * frame)
 {
-  GstBuffer *outbuf;
-  GstFlowReturn ret = GST_FLOW_OK;
-  gboolean header_ok;
-
-  /* reset the offset (only when we flushed) */
-  parse->priv->last_offset = 0;
-  parse->priv->last_entropy_len = 0;
-
-  outbuf = gst_adapter_take_buffer (parse->priv->adapter, len);
-  if (outbuf == NULL) {
-    GST_ELEMENT_ERROR (parse, STREAM, DECODE,
-        ("Failed to take buffer of size %u", len),
-        ("Failed to take buffer of size %u", len));
-    return GST_FLOW_ERROR;
-  }
-
-  header_ok = gst_jpeg_parse_read_header (parse, outbuf);
-
-  if (parse->priv->new_segment == TRUE
-      || parse->priv->width != parse->priv->caps_width
-      || parse->priv->height != parse->priv->caps_height
-      || parse->priv->framerate_numerator !=
-      parse->priv->caps_framerate_numerator
-      || parse->priv->framerate_denominator !=
-      parse->priv->caps_framerate_denominator) {
-    if (!gst_jpeg_parse_set_new_caps (parse, header_ok)) {
-      GST_ELEMENT_ERROR (parse, CORE, NEGOTIATION,
-          ("Can't set caps to the src pad"), ("Can't set caps to the src pad"));
-      return GST_FLOW_ERROR;
-    }
-    gst_pad_push_event (parse->priv->srcpad,
-        gst_event_new_segment (&parse->priv->segment));
-
-    if (parse->priv->tags) {
-      GST_DEBUG_OBJECT (parse, "Pushing tags: %" GST_PTR_FORMAT,
-          parse->priv->tags);
-      gst_pad_push_event (parse->priv->srcpad,
-          gst_event_new_tag (parse->priv->tags));
-      parse->priv->tags = NULL;
-    }
-
-    parse->priv->new_segment = FALSE;
-    parse->priv->caps_width = parse->priv->width;
-    parse->priv->caps_height = parse->priv->height;
-    parse->priv->caps_framerate_numerator = parse->priv->framerate_numerator;
-    parse->priv->caps_framerate_denominator =
-        parse->priv->framerate_denominator;
-  }
+  GstJpegParse *parse = GST_JPEG_PARSE_CAST (bparse);
+  GstBuffer *outbuf = frame->buffer;
 
   GST_BUFFER_TIMESTAMP (outbuf) = parse->priv->next_ts;
 
@@ -891,98 +773,108 @@
 
   GST_BUFFER_DURATION (outbuf) = parse->priv->duration;
 
-  GST_LOG_OBJECT (parse, "pushing buffer (ts=%" GST_TIME_FORMAT ", len=%u)",
-      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)), len);
-
-  ret = gst_pad_push (parse->priv->srcpad, outbuf);
-
-  return ret;
+  return GST_FLOW_OK;
 }
 
 static GstFlowReturn
-gst_jpeg_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
+gst_jpeg_parse_handle_frame (GstBaseParse * bparse, GstBaseParseFrame * frame,
+    gint * skipsize)
 {
-  GstJpegParse *parse = GST_JPEG_PARSE (parent);
+  GstJpegParse *parse = GST_JPEG_PARSE_CAST (bparse);
   gint len;
   GstClockTime timestamp, duration;
-  GstFlowReturn ret = GST_FLOW_OK;
+  GstMapInfo mapinfo;
+  gboolean header_ok;
 
-  timestamp = GST_BUFFER_PTS (buf);
-  duration = GST_BUFFER_DURATION (buf);
+  timestamp = GST_BUFFER_PTS (frame->buffer);
+  duration = GST_BUFFER_DURATION (frame->buffer);
 
-  gst_adapter_push (parse->priv->adapter, buf);
-
-  while (ret == GST_FLOW_OK && gst_jpeg_parse_skip_to_jpeg_header (parse)) {
-    if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (parse->priv->next_ts)))
-      parse->priv->next_ts = timestamp;
-
-    if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (duration)))
-      parse->priv->duration = duration;
-
-    /* check if we already have a EOI */
-    len = gst_jpeg_parse_get_image_length (parse);
-    if (len == 0) {
-      return GST_FLOW_OK;
-    } else if (len < 0) {
-      gst_adapter_flush (parse->priv->adapter, -len);
-      continue;
-    }
-
-    GST_LOG_OBJECT (parse, "parsed image of size %d", len);
-
-    /* now we have enough in the adapter to process a full jpeg image */
-    ret = gst_jpeg_parse_push_buffer (parse, len);
+  if (!gst_buffer_map (frame->buffer, &mapinfo, GST_MAP_READ)) {
+    return GST_FLOW_ERROR;
   }
 
-  GST_DEBUG_OBJECT (parse, "No further start marker found.");
-  return ret;
+  if (!gst_jpeg_parse_skip_to_jpeg_header (parse, &mapinfo, skipsize)) {
+    gst_buffer_unmap (frame->buffer, &mapinfo);
+    return GST_FLOW_OK;
+  }
+
+  if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (parse->priv->next_ts)))
+    parse->priv->next_ts = timestamp;
+
+  if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (duration)))
+    parse->priv->duration = duration;
+
+  len = gst_jpeg_parse_get_image_length (parse, &mapinfo);
+  if (len == 0) {
+    gst_buffer_unmap (frame->buffer, &mapinfo);
+    return GST_FLOW_OK;
+  } else if (len < 0) {
+    *skipsize = -len;
+    gst_buffer_unmap (frame->buffer, &mapinfo);
+    return GST_FLOW_OK;
+  }
+
+  /* check if we already have a EOI */
+  GST_LOG_OBJECT (parse, "parsed image of size %d", len);
+
+  /* reset the offset (only when we flushed) */
+  parse->priv->last_offset = 0;
+  parse->priv->last_entropy_len = 0;
+
+  header_ok = gst_jpeg_parse_read_header (parse, &mapinfo, len);
+
+  gst_buffer_unmap (frame->buffer, &mapinfo);
+
+  if (parse->priv->width != parse->priv->caps_width
+      || parse->priv->height != parse->priv->caps_height
+      || parse->priv->framerate_numerator !=
+      parse->priv->caps_framerate_numerator
+      || parse->priv->framerate_denominator !=
+      parse->priv->caps_framerate_denominator) {
+    if (!gst_jpeg_parse_set_new_caps (parse, header_ok)) {
+      GST_ELEMENT_ERROR (parse, CORE, NEGOTIATION,
+          ("Can't set caps to the src pad"), ("Can't set caps to the src pad"));
+      return GST_FLOW_ERROR;
+    }
+
+    if (parse->priv->tags) {
+      GST_DEBUG_OBJECT (parse, "Pushing tags: %" GST_PTR_FORMAT,
+          parse->priv->tags);
+      gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (parse),
+          gst_event_new_tag (parse->priv->tags));
+      parse->priv->tags = NULL;
+    }
+
+    parse->priv->caps_width = parse->priv->width;
+    parse->priv->caps_height = parse->priv->height;
+    parse->priv->caps_framerate_numerator = parse->priv->framerate_numerator;
+    parse->priv->caps_framerate_denominator =
+        parse->priv->framerate_denominator;
+  }
+
+
+  return gst_base_parse_finish_frame (bparse, frame, len);
 }
 
 static gboolean
-gst_jpeg_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_jpeg_parse_sink_event (GstBaseParse * bparse, GstEvent * event)
 {
-  GstJpegParse *parse = GST_JPEG_PARSE (parent);
+  GstJpegParse *parse = GST_JPEG_PARSE_CAST (bparse);
   gboolean res = TRUE;
 
   GST_DEBUG_OBJECT (parse, "event : %s", GST_EVENT_TYPE_NAME (event));
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_CAPS:
-    {
-      GstCaps *caps;
-
-      gst_event_parse_caps (event, &caps);
-      res = gst_jpeg_parse_sink_setcaps (parse, caps);
-      gst_event_unref (event);
-      break;
-    }
     case GST_EVENT_FLUSH_STOP:
       parse->priv->next_ts = GST_CLOCK_TIME_NONE;
       parse->priv->duration = GST_CLOCK_TIME_NONE;
       parse->priv->last_offset = 0;
       parse->priv->last_entropy_len = 0;
       parse->priv->last_resync = FALSE;
-      gst_adapter_clear (parse->priv->adapter);
-      break;
-    case GST_EVENT_EOS:{
-      /* Push the remaining data, even though it's incomplete */
-      guint available = gst_adapter_available (parse->priv->adapter);
-      if (available > 0)
-        gst_jpeg_parse_push_buffer (parse, available);
-      res = gst_pad_push_event (parse->priv->srcpad, event);
-      break;
-    }
-    case GST_EVENT_SEGMENT:
-      /* Discard any data in the adapter.  There should have been an EOS before
-       * to flush it. */
-      gst_adapter_clear (parse->priv->adapter);
-      gst_event_copy_segment (event, &parse->priv->segment);
-      gst_event_unref (event);
-      parse->priv->new_segment = TRUE;
       break;
     case GST_EVENT_TAG:{
-      if (!parse->priv->new_segment)
-        res = gst_pad_event_default (pad, parent, event);
+      if (gst_pad_has_current_caps (GST_BASE_PARSE_SRC_PAD (parse)))
+        res = GST_BASE_PARSE_CLASS (parent_class)->sink_event (bparse, event);
       else {
         GstTagList *taglist = NULL;
 
@@ -996,64 +888,53 @@
       break;
     }
     default:
-      res = gst_pad_event_default (pad, parent, event);
+      res = GST_BASE_PARSE_CLASS (parent_class)->sink_event (bparse, event);
       break;
   }
 
   return res;
 }
 
-static GstStateChangeReturn
-gst_jpeg_parse_change_state (GstElement * element, GstStateChange transition)
+static gboolean
+gst_jpeg_parse_start (GstBaseParse * bparse)
 {
-  GstStateChangeReturn ret;
   GstJpegParse *parse;
 
-  parse = GST_JPEG_PARSE (element);
+  parse = GST_JPEG_PARSE_CAST (bparse);
 
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      parse->priv->has_fps = FALSE;
+  parse->priv->has_fps = FALSE;
 
-      parse->priv->interlaced = FALSE;
-      parse->priv->width = parse->priv->height = 0;
-      parse->priv->framerate_numerator = 0;
-      parse->priv->framerate_denominator = 1;
+  parse->priv->width = parse->priv->height = 0;
+  parse->priv->framerate_numerator = 0;
+  parse->priv->framerate_denominator = 1;
 
-      parse->priv->caps_framerate_numerator =
-          parse->priv->caps_framerate_denominator = 0;
-      parse->priv->caps_width = parse->priv->caps_height = -1;
+  parse->priv->caps_framerate_numerator =
+      parse->priv->caps_framerate_denominator = 0;
+  parse->priv->caps_width = parse->priv->caps_height = -1;
 
-      parse->priv->new_segment = FALSE;
-      gst_segment_init (&parse->priv->segment, GST_FORMAT_UNDEFINED);
+  parse->priv->next_ts = GST_CLOCK_TIME_NONE;
+  parse->priv->duration = GST_CLOCK_TIME_NONE;
 
-      parse->priv->next_ts = GST_CLOCK_TIME_NONE;
-      parse->priv->duration = GST_CLOCK_TIME_NONE;
+  parse->priv->last_offset = 0;
+  parse->priv->last_entropy_len = 0;
+  parse->priv->last_resync = FALSE;
 
-      parse->priv->last_offset = 0;
-      parse->priv->last_entropy_len = 0;
-      parse->priv->last_resync = FALSE;
+  parse->priv->tags = NULL;
 
-      parse->priv->tags = NULL;
-    default:
-      break;
+  return TRUE;
+}
+
+static gboolean
+gst_jpeg_parse_stop (GstBaseParse * bparse)
+{
+  GstJpegParse *parse;
+
+  parse = GST_JPEG_PARSE_CAST (bparse);
+
+  if (parse->priv->tags) {
+    gst_tag_list_unref (parse->priv->tags);
+    parse->priv->tags = NULL;
   }
 
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-  if (ret != GST_STATE_CHANGE_SUCCESS)
-    return ret;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      gst_adapter_clear (parse->priv->adapter);
-      if (parse->priv->tags) {
-        gst_tag_list_unref (parse->priv->tags);
-        parse->priv->tags = NULL;
-      }
-      break;
-    default:
-      break;
-  }
-
-  return ret;
+  return TRUE;
 }
diff --git a/gst/jpegformat/gstjpegparse.h b/gst/jpegformat/gstjpegparse.h
index 8f6e9a7..d766516 100644
--- a/gst/jpegformat/gstjpegparse.h
+++ b/gst/jpegformat/gstjpegparse.h
@@ -25,6 +25,7 @@
 
 #include <gst/gst.h>
 #include <gst/base/gstadapter.h>
+#include <gst/base/gstbaseparse.h>
 
 #include "gstjpegformat.h"
 
@@ -40,18 +41,19 @@
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEG_PARSE))
 #define GST_IS_JPEG_PARSE_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEG_PARSE))
+#define GST_JPEG_PARSE_CAST(obj) ((GstJpegParse *)obj)
 
 typedef struct _GstJpegParse           GstJpegParse;
 typedef struct _GstJpegParsePrivate    GstJpegParsePrivate;
 typedef struct _GstJpegParseClass      GstJpegParseClass;
 
 struct _GstJpegParse {
-  GstElement element;
+  GstBaseParse parse;
   GstJpegParsePrivate *priv;
 };
 
 struct _GstJpegParseClass {
-  GstElementClass  parent_class;
+  GstBaseParseClass  parent_class;
 };
 
 GType gst_jpeg_parse_get_type (void);
diff --git a/gst/librfb/Makefile.in b/gst/librfb/Makefile.in
index f210dd1..878a8c2 100644
--- a/gst/librfb/Makefile.in
+++ b/gst/librfb/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -254,8 +254,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -294,7 +298,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -302,6 +305,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -351,8 +356,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -431,7 +434,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -440,7 +442,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -453,7 +454,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -478,6 +478,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -551,10 +553,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -580,6 +586,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -616,6 +625,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -656,17 +666,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -683,6 +692,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/librfb/d3des.c b/gst/librfb/d3des.c
index 785a3a8..c05fea3 100644
--- a/gst/librfb/d3des.c
+++ b/gst/librfb/d3des.c
@@ -36,12 +36,12 @@
 static void desfunc (unsigned long *, unsigned long *);
 static void cookey (DESContext * ctx, unsigned long *);
 
-//static unsigned long KnL[32] = { 0L };
+//static const unsigned long KnL[32] = { 0L };
 
-//static unsigned long KnR[32] = { 0L };
-//static unsigned long Kn3[32] = { 0L };
+//static const unsigned long KnR[32] = { 0L };
+//static const unsigned long Kn3[32] = { 0L };
 /* 
- * static unsigned char Df_Key[24] = {
+ * static const unsigned char Df_Key[24] = {
  * 	0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
  * 	0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
  * 	0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };
diff --git a/gst/librfb/rfbdecoder.c b/gst/librfb/rfbdecoder.c
index de762ed..88f3b03 100644
--- a/gst/librfb/rfbdecoder.c
+++ b/gst/librfb/rfbdecoder.c
@@ -663,28 +663,38 @@
 
   if (decoder->offset_x > 0) {
     if (decoder->offset_x > decoder->width) {
-      GST_WARNING ("Trying to crop more than the width of the server");
+      GST_WARNING
+          ("Trying to crop more than the width of the server.  Setting offset-x to 0.");
+      decoder->offset_x = 0;
     } else {
       decoder->width -= decoder->offset_x;
     }
   }
   if (decoder->offset_y > 0) {
     if (decoder->offset_y > decoder->height) {
-      GST_WARNING ("Trying to crop more than the height of the server");
+      GST_WARNING
+          ("Trying to crop more than the height of the server. Setting offset-y to 0.");
+      decoder->offset_y = 0;
     } else {
       decoder->height -= decoder->offset_y;
     }
   }
   if (decoder->rect_width > 0) {
     if (decoder->rect_width > decoder->width) {
-      GST_WARNING ("Trying to crop more than the width of the server");
+      GST_WARNING
+          ("Trying to crop more than the width of the server. Setting width to %u.",
+          decoder->width);
+      decoder->rect_width = decoder->width;
     } else {
       decoder->width = decoder->rect_width;
     }
   }
   if (decoder->rect_height > 0) {
     if (decoder->rect_height > decoder->height) {
-      GST_WARNING ("Trying to crop more than the height of the server");
+      GST_WARNING
+          ("Trying to crop more than the height of the server. Setting height to %u.",
+          decoder->height);
+      decoder->rect_height = decoder->height;
     } else {
       decoder->height = decoder->rect_height;
     }
diff --git a/gst/liveadder/Makefile.in b/gst/liveadder/Makefile.in
index defce0a..f3a475c 100644
--- a/gst/liveadder/Makefile.in
+++ b/gst/liveadder/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/liveadder/liveadder.c b/gst/liveadder/liveadder.c
index 1c3b7a0..af7fbbb 100644
--- a/gst/liveadder/liveadder.c
+++ b/gst/liveadder/liveadder.c
@@ -728,57 +728,15 @@
     {
       /* We need to send the query upstream and add the returned latency to our
        * own */
-      GstClockTime min_latency = 0, max_latency = G_MAXUINT64;
-      GValue item = { 0 };
-      GstIterator *iter = NULL;
-      gboolean done = FALSE;
-
-      iter = gst_element_iterate_sink_pads (GST_ELEMENT (adder));
-
-      while (!done) {
-        switch (gst_iterator_next (iter, &item)) {
-          case GST_ITERATOR_OK:
-          {
-            GstPad *sinkpad = GST_PAD (g_value_get_object (&item));
-            GstClockTime pad_min_latency, pad_max_latency;
-            gboolean pad_us_live;
-
-            if (gst_pad_peer_query (sinkpad, query)) {
-              gst_query_parse_latency (query, &pad_us_live, &pad_min_latency,
-                  &pad_max_latency);
-
-              res = TRUE;
-
-              GST_DEBUG_OBJECT (adder, "Peer latency for pad %s: min %"
-                  GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
-                  GST_PAD_NAME (sinkpad),
-                  GST_TIME_ARGS (pad_min_latency),
-                  GST_TIME_ARGS (pad_max_latency));
-
-              min_latency = MAX (pad_min_latency, min_latency);
-              max_latency = MIN (pad_max_latency, max_latency);
-            }
-          }
-            break;
-          case GST_ITERATOR_RESYNC:
-            min_latency = 0;
-            max_latency = G_MAXUINT64;
-
-            gst_iterator_resync (iter);
-            break;
-          case GST_ITERATOR_ERROR:
-            GST_ERROR_OBJECT (adder, "Error looping sink pads");
-            done = TRUE;
-            break;
-          case GST_ITERATOR_DONE:
-            done = TRUE;
-            break;
-        }
-      }
-      gst_iterator_free (iter);
+      res = gst_pad_query_default (pad, parent, query);
 
       if (res) {
         GstClockTime my_latency = adder->latency_ms * GST_MSECOND;
+        GstClockTime min_latency, max_latency;
+        gboolean live;
+
+        gst_query_parse_latency (query, &live, &min_latency, &max_latency);
+
         GST_OBJECT_LOCK (adder);
         adder->peer_latency = min_latency;
         min_latency += my_latency;
diff --git a/gst/midi/Makefile.in b/gst/midi/Makefile.in
index 7fe5eec..49df014 100644
--- a/gst/midi/Makefile.in
+++ b/gst/midi/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/midi/midiparse.c b/gst/midi/midiparse.c
index c42c1b5..2f817c7 100644
--- a/gst/midi/midiparse.c
+++ b/gst/midi/midiparse.c
@@ -21,7 +21,7 @@
 
 /**
  * SECTION:element-midiparse
- * @see_also: fluidsynth
+ * @see_also: fluiddec
  *
  * This element parses midi-files into midi events. You would need a midi
  * renderer such as fluidsynth to convert the events into raw samples.
@@ -29,7 +29,7 @@
  * <refsect2>
  * <title>Example pipeline</title>
  * |[
- * gst-launch-1.0 filesrc location=song.mid ! midiparse ! fluidsynth ! pulsesink
+ * gst-launch-1.0 filesrc location=song.mid ! midiparse ! fluiddec ! pulsesink
  * ]| This example pipeline will parse the midi and render to raw audio which is
  * played via pulseaudio.
  * </refsect2>
diff --git a/gst/mpegdemux/Makefile.in b/gst/mpegdemux/Makefile.in
index 24fc6b6..49379f4 100644
--- a/gst/mpegdemux/Makefile.in
+++ b/gst/mpegdemux/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c
index 90c00cb..69ca8e1 100644
--- a/gst/mpegdemux/gstmpegdemux.c
+++ b/gst/mpegdemux/gstmpegdemux.c
@@ -134,41 +134,41 @@
     GST_PAD_SOMETIMES,
     GST_STATIC_CAPS_ANY);
 
-static void gst_flups_demux_base_init (GstFluPSDemuxClass * klass);
-static void gst_flups_demux_class_init (GstFluPSDemuxClass * klass);
-static void gst_flups_demux_init (GstFluPSDemux * demux);
-static void gst_flups_demux_finalize (GstFluPSDemux * demux);
-static void gst_flups_demux_reset (GstFluPSDemux * demux);
+static void gst_ps_demux_base_init (GstPsDemuxClass * klass);
+static void gst_ps_demux_class_init (GstPsDemuxClass * klass);
+static void gst_ps_demux_init (GstPsDemux * demux);
+static void gst_ps_demux_finalize (GstPsDemux * demux);
+static void gst_ps_demux_reset (GstPsDemux * demux);
 
-static gboolean gst_flups_demux_sink_event (GstPad * pad, GstObject * parent,
+static gboolean gst_ps_demux_sink_event (GstPad * pad, GstObject * parent,
     GstEvent * event);
-static GstFlowReturn gst_flups_demux_chain (GstPad * pad, GstObject * parent,
+static GstFlowReturn gst_ps_demux_chain (GstPad * pad, GstObject * parent,
     GstBuffer * buffer);
-static gboolean gst_flups_demux_sink_activate (GstPad * sinkpad,
+static gboolean gst_ps_demux_sink_activate (GstPad * sinkpad,
     GstObject * parent);
-static gboolean gst_flups_demux_sink_activate_mode (GstPad * pad,
+static gboolean gst_ps_demux_sink_activate_mode (GstPad * pad,
     GstObject * parent, GstPadMode mode, gboolean active);
-static void gst_flups_demux_loop (GstPad * pad);
+static void gst_ps_demux_loop (GstPad * pad);
 
-static gboolean gst_flups_demux_src_event (GstPad * pad, GstObject * parent,
+static gboolean gst_ps_demux_src_event (GstPad * pad, GstObject * parent,
     GstEvent * event);
-static gboolean gst_flups_demux_src_query (GstPad * pad, GstObject * parent,
+static gboolean gst_ps_demux_src_query (GstPad * pad, GstObject * parent,
     GstQuery * query);
 
-static GstStateChangeReturn gst_flups_demux_change_state (GstElement * element,
+static GstStateChangeReturn gst_ps_demux_change_state (GstElement * element,
     GstStateChange transition);
 
-static inline gboolean gst_flups_demux_scan_forward_ts (GstFluPSDemux * demux,
+static inline gboolean gst_ps_demux_scan_forward_ts (GstPsDemux * demux,
     guint64 * pos, SCAN_MODE mode, guint64 * rts, gint limit);
-static inline gboolean gst_flups_demux_scan_backward_ts (GstFluPSDemux * demux,
+static inline gboolean gst_ps_demux_scan_backward_ts (GstPsDemux * demux,
     guint64 * pos, SCAN_MODE mode, guint64 * rts, gint limit);
 
-static inline void gst_flups_demux_send_gap_updates (GstFluPSDemux * demux,
+static inline void gst_ps_demux_send_gap_updates (GstPsDemux * demux,
     GstClockTime new_time);
-static inline void gst_flups_demux_clear_times (GstFluPSDemux * demux);
+static inline void gst_ps_demux_clear_times (GstPsDemux * demux);
 
-static void gst_flups_demux_reset_psm (GstFluPSDemux * demux);
-static void gst_flups_demux_flush (GstFluPSDemux * demux);
+static void gst_ps_demux_reset_psm (GstPsDemux * demux);
+static void gst_ps_demux_flush (GstPsDemux * demux);
 
 static GstElementClass *parent_class = NULL;
 
@@ -177,40 +177,40 @@
 static void gst_segment_set_duration (GstSegment * segment, GstFormat format,
     guint64 duration);
 
-/*static guint gst_flups_demux_signals[LAST_SIGNAL] = { 0 };*/
+/*static guint gst_ps_demux_signals[LAST_SIGNAL] = { 0 };*/
 
 GType
-gst_flups_demux_get_type (void)
+gst_ps_demux_get_type (void)
 {
-  static GType flups_demux_type = 0;
+  static GType ps_demux_type = 0;
 
-  if (!flups_demux_type) {
-    static const GTypeInfo flups_demux_info = {
-      sizeof (GstFluPSDemuxClass),
-      (GBaseInitFunc) gst_flups_demux_base_init,
+  if (!ps_demux_type) {
+    static const GTypeInfo ps_demux_info = {
+      sizeof (GstPsDemuxClass),
+      (GBaseInitFunc) gst_ps_demux_base_init,
       NULL,
-      (GClassInitFunc) gst_flups_demux_class_init,
+      (GClassInitFunc) gst_ps_demux_class_init,
       NULL,
       NULL,
-      sizeof (GstFluPSDemux),
+      sizeof (GstPsDemux),
       0,
-      (GInstanceInitFunc) gst_flups_demux_init,
+      (GInstanceInitFunc) gst_ps_demux_init,
       NULL
     };
 
-    flups_demux_type =
+    ps_demux_type =
         g_type_register_static (GST_TYPE_ELEMENT, "GstMpegPSDemux",
-        &flups_demux_info, 0);
+        &ps_demux_info, 0);
 
     GST_DEBUG_CATEGORY_INIT (gstflupsdemux_debug, "mpegpsdemux", 0,
         "MPEG program stream demultiplexer element");
   }
 
-  return flups_demux_type;
+  return ps_demux_type;
 }
 
 static void
-gst_flups_demux_base_init (GstFluPSDemuxClass * klass)
+gst_ps_demux_base_init (GstPsDemuxClass * klass)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
@@ -234,7 +234,7 @@
 }
 
 static void
-gst_flups_demux_class_init (GstFluPSDemuxClass * klass)
+gst_ps_demux_class_init (GstPsDemuxClass * klass)
 {
   GObjectClass *gobject_class;
   GstElementClass *gstelement_class;
@@ -244,45 +244,45 @@
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
-  gobject_class->finalize = (GObjectFinalizeFunc) gst_flups_demux_finalize;
+  gobject_class->finalize = (GObjectFinalizeFunc) gst_ps_demux_finalize;
 
-  gstelement_class->change_state = gst_flups_demux_change_state;
+  gstelement_class->change_state = gst_ps_demux_change_state;
 }
 
 static void
-gst_flups_demux_init (GstFluPSDemux * demux)
+gst_ps_demux_init (GstPsDemux * demux)
 {
-  GstFluPSDemuxClass *klass = GST_FLUPS_DEMUX_GET_CLASS (demux);
+  GstPsDemuxClass *klass = GST_PS_DEMUX_GET_CLASS (demux);
 
   demux->sinkpad = gst_pad_new_from_template (klass->sink_template, "sink");
   gst_pad_set_event_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_flups_demux_sink_event));
+      GST_DEBUG_FUNCPTR (gst_ps_demux_sink_event));
   gst_pad_set_chain_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_flups_demux_chain));
+      GST_DEBUG_FUNCPTR (gst_ps_demux_chain));
   gst_pad_set_activate_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_flups_demux_sink_activate));
+      GST_DEBUG_FUNCPTR (gst_ps_demux_sink_activate));
   gst_pad_set_activatemode_function (demux->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_flups_demux_sink_activate_mode));
+      GST_DEBUG_FUNCPTR (gst_ps_demux_sink_activate_mode));
 
   gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
 
   demux->streams =
-      g_malloc0 (sizeof (GstFluPSStream *) * (GST_FLUPS_DEMUX_MAX_STREAMS));
+      g_malloc0 (sizeof (GstPsStream *) * (GST_PS_DEMUX_MAX_STREAMS));
   demux->streams_found =
-      g_malloc0 (sizeof (GstFluPSStream *) * (GST_FLUPS_DEMUX_MAX_STREAMS));
+      g_malloc0 (sizeof (GstPsStream *) * (GST_PS_DEMUX_MAX_STREAMS));
   demux->found_count = 0;
 
   demux->adapter = gst_adapter_new ();
   demux->rev_adapter = gst_adapter_new ();
   demux->flowcombiner = gst_flow_combiner_new ();
 
-  gst_flups_demux_reset (demux);
+  gst_ps_demux_reset (demux);
 }
 
 static void
-gst_flups_demux_finalize (GstFluPSDemux * demux)
+gst_ps_demux_finalize (GstPsDemux * demux)
 {
-  gst_flups_demux_reset (demux);
+  gst_ps_demux_reset (demux);
   g_free (demux->streams);
   g_free (demux->streams_found);
 
@@ -294,13 +294,13 @@
 }
 
 static void
-gst_flups_demux_reset (GstFluPSDemux * demux)
+gst_ps_demux_reset (GstPsDemux * demux)
 {
   /* Clean up the streams and pads we allocated */
   gint i;
 
-  for (i = 0; i < GST_FLUPS_DEMUX_MAX_STREAMS; i++) {
-    GstFluPSStream *stream = demux->streams[i];
+  for (i = 0; i < GST_PS_DEMUX_MAX_STREAMS; i++) {
+    GstPsStream *stream = demux->streams[i];
 
     if (stream != NULL) {
       if (stream->pad && GST_PAD_PARENT (stream->pad)) {
@@ -315,7 +315,7 @@
     }
   }
   memset (demux->streams_found, 0,
-      sizeof (GstFluPSStream *) * (GST_FLUPS_DEMUX_MAX_STREAMS));
+      sizeof (GstPsStream *) * (GST_PS_DEMUX_MAX_STREAMS));
   demux->found_count = 0;
 
   gst_adapter_clear (demux->adapter);
@@ -335,21 +335,21 @@
   demux->next_dts = G_MAXUINT64;
   demux->need_no_more_pads = TRUE;
   demux->adjust_segment = TRUE;
-  gst_flups_demux_reset_psm (demux);
+  gst_ps_demux_reset_psm (demux);
   gst_segment_init (&demux->sink_segment, GST_FORMAT_UNDEFINED);
   gst_segment_init (&demux->src_segment, GST_FORMAT_TIME);
-  gst_flups_demux_flush (demux);
+  gst_ps_demux_flush (demux);
   demux->have_group_id = FALSE;
   demux->group_id = G_MAXUINT;
 }
 
-static GstFluPSStream *
-gst_flups_demux_create_stream (GstFluPSDemux * demux, gint id, gint stream_type)
+static GstPsStream *
+gst_ps_demux_create_stream (GstPsDemux * demux, gint id, gint stream_type)
 {
-  GstFluPSStream *stream;
+  GstPsStream *stream;
   GstPadTemplate *template;
   gchar *name;
-  GstFluPSDemuxClass *klass = GST_FLUPS_DEMUX_GET_CLASS (demux);
+  GstPsDemuxClass *klass = GST_PS_DEMUX_GET_CLASS (demux);
   GstCaps *caps;
   GstClockTime threshold = SEGMENT_THRESHOLD;
   GstEvent *event;
@@ -454,7 +454,7 @@
     return FALSE;
   }
 
-  stream = g_new0 (GstFluPSStream, 1);
+  stream = g_new0 (GstPsStream, 1);
   stream->id = id;
   stream->discont = TRUE;
   stream->need_segment = TRUE;
@@ -464,9 +464,9 @@
   stream->pad = gst_pad_new_from_template (template, name);
   stream->segment_thresh = threshold;
   gst_pad_set_event_function (stream->pad,
-      GST_DEBUG_FUNCPTR (gst_flups_demux_src_event));
+      GST_DEBUG_FUNCPTR (gst_ps_demux_src_event));
   gst_pad_set_query_function (stream->pad,
-      GST_DEBUG_FUNCPTR (gst_flups_demux_src_query));
+      GST_DEBUG_FUNCPTR (gst_ps_demux_src_query));
   gst_pad_use_fixed_caps (stream->pad);
 
   /* needed for set_caps to work */
@@ -511,13 +511,13 @@
   return stream;
 }
 
-static GstFluPSStream *
-gst_flups_demux_get_stream (GstFluPSDemux * demux, gint id, gint type)
+static GstPsStream *
+gst_ps_demux_get_stream (GstPsDemux * demux, gint id, gint type)
 {
-  GstFluPSStream *stream = demux->streams[id];
+  GstPsStream *stream = demux->streams[id];
 
   if (stream == NULL) {
-    if (!(stream = gst_flups_demux_create_stream (demux, id, type)))
+    if (!(stream = gst_ps_demux_create_stream (demux, id, type)))
       goto unknown_stream;
 
     GST_DEBUG_OBJECT (demux, "adding pad for stream id 0x%02x type 0x%02x", id,
@@ -547,8 +547,25 @@
   }
 }
 
+static GstPsStream *
+gst_ps_demux_get_stream_from_pad (GstPsDemux * demux, GstPad * srcpad)
+{
+  gint i, count;
+
+  count = demux->found_count;
+  for (i = 0; i < count; i++) {
+    GstPsStream *stream = demux->streams_found[i];
+
+    if (stream && stream->pad == srcpad)
+      return stream;
+  }
+
+  GST_DEBUG_OBJECT (srcpad, "no stream found for pad!");
+  return NULL;
+}
+
 static inline void
-gst_flups_demux_send_segment (GstFluPSDemux * demux, GstFluPSStream * stream,
+gst_ps_demux_send_segment (GstPsDemux * demux, GstPsStream * stream,
     GstClockTime pts)
 {
   /* discont */
@@ -604,7 +621,7 @@
 }
 
 static GstFlowReturn
-gst_flups_demux_send_data (GstFluPSDemux * demux, GstFluPSStream * stream,
+gst_ps_demux_send_data (GstPsDemux * demux, GstPsStream * stream,
     GstBuffer * buf)
 {
   GstFlowReturn result;
@@ -619,7 +636,7 @@
   if (G_UNLIKELY (demux->next_dts != G_MAXUINT64))
     dts = MPEGTIME_TO_GSTTIME (demux->next_dts);
 
-  gst_flups_demux_send_segment (demux, stream, pts);
+  gst_ps_demux_send_segment (demux, stream, pts);
 
   /* OK, sent new segment now prepare the buffer for sending */
   GST_BUFFER_PTS (buf) = pts;
@@ -645,7 +662,7 @@
       stream->last_ts = new_time;
     }
 
-    gst_flups_demux_send_gap_updates (demux, new_time);
+    gst_ps_demux_send_gap_updates (demux, new_time);
   }
 
   /* Set the buffer discont flag, and clear discont state on the stream */
@@ -681,14 +698,14 @@
 }
 
 static inline void
-gst_flups_demux_mark_discont (GstFluPSDemux * demux, gboolean discont,
+gst_ps_demux_mark_discont (GstPsDemux * demux, gboolean discont,
     gboolean need_segment)
 {
   gint i, count = demux->found_count;
 
   /* mark discont on all streams */
   for (i = 0; i < count; i++) {
-    GstFluPSStream *stream = demux->streams_found[i];
+    GstPsStream *stream = demux->streams_found[i];
 
     if (G_LIKELY (stream)) {
       stream->discont |= discont;
@@ -701,13 +718,13 @@
 }
 
 static gboolean
-gst_flups_demux_send_event (GstFluPSDemux * demux, GstEvent * event)
+gst_ps_demux_send_event (GstPsDemux * demux, GstEvent * event)
 {
   gint i, count = demux->found_count;
   gboolean ret = FALSE;
 
   for (i = 0; i < count; i++) {
-    GstFluPSStream *stream = demux->streams_found[i];
+    GstPsStream *stream = demux->streams_found[i];
 
     if (stream) {
       if (!gst_pad_push_event (stream->pad, gst_event_ref (event))) {
@@ -727,20 +744,20 @@
 }
 
 static gboolean
-gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
+gst_ps_demux_handle_dvd_event (GstPsDemux * demux, GstEvent * event)
 {
   const GstStructure *structure = gst_event_get_structure (event);
   const char *type = gst_structure_get_string (structure, "event");
   gint i;
   gchar cur_stream_name[32];
-  GstFluPSStream *temp = NULL;
+  GstPsStream *temp = NULL;
   const gchar *lang_code;
 
   if (strcmp (type, "dvd-lang-codes") == 0) {
     GST_DEBUG_OBJECT (demux, "Handling language codes event");
 
     /* Create a video pad to ensure have it before emit no more pads */
-    (void) gst_flups_demux_get_stream (demux, 0xe0, ST_VIDEO_MPEG2);
+    (void) gst_ps_demux_get_stream (demux, 0xe0, ST_VIDEO_MPEG2);
 
     /* Read out the languages for audio streams and request each one that 
      * is present */
@@ -765,7 +782,7 @@
           GST_DEBUG_OBJECT (demux,
               "Audio stream %d format %d ID 0x%02x - AC3", i,
               stream_format, stream_id);
-          temp = gst_flups_demux_get_stream (demux, stream_id, ST_PS_AUDIO_AC3);
+          temp = gst_ps_demux_get_stream (demux, stream_id, ST_PS_AUDIO_AC3);
           break;
         case 0x2:
         case 0x3:
@@ -775,7 +792,7 @@
           GST_DEBUG_OBJECT (demux,
               "Audio stream %d format %d ID 0x%02x - MPEG audio", i,
               stream_format, stream_id);
-          temp = gst_flups_demux_get_stream (demux, stream_id, ST_AUDIO_MPEG1);
+          temp = gst_ps_demux_get_stream (demux, stream_id, ST_AUDIO_MPEG1);
           break;
         case 0x4:
           /* LPCM */
@@ -783,8 +800,7 @@
           GST_DEBUG_OBJECT (demux,
               "Audio stream %d format %d ID 0x%02x - DVD LPCM", i,
               stream_format, stream_id);
-          temp =
-              gst_flups_demux_get_stream (demux, stream_id, ST_PS_AUDIO_LPCM);
+          temp = gst_ps_demux_get_stream (demux, stream_id, ST_PS_AUDIO_LPCM);
           break;
         case 0x6:
           /* DTS */
@@ -792,7 +808,7 @@
           GST_DEBUG_OBJECT (demux,
               "Audio stream %d format %d ID 0x%02x - DTS", i,
               stream_format, stream_id);
-          temp = gst_flups_demux_get_stream (demux, stream_id, ST_PS_AUDIO_DTS);
+          temp = gst_ps_demux_get_stream (demux, stream_id, ST_PS_AUDIO_DTS);
           break;
         case 0x7:
           /* FIXME: What range is SDDS? */
@@ -835,7 +851,7 @@
           0x20 + stream_id);
 
       /* Retrieve the subpicture stream to force pad creation */
-      temp = gst_flups_demux_get_stream (demux, 0x20 + stream_id,
+      temp = gst_ps_demux_get_stream (demux, 0x20 + stream_id,
           ST_PS_DVD_SUBPICTURE);
 
       g_snprintf (cur_stream_name, 32, "subpicture-%d-language", i);
@@ -859,7 +875,7 @@
   } else {
     /* forward to all pads, e.g. dvd clut event */
     gst_event_ref (event);
-    gst_flups_demux_send_event (demux, event);
+    gst_ps_demux_send_event (demux, event);
   }
 
   gst_event_unref (event);
@@ -867,26 +883,26 @@
 }
 
 static void
-gst_flups_demux_flush (GstFluPSDemux * demux)
+gst_ps_demux_flush (GstPsDemux * demux)
 {
   GST_DEBUG_OBJECT (demux, "flushing demuxer");
   gst_adapter_clear (demux->adapter);
   gst_adapter_clear (demux->rev_adapter);
   gst_pes_filter_drain (&demux->filter);
-  gst_flups_demux_clear_times (demux);
+  gst_ps_demux_clear_times (demux);
   demux->adapter_offset = G_MAXUINT64;
   demux->current_scr = G_MAXUINT64;
   demux->bytes_since_scr = 0;
 }
 
 static inline void
-gst_flups_demux_clear_times (GstFluPSDemux * demux)
+gst_ps_demux_clear_times (GstPsDemux * demux)
 {
   gint i, count = demux->found_count;
 
   /* Clear the last ts for all streams */
   for (i = 0; i < count; i++) {
-    GstFluPSStream *stream = demux->streams_found[i];
+    GstPsStream *stream = demux->streams_found[i];
 
     if (G_LIKELY (stream)) {
       stream->last_ts = GST_CLOCK_TIME_NONE;
@@ -895,7 +911,7 @@
 }
 
 static inline void
-gst_flups_demux_send_gap_updates (GstFluPSDemux * demux, GstClockTime new_start)
+gst_ps_demux_send_gap_updates (GstPsDemux * demux, GstClockTime new_start)
 {
   GstClockTime base_time, stop;
   gint i, count = demux->found_count;
@@ -914,7 +930,7 @@
 
   /* FIXME: Handle reverse playback */
   for (i = 0; i < count; i++) {
-    GstFluPSStream *stream = demux->streams_found[i];
+    GstPsStream *stream = demux->streams_found[i];
 
     if (stream) {
       if (stream->last_ts == GST_CLOCK_TIME_NONE ||
@@ -923,7 +939,7 @@
 
       if (stream->last_ts + stream->segment_thresh < new_start) {
         /* should send segment info before gap event */
-        gst_flups_demux_send_segment (demux, stream, GST_CLOCK_TIME_NONE);
+        gst_ps_demux_send_segment (demux, stream, GST_CLOCK_TIME_NONE);
 
         GST_LOG_OBJECT (demux,
             "Sending gap update to pad %s time %" GST_TIME_FORMAT,
@@ -938,25 +954,25 @@
 }
 
 static inline gboolean
-have_open_streams (GstFluPSDemux * demux)
+have_open_streams (GstPsDemux * demux)
 {
   return (demux->streams_found[0] != NULL);
 }
 
 static gboolean
-gst_flups_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_ps_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
 {
   gboolean res = TRUE;
-  GstFluPSDemux *demux = GST_FLUPS_DEMUX (parent);
+  GstPsDemux *demux = GST_PS_DEMUX (parent);
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_FLUSH_START:
-      gst_flups_demux_send_event (demux, event);
+      gst_ps_demux_send_event (demux, event);
       break;
     case GST_EVENT_FLUSH_STOP:
-      gst_flups_demux_send_event (demux, event);
+      gst_ps_demux_send_event (demux, event);
       gst_segment_init (&demux->sink_segment, GST_FORMAT_UNDEFINED);
-      gst_flups_demux_flush (demux);
+      gst_ps_demux_flush (demux);
       break;
     case GST_EVENT_SEGMENT:
     {
@@ -968,7 +984,7 @@
       GST_INFO_OBJECT (demux, "received segment %" GST_SEGMENT_FORMAT, segment);
 
       /* we need to emit a new segment */
-      gst_flups_demux_mark_discont (demux, TRUE, TRUE);
+      gst_ps_demux_mark_discont (demux, TRUE, TRUE);
 
       if (segment->format == GST_FORMAT_BYTES
           && demux->scr_rate_n != G_MAXUINT64
@@ -993,7 +1009,7 @@
     }
     case GST_EVENT_EOS:
       GST_INFO_OBJECT (demux, "Received EOS");
-      if (!gst_flups_demux_send_event (demux, event)
+      if (!gst_ps_demux_send_event (demux, event)
           && !have_open_streams (demux)) {
         GST_WARNING_OBJECT (demux, "EOS and no streams open");
         GST_ELEMENT_ERROR (demux, STREAM, FAILED,
@@ -1007,9 +1023,9 @@
 
       if (structure != NULL
           && gst_structure_has_name (structure, "application/x-gst-dvd")) {
-        res = gst_flups_demux_handle_dvd_event (demux, event);
+        res = gst_ps_demux_handle_dvd_event (demux, event);
       } else {
-        gst_flups_demux_send_event (demux, event);
+        gst_ps_demux_send_event (demux, event);
       }
       break;
     }
@@ -1017,7 +1033,7 @@
       gst_event_unref (event);
       break;
     default:
-      gst_flups_demux_send_event (demux, event);
+      gst_ps_demux_send_event (demux, event);
       break;
   }
 
@@ -1025,7 +1041,7 @@
 }
 
 static gboolean
-gst_flups_demux_handle_seek_push (GstFluPSDemux * demux, GstEvent * event)
+gst_ps_demux_handle_seek_push (GstPsDemux * demux, GstEvent * event)
 {
   gboolean res = FALSE;
   gdouble rate;
@@ -1095,14 +1111,13 @@
 
 /* Binary search for requested SCR */
 static inline guint64
-find_offset (GstFluPSDemux * demux, guint64 scr,
+find_offset (GstPsDemux * demux, guint64 scr,
     guint64 min_scr, guint64 min_scr_offset,
     guint64 max_scr, guint64 max_scr_offset, int recursion_count)
 {
   guint64 scr_rate_n = max_scr_offset - min_scr_offset;
   guint64 scr_rate_d = max_scr - min_scr;
   guint64 fscr = scr;
-  gboolean found;
   guint64 offset;
 
   if (recursion_count > MAX_RECURSION_COUNT) {
@@ -1113,11 +1128,8 @@
       MIN (gst_util_uint64_scale (scr - min_scr, scr_rate_n,
           scr_rate_d), demux->sink_segment.stop);
 
-  found = gst_flups_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
-
-  if (!found) {
-    found =
-        gst_flups_demux_scan_backward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
+  if (!gst_ps_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &fscr, 0)) {
+    gst_ps_demux_scan_backward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
   }
 
   if (fscr == scr || fscr == min_scr || fscr == max_scr) {
@@ -1134,9 +1146,9 @@
 }
 
 static inline gboolean
-gst_flups_demux_do_seek (GstFluPSDemux * demux, GstSegment * seeksegment)
+gst_ps_demux_do_seek (GstPsDemux * demux, GstSegment * seeksegment)
 {
-  gboolean found = FALSE;
+  gboolean found;
   guint64 fscr, offset;
   guint64 scr = GSTTIME_TO_MPEGTIME (seeksegment->position + demux->base_time);
 
@@ -1161,16 +1173,18 @@
     return FALSE;
   }
 
+  found = gst_ps_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
+  if (!found)
+    found = gst_ps_demux_scan_backward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
+
   while (found && fscr < scr) {
     offset++;
-    found =
-        gst_flups_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
+    found = gst_ps_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
   }
 
   while (found && fscr > scr && offset > 0) {
     offset--;
-    found =
-        gst_flups_demux_scan_backward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
+    found = gst_ps_demux_scan_backward_ts (demux, &offset, SCAN_SCR, &fscr, 0);
   }
 
   GST_INFO_OBJECT (demux, "doing seek at offset %" G_GUINT64_FORMAT
@@ -1183,7 +1197,7 @@
 }
 
 static gboolean
-gst_flups_demux_handle_seek_pull (GstFluPSDemux * demux, GstEvent * event)
+gst_ps_demux_handle_seek_pull (GstPsDemux * demux, GstEvent * event)
 {
   GstFormat format;
   GstSeekFlags flags;
@@ -1214,7 +1228,7 @@
     /* Flush start up and downstream to make sure data flow and loops are
        idle */
     demux->flushing = TRUE;
-    gst_flups_demux_send_event (demux, gst_event_new_flush_start ());
+    gst_ps_demux_send_event (demux, gst_event_new_flush_start ());
     gst_pad_push_event (demux->sinkpad, gst_event_new_flush_start ());
   } else {
     /* Pause the pulling task */
@@ -1246,7 +1260,7 @@
 
   if (flush || seeksegment.position != demux->src_segment.position) {
     /* Do the actual seeking */
-    if (!gst_flups_demux_do_seek (demux, &seeksegment)) {
+    if (!gst_ps_demux_do_seek (demux, &seeksegment)) {
       return FALSE;
     }
   }
@@ -1267,11 +1281,11 @@
 
   if (flush) {
     /* Stop flushing, the sinks are at time 0 now */
-    gst_flups_demux_send_event (demux, gst_event_new_flush_stop (TRUE));
+    gst_ps_demux_send_event (demux, gst_event_new_flush_stop (TRUE));
   }
 
   if (flush || seeksegment.position != demux->src_segment.position) {
-    gst_flups_demux_flush (demux);
+    gst_ps_demux_flush (demux);
   }
 
   /* Ok seek succeeded, take the newly configured segment */
@@ -1285,10 +1299,10 @@
   }
 
   /* Tell all the stream a new segment is needed */
-  gst_flups_demux_mark_discont (demux, TRUE, TRUE);
+  gst_ps_demux_mark_discont (demux, TRUE, TRUE);
 
   gst_pad_start_task (demux->sinkpad,
-      (GstTaskFunction) gst_flups_demux_loop, demux->sinkpad, NULL);
+      (GstTaskFunction) gst_ps_demux_loop, demux->sinkpad, NULL);
 
   GST_PAD_STREAM_UNLOCK (demux->sinkpad);
 
@@ -1318,19 +1332,30 @@
 }
 
 static gboolean
-gst_flups_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
+gst_ps_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
 {
   gboolean res = FALSE;
-  GstFluPSDemux *demux = GST_FLUPS_DEMUX (parent);
+  GstPsDemux *demux = GST_PS_DEMUX (parent);
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_SEEK:
       if (demux->random_access) {
-        res = gst_flups_demux_handle_seek_pull (demux, event);
+        res = gst_ps_demux_handle_seek_pull (demux, event);
       } else {
-        res = gst_flups_demux_handle_seek_push (demux, event);
+        res = gst_ps_demux_handle_seek_push (demux, event);
       }
       break;
+    case GST_EVENT_RECONFIGURE:{
+      GstPsStream *stream;
+
+      stream = gst_ps_demux_get_stream_from_pad (demux, pad);
+      if (stream != NULL)
+        stream->notlinked = FALSE;
+
+      gst_event_unref (event);
+      res = TRUE;
+      break;
+    }
     default:
       res = gst_pad_push_event (demux->sinkpad, event);
       break;
@@ -1340,10 +1365,10 @@
 }
 
 static gboolean
-gst_flups_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
+gst_ps_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
 {
   gboolean res = FALSE;
-  GstFluPSDemux *demux = GST_FLUPS_DEMUX (parent);
+  GstPsDemux *demux = GST_PS_DEMUX (parent);
 
   GST_LOG_OBJECT (demux, "Have query of type %d on pad %" GST_PTR_FORMAT,
       GST_QUERY_TYPE (query), pad);
@@ -1523,7 +1548,7 @@
 }
 
 static void
-gst_flups_demux_reset_psm (GstFluPSDemux * demux)
+gst_ps_demux_reset_psm (GstPsDemux * demux)
 {
   gint i;
 
@@ -1532,7 +1557,7 @@
     demux->psm[i] = type;
 
   /* Initialize all fields to -1 first */
-  FILL_TYPE (0x00, GST_FLUPS_DEMUX_MAX_PSM - 1, -1);
+  FILL_TYPE (0x00, GST_PS_DEMUX_MAX_PSM - 1, -1);
 
   FILL_TYPE (0x20, 0x3f, ST_PS_DVD_SUBPICTURE);
 
@@ -1574,7 +1599,7 @@
 #define PACK_START_SIZE     21
 
 static GstFlowReturn
-gst_flups_demux_parse_pack_start (GstFluPSDemux * demux)
+gst_ps_demux_parse_pack_start (GstPsDemux * demux)
 {
   const guint8 *data;
   guint length;
@@ -1841,7 +1866,7 @@
  */
 
 static GstFlowReturn
-gst_flups_demux_parse_sys_head (GstFluPSDemux * demux)
+gst_ps_demux_parse_sys_head (GstPsDemux * demux)
 {
   guint16 length;
   const guint8 *data;
@@ -2027,7 +2052,7 @@
 }
 
 static GstFlowReturn
-gst_flups_demux_parse_psm (GstFluPSDemux * demux)
+gst_ps_demux_parse_psm (GstPsDemux * demux)
 {
   guint16 length = 0, info_length = 0, es_map_length = 0;
   guint8 psm_version = 0;
@@ -2142,13 +2167,13 @@
 }
 
 static void
-gst_flups_demux_resync_cb (GstPESFilter * filter, GstFluPSDemux * demux)
+gst_ps_demux_resync_cb (GstPESFilter * filter, GstPsDemux * demux)
 {
 }
 
 static GstFlowReturn
-gst_flups_demux_data_cb (GstPESFilter * filter, gboolean first,
-    GstBuffer * buffer, GstFluPSDemux * demux)
+gst_ps_demux_data_cb (GstPESFilter * filter, gboolean first,
+    GstBuffer * buffer, GstPsDemux * demux)
 {
   GstBuffer *out_buf;
   GstFlowReturn ret = GST_FLOW_OK;
@@ -2216,20 +2241,20 @@
     }
     if (filter->pts != -1) {
       demux->next_pts = filter->pts + demux->scr_adjust;
-      GST_LOG_OBJECT (demux, "PTS = %" G_GUINT64_FORMAT
-          "(%" G_GUINT64_FORMAT ")", filter->pts, demux->next_pts);
+      GST_LOG_OBJECT (demux, "stream 0x%02x PTS = orig %" G_GUINT64_FORMAT
+          " (%" G_GUINT64_FORMAT ")", id, filter->pts, demux->next_pts);
     } else
       demux->next_pts = G_MAXUINT64;
 
     if (filter->dts != -1) {
       demux->next_dts = filter->dts + demux->scr_adjust;
+      GST_LOG_OBJECT (demux, "stream 0x%02x DTS = orig %" G_GUINT64_FORMAT
+          " (%" G_GUINT64_FORMAT ")", id, filter->dts, demux->next_dts);
     } else {
       demux->next_dts = demux->next_pts;
     }
-    GST_LOG_OBJECT (demux, "DTS = orig %" G_GUINT64_FORMAT
-        " (%" G_GUINT64_FORMAT ")", filter->dts, demux->next_dts);
 
-    demux->current_stream = gst_flups_demux_get_stream (demux, id, stream_type);
+    demux->current_stream = gst_ps_demux_get_stream (demux, id, stream_type);
   }
 
   if (G_UNLIKELY (demux->current_stream == NULL)) {
@@ -2258,7 +2283,7 @@
     out_buf =
         gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset, datalen);
 
-    ret = gst_flups_demux_send_data (demux, demux->current_stream, out_buf);
+    ret = gst_ps_demux_send_data (demux, demux->current_stream, out_buf);
     if (ret == GST_FLOW_NOT_LINKED) {
       demux->current_stream->notlinked = TRUE;
     }
@@ -2280,7 +2305,7 @@
 }
 
 static gboolean
-gst_flups_demux_resync (GstFluPSDemux * demux, gboolean save)
+gst_ps_demux_resync (GstPsDemux * demux, gboolean save)
 {
   const guint8 *data;
   gint avail;
@@ -2360,14 +2385,14 @@
 }
 
 static inline gboolean
-gst_flups_demux_is_pes_sync (guint32 sync)
+gst_ps_demux_is_pes_sync (guint32 sync)
 {
   return ((sync & 0xfc) == 0xbc) ||
       ((sync & 0xe0) == 0xc0) || ((sync & 0xf0) == 0xe0);
 }
 
 static inline gboolean
-gst_flups_demux_scan_ts (GstFluPSDemux * demux, const guint8 * data,
+gst_ps_demux_scan_ts (GstPsDemux * demux, const guint8 * data,
     SCAN_MODE mode, guint64 * rts)
 {
   gboolean ret = FALSE;
@@ -2446,11 +2471,12 @@
   if (mode == SCAN_SCR) {
     *rts = scr;
     ret = TRUE;
+    goto beach;
   }
 
   /* read the 4 bytes for the PES sync code */
   code = GST_READ_UINT32_BE (data);
-  if (!gst_flups_demux_is_pes_sync (code))
+  if (!gst_ps_demux_is_pes_sync (code))
     goto beach;
 
   switch (code) {
@@ -2549,7 +2575,7 @@
 }
 
 static inline gboolean
-gst_flups_demux_scan_forward_ts (GstFluPSDemux * demux, guint64 * pos,
+gst_ps_demux_scan_forward_ts (GstPsDemux * demux, guint64 * pos,
     SCAN_MODE mode, guint64 * rts, gint limit)
 {
   GstFlowReturn ret = GST_FLOW_OK;
@@ -2590,7 +2616,7 @@
 
     /* scan the block */
     for (cursor = 0; !found && cursor <= end_scan; cursor++) {
-      found = gst_flups_demux_scan_ts (demux, map.data + cursor, mode, &ts);
+      found = gst_ps_demux_scan_ts (demux, map.data + cursor, mode, &ts);
     }
 
     /* done with the buffer, unref it */
@@ -2609,7 +2635,7 @@
 }
 
 static inline gboolean
-gst_flups_demux_scan_backward_ts (GstFluPSDemux * demux, guint64 * pos,
+gst_ps_demux_scan_backward_ts (GstPsDemux * demux, guint64 * pos,
     SCAN_MODE mode, guint64 * rts, gint limit)
 {
   GstFlowReturn ret = GST_FLOW_OK;
@@ -2656,7 +2682,7 @@
 
     /* scan the block */
     for (cursor = (start_scan + 1); !found && cursor > 0; cursor--) {
-      found = gst_flups_demux_scan_ts (demux, data--, mode, &ts);
+      found = gst_ps_demux_scan_ts (demux, data--, mode, &ts);
     }
 
     /* done with the buffer, unref it */
@@ -2674,7 +2700,7 @@
 }
 
 static inline gboolean
-gst_flups_sink_get_duration (GstFluPSDemux * demux)
+gst_ps_sink_get_duration (GstPsDemux * demux)
 {
   gboolean res = FALSE;
   GstPad *peer;
@@ -2707,7 +2733,7 @@
   /* Scan for notorious SCR and PTS to calculate the duration */
   /* scan for first SCR in the stream */
   offset = demux->sink_segment.start;
-  gst_flups_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &demux->first_scr,
+  gst_ps_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &demux->first_scr,
       DURATION_SCAN_LIMIT);
   GST_DEBUG_OBJECT (demux, "First SCR: %" G_GINT64_FORMAT " %" GST_TIME_FORMAT
       " in packet starting at %" G_GUINT64_FORMAT,
@@ -2716,8 +2742,7 @@
   demux->first_scr_offset = offset;
   /* scan for last SCR in the stream */
   offset = demux->sink_segment.stop;
-  gst_flups_demux_scan_backward_ts (demux, &offset, SCAN_SCR,
-      &demux->last_scr, 0);
+  gst_ps_demux_scan_backward_ts (demux, &offset, SCAN_SCR, &demux->last_scr, 0);
   GST_DEBUG_OBJECT (demux, "Last SCR: %" G_GINT64_FORMAT " %" GST_TIME_FORMAT
       " in packet starting at %" G_GUINT64_FORMAT,
       demux->last_scr, GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->last_scr)),
@@ -2725,7 +2750,7 @@
   demux->last_scr_offset = offset;
   /* scan for first PTS in the stream */
   offset = demux->sink_segment.start;
-  gst_flups_demux_scan_forward_ts (demux, &offset, SCAN_PTS, &demux->first_pts,
+  gst_ps_demux_scan_forward_ts (demux, &offset, SCAN_PTS, &demux->first_pts,
       DURATION_SCAN_LIMIT);
   GST_DEBUG_OBJECT (demux, "First PTS: %" G_GINT64_FORMAT " %" GST_TIME_FORMAT
       " in packet starting at %" G_GUINT64_FORMAT,
@@ -2734,7 +2759,7 @@
   if (demux->first_pts != G_MAXUINT64) {
     /* scan for last PTS in the stream */
     offset = demux->sink_segment.stop;
-    gst_flups_demux_scan_backward_ts (demux, &offset, SCAN_PTS,
+    gst_ps_demux_scan_backward_ts (demux, &offset, SCAN_PTS,
         &demux->last_pts, DURATION_SCAN_LIMIT);
     GST_DEBUG_OBJECT (demux,
         "Last PTS: %" G_GINT64_FORMAT " %" GST_TIME_FORMAT
@@ -2748,7 +2773,7 @@
     offset = demux->first_scr_offset;
     for (i = 0; i < 10; i++) {
       offset++;
-      gst_flups_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &scr, 0);
+      gst_ps_demux_scan_forward_ts (demux, &offset, SCAN_SCR, &scr, 0);
       if (scr < demux->last_scr) {
         demux->first_scr = scr;
         demux->first_scr_offset = offset;
@@ -2791,10 +2816,10 @@
 }
 
 static inline GstFlowReturn
-gst_flups_demux_pull_block (GstPad * pad, GstFluPSDemux * demux,
+gst_ps_demux_pull_block (GstPad * pad, GstPsDemux * demux,
     guint64 offset, guint size)
 {
-  GstFlowReturn ret = GST_FLOW_OK;
+  GstFlowReturn ret;
   GstBuffer *buffer = NULL;
 
   ret = gst_pad_pull_range (pad, offset, size, &buffer);
@@ -2810,20 +2835,20 @@
     GST_LOG_OBJECT (demux, "setting discont flag on backward rate");
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
   }
-  ret = gst_flups_demux_chain (pad, GST_OBJECT (demux), buffer);
+  ret = gst_ps_demux_chain (pad, GST_OBJECT (demux), buffer);
 
 beach:
   return ret;
 }
 
 static void
-gst_flups_demux_loop (GstPad * pad)
+gst_ps_demux_loop (GstPad * pad)
 {
-  GstFluPSDemux *demux;
+  GstPsDemux *demux;
   GstFlowReturn ret = GST_FLOW_OK;
   guint64 offset = 0;
 
-  demux = GST_FLUPS_DEMUX (gst_pad_get_parent (pad));
+  demux = GST_PS_DEMUX (gst_pad_get_parent (pad));
 
   if (G_UNLIKELY (demux->flushing)) {
     ret = GST_FLOW_FLUSHING;
@@ -2831,7 +2856,7 @@
   }
 
   if (G_UNLIKELY (demux->sink_segment.format == GST_FORMAT_UNDEFINED))
-    gst_flups_sink_get_duration (demux);
+    gst_ps_sink_get_duration (demux);
 
   offset = demux->sink_segment.position;
   if (demux->sink_segment.rate >= 0) {
@@ -2840,7 +2865,7 @@
       size = MIN (size, demux->sink_segment.stop - offset);
     }
     /* pull in data */
-    ret = gst_flups_demux_pull_block (pad, demux, offset, size);
+    ret = gst_ps_demux_pull_block (pad, demux, offset, size);
 
     /* pause if something went wrong */
     if (G_UNLIKELY (ret != GST_FLOW_OK))
@@ -2868,7 +2893,7 @@
     guint64 size = MIN (offset, BLOCK_SZ);
 
     /* pull in data */
-    ret = gst_flups_demux_pull_block (pad, demux, offset - size, size);
+    ret = gst_ps_demux_pull_block (pad, demux, offset - size, size);
 
     /* pause if something went wrong */
     if (G_UNLIKELY (ret != GST_FLOW_OK))
@@ -2919,7 +2944,7 @@
           gst_element_post_message (GST_ELEMENT_CAST (demux),
               gst_message_new_segment_done (GST_OBJECT_CAST (demux),
                   GST_FORMAT_TIME, stop));
-          gst_flups_demux_send_event (demux,
+          gst_ps_demux_send_event (demux,
               gst_event_new_segment_done (GST_FORMAT_TIME, stop));
         } else {                /* Reverse playback */
           GST_LOG_OBJECT (demux, "Sending segment done, at beginning of "
@@ -2927,7 +2952,7 @@
           gst_element_post_message (GST_ELEMENT_CAST (demux),
               gst_message_new_segment_done (GST_OBJECT_CAST (demux),
                   GST_FORMAT_TIME, demux->src_segment.start));
-          gst_flups_demux_send_event (demux,
+          gst_ps_demux_send_event (demux,
               gst_event_new_segment_done (GST_FORMAT_TIME,
                   demux->src_segment.start));
         }
@@ -2935,7 +2960,7 @@
         /* normal playback, send EOS to all linked pads */
         gst_element_no_more_pads (GST_ELEMENT (demux));
         GST_LOG_OBJECT (demux, "Sending EOS, at end of stream");
-        if (!gst_flups_demux_send_event (demux, gst_event_new_eos ())
+        if (!gst_ps_demux_send_event (demux, gst_event_new_eos ())
             && !have_open_streams (demux)) {
           GST_WARNING_OBJECT (demux, "EOS and no streams open");
           GST_ELEMENT_ERROR (demux, STREAM, FAILED,
@@ -2946,7 +2971,7 @@
       GST_ELEMENT_ERROR (demux, STREAM, FAILED,
           ("Internal data stream error."),
           ("stream stopped, reason %s", reason));
-      gst_flups_demux_send_event (demux, gst_event_new_eos ());
+      gst_ps_demux_send_event (demux, gst_event_new_eos ());
     }
 
     gst_object_unref (demux);
@@ -2956,7 +2981,7 @@
 
 /* If we can pull that's prefered */
 static gboolean
-gst_flups_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
+gst_ps_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
 {
   gboolean res = FALSE;
   GstQuery *query = gst_query_new_scheduling ();
@@ -2979,10 +3004,10 @@
 
 /* This function gets called when we activate ourselves in push mode. */
 static gboolean
-gst_flups_demux_sink_activate_push (GstPad * sinkpad, GstObject * parent,
+gst_ps_demux_sink_activate_push (GstPad * sinkpad, GstObject * parent,
     gboolean active)
 {
-  GstFluPSDemux *demux = GST_FLUPS_DEMUX (parent);
+  GstPsDemux *demux = GST_PS_DEMUX (parent);
 
   demux->random_access = FALSE;
 
@@ -2993,15 +3018,15 @@
  * We can perform  random access to the resource and we start a task
  * to start reading */
 static gboolean
-gst_flups_demux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
+gst_ps_demux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
     gboolean active)
 {
-  GstFluPSDemux *demux = GST_FLUPS_DEMUX (parent);
+  GstPsDemux *demux = GST_PS_DEMUX (parent);
 
   if (active) {
     GST_DEBUG ("pull mode activated");
     demux->random_access = TRUE;
-    return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flups_demux_loop,
+    return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_ps_demux_loop,
         sinkpad, NULL);
   } else {
     demux->random_access = FALSE;
@@ -3010,13 +3035,13 @@
 }
 
 static gboolean
-gst_flups_demux_sink_activate_mode (GstPad * pad, GstObject * parent,
+gst_ps_demux_sink_activate_mode (GstPad * pad, GstObject * parent,
     GstPadMode mode, gboolean active)
 {
   if (mode == GST_PAD_MODE_PUSH) {
-    return gst_flups_demux_sink_activate_push (pad, parent, active);
+    return gst_ps_demux_sink_activate_push (pad, parent, active);
   } else if (mode == GST_PAD_MODE_PULL) {
-    return gst_flups_demux_sink_activate_pull (pad, parent, active);
+    return gst_ps_demux_sink_activate_pull (pad, parent, active);
   }
   return FALSE;
 }
@@ -3027,7 +3052,7 @@
 *  GST_FLOW_EOS: when all pads EOS or NOT_LINKED.
 */
 static GstFlowReturn
-gst_flups_demux_combine_flows (GstFluPSDemux * demux, GstFlowReturn ret)
+gst_ps_demux_combine_flows (GstPsDemux * demux, GstFlowReturn ret)
 {
   GST_LOG_OBJECT (demux, "flow return: %s", gst_flow_get_name (ret));
 
@@ -3041,9 +3066,9 @@
 }
 
 static GstFlowReturn
-gst_flups_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+gst_ps_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
 {
-  GstFluPSDemux *demux = GST_FLUPS_DEMUX (parent);
+  GstPsDemux *demux = GST_PS_DEMUX (parent);
   GstFlowReturn ret = GST_FLOW_OK;
   guint32 avail;
   gboolean save, discont;
@@ -3055,7 +3080,7 @@
         " offset %" G_GUINT64_FORMAT, GST_BUFFER_OFFSET (buffer));
 
     gst_pes_filter_drain (&demux->filter);
-    gst_flups_demux_mark_discont (demux, TRUE, FALSE);
+    gst_ps_demux_mark_discont (demux, TRUE, FALSE);
 
     /* mark discont on all streams */
     if (demux->sink_segment.rate >= 0.0) {
@@ -3116,7 +3141,7 @@
   /* align adapter data to sync boundary, we keep the data up to the next sync
    * point. */
   save = TRUE;
-  while (gst_flups_demux_resync (demux, save)) {
+  while (gst_ps_demux_resync (demux, save)) {
     gboolean ps_sync = TRUE;
     if (G_UNLIKELY (demux->flushing)) {
       ret = GST_FLOW_FLUSHING;
@@ -3126,10 +3151,10 @@
     /* now switch on last synced byte */
     switch (demux->last_sync_code) {
       case ID_PS_PACK_START_CODE:
-        ret = gst_flups_demux_parse_pack_start (demux);
+        ret = gst_ps_demux_parse_pack_start (demux);
         break;
       case ID_PS_SYSTEM_HEADER_START_CODE:
-        ret = gst_flups_demux_parse_sys_head (demux);
+        ret = gst_ps_demux_parse_sys_head (demux);
         break;
       case ID_PS_END_CODE:
         /* Skip final 4 bytes */
@@ -3138,10 +3163,10 @@
         ret = GST_FLOW_OK;
         goto done;
       case ID_PS_PROGRAM_STREAM_MAP:
-        ret = gst_flups_demux_parse_psm (demux);
+        ret = gst_ps_demux_parse_psm (demux);
         break;
       default:
-        if (gst_flups_demux_is_pes_sync (demux->last_sync_code)) {
+        if (gst_ps_demux_is_pes_sync (demux->last_sync_code)) {
           ret = gst_pes_filter_process (&demux->filter);
         } else {
           GST_DEBUG_OBJECT (demux, "sync_code=%08x, non PES sync found"
@@ -3174,7 +3199,7 @@
         ret = GST_FLOW_OK;
         break;
       default:
-        ret = gst_flups_demux_combine_flows (demux, ret);
+        ret = gst_ps_demux_combine_flows (demux, ret);
         if (ret != GST_FLOW_OK)
           goto done;
         break;
@@ -3185,9 +3210,9 @@
 }
 
 static GstStateChangeReturn
-gst_flups_demux_change_state (GstElement * element, GstStateChange transition)
+gst_ps_demux_change_state (GstElement * element, GstStateChange transition)
 {
-  GstFluPSDemux *demux = GST_FLUPS_DEMUX (element);
+  GstPsDemux *demux = GST_PS_DEMUX (element);
   GstStateChangeReturn result;
 
   switch (transition) {
@@ -3195,8 +3220,8 @@
       gst_pes_filter_init (&demux->filter, demux->adapter,
           &demux->adapter_offset);
       gst_pes_filter_set_callbacks (&demux->filter,
-          (GstPESFilterData) gst_flups_demux_data_cb,
-          (GstPESFilterResync) gst_flups_demux_resync_cb, demux);
+          (GstPESFilterData) gst_ps_demux_data_cb,
+          (GstPESFilterResync) gst_ps_demux_resync_cb, demux);
       demux->filter.gather_pes = TRUE;
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
@@ -3209,7 +3234,7 @@
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
-      gst_flups_demux_reset (demux);
+      gst_ps_demux_reset (demux);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       gst_pes_filter_uninit (&demux->filter);
diff --git a/gst/mpegdemux/gstmpegdemux.h b/gst/mpegdemux/gstmpegdemux.h
index dcc1505..9e4501d 100644
--- a/gst/mpegdemux/gstmpegdemux.h
+++ b/gst/mpegdemux/gstmpegdemux.h
@@ -42,8 +42,8 @@
  *                 Jan Schmidt <thaytan@noraisin.net>
  */
 
-#ifndef __GST_FLUPS_DEMUX_H__
-#define __GST_FLUPS_DEMUX_H__
+#ifndef __GST_PS_DEMUX_H__
+#define __GST_PS_DEMUX_H__
 
 #include <gst/gst.h>
 #include <gst/base/gstadapter.h>
@@ -53,39 +53,39 @@
 
 G_BEGIN_DECLS
 
-#define GST_TYPE_FLUPS_DEMUX		(gst_flups_demux_get_type())
-#define GST_FLUPS_DEMUX(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FLUPS_DEMUX,GstFluPSDemux))
-#define GST_FLUPS_DEMUX_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FLUPS_DEMUX,GstFluPSDemuxClass))
-#define GST_FLUPS_DEMUX_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS((klass),GST_TYPE_FLUPS_DEMUX,GstFluPSDemuxClass))
-#define GST_IS_FLUPS_DEMUX(obj)		(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FLUPS_DEMUX))
-#define GST_IS_FLUPS_DEMUX_CLASS(obj)	(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLUPS_DEMUX))
+#define GST_TYPE_PS_DEMUX		(gst_ps_demux_get_type())
+#define GST_PS_DEMUX(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PS_DEMUX,GstPsDemux))
+#define GST_PS_DEMUX_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PS_DEMUX,GstPsDemuxClass))
+#define GST_PS_DEMUX_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS((klass),GST_TYPE_PS_DEMUX,GstPsDemuxClass))
+#define GST_IS_PS_DEMUX(obj)		(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PS_DEMUX))
+#define GST_IS_PS_DEMUX_CLASS(obj)	(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PS_DEMUX))
 
-typedef struct _GstFluPSStream GstFluPSStream;
-typedef struct _GstFluPSDemux GstFluPSDemux;
-typedef struct _GstFluPSDemuxClass GstFluPSDemuxClass;
+typedef struct _GstPsStream GstPsStream;
+typedef struct _GstPsDemux GstPsDemux;
+typedef struct _GstPsDemuxClass GstPsDemuxClass;
 
-#define GST_FLUPS_DEMUX_MAX_STREAMS	256
-#define GST_FLUPS_DEMUX_MAX_PSM		256
+#define GST_PS_DEMUX_MAX_STREAMS	256
+#define GST_PS_DEMUX_MAX_PSM		256
 
 #define MAX_DVD_AUDIO_STREAMS       8
 #define MAX_DVD_SUBPICTURE_STREAMS  32
 
 typedef enum
 {
-  GST_FLUPS_DEMUX_SYNC_AUTO = 0,
-  GST_FLUPS_DEMUX_SYNC_SCR = 1,
-  GST_FLUPS_DEMUX_SYNC_DTS = 2
-} GstFluPSDemuxSync;
+  GST_PS_DEMUX_SYNC_AUTO = 0,
+  GST_PS_DEMUX_SYNC_SCR = 1,
+  GST_PS_DEMUX_SYNC_DTS = 2
+} GstPsDemuxSync;
 
 typedef enum
 {
-  STATE_FLUPS_DEMUX_NEED_SYNC,
-  STATE_FLUPS_DEMUX_SYNCED,
-  STATE_FLUPS_DEMUX_NEED_MORE_DATA,
-} GstFluPSDemuxState;
+  STATE_PS_DEMUX_NEED_SYNC,
+  STATE_PS_DEMUX_SYNCED,
+  STATE_PS_DEMUX_NEED_MORE_DATA,
+} GstPsDemuxState;
 
 /* Information associated with a single FluPS stream. */
-struct _GstFluPSStream
+struct _GstPsStream
 {
   GstPad *pad;
 
@@ -102,7 +102,7 @@
   GstTagList *pending_tags;
 };
 
-struct _GstFluPSDemux
+struct _GstPsDemux
 {
   GstElement parent;
 
@@ -137,18 +137,18 @@
   guint64 first_pts;
   guint64 last_pts;
 
-  gint16 psm[GST_FLUPS_DEMUX_MAX_PSM];
+  gint16 psm[GST_PS_DEMUX_MAX_PSM];
 
   GstSegment sink_segment;
   GstSegment src_segment;
   gboolean adjust_segment;
 
   /* stream output */
-  GstFluPSStream *current_stream;
+  GstPsStream *current_stream;
   guint64 next_pts;
   guint64 next_dts;
-  GstFluPSStream **streams;
-  GstFluPSStream **streams_found;
+  GstPsStream **streams;
+  GstPsStream **streams_found;
   gint found_count;
   gboolean need_no_more_pads;
 
@@ -158,7 +158,7 @@
   gboolean is_mpeg2_pack;
 };
 
-struct _GstFluPSDemuxClass
+struct _GstPsDemuxClass
 {
   GstElementClass parent_class;
 
@@ -169,7 +169,7 @@
   GstPadTemplate *private_template;
 };
 
-GType gst_flups_demux_get_type (void);
+GType gst_ps_demux_get_type (void);
 
 G_END_DECLS
-#endif /* __GST_FLUPS_DEMUX_H__ */
+#endif /* __GST_PS_DEMUX_H__ */
diff --git a/gst/mpegdemux/plugin.c b/gst/mpegdemux/plugin.c
index 59e7c30..4d0bca2 100644
--- a/gst/mpegdemux/plugin.c
+++ b/gst/mpegdemux/plugin.c
@@ -56,7 +56,7 @@
       "MPEG-PS PES filter");
 
   if (!gst_element_register (plugin, "mpegpsdemux", GST_RANK_PRIMARY,
-          GST_TYPE_FLUPS_DEMUX))
+          GST_TYPE_PS_DEMUX))
     return FALSE;
 
   return TRUE;
diff --git a/gst/mpegpsmux/Makefile.in b/gst/mpegpsmux/Makefile.in
index 60a0ffc..eed4af9 100644
--- a/gst/mpegpsmux/Makefile.in
+++ b/gst/mpegpsmux/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/mpegpsmux/crc.h b/gst/mpegpsmux/crc.h
index 35fb3e2..532b797 100644
--- a/gst/mpegpsmux/crc.h
+++ b/gst/mpegpsmux/crc.h
@@ -40,7 +40,7 @@
  * SOFTWARE.
  */
 
-static guint32 crc_tab[256] = {
+static const guint32 crc_tab[256] = {
   0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
   0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
   0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
diff --git a/gst/mpegpsmux/psmuxstream.c b/gst/mpegpsmux/psmuxstream.c
index 43f7070..22026a1 100644
--- a/gst/mpegpsmux/psmuxstream.c
+++ b/gst/mpegpsmux/psmuxstream.c
@@ -190,8 +190,8 @@
       stream->max_buffer_size = 400 * 1024;
     else if (stream->is_audio_stream)
       stream->max_buffer_size = 4 * 1024;
-    else                        /* Unknown */
-      stream->max_buffer_size = 4 * 1024;
+    else
+      g_assert_not_reached ();
   }
 
   return stream;
diff --git a/gst/mpegtsdemux/Makefile.in b/gst/mpegtsdemux/Makefile.in
index d127817..fd3b57a 100644
--- a/gst/mpegtsdemux/Makefile.in
+++ b/gst/mpegtsdemux/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -252,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -292,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -300,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -349,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -429,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -438,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -451,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -476,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -549,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -578,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -614,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -654,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -681,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c
index 1df1d76..117b975 100644
--- a/gst/mpegtsdemux/mpegtsbase.c
+++ b/gst/mpegtsdemux/mpegtsbase.c
@@ -1152,6 +1152,9 @@
       goto next;
     }
 
+    if (klass->inspect_packet)
+      klass->inspect_packet (base, &packet);
+
     /* If it's a known PES, push it */
     if (MPEGTS_BIT_IS_SET (base->is_pes, packet.pid)) {
       /* push the packet downstream */
@@ -1202,7 +1205,7 @@
   gboolean done = FALSE;
   MpegTSPacketizerPacketReturn pret;
   gint64 tmpval;
-  gint64 upstream_size, seek_pos;
+  gint64 upstream_size, seek_pos, reverse_limit;
   GstFormat format;
   guint initial_pcr_seen;
 
@@ -1210,7 +1213,7 @@
 
   /* Find initial sync point and at least 5 PCR values */
   for (i = 0; i < 20 && !done; i++) {
-    GST_DEBUG ("Grabbing %d => %d", i * 65536, 65536);
+    GST_DEBUG ("Grabbing %d => %d", i * 65536, (i + 1) * 65536);
 
     ret = gst_pad_pull_range (base->sinkpad, i * 65536, 65536, &buf);
     if (G_UNLIKELY (ret == GST_FLOW_EOS))
@@ -1249,7 +1252,6 @@
   GST_DEBUG ("Seen %d initial PCR", initial_pcr_seen);
 
   /* Now send data from the end */
-  mpegts_packetizer_clear (base->packetizer);
 
   /* Get the size of upstream */
   format = GST_FORMAT_BYTES;
@@ -1258,12 +1260,19 @@
   upstream_size = tmpval;
   done = FALSE;
 
-  /* Find last PCR value */
-  for (seek_pos = MAX (0, upstream_size - 655360);
-      seek_pos < upstream_size && !done; seek_pos += 65536) {
-    GST_DEBUG ("Grabbing %" G_GUINT64_FORMAT " => %d", seek_pos, 65536);
+  /* The scanning takes place on the last 2048kB. Considering PCR should
+   * be present at least every 100ms, this should cope with streams
+   * up to 160Mbit/s */
+  reverse_limit = MAX (0, upstream_size - 2097152);
 
-    ret = gst_pad_pull_range (base->sinkpad, seek_pos, 65536, &buf);
+  /* Find last PCR value, searching backwards by chunks of 300 MPEG-ts packets */
+  for (seek_pos = MAX (0, upstream_size - 56400);
+      seek_pos >= reverse_limit && !done; seek_pos -= 56400) {
+    mpegts_packetizer_clear (base->packetizer);
+    GST_DEBUG ("Grabbing %" G_GUINT64_FORMAT " => %" G_GUINT64_FORMAT, seek_pos,
+        seek_pos + 56400);
+
+    ret = gst_pad_pull_range (base->sinkpad, seek_pos, 56400, &buf);
     if (G_UNLIKELY (ret == GST_FLOW_EOS))
       break;
     if (G_UNLIKELY (ret != GST_FLOW_OK))
@@ -1274,17 +1283,16 @@
     buf = NULL;
 
     if (mpegts_packetizer_has_packets (base->packetizer)) {
-      while (1) {
-        /* Eat up all packets */
+      pret = PACKET_OK;
+      /* Eat up all packets, really try to get last PCR(s) */
+      while (pret != PACKET_NEED_MORE)
         pret = mpegts_packetizer_process_next_packet (base->packetizer);
-        if (pret == PACKET_NEED_MORE)
-          break;
-        if (pret != PACKET_BAD &&
-            base->packetizer->nb_seen_offsets > initial_pcr_seen) {
-          GST_DEBUG ("Got last PCR");
-          done = TRUE;
-          break;
-        }
+
+      if (base->packetizer->nb_seen_offsets > initial_pcr_seen) {
+        GST_DEBUG ("Got last PCR(s) (total seen:%d)",
+            base->packetizer->nb_seen_offsets);
+        done = TRUE;
+        break;
       }
     }
   }
diff --git a/gst/mpegtsdemux/mpegtsbase.h b/gst/mpegtsdemux/mpegtsbase.h
index 6b2d7d3..c427bd7 100644
--- a/gst/mpegtsdemux/mpegtsbase.h
+++ b/gst/mpegtsdemux/mpegtsbase.h
@@ -166,6 +166,7 @@
   /* Virtual methods */
   void (*reset) (MpegTSBase *base);
   GstFlowReturn (*push) (MpegTSBase *base, MpegTSPacketizerPacket *packet, GstMpegtsSection * section);
+  void (*inspect_packet) (MpegTSBase *base, MpegTSPacketizerPacket *packet);
   /* takes ownership of @event */
   gboolean (*push_event) (MpegTSBase *base, GstEvent * event);
 
diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c
index 84cc72e..f4d3a58 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.c
+++ b/gst/mpegtsdemux/mpegtspacketizer.c
@@ -50,8 +50,8 @@
 
 static void mpegts_packetizer_dispose (GObject * object);
 static void mpegts_packetizer_finalize (GObject * object);
-static GstClockTime calculate_skew (MpegTSPCR * pcr, guint64 pcrtime,
-    GstClockTime time);
+static GstClockTime calculate_skew (MpegTSPacketizer2 * packetizer,
+    MpegTSPCR * pcr, guint64 pcrtime, GstClockTime time);
 static void _close_current_group (MpegTSPCR * pcrtable);
 static void record_pcr (MpegTSPacketizer2 * packetizer, MpegTSPCR * pcrtable,
     guint64 pcr, guint64 offset);
@@ -121,6 +121,19 @@
   packetizer->lastobsid = 0;
 }
 
+GstClockTime
+mpegts_packetizer_get_current_time (MpegTSPacketizer2 * packetizer,
+    guint16 pcr_pid)
+{
+  MpegTSPCR *pcrtable = get_pcr_table (packetizer, pcr_pid);
+
+  if (pcrtable == NULL)
+    return GST_CLOCK_TIME_NONE;
+
+  return mpegts_packetizer_pts_to_ts (packetizer, pcrtable->last_pcrtime,
+      pcr_pid);
+}
+
 static inline MpegTSPacketizerStreamSubtable *
 find_subtable (GSList * subtables, guint8 table_id, guint16 subtable_extension)
 {
@@ -259,6 +272,7 @@
   packetizer->nb_seen_offsets = 0;
   packetizer->refoffset = -1;
   packetizer->last_in_time = GST_CLOCK_TIME_NONE;
+  packetizer->pcr_discont_threshold = GST_SECOND;
 }
 
 static void
@@ -384,7 +398,8 @@
     if (packetizer->calculate_skew
         && GST_CLOCK_TIME_IS_VALID (packetizer->last_in_time)) {
       pcrtable = get_pcr_table (packetizer, packet->pid);
-      calculate_skew (pcrtable, packet->pcr, packetizer->last_in_time);
+      calculate_skew (packetizer, pcrtable, packet->pcr,
+          packetizer->last_in_time);
     }
     if (packetizer->calculate_offset) {
       if (!pcrtable)
@@ -1038,7 +1053,7 @@
 
   /* We have more data to process ... */
   GST_DEBUG ("PID 0x%04x, More section present in packet (remaining bytes:%"
-      G_GSIZE_FORMAT ")", stream->pid, packet->data_end - data);
+      G_GSIZE_FORMAT ")", stream->pid, (gsize) (packet->data_end - data));
 
 section_start:
   GST_MEMDUMP ("section_start", data, packet->data_end - data);
@@ -1270,7 +1285,8 @@
  * Returns: @time adjusted with the clock skew.
  */
 static GstClockTime
-calculate_skew (MpegTSPCR * pcr, guint64 pcrtime, GstClockTime time)
+calculate_skew (MpegTSPacketizer2 * packetizer,
+    MpegTSPCR * pcr, guint64 pcrtime, GstClockTime time)
 {
   guint64 send_diff, recv_diff;
   gint64 delta;
@@ -1308,7 +1324,8 @@
       send_diff = gstpcrtime - pcr->base_pcrtime;
     } else if (GST_CLOCK_TIME_IS_VALID (time)
         && pcr->last_pcrtime - gstpcrtime > 15 * GST_SECOND) {
-      /* Assume a reset */
+      /* Time jumped backward by > 15 seconds, and we have a timestamp
+       * to use to close the discont. Assume a reset */
       GST_DEBUG ("PCR reset");
       /* Calculate PCR we would have expected for the given input time,
        * essentially applying the reverse correction process
@@ -1335,10 +1352,22 @@
           " corrected pcr time %" GST_TIME_FORMAT,
           GST_TIME_ARGS (pcr->pcroffset), GST_TIME_ARGS (gstpcrtime));
     } else {
-      GST_WARNING ("backward timestamps at server but no timestamps");
+      /* Small jumps backward, assume some arrival jitter and skip it */
       send_diff = 0;
-      /* at least try to get a new timestamp.. */
-      pcr->base_time = GST_CLOCK_TIME_NONE;
+
+      if (pcr->last_pcrtime - gstpcrtime < GST_SECOND) {
+        GST_WARNING
+            ("(small) backward timestamps at server or no buffer timestamps. Ignoring.");
+        /* This will trigger the no_skew logic before but leave other state
+         * intact */
+        time = GST_CLOCK_TIME_NONE;
+      } else {
+        /* A bigger backward step than packet out-of-order can account for. Reset base PCR time
+         * to be resynched the next time we see a PCR */
+        GST_WARNING
+            ("backward timestamps at server or no buffer timestamps. Resync base PCR");
+        pcr->base_pcrtime = GST_CLOCK_TIME_NONE;
+      }
     }
   } else
     send_diff = gstpcrtime - pcr->base_pcrtime;
@@ -1383,7 +1412,7 @@
   /* if the difference between the sender timeline and the receiver timeline
    * changed too quickly we have to resync because the server likely restarted
    * its timestamps. */
-  if (ABS (delta - pcr->skew) > GST_SECOND) {
+  if (ABS (delta - pcr->skew) > packetizer->pcr_discont_threshold) {
     GST_WARNING ("delta - skew: %" GST_TIME_FORMAT " too big, reset skew",
         GST_TIME_ARGS (delta - pcr->skew));
     mpegts_packetizer_resync (pcr, time, gstpcrtime, TRUE);
@@ -1582,8 +1611,8 @@
         GST_DEBUG ("Previous group bitrate (%" G_GUINT64_FORMAT " / %"
             GST_TIME_FORMAT ") : %" G_GUINT64_FORMAT,
             current->pending[current->last].offset,
-            GST_TIME_ARGS (PCRTIME_TO_GSTTIME (current->pending[current->
-                        last].pcr)), prevbr);
+            GST_TIME_ARGS (PCRTIME_TO_GSTTIME (current->pending[current->last].
+                    pcr)), prevbr);
       } else if (prev->values[prev->last_value].offset) {
         prevoffset = prev->values[prev->last_value].offset + prev->first_offset;
         prevpcr = prev->values[prev->last_value].pcr + prev->first_pcr;
@@ -1595,8 +1624,8 @@
         GST_DEBUG ("Previous group bitrate (%" G_GUINT64_FORMAT " / %"
             GST_TIME_FORMAT ") : %" G_GUINT64_FORMAT,
             prev->values[prev->last_value].offset,
-            GST_TIME_ARGS (PCRTIME_TO_GSTTIME (prev->values[prev->
-                        last_value].pcr)), prevbr);
+            GST_TIME_ARGS (PCRTIME_TO_GSTTIME (prev->values[prev->last_value].
+                    pcr)), prevbr);
       } else {
         GST_DEBUG ("Using overall bitrate");
         prevoffset = prev->values[prev->last_value].offset + prev->first_offset;
@@ -1874,6 +1903,7 @@
 
   packetizer->nb_seen_offsets += 1;
 
+  pcrtable->last_pcrtime = PCRTIME_TO_GSTTIME (pcr);
   /* FIXME : Invert logic later (probability is higher that we have a
    * current estimator) */
 
@@ -1904,9 +1934,8 @@
           group->first_offset,
           GST_TIME_ARGS (PCRTIME_TO_GSTTIME (group->pcr_offset)));
       GST_DEBUG ("Last PCR: +%" GST_TIME_FORMAT " offset: +%" G_GUINT64_FORMAT,
-          GST_TIME_ARGS (PCRTIME_TO_GSTTIME (group->values[group->
-                      last_value].pcr)),
-          group->values[group->last_value].offset);
+          GST_TIME_ARGS (PCRTIME_TO_GSTTIME (group->values[group->last_value].
+                  pcr)), group->values[group->last_value].offset);
       /* Check if before group */
       if (offset < group->first_offset) {
         GST_DEBUG ("offset is before that group");
@@ -2403,6 +2432,15 @@
 }
 
 void
+mpegts_packetizer_set_pcr_discont_threshold (MpegTSPacketizer2 * packetizer,
+    GstClockTime threshold)
+{
+  PACKETIZER_GROUP_LOCK (packetizer);
+  packetizer->pcr_discont_threshold = threshold;
+  PACKETIZER_GROUP_UNLOCK (packetizer);
+}
+
+void
 mpegts_packetizer_set_current_pcr_offset (MpegTSPacketizer2 * packetizer,
     GstClockTime offset, guint16 pcr_pid)
 {
diff --git a/gst/mpegtsdemux/mpegtspacketizer.h b/gst/mpegtsdemux/mpegtspacketizer.h
index f107b80..be8bf37 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.h
+++ b/gst/mpegtsdemux/mpegtspacketizer.h
@@ -282,6 +282,7 @@
   guint8 pcrtablelut[0x2000];
   MpegTSPCR *observations[MAX_PCR_OBS_CHANNELS];
   guint8 lastobsid;
+  GstClockTime pcr_discont_threshold;
 };
 
 struct _MpegTSPacketizer2Class {
@@ -365,12 +366,18 @@
 G_GNUC_INTERNAL GstClockTime
 mpegts_packetizer_pts_to_ts (MpegTSPacketizer2 * packetizer,
 			     GstClockTime pts, guint16 pcr_pid);
+G_GNUC_INTERNAL GstClockTime
+mpegts_packetizer_get_current_time (MpegTSPacketizer2 * packetizer,
+				    guint16 pcr_pid);
 G_GNUC_INTERNAL void
 mpegts_packetizer_set_current_pcr_offset (MpegTSPacketizer2 * packetizer,
 			  GstClockTime offset, guint16 pcr_pid);
 G_GNUC_INTERNAL void
 mpegts_packetizer_set_reference_offset (MpegTSPacketizer2 * packetizer,
 					guint64 refoffset);
+G_GNUC_INTERNAL void
+mpegts_packetizer_set_pcr_discont_threshold (MpegTSPacketizer2 * packetizer,
+					GstClockTime threshold);
 G_END_DECLS
 
 #endif /* GST_MPEGTS_PACKETIZER_H */
diff --git a/gst/mpegtsdemux/mpegtsparse.c b/gst/mpegtsdemux/mpegtsparse.c
index 87281b2..d306e48 100644
--- a/gst/mpegtsdemux/mpegtsparse.c
+++ b/gst/mpegtsdemux/mpegtsparse.c
@@ -34,8 +34,8 @@
 #include "mpegtsparse.h"
 #include "gstmpegdesc.h"
 
-/* latency in mseconds */
-#define TS_LATENCY 700
+/* latency in mseconds is maximum 100 ms between PCR */
+#define TS_LATENCY 100
 
 #define TABLE_ID_UNSET 0xFF
 #define RUNNING_STATUS_RUNNING 4
@@ -80,10 +80,18 @@
 
 enum
 {
-  ARG_0,
+  PROP_0,
+  PROP_SET_TIMESTAMPS,
+  PROP_SMOOTHING_LATENCY,
+  PROP_PCR_PID,
   /* FILL ME */
 };
 
+static void mpegts_parse_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void mpegts_parse_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
 static void
 mpegts_parse_program_started (MpegTSBase * base, MpegTSBaseProgram * program);
 static void
@@ -92,6 +100,8 @@
 static GstFlowReturn
 mpegts_parse_push (MpegTSBase * base, MpegTSPacketizerPacket * packet,
     GstMpegtsSection * section);
+static void mpegts_parse_inspect_packet (MpegTSBase * base,
+    MpegTSPacketizerPacket * packet);
 
 static MpegTSParsePad *mpegts_parse_create_tspad (MpegTSParse2 * parse,
     const gchar * name);
@@ -111,13 +121,34 @@
 static void mpegts_parse_reset (MpegTSBase * base);
 static GstFlowReturn mpegts_parse_input_done (MpegTSBase * base,
     GstBuffer * buffer);
+static GstFlowReturn
+drain_pending_buffers (MpegTSParse2 * parse, gboolean drain_all);
 
 static void
 mpegts_parse_class_init (MpegTSParse2Class * klass)
 {
+  GObjectClass *gobject_class = (GObjectClass *) (klass);
   GstElementClass *element_class;
   MpegTSBaseClass *ts_class;
 
+  gobject_class->set_property = mpegts_parse_set_property;
+  gobject_class->get_property = mpegts_parse_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_SET_TIMESTAMPS,
+      g_param_spec_boolean ("set-timestamps",
+          "Timestamp (or re-timestamp) the output stream",
+          "If set, timestamps will be set on the output buffers using "
+          "PCRs and smoothed over the smoothing-latency period", FALSE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SMOOTHING_LATENCY,
+      g_param_spec_uint ("smoothing-latency", "Smoothing Latency",
+          "Additional latency in microseconds for smoothing jitter in input timestamps on live capture",
+          0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_PCR_PID,
+      g_param_spec_int ("pcr-pid", "PID containing PCR",
+          "Set the PID to use for PCR values (-1 for auto)",
+          -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   element_class = GST_ELEMENT_CLASS (klass);
   element_class->pad_removed = mpegts_parse_pad_removed;
   element_class->request_new_pad = mpegts_parse_request_new_pad;
@@ -141,6 +172,7 @@
   ts_class->program_stopped = GST_DEBUG_FUNCPTR (mpegts_parse_program_stopped);
   ts_class->reset = GST_DEBUG_FUNCPTR (mpegts_parse_reset);
   ts_class->input_done = GST_DEBUG_FUNCPTR (mpegts_parse_input_done);
+  ts_class->inspect_packet = GST_DEBUG_FUNCPTR (mpegts_parse_inspect_packet);
 }
 
 static void
@@ -153,8 +185,12 @@
   base->push_data = FALSE;
   base->push_section = FALSE;
 
+  parse->user_pcr_pid = parse->pcr_pid = -1;
+
   parse->srcpad = gst_pad_new_from_static_template (&src_template, "src");
   parse->first = TRUE;
+  gst_pad_set_query_function (parse->srcpad,
+      GST_DEBUG_FUNCPTR (mpegts_parse_src_pad_query));
   gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad);
 
   parse->have_group_id = FALSE;
@@ -164,6 +200,8 @@
 static void
 mpegts_parse_reset (MpegTSBase * base)
 {
+  MpegTSParse2 *parse = (MpegTSParse2 *) base;
+
   /* Set the various know PIDs we are interested in */
 
   /* CAT */
@@ -187,58 +225,122 @@
   /* SIT */
   MPEGTS_BIT_SET (base->known_psi, 0x1f);
 
-  GST_MPEGTS_PARSE (base)->first = TRUE;
-  GST_MPEGTS_PARSE (base)->have_group_id = FALSE;
-  GST_MPEGTS_PARSE (base)->group_id = G_MAXUINT;
+  parse->first = TRUE;
+  parse->have_group_id = FALSE;
+  parse->group_id = G_MAXUINT;
 
-  g_list_free_full (GST_MPEGTS_PARSE (base)->pending_buffers,
-      (GDestroyNotify) gst_buffer_unref);
-  GST_MPEGTS_PARSE (base)->pending_buffers = NULL;;
+  g_list_free_full (parse->pending_buffers, (GDestroyNotify) gst_buffer_unref);
+  parse->pending_buffers = NULL;
+
+  parse->current_pcr = GST_CLOCK_TIME_NONE;
+  parse->previous_pcr = GST_CLOCK_TIME_NONE;
+  parse->bytes_since_pcr = 0;
+  parse->pcr_pid = parse->user_pcr_pid;
 }
 
 static void
+mpegts_parse_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  MpegTSParse2 *parse = (MpegTSParse2 *) object;
+
+  switch (prop_id) {
+    case PROP_SET_TIMESTAMPS:
+      parse->set_timestamps = g_value_get_boolean (value);
+      break;
+    case PROP_SMOOTHING_LATENCY:
+      parse->smoothing_latency = GST_USECOND * g_value_get_uint (value);
+      mpegts_packetizer_set_pcr_discont_threshold (GST_MPEGTS_BASE
+          (parse)->packetizer, parse->smoothing_latency);
+      break;
+    case PROP_PCR_PID:
+      parse->pcr_pid = parse->user_pcr_pid = g_value_get_int (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
+}
+
+static void
+mpegts_parse_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  MpegTSParse2 *parse = (MpegTSParse2 *) object;
+
+  switch (prop_id) {
+    case PROP_SET_TIMESTAMPS:
+      g_value_set_boolean (value, parse->set_timestamps);
+      break;
+    case PROP_SMOOTHING_LATENCY:
+      g_value_set_uint (value, parse->smoothing_latency / GST_USECOND);
+      break;
+    case PROP_PCR_PID:
+      g_value_set_int (value, parse->pcr_pid);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+  }
+}
+
+static gboolean
 prepare_src_pad (MpegTSBase * base, MpegTSParse2 * parse)
 {
-  if (base->packetizer->packet_size) {
-    GstEvent *event;
-    gchar *stream_id;
-    GstCaps *caps;
+  GstEvent *event;
+  gchar *stream_id;
+  GstCaps *caps;
 
-    stream_id =
-        gst_pad_create_stream_id (parse->srcpad, GST_ELEMENT_CAST (base),
-        "multi-program");
+  if (!parse->first)
+    return TRUE;
 
-    event =
-        gst_pad_get_sticky_event (parse->parent.sinkpad, GST_EVENT_STREAM_START,
-        0);
-    if (event) {
-      if (gst_event_parse_group_id (event, &parse->group_id))
-        parse->have_group_id = TRUE;
-      else
-        parse->have_group_id = FALSE;
-      gst_event_unref (event);
-    } else if (!parse->have_group_id) {
+  /* If there's no packet_size yet, we can't set caps yet */
+  if (G_UNLIKELY (base->packetizer->packet_size == 0))
+    return FALSE;
+
+  stream_id =
+      gst_pad_create_stream_id (parse->srcpad, GST_ELEMENT_CAST (base),
+      "multi-program");
+
+  event =
+      gst_pad_get_sticky_event (parse->parent.sinkpad, GST_EVENT_STREAM_START,
+      0);
+  if (event) {
+    if (gst_event_parse_group_id (event, &parse->group_id))
       parse->have_group_id = TRUE;
-      parse->group_id = gst_util_group_id_next ();
-    }
-    event = gst_event_new_stream_start (stream_id);
-    if (parse->have_group_id)
-      gst_event_set_group_id (event, parse->group_id);
-
-    gst_pad_push_event (parse->srcpad, event);
-    g_free (stream_id);
-
-    caps = gst_caps_new_simple ("video/mpegts",
-        "systemstream", G_TYPE_BOOLEAN, TRUE,
-        "packetsize", G_TYPE_INT, base->packetizer->packet_size, NULL);
-
-    gst_pad_set_caps (parse->srcpad, caps);
-    gst_caps_unref (caps);
-
-    gst_pad_push_event (parse->srcpad, gst_event_new_segment (&base->segment));
-
-    parse->first = FALSE;
+    else
+      parse->have_group_id = FALSE;
+    gst_event_unref (event);
+  } else if (!parse->have_group_id) {
+    parse->have_group_id = TRUE;
+    parse->group_id = gst_util_group_id_next ();
   }
+  event = gst_event_new_stream_start (stream_id);
+  if (parse->have_group_id)
+    gst_event_set_group_id (event, parse->group_id);
+
+  gst_pad_push_event (parse->srcpad, event);
+  g_free (stream_id);
+
+  caps = gst_caps_new_simple ("video/mpegts",
+      "systemstream", G_TYPE_BOOLEAN, TRUE,
+      "packetsize", G_TYPE_INT, base->packetizer->packet_size, NULL);
+
+  gst_pad_set_caps (parse->srcpad, caps);
+  gst_caps_unref (caps);
+
+  /* If setting output timestamps, ensure that the output segment is TIME */
+  if (parse->set_timestamps == FALSE || base->segment.format == GST_FORMAT_TIME)
+    gst_pad_push_event (parse->srcpad, gst_event_new_segment (&base->segment));
+  else {
+    GstSegment seg;
+    gst_segment_init (&seg, GST_FORMAT_TIME);
+    GST_DEBUG_OBJECT (parse,
+        "Generating time output segment %" GST_SEGMENT_FORMAT, &seg);
+    gst_pad_push_event (parse->srcpad, gst_event_new_segment (&seg));
+  }
+
+  parse->first = FALSE;
+
+  return TRUE;
 }
 
 static gboolean
@@ -255,6 +357,8 @@
     }
     prepare_src_pad (base, parse);
   }
+  if (G_UNLIKELY (GST_EVENT_TYPE (event) == GST_EVENT_EOS))
+    drain_pending_buffers (parse, TRUE);
 
   for (tmp = parse->srcpads; tmp; tmp = tmp->next) {
     GstPad *pad = (GstPad *) tmp->data;
@@ -559,39 +663,210 @@
   return ret;
 }
 
+static void
+mpegts_parse_inspect_packet (MpegTSBase * base, MpegTSPacketizerPacket * packet)
+{
+  MpegTSParse2 *parse = GST_MPEGTS_PARSE (base);
+  GST_LOG ("pid 0x%04x pusi:%d, afc:%d, cont:%d, payload:%p PCR %"
+      G_GUINT64_FORMAT, packet->pid, packet->payload_unit_start_indicator,
+      packet->scram_afc_cc & 0x30,
+      FLAGS_CONTINUITY_COUNTER (packet->scram_afc_cc), packet->payload,
+      packet->pcr);
+
+  /* Store the PCR if desired */
+  if (parse->current_pcr == GST_CLOCK_TIME_NONE &&
+      packet->afc_flags & MPEGTS_AFC_PCR_FLAG) {
+    /* Take this as the pcr_pid if set to auto-select */
+    if (parse->pcr_pid == -1)
+      parse->pcr_pid = packet->pid;
+    /* Check the PCR-PID matches the program we want for multiple programs */
+    if (parse->pcr_pid == packet->pid)
+      parse->current_pcr = PCRTIME_TO_GSTTIME (packet->pcr);
+  }
+}
+
+static GstClockTime
+get_pending_timestamp_diff (MpegTSParse2 * parse)
+{
+  GList *l;
+  GstClockTime first_ts, last_ts;
+
+  if (parse->pending_buffers == NULL)
+    return GST_CLOCK_TIME_NONE;
+
+  l = g_list_last (parse->pending_buffers);
+  first_ts = GST_BUFFER_PTS (l->data);
+  if (first_ts == GST_CLOCK_TIME_NONE)
+    return GST_CLOCK_TIME_NONE;
+
+  l = g_list_first (parse->pending_buffers);
+  last_ts = GST_BUFFER_PTS (l->data);
+  if (last_ts == GST_CLOCK_TIME_NONE)
+    return GST_CLOCK_TIME_NONE;
+
+  return last_ts - first_ts;
+}
+
+static GstFlowReturn
+drain_pending_buffers (MpegTSParse2 * parse, gboolean drain_all)
+{
+  MpegTSBase *base = (MpegTSBase *) (parse);
+  GstFlowReturn ret = GST_FLOW_OK;
+  GstClockTime start_ts;
+  GstClockTime pcr = GST_CLOCK_TIME_NONE;
+  GstClockTime pcr_diff = 0;
+  gsize pcr_bytes, bytes_since_pcr, pos;
+  GstBuffer *buffer;
+  GList *l, *end = NULL;
+
+  if (parse->pending_buffers == NULL)
+    return GST_FLOW_OK;         /* Nothing to push */
+
+  /*
+   * There are 4 cases:
+   *  1 We get a buffer with no PCR -> it's the head of the list
+   *      -> Do nothing, unless it's EOS
+   *  2 We get a buffer with a PCR, it's the first PCR we've seen, and belongs
+   *    to the buffer at the head of the list
+   *    -> Push any buffers in the list except the head,
+   *       using a smoothing of their timestamps to land at the PCR
+   *    -> store new PCR as the previous PCR, bytes_since_pcr = sizeof (buffer);
+   *  3 It's EOS (drain_all == TRUE, current_pcr == NONE)
+   *    -> Push any buffers in the list using a smoothing of their timestamps
+   *       starting at the previous PCR or first TS
+   *  4 We get a buffer with a PCR, and have a previous PCR
+   *    -> If distance > smoothing_latency,
+   *       output buffers except the last in the pending queue using
+   *       piecewise-linear timestamps
+   *    -> store new PCR as the previous PCR, bytes_since_pcr = sizeof (buffer);
+   */
+
+  /* Case 1 */
+  if (!GST_CLOCK_TIME_IS_VALID (parse->current_pcr) && !drain_all)
+    return GST_FLOW_OK;
+
+  if (GST_CLOCK_TIME_IS_VALID (parse->current_pcr)) {
+    pcr = mpegts_packetizer_pts_to_ts (base->packetizer,
+        parse->current_pcr, parse->pcr_pid);
+    parse->current_pcr = GST_CLOCK_TIME_NONE;
+  }
+
+  /* The bytes of the last buffer are after the PCR */
+  buffer = GST_BUFFER (g_list_nth_data (parse->pending_buffers, 0));
+  bytes_since_pcr = gst_buffer_get_size (buffer);
+
+  pcr_bytes = parse->bytes_since_pcr - bytes_since_pcr;
+
+  if (!drain_all)
+    end = g_list_first (parse->pending_buffers);
+
+  /* Case 2 */
+  if (!GST_CLOCK_TIME_IS_VALID (parse->previous_pcr)) {
+    pcr_diff = get_pending_timestamp_diff (parse);
+
+    /* Calculate the start_ts that ends at the end timestamp */
+    start_ts = GST_CLOCK_TIME_NONE;
+    if (end) {
+      start_ts = GST_BUFFER_PTS (GST_BUFFER (end->data));
+      if (start_ts > pcr_diff)
+        start_ts -= pcr_diff;
+    }
+  } else if (drain_all) {       /* Case 3 */
+    start_ts = parse->previous_pcr;
+    pcr_diff = get_pending_timestamp_diff (parse);
+  } else {                      /* Case 4 */
+    start_ts = parse->previous_pcr;
+    if (GST_CLOCK_TIME_IS_VALID (pcr) && pcr > start_ts)
+      pcr_diff = GST_CLOCK_DIFF (start_ts, pcr);
+
+    /* Make sure PCR observations are sufficiently far apart */
+    if (drain_all == FALSE && pcr_diff < parse->smoothing_latency)
+      return GST_FLOW_OK;
+  }
+
+  GST_INFO_OBJECT (parse, "Pushing buffers - startTS %" GST_TIME_FORMAT
+      " duration %" GST_TIME_FORMAT " %" G_GSIZE_FORMAT " bytes",
+      GST_TIME_ARGS (start_ts), GST_TIME_ARGS (pcr_diff), pcr_bytes);
+
+  /* Now, push buffers out pacing timestamps over pcr_diff time and pcr_bytes */
+  pos = 0;
+  l = g_list_last (parse->pending_buffers);
+  while (l != end) {
+    GList *p;
+    GstClockTime out_ts = start_ts;
+
+    buffer = gst_buffer_make_writable (GST_BUFFER (l->data));
+
+    if (out_ts != GST_CLOCK_TIME_NONE && pcr_diff != GST_CLOCK_TIME_NONE &&
+        pcr_bytes && pos)
+      out_ts += gst_util_uint64_scale (pcr_diff, pos, pcr_bytes);
+
+    pos += gst_buffer_get_size (buffer);
+
+    GST_DEBUG_OBJECT (parse,
+        "InputTS %" GST_TIME_FORMAT " out %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (GST_BUFFER_PTS (buffer)), GST_TIME_ARGS (out_ts));
+
+    GST_BUFFER_PTS (buffer) = out_ts;
+    GST_BUFFER_DTS (buffer) = out_ts;
+    if (ret == GST_FLOW_OK)
+      ret = gst_pad_push (parse->srcpad, buffer);
+    else
+      gst_buffer_unref (buffer);
+
+    /* Free this list node and move to the next */
+    p = g_list_previous (l);
+    parse->pending_buffers = g_list_remove_link (parse->pending_buffers, l);
+    g_list_free_1 (l);
+    l = p;
+  }
+
+  parse->pending_buffers = end;
+  parse->bytes_since_pcr = bytes_since_pcr;
+  parse->previous_pcr = pcr;
+  return ret;
+}
+
 static GstFlowReturn
 mpegts_parse_input_done (MpegTSBase * base, GstBuffer * buffer)
 {
   MpegTSParse2 *parse = GST_MPEGTS_PARSE (base);
   GstFlowReturn ret = GST_FLOW_OK;
 
-  if (G_UNLIKELY (parse->first))
-    prepare_src_pad (base, parse);
+  GST_LOG_OBJECT (parse, "Received buffer %" GST_PTR_FORMAT, buffer);
 
-  if (G_UNLIKELY (parse->first)) {
-    parse->pending_buffers = g_list_append (parse->pending_buffers, buffer);
-    return GST_FLOW_OK;
+  if (parse->current_pcr != GST_CLOCK_TIME_NONE) {
+    GST_DEBUG_OBJECT (parse,
+        "InputTS %" GST_TIME_FORMAT " PCR %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (GST_BUFFER_PTS (buffer)),
+        GST_TIME_ARGS (mpegts_packetizer_pts_to_ts (base->packetizer,
+                parse->current_pcr, parse->pcr_pid)));
   }
 
-  if (G_UNLIKELY (parse->pending_buffers)) {
-    GList *l;
+  if (parse->set_timestamps || parse->first) {
+    parse->pending_buffers = g_list_prepend (parse->pending_buffers, buffer);
+    parse->bytes_since_pcr += gst_buffer_get_size (buffer);
+    buffer = NULL;
+  }
 
-    for (l = parse->pending_buffers; l; l = l->next) {
-      if (ret == GST_FLOW_OK)
-        ret = gst_pad_push (parse->srcpad, l->data);
-      else
-        gst_buffer_unref (l->data);
-    }
-    g_list_free (parse->pending_buffers);
-    parse->pending_buffers = NULL;
+  if (!prepare_src_pad (base, parse))
+    return GST_FLOW_OK;
 
+  if (parse->pending_buffers != NULL) {
+    /* Don't keep pending_buffers if not setting output timestamps */
+    gboolean drain_all = (parse->set_timestamps == FALSE);
+    ret = drain_pending_buffers (parse, drain_all);
     if (ret != GST_FLOW_OK) {
-      gst_buffer_unref (buffer);
+      if (buffer)
+        gst_buffer_unref (buffer);
       return ret;
     }
   }
 
-  return gst_pad_push (parse->srcpad, buffer);
+  if (buffer != NULL)
+    ret = gst_pad_push (parse->srcpad, buffer);
+
+  return ret;
 }
 
 static MpegTSParsePad *
@@ -656,14 +931,17 @@
 
         gst_query_parse_latency (query, &is_live, &min_latency, &max_latency);
         if (is_live) {
-          min_latency += TS_LATENCY * GST_MSECOND;
+          GstClockTime extra_latency = TS_LATENCY * GST_MSECOND;
+          if (parse->set_timestamps) {
+            extra_latency = MAX (extra_latency, parse->smoothing_latency);
+          }
+          min_latency += extra_latency;
           if (max_latency != GST_CLOCK_TIME_NONE)
-            max_latency += TS_LATENCY * GST_MSECOND;
+            max_latency += extra_latency;
         }
 
         gst_query_set_latency (query, is_live, min_latency, max_latency);
       }
-
       break;
     }
     default:
diff --git a/gst/mpegtsdemux/mpegtsparse.h b/gst/mpegtsdemux/mpegtsparse.h
index 6848836..b1253bf 100644
--- a/gst/mpegtsdemux/mpegtsparse.h
+++ b/gst/mpegtsdemux/mpegtsparse.h
@@ -51,6 +51,11 @@
   gboolean have_group_id;
   guint group_id;
 
+  GstClockTime smoothing_latency;
+  GstClockTime current_pcr;
+  gint user_pcr_pid;
+  gint pcr_pid;
+
   /* Always present source pad */
   GstPad *srcpad;
 
@@ -58,7 +63,12 @@
 
   /* state */
   gboolean first;
+  gboolean set_timestamps;
+
+  /* Pending buffer state */
   GList *pending_buffers;
+  GstClockTime previous_pcr;
+  guint bytes_since_pcr;
 };
 
 struct _MpegTSParse2Class {
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index 9b2debb..9313cc5 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -64,16 +64,6 @@
  */
 #define SEEK_TIMESTAMP_OFFSET (2500 * GST_MSECOND)
 
-#define SEGMENT_FORMAT "[format:%s, rate:%f, start:%"			\
-  GST_TIME_FORMAT", stop:%"GST_TIME_FORMAT", time:%"GST_TIME_FORMAT	\
-  ", base:%"GST_TIME_FORMAT", position:%"GST_TIME_FORMAT		\
-  ", duration:%"GST_TIME_FORMAT"]"
-
-#define SEGMENT_ARGS(a) gst_format_get_name((a).format), (a).rate,	\
-    GST_TIME_ARGS((a).start), GST_TIME_ARGS((a).stop),			\
-    GST_TIME_ARGS((a).time), GST_TIME_ARGS((a).base),			\
-    GST_TIME_ARGS((a).position), GST_TIME_ARGS((a).duration)
-
 #define GST_FLOW_REWINDING GST_FLOW_CUSTOM_ERROR
 
 GST_DEBUG_CATEGORY_STATIC (ts_demux_debug);
@@ -144,6 +134,9 @@
   /* Whether the pad was added or not */
   gboolean active;
 
+  /* Whether this is a sparse stream (subtitles or metadata) */
+  gboolean sparse;
+
   /* TRUE if we are waiting for a valid timestamp */
   gboolean pending_ts;
 
@@ -165,6 +158,13 @@
   GstClockTime pts;
   GstClockTime dts;
 
+  /* Reference PTS used to detect gaps */
+  GstClockTime gap_ref_pts;
+  /* Number of outputted buffers */
+  guint32 nb_out_buffers;
+  /* Reference number of buffers for gaps */
+  guint32 gap_ref_buffers;
+
   /* Current PTS/DTS for this stream (in 90kHz unit) */
   guint64 raw_pts, raw_dts;
 
@@ -288,13 +288,15 @@
     const GValue * value, GParamSpec * pspec);
 static void gst_ts_demux_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
-static void gst_ts_demux_flush_streams (GstTSDemux * tsdemux);
+static void gst_ts_demux_flush_streams (GstTSDemux * tsdemux, gboolean hard);
 static GstFlowReturn
 gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream);
 static void gst_ts_demux_stream_flush (TSDemuxStream * stream,
-    GstTSDemux * demux);
+    GstTSDemux * demux, gboolean hard);
 
 static gboolean push_event (MpegTSBase * base, GstEvent * event);
+static void gst_ts_demux_check_and_sync_streams (GstTSDemux * demux,
+    GstClockTime time);
 
 static void
 _extra_init (void)
@@ -379,8 +381,6 @@
 {
   GstTSDemux *demux = (GstTSDemux *) base;
 
-  demux->calculate_update_segment = FALSE;
-
   demux->rate = 1.0;
   gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
   if (demux->segment_event) {
@@ -388,11 +388,6 @@
     demux->segment_event = NULL;
   }
 
-  if (demux->update_segment) {
-    gst_event_unref (demux->update_segment);
-    demux->update_segment = NULL;
-  }
-
   if (demux->global_tags) {
     gst_tag_list_unref (demux->global_tags);
     demux->global_tags = NULL;
@@ -820,14 +815,11 @@
   demux->rate = rate;
   res = GST_FLOW_OK;
 
-  if (flags & GST_SEEK_FLAG_ACCURATE) {
-    /* keep the seek infos for our segment */
-    gst_segment_do_seek (&demux->segment, rate, format, flags, start_type,
-        start, stop_type, stop, NULL);
-  } else {
-    /* Drop segment infos, it will be  recreated with actual seek infos */
-    gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
-  }
+  gst_segment_do_seek (&demux->segment, rate, format, flags, start_type,
+      start, stop_type, stop, NULL);
+  if (!(flags & GST_SEEK_FLAG_ACCURATE))
+    demux->reset_segment = TRUE;
+
   if (demux->segment_event) {
     gst_event_unref (demux->segment_event);
     demux->segment_event = NULL;
@@ -836,12 +828,13 @@
   for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
     TSDemuxStream *stream = tmp->data;
 
-
     if (flags & GST_SEEK_FLAG_ACCURATE)
       stream->needs_keyframe = TRUE;
 
     stream->seeked_pts = GST_CLOCK_TIME_NONE;
     stream->seeked_dts = GST_CLOCK_TIME_NONE;
+    stream->need_newsegment = TRUE;
+    stream->first_dts = GST_CLOCK_TIME_NONE;
   }
 
 done:
@@ -1015,6 +1008,7 @@
   GstPadTemplate *template = NULL;
   const GstMpegtsDescriptor *desc = NULL;
   GstPad *pad = NULL;
+  gboolean sparse = FALSE;
 
   gst_ts_demux_create_tags (stream);
 
@@ -1066,6 +1060,7 @@
         template = gst_static_pad_template_get (&subpicture_template);
         name = g_strdup_printf ("subpicture_%04x", bstream->pid);
         caps = gst_caps_new_empty_simple ("subpicture/x-pgs");
+        sparse = TRUE;
         break;
       case ST_BD_AUDIO_DTS_HD:
       case ST_BD_AUDIO_DTS_HD_MASTER_AUDIO:
@@ -1143,6 +1138,7 @@
         template = gst_static_pad_template_get (&private_template);
         name = g_strdup_printf ("private_%04x", bstream->pid);
         caps = gst_caps_new_empty_simple ("application/x-teletext");
+        sparse = TRUE;
         break;
       }
       desc =
@@ -1153,6 +1149,7 @@
         template = gst_static_pad_template_get (&private_template);
         name = g_strdup_printf ("private_%04x", bstream->pid);
         caps = gst_caps_new_empty_simple ("subpicture/x-dvb");
+        sparse = TRUE;
         break;
       }
 
@@ -1315,6 +1312,7 @@
       template = gst_static_pad_template_get (&subpicture_template);
       name = g_strdup_printf ("subpicture_%04x", bstream->pid);
       caps = gst_caps_new_empty_simple ("subpicture/x-dvd");
+      sparse = TRUE;
       break;
     default:
       GST_WARNING ("Non-media stream (stream_type:0x%x). Not creating pad",
@@ -1350,6 +1348,9 @@
     event = gst_event_new_stream_start (stream_id);
     if (demux->have_group_id)
       gst_event_set_group_id (event, demux->group_id);
+    if (sparse)
+      gst_event_set_stream_flags (event, GST_STREAM_FLAG_SPARSE);
+    stream->sparse = sparse;
 
     gst_pad_push_event (pad, event);
     g_free (stream_id);
@@ -1402,10 +1403,13 @@
     stream->discont = TRUE;
     stream->pts = GST_CLOCK_TIME_NONE;
     stream->dts = GST_CLOCK_TIME_NONE;
+    stream->first_dts = GST_CLOCK_TIME_NONE;
     stream->raw_pts = -1;
     stream->raw_dts = -1;
     stream->pending_ts = TRUE;
-    stream->first_dts = GST_CLOCK_TIME_NONE;
+    stream->nb_out_buffers = 0;
+    stream->gap_ref_buffers = 0;
+    stream->gap_ref_pts = GST_CLOCK_TIME_NONE;
     stream->continuity_counter = CONTINUITY_UNSET;
   }
 }
@@ -1450,7 +1454,7 @@
     stream->pad = NULL;
   }
 
-  gst_ts_demux_stream_flush (stream, GST_TS_DEMUX_CAST (base));
+  gst_ts_demux_stream_flush (stream, GST_TS_DEMUX_CAST (base), TRUE);
 
   tsdemux_h264_parsing_info_clear (&stream->h264infos);
 }
@@ -1458,35 +1462,31 @@
 static void
 activate_pad_for_stream (GstTSDemux * tsdemux, TSDemuxStream * stream)
 {
-  GList *tmp;
-  gboolean alldone = TRUE;
-
   if (stream->pad) {
     GST_DEBUG_OBJECT (tsdemux, "Activating pad %s:%s for stream %p",
         GST_DEBUG_PAD_NAME (stream->pad), stream);
     gst_element_add_pad ((GstElement *) tsdemux, stream->pad);
     stream->active = TRUE;
     GST_DEBUG_OBJECT (stream->pad, "done adding pad");
-
-    /* Check if all pads were activated, and if so emit no-more-pads */
-    for (tmp = tsdemux->program->stream_list; tmp; tmp = tmp->next) {
-      stream = (TSDemuxStream *) tmp->data;
-      if (stream->pad && !stream->active)
-        alldone = FALSE;
+    /* force sending of pending sticky events which have been stored on the
+     * pad already and which otherwise would only be sent on the first buffer
+     * or serialized event (which means very late in case of subtitle streams),
+     * and playsink waits for stream-start or another serialized event */
+    if (stream->sparse) {
+      GST_DEBUG_OBJECT (stream->pad, "sparse stream, pushing GAP event");
+      gst_pad_push_event (stream->pad, gst_event_new_gap (0, 0));
     }
-    if (alldone) {
-      GST_DEBUG_OBJECT (tsdemux, "All pads were activated, emit no-more-pads");
-      gst_element_no_more_pads ((GstElement *) tsdemux);
-    }
-  } else
+  } else if (((MpegTSBaseStream *) stream)->stream_type != 0xff) {
     GST_WARNING_OBJECT (tsdemux,
-        "stream %p (pid 0x%04x, type:0x%03x) has no pad", stream,
+        "stream %p (pid 0x%04x, type:0x%02x) has no pad", stream,
         ((MpegTSBaseStream *) stream)->pid,
         ((MpegTSBaseStream *) stream)->stream_type);
+  }
 }
 
 static void
-gst_ts_demux_stream_flush (TSDemuxStream * stream, GstTSDemux * tsdemux)
+gst_ts_demux_stream_flush (TSDemuxStream * stream, GstTSDemux * tsdemux,
+    gboolean hard)
 {
   GST_DEBUG ("flushing stream %p", stream);
 
@@ -1497,25 +1497,31 @@
   stream->expected_size = 0;
   stream->allocated_size = 0;
   stream->current_size = 0;
-  stream->need_newsegment = TRUE;
   stream->discont = TRUE;
   stream->pts = GST_CLOCK_TIME_NONE;
   stream->dts = GST_CLOCK_TIME_NONE;
-  stream->first_dts = GST_CLOCK_TIME_NONE;
   stream->raw_pts = -1;
   stream->raw_dts = -1;
   stream->pending_ts = TRUE;
+  stream->nb_out_buffers = 0;
+  stream->gap_ref_buffers = 0;
+  stream->gap_ref_pts = GST_CLOCK_TIME_NONE;
   stream->continuity_counter = CONTINUITY_UNSET;
+  if (hard) {
+    stream->first_dts = GST_CLOCK_TIME_NONE;
+    stream->need_newsegment = TRUE;
+  }
 }
 
 static void
-gst_ts_demux_flush_streams (GstTSDemux * demux)
+gst_ts_demux_flush_streams (GstTSDemux * demux, gboolean hard)
 {
+  GList *walk;
   if (!demux->program)
     return;
 
-  g_list_foreach (demux->program->stream_list,
-      (GFunc) gst_ts_demux_stream_flush, demux);
+  for (walk = demux->program->stream_list; walk; walk = g_list_next (walk))
+    gst_ts_demux_stream_flush (walk->data, demux, hard);
 }
 
 static void
@@ -1529,16 +1535,25 @@
 
   if (demux->requested_program_number == program->program_number ||
       (demux->requested_program_number == -1 && demux->program_number == -1)) {
+    GList *tmp;
 
     GST_LOG ("program %d started", program->program_number);
     demux->program_number = program->program_number;
     demux->program = program;
 
     /* If this is not the initial program, we need to calculate
-     * an update newsegment */
-    demux->calculate_update_segment = !program->initial_program;
+     * a new segment */
+    if (demux->segment_event) {
+      gst_event_unref (demux->segment_event);
+      demux->segment_event = NULL;
+    }
 
-    /* FIXME : When do we emit no_more_pads ? */
+    /* Add all streams, then fire no-more-pads */
+    for (tmp = program->stream_list; tmp; tmp = tmp->next) {
+      TSDemuxStream *stream = (TSDemuxStream *) tmp->data;
+      activate_pad_for_stream (demux, stream);
+    }
+    gst_element_no_more_pads ((GstElement *) demux);
   }
 }
 
@@ -1915,16 +1930,11 @@
 
   GST_DEBUG ("Creating new newsegment for stream %p", stream);
 
-  /* 1) If we need to calculate an update newsegment, do it
-   * 2) If we need to calculate a new newsegment, do it
-   * 3) If an update_segment is valid, push it
-   * 4) If a newsegment is valid, push it */
-
   /* Speedup : if we don't need to calculate anything, go straight to pushing */
-  if (!demux->calculate_update_segment && demux->segment_event)
+  if (demux->segment_event)
     goto push_new_segment;
 
-  /* Calculate the 'new_start' value, used for both updates and newsegment */
+  /* Calculate the 'new_start' value, used for newsegment */
   for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
     TSDemuxStream *pstream = (TSDemuxStream *) tmp->data;
 
@@ -1939,21 +1949,7 @@
   GST_DEBUG ("lowest_pts %" G_GUINT64_FORMAT " => clocktime %" GST_TIME_FORMAT,
       lowest_pts, GST_TIME_ARGS (firstts));
 
-  if (demux->calculate_update_segment) {
-    GST_DEBUG ("Calculating update segment");
-    /* If we have a valid segment, create an update of that */
-    if (demux->segment.format == GST_FORMAT_TIME) {
-      GstSegment update_segment;
-      GST_DEBUG ("Re-using segment " SEGMENT_FORMAT,
-          SEGMENT_ARGS (demux->segment));
-      gst_segment_copy_into (&demux->segment, &update_segment);
-      update_segment.stop = firstts;
-      demux->update_segment = gst_event_new_segment (&update_segment);
-    }
-    demux->calculate_update_segment = FALSE;
-  }
-
-  if (demux->segment.format != GST_FORMAT_TIME) {
+  if (demux->segment.format != GST_FORMAT_TIME || demux->reset_segment) {
     /* It will happen only if it's first program or after flushes. */
     GST_DEBUG ("Calculating actual segment");
     if (base->segment.format == GST_FORMAT_TIME) {
@@ -1970,10 +1966,13 @@
     }
   } else if (demux->segment.start < firstts) {
     /* Take into account the offset to the first buffer timestamp */
-    if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop))
-      demux->segment.stop += firstts - demux->segment.start;
-    demux->segment.position = firstts;
-    demux->segment.start = firstts;
+    if (demux->segment.rate > 0) {
+      demux->segment.start = firstts;
+
+      if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop))
+        demux->segment.stop += firstts - demux->segment.start;
+      demux->segment.position = firstts;
+    }
   }
 
   if (!demux->segment_event) {
@@ -1982,32 +1981,93 @@
   }
 
 push_new_segment:
-  if (demux->update_segment) {
-    GST_DEBUG_OBJECT (stream->pad, "Pushing update segment");
-    gst_event_ref (demux->update_segment);
-    gst_pad_push_event (stream->pad, demux->update_segment);
-  }
+  for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
+    stream = (TSDemuxStream *) tmp->data;
+    if (stream->pad == NULL)
+      continue;
 
-  if (demux->segment_event) {
-    GST_DEBUG_OBJECT (stream->pad, "Pushing newsegment event");
-    gst_event_ref (demux->segment_event);
-    gst_pad_push_event (stream->pad, demux->segment_event);
-  }
+    if (demux->segment_event) {
+      GST_DEBUG_OBJECT (stream->pad, "Pushing newsegment event");
+      gst_event_ref (demux->segment_event);
+      gst_pad_push_event (stream->pad, demux->segment_event);
+    }
 
-  if (demux->global_tags) {
-    gst_pad_push_event (stream->pad,
-        gst_event_new_tag (gst_tag_list_ref (demux->global_tags)));
-  }
+    if (demux->global_tags) {
+      gst_pad_push_event (stream->pad,
+          gst_event_new_tag (gst_tag_list_ref (demux->global_tags)));
+    }
 
-  /* Push pending tags */
-  if (stream->taglist) {
-    GST_DEBUG_OBJECT (stream->pad, "Sending tags %" GST_PTR_FORMAT,
-        stream->taglist);
-    gst_pad_push_event (stream->pad, gst_event_new_tag (stream->taglist));
-    stream->taglist = NULL;
-  }
+    /* Push pending tags */
+    if (stream->taglist) {
+      GST_DEBUG_OBJECT (stream->pad, "Sending tags %" GST_PTR_FORMAT,
+          stream->taglist);
+      gst_pad_push_event (stream->pad, gst_event_new_tag (stream->taglist));
+      stream->taglist = NULL;
+    }
 
-  stream->need_newsegment = FALSE;
+    stream->need_newsegment = FALSE;
+  }
+}
+
+static void
+gst_ts_demux_check_and_sync_streams (GstTSDemux * demux, GstClockTime time)
+{
+  GList *tmp;
+
+  GST_DEBUG_OBJECT (demux,
+      "Recheck streams and sync to at least: %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (time));
+
+  if (G_UNLIKELY (demux->program == NULL))
+    return;
+
+  /* Go over each stream and update it to at least 'time' time.
+   * For each stream, the pad stores the buffer counter the last time
+   * a gap check occurred (gap_ref_buffers) and a gap_ref_pts timestamp
+   * that is either the PTS from the stream or the PCR the pad was updated
+   * to.
+   *
+   * We can check nb_out_buffers to see if any buffers were pushed since then.
+   * This means we can detect buffers passing without PTSes fine and still generate
+   * gaps.
+   *
+   * If there haven't been any buffers pushed on this stream since the last
+   * gap check, push a gap event updating to the indicated input PCR time
+   * and update the pad's tracking.
+   *
+   * If there have been buffers pushed, update the reference buffer count
+   * and but don't push a gap event
+   */
+  for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
+    TSDemuxStream *ps = (TSDemuxStream *) tmp->data;
+    GST_DEBUG_OBJECT (ps->pad,
+        "0x%04x, PTS:%" GST_TIME_FORMAT " REFPTS:%" GST_TIME_FORMAT " Gap:%"
+        GST_TIME_FORMAT " nb_buffers: %d (ref:%d)",
+        ((MpegTSBaseStream *) ps)->pid, GST_TIME_ARGS (ps->pts),
+        GST_TIME_ARGS (ps->gap_ref_pts),
+        GST_TIME_ARGS (ps->pts - ps->gap_ref_pts), ps->nb_out_buffers,
+        ps->gap_ref_buffers);
+    if (ps->pad == NULL)
+      continue;
+
+    if (ps->nb_out_buffers == ps->gap_ref_buffers && ps->gap_ref_pts != ps->pts) {
+      /* Do initial setup of pad if needed - segment etc */
+      GST_DEBUG_OBJECT (ps->pad,
+          "Stream needs update. Pushing GAP event to TS %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (time));
+      if (G_UNLIKELY (ps->need_newsegment))
+        calculate_and_push_newsegment (demux, ps);
+
+      /* Now send gap event */
+      gst_pad_push_event (ps->pad, gst_event_new_gap (time, 0));
+    }
+
+    /* Update GAP tracking vars so we don't re-check this stream for a while */
+    ps->gap_ref_pts = time;
+    if (ps->pts != GST_CLOCK_TIME_NONE && ps->pts > time)
+      ps->gap_ref_pts = ps->pts;
+    ps->gap_ref_buffers = ps->nb_out_buffers;
+  }
 }
 
 static GstFlowReturn
@@ -2084,9 +2144,6 @@
     }
   }
 
-  if (G_UNLIKELY (!stream->active))
-    activate_pad_for_stream (demux, stream);
-
   if (G_UNLIKELY (stream->need_newsegment))
     calculate_and_push_newsegment (demux, stream);
 
@@ -2106,6 +2163,7 @@
       stream->discont = FALSE;
 
       res = gst_pad_push (stream->pad, pend->buffer);
+      stream->nb_out_buffers += 1;
       g_slice_free (PendingBuffer, pend);
     }
     g_list_free (stream->pending);
@@ -2143,10 +2201,31 @@
   stream->discont = FALSE;
 
   res = gst_pad_push (stream->pad, buffer);
+  /* Record that a buffer was pushed */
+  stream->nb_out_buffers += 1;
   GST_DEBUG_OBJECT (stream->pad, "Returned %s", gst_flow_get_name (res));
   res = gst_flow_combiner_update_flow (demux->flowcombiner, res);
   GST_DEBUG_OBJECT (stream->pad, "combined %s", gst_flow_get_name (res));
 
+  /* GAP / sparse stream tracking */
+  if (G_UNLIKELY (stream->gap_ref_pts == GST_CLOCK_TIME_NONE))
+    stream->gap_ref_pts = stream->pts;
+  else {
+    /* Look if the stream PTS has advanced 2 seconds since the last
+     * gap check, and sync streams if it has. The first stream to
+     * hit this will trigger a gap check */
+    if (G_UNLIKELY (stream->pts != GST_CLOCK_TIME_NONE &&
+            stream->pts > stream->gap_ref_pts + 2 * GST_SECOND)) {
+      GstClockTime curpcr =
+          mpegts_packetizer_get_current_time (MPEG_TS_BASE_PACKETIZER (demux),
+          demux->program->pcr_pid);
+      if (curpcr == GST_CLOCK_TIME_NONE || curpcr < 800 * GST_MSECOND)
+        goto beach;
+      curpcr -= 800 * GST_MSECOND;
+      gst_ts_demux_check_and_sync_streams (demux, curpcr);
+    }
+  }
+
 beach:
   /* Reset everything */
   GST_LOG ("Resetting to EMPTY, returning %s", gst_flow_get_name (res));
@@ -2199,13 +2278,12 @@
 {
   GstTSDemux *demux = GST_TS_DEMUX_CAST (base);
 
-  gst_ts_demux_flush_streams (demux);
+  gst_ts_demux_flush_streams (demux, hard);
 
   if (demux->segment_event) {
     gst_event_unref (demux->segment_event);
     demux->segment_event = NULL;
   }
-  demux->calculate_update_segment = FALSE;
   if (demux->global_tags) {
     gst_tag_list_unref (demux->global_tags);
     demux->global_tags = NULL;
diff --git a/gst/mpegtsdemux/tsdemux.h b/gst/mpegtsdemux/tsdemux.h
index 16112fc..b689412 100644
--- a/gst/mpegtsdemux/tsdemux.h
+++ b/gst/mpegtsdemux/tsdemux.h
@@ -69,15 +69,11 @@
   /* segments to be sent */
   GstSegment segment;
   GstEvent *segment_event;
+  gboolean reset_segment;
 
   /* global taglist */
   GstTagList *global_tags;
 
-  /* Set when program change */
-  gboolean calculate_update_segment;
-  /* update segment is */
-  GstEvent *update_segment;
-
   /* Full stream duration */
   GstClockTime duration;
 
diff --git a/gst/mpegtsmux/Makefile.in b/gst/mpegtsmux/Makefile.in
index 1b37cb4..6cd39fb 100644
--- a/gst/mpegtsmux/Makefile.in
+++ b/gst/mpegtsmux/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -290,8 +290,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -330,7 +334,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -338,6 +341,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -387,8 +392,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -467,7 +470,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -476,7 +478,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -489,7 +490,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -514,6 +514,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -587,10 +589,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -616,6 +622,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -652,6 +661,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -692,17 +702,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -719,6 +728,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c
index af246a2..be296d7 100644
--- a/gst/mpegtsmux/mpegtsmux.c
+++ b/gst/mpegtsmux/mpegtsmux.c
@@ -88,10 +88,6 @@
 #include <stdio.h>
 #include <string.h>
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include <gst/tag/tag.h>
 #include <gst/video/video.h>
 #include <gst/mpegts/mpegts.h>
@@ -171,7 +167,7 @@
 static gboolean new_packet_m2ts (MpegTsMux * mux, GstBuffer * buf,
     gint64 new_pcr);
 
-static void mpegtsdemux_prepare_srcpad (MpegTsMux * mux);
+static void mpegtsmux_prepare_srcpad (MpegTsMux * mux);
 GstFlowReturn mpegtsmux_clip_inc_running_time (GstCollectPads * pads,
     GstCollectData * cdata, GstBuffer * buf, GstBuffer ** outbuf,
     gpointer user_data);
@@ -186,7 +182,7 @@
 static GstStateChangeReturn mpegtsmux_change_state (GstElement * element,
     GstStateChange transition);
 static gboolean mpegtsmux_send_event (GstElement * element, GstEvent * event);
-static void mpegtsdemux_set_header_on_caps (MpegTsMux * mux);
+static void mpegtsmux_set_header_on_caps (MpegTsMux * mux);
 static gboolean mpegtsmux_src_event (GstPad * pad, GstObject * parent,
     GstEvent * event);
 
@@ -284,7 +280,7 @@
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ALIGNMENT,
       g_param_spec_int ("alignment", "packet alignment",
           "Number of packets per buffer (padded with dummy packets on EOS) "
-          "(-1 = auto, 0 = all available packets)",
+          "(-1 = auto, 0 = all available packets, 7 for UDP streaming)",
           -1, G_MAXINT, MPEGTSMUX_DEFAULT_ALIGNMENT,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
@@ -316,9 +312,6 @@
   gst_collect_pads_set_clip_function (mux->collect, (GstCollectPadsClipFunction)
       GST_DEBUG_FUNCPTR (mpegtsmux_clip_inc_running_time), mux);
 
-  mux->tsmux = tsmux_new ();
-  tsmux_set_write_func (mux->tsmux, new_packet_cb, mux);
-
   mux->adapter = gst_adapter_new ();
   mux->out_adapter = gst_adapter_new ();
 
@@ -378,7 +371,6 @@
   mux->is_delta = TRUE;
 
   mux->streamheader_sent = FALSE;
-  mux->force_key_unit_event = NULL;
   mux->pending_key_unit_ts = GST_CLOCK_TIME_NONE;
 #if 0
   mux->spn_count = 0;
@@ -599,7 +591,6 @@
       GST_PTR_FORMAT, ts_data->pid, caps);
 
   s = gst_caps_get_structure (caps, 0);
-  g_return_val_if_fail (s != NULL, FALSE);
 
   mt = gst_structure_get_name (s);
   value = gst_structure_get_value (s, "codec_data");
@@ -981,8 +972,7 @@
   guint count;
   GstEvent *event = NULL;
 
-  g_return_val_if_fail (pending_event != NULL, NULL);
-  g_return_val_if_fail (segment != NULL, NULL);
+  g_assert (segment != NULL);
 
   if (pending_event == NULL)
     goto out;
@@ -1008,8 +998,13 @@
   stream_time = gst_segment_to_stream_time (segment,
       GST_FORMAT_TIME, timestamp);
 
-  gst_video_event_parse_upstream_force_key_unit (pending_event,
-      NULL, &all_headers, &count);
+  if (GST_EVENT_TYPE (pending_event) == GST_EVENT_CUSTOM_DOWNSTREAM) {
+    gst_video_event_parse_downstream_force_key_unit (pending_event,
+        NULL, NULL, NULL, &all_headers, &count);
+  } else {
+    gst_video_event_parse_upstream_force_key_unit (pending_event, NULL,
+        &all_headers, &count);
+  }
 
   event =
       gst_video_event_new_downstream_force_key_unit (timestamp, stream_time,
@@ -1106,7 +1101,7 @@
     if (G_UNLIKELY (ret != GST_FLOW_OK))
       return ret;
 
-    mpegtsdemux_prepare_srcpad (mux);
+    mpegtsmux_prepare_srcpad (mux);
 
     mux->first = FALSE;
   }
@@ -1328,7 +1323,7 @@
     guint len)
 {
   /* Packets should be at least 188 bytes, but check anyway */
-  g_return_if_fail (len >= 2 || !data);
+  g_assert (len >= 2 || !data);
 
   if (!mux->streamheader_sent && data) {
     guint pid = ((data[1] & 0x1f) << 8) | data[2];
@@ -1344,7 +1339,7 @@
       }
       mux->streamheader = g_list_append (mux->streamheader, hbuf);
     } else if (mux->streamheader) {
-      mpegtsdemux_set_header_on_caps (mux);
+      mpegtsmux_set_header_on_caps (mux);
       mux->streamheader_sent = TRUE;
     }
   }
@@ -1363,11 +1358,9 @@
 static GstFlowReturn
 mpegtsmux_push_packets (MpegTsMux * mux, gboolean force)
 {
+  GstBufferList *buffer_list;
   gint align = mux->alignment;
   gint av, packet_size;
-  GstBuffer *buf;
-  GstFlowReturn ret = GST_FLOW_OK;
-  GstClockTime ts;
 
   if (mux->m2ts_mode) {
     packet_size = M2TS_PACKET_LENGTH;
@@ -1382,25 +1375,31 @@
   av = gst_adapter_available (mux->out_adapter);
   GST_LOG_OBJECT (mux, "align %d, av %d", align, av);
 
-  if (!align)
-    align = av;
-  else
-    align *= packet_size;
+  if (av == 0)
+    return GST_FLOW_OK;
 
-  /* FIXME: what about DTS here? */
-  GST_LOG_OBJECT (mux, "aligning to %d bytes", align);
-  if (G_LIKELY ((align <= av) && av)) {
-    GST_LOG_OBJECT (mux, "pushing %d aligned bytes", av - (av % align));
-    ts = gst_adapter_prev_pts (mux->out_adapter, NULL);
-    buf = gst_adapter_take_buffer (mux->out_adapter, av - (av % align));
-    g_assert (buf);
-    GST_BUFFER_PTS (buf) = ts;
-
-    ret = gst_pad_push (mux->srcpad, buf);
-    av = av % align;
+  /* no alignment, just push all available data */
+  if (align == 0) {
+    buffer_list = gst_adapter_take_buffer_list (mux->out_adapter, av);
+    return gst_pad_push_list (mux->srcpad, buffer_list);
   }
 
-  if (av && force) {
+  align *= packet_size;
+
+  if (!force && align > av)
+    return GST_FLOW_OK;
+
+  buffer_list = gst_buffer_list_new_sized ((av / align) + 1);
+
+  GST_LOG_OBJECT (mux, "aligning to %d bytes", align);
+  while (align <= av) {
+    gst_buffer_list_add (buffer_list,
+        gst_adapter_take_buffer (mux->out_adapter, align));
+    av -= align;
+  }
+
+  if (av > 0 && force) {
+    GstBuffer *buf;
     guint8 *data;
     guint32 header;
     gint dummy;
@@ -1410,11 +1409,9 @@
     buf = gst_buffer_new_and_alloc (align);
     gst_buffer_map (buf, &map, GST_MAP_READ);
     data = map.data;
-    ts = gst_adapter_prev_pts (mux->out_adapter, NULL);
 
     gst_adapter_copy (mux->out_adapter, data, 0, av);
     gst_adapter_clear (mux->out_adapter);
-    GST_BUFFER_PTS (buf) = ts;
 
     data += av;
     header = GST_READ_UINT32_BE (data - packet_size);
@@ -1444,11 +1441,10 @@
     }
 
     gst_buffer_unmap (buf, &map);
-
-    ret = gst_pad_push (mux->srcpad, buf);
+    gst_buffer_list_add (buffer_list, buf);
   }
 
-  return ret;
+  return gst_pad_push_list (mux->srcpad, buffer_list);
 }
 
 static GstFlowReturn
@@ -1632,7 +1628,7 @@
 }
 
 static void
-mpegtsdemux_set_header_on_caps (MpegTsMux * mux)
+mpegtsmux_set_header_on_caps (MpegTsMux * mux)
 {
   GstBuffer *buf;
   GstStructure *structure;
@@ -1666,7 +1662,7 @@
 }
 
 static void
-mpegtsdemux_prepare_srcpad (MpegTsMux * mux)
+mpegtsmux_prepare_srcpad (MpegTsMux * mux)
 {
   GstSegment seg;
   /* we are not going to seek */
@@ -1740,8 +1736,6 @@
   GstMpegtsSection *section;
   MpegTsMux *mux = GST_MPEG_TSMUX (element);
 
-  g_return_val_if_fail (event != NULL, FALSE);
-
   section = gst_event_parse_mpegts_section (event);
   gst_event_unref (event);
 
diff --git a/gst/mpegtsmux/tsmux/Makefile.in b/gst/mpegtsmux/tsmux/Makefile.in
index 0afa4d5..d99ba73 100644
--- a/gst/mpegtsmux/tsmux/Makefile.in
+++ b/gst/mpegtsmux/tsmux/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -216,8 +216,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -256,7 +260,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -264,6 +267,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -313,8 +318,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -393,7 +396,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -402,7 +404,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -415,7 +416,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -440,6 +440,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -513,10 +515,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -542,6 +548,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -578,6 +587,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -618,17 +628,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -645,6 +654,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.c b/gst/mpegtsmux/tsmux/tsmuxstream.c
index 2cbbf76..7e85537 100644
--- a/gst/mpegtsmux/tsmux/tsmuxstream.c
+++ b/gst/mpegtsmux/tsmux/tsmuxstream.c
@@ -180,6 +180,7 @@
     case TSMUX_ST_PS_TELETEXT:
       /* needs fixes PES header length */
       stream->pi.pes_header_length = 36;
+      /* fall through */
     case TSMUX_ST_PS_DVB_SUBPICTURE:
       /* private stream 1 */
       stream->id = 0xBD;
diff --git a/gst/mve/Makefile.in b/gst/mve/Makefile.in
index 39f82cc..2c67b12 100644
--- a/gst/mve/Makefile.in
+++ b/gst/mve/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/mxf/Makefile.in b/gst/mxf/Makefile.in
index c94e6ef..90e0c04 100644
--- a/gst/mxf/Makefile.in
+++ b/gst/mxf/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -252,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -292,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -300,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -349,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -429,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -438,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -451,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -476,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -549,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -578,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -614,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -654,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -681,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c
index 1c093b4..7681d51 100644
--- a/gst/mxf/mxfdemux.c
+++ b/gst/mxf/mxfdemux.c
@@ -31,7 +31,6 @@
  */
 
 /* TODO:
- *   - Seeking support: Use IndexTableSegments
  *   - Handle timecode tracks correctly (where is this documented?)
  *   - Handle drop-frame field of timecode tracks
  *   - Handle Generic container system items
@@ -52,10 +51,6 @@
 #include "config.h"
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include "mxfdemux.h"
 #include "mxfessence.h"
 
@@ -76,6 +71,13 @@
 GST_DEBUG_CATEGORY_STATIC (mxfdemux_debug);
 #define GST_CAT_DEFAULT mxfdemux_debug
 
+static GstFlowReturn
+gst_mxf_demux_pull_klv_packet (GstMXFDemux * demux, guint64 offset, MXFUL * key,
+    GstBuffer ** outbuf, guint * read);
+static GstFlowReturn
+gst_mxf_demux_handle_index_table_segment (GstMXFDemux * demux,
+    const MXFUL * key, GstBuffer * buffer, guint64 offset);
+
 GType gst_mxf_demux_pad_get_type (void);
 G_DEFINE_TYPE (GstMXFDemuxPad, gst_mxf_demux_pad, GST_TYPE_PAD);
 
@@ -275,6 +277,8 @@
     demux->pending_index_table_segments = NULL;
   }
 
+  demux->index_table_segments_collected = FALSE;
+
   gst_mxf_demux_reset_mxf_state (demux);
   gst_mxf_demux_reset_metadata (demux);
 
@@ -1671,8 +1675,10 @@
   }
 
   if (etrack->offsets && etrack->offsets->len > etrack->position) {
-    keyframe = g_array_index (etrack->offsets, GstMXFDemuxIndex,
-        etrack->position).keyframe;
+    GstMXFDemuxIndex *index =
+        &g_array_index (etrack->offsets, GstMXFDemuxIndex, etrack->position);
+    if (index->offset != 0)
+      keyframe = index->keyframe;
   }
 
   /* Create subbuffer to be able to change metadata */
@@ -1722,6 +1728,8 @@
 
       index.offset = demux->offset - demux->run_in;
       index.keyframe = keyframe;
+      if (etrack->offsets->len < etrack->position)
+        g_array_set_size (etrack->offsets, etrack->position);
       g_array_insert_val (etrack->offsets, etrack->position, index);
     }
   }
@@ -1887,6 +1895,39 @@
   return ret;
 }
 
+static void
+read_partition_header (GstMXFDemux * demux, guint64 offset)
+{
+  GstBuffer *buf;
+  MXFUL key;
+  guint read;
+
+  if (gst_mxf_demux_pull_klv_packet (demux, offset, &key, &buf, &read)
+      != GST_FLOW_OK)
+    return;
+  offset += read;
+
+  if (!mxf_is_partition_pack (&key)) {
+    gst_buffer_unref (buf);
+    return;
+  }
+
+  do {
+    gst_buffer_unref (buf);
+    if (gst_mxf_demux_pull_klv_packet (demux, offset, &key, &buf, &read)
+        != GST_FLOW_OK)
+      return;
+    offset += read;
+  }
+  while (mxf_is_fill (&key));
+
+  if (mxf_is_index_table_segment (&key)) {
+    gst_mxf_demux_handle_index_table_segment (demux, &key, buf, offset);
+  }
+
+  gst_buffer_unref (buf);
+}
+
 static GstFlowReturn
 gst_mxf_demux_handle_random_index_pack (GstMXFDemux * demux, const MXFUL * key,
     GstBuffer * buffer)
@@ -1960,17 +2001,31 @@
   return GST_FLOW_OK;
 }
 
+static gint
+compare_index_table_segments (gconstpointer comparee, gconstpointer compared)
+{
+  MXFIndexTableSegment *comparee_segment, *compared_segment;
+
+  comparee_segment = (MXFIndexTableSegment *) comparee;
+  compared_segment = (MXFIndexTableSegment *) compared;
+
+  /* FIXME : is that the correct comparison ? */
+  return comparee_segment->index_start_position -
+      compared_segment->index_start_position;
+}
+
 static GstFlowReturn
 gst_mxf_demux_handle_index_table_segment (GstMXFDemux * demux,
-    const MXFUL * key, GstBuffer * buffer)
+    const MXFUL * key, GstBuffer * buffer, guint64 offset)
 {
   MXFIndexTableSegment *segment;
   GstMapInfo map;
   gboolean ret;
+  GList *l;
 
   GST_DEBUG_OBJECT (demux,
       "Handling index table segment of size %" G_GSIZE_FORMAT " at offset %"
-      G_GUINT64_FORMAT, gst_buffer_get_size (buffer), demux->offset);
+      G_GUINT64_FORMAT, gst_buffer_get_size (buffer), offset);
 
   if (!demux->current_partition->primer.mappings) {
     GST_WARNING_OBJECT (demux, "Invalid primer pack");
@@ -1988,9 +2043,16 @@
     return GST_FLOW_ERROR;
   }
 
-  demux->pending_index_table_segments =
-      g_list_prepend (demux->pending_index_table_segments, segment);
+  segment->stream_offset = offset;
+  l = g_list_find_custom (demux->pending_index_table_segments, segment,
+      (GCompareFunc) compare_index_table_segments);
 
+  /* Prevent duplicates */
+  if (l == NULL)
+    demux->pending_index_table_segments =
+        g_list_prepend (demux->pending_index_table_segments, segment);
+  else
+    g_free (segment);
 
   return GST_FLOW_OK;
 }
@@ -2096,7 +2158,6 @@
 gst_mxf_demux_pull_random_index_pack (GstMXFDemux * demux)
 {
   GstBuffer *buffer;
-  GstFlowReturn ret;
   gint64 filesize = -1;
   GstFormat fmt = GST_FORMAT_BYTES;
   guint32 pack_size;
@@ -2113,9 +2174,7 @@
   g_assert (filesize > 4);
 
   buffer = NULL;
-  if ((ret =
-          gst_mxf_demux_pull_range (demux, filesize - 4, 4,
-              &buffer)) != GST_FLOW_OK) {
+  if (gst_mxf_demux_pull_range (demux, filesize - 4, 4, &buffer) != GST_FLOW_OK) {
     GST_DEBUG_OBJECT (demux, "Failed pulling last 4 bytes");
     return;
   }
@@ -2135,9 +2194,8 @@
   }
 
   buffer = NULL;
-  if ((ret =
-          gst_mxf_demux_pull_range (demux, filesize - pack_size, 16,
-              &buffer)) != GST_FLOW_OK) {
+  if (gst_mxf_demux_pull_range (demux, filesize - pack_size, 16,
+          &buffer) != GST_FLOW_OK) {
     GST_DEBUG_OBJECT (demux, "Failed pulling random index pack key");
     return;
   }
@@ -2153,9 +2211,8 @@
   }
 
   demux->offset = filesize - pack_size;
-  if ((ret =
-          gst_mxf_demux_pull_klv_packet (demux, filesize - pack_size, &key,
-              &buffer, NULL)) != GST_FLOW_OK) {
+  if (gst_mxf_demux_pull_klv_packet (demux, filesize - pack_size, &key,
+          &buffer, NULL) != GST_FLOW_OK) {
     GST_DEBUG_OBJECT (demux, "Failed pulling random index pack");
     return;
   }
@@ -2172,7 +2229,7 @@
   MXFUL key;
   GstBuffer *buffer = NULL;
   guint read = 0;
-  GstFlowReturn ret = GST_FLOW_OK;
+  GstFlowReturn flow = GST_FLOW_OK;
   GstMXFDemuxPartition *old_partition = demux->current_partition;
 
   demux->current_partition = NULL;
@@ -2189,10 +2246,10 @@
   }
 
 next_try:
-  ret =
+  flow =
       gst_mxf_demux_pull_klv_packet (demux, demux->offset, &key, &buffer,
       &read);
-  if (G_UNLIKELY (ret != GST_FLOW_OK))
+  if (G_UNLIKELY (flow != GST_FLOW_OK))
     goto out;
 
   if (!mxf_is_partition_pack (&key))
@@ -2217,10 +2274,10 @@
   }
 
   while (TRUE) {
-    ret =
+    flow =
         gst_mxf_demux_pull_klv_packet (demux, demux->offset, &key, &buffer,
         &read);
-    if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+    if (G_UNLIKELY (flow != GST_FLOW_OK)) {
       demux->offset =
           demux->run_in +
           demux->current_partition->partition.this_partition -
@@ -2265,10 +2322,10 @@
   while (demux->offset <
       demux->run_in + demux->current_partition->primer.offset +
       demux->current_partition->partition.header_byte_count) {
-    ret =
+    flow =
         gst_mxf_demux_pull_klv_packet (demux, demux->offset, &key, &buffer,
         &read);
-    if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+    if (G_UNLIKELY (flow != GST_FLOW_OK)) {
       demux->offset =
           demux->run_in +
           demux->current_partition->partition.this_partition -
@@ -2277,12 +2334,12 @@
     }
 
     if (mxf_is_metadata (&key)) {
-      ret = gst_mxf_demux_handle_metadata (demux, &key, buffer);
+      flow = gst_mxf_demux_handle_metadata (demux, &key, buffer);
       demux->offset += read;
       gst_buffer_unref (buffer);
       buffer = NULL;
 
-      if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+      if (G_UNLIKELY (flow != GST_FLOW_OK)) {
         gst_mxf_demux_reset_metadata (demux);
         demux->offset =
             demux->run_in +
@@ -2291,7 +2348,7 @@
         goto next_try;
       }
     } else if (mxf_is_descriptive_metadata (&key)) {
-      ret = gst_mxf_demux_handle_descriptive_metadata (demux, &key, buffer);
+      gst_mxf_demux_handle_descriptive_metadata (demux, &key, buffer);
       demux->offset += read;
       gst_buffer_unref (buffer);
       buffer = NULL;
@@ -2403,7 +2460,9 @@
   } else if (mxf_is_random_index_pack (key)) {
     ret = gst_mxf_demux_handle_random_index_pack (demux, key, buffer);
   } else if (mxf_is_index_table_segment (key)) {
-    ret = gst_mxf_demux_handle_index_table_segment (demux, key, buffer);
+    ret =
+        gst_mxf_demux_handle_index_table_segment (demux, key, buffer,
+        demux->offset);
   } else if (mxf_is_fill (key)) {
     GST_DEBUG_OBJECT (demux,
         "Skipping filler packet of size %" G_GSIZE_FORMAT " at offset %"
@@ -2463,6 +2522,31 @@
 }
 
 static guint64
+get_offset_from_index_table_segments (GstMXFDemux * demux, gint64 position,
+    gint64 * index_start_position)
+{
+  GList *l;
+  gint64 start, end;
+  gboolean return_offset = FALSE;
+
+  for (l = demux->pending_index_table_segments; l != NULL; l = l->next) {
+    MXFIndexTableSegment *segment = (MXFIndexTableSegment *) l->data;
+    start = segment->index_start_position;
+    end = start + segment->index_duration;
+
+    if (return_offset)
+      return segment->stream_offset;
+
+    if (start <= position && position < end) {
+      *index_start_position = segment->index_start_position;
+      return_offset = TRUE;
+    }
+  }
+
+  return 0;
+}
+
+static guint64
 gst_mxf_demux_find_essence_element (GstMXFDemux * demux,
     GstMXFDemuxEssenceTrack * etrack, gint64 * position, gboolean keyframe)
 {
@@ -2540,6 +2624,9 @@
       return new_offset;
     }
   } else if (demux->random_access) {
+    gint64 index_start_position = -1;
+    guint64 offset;
+
     demux->offset = demux->run_in;
     if (etrack->offsets && etrack->offsets->len) {
       for (i = etrack->offsets->len - 1; i >= 0; i--) {
@@ -2552,13 +2639,23 @@
         }
       }
     }
+
+    offset =
+        get_offset_from_index_table_segments (demux, *position,
+        &index_start_position);
+
+    demux->offset = offset;
+
     gst_mxf_demux_set_partition_for_offset (demux, demux->offset);
 
     for (i = 0; i < demux->essence_tracks->len; i++) {
       GstMXFDemuxEssenceTrack *t =
           &g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack, i);
 
-      t->position = (demux->offset == demux->run_in) ? 0 : -1;
+      if (index_start_position != -1)
+        t->position = index_start_position;
+      else
+        t->position = (demux->offset == demux->run_in) ? 0 : -1;
     }
 
     /* Else peek at all essence elements and complete our
@@ -2770,7 +2867,7 @@
 gst_mxf_demux_loop (GstPad * pad)
 {
   GstMXFDemux *demux = NULL;
-  GstFlowReturn ret = GST_FLOW_OK;
+  GstFlowReturn flow = GST_FLOW_OK;
   GstMapInfo map;
   gboolean res;
 
@@ -2782,7 +2879,7 @@
     while (demux->offset < 64 * 1024) {
       GstBuffer *buffer = NULL;
 
-      if ((ret =
+      if ((flow =
               gst_mxf_demux_pull_range (demux, demux->offset, 16,
                   &buffer)) != GST_FLOW_OK)
         break;
@@ -2804,12 +2901,12 @@
       gst_buffer_unref (buffer);
     }
 
-    if (G_UNLIKELY (ret != GST_FLOW_OK))
+    if (G_UNLIKELY (flow != GST_FLOW_OK))
       goto pause;
 
     if (G_UNLIKELY (demux->run_in == -1)) {
       GST_ERROR_OBJECT (demux, "No valid header partition pack found");
-      ret = GST_FLOW_ERROR;
+      flow = GST_FLOW_ERROR;
       goto pause;
     }
 
@@ -2818,10 +2915,10 @@
   }
 
   /* Now actually do something */
-  ret = gst_mxf_demux_pull_and_handle_klv_packet (demux);
+  flow = gst_mxf_demux_pull_and_handle_klv_packet (demux);
 
   /* pause if something went wrong */
-  if (G_UNLIKELY (ret != GST_FLOW_OK))
+  if (G_UNLIKELY (flow != GST_FLOW_OK))
     goto pause;
 
   /* check EOS condition */
@@ -2841,7 +2938,7 @@
     }
 
     if (eos) {
-      ret = GST_FLOW_EOS;
+      flow = GST_FLOW_EOS;
       goto pause;
     }
   }
@@ -2852,12 +2949,12 @@
 
 pause:
   {
-    const gchar *reason = gst_flow_get_name (ret);
+    const gchar *reason = gst_flow_get_name (flow);
 
     GST_LOG_OBJECT (demux, "pausing task, reason %s", reason);
     gst_pad_pause_task (pad);
 
-    if (ret == GST_FLOW_EOS) {
+    if (flow == GST_FLOW_EOS) {
       /* perform EOS logic */
       if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
         gint64 stop;
@@ -2888,7 +2985,7 @@
           GST_WARNING_OBJECT (demux, "failed pushing EOS on streams");
         }
       }
-    } else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) {
+    } else if (flow == GST_FLOW_NOT_LINKED || flow < GST_FLOW_EOS) {
       GstEvent *e;
 
       GST_ELEMENT_ERROR (demux, STREAM, FAILED,
@@ -3298,6 +3395,40 @@
   }
 }
 
+static void
+collect_index_table_segments (GstMXFDemux * demux)
+{
+  guint i;
+  GList *l;
+
+  if (!demux->random_index_pack)
+    return;
+
+  for (i = 0; i < demux->random_index_pack->len; i++) {
+    GstMXFDemuxPartition *p = NULL;
+    MXFRandomIndexPackEntry *e =
+        &g_array_index (demux->random_index_pack, MXFRandomIndexPackEntry, i);
+
+    if (e->offset < demux->run_in) {
+      GST_ERROR_OBJECT (demux, "Invalid random index pack entry");
+      return;
+    }
+
+    for (l = demux->partitions; l; l = l->next) {
+      GstMXFDemuxPartition *tmp = l->data;
+
+      if (tmp->partition.this_partition + demux->run_in == e->offset) {
+        p = tmp;
+        break;
+      }
+    }
+
+    if (p) {
+      read_partition_header (demux, p->partition.this_partition);
+    }
+  }
+}
+
 static gboolean
 gst_mxf_demux_seek_pull (GstMXFDemux * demux, GstEvent * event)
 {
@@ -3328,6 +3459,11 @@
 
   keyunit_ts = start;
 
+  if (!demux->index_table_segments_collected) {
+    collect_index_table_segments (demux);
+    demux->index_table_segments_collected = TRUE;
+  }
+
   if (flush) {
     GstEvent *e;
 
diff --git a/gst/mxf/mxfdemux.h b/gst/mxf/mxfdemux.h
index 38c7725..3324093 100644
--- a/gst/mxf/mxfdemux.h
+++ b/gst/mxf/mxfdemux.h
@@ -155,6 +155,8 @@
   GArray *essence_tracks;
   GList *pending_index_table_segments;
 
+  gboolean index_table_segments_collected;
+
   GArray *random_index_pack;
 
   /* Metadata */
diff --git a/gst/mxf/mxfmetadata.c b/gst/mxf/mxfmetadata.c
index edef298..7c314e8 100644
--- a/gst/mxf/mxfmetadata.c
+++ b/gst/mxf/mxfmetadata.c
@@ -4080,7 +4080,7 @@
 
     t = g_slice_new0 (MXFLocalTag);
     memcpy (&t->ul, MXF_UL (LOCATORS), 16);
-    t->size = 8 + 16 * self->n_locators;;
+    t->size = 8 + 16 * self->n_locators;
     t->data = g_slice_alloc0 (t->size);
     t->g_slice = TRUE;
     GST_WRITE_UINT32_BE (t->data, self->n_locators);
diff --git a/gst/mxf/mxftypes.h b/gst/mxf/mxftypes.h
index 1f31b40..0c338e7 100644
--- a/gst/mxf/mxftypes.h
+++ b/gst/mxf/mxftypes.h
@@ -171,6 +171,7 @@
   MXFIndexEntry *index_entries;
 
   GHashTable *other_tags;
+  guint64 stream_offset;
 } MXFIndexTableSegment;
 
 #define GST_TAG_MXF_UMID "mxf-umid"
diff --git a/gst/nuvdemux/Makefile.in b/gst/nuvdemux/Makefile.in
index e56b6c0..f5e5d2b 100644
--- a/gst/nuvdemux/Makefile.in
+++ b/gst/nuvdemux/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -243,8 +243,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -283,7 +287,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -291,6 +294,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -340,8 +345,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -420,7 +423,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -429,7 +431,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -442,7 +443,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -467,6 +467,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -540,10 +542,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -569,6 +575,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -605,6 +614,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -645,17 +655,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -672,6 +681,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/nuvdemux/gstnuvdemux.c b/gst/nuvdemux/gstnuvdemux.c
index 5bd29a5..ce4e98d 100644
--- a/gst/nuvdemux/gstnuvdemux.c
+++ b/gst/nuvdemux/gstnuvdemux.c
@@ -717,7 +717,6 @@
       break;
     case GST_NUV_DEMUX_INVALID_DATA:
       goto pause;
-      break;
     default:
       g_assert_not_reached ();
   }
diff --git a/gst/onvif/Makefile.am b/gst/onvif/Makefile.am
new file mode 100644
index 0000000..8ec94b1
--- /dev/null
+++ b/gst/onvif/Makefile.am
@@ -0,0 +1,29 @@
+plugin_LTLIBRARIES = libgstrtponvif.la
+
+libgstrtponvif_la_SOURCES = \
+	gstrtponvif.c \
+	gstrtponviftimestamp.c gstrtponviftimestamp.h \
+	gstrtponvifparse.c gstrtponvifparse.h
+libgstrtponvif_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+	$(GST_BASE_CFLAGS) $(GST_CFLAGS)
+libgstrtponvif_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+	$(GST_BASE_LIBS) $(GST_LIBS) -lgstrtp-$(GST_API_VERSION)
+libgstrtponvif_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstrtponvif_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+
+EXTRA_DIST =
+
+Android.mk: Makefile.am $(BUILT_SOURCES)
+	androgenizer \
+	-:PROJECT libgstrtponvif -:SHARED libgstrtponvif \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstrtponvif_la_SOURCES) \
+	 -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstrtponvif_la_CFLAGS) \
+	 -:LDFLAGS $(libgstrtponvif_la_LDFLAGS) \
+	           $(libgstrtponvif_la_LIBADD) \
+	           -ldl \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+		       LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
+	> $@
diff --git a/gst/real/Makefile.in b/gst/onvif/Makefile.in
similarity index 84%
copy from gst/real/Makefile.in
copy to gst/onvif/Makefile.in
index 2282e4e..e5b33d1 100644
--- a/gst/real/Makefile.in
+++ b/gst/onvif/Makefile.in
@@ -14,7 +14,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -80,9 +79,9 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = gst/real
+subdir = gst/onvif
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/depcomp $(noinst_HEADERS)
+	$(top_srcdir)/depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
 	$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -90,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -154,19 +153,20 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstreal_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
-am_libgstreal_la_OBJECTS = libgstreal_la-gstrealvideodec.lo \
-	libgstreal_la-gstrealaudiodec.lo libgstreal_la-gstreal.lo
-libgstreal_la_OBJECTS = $(am_libgstreal_la_OBJECTS)
+libgstrtponvif_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libgstrtponvif_la_OBJECTS = libgstrtponvif_la-gstrtponvif.lo \
+	libgstrtponvif_la-gstrtponviftimestamp.lo \
+	libgstrtponvif_la-gstrtponvifparse.lo
+libgstrtponvif_la_OBJECTS = $(am_libgstrtponvif_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstreal_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(libgstreal_la_CFLAGS) $(CFLAGS) \
-	$(libgstreal_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstrtponvif_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(libgstrtponvif_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CCLD) $(libgstrtponvif_la_CFLAGS) $(CFLAGS) \
+	$(libgstrtponvif_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -201,14 +201,13 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstreal_la_SOURCES)
-DIST_SOURCES = $(libgstreal_la_SOURCES)
+SOURCES = $(libgstrtponvif_la_SOURCES)
+DIST_SOURCES = $(libgstrtponvif_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
-HEADERS = $(noinst_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -245,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -725,28 +734,21 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstreal.la 
-libgstreal_la_SOURCES = \
-	gstrealvideodec.c \
-	gstrealaudiodec.c \
-	gstreal.c
+plugin_LTLIBRARIES = libgstrtponvif.la
+libgstrtponvif_la_SOURCES = \
+	gstrtponvif.c \
+	gstrtponviftimestamp.c gstrtponviftimestamp.h \
+	gstrtponvifparse.c gstrtponvifparse.h
 
-libgstreal_la_CFLAGS = \
-	$(GST_PLUGINS_BASE_CFLAGS) \
-	$(GST_BASE_CFLAGS) \
-	$(GST_CFLAGS)
+libgstrtponvif_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+	$(GST_BASE_CFLAGS) $(GST_CFLAGS)
 
-libgstreal_la_LIBADD = \
-	$(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_API_VERSION@ \
-	$(GST_BASE_LIBS)
+libgstrtponvif_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+	$(GST_BASE_LIBS) $(GST_LIBS) -lgstrtp-$(GST_API_VERSION)
 
-libgstreal_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstreal_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-noinst_HEADERS = \
-	gstreal.h         \
-	gstrealvideodec.h \
-	gstrealaudiodec.h
-
+libgstrtponvif_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstrtponvif_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+EXTRA_DIST = 
 all: all-am
 
 .SUFFIXES:
@@ -760,9 +762,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gst/real/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gst/onvif/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu gst/real/Makefile
+	  $(AUTOMAKE) --gnu gst/onvif/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -817,8 +819,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstreal.la: $(libgstreal_la_OBJECTS) $(libgstreal_la_DEPENDENCIES) $(EXTRA_libgstreal_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstreal_la_LINK) -rpath $(plugindir) $(libgstreal_la_OBJECTS) $(libgstreal_la_LIBADD) $(LIBS)
+libgstrtponvif.la: $(libgstrtponvif_la_OBJECTS) $(libgstrtponvif_la_DEPENDENCIES) $(EXTRA_libgstrtponvif_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libgstrtponvif_la_LINK) -rpath $(plugindir) $(libgstrtponvif_la_OBJECTS) $(libgstrtponvif_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -826,9 +828,9 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreal_la-gstreal.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreal_la-gstrealaudiodec.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreal_la-gstrealvideodec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstrtponvif_la-gstrtponvif.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstrtponvif_la-gstrtponvifparse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstrtponvif_la-gstrtponviftimestamp.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -854,26 +856,26 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstreal_la-gstrealvideodec.lo: gstrealvideodec.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -MT libgstreal_la-gstrealvideodec.lo -MD -MP -MF $(DEPDIR)/libgstreal_la-gstrealvideodec.Tpo -c -o libgstreal_la-gstrealvideodec.lo `test -f 'gstrealvideodec.c' || echo '$(srcdir)/'`gstrealvideodec.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstreal_la-gstrealvideodec.Tpo $(DEPDIR)/libgstreal_la-gstrealvideodec.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrealvideodec.c' object='libgstreal_la-gstrealvideodec.lo' libtool=yes @AMDEPBACKSLASH@
+libgstrtponvif_la-gstrtponvif.lo: gstrtponvif.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtponvif_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtponvif_la_CFLAGS) $(CFLAGS) -MT libgstrtponvif_la-gstrtponvif.lo -MD -MP -MF $(DEPDIR)/libgstrtponvif_la-gstrtponvif.Tpo -c -o libgstrtponvif_la-gstrtponvif.lo `test -f 'gstrtponvif.c' || echo '$(srcdir)/'`gstrtponvif.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstrtponvif_la-gstrtponvif.Tpo $(DEPDIR)/libgstrtponvif_la-gstrtponvif.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrtponvif.c' object='libgstrtponvif_la-gstrtponvif.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -c -o libgstreal_la-gstrealvideodec.lo `test -f 'gstrealvideodec.c' || echo '$(srcdir)/'`gstrealvideodec.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtponvif_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtponvif_la_CFLAGS) $(CFLAGS) -c -o libgstrtponvif_la-gstrtponvif.lo `test -f 'gstrtponvif.c' || echo '$(srcdir)/'`gstrtponvif.c
 
-libgstreal_la-gstrealaudiodec.lo: gstrealaudiodec.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -MT libgstreal_la-gstrealaudiodec.lo -MD -MP -MF $(DEPDIR)/libgstreal_la-gstrealaudiodec.Tpo -c -o libgstreal_la-gstrealaudiodec.lo `test -f 'gstrealaudiodec.c' || echo '$(srcdir)/'`gstrealaudiodec.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstreal_la-gstrealaudiodec.Tpo $(DEPDIR)/libgstreal_la-gstrealaudiodec.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrealaudiodec.c' object='libgstreal_la-gstrealaudiodec.lo' libtool=yes @AMDEPBACKSLASH@
+libgstrtponvif_la-gstrtponviftimestamp.lo: gstrtponviftimestamp.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtponvif_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtponvif_la_CFLAGS) $(CFLAGS) -MT libgstrtponvif_la-gstrtponviftimestamp.lo -MD -MP -MF $(DEPDIR)/libgstrtponvif_la-gstrtponviftimestamp.Tpo -c -o libgstrtponvif_la-gstrtponviftimestamp.lo `test -f 'gstrtponviftimestamp.c' || echo '$(srcdir)/'`gstrtponviftimestamp.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstrtponvif_la-gstrtponviftimestamp.Tpo $(DEPDIR)/libgstrtponvif_la-gstrtponviftimestamp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrtponviftimestamp.c' object='libgstrtponvif_la-gstrtponviftimestamp.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -c -o libgstreal_la-gstrealaudiodec.lo `test -f 'gstrealaudiodec.c' || echo '$(srcdir)/'`gstrealaudiodec.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtponvif_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtponvif_la_CFLAGS) $(CFLAGS) -c -o libgstrtponvif_la-gstrtponviftimestamp.lo `test -f 'gstrtponviftimestamp.c' || echo '$(srcdir)/'`gstrtponviftimestamp.c
 
-libgstreal_la-gstreal.lo: gstreal.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -MT libgstreal_la-gstreal.lo -MD -MP -MF $(DEPDIR)/libgstreal_la-gstreal.Tpo -c -o libgstreal_la-gstreal.lo `test -f 'gstreal.c' || echo '$(srcdir)/'`gstreal.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstreal_la-gstreal.Tpo $(DEPDIR)/libgstreal_la-gstreal.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstreal.c' object='libgstreal_la-gstreal.lo' libtool=yes @AMDEPBACKSLASH@
+libgstrtponvif_la-gstrtponvifparse.lo: gstrtponvifparse.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtponvif_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtponvif_la_CFLAGS) $(CFLAGS) -MT libgstrtponvif_la-gstrtponvifparse.lo -MD -MP -MF $(DEPDIR)/libgstrtponvif_la-gstrtponvifparse.Tpo -c -o libgstrtponvif_la-gstrtponvifparse.lo `test -f 'gstrtponvifparse.c' || echo '$(srcdir)/'`gstrtponvifparse.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstrtponvif_la-gstrtponvifparse.Tpo $(DEPDIR)/libgstrtponvif_la-gstrtponvifparse.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrtponvifparse.c' object='libgstrtponvif_la-gstrtponvifparse.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -c -o libgstreal_la-gstreal.lo `test -f 'gstreal.c' || echo '$(srcdir)/'`gstreal.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtponvif_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtponvif_la_CFLAGS) $(CFLAGS) -c -o libgstrtponvif_la-gstrtponvifparse.lo `test -f 'gstrtponvifparse.c' || echo '$(srcdir)/'`gstrtponvifparse.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -965,7 +967,7 @@
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES)
 installdirs:
 	for dir in "$(DESTDIR)$(plugindir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -1089,6 +1091,20 @@
 	uninstall-pluginLTLIBRARIES
 
 
+Android.mk: Makefile.am $(BUILT_SOURCES)
+	androgenizer \
+	-:PROJECT libgstrtponvif -:SHARED libgstrtponvif \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstrtponvif_la_SOURCES) \
+	 -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstrtponvif_la_CFLAGS) \
+	 -:LDFLAGS $(libgstrtponvif_la_LDFLAGS) \
+	           $(libgstrtponvif_la_LIBADD) \
+	           -ldl \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+		       LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
+	> $@
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/gst/onvif/gstrtponvif.c b/gst/onvif/gstrtponvif.c
new file mode 100644
index 0000000..c674232
--- /dev/null
+++ b/gst/onvif/gstrtponvif.c
@@ -0,0 +1,48 @@
+/*
+ * gstrtponvif.c
+ *
+ * Copyright (C) 2014 Axis Communications AB
+ *  Author: Guillaume Desmottes <guillaume.desmottes@collabora.com>
+ *
+ * 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstrtponviftimestamp.h"
+#include "gstrtponvifparse.h"
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  if (!gst_element_register (plugin, "rtponviftimestamp", GST_RANK_NONE,
+          GST_TYPE_RTP_ONVIF_TIMESTAMP))
+    return FALSE;
+  if (!gst_element_register (plugin, "rtponvifparse", GST_RANK_NONE,
+          GST_TYPE_RTP_ONVIF_PARSE))
+    return FALSE;
+
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    rtponvif,
+    "ONVIF Streaming features",
+    plugin_init, VERSION, GST_LICENSE_UNKNOWN, GST_PACKAGE_NAME,
+    GST_PACKAGE_ORIGIN)
diff --git a/gst/onvif/gstrtponvifparse.c b/gst/onvif/gstrtponvifparse.c
new file mode 100644
index 0000000..f48ac07
--- /dev/null
+++ b/gst/onvif/gstrtponvifparse.c
@@ -0,0 +1,150 @@
+/*
+ * gstrtponviftimestamp-parse.c
+ *
+ * Copyright (C) 2014 Axis Communications AB
+ *  Author: Guillaume Desmottes <guillaume.desmottes@collabora.com>
+ *
+ * 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <gst/rtp/gstrtpbuffer.h>
+
+#include "gstrtponvifparse.h"
+
+static GstFlowReturn gst_rtp_onvif_parse_chain (GstPad * pad,
+    GstObject * parent, GstBuffer * buf);
+
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp")
+    );
+
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp")
+    );
+
+G_DEFINE_TYPE (GstRtpOnvifParse, gst_rtp_onvif_parse, GST_TYPE_ELEMENT);
+
+static void
+gst_rtp_onvif_parse_class_init (GstRtpOnvifParseClass * klass)
+{
+  GstElementClass *gstelement_class;
+
+  gstelement_class = GST_ELEMENT_CLASS (klass);
+
+  /* register pads */
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sink_template_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_template_factory));
+
+  gst_element_class_set_static_metadata (gstelement_class,
+      "ONVIF NTP timestamps RTP extension", "Effect/RTP",
+      "Add absolute timestamps and flags of recorded data in a playback "
+      "session", "Guillaume Desmottes <guillaume.desmottes@collabora.com>");
+}
+
+static void
+gst_rtp_onvif_parse_init (GstRtpOnvifParse * self)
+{
+  self->sinkpad =
+      gst_pad_new_from_static_template (&sink_template_factory, "sink");
+  gst_pad_set_chain_function (self->sinkpad, gst_rtp_onvif_parse_chain);
+  gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
+  GST_PAD_SET_PROXY_CAPS (self->sinkpad);
+
+  self->srcpad =
+      gst_pad_new_from_static_template (&src_template_factory, "src");
+  gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
+}
+
+#define EXTENSION_ID 0xABAC
+#define EXTENSION_SIZE 3
+
+static gboolean
+handle_buffer (GstRtpOnvifParse * self, GstBuffer * buf)
+{
+  GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
+  guint8 *data;
+  guint16 bits;
+  guint wordlen;
+  guint8 flags;
+  /*
+     guint64 timestamp;
+     guint8 cseq;
+   */
+
+  if (!gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp)) {
+    GST_ELEMENT_ERROR (self, STREAM, FAILED,
+        ("Failed to map RTP buffer"), (NULL));
+    return FALSE;
+  }
+
+  /* Check if the ONVIF RTP extension is present in the packet */
+  if (!gst_rtp_buffer_get_extension_data (&rtp, &bits, (gpointer) & data,
+          &wordlen))
+    goto out;
+
+  if (bits != EXTENSION_ID || wordlen != EXTENSION_SIZE)
+    goto out;
+
+  /* timestamp = GST_READ_UINT64_BE (data);  TODO */
+  flags = GST_READ_UINT8 (data + 8);
+  /* cseq = GST_READ_UINT8 (data + 9);  TODO */
+
+  /* C */
+  if (flags & (1 << 7))
+    GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
+  else
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
+
+  /* E */
+  /* if (flags & (1 << 6));  TODO */
+
+  /* D */
+  if (flags & (1 << 5))
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
+  else
+    GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT);
+
+out:
+  gst_rtp_buffer_unmap (&rtp);
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_rtp_onvif_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
+{
+  GstRtpOnvifParse *self = GST_RTP_ONVIF_PARSE (parent);
+
+  if (!handle_buffer (self, buf)) {
+    gst_buffer_unref (buf);
+    return GST_FLOW_ERROR;
+  }
+
+  return gst_pad_push (self->srcpad, buf);
+}
diff --git a/gst/onvif/gstrtponvifparse.h b/gst/onvif/gstrtponvifparse.h
new file mode 100644
index 0000000..437b1ab
--- /dev/null
+++ b/gst/onvif/gstrtponvifparse.h
@@ -0,0 +1,62 @@
+/*
+ * gstrtponviftimestamp-parse.h
+ *
+ * Copyright (C) 2014 Axis Communications AB
+ *  Author: Guillaume Desmottes <guillaume.desmottes@collabora.com>
+ *
+ * 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GST_RTP_ONVIF_PARSE_H__
+#define __GST_RTP_ONVIF_PARSE_H__
+
+
+#include <gst/gst.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GST_TYPE_RTP_ONVIF_PARSE \
+  (gst_rtp_onvif_parse_get_type())
+#define GST_RTP_ONVIF_PARSE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_ONVIF_PARSE,GstRtpOnvifParse))
+#define GST_RTP_ONVIF_PARSE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_ONVIF_PARSE,GstRtpOnvifParseClass))
+#define GST_IS_RTP_ONVIF_PARSE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_ONVIF_PARSE))
+#define GST_IS_RTP_ONVIF_PARSE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_ONVIF_PARSE))
+
+typedef struct _GstRtpOnvifParse GstRtpOnvifParse;
+typedef struct _GstRtpOnvifParseClass GstRtpOnvifParseClass;
+
+struct _GstRtpOnvifParse {
+  GstElement element;
+
+  /* pads */
+  GstPad *sinkpad,*srcpad;
+};
+
+struct _GstRtpOnvifParseClass {
+  GstElementClass parent_class;
+};
+
+GType gst_rtp_onvif_parse_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_RTP_ONVIF_PARSE_H__ */
diff --git a/gst/onvif/gstrtponviftimestamp.c b/gst/onvif/gstrtponviftimestamp.c
new file mode 100644
index 0000000..7251d3f
--- /dev/null
+++ b/gst/onvif/gstrtponviftimestamp.c
@@ -0,0 +1,500 @@
+/*
+ * gstrtponviftimestamp.h
+ *
+ * Copyright (C) 2014 Axis Communications AB
+ *  Author: Guillaume Desmottes <guillaume.desmottes@collabora.com>
+ *
+ * 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <gst/rtp/gstrtpbuffer.h>
+
+#include "gstrtponviftimestamp.h"
+
+#define DEFAULT_NTP_OFFSET GST_CLOCK_TIME_NONE
+#define DEFAULT_CSEQ 0
+#define DEFAULT_SET_E_BIT FALSE
+
+GST_DEBUG_CATEGORY_STATIC (rtponviftimestamp_debug);
+#define GST_CAT_DEFAULT (rtponviftimestamp_debug)
+
+static GstFlowReturn gst_rtp_onvif_timestamp_chain (GstPad * pad,
+    GstObject * parent, GstBuffer * buf);
+static GstFlowReturn gst_rtp_onvif_timestamp_chain_list (GstPad * pad,
+    GstObject * parent, GstBufferList * list);
+
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp")
+    );
+
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp")
+    );
+
+enum
+{
+  ARG_0,
+  PROP_NTP_OFFSET,
+  PROP_CSEQ,
+  PROP_SET_E_BIT,
+};
+
+/*static guint gst_rtp_onvif_timestamp_signals[LAST_SIGNAL] = { 0 }; */
+
+G_DEFINE_TYPE (GstRtpOnvifTimestamp, gst_rtp_onvif_timestamp, GST_TYPE_ELEMENT);
+
+static void
+gst_rtp_onvif_timestamp_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec)
+{
+  GstRtpOnvifTimestamp *self = GST_RTP_ONVIF_TIMESTAMP (object);
+
+  switch (prop_id) {
+    case PROP_NTP_OFFSET:
+      g_value_set_uint64 (value, self->prop_ntp_offset);
+      break;
+    case PROP_CSEQ:
+      g_value_set_uint (value, self->prop_cseq);
+      break;
+    case PROP_SET_E_BIT:
+      g_value_set_boolean (value, self->prop_set_e_bit);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_rtp_onvif_timestamp_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+  GstRtpOnvifTimestamp *self = GST_RTP_ONVIF_TIMESTAMP (object);
+
+  switch (prop_id) {
+    case PROP_NTP_OFFSET:
+      self->prop_ntp_offset = g_value_get_uint64 (value);
+      break;
+    case PROP_CSEQ:
+      self->prop_cseq = g_value_get_uint (value);
+      break;
+    case PROP_SET_E_BIT:
+      self->prop_set_e_bit = g_value_get_boolean (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static GstStateChangeReturn
+gst_rtp_onvif_timestamp_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstRtpOnvifTimestamp *self = GST_RTP_ONVIF_TIMESTAMP (element);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (gst_rtp_onvif_timestamp_parent_class)->change_state
+      (element, transition);
+
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      if (GST_CLOCK_TIME_IS_VALID (self->prop_ntp_offset))
+        self->ntp_offset = self->prop_ntp_offset;
+      else
+        self->ntp_offset = GST_CLOCK_TIME_NONE;
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      if (!GST_CLOCK_TIME_IS_VALID (self->prop_ntp_offset) &&
+          GST_ELEMENT_CLOCK (element) == NULL) {
+        GST_ELEMENT_ERROR (element, CORE, CLOCK, ("Missing NTP offset"),
+            ("Set the \"ntp-offset\" property to,"
+                " can't guess it without a clock on the pipeline."));
+        return GST_STATE_CHANGE_FAILURE;
+      }
+      break;
+    default:
+      break;
+  }
+
+  return ret;
+}
+
+static void
+gst_rtp_onvif_timestamp_finalize (GObject * object)
+{
+  GstRtpOnvifTimestamp *self = GST_RTP_ONVIF_TIMESTAMP (object);
+
+  if (self->buffer)
+    gst_buffer_unref (self->buffer);
+  if (self->list)
+    gst_buffer_list_unref (self->list);
+
+  G_OBJECT_CLASS (gst_rtp_onvif_timestamp_parent_class)->finalize (object);
+}
+
+static void
+gst_rtp_onvif_timestamp_class_init (GstRtpOnvifTimestampClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gstelement_class = GST_ELEMENT_CLASS (klass);
+
+  gobject_class->get_property = gst_rtp_onvif_timestamp_get_property;
+  gobject_class->set_property = gst_rtp_onvif_timestamp_set_property;
+  gobject_class->finalize = gst_rtp_onvif_timestamp_finalize;
+
+  g_object_class_install_property (gobject_class, PROP_NTP_OFFSET,
+      g_param_spec_uint64 ("ntp-offset", "NTP offset",
+          "Offset between the pipeline running time and the absolute UTC time, "
+          "in nano-seconds since 1900 (-1 for automatic computation)",
+          0, G_MAXUINT64,
+          DEFAULT_NTP_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_CSEQ,
+      g_param_spec_uint ("cseq", "CSeq",
+          "The RTSP CSeq which initiated the playback",
+          0, G_MAXUINT32,
+          DEFAULT_CSEQ, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_SET_E_BIT,
+      g_param_spec_boolean ("set-e-bit", "Set 'E' bit",
+          "If the element should set the 'E' bit as defined in the ONVIF RTP "
+          "extension. This increases latency by one packet",
+          DEFAULT_SET_E_BIT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /* register pads */
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sink_template_factory));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_template_factory));
+
+  gst_element_class_set_static_metadata (gstelement_class,
+      "ONVIF NTP timestamps RTP extension", "Effect/RTP",
+      "Add absolute timestamps and flags of recorded data in a playback "
+      "session", "Guillaume Desmottes <guillaume.desmottes@collabora.com>");
+
+  gstelement_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_rtp_onvif_timestamp_change_state);
+
+  GST_DEBUG_CATEGORY_INIT (rtponviftimestamp_debug, "rtponviftimestamp",
+      0, "ONVIF NTP timestamps RTP extension");
+}
+
+static GstFlowReturn handle_and_push_buffer (GstRtpOnvifTimestamp * self,
+    GstBuffer * buf, gboolean end_contiguous);
+static GstFlowReturn handle_and_push_buffer_list (GstRtpOnvifTimestamp * self,
+    GstBufferList * list, gboolean end_contiguous);
+
+static gboolean
+gst_rtp_onvif_timestamp_sink_event (GstPad * pad, GstObject * parent,
+    GstEvent * event)
+{
+  GstRtpOnvifTimestamp *self = GST_RTP_ONVIF_TIMESTAMP (parent);
+
+  GST_DEBUG_OBJECT (pad, "handling event %s", GST_EVENT_TYPE_NAME (event));
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_SEGMENT:
+      gst_event_copy_segment (event, &self->segment);
+      break;
+    case GST_EVENT_FLUSH_STOP:
+      gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
+      break;
+    case GST_EVENT_EOS:
+      /* Push pending buffers, if any */
+      if (self->buffer) {
+        handle_and_push_buffer (self, self->buffer, TRUE);
+        self->buffer = NULL;
+      }
+      if (self->list) {
+        handle_and_push_buffer_list (self, self->list, TRUE);
+        self->list = NULL;
+      }
+      break;
+    default:
+      break;
+  }
+
+  return gst_pad_event_default (pad, parent, event);
+}
+
+static void
+gst_rtp_onvif_timestamp_init (GstRtpOnvifTimestamp * self)
+{
+  self->sinkpad =
+      gst_pad_new_from_static_template (&sink_template_factory, "sink");
+  gst_pad_set_chain_function (self->sinkpad, gst_rtp_onvif_timestamp_chain);
+  gst_pad_set_chain_list_function (self->sinkpad,
+      gst_rtp_onvif_timestamp_chain_list);
+  gst_pad_set_event_function (self->sinkpad,
+      gst_rtp_onvif_timestamp_sink_event);
+  gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
+  GST_PAD_SET_PROXY_CAPS (self->sinkpad);
+  GST_PAD_SET_PROXY_ALLOCATION (self->sinkpad);
+
+  self->srcpad =
+      gst_pad_new_from_static_template (&src_template_factory, "src");
+  gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
+
+  self->prop_ntp_offset = DEFAULT_NTP_OFFSET;
+  self->prop_set_e_bit = DEFAULT_SET_E_BIT;
+
+  self->buffer = NULL;
+  self->list = NULL;
+
+  gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
+}
+
+#define EXTENSION_ID 0xABAC
+#define EXTENSION_SIZE 3
+
+static gboolean
+handle_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf,
+    gboolean end_contiguous)
+{
+  GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
+  guint8 *data;
+  guint16 bits;
+  guint wordlen;
+  guint64 time;
+  guint8 field = 0;
+
+  if (!GST_CLOCK_TIME_IS_VALID (self->ntp_offset)) {
+    GstClock *clock = gst_element_get_clock (GST_ELEMENT (self));
+
+    if (clock) {
+      GstClockTime clock_time = gst_clock_get_time (clock);
+      guint64 real_time = g_get_real_time ();
+      GstClockTime running_time = clock_time -
+          gst_element_get_base_time (GST_ELEMENT (self));
+
+      /* convert microseconds to nanoseconds */
+      real_time *= 1000;
+
+      /* add constant to convert from 1970 based time to 1900 based time */
+      real_time += (G_GUINT64_CONSTANT (2208988800) * GST_SECOND);
+
+      self->ntp_offset = real_time - running_time;
+
+      gst_object_unref (clock);
+    } else {
+      /* Received a buffer in PAUSED, so we can't guess the match
+       * between the running time and the NTP clock yet.
+       */
+      return TRUE;
+    }
+  }
+
+  if (self->segment.format != GST_FORMAT_TIME) {
+    GST_ELEMENT_ERROR (self, STREAM, FAILED,
+        ("did not receive a time segment yet"), (NULL));
+    return FALSE;
+  }
+
+  if (!gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp)) {
+    GST_ELEMENT_ERROR (self, STREAM, FAILED,
+        ("Failed to map RTP buffer"), (NULL));
+    return FALSE;
+  }
+
+  if (!gst_rtp_buffer_set_extension_data (&rtp, EXTENSION_ID, EXTENSION_SIZE)) {
+    GST_ELEMENT_ERROR (self, STREAM, FAILED, ("Failed to set extension data"),
+        (NULL));
+    gst_rtp_buffer_unmap (&rtp);
+    return FALSE;
+  }
+
+  if (!gst_rtp_buffer_get_extension_data (&rtp, &bits, (gpointer) & data,
+          &wordlen)) {
+    GST_ELEMENT_ERROR (self, STREAM, FAILED, ("Failed to get extension data"),
+        (NULL));
+    gst_rtp_buffer_unmap (&rtp);
+    return FALSE;
+  }
+
+  /* NTP timestamp */
+  if (GST_BUFFER_DTS_IS_VALID (buf)) {
+    time = gst_segment_to_running_time (&self->segment, GST_FORMAT_TIME,
+        GST_BUFFER_DTS (buf));
+  } else if (GST_BUFFER_PTS_IS_VALID (buf)) {
+    time = gst_segment_to_running_time (&self->segment, GST_FORMAT_TIME,
+        GST_BUFFER_PTS (buf));
+  } else {
+    GST_ERROR_OBJECT (self,
+        "Buffer doesn't contain any valid DTS or PTS timestamp");
+    goto done;
+  }
+
+  if (time == GST_CLOCK_TIME_NONE) {
+    GST_ERROR_OBJECT (self, "Failed to get running time");
+    goto done;
+  }
+
+  /* add the offset (in seconds) */
+  time += self->ntp_offset;
+
+  /* convert to NTP time. upper 32 bits should contain the seconds
+   * and the lower 32 bits, the fractions of a second. */
+  time = gst_util_uint64_scale (time, (G_GINT64_CONSTANT (1) << 32),
+      GST_SECOND);
+
+  GST_DEBUG_OBJECT (self, "timestamp: %" G_GUINT64_FORMAT, time);
+
+  GST_WRITE_UINT64_BE (data, time);
+
+  /* The next byte is composed of: C E D mbz (5 bits) */
+
+  /* Set C if the buffer does *not* have the DELTA_UNIT flag as it means
+   * that's a key frame (or 'clean point'). */
+  if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) {
+    GST_DEBUG_OBJECT (self, "set C flag");
+    field |= (1 << 7);
+  }
+
+  /* Set E if the next buffer has DISCONT */
+  if (end_contiguous) {
+    GST_DEBUG_OBJECT (self, "set E flag");
+    field |= (1 << 6);
+  }
+
+  /* Set D if the buffer has the DISCONT flag */
+  if (GST_BUFFER_IS_DISCONT (buf)) {
+    GST_DEBUG_OBJECT (self, "set D flag");
+    field |= (1 << 5);
+  }
+
+  GST_WRITE_UINT8 (data + 8, field);
+
+  /* CSeq (low-order byte) */
+  GST_WRITE_UINT8 (data + 9, (guchar) self->prop_cseq);
+
+  memset (data + 10, 0, 3);
+
+done:
+  gst_rtp_buffer_unmap (&rtp);
+  return TRUE;
+}
+
+/* @buf: (transfer all) */
+static GstFlowReturn
+handle_and_push_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf,
+    gboolean end_contiguous)
+{
+  if (!handle_buffer (self, buf, end_contiguous)) {
+    gst_buffer_unref (buf);
+    return GST_FLOW_ERROR;
+  }
+
+  return gst_pad_push (self->srcpad, buf);
+}
+
+static GstFlowReturn
+gst_rtp_onvif_timestamp_chain (GstPad * pad, GstObject * parent,
+    GstBuffer * buf)
+{
+  GstRtpOnvifTimestamp *self = GST_RTP_ONVIF_TIMESTAMP (parent);
+  GstFlowReturn result = GST_FLOW_OK;
+
+  if (!self->prop_set_e_bit) {
+    /* Modify and push this buffer right away */
+    return handle_and_push_buffer (self, buf, FALSE);
+  }
+
+  /* We have to wait for the *next* buffer before pushing this one */
+
+  if (self->buffer) {
+    /* push the *previous* buffer received */
+    result = handle_and_push_buffer (self, self->buffer,
+        GST_BUFFER_IS_DISCONT (buf));
+  }
+
+  /* Transfer ownership */
+  self->buffer = buf;
+  return result;
+}
+
+/* @buf: (transfer all) */
+static GstFlowReturn
+handle_and_push_buffer_list (GstRtpOnvifTimestamp * self,
+    GstBufferList * list, gboolean end_contiguous)
+{
+  GstBuffer *buf;
+
+  /* Set the extension on the *first* buffer */
+  buf = gst_buffer_list_get (list, 0);
+  if (!handle_buffer (self, buf, end_contiguous)) {
+    gst_buffer_list_unref (list);
+    return GST_FLOW_ERROR;
+  }
+
+  return gst_pad_push_list (self->srcpad, list);
+}
+
+/* gst_pad_chain_list_default() refs the buffer when passing it to the chain
+ * function, making it not writable. We implement our own chain_list function
+ * to avoid having to copy each buffer. */
+static GstFlowReturn
+gst_rtp_onvif_timestamp_chain_list (GstPad * pad, GstObject * parent,
+    GstBufferList * list)
+{
+  GstRtpOnvifTimestamp *self = GST_RTP_ONVIF_TIMESTAMP (parent);
+  GstFlowReturn result = GST_FLOW_OK;
+  GstBuffer *buf;
+
+  if (!self->prop_set_e_bit) {
+    return handle_and_push_buffer_list (self, list, FALSE);
+  }
+
+  /* We have to wait for the *next* list before pushing this one */
+
+  if (self->list) {
+    /* push the *previous* list received */
+    buf = gst_buffer_list_get (list, 0);
+
+    result = handle_and_push_buffer_list (self, self->list,
+        GST_BUFFER_IS_DISCONT (buf));
+  }
+
+  /* Transfer ownership */
+  self->list = list;
+  return result;
+}
diff --git a/gst/onvif/gstrtponviftimestamp.h b/gst/onvif/gstrtponviftimestamp.h
new file mode 100644
index 0000000..40ad8d3
--- /dev/null
+++ b/gst/onvif/gstrtponviftimestamp.h
@@ -0,0 +1,74 @@
+/*
+ * gstrtponviftimestamp.h
+ *
+ * Copyright (C) 2014 Axis Communications AB
+ *  Author: Guillaume Desmottes <guillaume.desmottes@collabora.com>
+ *
+ * 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GST_RTP_ONVIF_TIMESTAMP_H__
+#define __GST_RTP_ONVIF_TIMESTAMP_H__
+
+
+#include <gst/gst.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GST_TYPE_RTP_ONVIF_TIMESTAMP \
+  (gst_rtp_onvif_timestamp_get_type())
+#define GST_RTP_ONVIF_TIMESTAMP(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_ONVIF_TIMESTAMP,GstRtpOnvifTimestamp))
+#define GST_RTP_ONVIF_TIMESTAMP_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_ONVIF_TIMESTAMP,GstRtpOnvifTimestampClass))
+#define GST_IS_RTP_ONVIF_TIMESTAMP(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_ONVIF_TIMESTAMP))
+#define GST_IS_RTP_ONVIF_TIMESTAMP_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_ONVIF_TIMESTAMP))
+
+typedef struct _GstRtpOnvifTimestamp GstRtpOnvifTimestamp;
+typedef struct _GstRtpOnvifTimestampClass GstRtpOnvifTimestampClass;
+
+struct _GstRtpOnvifTimestamp {
+  GstElement element;
+
+  /* pads */
+  GstPad *sinkpad,*srcpad;
+
+  GstClockTime prop_ntp_offset;
+  guint prop_cseq;
+  gboolean prop_set_e_bit;
+
+  GstClockTime ntp_offset;
+
+  GstSegment segment;
+  gboolean received_segment;
+  /* Buffer waiting to be handled, only used if prop_set_e_bit is TRUE */
+  GstBuffer *buffer;
+  GstBufferList *list;
+};
+
+struct _GstRtpOnvifTimestampClass {
+  GstElementClass parent_class;
+};
+
+GType gst_rtp_onvif_timestamp_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_RTP_ONVIF_TIMESTAMP_H__ */
diff --git a/gst/patchdetect/Makefile.in b/gst/patchdetect/Makefile.in
index 6d0d941..1e6caf2 100644
--- a/gst/patchdetect/Makefile.in
+++ b/gst/patchdetect/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/patchdetect/gstpatchdetect.c b/gst/patchdetect/gstpatchdetect.c
index 783ae0b..06a6396 100644
--- a/gst/patchdetect/gstpatchdetect.c
+++ b/gst/patchdetect/gstpatchdetect.c
@@ -299,7 +299,7 @@
   gboolean valid;
 } Patch;
 
-static Color patch_colors[24] = {
+static const Color patch_colors[24] = {
   {115, 82, 68, 92, 119, 143},
   {194, 150, 130, 152, 115, 148},
   {98, 122, 157, 119, 146, 116},
diff --git a/gst/pcapparse/Makefile.in b/gst/pcapparse/Makefile.in
index 5b347fe..8e64945 100644
--- a/gst/pcapparse/Makefile.in
+++ b/gst/pcapparse/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/pcapparse/gstpcapparse.c b/gst/pcapparse/gstpcapparse.c
index 069d759..ade724d 100644
--- a/gst/pcapparse/gstpcapparse.c
+++ b/gst/pcapparse/gstpcapparse.c
@@ -360,20 +360,28 @@
   guint16 len;
 
   switch (self->linktype) {
-    case DLT_ETHER:
+    case LINKTYPE_ETHER:
       if (buf_size < ETH_HEADER_LEN + IP_HEADER_MIN_LEN + UDP_HEADER_LEN)
         return FALSE;
 
       eth_type = GUINT16_FROM_BE (*((guint16 *) (buf + 12)));
       buf_ip = buf + ETH_HEADER_LEN;
       break;
-    case DLT_SLL:
+    case LINKTYPE_SLL:
       if (buf_size < SLL_HEADER_LEN + IP_HEADER_MIN_LEN + UDP_HEADER_LEN)
         return FALSE;
 
       eth_type = GUINT16_FROM_BE (*((guint16 *) (buf + 14)));
       buf_ip = buf + SLL_HEADER_LEN;
       break;
+    case LINKTYPE_RAW:
+      if (buf_size < IP_HEADER_MIN_LEN + UDP_HEADER_LEN)
+        return FALSE;
+
+      eth_type = 0x800;         /* This is fine since IPv4/IPv6 is parse elsewhere */
+      buf_ip = buf;
+      break;
+
     default:
       return FALSE;
   }
@@ -569,10 +577,11 @@
         goto out;
       }
 
-      if (linktype != DLT_ETHER && linktype != DLT_SLL) {
+      if (linktype != LINKTYPE_ETHER && linktype != LINKTYPE_SLL &&
+          linktype != LINKTYPE_RAW) {
         GST_ELEMENT_ERROR (self, STREAM, WRONG_TYPE, (NULL),
-            ("Only dumps of type Ethernet or Linux Coooked (SLL) understood,"
-                " type %d unknown", linktype));
+            ("Only dumps of type Ethernet, raw IP or Linux Cooked (SLL) "
+                "understood; type %d unknown", linktype));
         ret = GST_FLOW_ERROR;
         goto out;
       }
diff --git a/gst/pcapparse/gstpcapparse.h b/gst/pcapparse/gstpcapparse.h
index ef90ea2..2c9216f 100644
--- a/gst/pcapparse/gstpcapparse.h
+++ b/gst/pcapparse/gstpcapparse.h
@@ -47,8 +47,9 @@
 
 typedef enum
 {
-  DLT_ETHER  = 1,
-  DLT_SLL = 113
+  LINKTYPE_ETHER  = 1,
+  LINKTYPE_RAW = 101,
+  LINKTYPE_SLL = 113
 } GstPcapParseLinktype;
 
 /**
diff --git a/gst/pnm/Makefile.in b/gst/pnm/Makefile.in
index eb4014d..5cedcf2 100644
--- a/gst/pnm/Makefile.in
+++ b/gst/pnm/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/pnm/gstpnmdec.c b/gst/pnm/gstpnmdec.c
index 9c1c2cf..b4bf3d2 100644
--- a/gst/pnm/gstpnmdec.c
+++ b/gst/pnm/gstpnmdec.c
@@ -193,7 +193,7 @@
   guint i_rowstride;
   guint o_rowstride;
   GstFlowReturn r = GST_FLOW_OK;
-  gint bytes, i;
+  gint bytes, i, total_bytes = 0;
 
   r = gst_video_decoder_allocate_output_frame (decoder, frame);
   if (r != GST_FLOW_OK) {
@@ -224,6 +224,7 @@
       omap.data[i * 8 + 6] = (imap.data[i] & 0x02) ? 0 : 255;
       omap.data[i * 8 + 7] = (imap.data[i] & 0x01) ? 0 : 255;
     }
+    total_bytes = bytes * 8;
   } else
     /* Need to convert from PNM rowstride to GStreamer rowstride */
   if (s->mngr.info.width % 4 != 0) {
@@ -238,8 +239,26 @@
     for (i = 0; i < s->mngr.info.height; i++)
       memcpy (omap.data + i * o_rowstride, imap.data + i * i_rowstride,
           i_rowstride);
+    total_bytes = o_rowstride * s->mngr.info.height;
   } else {
     memcpy (omap.data, imap.data, s->size);
+    total_bytes = s->size;
+  }
+
+  if (s->mngr.info.type != GST_PNM_TYPE_BITMAP) {
+    /* Convert the pixels from 0 - max range to 0 - 255 range */
+    if (s->mngr.info.max < 255) {
+      gint max = s->mngr.info.max;
+      for (i = 0; i < total_bytes; i++) {
+        if (omap.data[i] <= max) {
+          omap.data[i] = 255 * omap.data[i] / max;
+        } else {
+          /* This is an error case, wherein value in the data stream is
+             more than max. Clamp such values to 255 */
+          omap.data[i] = 255;
+        }
+      }
+    }
   }
 
   if (s->mngr.info.encoding == GST_PNM_ENCODING_ASCII) {
diff --git a/gst/pnm/gstpnmenc.c b/gst/pnm/gstpnmenc.c
index dc09c6f..1c059c8 100644
--- a/gst/pnm/gstpnmenc.c
+++ b/gst/pnm/gstpnmenc.c
@@ -32,10 +32,6 @@
  * </refsect2>
  */
 
-/*
- * FIXME: Port to GstVideoEncoder
- */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -45,6 +41,8 @@
 
 #include <gst/gstutils.h>
 #include <gst/video/video.h>
+#include <gst/video/gstvideometa.h>
+#include <stdio.h>
 
 #include <string.h>
 
@@ -65,7 +63,13 @@
 GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
     GST_STATIC_CAPS (MIME_ALL));
 
-G_DEFINE_TYPE (GstPnmenc, gst_pnmenc, GST_TYPE_ELEMENT);
+G_DEFINE_TYPE (GstPnmenc, gst_pnmenc, GST_TYPE_VIDEO_ENCODER);
+#define parent_class gst_pnmenc_parent_class
+
+static GstFlowReturn
+gst_pnmenc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame);
+
+static void gst_pnmenc_finalize (GObject * object);
 
 static void
 gst_pnmenc_set_property (GObject * object, guint prop_id, const GValue * value,
@@ -75,10 +79,11 @@
 
   switch (prop_id) {
     case GST_PNMENC_PROP_ASCII:
-      if (g_value_get_boolean (value))
+      if (g_value_get_boolean (value)) {
         s->info.encoding = GST_PNM_ENCODING_ASCII;
-      else
+      } else {
         s->info.encoding = GST_PNM_ENCODING_RAW;
+      }
       s->info.fields |= GST_PNM_INFO_FIELDS_ENCODING;
       break;
     default:
@@ -103,161 +108,181 @@
   }
 }
 
-static GstFlowReturn
-gst_pnmenc_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
-{
-  GstPnmenc *s = GST_PNMENC (parent);
-  GstFlowReturn r;
-  gchar *header;
-  GstBuffer *out;
-
-  if (s->info.width == 0 || s->info.height == 0 || s->info.fields == 0)
-    goto not_negotiated;
-
-  /* Assumption: One buffer, one image. That is, always first write header. */
-  header = g_strdup_printf ("P%i\n%i %i\n%i\n",
-      s->info.type + 3 * (1 - s->info.encoding), s->info.width, s->info.height,
-      s->info.max);
-  out = gst_buffer_new_wrapped (header, strlen (header));
-  if ((r = gst_pad_push (s->src, out)) != GST_FLOW_OK)
-    goto out;
-
-  /* Need to convert from GStreamer rowstride to PNM rowstride */
-  if (s->info.width % 4 != 0) {
-    guint i_rowstride;
-    guint o_rowstride;
-    GstBuffer *obuf;
-    guint i;
-    GstMapInfo imap, omap;
-
-    if (s->info.type == GST_PNM_TYPE_PIXMAP) {
-      o_rowstride = 3 * s->info.width;
-      i_rowstride = GST_ROUND_UP_4 (o_rowstride);
-    } else {
-      o_rowstride = s->info.width;
-      i_rowstride = GST_ROUND_UP_4 (o_rowstride);
-    }
-
-    obuf = gst_buffer_new_and_alloc (o_rowstride * s->info.height);
-    gst_buffer_map (obuf, &omap, GST_MAP_WRITE);
-    gst_buffer_map (buf, &imap, GST_MAP_READ);
-    for (i = 0; i < s->info.height; i++)
-      memcpy (omap.data + o_rowstride * i, imap.data + i_rowstride * i,
-          o_rowstride);
-    gst_buffer_unmap (buf, &imap);
-    gst_buffer_unmap (obuf, &omap);
-    gst_buffer_unref (buf);
-    buf = obuf;
-  } else {
-    /* Pass through the data. */
-    buf = gst_buffer_make_writable (buf);
-  }
-
-  /* We might need to convert to ASCII... */
-  if (s->info.encoding == GST_PNM_ENCODING_ASCII) {
-    GstBuffer *obuf;
-    guint i, o;
-    GstMapInfo imap, omap;
-
-    gst_buffer_map (buf, &imap, GST_MAP_READ);
-    obuf = gst_buffer_new_and_alloc (imap.size * (4 + 1 / 20.));
-    gst_buffer_map (obuf, &omap, GST_MAP_WRITE);
-    for (i = o = 0; i < imap.size; i++) {
-      g_snprintf ((char *) omap.data + o, 4, "%3i", imap.data[i]);
-      o += 3;
-      omap.data[o++] = ' ';
-      if (!((i + 1) % 20))
-        omap.data[o++] = '\n';
-    }
-    gst_buffer_unmap (buf, &imap);
-    gst_buffer_unmap (obuf, &omap);
-    gst_buffer_unref (buf);
-    buf = obuf;
-  }
-
-  r = gst_pad_push (s->src, buf);
-
-out:
-
-  return r;
-
-not_negotiated:
-  {
-    gst_buffer_unref (buf);
-    return GST_FLOW_NOT_NEGOTIATED;
-  }
-}
-
-static gboolean
-gst_pnmenc_setcaps (GstPnmenc * s, GstCaps * caps)
-{
-  gboolean r;
-  GstCaps *srccaps;
-
-  s->info.max = 255;
-  s->info.fields = GST_PNM_INFO_FIELDS_MAX;
-
-  if (!gst_video_info_from_caps (&s->vinfo, caps))
-    return FALSE;
-
-  if (GST_VIDEO_INFO_IS_RGB (&s->vinfo)) {
-    s->info.type = GST_PNM_TYPE_PIXMAP;
-    srccaps = gst_caps_from_string (MIME_PM);
-  } else if (GST_VIDEO_INFO_IS_GRAY (&s->vinfo)) {
-    s->info.type = GST_PNM_TYPE_GRAYMAP;
-    srccaps = gst_caps_from_string (MIME_GM);
-  } else {
-    return FALSE;
-  }
-  r = gst_pad_set_caps (s->src, srccaps);
-  gst_caps_unref (srccaps);
-  s->info.fields |= GST_PNM_INFO_FIELDS_TYPE;
-
-  /* Remember width and height of the input data. */
-  s->info.width = GST_VIDEO_INFO_WIDTH (&s->vinfo);
-  s->info.height = GST_VIDEO_INFO_HEIGHT (&s->vinfo);
-  s->info.fields |= GST_PNM_INFO_FIELDS_WIDTH | GST_PNM_INFO_FIELDS_HEIGHT;
-
-  return r;
-}
-
-static gboolean
-gst_pnmenc_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
-  GstPnmenc *s = GST_PNMENC (parent);
-  gboolean r = FALSE;
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_CAPS:
-    {
-      GstCaps *caps;
-
-      gst_event_parse_caps (event, &caps);
-      r = gst_pnmenc_setcaps (s, caps);
-      gst_event_unref (event);
-      break;
-    }
-    default:
-      r = gst_pad_event_default (pad, parent, event);
-      break;
-  }
-
-  return r;
-}
-
 static void
 gst_pnmenc_init (GstPnmenc * s)
 {
-  GstPad *pad;
+  /* Set default encoding as RAW as ASCII takes up 4 time more bytes */
+  s->info.encoding = GST_PNM_ENCODING_RAW;
+}
 
-  pad = gst_pad_new_from_static_template (&sink_pad_template, "sink");
-  gst_pad_set_chain_function (pad, gst_pnmenc_chain);
-  gst_pad_set_event_function (pad, gst_pnmenc_sink_event);
-  gst_pad_use_fixed_caps (pad);
-  gst_element_add_pad (GST_ELEMENT (s), pad);
+static void
+gst_pnmenc_finalize (GObject * object)
+{
+  GstPnmenc *pnmenc = GST_PNMENC (object);
+  if (pnmenc->input_state)
+    gst_video_codec_state_unref (pnmenc->input_state);
 
-  s->src = gst_pad_new_from_static_template (&src_pad_template, "src");
-  gst_element_add_pad (GST_ELEMENT (s), s->src);
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+gst_pnmenc_set_format (GstVideoEncoder * encoder, GstVideoCodecState * state)
+{
+  GstPnmenc *pnmenc;
+  gboolean ret = TRUE;
+  GstVideoInfo *info;
+  GstVideoCodecState *output_state;
+
+  pnmenc = GST_PNMENC (encoder);
+  info = &state->info;
+
+  switch (GST_VIDEO_INFO_FORMAT (info)) {
+    case GST_VIDEO_FORMAT_RGB:
+      pnmenc->info.type = GST_PNM_TYPE_PIXMAP;
+      break;
+    case GST_VIDEO_FORMAT_GRAY8:
+      pnmenc->info.type = GST_PNM_TYPE_GRAYMAP;
+      break;
+    default:
+      ret = FALSE;
+      goto done;
+  }
+
+  pnmenc->info.width = GST_VIDEO_INFO_WIDTH (info);
+  pnmenc->info.height = GST_VIDEO_INFO_HEIGHT (info);
+  /* Supported max value is only one, that is 255 */
+  pnmenc->info.max = 255;
+
+  if (pnmenc->input_state)
+    gst_video_codec_state_unref (pnmenc->input_state);
+  pnmenc->input_state = gst_video_codec_state_ref (state);
+
+  output_state =
+      gst_video_encoder_set_output_state (encoder,
+      gst_caps_new_empty_simple ("image/pnm"), state);
+  gst_video_codec_state_unref (output_state);
+
+done:
+  return ret;
+}
+
+static GstFlowReturn
+gst_pnmenc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame)
+{
+  GstPnmenc *pnmenc;
+  guint size, pixels;
+  GstMapInfo omap, imap;
+  gchar *header;
+  GstVideoInfo *info;
+  GstFlowReturn ret = GST_FLOW_OK;
+  guint i_rowstride, o_rowstride;
+  guint bytes = 0, index, head_size;
+  guint i, j;
+
+  pnmenc = GST_PNMENC (encoder);
+  info = &pnmenc->input_state->info;
+
+  switch (GST_VIDEO_INFO_FORMAT (info)) {
+    case GST_VIDEO_FORMAT_RGB:
+      pixels = size = pnmenc->info.width * pnmenc->info.height * 3;
+      break;
+    case GST_VIDEO_FORMAT_GRAY8:
+      pixels = size = pnmenc->info.width * pnmenc->info.height * 1;
+      break;
+    default:
+      ret = FALSE;
+      goto done;
+  }
+
+  header = g_strdup_printf ("P%i\n%i %i\n%i\n",
+      pnmenc->info.type + 3 * (1 - pnmenc->info.encoding), pnmenc->info.width,
+      pnmenc->info.height, pnmenc->info.max);
+
+  if (pnmenc->info.encoding == GST_PNM_ENCODING_ASCII) {
+    /* Per component 4 bytes are used in case of ASCII encoding */
+    size = size * 4;
+    size += strlen (header);
+    frame->output_buffer =
+        gst_video_encoder_allocate_output_buffer (encoder, (size + size / 20));
+  } else {
+    size += strlen (header);
+    frame->output_buffer =
+        gst_video_encoder_allocate_output_buffer (encoder, size);
+  }
+
+  if (gst_buffer_map (frame->output_buffer, &omap, GST_MAP_WRITE) == FALSE) {
+    ret = GST_FLOW_ERROR;
+    goto done;
+  }
+  if (gst_buffer_map (frame->input_buffer, &imap, GST_MAP_READ) == FALSE) {
+    /* Unmap already mapped buffer */
+    gst_buffer_unmap (frame->output_buffer, &omap);
+    ret = GST_FLOW_ERROR;
+    goto done;
+  }
+  memcpy (omap.data, header, strlen (header));
+
+  head_size = strlen (header);
+  if (pnmenc->info.encoding == GST_PNM_ENCODING_ASCII) {
+    /* We need to convert to ASCII */
+    if (pnmenc->info.width % 4 != 0) {
+      /* Convert from gstreamer rowstride to PNM rowstride */
+      if (pnmenc->info.type == GST_PNM_TYPE_PIXMAP) {
+        o_rowstride = 3 * pnmenc->info.width;
+      } else {
+        o_rowstride = pnmenc->info.width;
+      }
+      i_rowstride = GST_VIDEO_FRAME_COMP_STRIDE (pnmenc->input_state, 0);
+
+      for (i = 0; i < pnmenc->info.height; i++) {
+        index = i * i_rowstride;
+        for (j = 0; j < o_rowstride; j++, bytes++, index++) {
+          g_snprintf ((char *) omap.data + head_size, 4, "%3i",
+              imap.data[index]);
+          head_size += 3;
+          omap.data[head_size++] = ' ';
+          /* Add new line so that file will not end up with sinle big line */
+          if (!((bytes + 1) % 20))
+            omap.data[head_size++] = '\n';
+        }
+      }
+    } else {
+      for (i = 0; i < pixels; i++) {
+        g_snprintf ((char *) omap.data + head_size, 4, "%3i", imap.data[i]);
+        head_size += 3;
+        omap.data[head_size++] = ' ';
+        if (!((i + 1) % 20))
+          omap.data[head_size++] = '\n';
+      }
+    }
+  } else {
+    /* Need to convert from GStreamer rowstride to PNM rowstride */
+    if (pnmenc->info.width % 4 != 0) {
+      if (pnmenc->info.type == GST_PNM_TYPE_PIXMAP) {
+        o_rowstride = 3 * pnmenc->info.width;
+      } else {
+        o_rowstride = pnmenc->info.width;
+      }
+      i_rowstride = GST_VIDEO_FRAME_COMP_STRIDE (pnmenc->input_state, 0);
+
+      for (i = 0; i < pnmenc->info.height; i++)
+        memcpy (omap.data + head_size + o_rowstride * i,
+            imap.data + i_rowstride * i, o_rowstride);
+    } else {
+      /* size contains complete image size inlcuding header size,
+         Exclude header size while copying data */
+      memcpy (omap.data + strlen (header), imap.data, (size - head_size));
+    }
+  }
+
+  gst_buffer_unmap (frame->output_buffer, &omap);
+  gst_buffer_unmap (frame->input_buffer, &imap);
+
+  if ((ret = gst_video_encoder_finish_frame (encoder, frame)) != GST_FLOW_OK)
+    goto done;
+
+done:
+  return ret;
 }
 
 static void
@@ -265,20 +290,28 @@
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+  GstVideoEncoderClass *venc_class = (GstVideoEncoderClass *) klass;
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_pad_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_pad_template));
-  gst_element_class_set_static_metadata (element_class, "PNM image encoder",
-      "Codec/Encoder/Image",
-      "Encodes images into portable pixmap or graymap (PNM) format",
-      "Lutz Mueller <lutz@users.sourceforge.net>");
-
+  parent_class = g_type_class_peek_parent (klass);
   gobject_class->set_property = gst_pnmenc_set_property;
   gobject_class->get_property = gst_pnmenc_get_property;
 
   g_object_class_install_property (gobject_class, GST_PNMENC_PROP_ASCII,
       g_param_spec_boolean ("ascii", "ASCII Encoding", "The output will be "
           "ASCII encoded", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_pad_template));
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_pad_template));
+
+  gst_element_class_set_static_metadata (element_class, "PNM image encoder",
+      "Codec/Encoder/Image",
+      "Encodes images into portable pixmap or graymap (PNM) format",
+      "Lutz Mueller <lutz@users.sourceforge.net>");
+
+  venc_class->set_format = gst_pnmenc_set_format;
+  venc_class->handle_frame = gst_pnmenc_handle_frame;
+  gobject_class->finalize = gst_pnmenc_finalize;
 }
diff --git a/gst/pnm/gstpnmenc.h b/gst/pnm/gstpnmenc.h
index 625379b..cb7f45b 100644
--- a/gst/pnm/gstpnmenc.h
+++ b/gst/pnm/gstpnmenc.h
@@ -38,9 +38,8 @@
 
 struct _GstPnmenc
 {
-  GstElement element;
-
-  GstVideoInfo vinfo;
+  GstVideoEncoder parent;
+  GstVideoCodecState *input_state;
   GstPnmInfo info;
 
   GstPad *src;
@@ -48,7 +47,7 @@
 
 struct _GstPnmencClass
 {
-  GstElementClass parent_class;
+  GstVideoEncoderClass parent;
 };
 
 GType gst_pnmenc_get_type (void) G_GNUC_CONST;
diff --git a/gst/pnm/gstpnmutils.c b/gst/pnm/gstpnmutils.c
index e8a6ece..b7441cd 100644
--- a/gst/pnm/gstpnmutils.c
+++ b/gst/pnm/gstpnmutils.c
@@ -176,6 +176,11 @@
           case '\n':
           case '\t':
           case ' ':
+            /* Check for maximum and minimum supported bit depth and
+               return error if its out of range */
+            if ((mngr->info.max > 255) || (mngr->info.max < 1)) {
+              return GST_PNM_INFO_MNGR_RESULT_FAILED;
+            }
             mngr->info.fields |= GST_PNM_INFO_FIELDS_MAX;
             mngr->data_offset += i + 1;
             return GST_PNM_INFO_MNGR_RESULT_FINISHED;
diff --git a/gst/rawparse/Makefile.in b/gst/rawparse/Makefile.in
index 1b721a4..fd4b406 100644
--- a/gst/rawparse/Makefile.in
+++ b/gst/rawparse/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/rawparse/gstrawparse.c b/gst/rawparse/gstrawparse.c
index e8c9fec..ad2607b 100644
--- a/gst/rawparse/gstrawparse.c
+++ b/gst/rawparse/gstrawparse.c
@@ -29,10 +29,6 @@
 
 #include <string.h>
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include <gst/gst.h>
 #include <gst/base/gstbasetransform.h>
 #include <gst/base/gstadapter.h>
diff --git a/gst/real/Makefile.am b/gst/real/Makefile.am
deleted file mode 100644
index b44196a..0000000
--- a/gst/real/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-plugin_LTLIBRARIES = libgstreal.la 
-
-libgstreal_la_SOURCES =	\
-	gstrealvideodec.c \
-	gstrealaudiodec.c \
-	gstreal.c
-
-libgstreal_la_CFLAGS = \
-	$(GST_PLUGINS_BASE_CFLAGS) \
-	$(GST_BASE_CFLAGS) \
-	$(GST_CFLAGS)
-libgstreal_la_LIBADD = \
-	$(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_API_VERSION@ \
-	$(GST_BASE_LIBS)
-libgstreal_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstreal_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = 	\
-	gstreal.h         \
-	gstrealvideodec.h \
-	gstrealaudiodec.h
diff --git a/gst/real/gstreal.c b/gst/real/gstreal.c
deleted file mode 100644
index 66a74d8..0000000
--- a/gst/real/gstreal.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Real wrapper plugin
- *
- * Copyright (C) Edward Hervey <bilboed@bilboed.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstreal.h"
-#include "gstrealvideodec.h"
-#include "gstrealaudiodec.h"
-
-static gboolean
-plugin_init (GstPlugin * p)
-{
-  if (!gst_element_register (p, "realvideodec", GST_RANK_MARGINAL,
-          GST_TYPE_REAL_VIDEO_DEC))
-    return FALSE;
-  if (!gst_element_register (p, "realaudiodec", GST_RANK_MARGINAL,
-          GST_TYPE_REAL_AUDIO_DEC))
-    return FALSE;
-
-  gst_plugin_add_dependency_simple (p, NULL, DEFAULT_REAL_CODECS_PATH, NULL,
-      GST_PLUGIN_DEPENDENCY_FLAG_NONE);
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, real,
-    "Decode REAL streams",
-    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/real/gstreal.h b/gst/real/gstreal.h
deleted file mode 100644
index 3121099..0000000
--- a/gst/real/gstreal.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Hans de Goede <j.w.r.degoede@hhs.nl>
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_REAL_H__
-#define __GST_REAL_H__
-
-#ifdef HAVE_CPU_I386
-#define DEFAULT_REAL_CODECS_PATH \
-  "/usr/lib/win32:/usr/lib/codecs:/usr/local/RealPlayer/codecs:" \
-  "/usr/local/lib/win32:/usr/local/lib/codecs"
-#endif
-#ifdef HAVE_CPU_X86_64
-#define DEFAULT_REAL_CODECS_PATH \
-  "/usr/lib64/win32:/usr/lib64/codecs:" \
-  "/usr/local/lib64/win32:/usr/local/lib64/codecs"
-#endif
-
-#endif /* __GST_REAL_H__ */
diff --git a/gst/real/gstrealaudiodec.c b/gst/real/gstrealaudiodec.c
deleted file mode 100644
index 78f97c5..0000000
--- a/gst/real/gstrealaudiodec.c
+++ /dev/null
@@ -1,768 +0,0 @@
-/* RealAudio wrapper plugin
- *
- * Copyright (C) 2006 Lutz Mueller <lutz@topfrose.de>
- * Copyright (C) 2006 Edward Hervey <bilboed@bilboed.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstreal.h"
-#include "gstrealaudiodec.h"
-
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (real_audio_dec_debug);
-#define GST_CAT_DEFAULT real_audio_dec_debug
-
-static GstStaticPadTemplate snk_t =
-    GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-pn-realaudio, "
-        "raversion = { 3, 4, 5, 6, 8 }; " "audio/x-sipro "));
-
-static GstStaticPadTemplate src_t =
-GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "width = (int) [ 1, MAX ], "
-        "depth = (int) [ 1, MAX ], "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]"));
-
-#define DEFAULT_RACOOK_NAMES "cook.so:cook.so.6.0"
-#define DEFAULT_RAATRK_NAMES "atrc.so:atrc.so.6.0"
-#define DEFAULT_RA14_4_NAMES "14_4.so.6.0"
-#define DEFAULT_RA28_8_NAMES "28_8.so.6.0"
-#define DEFAULT_RASIPR_NAMES "sipr.so:sipr.so.6.0"
-#define DEFAULT_PWD "Ardubancel Quazanga"
-
-enum
-{
-  PROP_0,
-  PROP_REAL_CODECS_PATH,
-  PROP_RACOOK_NAMES,
-  PROP_RAATRK_NAMES,
-  PROP_RA14_4_NAMES,
-  PROP_RA28_8_NAMES,
-  PROP_RASIPR_NAMES,
-  PROP_PASSWORD
-};
-
-typedef enum
-{
-  GST_REAL_AUDIO_DEC_VERSION_ATRK = 3,
-  GST_REAL_AUDIO_DEC_VERSION_14_4 = 4,
-  GST_REAL_AUDIO_DEC_VERSION_28_8 = 5,
-  GST_REAL_AUDIO_DEC_VERSION_SIPR = 6,
-  GST_REAL_AUDIO_DEC_VERSION_COOK = 8
-} GstRealAudioDecVersion;
-
-typedef struct
-{
-  /* Hooks */
-  GModule *module;
-
-  /* Used by the REAL library. */
-  gpointer context;
-
-    guint16 (*RADecode) (gpointer, guint8 *, guint32, guint8 *, guint32 *,
-      guint32);
-    guint16 (*RACloseCodec) (gpointer);
-    guint16 (*RAFreeDecoder) (gpointer);
-    guint16 (*RAInitDecoder) (gpointer, gpointer);
-    guint16 (*RAOpenCodec2) (gpointer, const gchar *);
-    guint16 (*RASetFlavor) (gpointer, guint16);
-  void (*SetDLLAccessPath) (gchar *);
-  void (*RASetPwd) (gpointer, const gchar *);
-} GstRADecLibrary;
-
-typedef struct
-{
-  guint32 samplerate;
-  guint16 width;
-  guint16 channels;
-  guint16 quality;
-  guint32 leaf_size;
-  guint32 packet_size;
-  guint32 datalen;
-  gpointer data;
-} RAInit;
-
-struct _GstRealAudioDec
-{
-  GstElement parent;
-
-  GstPad *src, *snk;
-
-  /* Caps */
-  guint width, height, leaf_size;
-
-  GstRADecLibrary lib;
-
-  /* Properties */
-  gboolean checked_modules;
-  gchar *real_codecs_path;
-  gchar *raatrk_names;
-  gboolean valid_atrk;
-  gchar *ra14_4_names;
-  gboolean valid_ra14_4;
-  gchar *ra28_8_names;
-  gboolean valid_ra28_8;
-  gchar *rasipr_names;
-  gboolean valid_sipr;
-  gchar *racook_names;
-  gboolean valid_cook;
-  gchar *pwd;
-};
-
-struct _GstRealAudioDecClass
-{
-  GstElementClass parent_class;
-};
-
-GST_BOILERPLATE (GstRealAudioDec, gst_real_audio_dec, GstElement,
-    GST_TYPE_ELEMENT);
-
-static GstFlowReturn
-gst_real_audio_dec_chain (GstPad * pad, GstBuffer * in)
-{
-  GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (GST_PAD_PARENT (pad));
-  GstFlowReturn flow;
-  GstClockTime timestamp;
-  GstBuffer *out = NULL;
-  guint16 res = 0;
-  guint len;
-
-  if (G_UNLIKELY (dec->lib.RADecode == NULL || dec->lib.module == NULL))
-    goto not_negotiated;
-
-  timestamp = GST_BUFFER_TIMESTAMP (in);
-
-  flow = gst_pad_alloc_buffer (dec->src, GST_BUFFER_OFFSET_NONE,
-      dec->width * dec->leaf_size * dec->height * 16,
-      GST_PAD_CAPS (dec->src), &out);
-
-  if (flow != GST_FLOW_OK)
-    goto done;
-
-  res = dec->lib.RADecode (dec->lib.context, GST_BUFFER_DATA (in),
-      GST_BUFFER_SIZE (in), GST_BUFFER_DATA (out), &len, -1);
-
-  if (res != 0)
-    goto could_not_decode;
-
-  GST_BUFFER_SIZE (out) = len;
-  GST_BUFFER_TIMESTAMP (out) = timestamp;
-
-  flow = gst_pad_push (dec->src, out);
-
-done:
-  gst_buffer_unref (in);
-  return flow;
-
-  /* Errors */
-could_not_decode:
-  {
-    gst_buffer_unref (out);
-    GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL),
-        ("Could not decode buffer (%i).", res));
-    flow = GST_FLOW_ERROR;
-    goto done;
-  }
-not_negotiated:
-  {
-    GST_WARNING_OBJECT (dec, "decoder not open, probably no input caps set "
-        "yet, caps on input buffer: %" GST_PTR_FORMAT, GST_BUFFER_CAPS (in));
-    flow = GST_FLOW_NOT_NEGOTIATED;
-    goto done;
-  }
-}
-
-static void
-close_library (GstRealAudioDec * dec, GstRADecLibrary * lib)
-{
-  if (lib->context) {
-    GST_LOG_OBJECT (dec, "closing library");
-    if (lib->RACloseCodec)
-      lib->RACloseCodec (lib->context);
-    /* lib->RAFreeDecoder (lib->context); */
-  }
-  if (lib->module) {
-    GST_LOG_OBJECT (dec, "closing library module");
-    g_module_close (lib->module);
-  }
-  memset (lib, 0, sizeof (GstRADecLibrary));
-}
-
-static gboolean
-open_library (GstRealAudioDec * dec, gint version, GstRADecLibrary * lib)
-{
-  const gchar *path, *names;
-  gchar **split_names, **split_path;
-  gint i, j;
-  gpointer ra_close_codec, ra_decode, ra_free_decoder;
-  gpointer ra_open_codec2, ra_init_decoder, ra_set_flavor;
-  gpointer set_dll_access_path = NULL, ra_set_pwd = NULL;
-  gchar *tmppath = NULL;
-  guint16 res = 0;
-
-  path = dec->real_codecs_path ? dec->real_codecs_path :
-      DEFAULT_REAL_CODECS_PATH;
-
-  switch (version) {
-    case GST_REAL_AUDIO_DEC_VERSION_COOK:
-      names = dec->racook_names ? dec->racook_names : DEFAULT_RACOOK_NAMES;
-      break;
-    case GST_REAL_AUDIO_DEC_VERSION_ATRK:
-      names = dec->raatrk_names ? dec->raatrk_names : DEFAULT_RAATRK_NAMES;
-      break;
-    case GST_REAL_AUDIO_DEC_VERSION_14_4:
-      names = dec->ra14_4_names ? dec->ra14_4_names : DEFAULT_RA14_4_NAMES;
-      break;
-    case GST_REAL_AUDIO_DEC_VERSION_28_8:
-      names = dec->ra28_8_names ? dec->ra28_8_names : DEFAULT_RA28_8_NAMES;
-      break;
-    case GST_REAL_AUDIO_DEC_VERSION_SIPR:
-      names = dec->rasipr_names ? dec->rasipr_names : DEFAULT_RASIPR_NAMES;
-      break;
-    default:
-      goto unknown_version;
-  }
-
-  GST_LOG_OBJECT (dec, "splitting paths %s, names %s", path, names);
-
-  split_path = g_strsplit (path, ":", 0);
-  split_names = g_strsplit (names, ":", 0);
-
-  for (i = 0; split_path[i]; i++) {
-    for (j = 0; split_names[j]; j++) {
-      gchar *codec = g_strconcat (split_path[i], "/", split_names[j], NULL);
-
-      GST_LOG_OBJECT (dec, "opening module %s", codec);
-
-      /* This is racy, but it doesn't matter here; would be nice if GModule
-       * gave us a GError instead of an error string, but it doesn't, so.. */
-      if (g_file_test (codec, G_FILE_TEST_EXISTS)) {
-        lib->module = g_module_open (codec, G_MODULE_BIND_LAZY);
-        if (lib->module == NULL) {
-          GST_ERROR_OBJECT (dec, "Could not open codec library '%s': %s",
-              codec, g_module_error ());
-        }
-      } else {
-        GST_DEBUG_OBJECT (dec, "%s does not exist", codec);
-      }
-      g_free (codec);
-      if (lib->module)
-        goto codec_search_done;
-    }
-  }
-
-codec_search_done:
-  /* we keep the path for a while to set the dll access path */
-  g_strfreev (split_names);
-
-  if (lib->module == NULL)
-    goto could_not_open;
-
-  GST_LOG_OBJECT (dec, "finding symbols");
-
-  if (!g_module_symbol (lib->module, "RACloseCodec", &ra_close_codec) ||
-      !g_module_symbol (lib->module, "RADecode", &ra_decode) ||
-      !g_module_symbol (lib->module, "RAFreeDecoder", &ra_free_decoder) ||
-      !g_module_symbol (lib->module, "RAOpenCodec2", &ra_open_codec2) ||
-      !g_module_symbol (lib->module, "RAInitDecoder", &ra_init_decoder) ||
-      !g_module_symbol (lib->module, "RASetFlavor", &ra_set_flavor)) {
-    goto could_not_load;
-  }
-
-  g_module_symbol (lib->module, "RASetPwd", &ra_set_pwd);
-  g_module_symbol (lib->module, "SetDLLAccessPath", &set_dll_access_path);
-
-  lib->RACloseCodec = (guint16 (*)(gpointer)) ra_close_codec;
-  lib->RADecode =
-      (guint16 (*)(gpointer, guint8 *, guint32, guint8 *, guint32 *, guint32))
-      ra_decode;
-  lib->RAFreeDecoder = (guint16 (*)(gpointer)) ra_free_decoder;
-  lib->RAOpenCodec2 = (guint16 (*)(gpointer, const gchar *)) ra_open_codec2;
-  lib->RAInitDecoder = (guint16 (*)(gpointer, gpointer)) ra_init_decoder;
-  lib->RASetFlavor = (guint16 (*)(gpointer, guint16)) ra_set_flavor;
-  lib->RASetPwd = (void (*)(gpointer, const gchar *)) ra_set_pwd;
-  lib->SetDLLAccessPath = (void (*)(gchar *)) set_dll_access_path;
-
-  if (lib->SetDLLAccessPath)
-    lib->SetDLLAccessPath (split_path[i]);
-
-  tmppath = g_strdup_printf ("%s/", split_path[i]);
-  if ((res = lib->RAOpenCodec2 (&lib->context, tmppath))) {
-    g_free (tmppath);
-    goto could_not_initialize;
-  }
-  g_free (tmppath);
-
-  /* now we are done with the split paths, so free them */
-  g_strfreev (split_path);
-
-  return TRUE;
-
-  /* ERRORS */
-unknown_version:
-  {
-    GST_DEBUG_OBJECT (dec, "Cannot handle version %i.", version);
-    return FALSE;
-  }
-could_not_open:
-  {
-    g_strfreev (split_path);
-    GST_DEBUG_OBJECT (dec, "Could not find library '%s' in '%s'", names, path);
-    return FALSE;
-  }
-could_not_load:
-  {
-    g_strfreev (split_path);
-    close_library (dec, lib);
-    GST_DEBUG_OBJECT (dec, "Could not load all symbols: %s", g_module_error ());
-    return FALSE;
-  }
-could_not_initialize:
-  {
-    close_library (dec, lib);
-    GST_WARNING_OBJECT (dec, "Initialization of REAL driver failed (%i).", res);
-    return FALSE;
-  }
-}
-
-static void
-gst_real_audio_dec_probe_modules (GstRealAudioDec * dec)
-{
-  GstRADecLibrary dummy = { NULL };
-
-  if ((dec->valid_atrk =
-          open_library (dec, GST_REAL_AUDIO_DEC_VERSION_ATRK, &dummy)))
-    close_library (dec, &dummy);
-  if ((dec->valid_ra14_4 =
-          open_library (dec, GST_REAL_AUDIO_DEC_VERSION_14_4, &dummy)))
-    close_library (dec, &dummy);
-  if ((dec->valid_ra28_8 =
-          open_library (dec, GST_REAL_AUDIO_DEC_VERSION_28_8, &dummy)))
-    close_library (dec, &dummy);
-#ifdef HAVE_CPU_X86_64
-  /* disabled because it does not seem to work on 64 bits */
-  dec->valid_sipr = FALSE;
-#else
-  if ((dec->valid_sipr =
-          open_library (dec, GST_REAL_AUDIO_DEC_VERSION_SIPR, &dummy)))
-    close_library (dec, &dummy);
-#endif
-  if ((dec->valid_cook =
-          open_library (dec, GST_REAL_AUDIO_DEC_VERSION_COOK, &dummy)))
-    close_library (dec, &dummy);
-}
-
-static GstCaps *
-gst_real_audio_dec_getcaps (GstPad * pad)
-{
-  GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (GST_PAD_PARENT (pad));
-  GstCaps *res;
-
-  if (dec->checked_modules) {
-    GValue versions = { 0 };
-    GValue version = { 0 };
-
-    GST_LOG_OBJECT (dec, "constructing caps");
-
-    g_value_init (&versions, GST_TYPE_LIST);
-    g_value_init (&version, G_TYPE_INT);
-
-    if (dec->valid_atrk) {
-      g_value_set_int (&version, GST_REAL_AUDIO_DEC_VERSION_ATRK);
-      gst_value_list_append_value (&versions, &version);
-    }
-    if (dec->valid_ra14_4) {
-      g_value_set_int (&version, GST_REAL_AUDIO_DEC_VERSION_14_4);
-      gst_value_list_append_value (&versions, &version);
-    }
-    if (dec->valid_ra28_8) {
-      g_value_set_int (&version, GST_REAL_AUDIO_DEC_VERSION_28_8);
-      gst_value_list_append_value (&versions, &version);
-    }
-    if (dec->valid_sipr) {
-      g_value_set_int (&version, GST_REAL_AUDIO_DEC_VERSION_SIPR);
-      gst_value_list_append_value (&versions, &version);
-    }
-    if (dec->valid_cook) {
-      g_value_set_int (&version, GST_REAL_AUDIO_DEC_VERSION_COOK);
-      gst_value_list_append_value (&versions, &version);
-    }
-
-    if (gst_value_list_get_size (&versions) > 0) {
-      res = gst_caps_new_simple ("audio/x-pn-realaudio", NULL);
-      gst_structure_set_value (gst_caps_get_structure (res, 0),
-          "raversion", &versions);
-    } else {
-      res = gst_caps_new_empty ();
-    }
-
-    if (dec->valid_sipr) {
-      gst_caps_append (res, gst_caps_new_simple ("audio/x-sipro", NULL));
-    }
-    g_value_unset (&versions);
-    g_value_unset (&version);
-  } else {
-    GST_LOG_OBJECT (dec, "returning padtemplate caps");
-    res = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
-  }
-  GST_LOG_OBJECT (dec, "returning caps %" GST_PTR_FORMAT, res);
-
-  return res;
-}
-
-static gboolean
-gst_real_audio_dec_setcaps (GstPad * pad, GstCaps * caps)
-{
-  GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (GST_PAD_PARENT (pad));
-  GstStructure *s = gst_caps_get_structure (caps, 0);
-  gint version, flavor, channels, rate, leaf_size, packet_size, width, height;
-  guint16 res = 0;
-  RAInit data;
-  gboolean bres;
-  const GValue *v;
-  GstBuffer *buf = NULL;
-  const gchar *name = gst_structure_get_name (s);
-
-  if (!strcmp (name, "audio/x-sipro")) {
-    version = GST_REAL_AUDIO_DEC_VERSION_SIPR;
-  } else {
-    if (!gst_structure_get_int (s, "raversion", &version))
-      goto missing_keys;
-  }
-
-  if (!gst_structure_get_int (s, "flavor", &flavor) ||
-      !gst_structure_get_int (s, "channels", &channels) ||
-      !gst_structure_get_int (s, "width", &width) ||
-      !gst_structure_get_int (s, "rate", &rate) ||
-      !gst_structure_get_int (s, "height", &height) ||
-      !gst_structure_get_int (s, "leaf_size", &leaf_size) ||
-      !gst_structure_get_int (s, "packet_size", &packet_size))
-    goto missing_keys;
-
-  if ((v = gst_structure_get_value (s, "codec_data")))
-    buf = g_value_peek_pointer (v);
-
-  GST_LOG_OBJECT (dec, "opening code for version %d", version);
-
-  /* first close existing decoder */
-  close_library (dec, &dec->lib);
-
-  if (!open_library (dec, version, &dec->lib))
-    goto could_not_open;
-
-  /* we have the module, no initialize with the caps data */
-  data.samplerate = rate;
-  data.width = width;
-  data.channels = channels;
-  data.quality = 100;
-  data.leaf_size = leaf_size;
-  data.packet_size = packet_size;
-  data.datalen = buf ? GST_BUFFER_SIZE (buf) : 0;
-  data.data = buf ? GST_BUFFER_DATA (buf) : NULL;
-
-  if ((res = dec->lib.RAInitDecoder (dec->lib.context, &data))) {
-    GST_WARNING_OBJECT (dec, "RAInitDecoder() failed");
-    goto could_not_initialize;
-  }
-
-  if (dec->lib.RASetPwd) {
-    dec->lib.RASetPwd (dec->lib.context, dec->pwd ? dec->pwd : DEFAULT_PWD);
-  }
-
-  if ((res = dec->lib.RASetFlavor (dec->lib.context, flavor))) {
-    GST_WARNING_OBJECT (dec, "RASetFlavor(%d) failed", flavor);
-    goto could_not_initialize;
-  }
-
-  caps = gst_caps_new_simple ("audio/x-raw-int",
-      "endianness", G_TYPE_INT, G_BYTE_ORDER,
-      "width", G_TYPE_INT, width,
-      "depth", G_TYPE_INT, width,
-      "rate", G_TYPE_INT, rate,
-      "channels", G_TYPE_INT, channels, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
-  bres = gst_pad_set_caps (GST_PAD (dec->src), caps);
-  gst_caps_unref (caps);
-  if (!bres)
-    goto could_not_set_caps;
-
-  dec->width = width;
-  dec->height = height;
-  dec->leaf_size = leaf_size;
-
-  GST_LOG_OBJECT (dec, "opened module");
-
-  return TRUE;
-
-missing_keys:
-  {
-    GST_DEBUG_OBJECT (dec, "Could not find all necessary keys in structure.");
-    return FALSE;
-  }
-could_not_open:
-  {
-    GST_DEBUG_OBJECT (dec, "Could not find decoder");
-    return FALSE;
-  }
-could_not_initialize:
-  {
-    close_library (dec, &dec->lib);
-    GST_WARNING_OBJECT (dec, "Initialization of REAL driver failed (%i).", res);
-    return FALSE;
-  }
-could_not_set_caps:
-  {
-    /* should normally not fail */
-    close_library (dec, &dec->lib);
-    GST_DEBUG_OBJECT (dec, "Could not convince peer to accept caps.");
-    return FALSE;
-  }
-}
-
-static void
-gst_real_audio_dec_init (GstRealAudioDec * dec, GstRealAudioDecClass * klass)
-{
-  dec->snk = gst_pad_new_from_static_template (&snk_t, "sink");
-  gst_pad_set_setcaps_function (dec->snk,
-      GST_DEBUG_FUNCPTR (gst_real_audio_dec_setcaps));
-  gst_pad_set_getcaps_function (dec->snk,
-      GST_DEBUG_FUNCPTR (gst_real_audio_dec_getcaps));
-  gst_pad_set_chain_function (dec->snk,
-      GST_DEBUG_FUNCPTR (gst_real_audio_dec_chain));
-  gst_element_add_pad (GST_ELEMENT (dec), dec->snk);
-
-  dec->src = gst_pad_new_from_static_template (&src_t, "src");
-  gst_pad_use_fixed_caps (dec->src);
-  gst_element_add_pad (GST_ELEMENT (dec), dec->src);
-}
-
-static void
-gst_real_audio_dec_base_init (gpointer g_class)
-{
-  GstElementClass *ec = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (ec, gst_static_pad_template_get (&snk_t));
-  gst_element_class_add_pad_template (ec, gst_static_pad_template_get (&src_t));
-  gst_element_class_set_static_metadata (ec, "RealAudio decoder",
-      "Codec/Decoder/Audio", "Decoder for RealAudio streams",
-      "Lutz Mueller <lutz@topfrose.de>");
-}
-
-static GstStateChangeReturn
-gst_real_audio_dec_change_state (GstElement * element,
-    GstStateChange transition)
-{
-  GstStateChangeReturn ret;
-  GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      gst_real_audio_dec_probe_modules (dec);
-      dec->checked_modules = TRUE;
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      close_library (dec, &dec->lib);
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      dec->checked_modules = FALSE;
-      break;
-    default:
-      break;
-  }
-  return ret;
-}
-
-static void
-gst_real_audio_dec_finalize (GObject * object)
-{
-  GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
-
-  close_library (dec, &dec->lib);
-
-  if (dec->real_codecs_path) {
-    g_free (dec->real_codecs_path);
-    dec->real_codecs_path = NULL;
-  }
-  if (dec->racook_names) {
-    g_free (dec->racook_names);
-    dec->racook_names = NULL;
-  }
-  if (dec->raatrk_names) {
-    g_free (dec->raatrk_names);
-    dec->raatrk_names = NULL;
-  }
-  if (dec->ra14_4_names) {
-    g_free (dec->ra14_4_names);
-    dec->ra14_4_names = NULL;
-  }
-  if (dec->ra28_8_names) {
-    g_free (dec->ra28_8_names);
-    dec->ra28_8_names = NULL;
-  }
-  if (dec->rasipr_names) {
-    g_free (dec->rasipr_names);
-    dec->rasipr_names = NULL;
-  }
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_real_audio_dec_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
-
-  switch (prop_id) {
-    case PROP_REAL_CODECS_PATH:
-      if (dec->real_codecs_path)
-        g_free (dec->real_codecs_path);
-      dec->real_codecs_path = g_value_dup_string (value);
-      break;
-    case PROP_RACOOK_NAMES:
-      if (dec->racook_names)
-        g_free (dec->racook_names);
-      dec->racook_names = g_value_dup_string (value);
-      break;
-    case PROP_RAATRK_NAMES:
-      if (dec->raatrk_names)
-        g_free (dec->raatrk_names);
-      dec->raatrk_names = g_value_dup_string (value);
-      break;
-    case PROP_RA14_4_NAMES:
-      if (dec->ra14_4_names)
-        g_free (dec->ra14_4_names);
-      dec->ra14_4_names = g_value_dup_string (value);
-      break;
-    case PROP_RA28_8_NAMES:
-      if (dec->ra28_8_names)
-        g_free (dec->ra28_8_names);
-      dec->ra28_8_names = g_value_dup_string (value);
-      break;
-    case PROP_RASIPR_NAMES:
-      if (dec->rasipr_names)
-        g_free (dec->rasipr_names);
-      dec->rasipr_names = g_value_dup_string (value);
-      break;
-    case PROP_PASSWORD:
-      if (dec->pwd)
-        g_free (dec->pwd);
-      dec->pwd = g_value_dup_string (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_real_audio_dec_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
-
-  switch (prop_id) {
-    case PROP_REAL_CODECS_PATH:
-      g_value_set_string (value, dec->real_codecs_path ? dec->real_codecs_path
-          : DEFAULT_REAL_CODECS_PATH);
-      break;
-    case PROP_RACOOK_NAMES:
-      g_value_set_string (value, dec->racook_names ? dec->racook_names :
-          DEFAULT_RACOOK_NAMES);
-      break;
-    case PROP_RAATRK_NAMES:
-      g_value_set_string (value, dec->raatrk_names ? dec->raatrk_names :
-          DEFAULT_RAATRK_NAMES);
-      break;
-    case PROP_RA14_4_NAMES:
-      g_value_set_string (value, dec->ra14_4_names ? dec->ra14_4_names :
-          DEFAULT_RA14_4_NAMES);
-      break;
-    case PROP_RA28_8_NAMES:
-      g_value_set_string (value, dec->ra28_8_names ? dec->ra28_8_names :
-          DEFAULT_RA28_8_NAMES);
-      break;
-    case PROP_RASIPR_NAMES:
-      g_value_set_string (value, dec->rasipr_names ? dec->rasipr_names :
-          DEFAULT_RASIPR_NAMES);
-      break;
-    case PROP_PASSWORD:
-      g_value_set_string (value, dec->pwd ? dec->pwd : DEFAULT_PWD);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_real_audio_dec_class_init (GstRealAudioDecClass * klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->set_property = gst_real_audio_dec_set_property;
-  object_class->get_property = gst_real_audio_dec_get_property;
-  object_class->finalize = gst_real_audio_dec_finalize;
-
-  element_class->change_state = gst_real_audio_dec_change_state;
-
-  g_object_class_install_property (object_class, PROP_REAL_CODECS_PATH,
-      g_param_spec_string ("real-codecs-path",
-          "Path where to search for RealPlayer codecs",
-          "Path where to search for RealPlayer codecs",
-          DEFAULT_REAL_CODECS_PATH,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RACOOK_NAMES,
-      g_param_spec_string ("racook-names", "Names of cook driver",
-          "Names of cook driver", DEFAULT_RACOOK_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RAATRK_NAMES,
-      g_param_spec_string ("raatrk-names", "Names of atrk driver",
-          "Names of atrk driver", DEFAULT_RAATRK_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RA14_4_NAMES,
-      g_param_spec_string ("ra14-4-names", "Names of 14_4 driver",
-          "Names of 14_4 driver", DEFAULT_RA14_4_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RA28_8_NAMES,
-      g_param_spec_string ("ra28-8-names", "Names of 28_8 driver",
-          "Names of 28_8 driver", DEFAULT_RA28_8_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RASIPR_NAMES,
-      g_param_spec_string ("rasipr-names", "Names of sipr driver",
-          "Names of sipr driver", DEFAULT_RASIPR_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_PASSWORD,
-      g_param_spec_string ("password", "Password", "Password",
-          DEFAULT_PWD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  GST_DEBUG_CATEGORY_INIT (real_audio_dec_debug, "realaudiodec", 0,
-      "RealAudio decoder");
-}
diff --git a/gst/real/gstrealaudiodec.h b/gst/real/gstrealaudiodec.h
deleted file mode 100644
index 0a55678..0000000
--- a/gst/real/gstrealaudiodec.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2006 Lutz Mueller <lutz@topfrose.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_REAL_AUDIO_DEC_H__
-#define __GST_REAL_AUDIO_DEC_H__
-
-#include <gst/gst.h>
-#include <gst/audio/audio.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_REAL_AUDIO_DEC (gst_real_audio_dec_get_type())
-#define GST_REAL_AUDIO_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_REAL_AUDIO_DEC,GstRealAudioDec))
-#define GST_REAL_AUDIO_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_REAL_AUDIO_DEC,GstRealAudioDecClass))
-
-typedef struct _GstRealAudioDec GstRealAudioDec;
-typedef struct _GstRealAudioDecClass GstRealAudioDecClass;
-
-GType gst_real_audio_dec_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_REAL_AUDIO_DEC_H__ */
diff --git a/gst/real/gstrealvideodec.c b/gst/real/gstrealvideodec.c
deleted file mode 100644
index 216cebf..0000000
--- a/gst/real/gstrealvideodec.c
+++ /dev/null
@@ -1,774 +0,0 @@
-/* RealVideo wrapper plugin
- *
- * Copyright (C) 2005 Lutz Mueller <lutz@topfrose.de>
- * Copyright (C) 2006 Edward Hervey <bilboed@bilboed.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstreal.h"
-#include "gstrealvideodec.h"
-
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (realvideode_debug);
-#define GST_CAT_DEFAULT realvideode_debug
-
-static GstStaticPadTemplate snk_t =
-GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-pn-realvideo, " "rmversion = (int) [ 2, 4 ]"));
-static GstStaticPadTemplate src_t =
-GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-yuv, "
-        "format = (fourcc) I420, "
-        "framerate = (fraction) [0/1, MAX], "
-        "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ] "));
-
-#define DEFAULT_RV20_NAMES "drv2.so:drv2.so.6.0"
-#define DEFAULT_RV30_NAMES "drvc.so:drv3.so.6.0"
-#define DEFAULT_RV40_NAMES "drvc.so:drv4.so.6.0"
-#define DEFAULT_MAX_ERRORS 25
-
-enum
-{
-  PROP_0,
-  PROP_REAL_CODECS_PATH,
-  PROP_RV20_NAMES,
-  PROP_RV30_NAMES,
-  PROP_RV40_NAMES,
-  PROP_MAX_ERRORS
-};
-
-GST_BOILERPLATE (GstRealVideoDec, gst_real_video_dec, GstElement,
-    GST_TYPE_ELEMENT);
-
-static gboolean open_library (GstRealVideoDec * dec,
-    GstRealVideoDecVersion version, GstRVDecLibrary * lib);
-static void close_library (GstRealVideoDec * dec, GstRVDecLibrary * lib);
-
-typedef struct
-{
-  guint32 datalen;
-  gint32 interpolate;
-  gint32 nfragments;
-  gpointer fragments;
-  guint32 flags;
-  guint32 timestamp;
-} RVInData;
-
-typedef struct
-{
-  guint32 frames;
-  guint32 notes;
-  guint32 timestamp;
-  guint32 width;
-  guint32 height;
-} RVOutData;
-
-static GstFlowReturn
-gst_real_video_dec_chain (GstPad * pad, GstBuffer * in)
-{
-  GstRealVideoDec *dec;
-  guint8 *data;
-  guint size;
-  GstFlowReturn ret;
-  RVInData tin;
-  RVOutData tout;
-  GstClockTime timestamp, duration;
-  GstBuffer *out;
-  guint32 result;
-  guint frag_count, frag_size;
-
-  dec = GST_REAL_VIDEO_DEC (GST_PAD_PARENT (pad));
-
-  if (G_UNLIKELY (dec->lib.Transform == NULL || dec->lib.module == NULL))
-    goto not_negotiated;
-
-  data = GST_BUFFER_DATA (in);
-  size = GST_BUFFER_SIZE (in);
-  timestamp = GST_BUFFER_TIMESTAMP (in);
-  duration = GST_BUFFER_DURATION (in);
-
-  GST_DEBUG_OBJECT (dec, "got buffer of size %u, timestamp %" GST_TIME_FORMAT,
-      size, GST_TIME_ARGS (timestamp));
-
-  /* alloc output buffer */
-  ret = gst_pad_alloc_buffer (dec->src, GST_BUFFER_OFFSET_NONE,
-      dec->width * dec->height * 3 / 2, GST_PAD_CAPS (dec->src), &out);
-  if (ret != GST_FLOW_OK)
-    goto alloc_failed;
-
-  GST_BUFFER_TIMESTAMP (out) = timestamp;
-  GST_BUFFER_DURATION (out) = duration;
-
-  frag_count = *data++;
-  frag_size = (frag_count + 1) * 8;
-  size -= (frag_size + 1);
-
-  GST_DEBUG_OBJECT (dec, "frag_count %u, frag_size %u, data size %u",
-      frag_count, frag_size, size);
-
-  /* Decode.
-   *
-   * The Buffers contain
-   *
-   *  0                   1                   2                   3
-   *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-   * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   * |  nfragments   |   fragment1 ...                               |
-   * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   * |  ....                                                         |
-   * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   * |  ...          |   fragment2 ...                               |
-   * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   *    ....                                                          
-   * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   * |  ...          |   fragment data                               |
-   * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   *
-   * nfragments: number of fragments 
-   * fragmentN: 8 bytes of fragment data (nfragements + 1) of them
-   * fragment data: the data of the fragments.
-   */
-  tin.datalen = size;
-  tin.interpolate = 0;
-  tin.nfragments = frag_count;
-  tin.fragments = data;
-  tin.flags = 0;
-  tin.timestamp = timestamp;
-
-  /* jump over the frag table to the fragments */
-  data += frag_size;
-
-  result = dec->lib.Transform (
-      (gchar *) data,
-      (gchar *) GST_BUFFER_DATA (out), &tin, &tout, dec->lib.context);
-  if (result)
-    goto could_not_transform;
-
-  /* When we decoded a frame, reset the error counter. We only fail after N
-   * consecutive decoding errors. */
-  dec->error_count = 0;
-
-  gst_buffer_unref (in);
-
-  /* Check for new dimensions */
-  if (tout.frames && ((dec->width != tout.width)
-          || (dec->height != tout.height))) {
-    GstCaps *caps = gst_caps_copy (GST_PAD_CAPS (dec->src));
-    GstStructure *s = gst_caps_get_structure (caps, 0);
-
-    GST_DEBUG_OBJECT (dec, "New dimensions: %"
-        G_GUINT32_FORMAT " x %" G_GUINT32_FORMAT, tout.width, tout.height);
-
-    gst_structure_set (s, "width", G_TYPE_INT, (gint) tout.width,
-        "height", G_TYPE_INT, (gint) tout.height, NULL);
-
-    gst_pad_set_caps (dec->src, caps);
-    gst_buffer_set_caps (out, caps);
-    gst_caps_unref (caps);
-
-    dec->width = tout.width;
-    dec->height = tout.height;
-    GST_BUFFER_SIZE (out) = dec->width * dec->height * 3 / 2;
-  }
-
-  GST_DEBUG_OBJECT (dec,
-      "Pushing out buffer with timestamp %" GST_TIME_FORMAT,
-      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (out)));
-
-  if ((ret = gst_pad_push (dec->src, out)) != GST_FLOW_OK)
-    goto could_not_push;
-
-  return ret;
-
-  /* Errors */
-not_negotiated:
-  {
-    GST_WARNING_OBJECT (dec, "decoder not open, probably no input caps set "
-        "yet, caps on input buffer: %" GST_PTR_FORMAT, GST_BUFFER_CAPS (in));
-    gst_buffer_unref (in);
-    return GST_FLOW_NOT_NEGOTIATED;
-  }
-alloc_failed:
-  {
-    GST_DEBUG_OBJECT (dec, "buffer alloc failed: %s", gst_flow_get_name (ret));
-    gst_buffer_unref (in);
-    return ret;
-  }
-could_not_transform:
-  {
-    gst_buffer_unref (out);
-    gst_buffer_unref (in);
-
-    dec->error_count++;
-
-    if (dec->max_errors && dec->error_count >= dec->max_errors) {
-      GST_ELEMENT_ERROR (dec, STREAM, DECODE,
-          ("Could not decode buffer: %" G_GUINT32_FORMAT, result), (NULL));
-      return GST_FLOW_ERROR;
-    } else {
-      GST_ELEMENT_WARNING (dec, STREAM, DECODE,
-          ("Could not decode buffer: %" G_GUINT32_FORMAT, result), (NULL));
-      return GST_FLOW_OK;
-    }
-  }
-could_not_push:
-  {
-    GST_DEBUG_OBJECT (dec, "Could not push buffer: %s",
-        gst_flow_get_name (ret));
-    return ret;
-  }
-}
-
-static GstCaps *
-gst_real_video_dec_getcaps (GstPad * pad)
-{
-  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (GST_PAD_PARENT (pad));
-  GstCaps *res;
-
-  if (dec->checked_modules) {
-    GValue versions = { 0 };
-    GValue version = { 0 };
-
-    GST_LOG_OBJECT (dec, "constructing caps");
-
-    g_value_init (&versions, GST_TYPE_LIST);
-    g_value_init (&version, G_TYPE_INT);
-
-    if (dec->valid_rv20) {
-      g_value_set_int (&version, GST_REAL_VIDEO_DEC_VERSION_2);
-      gst_value_list_append_value (&versions, &version);
-    }
-    if (dec->valid_rv30) {
-      g_value_set_int (&version, GST_REAL_VIDEO_DEC_VERSION_3);
-      gst_value_list_append_value (&versions, &version);
-    }
-    if (dec->valid_rv40) {
-      g_value_set_int (&version, GST_REAL_VIDEO_DEC_VERSION_4);
-      gst_value_list_append_value (&versions, &version);
-    }
-
-    if (gst_value_list_get_size (&versions) > 0) {
-      res = gst_caps_new_simple ("video/x-pn-realvideo", NULL);
-      gst_structure_set_value (gst_caps_get_structure (res, 0),
-          "rmversion", &versions);
-    } else {
-      res = gst_caps_new_empty ();
-    }
-    g_value_unset (&versions);
-    g_value_unset (&version);
-  } else {
-    GST_LOG_OBJECT (dec, "returning padtemplate caps");
-    res = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
-  }
-  GST_LOG_OBJECT (dec, "returning caps %" GST_PTR_FORMAT, res);
-
-  return res;
-}
-
-static gboolean
-gst_real_video_dec_setcaps (GstPad * pad, GstCaps * caps)
-{
-  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (GST_PAD_PARENT (pad));
-  GstStructure *s = gst_caps_get_structure (caps, 0);
-  gint version, res, width, height, format, subformat;
-  gint framerate_num, framerate_denom;
-  gchar data[36];
-  gboolean bres;
-  const GValue *v;
-
-  if (!gst_structure_get_int (s, "rmversion", &version) ||
-      !gst_structure_get_int (s, "width", (gint *) & width) ||
-      !gst_structure_get_int (s, "height", (gint *) & height) ||
-      !gst_structure_get_int (s, "format", &format) ||
-      !gst_structure_get_int (s, "subformat", &subformat) ||
-      !gst_structure_get_fraction (s, "framerate", &framerate_num,
-          &framerate_denom))
-    goto missing_keys;
-
-  GST_LOG_OBJECT (dec, "Setting version to %d", version);
-
-  close_library (dec, &dec->lib);
-
-  if (!open_library (dec, version, &dec->lib))
-    goto open_failed;
-
-  /* Initialize REAL driver. */
-  GST_WRITE_UINT16_LE (data + 0, 11);
-  GST_WRITE_UINT16_LE (data + 2, width);
-  GST_WRITE_UINT16_LE (data + 4, height);
-  GST_WRITE_UINT16_LE (data + 6, 0);
-  GST_WRITE_UINT32_LE (data + 8, 0);
-  GST_WRITE_UINT32_LE (data + 12, subformat);
-  GST_WRITE_UINT32_LE (data + 16, 1);
-  GST_WRITE_UINT32_LE (data + 20, format);
-
-  if ((res = dec->lib.Init (&data, &dec->lib.context)))
-    goto could_not_initialize;
-
-  if ((v = gst_structure_get_value (s, "codec_data"))) {
-    GstBuffer *buf;
-    guint32 *msgdata;
-    guint i;
-    guint8 *bufdata;
-    guint bufsize;
-    struct
-    {
-      guint32 type;
-      guint32 msg;
-      gpointer data;
-      guint32 extra[6];
-    } msg;
-
-    buf = g_value_peek_pointer (v);
-
-    bufdata = GST_BUFFER_DATA (buf);
-    bufsize = GST_BUFFER_SIZE (buf);
-
-    /* skip format and subformat */
-    bufdata += 8;
-    bufsize -= 8;
-
-    GST_LOG_OBJECT (dec, "Creating custom message of length %d", bufsize);
-
-    msgdata = g_new0 (guint32, bufsize + 2);
-    if (!msgdata)
-      goto could_not_allocate;
-
-    msg.type = 0x24;
-    msg.msg = 1 + ((subformat >> 16) & 7);
-    msg.data = msgdata;
-    for (i = 0; i < 6; i++)
-      msg.extra[i] = 0;
-    msgdata[0] = width;
-    msgdata[1] = height;
-    for (i = 0; i < bufsize; i++)
-      msgdata[i + 2] = 4 * (guint32) bufdata[i];
-
-    res = dec->lib.Message (&msg, dec->lib.context);
-
-    g_free (msgdata);
-    if (res)
-      goto could_not_send_message;
-  }
-
-  caps = gst_caps_new_simple ("video/x-raw-yuv",
-      "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
-      "framerate", GST_TYPE_FRACTION, framerate_num, framerate_denom,
-      "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
-
-  /* set PAR if one was specified in the sink caps */
-  if ((v = gst_structure_get_value (s, "pixel-aspect-ratio"))) {
-    gst_structure_set_value (gst_caps_get_structure (caps, 0),
-        "pixel-aspect-ratio", v);
-  }
-
-  bres = gst_pad_set_caps (GST_PAD (dec->src), caps);
-  gst_caps_unref (caps);
-  if (!bres)
-    goto could_not_set_caps;
-
-  dec->version = version;
-  dec->width = width;
-  dec->height = height;
-  dec->format = format;
-  dec->subformat = subformat;
-  dec->framerate_num = framerate_num;
-  dec->framerate_denom = framerate_denom;
-
-  return TRUE;
-
-missing_keys:
-  {
-    GST_ERROR_OBJECT (dec, "Could not find all necessary keys in structure.");
-    return FALSE;
-  }
-open_failed:
-  {
-    GST_ERROR_OBJECT (dec, "failed to open library");
-    return FALSE;
-  }
-could_not_initialize:
-  {
-    GST_ERROR_OBJECT (dec, "Initialization of REAL driver failed (%i).", res);
-    close_library (dec, &dec->lib);
-    return FALSE;
-  }
-could_not_allocate:
-  {
-    GST_ERROR_OBJECT (dec, "Could not allocate memory.");
-    close_library (dec, &dec->lib);
-    return FALSE;
-  }
-could_not_send_message:
-  {
-    GST_ERROR_OBJECT (dec, "Failed to send custom message needed for "
-        "initialization (%i).", res);
-    close_library (dec, &dec->lib);
-    return FALSE;
-  }
-could_not_set_caps:
-  {
-    GST_ERROR_OBJECT (dec, "Could not convince peer to accept dimensions "
-        "%i x %i.", dec->width, dec->height);
-    close_library (dec, &dec->lib);
-    return FALSE;
-  }
-}
-
-/* Attempts to open the correct library for the configured version */
-
-static gboolean
-open_library (GstRealVideoDec * dec, GstRealVideoDecVersion version,
-    GstRVDecLibrary * lib)
-{
-  gpointer rv_custom_msg, rv_free, rv_init, rv_transform;
-  GModule *module = NULL;
-  const gchar *path, *names;
-  gchar **split_names, **split_path;
-  int i, j;
-
-  GST_DEBUG_OBJECT (dec,
-      "Attempting to open shared library for real video version %d", version);
-
-  path = dec->real_codecs_path ? dec->real_codecs_path :
-      DEFAULT_REAL_CODECS_PATH;
-
-  switch (version) {
-    case GST_REAL_VIDEO_DEC_VERSION_2:
-      names = dec->rv20_names ? dec->rv20_names : DEFAULT_RV20_NAMES;
-      break;
-    case GST_REAL_VIDEO_DEC_VERSION_3:
-      names = dec->rv30_names ? dec->rv30_names : DEFAULT_RV30_NAMES;
-      break;
-    case GST_REAL_VIDEO_DEC_VERSION_4:
-      names = dec->rv40_names ? dec->rv40_names : DEFAULT_RV40_NAMES;
-      break;
-    default:
-      goto unknown_version;
-  }
-
-  split_path = g_strsplit (path, ":", 0);
-  split_names = g_strsplit (names, ":", 0);
-
-  for (i = 0; split_path[i]; i++) {
-    for (j = 0; split_names[j]; j++) {
-      gchar *codec = g_strconcat (split_path[i], "/", split_names[j], NULL);
-
-      GST_DEBUG_OBJECT (dec, "trying %s", codec);
-      /* This is racy, but it doesn't matter here; would be nice if GModule
-       * gave us a GError instead of an error string, but it doesn't, so.. */
-      if (g_file_test (codec, G_FILE_TEST_EXISTS)) {
-        module = g_module_open (codec, G_MODULE_BIND_LAZY);
-        if (module == NULL) {
-          GST_ERROR_OBJECT (dec, "Could not open codec library '%s': %s",
-              codec, g_module_error ());
-        }
-      } else {
-        GST_LOG_OBJECT (dec, "%s does not exist", codec);
-      }
-      g_free (codec);
-      if (module)
-        goto codec_search_done;
-    }
-  }
-
-codec_search_done:
-  g_strfreev (split_path);
-  g_strfreev (split_names);
-
-  if (module == NULL)
-    return FALSE;
-
-  GST_DEBUG_OBJECT (dec, "module opened, finding symbols");
-
-  /* First try opening legacy symbols, if that fails try loading new symbols */
-  if (g_module_symbol (module, "RV20toYUV420Init", &rv_init) &&
-      g_module_symbol (module, "RV20toYUV420Free", &rv_free) &&
-      g_module_symbol (module, "RV20toYUV420Transform", &rv_transform) &&
-      g_module_symbol (module, "RV20toYUV420CustomMessage", &rv_custom_msg)) {
-    GST_LOG_OBJECT (dec, "Loaded legacy symbols");
-  } else if (g_module_symbol (module, "RV40toYUV420Init", &rv_init) &&
-      g_module_symbol (module, "RV40toYUV420Free", &rv_free) &&
-      g_module_symbol (module, "RV40toYUV420Transform", &rv_transform) &&
-      g_module_symbol (module, "RV40toYUV420CustomMessage", &rv_custom_msg)) {
-    GST_LOG_OBJECT (dec, "Loaded new symbols");
-  } else {
-    goto could_not_load;
-  }
-
-  lib->Init = (guint32 (*)(gpointer, gpointer)) rv_init;
-  lib->Free = (guint32 (*)(gpointer)) rv_free;
-  lib->Transform = (guint32 (*)(gchar *, gchar *, gpointer, gpointer, gpointer))
-      rv_transform;
-  lib->Message = (guint32 (*)(gpointer, gpointer)) rv_custom_msg;
-  lib->module = module;
-
-  dec->error_count = 0;
-
-  return TRUE;
-
-unknown_version:
-  {
-    GST_ERROR_OBJECT (dec, "Cannot handle version %i.", version);
-    return FALSE;
-  }
-could_not_load:
-  {
-    close_library (dec, lib);
-    GST_ERROR_OBJECT (dec, "Could not load all symbols: %s", g_module_error ());
-    return FALSE;
-  }
-}
-
-static void
-close_library (GstRealVideoDec * dec, GstRVDecLibrary * lib)
-{
-  if (lib->context) {
-    GST_LOG_OBJECT (dec, "closing library");
-    if (lib->Free)
-      lib->Free (lib->context);
-  }
-  if (lib->module) {
-    GST_LOG_OBJECT (dec, "closing library module");
-    g_module_close (lib->module);
-    lib->module = NULL;
-  }
-  memset (lib, 0, sizeof (*lib));
-}
-
-static void
-gst_real_video_dec_probe_modules (GstRealVideoDec * dec)
-{
-  GstRVDecLibrary dummy = { NULL };
-
-  if ((dec->valid_rv20 =
-          open_library (dec, GST_REAL_VIDEO_DEC_VERSION_2, &dummy)))
-    close_library (dec, &dummy);
-  if ((dec->valid_rv30 =
-          open_library (dec, GST_REAL_VIDEO_DEC_VERSION_3, &dummy)))
-    close_library (dec, &dummy);
-  if ((dec->valid_rv40 =
-          open_library (dec, GST_REAL_VIDEO_DEC_VERSION_4, &dummy)))
-    close_library (dec, &dummy);
-}
-
-static GstStateChangeReturn
-gst_real_video_dec_change_state (GstElement * element,
-    GstStateChange transition)
-{
-  GstStateChangeReturn ret;
-  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      gst_real_video_dec_probe_modules (dec);
-      dec->checked_modules = TRUE;
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      close_library (dec, &dec->lib);
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      dec->checked_modules = FALSE;
-      break;
-    default:
-      break;
-  }
-  return ret;
-}
-
-static void
-gst_real_video_dec_init (GstRealVideoDec * dec, GstRealVideoDecClass * klass)
-{
-  dec->snk = gst_pad_new_from_static_template (&snk_t, "sink");
-  gst_pad_set_getcaps_function (dec->snk,
-      GST_DEBUG_FUNCPTR (gst_real_video_dec_getcaps));
-  gst_pad_set_setcaps_function (dec->snk,
-      GST_DEBUG_FUNCPTR (gst_real_video_dec_setcaps));
-  gst_pad_set_chain_function (dec->snk,
-      GST_DEBUG_FUNCPTR (gst_real_video_dec_chain));
-  gst_element_add_pad (GST_ELEMENT (dec), dec->snk);
-
-  dec->src = gst_pad_new_from_static_template (&src_t, "src");
-  gst_pad_use_fixed_caps (dec->src);
-  gst_element_add_pad (GST_ELEMENT (dec), dec->src);
-
-  dec->max_errors = DEFAULT_MAX_ERRORS;
-  dec->error_count = 0;
-}
-
-static void
-gst_real_video_dec_base_init (gpointer g_class)
-{
-  GstElementClass *ec = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_add_pad_template (ec, gst_static_pad_template_get (&snk_t));
-  gst_element_class_add_pad_template (ec, gst_static_pad_template_get (&src_t));
-  gst_element_class_set_static_metadata (ec, "RealVideo decoder",
-      "Codec/Decoder/Video", "Decoder for RealVideo streams",
-      "Lutz Mueller <lutz@topfrose.de>");
-}
-
-static void
-gst_real_video_dec_finalize (GObject * object)
-{
-  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
-
-  close_library (dec, &dec->lib);
-
-  if (dec->real_codecs_path) {
-    g_free (dec->real_codecs_path);
-    dec->real_codecs_path = NULL;
-  }
-  if (dec->rv20_names) {
-    g_free (dec->rv20_names);
-    dec->rv20_names = NULL;
-  }
-  if (dec->rv30_names) {
-    g_free (dec->rv30_names);
-    dec->rv30_names = NULL;
-  }
-  if (dec->rv40_names) {
-    g_free (dec->rv40_names);
-    dec->rv40_names = NULL;
-  }
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_real_video_dec_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
-
-  /* Changing the location of the .so supposes it's not being done
-   * in a state greater than READY !
-   */
-
-  switch (prop_id) {
-    case PROP_REAL_CODECS_PATH:
-      if (dec->real_codecs_path)
-        g_free (dec->real_codecs_path);
-      dec->real_codecs_path = g_value_dup_string (value);
-      break;
-    case PROP_RV20_NAMES:
-      if (dec->rv20_names)
-        g_free (dec->rv20_names);
-      dec->rv20_names = g_value_dup_string (value);
-      break;
-    case PROP_RV30_NAMES:
-      if (dec->rv30_names)
-        g_free (dec->rv30_names);
-      dec->rv30_names = g_value_dup_string (value);
-      break;
-    case PROP_RV40_NAMES:
-      if (dec->rv40_names)
-        g_free (dec->rv40_names);
-      dec->rv40_names = g_value_dup_string (value);
-      break;
-    case PROP_MAX_ERRORS:
-      dec->max_errors = g_value_get_int (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_real_video_dec_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
-
-  switch (prop_id) {
-    case PROP_REAL_CODECS_PATH:
-      g_value_set_string (value, dec->real_codecs_path ? dec->real_codecs_path
-          : DEFAULT_REAL_CODECS_PATH);
-      break;
-    case PROP_RV20_NAMES:
-      g_value_set_string (value, dec->rv20_names ? dec->rv20_names :
-          DEFAULT_RV20_NAMES);
-      break;
-    case PROP_RV30_NAMES:
-      g_value_set_string (value, dec->rv30_names ? dec->rv30_names :
-          DEFAULT_RV30_NAMES);
-      break;
-    case PROP_RV40_NAMES:
-      g_value_set_string (value, dec->rv40_names ? dec->rv40_names :
-          DEFAULT_RV40_NAMES);
-      break;
-    case PROP_MAX_ERRORS:
-      g_value_set_int (value, dec->max_errors);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_real_video_dec_class_init (GstRealVideoDecClass * klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  object_class->set_property = gst_real_video_dec_set_property;
-  object_class->get_property = gst_real_video_dec_get_property;
-  object_class->finalize = gst_real_video_dec_finalize;
-
-  element_class->change_state = gst_real_video_dec_change_state;
-
-  g_object_class_install_property (object_class, PROP_REAL_CODECS_PATH,
-      g_param_spec_string ("real-codecs-path",
-          "Path where to search for RealPlayer codecs",
-          "Path where to search for RealPlayer codecs",
-          DEFAULT_REAL_CODECS_PATH,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RV20_NAMES,
-      g_param_spec_string ("rv20-names", "Names of rv20 driver",
-          "Names of rv20 driver", DEFAULT_RV20_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RV30_NAMES,
-      g_param_spec_string ("rv30-names", "Names of rv30 driver",
-          "Names of rv30 driver", DEFAULT_RV30_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_RV40_NAMES,
-      g_param_spec_string ("rv40-names", "Names of rv40 driver",
-          "Names of rv40 driver", DEFAULT_RV40_NAMES,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-  g_object_class_install_property (object_class, PROP_MAX_ERRORS,
-      g_param_spec_int ("max-errors", "Max errors",
-          "Maximum number of consecutive errors (0 = unlimited)",
-          0, G_MAXINT, DEFAULT_MAX_ERRORS,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  GST_DEBUG_CATEGORY_INIT (realvideode_debug, "realvideodec", 0,
-      "RealVideo decoder");
-}
diff --git a/gst/real/gstrealvideodec.h b/gst/real/gstrealvideodec.h
deleted file mode 100644
index 2abb337..0000000
--- a/gst/real/gstrealvideodec.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2006 Lutz Mueller <lutz@topfrose.de>
- * Copyright (C) 2006 Edward Hervey <bilboed@bilbod.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_REAL_VIDEO_DEC_H__
-#define __GST_REAL_VIDEO_DEC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_REAL_VIDEO_DEC (gst_real_video_dec_get_type())
-#define GST_REAL_VIDEO_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_REAL_VIDEO_DEC,GstRealVideoDec))
-#define GST_REAL_VIDEO_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_REAL_VIDEO_DEC,GstRealVideoDecClass))
-
-typedef struct _GstRealVideoDec GstRealVideoDec;
-typedef struct _GstRealVideoDecClass GstRealVideoDecClass;
-typedef enum _GstRealVideoDecVersion GstRealVideoDecVersion;
-
-enum _GstRealVideoDecVersion
-{
-  GST_REAL_VIDEO_DEC_VERSION_2 = 2,
-  GST_REAL_VIDEO_DEC_VERSION_3 = 3,
-  GST_REAL_VIDEO_DEC_VERSION_4 = 4
-};
-
-typedef struct {
-  GModule *module;
-
-  gpointer context;
-
-  guint32 (*Init) (gpointer, gpointer);
-  guint32 (*Free) (gpointer);
-  guint32 (*Transform) (gchar *, gchar *, gpointer, gpointer, gpointer);
-  guint32 (*Message) (gpointer, gpointer);
-
-  /*
-  GstRealVideoDecMessageFunc custom_message;
-  GstRealVideoDecFreeFunc free;
-  GstRealVideoDecInitFunc init;
-  GstRealVideoDecTransformFunc transform;
-  */
-
-} GstRVDecLibrary;
-
-struct _GstRealVideoDec
-{
-  GstElement parent;
-
-  GstPad *src, *snk;
-
-  /* Caps */
-  GstRealVideoDecVersion version;
-  guint width, height;
-  gint format, subformat;
-  gint framerate_num, framerate_denom;
-
-  gint error_count;
-
-  /* Library functions */
-  GstRVDecLibrary lib;
-
-  /* Properties */
-  gchar *real_codecs_path;
-  gboolean checked_modules;
-  gchar *rv20_names;
-  gboolean valid_rv20;
-  gchar *rv30_names;
-  gboolean valid_rv30;
-  gchar *rv40_names;
-  gboolean valid_rv40;
-  gint max_errors;
-};
-
-struct _GstRealVideoDecClass
-{
-  GstElementClass parent_class;
-};
-
-GType gst_real_video_dec_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_REAL_VIDEO_DEC_H__ */
-
-
diff --git a/gst/removesilence/Makefile.in b/gst/removesilence/Makefile.in
index c133beb..d27ab46 100644
--- a/gst/removesilence/Makefile.in
+++ b/gst/removesilence/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/rtp/Makefile.am b/gst/rtp/Makefile.am
new file mode 100644
index 0000000..cc4e0df
--- /dev/null
+++ b/gst/rtp/Makefile.am
@@ -0,0 +1,39 @@
+plugin_LTLIBRARIES = libgstrtpbad.la
+
+libgstrtpbad_la_SOURCES = \
+	gstrtp.c \
+	gstrtph265depay.c \
+	gstrtph265pay.c
+
+libgstrtpbad_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
+	$(GST_CFLAGS)
+
+libgstrtpbad_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+	$(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-$(GST_API_VERSION).la \
+	-lgstaudio-@GST_API_VERSION@ \
+	-lgstvideo-@GST_API_VERSION@ \
+	-lgsttag-@GST_API_VERSION@ \
+	-lgstrtp-@GST_API_VERSION@ \
+	-lgstpbutils-@GST_API_VERSION@ \
+	$(GST_BASE_LIBS) $(GST_LIBS) \
+	$(LIBM)
+libgstrtpbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstrtpbad_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS =			\
+	gstrtph265depay.h \
+	gstrtph265pay.h
+
+Android.mk: Makefile.am $(BUILT_SOURCES)
+	androgenizer \
+	-:PROJECT libgstrtpbad -:SHARED libgstrtpbad \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstrtpbad_la_SOURCES) \
+	 -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstrtpbad_la_CFLAGS) \
+	 -:LDFLAGS $(libgstrtpbad_la_LDFLAGS) \
+	  $(libgstrtpbad_la_LIBADD) \
+	  -ldl \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+	      LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
+	> $@
diff --git a/gst/real/Makefile.in b/gst/rtp/Makefile.in
similarity index 84%
rename from gst/real/Makefile.in
rename to gst/rtp/Makefile.in
index 2282e4e..d04a764 100644
--- a/gst/real/Makefile.in
+++ b/gst/rtp/Makefile.in
@@ -80,7 +80,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = gst/real
+subdir = gst/rtp
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp $(noinst_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -154,19 +154,22 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstreal_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+libgstrtpbad_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-$(GST_API_VERSION).la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
-am_libgstreal_la_OBJECTS = libgstreal_la-gstrealvideodec.lo \
-	libgstreal_la-gstrealaudiodec.lo libgstreal_la-gstreal.lo
-libgstreal_la_OBJECTS = $(am_libgstreal_la_OBJECTS)
+am_libgstrtpbad_la_OBJECTS = libgstrtpbad_la-gstrtp.lo \
+	libgstrtpbad_la-gstrtph265depay.lo \
+	libgstrtpbad_la-gstrtph265pay.lo
+libgstrtpbad_la_OBJECTS = $(am_libgstrtpbad_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstreal_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(libgstreal_la_CFLAGS) $(CFLAGS) \
-	$(libgstreal_la_LDFLAGS) $(LDFLAGS) -o $@
+libgstrtpbad_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(libgstrtpbad_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+	$(CCLD) $(libgstrtpbad_la_CFLAGS) $(CFLAGS) \
+	$(libgstrtpbad_la_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -201,8 +204,8 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libgstreal_la_SOURCES)
-DIST_SOURCES = $(libgstreal_la_SOURCES)
+SOURCES = $(libgstrtpbad_la_SOURCES)
+DIST_SOURCES = $(libgstrtpbad_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -245,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -725,27 +738,30 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstreal.la 
-libgstreal_la_SOURCES = \
-	gstrealvideodec.c \
-	gstrealaudiodec.c \
-	gstreal.c
+plugin_LTLIBRARIES = libgstrtpbad.la
+libgstrtpbad_la_SOURCES = \
+	gstrtp.c \
+	gstrtph265depay.c \
+	gstrtph265pay.c
 
-libgstreal_la_CFLAGS = \
-	$(GST_PLUGINS_BASE_CFLAGS) \
-	$(GST_BASE_CFLAGS) \
+libgstrtpbad_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
 	$(GST_CFLAGS)
 
-libgstreal_la_LIBADD = \
-	$(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_API_VERSION@ \
-	$(GST_BASE_LIBS)
+libgstrtpbad_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+	$(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-$(GST_API_VERSION).la \
+	-lgstaudio-@GST_API_VERSION@ \
+	-lgstvideo-@GST_API_VERSION@ \
+	-lgsttag-@GST_API_VERSION@ \
+	-lgstrtp-@GST_API_VERSION@ \
+	-lgstpbutils-@GST_API_VERSION@ \
+	$(GST_BASE_LIBS) $(GST_LIBS) \
+	$(LIBM)
 
-libgstreal_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstreal_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+libgstrtpbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstrtpbad_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
 noinst_HEADERS = \
-	gstreal.h         \
-	gstrealvideodec.h \
-	gstrealaudiodec.h
+	gstrtph265depay.h \
+	gstrtph265pay.h
 
 all: all-am
 
@@ -760,9 +776,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gst/real/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gst/rtp/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu gst/real/Makefile
+	  $(AUTOMAKE) --gnu gst/rtp/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -817,8 +833,8 @@
 	  rm -f $${locs}; \
 	}
 
-libgstreal.la: $(libgstreal_la_OBJECTS) $(libgstreal_la_DEPENDENCIES) $(EXTRA_libgstreal_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstreal_la_LINK) -rpath $(plugindir) $(libgstreal_la_OBJECTS) $(libgstreal_la_LIBADD) $(LIBS)
+libgstrtpbad.la: $(libgstrtpbad_la_OBJECTS) $(libgstrtpbad_la_DEPENDENCIES) $(EXTRA_libgstrtpbad_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(libgstrtpbad_la_LINK) -rpath $(plugindir) $(libgstrtpbad_la_OBJECTS) $(libgstrtpbad_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -826,9 +842,9 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreal_la-gstreal.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreal_la-gstrealaudiodec.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstreal_la-gstrealvideodec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstrtpbad_la-gstrtp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstrtpbad_la-gstrtph265depay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstrtpbad_la-gstrtph265pay.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -854,26 +870,26 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libgstreal_la-gstrealvideodec.lo: gstrealvideodec.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -MT libgstreal_la-gstrealvideodec.lo -MD -MP -MF $(DEPDIR)/libgstreal_la-gstrealvideodec.Tpo -c -o libgstreal_la-gstrealvideodec.lo `test -f 'gstrealvideodec.c' || echo '$(srcdir)/'`gstrealvideodec.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstreal_la-gstrealvideodec.Tpo $(DEPDIR)/libgstreal_la-gstrealvideodec.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrealvideodec.c' object='libgstreal_la-gstrealvideodec.lo' libtool=yes @AMDEPBACKSLASH@
+libgstrtpbad_la-gstrtp.lo: gstrtp.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtpbad_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtpbad_la_CFLAGS) $(CFLAGS) -MT libgstrtpbad_la-gstrtp.lo -MD -MP -MF $(DEPDIR)/libgstrtpbad_la-gstrtp.Tpo -c -o libgstrtpbad_la-gstrtp.lo `test -f 'gstrtp.c' || echo '$(srcdir)/'`gstrtp.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstrtpbad_la-gstrtp.Tpo $(DEPDIR)/libgstrtpbad_la-gstrtp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrtp.c' object='libgstrtpbad_la-gstrtp.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -c -o libgstreal_la-gstrealvideodec.lo `test -f 'gstrealvideodec.c' || echo '$(srcdir)/'`gstrealvideodec.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtpbad_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtpbad_la_CFLAGS) $(CFLAGS) -c -o libgstrtpbad_la-gstrtp.lo `test -f 'gstrtp.c' || echo '$(srcdir)/'`gstrtp.c
 
-libgstreal_la-gstrealaudiodec.lo: gstrealaudiodec.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -MT libgstreal_la-gstrealaudiodec.lo -MD -MP -MF $(DEPDIR)/libgstreal_la-gstrealaudiodec.Tpo -c -o libgstreal_la-gstrealaudiodec.lo `test -f 'gstrealaudiodec.c' || echo '$(srcdir)/'`gstrealaudiodec.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstreal_la-gstrealaudiodec.Tpo $(DEPDIR)/libgstreal_la-gstrealaudiodec.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrealaudiodec.c' object='libgstreal_la-gstrealaudiodec.lo' libtool=yes @AMDEPBACKSLASH@
+libgstrtpbad_la-gstrtph265depay.lo: gstrtph265depay.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtpbad_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtpbad_la_CFLAGS) $(CFLAGS) -MT libgstrtpbad_la-gstrtph265depay.lo -MD -MP -MF $(DEPDIR)/libgstrtpbad_la-gstrtph265depay.Tpo -c -o libgstrtpbad_la-gstrtph265depay.lo `test -f 'gstrtph265depay.c' || echo '$(srcdir)/'`gstrtph265depay.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstrtpbad_la-gstrtph265depay.Tpo $(DEPDIR)/libgstrtpbad_la-gstrtph265depay.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrtph265depay.c' object='libgstrtpbad_la-gstrtph265depay.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -c -o libgstreal_la-gstrealaudiodec.lo `test -f 'gstrealaudiodec.c' || echo '$(srcdir)/'`gstrealaudiodec.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtpbad_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtpbad_la_CFLAGS) $(CFLAGS) -c -o libgstrtpbad_la-gstrtph265depay.lo `test -f 'gstrtph265depay.c' || echo '$(srcdir)/'`gstrtph265depay.c
 
-libgstreal_la-gstreal.lo: gstreal.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -MT libgstreal_la-gstreal.lo -MD -MP -MF $(DEPDIR)/libgstreal_la-gstreal.Tpo -c -o libgstreal_la-gstreal.lo `test -f 'gstreal.c' || echo '$(srcdir)/'`gstreal.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstreal_la-gstreal.Tpo $(DEPDIR)/libgstreal_la-gstreal.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstreal.c' object='libgstreal_la-gstreal.lo' libtool=yes @AMDEPBACKSLASH@
+libgstrtpbad_la-gstrtph265pay.lo: gstrtph265pay.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtpbad_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtpbad_la_CFLAGS) $(CFLAGS) -MT libgstrtpbad_la-gstrtph265pay.lo -MD -MP -MF $(DEPDIR)/libgstrtpbad_la-gstrtph265pay.Tpo -c -o libgstrtpbad_la-gstrtph265pay.lo `test -f 'gstrtph265pay.c' || echo '$(srcdir)/'`gstrtph265pay.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstrtpbad_la-gstrtph265pay.Tpo $(DEPDIR)/libgstrtpbad_la-gstrtph265pay.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstrtph265pay.c' object='libgstrtpbad_la-gstrtph265pay.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstreal_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstreal_la_CFLAGS) $(CFLAGS) -c -o libgstreal_la-gstreal.lo `test -f 'gstreal.c' || echo '$(srcdir)/'`gstreal.c
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstrtpbad_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstrtpbad_la_CFLAGS) $(CFLAGS) -c -o libgstrtpbad_la-gstrtph265pay.lo `test -f 'gstrtph265pay.c' || echo '$(srcdir)/'`gstrtph265pay.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -1089,6 +1105,20 @@
 	uninstall-pluginLTLIBRARIES
 
 
+Android.mk: Makefile.am $(BUILT_SOURCES)
+	androgenizer \
+	-:PROJECT libgstrtpbad -:SHARED libgstrtpbad \
+	 -:TAGS eng debug \
+         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
+	 -:SOURCES $(libgstrtpbad_la_SOURCES) \
+	 -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstrtpbad_la_CFLAGS) \
+	 -:LDFLAGS $(libgstrtpbad_la_LDFLAGS) \
+	  $(libgstrtpbad_la_LIBADD) \
+	  -ldl \
+	 -:PASSTHROUGH LOCAL_ARM_MODE:=arm \
+	      LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
+	> $@
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/gst/rtp/gstrtp.c b/gst/rtp/gstrtp.c
new file mode 100644
index 0000000..fd07748
--- /dev/null
+++ b/gst/rtp/gstrtp.c
@@ -0,0 +1,47 @@
+/* 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/tag/tag.h>
+
+#include "gstrtph265depay.h"
+#include "gstrtph265pay.h"
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  gst_tag_image_type_get_type ();
+
+  if (!gst_rtp_h265_depay_plugin_init (plugin))
+    return FALSE;
+
+  if (!gst_rtp_h265_pay_plugin_init (plugin))
+    return FALSE;
+
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    rtpbad,
+    "Real-time protocol plugins",
+    plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
diff --git a/gst/rtp/gstrtph265depay.c b/gst/rtp/gstrtph265depay.c
new file mode 100644
index 0000000..941a5db
--- /dev/null
+++ b/gst/rtp/gstrtph265depay.c
@@ -0,0 +1,1413 @@
+/* GStreamer
+ * Copyright (C) <2006> Wim Taymans <wim.taymans@gmail.com>
+ * Copyright (C) <2014> Jurgen Slowack <jurgenslowack@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#include <gst/base/gstbitreader.h>
+#include <gst/rtp/gstrtpbuffer.h>
+#include "gstrtph265depay.h"
+
+GST_DEBUG_CATEGORY_STATIC (rtph265depay_debug);
+#define GST_CAT_DEFAULT (rtph265depay_debug)
+
+/* This is what we'll default to when downstream hasn't
+ * expressed a restriction or preference via caps */
+#define DEFAULT_BYTE_STREAM   TRUE
+#define DEFAULT_ACCESS_UNIT   FALSE
+
+/* 3 zero bytes syncword */
+static const guint8 sync_bytes[] = { 0, 0, 0, 1 };
+
+static GstStaticPadTemplate gst_rtp_h265_depay_src_template =
+    GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (
+        /* FIXME - hvc1 and hev1 formats are not supported yet */
+        /*"video/x-h265, "
+           "stream-format = (string) hvc1, alignment = (string) au; "
+           "video/x-h265, "
+           "stream-format = (string) hev1, alignment = (string) au; " */
+        "video/x-h265, "
+        "stream-format = (string) byte-stream, alignment = (string) { nal, au }")
+    );
+
+static GstStaticPadTemplate gst_rtp_h265_depay_sink_template =
+GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp, "
+        "media = (string) \"video\", "
+        "clock-rate = (int) 90000, " "encoding-name = (string) \"H265\"")
+        /** optional parameters **/
+    /* "profile-space = (int) [ 0, 3 ], " */
+    /* "profile-id = (int) [ 0, 31 ], " */
+    /* "tier-flag = (int) [ 0, 1 ], " */
+    /* "level-id = (int) [ 0, 255 ], " */
+    /* "interop-constraints = (string) ANY, " */
+    /* "profile-compatibility-indicator = (string) ANY, " */
+    /* "sprop-sub-layer-id = (int) [ 0, 6 ], " */
+    /* "recv-sub-layer-id = (int) [ 0, 6 ], " */
+    /* "max-recv-level-id = (int) [ 0, 255 ], " */
+    /* "tx-mode = (string) {MST , SST}, " */
+    /* "sprop-vps = (string) ANY, " */
+    /* "sprop-sps = (string) ANY, " */
+    /* "sprop-pps = (string) ANY, " */
+    /* "sprop-sei = (string) ANY, " */
+    /* "max-lsr = (int) ANY, " *//* MUST be in the range of MaxLumaSR to 16 * MaxLumaSR, inclusive */
+    /* "max-lps = (int) ANY, " *//* MUST be in the range of MaxLumaPS to 16 * MaxLumaPS, inclusive */
+    /* "max-cpb = (int) ANY, " *//* MUST be in the range of MaxCPB to 16 * MaxCPB, inclusive */
+    /* "max-dpb = (int) [1, 16], " */
+    /* "max-br = (int) ANY, " *//* MUST be in the range of MaxBR to 16 * MaxBR, inclusive, for the highest level */
+    /* "max-tr = (int) ANY, " *//* MUST be in the range of MaxTileRows to 16 * MaxTileRows, inclusive, for the highest level */
+    /* "max-tc = (int) ANY, " *//* MUST be in the range of MaxTileCols to 16 * MaxTileCols, inclusive, for the highest level */
+    /* "max-fps = (int) ANY, " */
+    /* "sprop-max-don-diff = (int) [0, 32767], " */
+    /* "sprop-depack-buf-nalus = (int) [0, 32767], " */
+    /* "sprop-depack-buf-nalus = (int) [0, 4294967295], " */
+    /* "depack-buf-cap = (int) [1, 4294967295], " */
+    /* "sprop-segmentation-id = (int) [0, 3], " */
+    /* "sprop-spatial-segmentation-idc = (string) ANY, " */
+    /* "dec-parallel-cap = (string) ANY, " */
+    );
+
+#define gst_rtp_h265_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpH265Depay, gst_rtp_h265_depay,
+    GST_TYPE_RTP_BASE_DEPAYLOAD);
+
+static void gst_rtp_h265_depay_finalize (GObject * object);
+
+static GstStateChangeReturn gst_rtp_h265_depay_change_state (GstElement *
+    element, GstStateChange transition);
+
+static GstBuffer *gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload,
+    GstBuffer * buf);
+static gboolean gst_rtp_h265_depay_setcaps (GstRTPBaseDepayload * filter,
+    GstCaps * caps);
+static gboolean gst_rtp_h265_depay_handle_event (GstRTPBaseDepayload * depay,
+    GstEvent * event);
+
+static void
+gst_rtp_h265_depay_class_init (GstRtpH265DepayClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+  GstRTPBaseDepayloadClass *gstrtpbasedepayload_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+  gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
+
+  gobject_class->finalize = gst_rtp_h265_depay_finalize;
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_rtp_h265_depay_src_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_rtp_h265_depay_sink_template));
+
+  gst_element_class_set_static_metadata (gstelement_class,
+      "RTP H265 depayloader", "Codec/Depayloader/Network/RTP",
+      "Extracts H265 video from RTP packets (draft-ietf-payload-rtp-h265-03.txt)",
+      "Jurgen Slowack <jurgenslowack@gmail.com>");
+  gstelement_class->change_state = gst_rtp_h265_depay_change_state;
+
+  gstrtpbasedepayload_class->process = gst_rtp_h265_depay_process;
+  gstrtpbasedepayload_class->set_caps = gst_rtp_h265_depay_setcaps;
+  gstrtpbasedepayload_class->handle_event = gst_rtp_h265_depay_handle_event;
+}
+
+static void
+gst_rtp_h265_depay_init (GstRtpH265Depay * rtph265depay)
+{
+  rtph265depay->adapter = gst_adapter_new ();
+  rtph265depay->picture_adapter = gst_adapter_new ();
+  rtph265depay->byte_stream = DEFAULT_BYTE_STREAM;
+  rtph265depay->stream_format = (gchar *) g_malloc (10);
+  rtph265depay->merge = DEFAULT_ACCESS_UNIT;
+  rtph265depay->vps = g_ptr_array_new_with_free_func (
+      (GDestroyNotify) gst_buffer_unref);
+  rtph265depay->sps = g_ptr_array_new_with_free_func (
+      (GDestroyNotify) gst_buffer_unref);
+  rtph265depay->pps = g_ptr_array_new_with_free_func (
+      (GDestroyNotify) gst_buffer_unref);
+}
+
+static void
+gst_rtp_h265_depay_reset (GstRtpH265Depay * rtph265depay)
+{
+  gst_adapter_clear (rtph265depay->adapter);
+  rtph265depay->wait_start = TRUE;
+  gst_adapter_clear (rtph265depay->picture_adapter);
+  rtph265depay->picture_start = FALSE;
+  rtph265depay->last_keyframe = FALSE;
+  rtph265depay->last_ts = 0;
+  rtph265depay->current_fu_type = 0;
+  rtph265depay->new_codec_data = FALSE;
+  g_ptr_array_set_size (rtph265depay->vps, 0);
+  g_ptr_array_set_size (rtph265depay->sps, 0);
+  g_ptr_array_set_size (rtph265depay->pps, 0);
+}
+
+static void
+gst_rtp_h265_depay_finalize (GObject * object)
+{
+  GstRtpH265Depay *rtph265depay;
+
+  rtph265depay = GST_RTP_H265_DEPAY (object);
+
+  if (rtph265depay->codec_data)
+    gst_buffer_unref (rtph265depay->codec_data);
+
+  g_free (rtph265depay->stream_format);
+
+  g_object_unref (rtph265depay->adapter);
+  g_object_unref (rtph265depay->picture_adapter);
+
+  g_ptr_array_free (rtph265depay->vps, TRUE);
+  g_ptr_array_free (rtph265depay->sps, TRUE);
+  g_ptr_array_free (rtph265depay->pps, TRUE);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_rtp_h265_depay_negotiate (GstRtpH265Depay * rtph265depay)
+{
+  GstCaps *caps;
+  gint byte_stream = -1;
+  gint merge = -1;
+
+  caps =
+      gst_pad_get_allowed_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay));
+
+  GST_DEBUG_OBJECT (rtph265depay, "allowed caps: %" GST_PTR_FORMAT, caps);
+
+  if (caps) {
+    if (gst_caps_get_size (caps) > 0) {
+      GstStructure *s = gst_caps_get_structure (caps, 0);
+      const gchar *str = NULL;
+
+      if ((str = gst_structure_get_string (s, "stream-format"))) {
+
+        strcpy (rtph265depay->stream_format, str);
+
+        if (strcmp (str, "hev1") == 0) {
+          byte_stream = FALSE;
+        } else if (strcmp (str, "hvc1") == 0) {
+          byte_stream = FALSE;
+        } else if (strcmp (str, "byte-stream") == 0) {
+          byte_stream = TRUE;
+        } else {
+          GST_DEBUG_OBJECT (rtph265depay, "unknown stream-format: %s", str);
+        }
+      }
+
+      if ((str = gst_structure_get_string (s, "alignment"))) {
+        if (strcmp (str, "au") == 0) {
+          merge = TRUE;
+        } else if (strcmp (str, "nal") == 0) {
+          merge = FALSE;
+        } else {
+          GST_DEBUG_OBJECT (rtph265depay, "unknown alignment: %s", str);
+        }
+      }
+    }
+    gst_caps_unref (caps);
+  }
+
+  if (byte_stream != -1) {
+    GST_DEBUG_OBJECT (rtph265depay, "downstream requires byte-stream %d",
+        byte_stream);
+    rtph265depay->byte_stream = byte_stream;
+  } else {
+    GST_DEBUG_OBJECT (rtph265depay, "defaulting to byte-stream %d",
+        DEFAULT_BYTE_STREAM);
+    strcpy (rtph265depay->stream_format, "byte-stream");
+    rtph265depay->byte_stream = DEFAULT_BYTE_STREAM;
+  }
+  if (merge != -1) {
+    GST_DEBUG_OBJECT (rtph265depay, "downstream requires merge %d", merge);
+    rtph265depay->merge = merge;
+  } else {
+    GST_DEBUG_OBJECT (rtph265depay, "defaulting to merge %d",
+        DEFAULT_ACCESS_UNIT);
+    rtph265depay->merge = DEFAULT_ACCESS_UNIT;
+  }
+}
+
+/* Stolen from bad/gst/mpegtsdemux/payloader_parsers.c */
+/* variable length Exp-Golomb parsing according to H.265 spec section 9.2*/
+static gboolean
+read_golomb (GstBitReader * br, guint32 * value)
+{
+  guint8 b, leading_zeros = -1;
+  *value = 1;
+
+  for (b = 0; !b; leading_zeros++) {
+    if (!gst_bit_reader_get_bits_uint8 (br, &b, 1))
+      return FALSE;
+    *value *= 2;
+  }
+
+  *value = (*value >> 1) - 1;
+  if (leading_zeros > 0) {
+    guint32 tmp = 0;
+    if (!gst_bit_reader_get_bits_uint32 (br, &tmp, leading_zeros))
+      return FALSE;
+    *value += tmp;
+  }
+
+  return TRUE;
+}
+
+static gboolean
+parse_sps (GstMapInfo * map, guint32 * sps_id)
+{                               /* To parse seq_parameter_set_id */
+  GstBitReader br = GST_BIT_READER_INIT (map->data + 15,
+      map->size - 15);
+
+  if (map->size < 16)
+    return FALSE;
+
+  if (!read_golomb (&br, sps_id))
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+parse_pps (GstMapInfo * map, guint32 * sps_id, guint32 * pps_id)
+{                               /* To parse picture_parameter_set_id */
+  GstBitReader br = GST_BIT_READER_INIT (map->data + 2,
+      map->size - 2);
+
+  if (map->size < 3)
+    return FALSE;
+
+  if (!read_golomb (&br, pps_id))
+    return FALSE;
+  if (!read_golomb (&br, sps_id))
+    return FALSE;
+
+  return TRUE;
+}
+
+
+static gboolean
+gst_rtp_h265_set_src_caps (GstRtpH265Depay * rtph265depay)
+{
+  gboolean res;
+  GstCaps *srccaps;
+
+  if (!rtph265depay->byte_stream &&
+      (!rtph265depay->new_codec_data ||
+          rtph265depay->vps->len == 0 || rtph265depay->sps->len == 0
+          || rtph265depay->pps->len == 0))
+    return TRUE;
+
+  srccaps = gst_caps_new_simple ("video/x-h265",
+      "stream-format", G_TYPE_STRING,
+      rtph265depay->stream_format,
+      "alignment", G_TYPE_STRING, rtph265depay->merge ? "au" : "nal", NULL);
+
+  if (!rtph265depay->byte_stream) {
+
+    GstBuffer *codec_data;
+    gint i = 0;
+    gint len;
+    guint num_vps = rtph265depay->vps->len;
+    guint num_sps = rtph265depay->sps->len;
+    guint num_pps = rtph265depay->pps->len;
+    GstMapInfo map, nalmap;
+    guint8 *data;
+    gint nl;
+    guint8 num_arrays = 0;
+    guint new_size;
+    GstBitReader br;
+    guint32 tmp;
+    guint8 tmp8 = 0;
+    guint32 max_sub_layers_minus1, temporal_id_nesting_flag, chroma_format_idc,
+        bit_depth_luma_minus8, bit_depth_chroma_minus8,
+        min_spatial_segmentation_idc;
+
+    /* Fixme: Current implementation is not embedding SEI in codec_data */
+
+    if (num_sps == 0)
+      return FALSE;
+
+    /* start with 23 bytes header */
+    len = 23;
+
+    num_arrays = (num_vps > 0) + (num_sps > 0) + (num_pps > 0);
+    len += num_arrays;
+
+    /* add size of vps, sps & pps */
+    for (i = 0; i < num_vps; i++)
+      len += 2 + gst_buffer_get_size (g_ptr_array_index (rtph265depay->vps, i));
+    for (i = 0; i < num_sps; i++)
+      len += 2 + gst_buffer_get_size (g_ptr_array_index (rtph265depay->sps, i));
+    for (i = 0; i < num_pps; i++)
+      len += 2 + gst_buffer_get_size (g_ptr_array_index (rtph265depay->pps, i));
+
+    GST_DEBUG_OBJECT (rtph265depay,
+        "constructing codec_data: num_vps =%d num_sps=%d, num_pps=%d", num_vps,
+        num_sps, num_pps);
+
+    codec_data = gst_buffer_new_and_alloc (len);
+    g_debug ("alloc_len: %u", len);
+    gst_buffer_map (codec_data, &map, GST_MAP_READWRITE);
+    data = map.data;
+
+    memset (data, 0, map.size);
+
+    /* Parsing sps to get the info required further on */
+
+    gst_buffer_map (g_ptr_array_index (rtph265depay->sps, 0), &nalmap,
+        GST_MAP_READ);
+
+    max_sub_layers_minus1 = ((nalmap.data[2]) >> 1) & 0x07;
+    temporal_id_nesting_flag = nalmap.data[2] & 0x01;
+
+    gst_bit_reader_init (&br, nalmap.data + 15, nalmap.size - 15);
+
+    read_golomb (&br, &tmp);    /* sps_seq_parameter_set_id */
+    read_golomb (&br, &chroma_format_idc);      /* chroma_format_idc */
+
+    if (chroma_format_idc == 3)
+
+      gst_bit_reader_get_bits_uint8 (&br, &tmp8, 1);    /* separate_colour_plane_flag */
+
+    read_golomb (&br, &tmp);    /* pic_width_in_luma_samples */
+    read_golomb (&br, &tmp);    /* pic_height_in_luma_samples */
+
+    gst_bit_reader_get_bits_uint8 (&br, &tmp8, 1);      /* conformance_window_flag */
+    if (tmp8) {
+      read_golomb (&br, &tmp);  /* conf_win_left_offset */
+      read_golomb (&br, &tmp);  /* conf_win_right_offset */
+      read_golomb (&br, &tmp);  /* conf_win_top_offset */
+      read_golomb (&br, &tmp);  /* conf_win_bottom_offset */
+    }
+
+    read_golomb (&br, &bit_depth_luma_minus8);  /* bit_depth_luma_minus8 */
+    read_golomb (&br, &bit_depth_chroma_minus8);        /* bit_depth_chroma_minus8 */
+
+    GST_DEBUG_OBJECT (rtph265depay,
+        "Ignoring min_spatial_segmentation for now (assuming zero)");
+
+    min_spatial_segmentation_idc = 0;   /* NOTE - we ignore this for now, but in a perfect world, we should continue parsing to obtain the real value */
+
+    nl = nalmap.size;
+
+    gst_buffer_unmap (g_ptr_array_index (rtph265depay->sps, 0), &nalmap);
+
+    /* HEVCDecoderConfigurationVersion = 1 */
+    data[0] = 1;
+
+    /* Copy from profile_tier_level (Rec. ITU-T H.265 (04/2013) section 7.3.3
+     *
+     * profile_space | tier_flat | profile_idc |
+     * profile_compatibility_flags | constraint_indicator_flags |
+     * level_idc | progressive_source_flag | interlaced_source_flag
+     * non_packed_constraint_flag | frame_only_constraint_flag
+     * reserved_zero_44bits | level_idc */
+    gst_buffer_map (g_ptr_array_index (rtph265depay->sps, 0), &nalmap,
+        GST_MAP_READ);
+    for (i = 0; i < 12; i++)
+      data[i + 1] = nalmap.data[i];
+    gst_buffer_unmap (g_ptr_array_index (rtph265depay->sps, 0), &nalmap);
+
+    /* min_spatial_segmentation_idc */
+    GST_WRITE_UINT16_BE (data + 13, min_spatial_segmentation_idc);
+    data[13] |= 0xf0;
+    data[15] = 0xfc;            /* keeping parrallelismType as zero (unknown) */
+    data[16] = 0xfc | chroma_format_idc;
+    data[17] = 0xf8 | bit_depth_luma_minus8;
+    data[18] = 0xf8 | bit_depth_chroma_minus8;
+    data[19] = 0x00;            /* keep avgFrameRate as unspecified */
+    data[20] = 0x00;            /* keep avgFrameRate as unspecified */
+    /* constFrameRate(2 bits): 0, stream may or may not be of constant framerate
+     * numTemporalLayers (3 bits): number of temporal layers, value from SPS
+     * TemporalIdNested (1 bit): sps_temporal_id_nesting_flag from SPS
+     * lengthSizeMinusOne (2 bits): plus 1 indicates the length of the NALUnitLength */
+    data[21] =
+        0x00 | ((max_sub_layers_minus1 +
+            1) << 3) | (temporal_id_nesting_flag << 2) | (nl - 1);
+    GST_WRITE_UINT8 (data + 22, num_arrays);    /* numOfArrays */
+
+    data += 23;
+
+    /* copy all VPS */
+    if (num_vps > 0) {
+      /* array_completeness | reserved_zero bit | nal_unit_type */
+      data[0] = 0x00 | 0x20;
+      data++;
+
+      GST_WRITE_UINT16_BE (data, num_vps);
+      data += 2;
+
+      for (i = 0; i < num_vps; i++) {
+        gsize nal_size =
+            gst_buffer_get_size (g_ptr_array_index (rtph265depay->vps, i));
+        GST_WRITE_UINT16_BE (data, nal_size);
+        gst_buffer_extract (g_ptr_array_index (rtph265depay->vps, i), 0,
+            data + 2, nal_size);
+        data += 2 + nal_size;
+        GST_DEBUG_OBJECT (rtph265depay, "Copied VPS %d of length %u", i,
+            (guint) nal_size);
+      }
+    }
+
+    /* copy all SPS */
+    if (num_sps > 0) {
+      /* array_completeness | reserved_zero bit | nal_unit_type */
+      data[0] = 0x00 | 0x21;
+      data++;
+
+      GST_WRITE_UINT16_BE (data, num_sps);
+      data += 2;
+
+      for (i = 0; i < num_sps; i++) {
+        gsize nal_size =
+            gst_buffer_get_size (g_ptr_array_index (rtph265depay->sps, i));
+        GST_WRITE_UINT16_BE (data, nal_size);
+        gst_buffer_extract (g_ptr_array_index (rtph265depay->sps, i), 0,
+            data + 2, nal_size);
+        data += 2 + nal_size;
+        GST_DEBUG_OBJECT (rtph265depay, "Copied SPS %d of length %u", i,
+            (guint) nal_size);
+      }
+    }
+
+    /* copy all PPS */
+    if (num_pps > 0) {
+      /* array_completeness | reserved_zero bit | nal_unit_type */
+      data[0] = 0x00 | 0x22;
+      data++;
+
+      GST_WRITE_UINT16_BE (data, num_pps);
+      data += 2;
+
+      for (i = 0; i < num_pps; i++) {
+        gsize nal_size =
+            gst_buffer_get_size (g_ptr_array_index (rtph265depay->pps, i));
+        GST_WRITE_UINT16_BE (data, nal_size);
+        gst_buffer_extract (g_ptr_array_index (rtph265depay->pps, i), 0,
+            data + 2, nal_size);
+        data += 2 + nal_size;
+        GST_DEBUG_OBJECT (rtph265depay, "Copied PPS %d of length %u", i,
+            (guint) nal_size);
+      }
+    }
+
+    new_size = data - map.data;
+    gst_buffer_unmap (codec_data, &map);
+    gst_buffer_set_size (codec_data, new_size);
+
+    gst_caps_set_simple (srccaps,
+        "codec_data", GST_TYPE_BUFFER, codec_data, NULL);
+    gst_buffer_unref (codec_data);
+  }
+
+  res = gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph265depay),
+      srccaps);
+  gst_caps_unref (srccaps);
+
+  if (res)
+    rtph265depay->new_codec_data = FALSE;
+
+  return res;
+}
+
+gboolean
+gst_rtp_h265_add_vps_sps_pps (GstElement * rtph265, GPtrArray * vps_array,
+    GPtrArray * sps_array, GPtrArray * pps_array, GstBuffer * nal)
+{
+  GstMapInfo map;
+  guchar type;
+  guint i;
+
+  gst_buffer_map (nal, &map, GST_MAP_READ);
+
+  type = (map.data[0] >> 1) & 0x3f;
+
+  if (type == GST_H265_VPS_NUT) {
+    guint32 vps_id = (map.data[2] >> 4) & 0x0f;
+
+    for (i = 0; i < vps_array->len; i++) {
+      GstBuffer *vps = g_ptr_array_index (vps_array, i);
+      GstMapInfo vpsmap;
+      guint32 tmp_vps_id;
+
+      gst_buffer_map (vps, &vpsmap, GST_MAP_READ);
+      tmp_vps_id = (vpsmap.data[2] >> 4) & 0x0f;
+
+      if (vps_id == tmp_vps_id) {
+        if (map.size == vpsmap.size &&
+            memcmp (map.data, vpsmap.data, vpsmap.size) == 0) {
+          GST_LOG_OBJECT (rtph265, "Unchanged VPS %u, not updating", vps_id);
+          gst_buffer_unmap (vps, &vpsmap);
+          goto drop;
+        } else {
+          gst_buffer_unmap (vps, &vpsmap);
+          g_ptr_array_remove_index_fast (vps_array, i);
+          g_ptr_array_add (vps_array, nal);
+          GST_LOG_OBJECT (rtph265, "Modified VPS %u, replacing", vps_id);
+          goto done;
+        }
+      }
+      gst_buffer_unmap (vps, &vpsmap);
+    }
+    GST_LOG_OBJECT (rtph265, "Adding new VPS %u", vps_id);
+    g_ptr_array_add (vps_array, nal);
+  } else if (type == GST_H265_SPS_NUT) {
+    guint32 sps_id;
+
+    if (!parse_sps (&map, &sps_id)) {
+      GST_WARNING_OBJECT (rtph265, "Invalid SPS,"
+          " can't parse seq_parameter_set_id");
+      goto drop;
+    }
+
+    for (i = 0; i < sps_array->len; i++) {
+      GstBuffer *sps = g_ptr_array_index (sps_array, i);
+      GstMapInfo spsmap;
+      guint32 tmp_sps_id;
+
+      gst_buffer_map (sps, &spsmap, GST_MAP_READ);
+      parse_sps (&spsmap, &tmp_sps_id);
+
+      if (sps_id == tmp_sps_id) {
+        if (map.size == spsmap.size &&
+            memcmp (map.data, spsmap.data, spsmap.size) == 0) {
+          GST_LOG_OBJECT (rtph265, "Unchanged SPS %u, not updating", sps_id);
+          gst_buffer_unmap (sps, &spsmap);
+          goto drop;
+        } else {
+          gst_buffer_unmap (sps, &spsmap);
+          g_ptr_array_remove_index_fast (sps_array, i);
+          g_ptr_array_add (sps_array, nal);
+          GST_LOG_OBJECT (rtph265, "Modified SPS %u, replacing", sps_id);
+          goto done;
+        }
+      }
+      gst_buffer_unmap (sps, &spsmap);
+    }
+    GST_LOG_OBJECT (rtph265, "Adding new SPS %u", sps_id);
+    g_ptr_array_add (sps_array, nal);
+  } else if (type == GST_H265_PPS_NUT) {
+    guint32 sps_id;
+    guint32 pps_id;
+
+    if (!parse_pps (&map, &sps_id, &pps_id)) {
+      GST_WARNING_OBJECT (rtph265, "Invalid PPS,"
+          " can't parse seq_parameter_set_id or pic_parameter_set_id");
+      goto drop;
+    }
+
+    for (i = 0; i < pps_array->len; i++) {
+      GstBuffer *pps = g_ptr_array_index (pps_array, i);
+      GstMapInfo ppsmap;
+      guint32 tmp_sps_id;
+      guint32 tmp_pps_id;
+
+
+      gst_buffer_map (pps, &ppsmap, GST_MAP_READ);
+      parse_pps (&ppsmap, &tmp_sps_id, &tmp_pps_id);
+
+      if (sps_id == tmp_sps_id && pps_id == tmp_pps_id) {
+        if (map.size == ppsmap.size &&
+            memcmp (map.data, ppsmap.data, ppsmap.size) == 0) {
+          GST_LOG_OBJECT (rtph265, "Unchanged PPS %u:%u, not updating", sps_id,
+              pps_id);
+          gst_buffer_unmap (pps, &ppsmap);
+          goto drop;
+        } else {
+          gst_buffer_unmap (pps, &ppsmap);
+          g_ptr_array_remove_index_fast (pps_array, i);
+          g_ptr_array_add (pps_array, nal);
+          GST_LOG_OBJECT (rtph265, "Modified PPS %u:%u, replacing",
+              sps_id, pps_id);
+          goto done;
+        }
+      }
+      gst_buffer_unmap (pps, &ppsmap);
+    }
+    GST_LOG_OBJECT (rtph265, "Adding new PPS %u:%i", sps_id, pps_id);
+    g_ptr_array_add (pps_array, nal);
+  } else {
+    goto drop;
+  }
+
+done:
+  gst_buffer_unmap (nal, &map);
+
+  return TRUE;
+
+drop:
+  gst_buffer_unmap (nal, &map);
+  gst_buffer_unref (nal);
+
+  return FALSE;
+}
+
+
+static void
+gst_rtp_h265_depay_add_vps_sps_pps (GstRtpH265Depay * rtph265depay,
+    GstBuffer * nal)
+{
+  if (gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265depay),
+          rtph265depay->vps, rtph265depay->sps, rtph265depay->pps, nal))
+    rtph265depay->new_codec_data = TRUE;
+}
+
+static gboolean
+gst_rtp_h265_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
+{
+  gint clock_rate;
+  GstStructure *structure = gst_caps_get_structure (caps, 0);
+  GstRtpH265Depay *rtph265depay;
+  const gchar *ps;
+  GstBuffer *codec_data;
+  GstMapInfo map;
+  guint8 *ptr;
+
+  rtph265depay = GST_RTP_H265_DEPAY (depayload);
+
+  if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
+    clock_rate = 90000;
+  depayload->clock_rate = clock_rate;
+
+  /* Base64 encoded, comma separated config NALs */
+  ps = gst_structure_get_string (structure, "sprop-parameter-sets");
+
+  /* negotiate with downstream w.r.t. output format and alignment */
+  gst_rtp_h265_depay_negotiate (rtph265depay);
+
+  if (rtph265depay->byte_stream && ps != NULL) {
+    /* for bytestream we only need the parameter sets but we don't error out
+     * when they are not there, we assume they are in the stream. */
+    gchar **params;
+    guint len, total;
+    gint i;
+
+    params = g_strsplit (ps, ",", 0);
+
+    /* count total number of bytes in base64. Also include the sync bytes in
+     * front of the params. */
+    len = 0;
+    for (i = 0; params[i]; i++) {
+      len += strlen (params[i]);
+      len += sizeof (sync_bytes);
+    }
+    /* we seriously overshoot the length, but it's fine. */
+    codec_data = gst_buffer_new_and_alloc (len);
+
+    gst_buffer_map (codec_data, &map, GST_MAP_WRITE);
+    ptr = map.data;
+    total = 0;
+    for (i = 0; params[i]; i++) {
+      guint save = 0;
+      gint state = 0;
+
+      GST_DEBUG_OBJECT (depayload, "decoding param %d (%s)", i, params[i]);
+      memcpy (ptr, sync_bytes, sizeof (sync_bytes));
+      ptr += sizeof (sync_bytes);
+      len =
+          g_base64_decode_step (params[i], strlen (params[i]), ptr, &state,
+          &save);
+      GST_DEBUG_OBJECT (depayload, "decoded %d bytes", len);
+      total += len + sizeof (sync_bytes);
+      ptr += len;
+    }
+    gst_buffer_unmap (codec_data, &map);
+    gst_buffer_resize (codec_data, 0, total);
+    g_strfreev (params);
+
+    /* keep the codec_data, we need to send it as the first buffer. We cannot
+     * push it in the adapter because the adapter might be flushed on discont.
+     */
+    if (rtph265depay->codec_data)
+      gst_buffer_unref (rtph265depay->codec_data);
+    rtph265depay->codec_data = codec_data;
+  } else if (!rtph265depay->byte_stream) {
+    gchar **params;
+    gint i;
+
+    if (ps == NULL)
+      goto incomplete_caps;
+
+    params = g_strsplit (ps, ",", 0);
+
+    GST_DEBUG_OBJECT (depayload, "we have %d params", g_strv_length (params));
+
+    /* start with 23 bytes header */
+    for (i = 0; params[i]; i++) {
+      GstBuffer *nal;
+      GstMapInfo nalmap;
+      gsize nal_len;
+      guint save = 0;
+      gint state = 0;
+
+      nal_len = strlen (params[i]);
+      nal = gst_buffer_new_and_alloc (nal_len);
+      gst_buffer_map (nal, &nalmap, GST_MAP_READWRITE);
+
+      nal_len =
+          g_base64_decode_step (params[i], nal_len, nalmap.data, &state, &save);
+
+      GST_DEBUG_OBJECT (depayload, "adding param %d as %s", i,
+          (((nalmap.data[0] >> 1) & 0x3f) ==
+              32) ? "VPS" : (((nalmap.data[0] >> 1) & 0x3f) ==
+              33) ? "SPS" : "PPS");
+
+      gst_buffer_unmap (nal, &nalmap);
+      gst_buffer_set_size (nal, nal_len);
+
+      gst_rtp_h265_depay_add_vps_sps_pps (rtph265depay, nal);
+    }
+    g_strfreev (params);
+
+    if (rtph265depay->sps->len == 0 || rtph265depay->pps->len == 0)
+      goto incomplete_caps;
+  }
+
+  return gst_rtp_h265_set_src_caps (rtph265depay);
+
+  /* ERRORS */
+incomplete_caps:
+  {
+    GST_DEBUG_OBJECT (depayload, "we have incomplete caps,"
+        " doing setcaps later");
+    return TRUE;
+  }
+}
+
+static GstBuffer *
+gst_rtp_h265_complete_au (GstRtpH265Depay * rtph265depay,
+    GstClockTime * out_timestamp, gboolean * out_keyframe)
+{
+  guint outsize;
+  GstBuffer *outbuf;
+
+  /* we had a picture in the adapter and we completed it */
+  GST_DEBUG_OBJECT (rtph265depay, "taking completed AU");
+  outsize = gst_adapter_available (rtph265depay->picture_adapter);
+  outbuf = gst_adapter_take_buffer (rtph265depay->picture_adapter, outsize);
+
+  *out_timestamp = rtph265depay->last_ts;
+  *out_keyframe = rtph265depay->last_keyframe;
+
+  rtph265depay->last_keyframe = FALSE;
+  rtph265depay->picture_start = FALSE;
+
+  return outbuf;
+}
+
+/* VPS/SPS/PPS/RADL/TSA/RASL/IDR/CRA is considered key, all others DELTA;
+ * so downstream waiting for keyframe can pick up at VPS/SPS/PPS/IDR */
+
+#define NAL_TYPE_IS_PARAMETER_SET(nt) (		((nt) == GST_H265_VPS_NUT)\
+										||  ((nt) == GST_H265_SPS_NUT)\
+										||  ((nt) == GST_H265_PPS_NUT)				)
+
+#define NAL_TYPE_IS_CODED_SLICE_SEGMENT(nt) (		((nt) == GST_H265_NAL_SLICE_TRAIL_N)\
+												|| 	((nt) == GST_H265_NAL_SLICE_TRAIL_R)\
+												||  ((nt) == GST_H265_NAL_SLICE_TSA_N)\
+												||  ((nt) == GST_H265_NAL_SLICE_TSA_R)\
+												||  ((nt) == GST_H265_NAL_SLICE_STSA_N)\
+												||  ((nt) == GST_H265_NAL_SLICE_STSA_R)\
+												||  ((nt) == GST_H265_NAL_SLICE_RASL_N)\
+												||  ((nt) == GST_H265_NAL_SLICE_RASL_R)\
+												||  ((nt) == GST_H265_NAL_SLICE_BLA_W_LP)\
+												||  ((nt) == GST_H265_NAL_SLICE_BLA_W_RADL)\
+												||  ((nt) == GST_H265_NAL_SLICE_BLA_N_LP)\
+												||  ((nt) == GST_H265_NAL_SLICE_IDR_W_RADL)\
+												||  ((nt) == GST_H265_NAL_SLICE_IDR_N_LP)\
+												||  ((nt) == GST_H265_NAL_SLICE_CRA_NUT)		)
+
+#define NAL_TYPE_IS_KEY(nt) (NAL_TYPE_IS_PARAMETER_SET(nt) || NAL_TYPE_IS_CODED_SLICE_SEGMENT(nt))
+
+static GstBuffer *
+gst_rtp_h265_depay_handle_nal (GstRtpH265Depay * rtph265depay, GstBuffer * nal,
+    GstClockTime in_timestamp, gboolean marker)
+{
+  GstRTPBaseDepayload *depayload = GST_RTP_BASE_DEPAYLOAD (rtph265depay);
+  gint nal_type;
+  GstMapInfo map;
+  GstBuffer *outbuf = NULL;
+  GstClockTime out_timestamp;
+  gboolean keyframe, out_keyframe;
+
+  gst_buffer_map (nal, &map, GST_MAP_READ);
+  if (G_UNLIKELY (map.size < 5))
+    goto short_nal;
+
+  nal_type = (map.data[4] >> 1) & 0x3f;
+  GST_DEBUG_OBJECT (rtph265depay, "handle NAL type %d (RTP marker bit %d)",
+      nal_type, marker);
+
+  keyframe = NAL_TYPE_IS_KEY (nal_type);
+
+  out_keyframe = keyframe;
+  out_timestamp = in_timestamp;
+
+  if (!rtph265depay->byte_stream) {
+    if (NAL_TYPE_IS_PARAMETER_SET (nal_type)) {
+      gst_rtp_h265_depay_add_vps_sps_pps (rtph265depay,
+          gst_buffer_copy_region (nal, GST_BUFFER_COPY_ALL,
+              4, gst_buffer_get_size (nal) - 4));
+      gst_buffer_unmap (nal, &map);
+      gst_buffer_unref (nal);
+      return NULL;
+    } else if (rtph265depay->sps->len == 0 || rtph265depay->pps->len == 0) {
+      /* Down push down any buffer in non-bytestream mode if the SPS/PPS haven't
+       * go through yet
+       */
+      gst_pad_push_event (GST_RTP_BASE_DEPAYLOAD_SINKPAD (depayload),
+          gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM,
+              gst_structure_new ("GstForceKeyUnit",
+                  "all-headers", G_TYPE_BOOLEAN, TRUE, NULL)));
+      gst_buffer_unmap (nal, &map);
+      gst_buffer_unref (nal);
+      return NULL;
+    }
+
+    if (rtph265depay->new_codec_data &&
+        rtph265depay->sps->len > 0 && rtph265depay->pps->len > 0)
+      gst_rtp_h265_set_src_caps (rtph265depay);
+  }
+
+  if (rtph265depay->merge) {
+    gboolean start = FALSE, complete = FALSE;
+
+    /* marker bit isn't mandatory so in the following code we try to detect
+     * an AU boundary (see H.265 spec section 7.4.2.4.4) */
+    if (!marker) {
+
+      if (NAL_TYPE_IS_CODED_SLICE_SEGMENT (nal_type)) {
+        /* A NAL unit (X) ends an access unit if the next-occurring VCL NAL unit (Y) has the high-order bit of the first byte after its NAL unit header equal to 1 */
+        start = TRUE;
+        if (((map.data[6] >> 7) & 0x01) == 1) {
+          complete = TRUE;
+        }
+        complete = TRUE;
+      } else if ((nal_type >= 32 && nal_type <= 35)
+          || nal_type == 39 || (nal_type >= 41 && nal_type <= 44)
+          || (nal_type >= 48 && nal_type <= 55)) {
+        /* VPS, SPS, PPS, SEI, ... terminate an access unit */
+        complete = TRUE;
+      }
+      GST_DEBUG_OBJECT (depayload, "start %d, complete %d", start, complete);
+
+      if (complete && rtph265depay->picture_start)
+        outbuf = gst_rtp_h265_complete_au (rtph265depay, &out_timestamp,
+            &out_keyframe);
+    }
+    /* add to adapter */
+    gst_buffer_unmap (nal, &map);
+
+    GST_DEBUG_OBJECT (depayload, "adding NAL to picture adapter");
+    gst_adapter_push (rtph265depay->picture_adapter, nal);
+    rtph265depay->last_ts = in_timestamp;
+    rtph265depay->last_keyframe |= keyframe;
+    rtph265depay->picture_start |= start;
+
+    if (marker)
+      outbuf = gst_rtp_h265_complete_au (rtph265depay, &out_timestamp,
+          &out_keyframe);
+  } else {
+    /* no merge, output is input nal */
+    GST_DEBUG_OBJECT (depayload, "using NAL as output");
+    outbuf = nal;
+    gst_buffer_unmap (nal, &map);
+  }
+
+  if (outbuf) {
+    /* prepend codec_data */
+    if (rtph265depay->codec_data) {
+      GST_DEBUG_OBJECT (depayload, "prepending codec_data");
+      outbuf = gst_buffer_append (rtph265depay->codec_data, outbuf);
+      rtph265depay->codec_data = NULL;
+      out_keyframe = TRUE;
+    }
+    outbuf = gst_buffer_make_writable (outbuf);
+
+    GST_BUFFER_TIMESTAMP (outbuf) = out_timestamp;
+
+    if (out_keyframe)
+      GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+    else
+      GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+  }
+
+  return outbuf;
+
+  /* ERRORS */
+short_nal:
+  {
+    GST_WARNING_OBJECT (depayload, "dropping short NAL");
+    gst_buffer_unmap (nal, &map);
+    gst_buffer_unref (nal);
+    return NULL;
+  }
+}
+
+static GstBuffer *
+gst_rtp_h265_push_fragmentation_unit (GstRtpH265Depay * rtph265depay,
+    gboolean send)
+{
+  guint outsize;
+  GstMapInfo map;
+  GstBuffer *outbuf;
+
+  outsize = gst_adapter_available (rtph265depay->adapter);
+  outbuf = gst_adapter_take_buffer (rtph265depay->adapter, outsize);
+
+  gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
+  GST_DEBUG_OBJECT (rtph265depay, "output %d bytes", outsize);
+
+  if (rtph265depay->byte_stream) {
+    memcpy (map.data, sync_bytes, sizeof (sync_bytes));
+  } else {
+    goto not_implemented;
+  }
+  gst_buffer_unmap (outbuf, &map);
+
+  rtph265depay->current_fu_type = 0;
+
+  outbuf = gst_rtp_h265_depay_handle_nal (rtph265depay, outbuf,
+      rtph265depay->fu_timestamp, rtph265depay->fu_marker);
+
+  if (send && outbuf) {
+    gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtph265depay), outbuf);
+    outbuf = NULL;
+  }
+  return outbuf;
+
+not_implemented:
+  {
+    GST_ERROR_OBJECT (rtph265depay,
+        ("Only bytestream format is currently supported."));
+    gst_buffer_unmap (outbuf, &map);
+    return NULL;
+  }
+}
+
+static GstBuffer *
+gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
+{
+  GstRtpH265Depay *rtph265depay;
+  GstBuffer *outbuf = NULL;
+  guint8 nal_unit_type;
+  GstRTPBuffer rtp = { NULL };
+
+  rtph265depay = GST_RTP_H265_DEPAY (depayload);
+
+  /* flush remaining data on discont */
+  if (GST_BUFFER_IS_DISCONT (buf)) {
+    gst_adapter_clear (rtph265depay->adapter);
+    rtph265depay->wait_start = TRUE;
+    rtph265depay->current_fu_type = 0;
+  }
+
+  {
+    gint payload_len;
+    guint8 *payload;
+    guint header_len;
+    GstMapInfo map;
+    guint outsize, nalu_size;
+    GstClockTime timestamp;
+    gboolean marker;
+    guint8 nuh_layer_id, nuh_temporal_id_plus1;
+    guint8 S, E;
+    guint16 nal_header;
+#if 0
+    gboolean donl_present = FALSE;
+#endif
+
+    timestamp = GST_BUFFER_TIMESTAMP (buf);
+
+    gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
+
+    payload_len = gst_rtp_buffer_get_payload_len (&rtp);
+    payload = gst_rtp_buffer_get_payload (&rtp);
+    marker = gst_rtp_buffer_get_marker (&rtp);
+
+    GST_DEBUG_OBJECT (rtph265depay, "receiving %d bytes", payload_len);
+
+    if (payload_len == 0)
+      goto empty_packet;
+
+    /* +---------------+---------------+
+     * |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |F|   Type    |  LayerId  | TID |
+     * +-------------+-----------------+
+     *
+     * F must be 0.
+     *
+     */
+    nal_unit_type = (payload[0] >> 1) & 0x3f;
+    nuh_layer_id = ((payload[0] & 0x01) << 5) | (payload[1] >> 3);      /* should be zero for now but this could change in future HEVC extensions */
+    nuh_temporal_id_plus1 = payload[1] & 0x03;
+
+    /* At least two byte header with type */
+    header_len = 2;
+
+    GST_DEBUG_OBJECT (rtph265depay,
+        "NAL header nal_unit_type %d, nuh_temporal_id_plus1 %d", nal_unit_type,
+        nuh_temporal_id_plus1);
+
+    GST_FIXME_OBJECT (rtph265depay, "Assuming DONL field is not present");
+
+    /* FIXME - assuming DONL field is not present for now */
+    /*donl_present = (tx-mode == "MST") || (sprop-max-don-diff > 0); */
+
+    /* If FU unit was being processed, but the current nal is of a different
+     * type.  Assume that the remote payloader is buggy (didn't set the end bit
+     * when the FU ended) and send out what we gathered thusfar */
+    if (G_UNLIKELY (rtph265depay->current_fu_type != 0 &&
+            nal_unit_type != rtph265depay->current_fu_type))
+      gst_rtp_h265_push_fragmentation_unit (rtph265depay, TRUE);
+
+    switch (nal_unit_type) {
+      case 48:
+      {
+        GST_DEBUG_OBJECT (rtph265depay, "Processing aggregation packet");
+
+        /* Aggregation packet (section 4.7) */
+
+        /*  An example of an AP packet containing two aggregation units
+           without the DONL and DOND fields
+
+           0                   1                   2                   3
+           0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+           |                          RTP Header                           |
+           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+           |   PayloadHdr (Type=48)        |         NALU 1 Size           |
+           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+           |          NALU 1 HDR           |                               |
+           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+         NALU 1 Data           |
+           |                   . . .                                       |
+           |                                                               |
+           +               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+           |  . . .        | NALU 2 Size                   | NALU 2 HDR    |
+           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+           | NALU 2 HDR    |                                               |
+           +-+-+-+-+-+-+-+-+              NALU 2 Data                      |
+           |                   . . .                                       |
+           |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+           |                               :...OPTIONAL RTP padding        |
+           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         */
+
+        /* strip headers */
+        payload += header_len;
+        payload_len -= header_len;
+
+        rtph265depay->wait_start = FALSE;
+
+#if 0
+        if (donl_present)
+          goto not_implemented_donl_present;
+#endif
+
+        while (payload_len > 2) {
+
+          nalu_size = (payload[0] << 8) | payload[1];
+
+          /* dont include nalu_size */
+          if (nalu_size > (payload_len - 2))
+            nalu_size = payload_len - 2;
+
+          outsize = nalu_size + sizeof (sync_bytes);
+          outbuf = gst_buffer_new_and_alloc (outsize);
+
+          gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
+          if (rtph265depay->byte_stream) {
+            memcpy (map.data, sync_bytes, sizeof (sync_bytes));
+          } else {
+            goto not_implemented;
+          }
+
+          /* strip NALU size */
+          payload += 2;
+          payload_len -= 2;
+
+          memcpy (map.data + sizeof (sync_bytes), payload, nalu_size);
+          gst_buffer_unmap (outbuf, &map);
+
+          gst_adapter_push (rtph265depay->adapter, outbuf);
+
+          payload += nalu_size;
+          payload_len -= nalu_size;
+        }
+
+        outsize = gst_adapter_available (rtph265depay->adapter);
+        outbuf = gst_adapter_take_buffer (rtph265depay->adapter, outsize);
+
+        outbuf = gst_rtp_h265_depay_handle_nal (rtph265depay, outbuf, timestamp,
+            marker);
+        break;
+      }
+      case 49:
+      {
+        GST_DEBUG_OBJECT (rtph265depay, "Processing Fragmentation Unit");
+
+        /* Fragmentation units (FUs)  Section 4.8 */
+
+        /*    The structure of a Fragmentation Unit (FU)
+         *
+         *    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         |    PayloadHdr (Type=49)       |   FU header   | DONL (cond)   |
+         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
+         | DONL (cond)   |                                               |
+         |-+-+-+-+-+-+-+-+                                               |
+         |                         FU payload                            |
+         |                                                               |
+         |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         |                               :...OPTIONAL RTP padding        |
+         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         *
+         *
+         */
+
+        /* strip headers */
+        payload += header_len;
+        payload_len -= header_len;
+
+        /* processing FU header */
+        S = (payload[0] & 0x80) == 0x80;
+        E = (payload[0] & 0x40) == 0x40;
+
+        GST_DEBUG_OBJECT (rtph265depay,
+            "FU header with S %d, E %d, nal_unit_type %d", S, E,
+            payload[0] & 0x3f);
+
+        if (rtph265depay->wait_start && !S)
+          goto waiting_start;
+
+#if 0
+        if (donl_present)
+          goto not_implemented_donl_present;
+#endif
+
+        if (S) {
+
+          GST_DEBUG_OBJECT (rtph265depay, "Start of Fragmentation Unit");
+
+          /* If a new FU unit started, while still processing an older one.
+           * Assume that the remote payloader is buggy (doesn't set the end
+           * bit) and send out what we've gathered thusfar */
+          if (G_UNLIKELY (rtph265depay->current_fu_type != 0))
+            gst_rtp_h265_push_fragmentation_unit (rtph265depay, TRUE);
+
+          rtph265depay->current_fu_type = nal_unit_type;
+          rtph265depay->fu_timestamp = timestamp;
+
+          rtph265depay->wait_start = FALSE;
+
+          /* reconstruct NAL header */
+          nal_header =
+              ((payload[0] & 0x3f) << 9) | (nuh_layer_id << 3) |
+              nuh_temporal_id_plus1;
+
+          /* go back one byte so we can copy the payload + two bytes more in the front which
+           * will be overwritten by the nal_header
+           */
+          payload -= 1;
+          payload_len += 1;
+
+          nalu_size = payload_len;
+          outsize = nalu_size + sizeof (sync_bytes);
+          outbuf = gst_buffer_new_and_alloc (outsize);
+
+          gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
+          memcpy (map.data + sizeof (sync_bytes), payload, nalu_size);
+          map.data[sizeof (sync_bytes)] = nal_header >> 8;
+          map.data[sizeof (sync_bytes) + 1] = nal_header & 0xff;
+          gst_buffer_unmap (outbuf, &map);
+
+          GST_DEBUG_OBJECT (rtph265depay, "queueing %d bytes", outsize);
+
+          /* and assemble in the adapter */
+          gst_adapter_push (rtph265depay->adapter, outbuf);
+        } else {
+
+          GST_DEBUG_OBJECT (rtph265depay,
+              "Following part of Fragmentation Unit");
+
+          /* strip off FU header byte */
+          payload += 1;
+          payload_len -= 1;
+
+          outsize = payload_len;
+          outbuf = gst_buffer_new_and_alloc (outsize);
+          gst_buffer_fill (outbuf, 0, payload, outsize);
+
+          GST_DEBUG_OBJECT (rtph265depay, "queueing %d bytes", outsize);
+
+          /* and assemble in the adapter */
+          gst_adapter_push (rtph265depay->adapter, outbuf);
+        }
+
+        outbuf = NULL;
+        rtph265depay->fu_marker = marker;
+
+        /* if NAL unit ends, flush the adapter */
+        if (E) {
+          outbuf = gst_rtp_h265_push_fragmentation_unit (rtph265depay, FALSE);
+          GST_DEBUG_OBJECT (rtph265depay, "End of Fragmentation Unit");
+        }
+        break;
+      }
+      case 50:
+        goto not_implemented;   /* PACI packets  Section 4.9 */
+      default:
+      {
+        rtph265depay->wait_start = FALSE;
+
+        /* All other cases: Single NAL unit packet   Section 4.6 */
+        /* the entire payload is the output buffer */
+
+#if 0
+        if (donl_present)
+          goto not_implemented_donl_present;
+#endif
+
+        nalu_size = payload_len;
+        outsize = nalu_size + sizeof (sync_bytes);
+        outbuf = gst_buffer_new_and_alloc (outsize);
+
+        gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
+        if (rtph265depay->byte_stream) {
+          memcpy (map.data, sync_bytes, sizeof (sync_bytes));
+        } else {
+          goto not_implemented;
+        }
+        memcpy (map.data + sizeof (sync_bytes), payload, nalu_size);
+        gst_buffer_unmap (outbuf, &map);
+
+        outbuf = gst_rtp_h265_depay_handle_nal (rtph265depay, outbuf, timestamp,
+            marker);
+        break;
+      }
+    }
+    gst_rtp_buffer_unmap (&rtp);
+  }
+
+  return outbuf;
+
+  /* ERRORS */
+empty_packet:
+  {
+    GST_DEBUG_OBJECT (rtph265depay, "empty packet");
+    gst_rtp_buffer_unmap (&rtp);
+    return NULL;
+  }
+waiting_start:
+  {
+    GST_DEBUG_OBJECT (rtph265depay, "waiting for start");
+    gst_rtp_buffer_unmap (&rtp);
+    return NULL;
+  }
+#if 0
+not_implemented_donl_present:
+  {
+    GST_ELEMENT_ERROR (rtph265depay, STREAM, FORMAT,
+        (NULL), ("DONL field present not supported yet"));
+    gst_rtp_buffer_unmap (&rtp);
+    return NULL;
+  }
+#endif
+not_implemented:
+  {
+    GST_ELEMENT_ERROR (rtph265depay, STREAM, FORMAT,
+        (NULL), ("NAL unit type %d not supported yet", nal_unit_type));
+    gst_rtp_buffer_unmap (&rtp);
+    return NULL;
+  }
+}
+
+static gboolean
+gst_rtp_h265_depay_handle_event (GstRTPBaseDepayload * depay, GstEvent * event)
+{
+  GstRtpH265Depay *rtph265depay;
+
+  rtph265depay = GST_RTP_H265_DEPAY (depay);
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_FLUSH_STOP:
+      gst_rtp_h265_depay_reset (rtph265depay);
+      break;
+    default:
+      break;
+  }
+
+  return
+      GST_RTP_BASE_DEPAYLOAD_CLASS (parent_class)->handle_event (depay, event);
+}
+
+static GstStateChangeReturn
+gst_rtp_h265_depay_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstRtpH265Depay *rtph265depay;
+  GstStateChangeReturn ret;
+
+  rtph265depay = GST_RTP_H265_DEPAY (element);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      break;
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      gst_rtp_h265_depay_reset (rtph265depay);
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      break;
+    default:
+      break;
+  }
+  return ret;
+}
+
+gboolean
+gst_rtp_h265_depay_plugin_init (GstPlugin * plugin)
+{
+  GST_DEBUG_CATEGORY_INIT (rtph265depay_debug, "rtph265depay", 0,
+      "H265 Video RTP Depayloader");
+
+  return gst_element_register (plugin, "rtph265depay",
+      GST_RANK_SECONDARY, GST_TYPE_RTP_H265_DEPAY);
+}
diff --git a/gst/rtp/gstrtph265depay.h b/gst/rtp/gstrtph265depay.h
new file mode 100644
index 0000000..ed49329
--- /dev/null
+++ b/gst/rtp/gstrtph265depay.h
@@ -0,0 +1,98 @@
+/* GStreamer
+ * Copyright (C) <2006> Wim Taymans <wim.taymans@gmail.com>
+ * Copyright (C) <2014> Jurgen Slowack <jurgenslowack@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_H265_DEPAY_H__
+#define __GST_RTP_H265_DEPAY_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+#include <gst/rtp/gstrtpbasedepayload.h>
+#include <gst/codecparsers/gsth265parser.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_RTP_H265_DEPAY \
+  (gst_rtp_h265_depay_get_type())
+#define GST_RTP_H265_DEPAY(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H265_DEPAY,GstRtpH265Depay))
+#define GST_RTP_H265_DEPAY_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H265_DEPAY,GstRtpH265DepayClass))
+#define GST_IS_RTP_H265_DEPAY(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H265_DEPAY))
+#define GST_IS_RTP_H265_DEPAY_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H265_DEPAY))
+typedef struct _GstRtpH265Depay GstRtpH265Depay;
+typedef struct _GstRtpH265DepayClass GstRtpH265DepayClass;
+
+#define GST_H265_VPS_NUT 32
+#define GST_H265_SPS_NUT 33
+#define GST_H265_PPS_NUT 34
+
+typedef enum
+{
+  GST_H265_STREAM_FORMAT_UNKNOWN,
+  GST_H265_STREAM_FORMAT_BYTESTREAM,
+  GST_H265_STREAM_FORMAT_HVC1,
+  GST_H265_STREAM_FORMAT_HEV1
+} GstH265StreamFormat;
+
+struct _GstRtpH265Depay
+{
+  GstRTPBaseDepayload depayload;
+
+  gchar *stream_format;
+  gboolean byte_stream;
+
+  GstBuffer *codec_data;
+  GstAdapter *adapter;
+  gboolean wait_start;
+
+  /* nal merging */
+  gboolean merge;
+  GstAdapter *picture_adapter;
+  gboolean picture_start;
+  GstClockTime last_ts;
+  gboolean last_keyframe;
+
+  /* Work around broken payloaders wrt. Fragmentation Units */
+  guint8 current_fu_type;
+  GstClockTime fu_timestamp;
+  gboolean fu_marker;
+
+  /* misc */
+  GPtrArray *vps;
+  GPtrArray *sps;
+  GPtrArray *pps;
+  gboolean new_codec_data;
+};
+
+struct _GstRtpH265DepayClass
+{
+  GstRTPBaseDepayloadClass parent_class;
+};
+
+GType gst_rtp_h265_depay_get_type (void);
+
+gboolean gst_rtp_h265_depay_plugin_init (GstPlugin * plugin);
+
+gboolean gst_rtp_h265_add_vps_sps_pps (GstElement * rtph265, GPtrArray * vps,
+    GPtrArray * sps, GPtrArray * pps, GstBuffer * nal);
+
+G_END_DECLS
+#endif /* __GST_RTP_H265_DEPAY_H__ */
diff --git a/gst/rtp/gstrtph265pay.c b/gst/rtp/gstrtph265pay.c
new file mode 100644
index 0000000..b2da44d
--- /dev/null
+++ b/gst/rtp/gstrtph265pay.c
@@ -0,0 +1,1497 @@
+/* GStreamer
+ * Copyright (C) <2006> Wim Taymans <wim.taymans@gmail.com>
+ * Copyright (C) <2014> Jurgen Slowack <jurgenslowack@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <gst/rtp/gstrtpbuffer.h>
+#include <gst/pbutils/pbutils.h>
+
+/* Included to not duplicate gst_rtp_h265_add_vps_sps_pps () */
+#include "gstrtph265depay.h"
+
+#include "gstrtph265pay.h"
+
+
+GST_DEBUG_CATEGORY_STATIC (rtph265pay_debug);
+#define GST_CAT_DEFAULT (rtph265pay_debug)
+
+/* references:
+ *
+ * Internet Draft RTP Payload Format for High Efficiency Video Coding
+ *
+ *                   draft-ietf-payload-rtp-h265-03.txt
+ *
+ * This draft will be replaced with an RFC, so some details may change.
+ *
+ */
+
+static GstStaticPadTemplate gst_rtp_h265_pay_sink_template =
+    GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (
+        /* Only bytestream format supported for now */
+        /* "video/x-h265, "
+           "stream-format = (string) hvc1, alignment = (string) au; "
+           "video/x-h265, "
+           "stream-format = (string) hev1, alignment = (string) au; " */
+        "video/x-h265, "
+        "stream-format = (string) byte-stream, alignment = (string) { nal, au }")
+    );
+
+static GstStaticPadTemplate gst_rtp_h265_pay_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp, "
+        "media = (string) \"video\", "
+        "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
+        "clock-rate = (int) 90000, " "encoding-name = (string) \"H265\"")
+                /** optional parameters **/
+    /* "profile-space = (int) [ 0, 3 ], " */
+    /* "profile-id = (int) [ 0, 31 ], " */
+    /* "tier-flag = (int) [ 0, 1 ], " */
+    /* "level-id = (int) [ 0, 255 ], " */
+    /* "interop-constraints = (string) ANY, " */
+    /* "profile-compatibility-indicator = (string) ANY, " */
+    /* "sprop-sub-layer-id = (int) [ 0, 6 ], " */
+    /* "recv-sub-layer-id = (int) [ 0, 6 ], " */
+    /* "max-recv-level-id = (int) [ 0, 255 ], " */
+    /* "tx-mode = (string) {MST , SST}, " */
+    /* "sprop-vps = (string) ANY, " */
+    /* "sprop-sps = (string) ANY, " */
+    /* "sprop-pps = (string) ANY, " */
+    /* "sprop-sei = (string) ANY, " */
+    /* "max-lsr = (int) ANY, " *//* MUST be in the range of MaxLumaSR to 16 * MaxLumaSR, inclusive */
+    /* "max-lps = (int) ANY, " *//* MUST be in the range of MaxLumaPS to 16 * MaxLumaPS, inclusive */
+    /* "max-cpb = (int) ANY, " *//* MUST be in the range of MaxCPB to 16 * MaxCPB, inclusive */
+    /* "max-dpb = (int) [1, 16], " */
+    /* "max-br = (int) ANY, " *//* MUST be in the range of MaxBR to 16 * MaxBR, inclusive, for the highest level */
+    /* "max-tr = (int) ANY, " *//* MUST be in the range of MaxTileRows to 16 * MaxTileRows, inclusive, for the highest level */
+    /* "max-tc = (int) ANY, " *//* MUST be in the range of MaxTileCols to 16 * MaxTileCols, inclusive, for the highest level */
+    /* "max-fps = (int) ANY, " */
+    /* "sprop-max-don-diff = (int) [0, 32767], " */
+    /* "sprop-depack-buf-nalus = (int) [0, 32767], " */
+    /* "sprop-depack-buf-nalus = (int) [0, 4294967295], " */
+    /* "depack-buf-cap = (int) [1, 4294967295], " */
+    /* "sprop-segmentation-id = (int) [0, 3], " */
+    /* "sprop-spatial-segmentation-idc = (string) ANY, " */
+    /* "dec-parallel-cap = (string) ANY, " */
+    );
+
+#define DEFAULT_SPROP_PARAMETER_SETS    NULL
+#define DEFAULT_CONFIG_INTERVAL		      0
+
+enum
+{
+  PROP_0,
+  PROP_SPROP_PARAMETER_SETS,
+  PROP_CONFIG_INTERVAL,
+  PROP_LAST
+};
+
+#define IS_ACCESS_UNIT(x) (((x) > 0x00) && ((x) < 0x06))
+
+static void gst_rtp_h265_pay_finalize (GObject * object);
+
+static void gst_rtp_h265_pay_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_rtp_h265_pay_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+static GstCaps *gst_rtp_h265_pay_getcaps (GstRTPBasePayload * payload,
+    GstPad * pad, GstCaps * filter);
+static gboolean gst_rtp_h265_pay_setcaps (GstRTPBasePayload * basepayload,
+    GstCaps * caps);
+static GstFlowReturn gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * pad,
+    GstBuffer * buffer);
+static gboolean gst_rtp_h265_pay_sink_event (GstRTPBasePayload * payload,
+    GstEvent * event);
+static GstStateChangeReturn gst_rtp_h265_pay_change_state (GstElement *
+    element, GstStateChange transition);
+
+#define gst_rtp_h265_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpH265Pay, gst_rtp_h265_pay, GST_TYPE_RTP_BASE_PAYLOAD);
+
+static void
+gst_rtp_h265_pay_class_init (GstRtpH265PayClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+  GstRTPBasePayloadClass *gstrtpbasepayload_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+  gstrtpbasepayload_class = (GstRTPBasePayloadClass *) klass;
+
+  gobject_class->set_property = gst_rtp_h265_pay_set_property;
+  gobject_class->get_property = gst_rtp_h265_pay_get_property;
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass),
+      PROP_SPROP_PARAMETER_SETS, g_param_spec_string ("sprop-parameter-sets",
+          "sprop-parameter-sets",
+          "The base64 sprop-parameter-sets to set in out caps (set to NULL to "
+          "extract from stream)",
+          DEFAULT_SPROP_PARAMETER_SETS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass),
+      PROP_CONFIG_INTERVAL,
+      g_param_spec_uint ("config-interval",
+          "VPS SPS PPS Send Interval",
+          "Send VPS, SPS and PPS Insertion Interval in seconds (sprop parameter sets "
+          "will be multiplexed in the data stream when detected.) (0 = disabled)",
+          0, 3600, DEFAULT_CONFIG_INTERVAL,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
+      );
+
+  gobject_class->finalize = gst_rtp_h265_pay_finalize;
+
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_rtp_h265_pay_src_template));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&gst_rtp_h265_pay_sink_template));
+
+  gst_element_class_set_static_metadata (gstelement_class, "RTP H265 payloader",
+      "Codec/Payloader/Network/RTP",
+      "Payload-encode H265 video into RTP packets (based on draft-ietf-payload-rtp-h265-03.txt)",
+      "Jurgen Slowack <jurgenslowack@gmail.com>");
+
+  gstelement_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_rtp_h265_pay_change_state);
+
+  gstrtpbasepayload_class->get_caps = gst_rtp_h265_pay_getcaps;
+  gstrtpbasepayload_class->set_caps = gst_rtp_h265_pay_setcaps;
+  gstrtpbasepayload_class->handle_buffer = gst_rtp_h265_pay_handle_buffer;
+  gstrtpbasepayload_class->sink_event = gst_rtp_h265_pay_sink_event;
+
+  GST_DEBUG_CATEGORY_INIT (rtph265pay_debug, "rtph265pay", 0,
+      "H265 RTP Payloader");
+}
+
+static void
+gst_rtp_h265_pay_init (GstRtpH265Pay * rtph265pay)
+{
+  rtph265pay->queue = g_array_new (FALSE, FALSE, sizeof (guint));
+  rtph265pay->profile = 0;
+  rtph265pay->sps = g_ptr_array_new_with_free_func (
+      (GDestroyNotify) gst_buffer_unref);
+  rtph265pay->pps = g_ptr_array_new_with_free_func (
+      (GDestroyNotify) gst_buffer_unref);
+  rtph265pay->vps = g_ptr_array_new_with_free_func (
+      (GDestroyNotify) gst_buffer_unref);
+  rtph265pay->last_vps_sps_pps = -1;
+  rtph265pay->vps_sps_pps_interval = DEFAULT_CONFIG_INTERVAL;
+
+  rtph265pay->adapter = gst_adapter_new ();
+}
+
+static void
+gst_rtp_h265_pay_clear_vps_sps_pps (GstRtpH265Pay * rtph265pay)
+{
+  g_ptr_array_set_size (rtph265pay->vps, 0);
+  g_ptr_array_set_size (rtph265pay->sps, 0);
+  g_ptr_array_set_size (rtph265pay->pps, 0);
+}
+
+static void
+gst_rtp_h265_pay_finalize (GObject * object)
+{
+  GstRtpH265Pay *rtph265pay;
+
+  rtph265pay = GST_RTP_H265_PAY (object);
+
+  g_array_free (rtph265pay->queue, TRUE);
+
+  g_ptr_array_free (rtph265pay->sps, TRUE);
+  g_ptr_array_free (rtph265pay->pps, TRUE);
+  g_ptr_array_free (rtph265pay->vps, TRUE);
+
+  g_free (rtph265pay->sprop_parameter_sets);
+
+  g_object_unref (rtph265pay->adapter);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static const gchar all_levels[][4] = {
+  "1",
+  "2",
+  "2.1",
+  "3",
+  "3.1",
+  "4",
+  "4.1",
+  "5",
+  "5.1",
+  "5.2",
+  "6",
+  "6.1",
+  "6.2"
+};
+
+static GstCaps *
+gst_rtp_h265_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
+    GstCaps * filter)
+{
+  GstCaps *template_caps;
+  GstCaps *allowed_caps;
+  GstCaps *caps;
+  GstCaps *icaps;
+  gboolean append_unrestricted;
+  guint i;
+
+  allowed_caps =
+      gst_pad_peer_query_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload), NULL);
+
+  if (allowed_caps == NULL)
+    return NULL;
+
+  template_caps =
+      gst_static_pad_template_get_caps (&gst_rtp_h265_pay_sink_template);
+
+  if (gst_caps_is_any (allowed_caps)) {
+    caps = gst_caps_ref (template_caps);
+    goto done;
+  }
+
+  if (gst_caps_is_empty (allowed_caps)) {
+    caps = gst_caps_ref (allowed_caps);
+    goto done;
+  }
+
+  caps = gst_caps_new_empty ();
+
+  append_unrestricted = FALSE;
+  for (i = 0; i < gst_caps_get_size (allowed_caps); i++) {
+    GstStructure *s = gst_caps_get_structure (allowed_caps, i);
+    GstStructure *new_s = gst_structure_new_empty ("video/x-h265");
+    const gchar *profile_level_id;
+
+    profile_level_id = gst_structure_get_string (s, "profile-level-id");
+
+    if (profile_level_id && strlen (profile_level_id) == 6) {   /* Code taken from gstrtph264pay.c, needs to be revised for H.265 */
+      const gchar *profile;
+      const gchar *level;
+      long int spsint;
+      guint8 sps[3];
+
+      spsint = strtol (profile_level_id, NULL, 16);
+      sps[0] = spsint >> 16;
+      sps[1] = spsint >> 8;
+      sps[2] = spsint;
+
+      profile = gst_codec_utils_h265_get_profile (sps, 3);
+      level = gst_codec_utils_h265_get_level (sps, 3);
+
+      if (profile && level) {
+        GST_LOG_OBJECT (payload, "In caps, have profile %s and level %s",
+            profile, level);
+
+        if (!strcmp (profile, "main"))
+          gst_structure_set (new_s, "profile", G_TYPE_STRING, profile, NULL);
+        else {
+          GValue val = { 0, };
+          GValue profiles = { 0, };
+
+          g_value_init (&profiles, GST_TYPE_LIST);
+          g_value_init (&val, G_TYPE_STRING);
+
+          g_value_set_static_string (&val, profile);
+          gst_value_list_append_value (&profiles, &val);
+
+          g_value_set_static_string (&val, "main");
+          gst_value_list_append_value (&profiles, &val);
+
+          gst_structure_take_value (new_s, "profile", &profiles);
+        }
+
+        if (!strcmp (level, "1"))
+          gst_structure_set (new_s, "level", G_TYPE_STRING, level, NULL);
+        else {
+          GValue levels = { 0, };
+          GValue val = { 0, };
+          int j;
+
+          g_value_init (&levels, GST_TYPE_LIST);
+          g_value_init (&val, G_TYPE_STRING);
+
+          for (j = 0; j < G_N_ELEMENTS (all_levels); j++) {
+            g_value_set_static_string (&val, all_levels[j]);
+            gst_value_list_prepend_value (&levels, &val);
+            if (!strcmp (level, all_levels[j]))
+              break;
+          }
+          gst_structure_take_value (new_s, "level", &levels);
+        }
+      } else {
+        /* Invalid profile-level-id means main */
+
+        gst_structure_set (new_s, "profile", G_TYPE_STRING, "main", NULL);
+      }
+    } else {
+      /* No profile-level-id means main or unrestricted */
+
+      gst_structure_set (new_s, "profile", G_TYPE_STRING, "main", NULL);
+      append_unrestricted = TRUE;
+    }
+
+    caps = gst_caps_merge_structure (caps, new_s);
+  }
+
+  if (append_unrestricted) {
+    caps =
+        gst_caps_merge_structure (caps, gst_structure_new ("video/x-h265", NULL,
+            NULL));
+  }
+
+  icaps = gst_caps_intersect (caps, template_caps);
+  gst_caps_unref (caps);
+  caps = icaps;
+
+done:
+
+  gst_caps_unref (template_caps);
+  gst_caps_unref (allowed_caps);
+
+  GST_LOG_OBJECT (payload, "returning caps %" GST_PTR_FORMAT, caps);
+  return caps;
+}
+
+/* take the currently configured VPS, SPS and PPS lists and set them on the caps as
+ * sprop-parameter-sets */
+static gboolean
+gst_rtp_h265_pay_set_vps_sps_pps (GstRTPBasePayload * basepayload)
+{
+  GstRtpH265Pay *payloader = GST_RTP_H265_PAY (basepayload);
+  gchar *profile;
+  gchar *set;
+  GString *sprops;
+  guint count;
+  gboolean res;
+  GstMapInfo map;
+  guint i;
+
+  sprops = g_string_new ("");
+  count = 0;
+
+  GST_DEBUG_OBJECT (payloader,
+      "Entering function gst_rtp_h265_pay_set_vps_sps_pps");
+
+  /* build the sprop-parameter-sets */
+  for (i = 0; i < payloader->vps->len; i++) {
+    GstBuffer *vps_buf =
+        GST_BUFFER_CAST (g_ptr_array_index (payloader->vps, i));
+
+    gst_buffer_map (vps_buf, &map, GST_MAP_READ);
+    set = g_base64_encode (map.data, map.size);
+    gst_buffer_unmap (vps_buf, &map);
+
+    g_string_append_printf (sprops, "%s%s", count ? "," : "", set);
+    g_free (set);
+    count++;
+  }
+  for (i = 0; i < payloader->sps->len; i++) {
+    GstBuffer *sps_buf =
+        GST_BUFFER_CAST (g_ptr_array_index (payloader->sps, i));
+
+    gst_buffer_map (sps_buf, &map, GST_MAP_READ);
+    set = g_base64_encode (map.data, map.size);
+    gst_buffer_unmap (sps_buf, &map);
+
+    g_string_append_printf (sprops, "%s%s", count ? "," : "", set);
+    g_free (set);
+    count++;
+  }
+  for (i = 0; i < payloader->pps->len; i++) {
+    GstBuffer *pps_buf =
+        GST_BUFFER_CAST (g_ptr_array_index (payloader->pps, i));
+
+    gst_buffer_map (pps_buf, &map, GST_MAP_READ);
+    set = g_base64_encode (map.data, map.size);
+    gst_buffer_unmap (pps_buf, &map);
+
+    g_string_append_printf (sprops, "%s%s", count ? "," : "", set);
+    g_free (set);
+    count++;
+  }
+
+  if (G_LIKELY (count)) {
+    /* profile is 24 bit. Force it to respect the limit */
+    profile = g_strdup_printf ("%06x", payloader->profile & 0xffffff);
+    /* combine into output caps */
+    res = gst_rtp_base_payload_set_outcaps (basepayload,
+        "sprop-parameter-sets", G_TYPE_STRING, sprops->str, NULL);
+    g_free (profile);
+  } else {
+    res = gst_rtp_base_payload_set_outcaps (basepayload, NULL);
+  }
+  g_string_free (sprops, TRUE);
+
+  return res;
+}
+
+
+static gboolean
+gst_rtp_h265_pay_setcaps (GstRTPBasePayload * basepayload, GstCaps * caps)
+{
+  GstRtpH265Pay *rtph265pay;
+  GstStructure *str;
+  const GValue *value;
+  GstMapInfo map;
+  guint8 *data;
+  gsize size;
+  GstBuffer *buffer;
+  const gchar *alignment, *stream_format;
+  guint8 num_arrays;
+
+  rtph265pay = GST_RTP_H265_PAY (basepayload);
+
+  str = gst_caps_get_structure (caps, 0);
+
+  /* we can only set the output caps when we found the sprops and profile
+   * NALs */
+  gst_rtp_base_payload_set_options (basepayload, "video", TRUE, "H265", 90000);
+
+  rtph265pay->alignment = GST_H265_ALIGNMENT_UNKNOWN;
+  alignment = gst_structure_get_string (str, "alignment");
+  if (alignment) {
+    if (g_str_equal (alignment, "au"))
+      rtph265pay->alignment = GST_H265_ALIGNMENT_AU;
+    if (g_str_equal (alignment, "nal"))
+      rtph265pay->alignment = GST_H265_ALIGNMENT_NAL;
+  }
+
+  rtph265pay->stream_format = GST_H265_STREAM_FORMAT_UNKNOWN;
+  stream_format = gst_structure_get_string (str, "stream-format");
+  if (stream_format) {
+    if (g_str_equal (stream_format, "hvc1"))
+      rtph265pay->stream_format = GST_H265_STREAM_FORMAT_HVC1;
+    if (g_str_equal (stream_format, "hev1"))
+      rtph265pay->stream_format = GST_H265_STREAM_FORMAT_HEV1;
+    if (g_str_equal (stream_format, "byte-stream"))
+      rtph265pay->stream_format = GST_H265_STREAM_FORMAT_BYTESTREAM;
+  }
+
+  /* packetized HEVC video has a codec_data */
+  if ((value = gst_structure_get_value (str, "codec_data"))) {
+    guint num_vps, num_sps, num_pps;
+    gint i, j, nal_size;
+
+    GST_DEBUG_OBJECT (rtph265pay, "have packetized h265");
+
+    buffer = gst_value_get_buffer (value);
+
+    gst_buffer_map (buffer, &map, GST_MAP_READ);
+    data = map.data;
+    size = map.size;
+
+    /* parse the hevcC data */
+    if (size < 23)
+      goto hevcc_too_small;
+    /* HEVCDecoderConfigurationVersion (must be 1) */
+    if (data[0] != 1)
+      goto wrong_version;
+
+    /* profile_space | tier_flag | profile_idc */
+    rtph265pay->profile = data[1];
+    GST_DEBUG_OBJECT (rtph265pay, "profile %06x", rtph265pay->profile);
+
+    /* profile_compatibility_flags */
+    for (i = 2; i < 6; i++) {
+      for (j = 7; j >= 0; j--) {
+        GST_DEBUG_OBJECT (rtph265pay, "profile_compatibility_flag %06x",
+            (data[i] >> j) & 1);
+      }
+    }
+
+    GST_DEBUG_OBJECT (rtph265pay, "progressive_source_flag %06x",
+        (data[6] >> 7) & 1);
+    GST_DEBUG_OBJECT (rtph265pay, "interlaced_source_flag %06x",
+        (data[6] >> 6) & 1);
+    GST_DEBUG_OBJECT (rtph265pay, "non_packed_constraint_flag %06x",
+        (data[6] >> 5) & 1);
+    GST_DEBUG_OBJECT (rtph265pay, "frame_only_constraint_flag %06x",
+        (data[6] >> 4) & 1);
+
+    GST_DEBUG_OBJECT (rtph265pay, "level_idc %06x", data[12]);
+
+    GST_DEBUG_OBJECT (rtph265pay, "min_spatial_segmentation_idc %06x",
+        ((data[13] ^ 0xf0) << 8) + data[14]);
+    GST_DEBUG_OBJECT (rtph265pay, "parrallelismType %06x (ignored by paloader)",
+        data[15]);
+
+    GST_DEBUG_OBJECT (rtph265pay, "sps_chroma_format_idc %06x",
+        data[16] ^ 0xfc);
+    GST_DEBUG_OBJECT (rtph265pay, "bit_depth_luma_minus8 %06x",
+        data[17] ^ 0xf8);
+    GST_DEBUG_OBJECT (rtph265pay, "bit_depth_chroma_minus8 %06x",
+        data[18] ^ 0xf8);
+    GST_DEBUG_OBJECT (rtph265pay, "avgFrameRate %06x", data[19]);
+    GST_DEBUG_OBJECT (rtph265pay, "avgFrameRate %06x", data[20]);
+
+    /* constFrameRate(2 bits): 0, stream may or may not be of constant framerate
+     * numTemporalLayers (3 bits): number of temporal layers, value from SPS
+     * TemporalIdNested (1 bit): sps_temporal_id_nesting_flag from SPS
+     * lengthSizeMinusOne (2 bits): plus 1 indicates the length of the NALUnitLength */
+    GST_DEBUG_OBJECT (rtph265pay, "constFrameRate %06x",
+        (data[21] >> 6) & 0x03);
+    GST_DEBUG_OBJECT (rtph265pay, "numTemporalLayers %06x",
+        (data[21] >> 3) & 0x07);
+    GST_DEBUG_OBJECT (rtph265pay, "temporal_id_nesting_flag %06x",
+        (data[21] >> 2) & 0x01);
+
+    rtph265pay->nal_length_size = (data[21] & 0x3) + 1;
+    GST_DEBUG_OBJECT (rtph265pay, "nal length %u", rtph265pay->nal_length_size);
+
+    num_arrays = GST_READ_UINT8 (data + 22);
+
+    data += 23;
+    size -= 23;
+
+    if (num_arrays > 0) {
+      if (data[0] == (0x00 | 0x20)) {   /* VPS */
+
+        data++;
+        num_vps = data[0] << 8 | data[1];
+        data += 2;
+        size -= 2;
+
+        for (i = 0; i < num_vps; i++) {
+
+          GstBuffer *vps_buf;
+
+          if (size < 2)
+            goto hevcc_error;
+
+          nal_size = (data[0] << 8) | data[1];
+          data += 2;
+          size -= 2;
+
+          GST_LOG_OBJECT (rtph265pay, "VPS %d size %d", i, nal_size);
+
+          if (size < nal_size)
+            goto hevcc_error;
+
+          /* make a buffer out of it and add to VPS list */
+          vps_buf = gst_buffer_new_and_alloc (nal_size);
+          gst_buffer_fill (vps_buf, 0, data, nal_size);
+          gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay),
+              rtph265pay->vps, rtph265pay->sps, rtph265pay->pps, vps_buf);
+          data += nal_size;
+          size -= nal_size;
+        }
+      }
+
+      --num_arrays;
+    }
+
+    if (num_arrays > 0) {
+      if (data[0] == (0x00 | 0x21)) {   /* SPS */
+
+        data++;
+        num_sps = data[0] << 8 | data[1];
+        data += 2;
+        size -= 2;
+
+        for (i = 0; i < num_sps; i++) {
+
+          GstBuffer *sps_buf;
+
+          if (size < 2)
+            goto hevcc_error;
+
+          nal_size = (data[0] << 8) | data[1];
+          data += 2;
+          size -= 2;
+
+          GST_LOG_OBJECT (rtph265pay, "SPS %d size %d", i, nal_size);
+
+          if (size < nal_size)
+            goto hevcc_error;
+
+          /* make a buffer out of it and add to SPS list */
+          sps_buf = gst_buffer_new_and_alloc (nal_size);
+          gst_buffer_fill (sps_buf, 0, data, nal_size);
+          gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay),
+              rtph265pay->vps, rtph265pay->sps, rtph265pay->pps, sps_buf);
+          data += nal_size;
+          size -= nal_size;
+        }
+      }
+
+      --num_arrays;
+    }
+
+    if (num_arrays > 0) {
+      if (data[0] == (0x00 | 0x22)) {   /* PPS */
+
+        data++;
+        num_pps = data[0] << 8 | data[1];
+        data += 2;
+        size -= 2;
+
+        for (i = 0; i < num_pps; i++) {
+
+          GstBuffer *pps_buf;
+
+          if (size < 2)
+            goto hevcc_error;
+
+          nal_size = (data[0] << 8) | data[1];
+          data += 2;
+          size -= 2;
+
+          GST_LOG_OBJECT (rtph265pay, "PPS %d size %d", i, nal_size);
+
+          if (size < nal_size)
+            goto hevcc_error;
+
+          /* make a buffer out of it and add to PPS list */
+          pps_buf = gst_buffer_new_and_alloc (nal_size);
+          gst_buffer_fill (pps_buf, 0, data, nal_size);
+          gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay),
+              rtph265pay->vps, rtph265pay->sps, rtph265pay->pps, pps_buf);
+          data += nal_size;
+          size -= nal_size;
+        }
+      }
+
+      --num_arrays;
+    }
+
+    /* and update the caps with the collected data */
+    if (!gst_rtp_h265_pay_set_vps_sps_pps (basepayload))
+      goto set_vps_sps_pps_failed;
+
+    GST_DEBUG_OBJECT (rtph265pay, "Caps have been set");
+
+    gst_buffer_unmap (buffer, &map);
+  } else {
+    GST_DEBUG_OBJECT (rtph265pay, "have bytestream h265");
+  }
+
+  return TRUE;
+
+hevcc_too_small:
+  {
+    GST_ERROR_OBJECT (rtph265pay, "hevcC size %" G_GSIZE_FORMAT " < 7", size);
+    goto error;
+  }
+wrong_version:
+  {
+    GST_ERROR_OBJECT (rtph265pay, "wrong hevcC version");
+    goto error;
+  }
+hevcc_error:
+  {
+    GST_ERROR_OBJECT (rtph265pay, "hevcC too small ");
+    goto error;
+  }
+set_vps_sps_pps_failed:
+  {
+    GST_ERROR_OBJECT (rtph265pay, "failed to set vps/sps/pps");
+    goto error;
+  }
+error:
+  {
+    gst_buffer_unmap (buffer, &map);
+    return FALSE;
+  }
+}
+
+static void
+gst_rtp_h265_pay_parse_sprop_parameter_sets (GstRtpH265Pay * rtph265pay)
+{
+  const gchar *ps;
+  gchar **params;
+  guint len;
+  gint i;
+  GstBuffer *buf;
+
+  ps = rtph265pay->sprop_parameter_sets;
+  if (ps == NULL)
+    return;
+
+  gst_rtp_h265_pay_clear_vps_sps_pps (rtph265pay);
+
+  params = g_strsplit (ps, ",", 0);
+  len = g_strv_length (params);
+
+  GST_DEBUG_OBJECT (rtph265pay, "we have %d params", len);
+
+  for (i = 0; params[i]; i++) {
+    gsize nal_len;
+    GstMapInfo map;
+    guint8 *nalp;
+    guint save = 0;
+    gint state = 0;
+
+    nal_len = strlen (params[i]);
+    buf = gst_buffer_new_and_alloc (nal_len);
+
+    gst_buffer_map (buf, &map, GST_MAP_WRITE);
+    nalp = map.data;
+    nal_len = g_base64_decode_step (params[i], nal_len, nalp, &state, &save);
+    gst_buffer_unmap (buf, &map);
+    gst_buffer_resize (buf, 0, nal_len);
+
+    if (!nal_len) {
+      gst_buffer_unref (buf);
+      continue;
+    }
+
+    gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay), rtph265pay->vps,
+        rtph265pay->sps, rtph265pay->pps, buf);
+  }
+  g_strfreev (params);
+}
+
+static guint
+next_start_code (const guint8 * data, guint size)
+{
+  /* Boyer-Moore string matching algorithm, in a degenerative
+   * sense because our search 'alphabet' is binary - 0 & 1 only.
+   * This allow us to simplify the general BM algorithm to a very
+   * simple form. */
+  /* assume 1 is in the 3th byte */
+  guint offset = 2;
+
+  while (offset < size) {
+    if (1 == data[offset]) {
+      unsigned int shift = offset;
+
+      if (0 == data[--shift]) {
+        if (0 == data[--shift]) {
+          return shift;
+        }
+      }
+      /* The jump is always 3 because of the 1 previously matched.
+       * All the 0's must be after this '1' matched at offset */
+      offset += 3;
+    } else if (0 == data[offset]) {
+      /* maybe next byte is 1? */
+      offset++;
+    } else {
+      /* can jump 3 bytes forward */
+      offset += 3;
+    }
+    /* at each iteration, we rescan in a backward manner until
+     * we match 0.0.1 in reverse order. Since our search string
+     * has only 2 'alpabets' (i.e. 0 & 1), we know that any
+     * mismatch will force us to shift a fixed number of steps */
+  }
+  GST_DEBUG ("Cannot find next NAL start code. returning %u", size);
+
+  return size;
+}
+
+static gboolean
+gst_rtp_h265_pay_decode_nal (GstRtpH265Pay * payloader,
+    const guint8 * data, guint size, GstClockTime dts, GstClockTime pts)
+{
+  guint8 header, type;
+  gboolean updated;
+
+  /* default is no update */
+  updated = FALSE;
+
+  GST_DEBUG ("NAL payload len=%u", size);
+
+  header = data[0];
+  type = header & 0x3f;
+
+  /* We record the timestamp of the last SPS/PPS so
+   * that we can insert them at regular intervals and when needed. */
+  if (GST_H265_NAL_VPS == type || GST_H265_NAL_SPS == type
+      || GST_H265_NAL_PPS == type) {
+    GstBuffer *nal;
+
+    /* encode the entire NAL in base64 */
+    GST_DEBUG ("Found %s %x %x %x Len=%u",
+        type == GST_H265_NAL_VPS ? "VPS" : type ==
+        GST_H265_NAL_SPS ? "SPS" : "PPS", (header >> 7), (header >> 5) & 3,
+        type, size);
+
+    nal = gst_buffer_new_allocate (NULL, size, NULL);
+    gst_buffer_fill (nal, 0, data, size);
+
+    updated = gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (payloader),
+        payloader->vps, payloader->sps, payloader->pps, nal);
+
+    /* remember when we last saw VPS */
+    if (updated && pts != -1)
+      payloader->last_vps_sps_pps = pts;
+  } else {
+    GST_DEBUG ("NAL: %x %x %x Len = %u", (header >> 7),
+        (header >> 5) & 3, type, size);
+  }
+
+  return updated;
+}
+
+static GstFlowReturn
+gst_rtp_h265_pay_payload_nal (GstRTPBasePayload * basepayload,
+    GstBuffer * paybuf, GstClockTime dts, GstClockTime pts, gboolean end_of_au);
+
+static GstFlowReturn
+gst_rtp_h265_pay_send_vps_sps_pps (GstRTPBasePayload * basepayload,
+    GstRtpH265Pay * rtph265pay, GstClockTime dts, GstClockTime pts)
+{
+  GstFlowReturn ret = GST_FLOW_OK;
+  gboolean sent_all_vps_sps_pps = TRUE;
+  guint i;
+
+  for (i = 0; i < rtph265pay->vps->len; i++) {
+    GstBuffer *vps_buf =
+        GST_BUFFER_CAST (g_ptr_array_index (rtph265pay->vps, i));
+
+    GST_DEBUG_OBJECT (rtph265pay, "inserting VPS in the stream");
+    /* resend VPS */
+    ret = gst_rtp_h265_pay_payload_nal (basepayload, gst_buffer_ref (vps_buf),
+        dts, pts, FALSE);
+    /* Not critical here; but throw a warning */
+    if (ret != GST_FLOW_OK) {
+      sent_all_vps_sps_pps = FALSE;
+      GST_WARNING ("Problem pushing VPS");
+    }
+  }
+  for (i = 0; i < rtph265pay->sps->len; i++) {
+    GstBuffer *sps_buf =
+        GST_BUFFER_CAST (g_ptr_array_index (rtph265pay->sps, i));
+
+    GST_DEBUG_OBJECT (rtph265pay, "inserting SPS in the stream");
+    /* resend SPS */
+    ret = gst_rtp_h265_pay_payload_nal (basepayload, gst_buffer_ref (sps_buf),
+        dts, pts, FALSE);
+    /* Not critical here; but throw a warning */
+    if (ret != GST_FLOW_OK) {
+      sent_all_vps_sps_pps = FALSE;
+      GST_WARNING ("Problem pushing SPS");
+    }
+  }
+  for (i = 0; i < rtph265pay->pps->len; i++) {
+    GstBuffer *pps_buf =
+        GST_BUFFER_CAST (g_ptr_array_index (rtph265pay->pps, i));
+
+    GST_DEBUG_OBJECT (rtph265pay, "inserting PPS in the stream");
+    /* resend PPS */
+    ret = gst_rtp_h265_pay_payload_nal (basepayload, gst_buffer_ref (pps_buf),
+        dts, pts, FALSE);
+    /* Not critical here; but throw a warning */
+    if (ret != GST_FLOW_OK) {
+      sent_all_vps_sps_pps = FALSE;
+      GST_WARNING ("Problem pushing PPS");
+    }
+  }
+
+  if (pts != -1 && sent_all_vps_sps_pps)
+    rtph265pay->last_vps_sps_pps = pts;
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_rtp_h265_pay_payload_nal (GstRTPBasePayload * basepayload,
+    GstBuffer * paybuf, GstClockTime dts, GstClockTime pts, gboolean end_of_au)
+{
+  GstRtpH265Pay *rtph265pay;
+  GstFlowReturn ret;
+  guint8 nalHeader[2];
+  guint8 nalType;
+  guint packet_len, payload_len, mtu;
+  GstBuffer *outbuf;
+  guint8 *payload;
+  GstBufferList *list = NULL;
+  gboolean send_vps_sps_pps;
+  GstRTPBuffer rtp = { NULL };
+  guint size = gst_buffer_get_size (paybuf);
+
+  rtph265pay = GST_RTP_H265_PAY (basepayload);
+  mtu = GST_RTP_BASE_PAYLOAD_MTU (rtph265pay);
+
+  gst_buffer_extract (paybuf, 0, nalHeader, 2);
+  nalType = (nalHeader[0] >> 1) & 0x3f;
+
+  GST_DEBUG_OBJECT (rtph265pay, "Processing Buffer with NAL TYPE=%d", nalType);
+
+  /* should set src caps before pushing stuff,
+   * and if we did not see enough VPS/SPS/PPS, that may not be the case */
+  if (G_UNLIKELY (!gst_pad_has_current_caps (GST_RTP_BASE_PAYLOAD_SRCPAD
+              (basepayload))))
+    gst_rtp_h265_pay_set_vps_sps_pps (basepayload);
+
+  send_vps_sps_pps = FALSE;
+
+  /* check if we need to emit an VPS/SPS/PPS now */
+  if (((nalType == GST_H265_NAL_SLICE_TRAIL_N)
+          || (nalType == GST_H265_NAL_SLICE_TRAIL_R)
+          || (nalType == GST_H265_NAL_SLICE_TSA_N)
+          || (nalType == GST_H265_NAL_SLICE_TSA_R)
+          || (nalType == GST_H265_NAL_SLICE_STSA_N)
+          || (nalType == GST_H265_NAL_SLICE_STSA_R)
+          || (nalType == GST_H265_NAL_SLICE_RASL_N)
+          || (nalType == GST_H265_NAL_SLICE_RASL_R)
+          || (nalType == GST_H265_NAL_SLICE_BLA_W_LP)
+          || (nalType == GST_H265_NAL_SLICE_BLA_W_RADL)
+          || (nalType == GST_H265_NAL_SLICE_BLA_N_LP)
+          || (nalType == GST_H265_NAL_SLICE_IDR_W_RADL)
+          || (nalType == GST_H265_NAL_SLICE_IDR_N_LP)
+          || (nalType == GST_H265_NAL_SLICE_CRA_NUT))
+      && rtph265pay->vps_sps_pps_interval > 0) {
+
+    if (rtph265pay->last_vps_sps_pps != -1) {
+      guint64 diff;
+
+      GST_LOG_OBJECT (rtph265pay,
+          "now %" GST_TIME_FORMAT ", last VPS/SPS/PPS %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (pts), GST_TIME_ARGS (rtph265pay->last_vps_sps_pps));
+
+      /* calculate diff between last SPS/PPS in milliseconds */
+      if (pts > rtph265pay->last_vps_sps_pps)
+        diff = pts - rtph265pay->last_vps_sps_pps;
+      else
+        diff = 0;
+
+      GST_DEBUG_OBJECT (rtph265pay,
+          "interval since last VPS/SPS/PPS %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (diff));
+
+      /* bigger than interval, queue SPS/PPS */
+      if (GST_TIME_AS_SECONDS (diff) >= rtph265pay->vps_sps_pps_interval) {
+        GST_DEBUG_OBJECT (rtph265pay, "time to send VPS/SPS/PPS");
+        send_vps_sps_pps = TRUE;
+      }
+    } else {
+      /* no known previous SPS/PPS time, send now */
+      GST_DEBUG_OBJECT (rtph265pay, "no previous VPS/SPS/PPS time, send now");
+      send_vps_sps_pps = TRUE;
+    }
+  }
+
+  if (send_vps_sps_pps || rtph265pay->send_vps_sps_pps) {
+    /* we need to send SPS/PPS now first. FIXME, don't use the pts for
+     * checking when we need to send SPS/PPS but convert to running_time first. */
+    rtph265pay->send_vps_sps_pps = FALSE;
+    ret = gst_rtp_h265_pay_send_vps_sps_pps (basepayload, rtph265pay, dts, pts);
+    if (ret != GST_FLOW_OK)
+      return ret;
+  }
+
+  packet_len = gst_rtp_buffer_calc_packet_len (size, 0, 0);
+
+  GST_FIXME_OBJECT (rtph265pay, "Set RTP marker bit appropriately");
+
+  if (packet_len < mtu) {
+    GST_DEBUG_OBJECT (rtph265pay,
+        "NAL Unit fit in one packet datasize=%d mtu=%d", size, mtu);
+    /* will fit in one packet */
+
+    /* use buffer lists
+     * create buffer without payload containing only the RTP header
+     * (memory block at index 0) */
+    outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
+
+    gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
+
+    /* FIXME : only set the marker bit on packets containing access units */
+    /* if (IS_ACCESS_UNIT (nalType) && end_of_au) {
+       gst_rtp_buffer_set_marker (&rtp, 1);
+       } */
+
+    /* timestamp the outbuffer */
+    GST_BUFFER_PTS (outbuf) = pts;
+    GST_BUFFER_DTS (outbuf) = dts;
+
+    /* insert payload memory block */
+    outbuf = gst_buffer_append (outbuf, paybuf);
+
+    list = gst_buffer_list_new ();
+
+    /* add the buffer to the buffer list */
+    gst_buffer_list_add (list, outbuf);
+
+    gst_rtp_buffer_unmap (&rtp);
+
+    /* push the list to the next element in the pipe */
+    ret = gst_rtp_base_payload_push_list (basepayload, list);
+  } else {
+    /* fragmentation Units */
+    guint limitedSize;
+    int ii = 0, start = 1, end = 0, pos = 0;
+
+    GST_DEBUG_OBJECT (basepayload,
+        "NAL Unit DOES NOT fit in one packet datasize=%d mtu=%d", size, mtu);
+
+    pos += 2;
+    size -= 2;
+
+    ret = GST_FLOW_OK;
+
+    GST_DEBUG_OBJECT (basepayload, "Using FU fragmentation for data size=%d",
+        size);
+
+    /* We keep 3 bytes for PayloadHdr and FU Header */
+    payload_len = gst_rtp_buffer_calc_payload_len (mtu - 3, 0, 0);
+
+    list = gst_buffer_list_new ();
+
+    while (end == 0) {
+      limitedSize = size < payload_len ? size : payload_len;
+      GST_DEBUG_OBJECT (basepayload,
+          "Inside  FU fragmentation limitedSize=%d iteration=%d", limitedSize,
+          ii);
+
+      /* use buffer lists
+       * create buffer without payload containing only the RTP header
+       * (memory block at index 0), and with space for PayloadHdr and FU header */
+      outbuf = gst_rtp_buffer_new_allocate (3, 0, 0);
+
+      gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
+
+      GST_BUFFER_DTS (outbuf) = dts;
+      GST_BUFFER_PTS (outbuf) = pts;
+      payload = gst_rtp_buffer_get_payload (&rtp);
+
+      if (limitedSize == size) {
+        GST_DEBUG_OBJECT (basepayload, "end size=%d iteration=%d", size, ii);
+        end = 1;
+      }
+
+      /* PayloadHdr (type = 49) */
+      payload[0] = (nalHeader[0] & 0x81) | (49 << 1);
+      payload[1] = nalHeader[1];
+
+      /* FIXME - set RTP marker bit appropriately */
+      /* if (IS_ACCESS_UNIT (nalType)) {
+         gst_rtp_buffer_set_marker (&rtp, end && end_of_au);
+         } */
+
+      /* FU Header */
+      payload[2] = (start << 7) | (end << 6) | (nalType & 0x3f);
+
+      gst_rtp_buffer_unmap (&rtp);
+
+      /* insert payload memory block */
+      gst_buffer_append (outbuf,
+          gst_buffer_copy_region (paybuf, GST_BUFFER_COPY_MEMORY, pos,
+              limitedSize));
+
+      /* add the buffer to the buffer list */
+      gst_buffer_list_add (list, outbuf);
+
+
+      size -= limitedSize;
+      pos += limitedSize;
+      ii++;
+      start = 0;
+    }
+
+    ret = gst_rtp_base_payload_push_list (basepayload, list);
+    gst_buffer_unref (paybuf);
+  }
+  return ret;
+}
+
+static GstFlowReturn
+gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * basepayload,
+    GstBuffer * buffer)
+{
+  GstRtpH265Pay *rtph265pay;
+  GstFlowReturn ret;
+  gsize size;
+  guint nal_len, i;
+  GstMapInfo map;
+  const guint8 *data;
+  GstClockTime dts, pts;
+  GArray *nal_queue;
+  gboolean hevc;
+  GstBuffer *paybuf = NULL;
+  gsize skip;
+
+  rtph265pay = GST_RTP_H265_PAY (basepayload);
+
+  /* the input buffer contains one or more NAL units */
+
+  hevc = (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HEV1)
+      || (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HVC1);
+
+  if (hevc) {
+    /* In hevc mode, there is no adapter, so nothing to flush */
+    if (buffer == NULL)
+      return GST_FLOW_OK;
+    gst_buffer_map (buffer, &map, GST_MAP_READ);
+    data = map.data;
+    size = map.size;
+    pts = GST_BUFFER_PTS (buffer);
+    dts = GST_BUFFER_DTS (buffer);
+    GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
+  } else {
+    dts = gst_adapter_prev_dts (rtph265pay->adapter, NULL);
+    pts = gst_adapter_prev_pts (rtph265pay->adapter, NULL);
+    if (buffer) {
+      if (!GST_CLOCK_TIME_IS_VALID (dts))
+        dts = GST_BUFFER_DTS (buffer);
+      if (!GST_CLOCK_TIME_IS_VALID (pts))
+        pts = GST_BUFFER_PTS (buffer);
+
+      gst_adapter_push (rtph265pay->adapter, buffer);
+    }
+    size = gst_adapter_available (rtph265pay->adapter);
+    /* Nothing to do here if the adapter is empty, e.g. on EOS */
+    if (size == 0)
+      return GST_FLOW_OK;
+    data = gst_adapter_map (rtph265pay->adapter, size);
+    GST_DEBUG_OBJECT (basepayload,
+        "got %" G_GSIZE_FORMAT " bytes (%" G_GSIZE_FORMAT ")", size,
+        buffer ? gst_buffer_get_size (buffer) : 0);
+  }
+
+  ret = GST_FLOW_OK;
+
+  /* now loop over all NAL units and put them in a packet
+   * FIXME, we should really try to pack multiple NAL units into one RTP packet
+   * if we can, especially for the config packets that wont't cause decoder
+   * latency. */
+  if (hevc) {
+    guint nal_length_size;
+    gsize offset = 0;
+
+    nal_length_size = rtph265pay->nal_length_size;
+
+    while (size > nal_length_size) {
+      gint i;
+      gboolean end_of_au = FALSE;
+
+      nal_len = 0;
+      for (i = 0; i < nal_length_size; i++) {
+        nal_len = ((nal_len << 8) + data[i]);
+      }
+
+      /* skip the length bytes, make sure we don't run past the buffer size */
+      data += nal_length_size;
+      offset += nal_length_size;
+      size -= nal_length_size;
+
+      if (size >= nal_len) {
+        GST_DEBUG_OBJECT (basepayload, "got NAL of size %u", nal_len);
+      } else {
+        nal_len = size;
+        GST_DEBUG_OBJECT (basepayload, "got incomplete NAL of size %u",
+            nal_len);
+      }
+
+      /* If we're at the end of the buffer, then we're at the end of the
+       * access unit
+       */
+      if (rtph265pay->alignment == GST_H265_ALIGNMENT_AU
+          && size - nal_len <= nal_length_size) {
+        end_of_au = TRUE;
+      }
+
+      paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_MEMORY, offset,
+          nal_len);
+
+      ret =
+          gst_rtp_h265_pay_payload_nal (basepayload, paybuf, dts, pts,
+          end_of_au);
+      if (ret != GST_FLOW_OK)
+        break;
+
+      data += nal_len;
+      offset += nal_len;
+      size -= nal_len;
+    }
+  } else {
+    guint next;
+    gboolean update = FALSE;
+
+    /* get offset of first start code */
+    next = next_start_code (data, size);
+
+    /* skip to start code, if no start code is found, next will be size and we
+     * will not collect data. */
+    data += next;
+    size -= next;
+    nal_queue = rtph265pay->queue;
+    skip = next;
+
+    /* array must be empty when we get here */
+    g_assert (nal_queue->len == 0);
+
+    GST_DEBUG_OBJECT (basepayload,
+        "found first start at %u, bytes left %" G_GSIZE_FORMAT, next, size);
+
+    /* first pass to locate NALs and parse SPS/PPS */
+    while (size > 4) {
+      /* skip start code */
+      data += 3;
+      size -= 3;
+
+      /* use next_start_code() to scan buffer.
+       * next_start_code() returns the offset in data,
+       * starting from zero to the first byte of 0.0.0.1
+       * If no start code is found, it returns the value of the
+       * 'size' parameter.
+       * data is unchanged by the call to next_start_code()
+       */
+      next = next_start_code (data, size);
+
+      if (next == size && buffer != NULL) {
+        /* Didn't find the start of next NAL and it's not EOS,
+         * handle it next time */
+        break;
+      }
+
+      /* nal length is distance to next start code */
+      nal_len = next;
+
+      GST_DEBUG_OBJECT (basepayload, "found next start at %u of size %u", next,
+          nal_len);
+
+      if (rtph265pay->sprop_parameter_sets != NULL) {
+        /* explicitly set profile and sprop, use those */
+        if (rtph265pay->update_caps) {
+          if (!gst_rtp_base_payload_set_outcaps (basepayload,
+                  "sprop-parameter-sets", G_TYPE_STRING,
+                  rtph265pay->sprop_parameter_sets, NULL))
+            goto caps_rejected;
+
+          /* parse SPS and PPS from provided parameter set (for insertion) */
+          gst_rtp_h265_pay_parse_sprop_parameter_sets (rtph265pay);
+
+          rtph265pay->update_caps = FALSE;
+
+          GST_DEBUG ("outcaps update: sprop-parameter-sets=%s",
+              rtph265pay->sprop_parameter_sets);
+        }
+      } else {
+        /* We know our stream is a valid H265 NAL packet,
+         * go parse it for SPS/PPS to enrich the caps */
+        /* order: make sure to check nal */
+        update =
+            gst_rtp_h265_pay_decode_nal (rtph265pay, data, nal_len, dts, pts)
+            || update;
+      }
+      /* move to next NAL packet */
+      data += nal_len;
+      size -= nal_len;
+
+      g_array_append_val (nal_queue, nal_len);
+    }
+
+    /* if has new VPS, SPS & PPS, update the output caps */
+    if (G_UNLIKELY (update))
+      if (!gst_rtp_h265_pay_set_vps_sps_pps (basepayload))
+        goto caps_rejected;
+
+    /* second pass to payload and push */
+
+    if (nal_queue->len != 0)
+      gst_adapter_flush (rtph265pay->adapter, skip);
+
+    for (i = 0; i < nal_queue->len; i++) {
+      guint size;
+      gboolean end_of_au = FALSE;
+
+      nal_len = g_array_index (nal_queue, guint, i);
+      /* skip start code */
+      gst_adapter_flush (rtph265pay->adapter, 3);
+
+      /* Trim the end unless we're the last NAL in the stream.
+       * In case we're not at the end of the buffer we know the next block
+       * starts with 0x000001 so all the 0x00 bytes at the end of this one are
+       * trailing 0x0 that can be discarded */
+      size = nal_len;
+      data = gst_adapter_map (rtph265pay->adapter, size);
+      if (i + 1 != nal_queue->len || buffer != NULL)
+        for (; size > 1 && data[size - 1] == 0x0; size--)
+          /* skip */ ;
+
+
+      /* If it's the last nal unit we have in non-bytestream mode, we can
+       * assume it's the end of an access-unit
+       *
+       * FIXME: We need to wait until the next packet or EOS to
+       * actually payload the NAL so we can know if the current NAL is
+       * the last one of an access unit or not if we are in bytestream mode
+       */
+      if ((rtph265pay->alignment == GST_H265_ALIGNMENT_AU || buffer == NULL) &&
+          i == nal_queue->len - 1)
+        end_of_au = TRUE;
+      paybuf = gst_adapter_take_buffer (rtph265pay->adapter, size);
+      g_assert (paybuf);
+
+      /* put the data in one or more RTP packets */
+      ret =
+          gst_rtp_h265_pay_payload_nal (basepayload, paybuf, dts, pts,
+          end_of_au);
+      if (ret != GST_FLOW_OK) {
+        break;
+      }
+
+      /* move to next NAL packet */
+      /* Skips the trailing zeros */
+      gst_adapter_flush (rtph265pay->adapter, nal_len - size);
+    }
+    g_array_set_size (nal_queue, 0);
+  }
+
+done:
+  if (hevc) {
+    gst_buffer_unmap (buffer, &map);
+    gst_buffer_unref (buffer);
+  } else {
+    gst_adapter_unmap (rtph265pay->adapter);
+  }
+
+  return ret;
+
+caps_rejected:
+  {
+    GST_WARNING_OBJECT (basepayload, "Could not set outcaps");
+    g_array_set_size (nal_queue, 0);
+    ret = GST_FLOW_NOT_NEGOTIATED;
+    goto done;
+  }
+}
+
+static gboolean
+gst_rtp_h265_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event)
+{
+  gboolean res;
+  const GstStructure *s;
+  GstRtpH265Pay *rtph265pay = GST_RTP_H265_PAY (payload);
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_FLUSH_STOP:
+      gst_adapter_clear (rtph265pay->adapter);
+      break;
+    case GST_EVENT_CUSTOM_DOWNSTREAM:
+      s = gst_event_get_structure (event);
+      if (gst_structure_has_name (s, "GstForceKeyUnit")) {
+        gboolean resend_codec_data;
+
+        if (gst_structure_get_boolean (s, "all-headers",
+                &resend_codec_data) && resend_codec_data)
+          rtph265pay->send_vps_sps_pps = TRUE;
+      }
+      break;
+    case GST_EVENT_EOS:
+    {
+      /* call handle_buffer with NULL to flush last NAL from adapter
+       * in byte-stream mode
+       */
+      gst_rtp_h265_pay_handle_buffer (payload, NULL);
+      break;
+    }
+    case GST_EVENT_STREAM_START:
+      GST_DEBUG_OBJECT (rtph265pay,
+          "New stream detected => Clear VPS, SPS and PPS");
+      gst_rtp_h265_pay_clear_vps_sps_pps (rtph265pay);
+      break;
+    default:
+      break;
+  }
+
+  res = GST_RTP_BASE_PAYLOAD_CLASS (parent_class)->sink_event (payload, event);
+
+  return res;
+}
+
+static GstStateChangeReturn
+gst_rtp_h265_pay_change_state (GstElement * element, GstStateChange transition)
+{
+  GstStateChangeReturn ret;
+  GstRtpH265Pay *rtph265pay = GST_RTP_H265_PAY (element);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      rtph265pay->send_vps_sps_pps = FALSE;
+      gst_adapter_clear (rtph265pay->adapter);
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      rtph265pay->last_vps_sps_pps = -1;
+      gst_rtp_h265_pay_clear_vps_sps_pps (rtph265pay);
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+  return ret;
+}
+
+static void
+gst_rtp_h265_pay_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstRtpH265Pay *rtph265pay;
+
+  rtph265pay = GST_RTP_H265_PAY (object);
+
+  switch (prop_id) {
+    case PROP_SPROP_PARAMETER_SETS:
+      g_free (rtph265pay->sprop_parameter_sets);
+      rtph265pay->sprop_parameter_sets = g_value_dup_string (value);
+      rtph265pay->update_caps = TRUE;
+      break;
+    case PROP_CONFIG_INTERVAL:
+      rtph265pay->vps_sps_pps_interval = g_value_get_uint (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_rtp_h265_pay_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstRtpH265Pay *rtph265pay;
+
+  rtph265pay = GST_RTP_H265_PAY (object);
+
+  switch (prop_id) {
+    case PROP_SPROP_PARAMETER_SETS:
+      g_value_set_string (value, rtph265pay->sprop_parameter_sets);
+      break;
+    case PROP_CONFIG_INTERVAL:
+      g_value_set_uint (value, rtph265pay->vps_sps_pps_interval);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+gboolean
+gst_rtp_h265_pay_plugin_init (GstPlugin * plugin)
+{
+  return gst_element_register (plugin, "rtph265pay",
+      GST_RANK_SECONDARY, GST_TYPE_RTP_H265_PAY);
+}
diff --git a/gst/rtp/gstrtph265pay.h b/gst/rtp/gstrtph265pay.h
new file mode 100644
index 0000000..8382c5e
--- /dev/null
+++ b/gst/rtp/gstrtph265pay.h
@@ -0,0 +1,82 @@
+/* GStreamer
+ * Copyright (C) <2006> Wim Taymans <wim.taymans@gmail.com>
+ * Copyright (C) <2014> Jurgen Slowack <jurgenslowack@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_RTP_H265_PAY_H__
+#define __GST_RTP_H265_PAY_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+#include <gst/rtp/gstrtpbasepayload.h>
+#include <gst/codecparsers/gsth265parser.h>
+
+G_BEGIN_DECLS
+#define GST_TYPE_RTP_H265_PAY \
+  (gst_rtp_h265_pay_get_type())
+#define GST_RTP_H265_PAY(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H265_PAY,GstRtpH265Pay))
+#define GST_RTP_H265_PAY_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H265_PAY,GstRtpH265PayClass))
+#define GST_IS_RTP_H265_PAY(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H265_PAY))
+#define GST_IS_RTP_H265_PAY_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H265_PAY))
+typedef struct _GstRtpH265Pay GstRtpH265Pay;
+typedef struct _GstRtpH265PayClass GstRtpH265PayClass;
+
+typedef enum
+{
+  GST_H265_ALIGNMENT_UNKNOWN,
+  GST_H265_ALIGNMENT_NAL,
+  GST_H265_ALIGNMENT_AU
+} GstH265Alignment;
+
+struct _GstRtpH265Pay
+{
+  GstRTPBasePayload payload;
+
+  guint profile;
+  GPtrArray *sps, *pps, *vps;
+
+  GstH265StreamFormat stream_format;
+  GstH265Alignment alignment;
+  guint nal_length_size;
+  GArray *queue;
+
+  gchar *sprop_parameter_sets;
+  gboolean update_caps;
+
+  GstAdapter *adapter;
+
+  guint vps_sps_pps_interval;
+  gboolean send_vps_sps_pps;
+  GstClockTime last_vps_sps_pps;
+};
+
+struct _GstRtpH265PayClass
+{
+  GstRTPBasePayloadClass parent_class;
+};
+
+GType gst_rtp_h265_pay_get_type (void);
+
+gboolean gst_rtp_h265_pay_plugin_init (GstPlugin * plugin);
+
+G_END_DECLS
+#endif /* __GST_RTP_H265_PAY_H__ */
diff --git a/gst/sdi/Makefile.in b/gst/sdi/Makefile.in
index e61c539..fb2c6af 100644
--- a/gst/sdi/Makefile.in
+++ b/gst/sdi/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/sdp/Makefile.in b/gst/sdp/Makefile.in
index 8b81d56..465bc96 100644
--- a/gst/sdp/Makefile.in
+++ b/gst/sdp/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/sdp/gstsdpdemux.c b/gst/sdp/gstsdpdemux.c
index 17e2e05..d2a1fa3 100644
--- a/gst/sdp/gstsdpdemux.c
+++ b/gst/sdp/gstsdpdemux.c
@@ -20,7 +20,7 @@
  * SECTION:element-sdpdemux
  *
  * sdpdemux currently understands SDP as the input format of the session description.
- * For each stream listed in the SDP a new stream_%u pad will be created
+ * For each stream listed in the SDP a new stream_\%u pad will be created
  * with caps derived from the SDP media description. This is a caps of mime type
  * "application/x-rtp" that can be connected to any available RTP depayloader
  * element. 
@@ -45,10 +45,6 @@
 #include "config.h"
 #endif
 
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
 #include "gstsdpdemux.h"
 
 #include <gst/rtp/gstrtppayloads.h>
diff --git a/gst/segmentclip/Makefile.in b/gst/segmentclip/Makefile.in
index 05e76e7..24c95c5 100644
--- a/gst/segmentclip/Makefile.in
+++ b/gst/segmentclip/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/siren/Makefile.in b/gst/siren/Makefile.in
index 78c2163..cb2773b 100644
--- a/gst/siren/Makefile.in
+++ b/gst/siren/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/siren/common.c b/gst/siren/common.c
index 46a4877..ee77c70 100644
--- a/gst/siren/common.c
+++ b/gst/siren/common.c
@@ -269,7 +269,7 @@
 
       if (sample_rate == 24000)
         *sample_rate_code = 1;
-      else if (sample_rate == 24000)
+      else if (sample_rate == 32000)
         *sample_rate_code = 2;
       else if (sample_rate == 48000)
         *sample_rate_code = 3;
diff --git a/gst/siren/decoder.c b/gst/siren/decoder.c
index e90932a..8f87ca9 100644
--- a/gst/siren/decoder.c
+++ b/gst/siren/decoder.c
@@ -82,10 +82,10 @@
       scale_factor, number_of_regions, sample_rate_code, bits_per_frame;
   int decoded_sample_rate_code;
 
-  static int absolute_region_power_index[28] = { 0 };
-  static float decoder_standard_deviation[28] = { 0 };
-  static int power_categories[28] = { 0 };
-  static int category_balance[28] = { 0 };
+  int absolute_region_power_index[28] = { 0 };
+  float decoder_standard_deviation[28] = { 0 };
+  int power_categories[28] = { 0 };
+  int category_balance[28] = { 0 };
   int ChecksumTable[4] = { 0x7F80, 0x7878, 0x6666, 0x5555 };
   int i, j;
 
diff --git a/gst/siren/encoder.c b/gst/siren/encoder.c
index 658fe5d..8bb340f 100644
--- a/gst/siren/encoder.c
+++ b/gst/siren/encoder.c
@@ -82,13 +82,13 @@
       scale_factor, number_of_regions, sample_rate_code, bits_per_frame;
   int sample_rate = encoder->sample_rate;
 
-  static int absolute_region_power_index[28] = { 0 };
-  static int power_categories[28] = { 0 };
-  static int category_balance[28] = { 0 };
-  static int drp_num_bits[30] = { 0 };
-  static int drp_code_bits[30] = { 0 };
-  static int region_mlt_bit_counts[28] = { 0 };
-  static int region_mlt_bits[112] = { 0 };
+  int absolute_region_power_index[28] = { 0 };
+  int power_categories[28] = { 0 };
+  int category_balance[28] = { 0 };
+  int drp_num_bits[30] = { 0 };
+  int drp_code_bits[30] = { 0 };
+  int region_mlt_bit_counts[28] = { 0 };
+  int region_mlt_bits[112] = { 0 };
   int ChecksumTable[4] = { 0x7F80, 0x7878, 0x6666, 0x5555 };
   int i, j;
 
diff --git a/gst/siren/gstsirendec.c b/gst/siren/gstsirendec.c
index 0b26f5a..7a3ae4b 100644
--- a/gst/siren/gstsirendec.c
+++ b/gst/siren/gstsirendec.c
@@ -105,7 +105,7 @@
 
   GST_DEBUG_OBJECT (dec, "start");
 
-  sdec->decoder = Siren7_NewDecoder (16000);;
+  sdec->decoder = Siren7_NewDecoder (16000);
 
   /* no flushing please */
   gst_audio_decoder_set_drainable (dec, FALSE);
diff --git a/gst/siren/gstsirendec.h b/gst/siren/gstsirendec.h
index bcb55cd..27d7c86 100644
--- a/gst/siren/gstsirendec.h
+++ b/gst/siren/gstsirendec.h
@@ -29,7 +29,7 @@
 #include "siren7.h"
 
 G_BEGIN_DECLS
-/* #define's don't like whitespacey bits */
+
 #define GST_TYPE_SIREN_DEC \
   (gst_siren_dec_get_type())
 #define GST_SIREN_DEC(obj) \
@@ -42,9 +42,9 @@
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_DEC))
 #define GST_IS_SIREN_DEC_CLASS(obj) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_DEC))
+
 typedef struct _GstSirenDec GstSirenDec;
 typedef struct _GstSirenDecClass GstSirenDecClass;
-typedef struct _GstSirenDecPrivate GstSirenDecPrivate;
 
 struct _GstSirenDec
 {
@@ -64,4 +64,5 @@
 gboolean gst_siren_dec_plugin_init (GstPlugin * plugin);
 
 G_END_DECLS
+
 #endif /* __GST_SIREN_DEC_H__ */
diff --git a/gst/siren/gstsirenenc.h b/gst/siren/gstsirenenc.h
index 9351bd2..acfb5e6 100644
--- a/gst/siren/gstsirenenc.h
+++ b/gst/siren/gstsirenenc.h
@@ -29,7 +29,7 @@
 #include "siren7.h"
 
 G_BEGIN_DECLS
-/* #define's don't like whitespacey bits */
+
 #define GST_TYPE_SIREN_ENC \
   (gst_siren_enc_get_type())
 #define GST_SIREN_ENC(obj) \
@@ -42,9 +42,9 @@
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_ENC))
 #define GST_IS_SIREN_ENC_CLASS(obj) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_ENC))
+
 typedef struct _GstSirenEnc GstSirenEnc;
 typedef struct _GstSirenEncClass GstSirenEncClass;
-typedef struct _GstSirenEncPrivate GstSirenEncPrivate;
 
 struct _GstSirenEnc
 {
diff --git a/gst/smooth/Makefile.in b/gst/smooth/Makefile.in
index ea2097d..a6e58d5 100644
--- a/gst/smooth/Makefile.in
+++ b/gst/smooth/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/speed/Makefile.in b/gst/speed/Makefile.in
index 543c0d8..b2fc0dc 100644
--- a/gst/speed/Makefile.in
+++ b/gst/speed/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/stereo/Makefile.in b/gst/stereo/Makefile.in
index f0518fc..67f1b04 100644
--- a/gst/stereo/Makefile.in
+++ b/gst/stereo/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/subenc/Makefile.in b/gst/subenc/Makefile.in
index 76cac9c..483598c 100644
--- a/gst/subenc/Makefile.in
+++ b/gst/subenc/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/tta/Makefile.in b/gst/tta/Makefile.in
index 96c287d..4de83c4 100644
--- a/gst/tta/Makefile.in
+++ b/gst/tta/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/tta/filters.h b/gst/tta/filters.h
index 2162b20..9df5e1d 100644
--- a/gst/tta/filters.h
+++ b/gst/tta/filters.h
@@ -32,7 +32,7 @@
 #define FILTERS_H
 
 ///////// Filter Settings //////////
-static long flt_set[3] = {10, 9, 10};
+static const long flt_set[3] = {10, 9, 10};
 
 static void
 memshl (register long *pA, register long *pB) {
diff --git a/gst/videofilters/Makefile.in b/gst/videofilters/Makefile.in
index dd10898..be48ccb 100644
--- a/gst/videofilters/Makefile.in
+++ b/gst/videofilters/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -250,8 +250,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -290,7 +294,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -298,6 +301,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -347,8 +352,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -427,7 +430,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -436,7 +438,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -449,7 +450,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -474,6 +474,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -547,10 +549,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -576,6 +582,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -612,6 +621,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -652,17 +662,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -679,6 +688,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/videofilters/gstzebrastripe.c b/gst/videofilters/gstzebrastripe.c
index 2da9756..0b08100 100644
--- a/gst/videofilters/gstzebrastripe.c
+++ b/gst/videofilters/gstzebrastripe.c
@@ -79,7 +79,7 @@
 /* pad templates */
 
 #define VIDEO_CAPS GST_VIDEO_CAPS_MAKE( \
-    "{ I420, Y444, Y42B, Y41B, YUY2, UYVY, AYUV }")
+    "{ I420, Y444, Y42B, Y41B, YUY2, UYVY, AYUV, NV12, NV21, YV12 }")
 
 
 /* class initialization */
@@ -200,105 +200,52 @@
 }
 
 static GstFlowReturn
-gst_zebra_stripe_transform_frame_ip_planarY (GstZebraStripe * zebrastripe,
+gst_zebra_stripe_transform_frame_ip (GstVideoFilter * filter,
     GstVideoFrame * frame)
 {
-  int width = frame->info.width;
-  int height = frame->info.height;
-  int i, j;
-  int threshold = zebrastripe->y_threshold;
-  int t = zebrastripe->t;
-
-  for (j = 0; j < height; j++) {
-    guint8 *data = (guint8 *) frame->data[0] + frame->info.stride[0] * j;
-    for (i = 0; i < width; i++) {
-      if (data[i] >= threshold) {
-        if ((i + j + t) & 0x4)
-          data[i] = 16;
-      }
-    }
-  }
-  return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_zebra_stripe_transform_frame_ip_YUY2 (GstZebraStripe * zebrastripe,
-    GstVideoFrame * frame)
-{
+  GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (filter);
   int width = frame->info.width;
   int height = frame->info.height;
   int i, j;
   int threshold = zebrastripe->y_threshold;
   int t = zebrastripe->t;
   int offset = 0;
-
-  if (frame->info.finfo->format == GST_VIDEO_FORMAT_UYVY) {
-    offset = 1;
-  }
-
-  for (j = 0; j < height; j++) {
-    guint8 *data =
-        (guint8 *) frame->data[0] + frame->info.stride[0] * j + offset;
-    for (i = 0; i < width; i++) {
-      if (data[2 * i] >= threshold) {
-        if ((i + j + t) & 0x4)
-          data[2 * i] = 16;
-      }
-    }
-  }
-  return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_zebra_stripe_transform_frame_ip_AYUV (GstZebraStripe * zebrastripe,
-    GstVideoFrame * frame)
-{
-  int width = frame->info.width;
-  int height = frame->info.height;
-  int i, j;
-  int threshold = zebrastripe->y_threshold;
-  int t = zebrastripe->t;
-
-  for (j = 0; j < height; j++) {
-    guint8 *data = (guint8 *) frame->data[0] + frame->info.stride[0] * j;
-    for (i = 0; i < width; i++) {
-      if (data[4 * i + 1] >= threshold) {
-        if ((i + j + t) & 0x4)
-          data[4 * i + 1] = 16;
-      }
-    }
-  }
-
-  return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_zebra_stripe_transform_frame_ip (GstVideoFilter * filter,
-    GstVideoFrame * frame)
-{
-  GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (filter);
+  int pixel_stride = 0, y_position = 0;
 
   GST_DEBUG_OBJECT (zebrastripe, "transform_frame_ip");
   zebrastripe->t++;
+  pixel_stride = GST_VIDEO_FORMAT_INFO_PSTRIDE (frame->info.finfo, 0);
 
   switch (frame->info.finfo->format) {
     case GST_VIDEO_FORMAT_I420:
     case GST_VIDEO_FORMAT_Y41B:
     case GST_VIDEO_FORMAT_Y444:
     case GST_VIDEO_FORMAT_Y42B:
-      gst_zebra_stripe_transform_frame_ip_planarY (zebrastripe, frame);
-      break;
     case GST_VIDEO_FORMAT_YUY2:
+    case GST_VIDEO_FORMAT_NV12:
+    case GST_VIDEO_FORMAT_NV21:
+    case GST_VIDEO_FORMAT_YV12:
+      break;
     case GST_VIDEO_FORMAT_UYVY:
-      gst_zebra_stripe_transform_frame_ip_YUY2 (zebrastripe, frame);
+      offset = 1;
       break;
     case GST_VIDEO_FORMAT_AYUV:
-      gst_zebra_stripe_transform_frame_ip_AYUV (zebrastripe, frame);
+      y_position = 1;
       break;
     default:
       g_assert_not_reached ();
   }
 
+  for (j = 0; j < height; j++) {
+    guint8 *data =
+        (guint8 *) frame->data[0] + frame->info.stride[0] * j + offset;
+    for (i = 0; i < width; i++) {
+      if (data[pixel_stride * i + y_position] >= threshold) {
+        if ((i + j + t) & 0x4)
+          data[pixel_stride * i + y_position] = 16;
+      }
+    }
+  }
 
   return GST_FLOW_OK;
 }
diff --git a/gst/videomeasure/Makefile.in b/gst/videomeasure/Makefile.in
index 5b59ed3..29d9caa 100644
--- a/gst/videomeasure/Makefile.in
+++ b/gst/videomeasure/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/videomeasure/gstvideomeasure_ssim.c b/gst/videomeasure/gstvideomeasure_ssim.c
index 3c7c502..8ccac88 100644
--- a/gst/videomeasure/gstvideomeasure_ssim.c
+++ b/gst/videomeasure/gstvideomeasure_ssim.c
@@ -664,15 +664,17 @@
         if (res) {
           gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
 
-          if (min_cur > min)
-            min = min_cur;
+          if (live_cur) {
+            if (min_cur > min)
+              min = min_cur;
 
-          if (max_cur != GST_CLOCK_TIME_NONE &&
-              ((max != GST_CLOCK_TIME_NONE && max_cur > max) ||
-                  (max == GST_CLOCK_TIME_NONE)))
-            max = max_cur;
+            if (max == GST_CLOCK_TIME_NONE)
+              max = max_cur;
+            else if (max_cur < max)
+              max = max_cur;
 
-          live = live || live_cur;
+            live = TRUE;
+          }
         }
 
         gst_query_unref (peerquery);
@@ -1473,7 +1475,7 @@
       collect_data = (GstCollectData *) collected->data;
 
       if (collect_data->pad == ssim->orig) {
-        orgbuf = gst_collect_pads_pop (pads, collect_data);;
+        orgbuf = gst_collect_pads_pop (pads, collect_data);
 
         GST_DEBUG_OBJECT (ssim, "Original stream - flags(0x%x), timestamp(%"
             GST_TIME_FORMAT "), duration(%" GST_TIME_FORMAT ")",
diff --git a/gst/videoparsers/Makefile.in b/gst/videoparsers/Makefile.in
index 755d7e4..0c29932 100644
--- a/gst/videoparsers/Makefile.in
+++ b/gst/videoparsers/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -257,8 +257,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -297,7 +301,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -305,6 +308,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -354,8 +359,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -434,7 +437,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -443,7 +445,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -456,7 +457,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -481,6 +481,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -554,10 +556,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -583,6 +589,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -619,6 +628,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -659,17 +669,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -686,6 +695,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c
index 506cd61..f7a56e2 100644
--- a/gst/videoparsers/gsth264parse.c
+++ b/gst/videoparsers/gsth264parse.c
@@ -189,13 +189,16 @@
   h264parse->idr_pos = -1;
   h264parse->sei_pos = -1;
   h264parse->keyframe = FALSE;
+  h264parse->header = FALSE;
   h264parse->frame_start = FALSE;
   gst_adapter_clear (h264parse->frame_out);
 }
 
 static void
-gst_h264_parse_reset (GstH264Parse * h264parse)
+gst_h264_parse_reset_stream_info (GstH264Parse * h264parse)
 {
+  gint i;
+
   h264parse->width = 0;
   h264parse->height = 0;
   h264parse->fps_num = 0;
@@ -204,19 +207,32 @@
   h264parse->upstream_par_d = -1;
   h264parse->parsed_par_n = 0;
   h264parse->parsed_par_d = 0;
-  gst_buffer_replace (&h264parse->codec_data, NULL);
-  gst_buffer_replace (&h264parse->codec_data_in, NULL);
-  h264parse->nal_length_size = 4;
-  h264parse->packetized = FALSE;
-  h264parse->transform = FALSE;
+  h264parse->have_pps = FALSE;
+  h264parse->have_sps = FALSE;
 
   h264parse->align = GST_H264_PARSE_ALIGN_NONE;
   h264parse->format = GST_H264_PARSE_FORMAT_NONE;
 
-  h264parse->last_report = GST_CLOCK_TIME_NONE;
+  h264parse->transform = FALSE;
+  h264parse->nal_length_size = 4;
+  h264parse->packetized = FALSE;
   h264parse->push_codec = FALSE;
-  h264parse->have_pps = FALSE;
-  h264parse->have_sps = FALSE;
+
+  gst_buffer_replace (&h264parse->codec_data, NULL);
+  gst_buffer_replace (&h264parse->codec_data_in, NULL);
+
+  gst_h264_parse_reset_frame (h264parse);
+
+  for (i = 0; i < GST_H264_MAX_SPS_COUNT; i++)
+    gst_buffer_replace (&h264parse->sps_nals[i], NULL);
+  for (i = 0; i < GST_H264_MAX_PPS_COUNT; i++)
+    gst_buffer_replace (&h264parse->pps_nals[i], NULL);
+}
+
+static void
+gst_h264_parse_reset (GstH264Parse * h264parse)
+{
+  h264parse->last_report = GST_CLOCK_TIME_NONE;
 
   h264parse->dts = GST_CLOCK_TIME_NONE;
   h264parse->ts_trn_nb = GST_CLOCK_TIME_NONE;
@@ -229,7 +245,7 @@
 
   h264parse->discont = FALSE;
 
-  gst_h264_parse_reset_frame (h264parse);
+  gst_h264_parse_reset_stream_info (h264parse);
 }
 
 static gboolean
@@ -256,17 +272,11 @@
 static gboolean
 gst_h264_parse_stop (GstBaseParse * parse)
 {
-  guint i;
   GstH264Parse *h264parse = GST_H264_PARSE (parse);
 
   GST_DEBUG_OBJECT (parse, "stop");
   gst_h264_parse_reset (h264parse);
 
-  for (i = 0; i < GST_H264_MAX_SPS_COUNT; i++)
-    gst_buffer_replace (&h264parse->sps_nals[i], NULL);
-  for (i = 0; i < GST_H264_MAX_PPS_COUNT; i++)
-    gst_buffer_replace (&h264parse->pps_nals[i], NULL);
-
   gst_h264_nal_parser_free (h264parse->nalparser);
 
   return TRUE;
@@ -428,7 +438,7 @@
   GstBuffer *buf, **store;
   guint size = nalu->size, store_size;
 
-  if (naltype == GST_H264_NAL_SPS) {
+  if (naltype == GST_H264_NAL_SPS || naltype == GST_H264_NAL_SUBSET_SPS) {
     store_size = GST_H264_MAX_SPS_COUNT;
     store = h264parse->sps_nals;
     GST_DEBUG_OBJECT (h264parse, "storing sps %u", id);
@@ -447,6 +457,10 @@
   buf = gst_buffer_new_allocate (NULL, size, NULL);
   gst_buffer_fill (buf, 0, nalu->data + nalu->offset, size);
 
+  /* Indicate that buffer contain a header needed for decoding */
+  if (naltype == GST_H264_NAL_SPS || naltype == GST_H264_NAL_PPS)
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
+
   if (store[id])
     gst_buffer_unref (store[id]);
 
@@ -467,13 +481,16 @@
   "AU delimiter",
   "Sequence End",
   "Stream End",
-  "Filler Data"
+  "Filler Data",
+  "SPS extension",
+  "Prefix",
+  "SPS Subset"
 };
 
 static const gchar *
 _nal_name (GstH264NalUnitType nal_type)
 {
-  if (nal_type <= GST_H264_NAL_FILLER_DATA)
+  if (nal_type <= GST_H264_NAL_SUBSET_SPS)
     return nal_names[nal_type];
   return "Invalid";
 }
@@ -528,6 +545,16 @@
             sei.payload.recovery_point.broken_link_flag,
             sei.payload.recovery_point.changing_slice_group_idc);
         break;
+
+        /* Additional messages that are not innerly useful to the
+         * element but for debugging purposes */
+      case GST_H264_SEI_STEREO_VIDEO_INFO:
+        GST_LOG_OBJECT (h264parse, "stereo video information message");
+        break;
+      case GST_H264_SEI_FRAME_PACKING:
+        GST_LOG_OBJECT (h264parse, "frame packing arrangement message: type %d",
+            sei.payload.frame_packing.frame_packing_type);
+        break;
     }
   }
   g_array_free (messages, TRUE);
@@ -556,11 +583,18 @@
       nal_type, _nal_name (nal_type), nalu->size);
 
   switch (nal_type) {
+    case GST_H264_NAL_SUBSET_SPS:
+      if (!GST_H264_PARSE_STATE_VALID (h264parse, GST_H264_PARSE_STATE_GOT_SPS))
+        return FALSE;
+      pres = gst_h264_parser_parse_subset_sps (nalparser, nalu, &sps, TRUE);
+      goto process_sps;
+
     case GST_H264_NAL_SPS:
       /* reset state, everything else is obsolete */
       h264parse->state = 0;
-
       pres = gst_h264_parser_parse_sps (nalparser, nalu, &sps, TRUE);
+
+    process_sps:
       /* arranged for a fallback sps.id, so use that one and only warn */
       if (pres != GST_H264_PARSER_OK) {
         GST_WARNING_OBJECT (h264parse, "failed to parse SPS:");
@@ -581,6 +615,7 @@
 
       gst_h264_parser_store_nal (h264parse, sps.id, nal_type, nalu);
       h264parse->state |= GST_H264_PARSE_STATE_GOT_SPS;
+      h264parse->header |= TRUE;
       break;
     case GST_H264_NAL_PPS:
       /* expected state: got-sps */
@@ -614,6 +649,7 @@
       gst_h264_parser_store_nal (h264parse, pps.id, nal_type, nalu);
       gst_h264_pps_clear (&pps);
       h264parse->state |= GST_H264_PARSE_STATE_GOT_PPS;
+      h264parse->header |= TRUE;
       break;
     case GST_H264_NAL_SEI:
       /* expected state: got-sps */
@@ -637,6 +673,7 @@
     case GST_H264_NAL_SLICE_DPB:
     case GST_H264_NAL_SLICE_DPC:
     case GST_H264_NAL_SLICE_IDR:
+    case GST_H264_NAL_SLICE_EXT:
       /* expected state: got-sps|got-pps (valid picture headers) */
       h264parse->state &= GST_H264_PARSE_STATE_VALID_PICTURE_HEADERS;
       if (!GST_H264_PARSE_STATE_VALID (h264parse,
@@ -644,13 +681,15 @@
         return FALSE;
 
       /* don't need to parse the whole slice (header) here */
-      if (*(nalu->data + nalu->offset + 1) & 0x80) {
+      if (*(nalu->data + nalu->offset + nalu->header_bytes) & 0x80) {
         /* means first_mb_in_slice == 0 */
         /* real frame data */
         GST_DEBUG_OBJECT (h264parse, "first_mb_in_slice = 0");
         h264parse->frame_start = TRUE;
       }
       GST_DEBUG_OBJECT (h264parse, "frame start: %i", h264parse->frame_start);
+      if (nal_type == GST_H264_NAL_SLICE_EXT && !GST_H264_IS_MVC_NALU (nalu))
+        break;
       {
         GstH264SliceHdr slice;
 
@@ -747,8 +786,9 @@
    * and also works with broken frame_num in NAL
    * (where spec-wise would fail) */
   nal_type = nnalu.type;
-  complete = h264parse->picture_start && (nal_type >= GST_H264_NAL_SEI &&
-      nal_type <= GST_H264_NAL_AU_DELIMITER);
+  complete = h264parse->picture_start && ((nal_type >= GST_H264_NAL_SEI &&
+          nal_type <= GST_H264_NAL_AU_DELIMITER) ||
+      (nal_type >= 14 && nal_type <= 18));
 
   GST_LOG_OBJECT (h264parse, "next nal type: %d %s", nal_type,
       _nal_name (nal_type));
@@ -756,7 +796,7 @@
       || nal_type == GST_H264_NAL_SLICE_DPA
       || nal_type == GST_H264_NAL_SLICE_IDR) &&
       /* first_mb_in_slice == 0 considered start of frame */
-      (nnalu.data[nnalu.offset + 1] & 0x80);
+      (nnalu.data[nnalu.offset + nnalu.header_bytes] & 0x80);
 
   GST_LOG_OBJECT (h264parse, "au complete: %d", complete);
 
@@ -1180,6 +1220,183 @@
   }
 }
 
+static GstCaps *
+get_compatible_profile_caps (GstH264SPS * sps)
+{
+  GstCaps *caps = NULL;
+  const gchar **profiles = NULL;
+  gint i;
+  GValue compat_profiles = G_VALUE_INIT;
+  g_value_init (&compat_profiles, GST_TYPE_LIST);
+
+  switch (sps->profile_idc) {
+    case GST_H264_PROFILE_EXTENDED:
+      if (sps->constraint_set0_flag) {  /* A.2.1 */
+        if (sps->constraint_set1_flag) {
+          static const gchar *profile_array[] =
+              { "constrained-baseline", "baseline", "main", "high",
+            "high-10", "high-4:2:2", "high-4:4:4", NULL
+          };
+          profiles = profile_array;
+        } else {
+          static const gchar *profile_array[] = { "baseline", NULL };
+          profiles = profile_array;
+        }
+      } else if (sps->constraint_set1_flag) {   /* A.2.2 */
+        static const gchar *profile_array[] =
+            { "main", "high", "high-10", "high-4:2:2", "high-4:4:4", NULL };
+        profiles = profile_array;
+      }
+      break;
+    case GST_H264_PROFILE_BASELINE:
+      if (sps->constraint_set1_flag) {  /* A.2.1 */
+        static const gchar *profile_array[] =
+            { "constrained-baseline", "main", "high", "high-10", "high-4:2:2",
+          "high-4:4:4", NULL
+        };
+        profiles = profile_array;
+      } else {
+        static const gchar *profile_array[] = { "extended", NULL };
+        profiles = profile_array;
+      }
+      break;
+    case GST_H264_PROFILE_MAIN:
+    {
+      static const gchar *profile_array[] =
+          { "high", "high-10", "high-4:2:2", "high-4:4:4", NULL };
+      profiles = profile_array;
+    }
+      break;
+    case GST_H264_PROFILE_HIGH:
+      if (sps->constraint_set1_flag) {
+        static const gchar *profile_array[] =
+            { "main", "high-10", "high-4:2:2", "high-4:4:4", NULL };
+        profiles = profile_array;
+      } else {
+        static const gchar *profile_array[] =
+            { "high-10", "high-4:2:2", "high-4:4:4", NULL };
+        profiles = profile_array;
+      }
+      break;
+    case GST_H264_PROFILE_HIGH10:
+      if (sps->constraint_set1_flag) {
+        static const gchar *profile_array[] =
+            { "main", "high", "high-4:2:2", "high-4:4:4", NULL };
+        profiles = profile_array;
+      } else {
+        if (sps->constraint_set3_flag) {        /* A.2.8 */
+          static const gchar *profile_array[] =
+              { "high-10", "high-4:2:2", "high-4:4:4", "high-4:2:2-intra",
+            "high-4:4:4-intra", NULL
+          };
+          profiles = profile_array;
+        } else {
+          static const gchar *profile_array[] =
+              { "high-4:2:2", "high-4:4:4", NULL };
+          profiles = profile_array;
+        }
+      }
+      break;
+    case GST_H264_PROFILE_HIGH_422:
+      if (sps->constraint_set1_flag) {
+        static const gchar *profile_array[] =
+            { "main", "high", "high-10", "high-4:4:4", NULL };
+        profiles = profile_array;
+      } else {
+        if (sps->constraint_set3_flag) {        /* A.2.9 */
+          static const gchar *profile_array[] =
+              { "high-4:2:2", "high-4:4:4", "high-4:4:4-intra", NULL };
+          profiles = profile_array;
+        } else {
+          static const gchar *profile_array[] = { "high-4:4:4", NULL };
+          profiles = profile_array;
+        }
+      }
+      break;
+    case GST_H264_PROFILE_HIGH_444:
+      if (sps->constraint_set1_flag) {
+        static const gchar *profile_array[] =
+            { "main", "high", "high-10", "high-4:2:2", NULL };
+        profiles = profile_array;
+      } else if (sps->constraint_set3_flag) {   /* A.2.10 */
+        static const gchar *profile_array[] = { "high-4:4:4", NULL };
+        profiles = profile_array;
+      }
+      break;
+    case GST_H264_PROFILE_MULTIVIEW_HIGH:
+      if (sps->extension_type == GST_H264_NAL_EXTENSION_MVC
+          && sps->extension.mvc.num_views_minus1 == 1) {
+        static const gchar *profile_array[] =
+            { "stereo-high", "multiview-high", NULL };
+        profiles = profile_array;
+      } else {
+        static const gchar *profile_array[] = { "multiview-high", NULL };
+        profiles = profile_array;
+      }
+      break;
+    default:
+      break;
+  }
+
+  if (profiles) {
+    GValue value = G_VALUE_INIT;
+    caps = gst_caps_new_empty_simple ("video/x-h264");
+    for (i = 0; profiles[i]; i++) {
+      g_value_init (&value, G_TYPE_STRING);
+      g_value_set_string (&value, profiles[i]);
+      gst_value_list_append_value (&compat_profiles, &value);
+      g_value_unset (&value);
+    }
+    gst_caps_set_value (caps, "profile", &compat_profiles);
+    g_value_unset (&compat_profiles);
+  }
+
+  return caps;
+}
+
+/* if downstream didn't support the exact profile indicated in sps header,
+ * check for the compatible profiles also */
+static void
+ensure_caps_profile (GstH264Parse * h264parse, GstCaps * caps, GstH264SPS * sps)
+{
+  GstCaps *filter_caps, *peer_caps, *compat_caps;
+
+  filter_caps = gst_caps_new_empty_simple ("video/x-h264");
+  peer_caps =
+      gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (h264parse), filter_caps);
+
+  if (peer_caps && !gst_caps_can_intersect (caps, peer_caps)) {
+    GstStructure *structure;
+
+    compat_caps = get_compatible_profile_caps (sps);
+    if (compat_caps != NULL) {
+      GstCaps *res_caps = NULL;
+
+      res_caps = gst_caps_intersect (peer_caps, compat_caps);
+
+      if (res_caps && !gst_caps_is_empty (res_caps)) {
+        const gchar *profile_str = NULL;
+
+        res_caps = gst_caps_fixate (res_caps);
+        structure = gst_caps_get_structure (res_caps, 0);
+        profile_str = gst_structure_get_string (structure, "profile");
+        if (profile_str) {
+          gst_caps_set_simple (caps, "profile", G_TYPE_STRING, profile_str,
+              NULL);
+          GST_DEBUG_OBJECT (h264parse,
+              "Setting compatible profile %s to the caps", profile_str);
+        }
+      }
+      if (res_caps)
+        gst_caps_unref (res_caps);
+      gst_caps_unref (compat_caps);
+    }
+  }
+  if (peer_caps)
+    gst_caps_unref (peer_caps);
+  gst_caps_unref (filter_caps);
+}
+
 static void
 gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
 {
@@ -1347,6 +1564,8 @@
         gst_codec_utils_h264_caps_set_level_and_profile (caps,
             map.data + 1, map.size - 1);
         gst_buffer_unmap (sps_buf, &map);
+        /* relax the profile constraint to find a suitable decoder */
+        ensure_caps_profile (h264parse, caps, sps);
       }
     }
 
@@ -1546,6 +1765,11 @@
   else
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
 
+  if (h264parse->header)
+    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_HEADER);
+  else
+    GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_HEADER);
+
   if (h264parse->discont) {
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
     h264parse->discont = FALSE;
@@ -1725,10 +1949,12 @@
   if (h264parse->interval > 0 || h264parse->push_codec) {
     GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
     guint64 diff;
+    gboolean initial_frame = FALSE;
 
     /* init */
     if (!GST_CLOCK_TIME_IS_VALID (h264parse->last_report)) {
       h264parse->last_report = timestamp;
+      initial_frame = TRUE;
     }
 
     if (h264parse->idr_pos >= 0) {
@@ -1748,7 +1974,7 @@
           GST_TIME_ARGS (diff));
 
       if (GST_TIME_AS_SECONDS (diff) >= h264parse->interval ||
-          h264parse->push_codec) {
+          initial_frame || h264parse->push_codec) {
         GstBuffer *codec_nal;
         gint i;
         GstClockTime new_ts;
@@ -1856,18 +2082,26 @@
 {
   GstH264Parse *h264parse;
   GstStructure *str;
-  const GValue *value;
+  const GValue *codec_data_value;
   GstBuffer *codec_data = NULL;
   gsize size;
   guint format, align, off;
   GstH264NalUnit nalu;
   GstH264ParserResult parseres;
+  GstCaps *old_caps;
 
   h264parse = GST_H264_PARSE (parse);
 
   /* reset */
   h264parse->push_codec = FALSE;
 
+  old_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SINK_PAD (parse));
+  if (old_caps) {
+    if (!gst_caps_is_equal (old_caps, caps))
+      gst_h264_parse_reset_stream_info (h264parse);
+    gst_caps_unref (old_caps);
+  }
+
   str = gst_caps_get_structure (caps, 0);
 
   /* accept upstream info if provided */
@@ -1881,9 +2115,43 @@
   /* get upstream format and align from caps */
   gst_h264_parse_format_from_caps (caps, &format, &align);
 
-  /* packetized video has a codec_data */
-  if (format != GST_H264_PARSE_FORMAT_BYTE &&
-      (value = gst_structure_get_value (str, "codec_data"))) {
+  codec_data_value = gst_structure_get_value (str, "codec_data");
+
+  /* fix up caps without stream-format for max. backwards compatibility */
+  if (format == GST_H264_PARSE_FORMAT_NONE) {
+    /* codec_data implies avc */
+    if (codec_data_value != NULL) {
+      GST_ERROR ("video/x-h264 caps with codec_data but no stream-format=avc");
+      format = GST_H264_PARSE_FORMAT_AVC;
+    } else {
+      /* otherwise assume bytestream input */
+      GST_ERROR ("video/x-h264 caps without codec_data or stream-format");
+      format = GST_H264_PARSE_FORMAT_BYTE;
+    }
+  }
+
+  /* avc caps sanity checks */
+  if (format == GST_H264_PARSE_FORMAT_AVC) {
+    /* AVC requires codec_data, AVC3 might have one and/or SPS/PPS inline */
+    if (codec_data_value == NULL)
+      goto avc_caps_codec_data_missing;
+
+    /* AVC implies alignment=au, everything else is not allowed */
+    if (align == GST_H264_PARSE_ALIGN_NONE)
+      align = GST_H264_PARSE_ALIGN_AU;
+    else if (align != GST_H264_PARSE_ALIGN_AU)
+      goto avc_caps_wrong_alignment;
+  }
+
+  /* bytestream caps sanity checks */
+  if (format == GST_H264_PARSE_FORMAT_BYTE) {
+    /* should have SPS/PSS in-band (and/or oob in streamheader field) */
+    if (codec_data_value != NULL)
+      goto bytestream_caps_with_codec_data;
+  }
+
+  /* packetized video has codec_data (required for AVC, optional for AVC3) */
+  if (codec_data_value != NULL) {
     GstMapInfo map;
     guint8 *data;
     guint num_sps, num_pps;
@@ -1896,9 +2164,13 @@
     /* make note for optional split processing */
     h264parse->packetized = TRUE;
 
-    codec_data = gst_value_get_buffer (value);
+    /* codec_data field should hold a buffer */
+    if (!GST_VALUE_HOLDS_BUFFER (codec_data_value))
+      goto avc_caps_codec_data_wrong_type;
+
+    codec_data = gst_value_get_buffer (codec_data_value);
     if (!codec_data)
-      goto wrong_type;
+      goto avc_caps_codec_data_missing;
     gst_buffer_map (codec_data, &map, GST_MAP_READ);
     data = map.data;
     size = map.size;
@@ -1960,14 +2232,7 @@
     gst_buffer_unmap (codec_data, &map);
 
     gst_buffer_replace (&h264parse->codec_data_in, codec_data);
-
-    /* if upstream sets codec_data without setting stream-format and alignment, we
-     * assume stream-format=avc,alignment=au */
-    if (format == GST_H264_PARSE_FORMAT_NONE)
-      format = GST_H264_PARSE_FORMAT_AVC;
-    if (align == GST_H264_PARSE_ALIGN_NONE)
-      align = GST_H264_PARSE_ALIGN_AU;
-  } else {
+  } else if (format == GST_H264_PARSE_FORMAT_BYTE) {
     GST_DEBUG_OBJECT (h264parse, "have bytestream h264");
     /* nothing to pre-process */
     h264parse->packetized = FALSE;
@@ -1978,6 +2243,8 @@
       format = GST_H264_PARSE_FORMAT_BYTE;
       align = GST_H264_PARSE_ALIGN_AU;
     }
+  } else {
+    /* probably AVC3 without codec_data field, anything to do here? */
   }
 
   {
@@ -2019,6 +2286,27 @@
   return TRUE;
 
   /* ERRORS */
+avc_caps_codec_data_wrong_type:
+  {
+    GST_WARNING_OBJECT (parse, "H.264 AVC caps, codec_data field not a buffer");
+    goto refuse_caps;
+  }
+avc_caps_codec_data_missing:
+  {
+    GST_WARNING_OBJECT (parse, "H.264 AVC caps, but no codec_data");
+    goto refuse_caps;
+  }
+avc_caps_wrong_alignment:
+  {
+    GST_WARNING_OBJECT (parse, "H.264 AVC caps with NAL alignment, must be AU");
+    goto refuse_caps;
+  }
+bytestream_caps_with_codec_data:
+  {
+    GST_WARNING_OBJECT (parse, "H.264 bytestream caps with codec_data is not "
+        "expected, send SPS/PPS in-band with data or in streamheader field");
+    goto refuse_caps;
+  }
 avcc_too_small:
   {
     GST_DEBUG_OBJECT (h264parse, "avcC size %" G_GSIZE_FORMAT " < 8", size);
@@ -2029,11 +2317,6 @@
     GST_DEBUG_OBJECT (h264parse, "wrong avcC version");
     goto refuse_caps;
   }
-wrong_type:
-  {
-    GST_DEBUG_OBJECT (h264parse, "wrong codec-data type");
-    goto refuse_caps;
-  }
 refuse_caps:
   {
     GST_WARNING_OBJECT (h264parse, "refused caps %" GST_PTR_FORMAT, caps);
@@ -2147,6 +2430,8 @@
               || segment->applied_rate != 1.0))
         h264parse->do_ts = FALSE;
 
+      h264parse->last_report = GST_CLOCK_TIME_NONE;
+
       res = GST_BASE_PARSE_CLASS (parent_class)->sink_event (parse, event);
       break;
     }
diff --git a/gst/videoparsers/gsth264parse.h b/gst/videoparsers/gsth264parse.h
index c9d188b..e056ca2 100644
--- a/gst/videoparsers/gsth264parse.h
+++ b/gst/videoparsers/gsth264parse.h
@@ -109,6 +109,7 @@
   gboolean update_caps;
   GstAdapter *frame_out;
   gboolean keyframe;
+  gboolean header;
   gboolean frame_start;
   /* AU state */
   gboolean picture_start;
diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c
index 9a98dcc..2d7b997 100644
--- a/gst/videoparsers/gsth265parse.c
+++ b/gst/videoparsers/gsth265parse.c
@@ -168,6 +168,7 @@
   h265parse->idr_pos = -1;
   h265parse->sei_pos = -1;
   h265parse->keyframe = FALSE;
+  h265parse->header = FALSE;
   gst_adapter_clear (h265parse->frame_out);
 }
 
@@ -419,6 +420,10 @@
   buf = gst_buffer_new_allocate (NULL, size, NULL);
   gst_buffer_fill (buf, 0, nalu->data + nalu->offset, size);
 
+  /* Indicate that buffer contain a header needed for decoding */
+  if (naltype >= GST_H265_NAL_VPS && naltype <= GST_H265_NAL_PPS)
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
+
   if (store[id])
     gst_buffer_unref (store[id]);
 
@@ -524,6 +529,7 @@
       }
 
       gst_h265_parser_store_nal (h265parse, vps.id, nal_type, nalu);
+      h265parse->header |= TRUE;
       break;
     case GST_H265_NAL_SPS:
       pres = gst_h265_parser_parse_sps (nalparser, nalu, &sps, TRUE);
@@ -546,6 +552,7 @@
       }
 
       gst_h265_parser_store_nal (h265parse, sps.id, nal_type, nalu);
+      h265parse->header |= TRUE;
       break;
     case GST_H265_NAL_PPS:
       pres = gst_h265_parser_parse_pps (nalparser, nalu, &pps);
@@ -571,6 +578,7 @@
       }
 
       gst_h265_parser_store_nal (h265parse, pps.id, nal_type, nalu);
+      h265parse->header |= TRUE;
       break;
     case GST_H265_NAL_PREFIX_SEI:
     case GST_H265_NAL_SUFFIX_SEI:
@@ -866,7 +874,6 @@
       case GST_H265_PARSER_NO_NAL:
         *skipsize = size - 3;
         goto skip;
-        break;
       default:
         g_assert_not_reached ();
         break;
@@ -930,7 +937,6 @@
           nalu.offset = nalu.sc_offset;
           goto end;
         }
-        break;
       default:
         g_assert_not_reached ();
         break;
@@ -1409,6 +1415,11 @@
   else
     GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
 
+  if (h265parse->header)
+    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_HEADER);
+  else
+    GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_HEADER);
+
   /* replace with transformed HEVC output if applicable */
   av = gst_adapter_available (h265parse->frame_out);
   if (av) {
diff --git a/gst/videoparsers/gsth265parse.h b/gst/videoparsers/gsth265parse.h
index 7e07a60..91e84ab 100644
--- a/gst/videoparsers/gsth265parse.h
+++ b/gst/videoparsers/gsth265parse.h
@@ -83,6 +83,7 @@
   gboolean update_caps;
   GstAdapter *frame_out;
   gboolean keyframe;
+  gboolean header;
   /* AU state */
   gboolean picture_start;
 
diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c
index 1afaa17..a169363 100644
--- a/gst/videoparsers/gstmpeg4videoparse.c
+++ b/gst/videoparsers/gstmpeg4videoparse.c
@@ -509,7 +509,6 @@
         mp4vparse->last_sc = size - 3;
       }
       goto out;
-      break;
     default:
       /* decide whether this startcode ends a frame */
       ret = gst_mpeg4vparse_process_sc (mp4vparse, &packet, size);
diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c
index dadab94..dd57e93 100644
--- a/gst/videoparsers/gstmpegvideoparse.c
+++ b/gst/videoparsers/gstmpegvideoparse.c
@@ -575,8 +575,8 @@
 }
 
 /* FIXME move into baseparse, or anything equivalent;
- * see https://bugzilla.gnome.org/show_bug.cgi?id=650093 */
-#define GST_BASE_PARSE_FRAME_FLAG_PARSING   0x10000
+ * see https://bugzilla.gnome.org/show_bug.cgi?id=650093
+ * #define GST_BASE_PARSE_FRAME_FLAG_PARSING   0x100000 */
 
 static inline void
 update_frame_parsing_status (GstMpegvParse * mpvparse,
@@ -619,7 +619,7 @@
 
   /* if already found a previous start code, e.g. start of frame, go for next */
   if (mpvparse->last_sc >= 0) {
-    off = packet.offset = mpvparse->last_sc;
+    packet.offset = mpvparse->last_sc;
     packet.size = 0;
     goto next;
   }
diff --git a/gst/videoparsers/gstpngparse.c b/gst/videoparsers/gstpngparse.c
index efd62a6..d266bd3 100644
--- a/gst/videoparsers/gstpngparse.c
+++ b/gst/videoparsers/gstpngparse.c
@@ -49,6 +49,7 @@
 G_DEFINE_TYPE (GstPngParse, gst_png_parse, GST_TYPE_BASE_PARSE);
 
 static gboolean gst_png_parse_start (GstBaseParse * parse);
+static gboolean gst_png_parse_event (GstBaseParse * parse, GstEvent * event);
 static GstFlowReturn gst_png_parse_handle_frame (GstBaseParse * parse,
     GstBaseParseFrame * frame, gint * skipsize);
 static GstFlowReturn gst_png_parse_pre_push_frame (GstBaseParse * parse,
@@ -72,6 +73,7 @@
 
   /* Override BaseParse vfuncs */
   parse_class->start = GST_DEBUG_FUNCPTR (gst_png_parse_start);
+  parse_class->sink_event = GST_DEBUG_FUNCPTR (gst_png_parse_event);
   parse_class->handle_frame = GST_DEBUG_FUNCPTR (gst_png_parse_handle_frame);
   parse_class->pre_push_frame =
       GST_DEBUG_FUNCPTR (gst_png_parse_pre_push_frame);
@@ -100,6 +102,24 @@
   return TRUE;
 }
 
+static gboolean
+gst_png_parse_event (GstBaseParse * parse, GstEvent * event)
+{
+  gboolean res;
+
+  res = GST_BASE_PARSE_CLASS (parent_class)->sink_event (parse, event);
+
+  switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_FLUSH_STOP:
+      /* the start code and at least 2 empty frames (IHDR and IEND) */
+      gst_base_parse_set_min_frame_size (parse, 8 + 12 + 12);
+      break;
+    default:
+      break;
+  }
+
+  return res;
+}
 
 static GstFlowReturn
 gst_png_parse_handle_frame (GstBaseParse * parse,
@@ -155,18 +175,27 @@
     if (!gst_byte_reader_get_uint32_le (&reader, &code))
       goto beach;
 
+    GST_TRACE_OBJECT (parse, "%" GST_FOURCC_FORMAT " chunk, %u bytes",
+        GST_FOURCC_ARGS (code), length);
+
     if (code == GST_MAKE_FOURCC ('I', 'H', 'D', 'R')) {
       if (!gst_byte_reader_get_uint32_be (&reader, &width))
         goto beach;
       if (!gst_byte_reader_get_uint32_be (&reader, &height))
         goto beach;
       length -= 8;
+    } else if (code == GST_MAKE_FOURCC ('I', 'D', 'A', 'T')) {
+      gst_base_parse_set_min_frame_size (parse,
+          gst_byte_reader_get_pos (&reader) + 4 + length + 12);
     }
 
     if (!gst_byte_reader_skip (&reader, length + 4))
       goto beach;
 
     if (code == GST_MAKE_FOURCC ('I', 'E', 'N', 'D')) {
+      /* the start code and at least 2 empty frames (IHDR and IEND) */
+      gst_base_parse_set_min_frame_size (parse, 8 + 12 + 12);
+
       if (pngparse->width != width || pngparse->height != height) {
         GstCaps *caps, *sink_caps;
 
diff --git a/gst/videoparsers/gstvc1parse.c b/gst/videoparsers/gstvc1parse.c
index 02e2d0f..7c2608b 100644
--- a/gst/videoparsers/gstvc1parse.c
+++ b/gst/videoparsers/gstvc1parse.c
@@ -287,6 +287,9 @@
   gst_buffer_replace (&vc1parse->seq_layer_buffer, NULL);
   gst_buffer_replace (&vc1parse->seq_hdr_buffer, NULL);
   gst_buffer_replace (&vc1parse->entrypoint_buffer, NULL);
+
+  vc1parse->seq_layer_sent = FALSE;
+  vc1parse->frame_layer_first_frame_sent = FALSE;
 }
 
 static gboolean
@@ -314,6 +317,160 @@
 }
 
 static gboolean
+gst_vc1_parse_is_format_allowed (GstVC1Parse * vc1parse)
+{
+  if (vc1parse->profile == GST_VC1_PROFILE_ADVANCED &&
+      vc1parse->output_stream_format ==
+      VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME) {
+    GST_ERROR_OBJECT (vc1parse,
+        "sequence-layer-raw-frame is not allowed in advanced profile");
+    return FALSE;
+  } else if (vc1parse->profile == GST_VC1_PROFILE_SIMPLE &&
+      (vc1parse->output_stream_format == VC1_STREAM_FORMAT_BDU ||
+          vc1parse->output_stream_format == VC1_STREAM_FORMAT_BDU_FRAME ||
+          vc1parse->output_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU ||
+          vc1parse->output_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME)) {
+    GST_ERROR_OBJECT (vc1parse,
+        "output stream-format not allowed in simple profile");
+    return FALSE;
+  }
+
+  GST_DEBUG_OBJECT (vc1parse, "check output header-format");
+  switch (vc1parse->output_header_format) {
+    case VC1_HEADER_FORMAT_ASF:
+    case VC1_HEADER_FORMAT_SEQUENCE_LAYER:
+      /* Doesn't make sense to have sequence-layer-* stream-format */
+      if (vc1parse->output_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU ||
+          vc1parse->output_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME ||
+          vc1parse->output_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME ||
+          vc1parse->output_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER)
+        return FALSE;
+      break;
+    case VC1_HEADER_FORMAT_NONE:
+      /* In simple/main profile, there is no sequence header BDU */
+      if (vc1parse->profile != GST_VC1_PROFILE_ADVANCED &&
+          (vc1parse->output_stream_format == VC1_STREAM_FORMAT_BDU ||
+              vc1parse->output_stream_format == VC1_STREAM_FORMAT_BDU_FRAME ||
+              vc1parse->output_stream_format == VC1_STREAM_FORMAT_FRAME_LAYER))
+        return FALSE;
+
+      /* ASF stream-format doesn't carry sequence header */
+      if (vc1parse->output_stream_format == VC1_STREAM_FORMAT_ASF)
+        return FALSE;
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+
+  if (vc1parse->output_stream_format == vc1parse->input_stream_format)
+    return TRUE;
+
+  GST_DEBUG_OBJECT (vc1parse, "check stream-format conversion");
+  switch (vc1parse->output_stream_format) {
+    case VC1_STREAM_FORMAT_BDU:
+      if (vc1parse->input_stream_format == VC1_STREAM_FORMAT_BDU_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_FRAME_LAYER)
+        goto conversion_not_supported;
+      break;
+
+    case VC1_STREAM_FORMAT_BDU_FRAME:
+      if (vc1parse->input_stream_format == VC1_STREAM_FORMAT_BDU ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_ASF ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_FRAME_LAYER)
+        goto conversion_not_supported;
+
+      if (vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME)
+        return FALSE;
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+      if (vc1parse->input_stream_format == VC1_STREAM_FORMAT_BDU_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_FRAME_LAYER)
+        goto conversion_not_supported;
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+      if (vc1parse->input_stream_format == VC1_STREAM_FORMAT_BDU ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_ASF ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_FRAME_LAYER)
+        goto conversion_not_supported;
+
+      if (vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME)
+        return FALSE;
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+      if (vc1parse->input_stream_format == VC1_STREAM_FORMAT_BDU ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_BDU_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME ||
+          vc1parse->input_stream_format ==
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER ||
+          vc1parse->input_stream_format == VC1_STREAM_FORMAT_FRAME_LAYER)
+        goto conversion_not_supported;
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+      if (vc1parse->input_stream_format != VC1_STREAM_FORMAT_FRAME_LAYER &&
+          vc1parse->input_stream_format != VC1_STREAM_FORMAT_ASF)
+        goto conversion_not_supported;
+      break;
+
+    case VC1_STREAM_FORMAT_ASF:
+      goto conversion_not_supported;
+      break;
+
+    case VC1_STREAM_FORMAT_FRAME_LAYER:
+      if (vc1parse->input_stream_format !=
+          VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER &&
+          vc1parse->input_stream_format != VC1_STREAM_FORMAT_ASF)
+        goto conversion_not_supported;
+      break;
+
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+
+  return TRUE;
+
+conversion_not_supported:
+  GST_ERROR_OBJECT (vc1parse, "stream conversion not implemented yet");
+  return FALSE;
+}
+
+static gboolean
 gst_vc1_parse_renegotiate (GstVC1Parse * vc1parse)
 {
   GstCaps *in_caps;
@@ -390,6 +547,10 @@
 
   if (allowed_caps)
     gst_caps_unref (allowed_caps);
+
+  if (!gst_vc1_parse_is_format_allowed (vc1parse))
+    return FALSE;
+
   vc1parse->renegotiate = FALSE;
   vc1parse->update_caps = TRUE;
 
@@ -606,6 +767,99 @@
   }
 }
 
+static GstBuffer *
+gst_vc1_parse_make_sequence_layer (GstVC1Parse * vc1parse)
+{
+  GstBuffer *seq_layer_buffer;
+  guint8 *data;
+  guint32 structC = 0;
+  GstMapInfo minfo;
+
+  seq_layer_buffer = gst_buffer_new_and_alloc (36);
+  gst_buffer_map (seq_layer_buffer, &minfo, GST_MAP_WRITE);
+
+  data = minfo.data;
+  /* According to SMPTE 421M Annex L, the sequence layer shall be
+   * represented as a sequence of 32 bit unsigned integers and each
+   * integers should be serialized in little-endian byte-order except for
+   * STRUCT_C which should be serialized in big-endian byte-order. */
+
+  /* Unknown number of frames and start code */
+  data[0] = 0xff;
+  data[1] = 0xff;
+  data[2] = 0xff;
+  data[3] = 0xc5;
+
+  /* 0x00000004 */
+  GST_WRITE_UINT32_LE (data + 4, 4);
+
+  /* structC */
+  structC |= (vc1parse->profile << 30);
+  if (vc1parse->profile != GST_VC1_PROFILE_ADVANCED) {
+    /* Build simple/main structC from sequence header */
+    structC |= (vc1parse->seq_hdr.struct_c.wmvp << 28);
+    structC |= (vc1parse->seq_hdr.struct_c.frmrtq_postproc << 25);
+    structC |= (vc1parse->seq_hdr.struct_c.bitrtq_postproc << 20);
+    structC |= (vc1parse->seq_hdr.struct_c.loop_filter << 19);
+    /* Reserved3 shall be set to zero */
+    structC |= (vc1parse->seq_hdr.struct_c.multires << 17);
+    /* Reserved4 shall be set to one */
+    structC |= (1 << 16);
+    structC |= (vc1parse->seq_hdr.struct_c.fastuvmc << 15);
+    structC |= (vc1parse->seq_hdr.struct_c.extended_mv << 14);
+    structC |= (vc1parse->seq_hdr.struct_c.dquant << 12);
+    structC |= (vc1parse->seq_hdr.struct_c.vstransform << 11);
+    /* Reserved5 shall be set to zero */
+    structC |= (vc1parse->seq_hdr.struct_c.overlap << 9);
+    structC |= (vc1parse->seq_hdr.struct_c.syncmarker << 8);
+    structC |= (vc1parse->seq_hdr.struct_c.rangered << 7);
+    structC |= (vc1parse->seq_hdr.struct_c.maxbframes << 4);
+    structC |= (vc1parse->seq_hdr.struct_c.quantizer << 2);
+    structC |= (vc1parse->seq_hdr.struct_c.finterpflag << 1);
+    /* Reserved6 shall be set to one */
+    structC |= 1;
+  }
+  GST_WRITE_UINT32_BE (data + 8, structC);
+
+  /* structA */
+  if (vc1parse->profile != GST_VC1_PROFILE_ADVANCED) {
+    GST_WRITE_UINT32_LE (data + 12, vc1parse->height);
+    GST_WRITE_UINT32_LE (data + 16, vc1parse->width);
+  } else {
+    GST_WRITE_UINT32_LE (data + 12, 0);
+    GST_WRITE_UINT32_LE (data + 16, 0);
+  }
+
+  /* 0x0000000c */
+  GST_WRITE_UINT32_LE (data + 20, 0x0000000c);
+
+  /* structB */
+  /* Unknown HRD_BUFFER */
+  GST_WRITE_UINT24_LE (data + 24, 0);
+  if ((gint) vc1parse->level != -1)
+    data[27] = (vc1parse->level << 5);
+  else
+    data[27] = (0x4 << 5);      /* Use HIGH level */
+  /* Unknown HRD_RATE */
+  GST_WRITE_UINT32_LE (data + 28, 0);
+  /* Framerate */
+  if (vc1parse->fps_d == 0) {
+    /* If not known, it seems we need to put in the maximum framerate
+       possible for the profile/level used (this is for RTP
+       (https://tools.ietf.org/html/draft-ietf-avt-rtp-vc1-06#section-6.1),
+       so likely elsewhere too */
+    GST_WRITE_UINT32_LE (data + 32, gst_vc1_parse_get_max_framerate (vc1parse));
+  } else {
+    GST_WRITE_UINT32_LE (data + 32,
+        ((guint32) (((gdouble) vc1parse->fps_n) /
+                ((gdouble) vc1parse->fps_d) + 0.5)));
+  }
+
+  gst_buffer_unmap (seq_layer_buffer, &minfo);
+
+  return seq_layer_buffer;
+}
+
 static gboolean
 gst_vc1_parse_update_caps (GstVC1Parse * vc1parse)
 {
@@ -795,90 +1049,9 @@
         gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER,
             vc1parse->seq_layer_buffer, NULL);
       } else {
-        GstBuffer *codec_data = gst_buffer_new_and_alloc (36);
-        guint8 *data;
-        guint32 structC = 0;
-        GstMapInfo minfo;
+        GstBuffer *codec_data;
 
-        gst_buffer_map (codec_data, &minfo, GST_MAP_WRITE);
-
-        data = minfo.data;
-        /* According to SMPTE 421M Annex L, the sequence layer shall be
-         * represented as a sequence of 32 bit unsigned integers and each
-         * integers should be serialized in little-endian byte-order except for
-         * STRUCT_C which should be serialized in big-endian byte-order. */
-
-        /* Unknown number of frames and start code */
-        data[0] = 0xff;
-        data[1] = 0xff;
-        data[2] = 0xff;
-        data[3] = 0xc5;
-
-        /* 0x00000004 */
-        GST_WRITE_UINT32_LE (data + 4, 4);
-
-        /* structC */
-        structC |= (vc1parse->profile << 30);
-        if (vc1parse->profile != GST_VC1_PROFILE_ADVANCED) {
-          structC |= (vc1parse->seq_layer.struct_c.wmvp << 28);
-          structC |= (vc1parse->seq_layer.struct_c.frmrtq_postproc << 25);
-          structC |= (vc1parse->seq_layer.struct_c.bitrtq_postproc << 20);
-          structC |= (vc1parse->seq_layer.struct_c.loop_filter << 19);
-          /* Reserved3 shall be set to zero */
-          structC |= (vc1parse->seq_layer.struct_c.multires << 17);
-          /* Reserved4 shall be set to one */
-          structC |= (1 << 16);
-          structC |= (vc1parse->seq_layer.struct_c.fastuvmc << 15);
-          structC |= (vc1parse->seq_layer.struct_c.extended_mv << 14);
-          structC |= (vc1parse->seq_layer.struct_c.dquant << 12);
-          structC |= (vc1parse->seq_layer.struct_c.vstransform << 11);
-          /* Reserved5 shall be set to zero */
-          structC |= (vc1parse->seq_layer.struct_c.overlap << 9);
-          structC |= (vc1parse->seq_layer.struct_c.syncmarker << 8);
-          structC |= (vc1parse->seq_layer.struct_c.rangered << 7);
-          structC |= (vc1parse->seq_layer.struct_c.maxbframes << 4);
-          structC |= (vc1parse->seq_layer.struct_c.quantizer << 2);
-          structC |= (vc1parse->seq_layer.struct_c.finterpflag << 1);
-          /* Reserved6 shall be set to one */
-          structC |= 1;
-        }
-        GST_WRITE_UINT32_BE (data + 8, structC);
-
-        /* structA */
-        if (vc1parse->profile != GST_VC1_PROFILE_ADVANCED) {
-          GST_WRITE_UINT32_LE (data + 12, vc1parse->height);
-          GST_WRITE_UINT32_LE (data + 16, vc1parse->width);
-        } else {
-          GST_WRITE_UINT32_LE (data + 12, 0);
-          GST_WRITE_UINT32_LE (data + 16, 0);
-        }
-
-        /* 0x0000000c */
-        GST_WRITE_UINT32_LE (data + 20, 0x0000000c);
-
-        /* structB */
-        /* Unknown HRD_BUFFER */
-        GST_WRITE_UINT24_LE (data + 24, 0);
-        if ((gint) vc1parse->level != -1)
-          data[27] = (vc1parse->level << 5);
-        else
-          data[27] = (0x4 << 5);        /* Use HIGH level */
-        /* Unknown HRD_RATE */
-        GST_WRITE_UINT32_LE (data + 28, 0);
-        /* Framerate */
-        if (vc1parse->fps_d == 0) {
-          /* If not known, it seems we need to put in the maximum framerate
-             possible for the profile/level used (this is for RTP
-             (https://tools.ietf.org/html/draft-ietf-avt-rtp-vc1-06#section-6.1),
-             so likely elsewhere too */
-          GST_WRITE_UINT32_LE (data + 32,
-              gst_vc1_parse_get_max_framerate (vc1parse));
-        } else {
-          GST_WRITE_UINT32_LE (data + 32,
-              ((guint32) (((gdouble) vc1parse->fps_n) /
-                      ((gdouble) vc1parse->fps_d) + 0.5)));
-        }
-        gst_buffer_unmap (codec_data, &minfo);
+        codec_data = gst_vc1_parse_make_sequence_layer (vc1parse);
 
         gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, codec_data,
             NULL);
@@ -1370,9 +1543,165 @@
 }
 
 static GstFlowReturn
+gst_vc1_parse_push_sequence_layer (GstVC1Parse * vc1parse)
+{
+  GstBuffer *seq_layer;
+
+  if ((seq_layer = vc1parse->seq_layer_buffer))
+    gst_buffer_ref (seq_layer);
+  else
+    seq_layer = gst_vc1_parse_make_sequence_layer (vc1parse);
+
+  return gst_pad_push (GST_BASE_PARSE_SRC_PAD (vc1parse), seq_layer);
+}
+
+static GstFlowReturn
+gst_vc1_parse_convert_asf_to_bdu (GstVC1Parse * vc1parse,
+    GstBaseParseFrame * frame)
+{
+  GstByteWriter bw;
+  GstBuffer *buffer;
+  GstBuffer *tmp;
+  GstMemory *mem;
+  guint8 sc_data[4];
+  guint32 startcode;
+  gboolean ok;
+  GstFlowReturn ret = GST_FLOW_OK;
+
+  buffer = frame->buffer;
+
+  /* Simple profile doesn't have start codes so bdu format is not possible */
+  if (vc1parse->profile == GST_VC1_PROFILE_SIMPLE) {
+    GST_ERROR_OBJECT (vc1parse, "can't convert to bdu in simple profile");
+    ret = GST_FLOW_NOT_NEGOTIATED;
+    goto done;
+  }
+
+  /* ASF frame could have a start code at the beginning or not. So we first
+   * check for a start code if we have at least 4 bytes in the buffer. */
+  if (gst_buffer_extract (buffer, 0, sc_data, 4) == 4) {
+    startcode = GST_READ_UINT32_BE (sc_data);
+    if (((startcode & 0xffffff00) == 0x00000100)) {
+      /* Start code found */
+      goto done;
+    }
+  }
+
+  /* Yes, a frame could be smaller than 4 bytes and valid, for instance
+   * black video. */
+
+  /* We will prepend 4 bytes to buffer */
+  gst_byte_writer_init_with_size (&bw, 4, TRUE);
+
+  /* Set start code and suffixe, we assume raw asf data is a frame */
+  ok = gst_byte_writer_put_uint24_be (&bw, 0x000001);
+  ok &= gst_byte_writer_put_uint8 (&bw, 0x0D);
+  tmp = gst_byte_writer_reset_and_get_buffer (&bw);
+
+  /* Prepend startcode buffer to frame buffer */
+  mem = gst_buffer_get_all_memory (tmp);
+  gst_buffer_prepend_memory (buffer, mem);
+  gst_buffer_unref (tmp);
+
+  if (G_UNLIKELY (!ok)) {
+    GST_ERROR_OBJECT (vc1parse, "convert asf to bdu failed");
+    ret = GST_FLOW_ERROR;
+  }
+
+done:
+  return ret;
+}
+
+static GstFlowReturn
+gst_vc1_parse_convert_to_frame_layer (GstVC1Parse * vc1parse,
+    GstBaseParseFrame * frame)
+{
+  GstByteWriter bw;
+  GstBuffer *buffer;
+  GstBuffer *frame_layer;
+  gsize frame_layer_size;
+  GstMemory *mem;
+  gboolean ok;
+  gboolean keyframe;
+  guint8 sc_data[4];
+  guint32 startcode;
+
+  buffer = frame->buffer;
+  keyframe = !(GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT));
+
+  /* We need 8 bytes for frame-layer header */
+  frame_layer_size = 8;
+  if (vc1parse->profile == GST_VC1_PROFILE_ADVANCED) {
+    if (!vc1parse->frame_layer_first_frame_sent) {
+      /* First frame should contain sequence-header, entry-point and frame */
+      frame_layer_size += 4 + gst_buffer_get_size (vc1parse->seq_hdr_buffer)
+          + 4 + gst_buffer_get_size (vc1parse->entrypoint_buffer) + 4;
+    } else if (keyframe) {
+      /* Keyframe should contain entry point */
+      frame_layer_size += 4 +
+          gst_buffer_get_size (vc1parse->entrypoint_buffer) + 4;
+    }
+  }
+
+  gst_byte_writer_init_with_size (&bw, frame_layer_size, TRUE);
+
+  /* frame-layer header shall be serialized in little-endian byte order */
+  ok = gst_byte_writer_put_uint24_le (&bw, gst_buffer_get_size (buffer));
+
+  if (keyframe)
+    ok &= gst_byte_writer_put_uint8 (&bw, 0x80);        /* keyframe */
+  else
+    ok &= gst_byte_writer_put_uint8 (&bw, 0x00);
+
+  ok &= gst_byte_writer_put_uint32_le (&bw, GST_BUFFER_PTS (buffer));
+
+  if (vc1parse->profile != GST_VC1_PROFILE_ADVANCED)
+    goto headers_done;
+
+  if (!vc1parse->frame_layer_first_frame_sent) {
+    /* Write sequence-header start code, sequence-header entrypoint startcode
+     * and entrypoint */
+    ok &= gst_byte_writer_put_uint32_be (&bw, 0x0000010f);
+    ok &= gst_byte_writer_put_buffer (&bw, vc1parse->seq_hdr_buffer, 0, -1);
+    ok &= gst_byte_writer_put_uint32_be (&bw, 0x0000010e);
+    ok &= gst_byte_writer_put_buffer (&bw, vc1parse->entrypoint_buffer, 0, -1);
+  } else if (keyframe) {
+    /* Write entrypoint startcode and entrypoint */
+    ok &= gst_byte_writer_put_uint32_be (&bw, 0x0000010e);
+    ok &= gst_byte_writer_put_buffer (&bw, vc1parse->entrypoint_buffer, 0, -1);
+  }
+
+  /* frame can begin with startcode, in this case, don't prepend it */
+  if (gst_buffer_extract (buffer, 0, sc_data, 4) == 4) {
+    startcode = GST_READ_UINT32_BE (sc_data);
+    if (((startcode & 0xffffff00) == 0x00000100)) {
+      /* Start code found */
+      goto headers_done;
+    }
+  }
+
+  ok &= gst_byte_writer_put_uint32_be (&bw, 0x0000010d);
+
+headers_done:
+  frame_layer = gst_byte_writer_reset_and_get_buffer (&bw);
+  mem = gst_buffer_get_all_memory (frame_layer);
+  gst_buffer_prepend_memory (buffer, mem);
+  gst_buffer_unref (frame_layer);
+
+  if (G_UNLIKELY (!ok)) {
+    GST_ERROR_OBJECT (vc1parse, "failed to convert to frame layer");
+    return GST_FLOW_ERROR;
+  }
+
+  vc1parse->frame_layer_first_frame_sent = TRUE;
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
 gst_vc1_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
 {
   GstVC1Parse *vc1parse = GST_VC1_PARSE (parse);
+  GstFlowReturn ret = GST_FLOW_OK;
 
   if (!vc1parse->sent_codec_tag) {
     GstTagList *taglist;
@@ -1393,13 +1722,289 @@
     vc1parse->sent_codec_tag = TRUE;
   }
 
-  if (vc1parse->input_header_format != vc1parse->output_header_format ||
-      vc1parse->input_stream_format != vc1parse->output_stream_format) {
-    GST_WARNING_OBJECT (vc1parse, "stream conversion not implemented yet");
-    return GST_FLOW_ERROR;
+  /* Nothing to do here */
+  if (vc1parse->input_stream_format == vc1parse->output_stream_format)
+    return GST_FLOW_OK;
+
+  switch (vc1parse->output_stream_format) {
+    case VC1_STREAM_FORMAT_BDU:
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+          g_assert_not_reached ();
+          break;
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+          /* We just need to drop sequence-layer buffer */
+          if (frame->flags & GST_BASE_PARSE_FRAME_FLAG_NO_FRAME) {
+            ret = GST_BASE_PARSE_FLOW_DROPPED;
+          }
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_ASF:
+          ret = gst_vc1_parse_convert_asf_to_bdu (vc1parse, frame);
+          break;
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+      break;
+
+    case VC1_STREAM_FORMAT_BDU_FRAME:
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+          g_assert_not_reached ();
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+          /* We just need to drop sequence-layer buffer */
+          if (frame->flags & GST_BASE_PARSE_FRAME_FLAG_NO_FRAME) {
+            ret = GST_BASE_PARSE_FLOW_DROPPED;
+          }
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+        case VC1_STREAM_FORMAT_ASF:
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+          /* We just need to send the sequence-layer first */
+          if (!vc1parse->seq_layer_sent) {
+            ret = gst_vc1_parse_push_sequence_layer (vc1parse);
+            if (ret != GST_FLOW_OK) {
+              GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
+              break;
+            }
+            vc1parse->seq_layer_sent = TRUE;
+          }
+          break;
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+          g_assert_not_reached ();
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_ASF:
+          /* We just need to send the sequence-layer first */
+          if (!vc1parse->seq_layer_sent) {
+            ret = gst_vc1_parse_push_sequence_layer (vc1parse);
+            if (ret != GST_FLOW_OK) {
+              GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
+              break;
+            }
+            vc1parse->seq_layer_sent = TRUE;
+          }
+          /* FIXME: We may only authorize this when header-format is set to
+           * none and we should add the entrypoint for advanced profile. */
+          ret = gst_vc1_parse_convert_asf_to_bdu (vc1parse, frame);
+          break;
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+          /* We just need to send the sequence-layer first */
+          if (!vc1parse->seq_layer_sent) {
+            ret = gst_vc1_parse_push_sequence_layer (vc1parse);
+            if (ret != GST_FLOW_OK) {
+              GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
+              break;
+            }
+            vc1parse->seq_layer_sent = TRUE;
+          }
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+          g_assert_not_reached ();
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+        case VC1_STREAM_FORMAT_ASF:
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+      if (vc1parse->profile != GST_VC1_PROFILE_SIMPLE &&
+          vc1parse->profile != GST_VC1_PROFILE_MAIN) {
+        GST_ERROR_OBJECT (vc1parse,
+            "sequence-layer-raw-frame is only for simple/main profile");
+        goto conversion_not_supported;
+      }
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+          g_assert_not_reached ();
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+          goto conversion_not_supported;
+        case VC1_STREAM_FORMAT_ASF:
+          /* ASF contains raw frame for simple/main profile, so we just
+           * have to send sequence-layer before frames */
+          if (!vc1parse->seq_layer_sent) {
+            ret = gst_vc1_parse_push_sequence_layer (vc1parse);
+            if (ret != GST_FLOW_OK) {
+              GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
+              break;
+            }
+            vc1parse->seq_layer_sent = TRUE;
+          }
+          break;
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+      break;
+
+    case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+          g_assert_not_reached ();
+          break;
+        case VC1_STREAM_FORMAT_ASF:
+          /* Make sure we push the sequence layer */
+          if (!vc1parse->seq_layer_sent) {
+            ret = gst_vc1_parse_push_sequence_layer (vc1parse);
+            if (ret != GST_FLOW_OK) {
+              GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
+              break;
+            }
+            vc1parse->seq_layer_sent = TRUE;
+          }
+          ret = gst_vc1_parse_convert_to_frame_layer (vc1parse, frame);
+          break;
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+          /* We just need to send the sequence-layer first */
+          if (!vc1parse->seq_layer_sent) {
+            ret = gst_vc1_parse_push_sequence_layer (vc1parse);
+            if (ret != GST_FLOW_OK) {
+              GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
+              break;
+            }
+            vc1parse->seq_layer_sent = TRUE;
+          }
+          break;
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+      break;
+
+    case VC1_STREAM_FORMAT_ASF:
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_ASF:
+          g_assert_not_reached ();
+          break;
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+          goto conversion_not_supported;
+          break;
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+
+    case VC1_STREAM_FORMAT_FRAME_LAYER:
+      switch (vc1parse->input_stream_format) {
+        case VC1_STREAM_FORMAT_BDU:
+        case VC1_STREAM_FORMAT_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_RAW_FRAME:
+          goto conversion_not_supported;
+          break;
+        case VC1_STREAM_FORMAT_SEQUENCE_LAYER_FRAME_LAYER:
+          /* We just need to drop sequence-layer buffer */
+          if (frame->flags & GST_BASE_PARSE_FRAME_FLAG_NO_FRAME) {
+            ret = GST_BASE_PARSE_FLOW_DROPPED;
+          }
+          break;
+        case VC1_STREAM_FORMAT_ASF:
+          ret = gst_vc1_parse_convert_to_frame_layer (vc1parse, frame);
+          break;
+        case VC1_STREAM_FORMAT_FRAME_LAYER:
+        default:
+          g_assert_not_reached ();
+          break;
+      }
+      break;
+
+    default:
+      g_assert_not_reached ();
+      break;
   }
 
-  return GST_FLOW_OK;
+  return ret;
+
+conversion_not_supported:
+  GST_WARNING_OBJECT (vc1parse, "stream conversion not implemented yet");
+  return GST_FLOW_NOT_NEGOTIATED;
 }
 
 /* SMPTE 421M Table 7 */
diff --git a/gst/videoparsers/gstvc1parse.h b/gst/videoparsers/gstvc1parse.h
index 28c3c4f..037e5aa 100644
--- a/gst/videoparsers/gstvc1parse.h
+++ b/gst/videoparsers/gstvc1parse.h
@@ -61,8 +61,8 @@
 } GstVC1ParseFormat;
 
 /* FIXME move into baseparse, or anything equivalent;
- * see https://bugzilla.gnome.org/show_bug.cgi?id=650093 */
-#define GST_BASE_PARSE_FRAME_FLAG_PARSING   0x10000
+ * see https://bugzilla.gnome.org/show_bug.cgi?id=650093
+ * #define GST_BASE_PARSE_FRAME_FLAG_PARSING   0x100000 */
 
 typedef struct _GstVC1Parse GstVC1Parse;
 typedef struct _GstVC1ParseClass GstVC1ParseClass;
@@ -107,6 +107,14 @@
    * valid if the GstBaseParseFrame has the
    * GST_BASE_PARSE_FRAME_FLAG_PARSING flag */
   GstVC1StartCode startcode;
+
+  /* TRUE if we have already sent the sequence-layer,
+   * use for stream-format conversion */
+  gboolean seq_layer_sent;
+
+  /* TRUE if we have already sent the frame-layer first frame,
+   * use for stream-format conversion */
+  gboolean frame_layer_first_frame_sent;
 };
 
 struct _GstVC1ParseClass
diff --git a/gst/videosignal/Makefile.in b/gst/videosignal/Makefile.in
index 13797ee..df8f4aa 100644
--- a/gst/videosignal/Makefile.in
+++ b/gst/videosignal/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/videosignal/gstsimplevideomark.c b/gst/videosignal/gstsimplevideomark.c
index 85e719d..d62af9b 100644
--- a/gst/videosignal/gstsimplevideomark.c
+++ b/gst/videosignal/gstsimplevideomark.c
@@ -359,15 +359,13 @@
     return GST_FLOW_ERROR;
   }
 
+  d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
+  /* move to start of bottom left */
+  d += row_stride * (height - ph - simplevideomark->bottom_offset) +
+      pixel_stride * simplevideomark->left_offset;
+
   /* draw the bottom left pixels */
   for (i = 0; i < simplevideomark->pattern_count; i++) {
-    d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
-    /* move to start of bottom left */
-    d += row_stride * (height - ph - simplevideomark->bottom_offset) +
-        pixel_stride * simplevideomark->left_offset;
-    /* move to i-th pattern */
-    d += pixel_stride * pw * i;
-
     if (i & 1)
       /* odd pixels must be white */
       color = 255;
@@ -377,6 +375,9 @@
     /* draw box of width * height */
     gst_video_mark_draw_box (simplevideomark, d, pw, ph, row_stride,
         pixel_stride, color);
+
+    /* move to i-th pattern */
+    d += pixel_stride * pw;
   }
 
   pattern_shift =
@@ -384,15 +385,6 @@
 
   /* get the data of the pattern */
   for (i = 0; i < simplevideomark->pattern_data_count; i++) {
-    d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
-    /* move to start of bottom left, adjust for offsets */
-    d += row_stride * (height - ph - simplevideomark->bottom_offset) +
-        pixel_stride * simplevideomark->left_offset;
-    /* move after the fixed pattern */
-    d += pixel_stride * simplevideomark->pattern_count * pw;
-    /* move to i-th pattern data */
-    d += pixel_stride * pw * i;
-
     if (simplevideomark->pattern_data & pattern_shift)
       color = 255;
     else
@@ -402,6 +394,9 @@
         pixel_stride, color);
 
     pattern_shift >>= 1;
+
+    /* move to i-th pattern data */
+    d += pixel_stride * pw;
   }
 
   return GST_FLOW_OK;
diff --git a/gst/videosignal/gstsimplevideomarkdetect.c b/gst/videosignal/gstsimplevideomarkdetect.c
index fca367e..c04d90b 100644
--- a/gst/videosignal/gstsimplevideomarkdetect.c
+++ b/gst/videosignal/gstsimplevideomarkdetect.c
@@ -463,15 +463,13 @@
     goto no_pattern;
   }
 
+  d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
+  /* move to start of bottom left, adjust for offsets */
+  d += row_stride * (height - ph - simplevideomarkdetect->bottom_offset) +
+      pixel_stride * simplevideomarkdetect->left_offset;
+
   /* analyse the bottom left pixels */
   for (i = 0; i < simplevideomarkdetect->pattern_count; i++) {
-    d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
-    /* move to start of bottom left, adjust for offsets */
-    d += row_stride * (height - ph - simplevideomarkdetect->bottom_offset) +
-        pixel_stride * simplevideomarkdetect->left_offset;
-    /* move to i-th pattern */
-    d += pixel_stride * pw * i;
-
     /* calc brightness of width * height box */
     brightness =
         gst_video_detect_calc_brightness (simplevideomarkdetect, d, pw, ph,
@@ -494,6 +492,9 @@
               simplevideomarkdetect->pattern_sensitivity))
         goto no_pattern;
     }
+
+    /* move to i-th pattern */
+    d += pixel_stride * pw;
   }
   GST_DEBUG_OBJECT (simplevideomarkdetect, "found pattern");
 
@@ -501,15 +502,6 @@
 
   /* get the data of the pattern */
   for (i = 0; i < simplevideomarkdetect->pattern_data_count; i++) {
-    d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
-    /* move to start of bottom left, adjust for offsets */
-    d += row_stride * (height - ph - simplevideomarkdetect->bottom_offset) +
-        pixel_stride * simplevideomarkdetect->left_offset;
-    /* move after the fixed pattern */
-    d += pixel_stride * (simplevideomarkdetect->pattern_count * pw);
-    /* move to i-th pattern data */
-    d += pixel_stride * pw * i;
-
     /* calc brightness of width * height box */
     brightness =
         gst_video_detect_calc_brightness (simplevideomarkdetect, d, pw, ph,
@@ -518,6 +510,8 @@
     pattern_data <<= 1;
     if (brightness > simplevideomarkdetect->pattern_center)
       pattern_data |= 1;
+    /* move to i-th pattern data */
+    d += pixel_stride * pw;
   }
 
   GST_DEBUG_OBJECT (simplevideomarkdetect, "have data %" G_GUINT64_FORMAT,
diff --git a/gst/vmnc/Makefile.in b/gst/vmnc/Makefile.in
index b0585e9..f7a55d6 100644
--- a/gst/vmnc/Makefile.in
+++ b/gst/vmnc/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/vmnc/vmncdec.c b/gst/vmnc/vmncdec.c
index 6d33bdd..058a844 100644
--- a/gst/vmnc/vmncdec.c
+++ b/gst/vmnc/vmncdec.c
@@ -848,9 +848,10 @@
   /* We require a format descriptor in-stream, so we ignore the info from the
    * container here. We just use the framerate */
 
-  /* Declare it packetized if a valid framerate was parsed, not ideal */
-  gst_video_decoder_set_packetized (decoder,
-      state->info.fps_n && state->info.fps_d);
+  if (decoder->input_segment.format == GST_FORMAT_TIME)
+    gst_video_decoder_set_packetized (decoder, TRUE);
+  else
+    gst_video_decoder_set_packetized (decoder, FALSE);
 
   if (dec->input_state)
     gst_video_codec_state_unref (dec->input_state);
diff --git a/gst/y4m/Makefile.in b/gst/y4m/Makefile.in
index 26ef6e0..53318f9 100644
--- a/gst/y4m/Makefile.in
+++ b/gst/y4m/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/gst/y4m/gsty4mdec.c b/gst/y4m/gsty4mdec.c
index 803ff27..6bf27a8 100644
--- a/gst/y4m/gsty4mdec.c
+++ b/gst/y4m/gsty4mdec.c
@@ -701,10 +701,10 @@
       gst_video_frame_map (&oframe, &y4mdec->out_info, outbuf, GST_MAP_WRITE);
 
       for (i = 0; i < 3; i++) {
-        w = GST_VIDEO_FRAME_COMP_WIDTH (&iframe, i);;
-        h = GST_VIDEO_FRAME_COMP_HEIGHT (&iframe, i);;
-        istride = GST_VIDEO_FRAME_COMP_STRIDE (&iframe, i);;
-        ostride = GST_VIDEO_FRAME_COMP_STRIDE (&oframe, i);;
+        w = GST_VIDEO_FRAME_COMP_WIDTH (&iframe, i);
+        h = GST_VIDEO_FRAME_COMP_HEIGHT (&iframe, i);
+        istride = GST_VIDEO_FRAME_COMP_STRIDE (&iframe, i);
+        ostride = GST_VIDEO_FRAME_COMP_STRIDE (&oframe, i);
         src = GST_VIDEO_FRAME_COMP_DATA (&iframe, i);
         dest = GST_VIDEO_FRAME_COMP_DATA (&oframe, i);
 
diff --git a/gst/yadif/Makefile.in b/gst/yadif/Makefile.in
index 9c47a4f..c58fa96 100644
--- a/gst/yadif/Makefile.in
+++ b/gst/yadif/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -243,8 +243,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -283,7 +287,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -291,6 +294,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -340,8 +345,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -420,7 +423,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -429,7 +431,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -442,7 +443,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -467,6 +467,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -540,10 +542,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -569,6 +575,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -605,6 +614,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -645,17 +655,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -672,6 +681,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/m4/Makefile.in b/m4/Makefile.in
index ddb3e38..26c2605 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -158,8 +158,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -198,7 +202,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -206,6 +209,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -255,8 +260,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -335,7 +338,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -344,7 +346,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -357,7 +358,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -382,6 +382,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -455,10 +457,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -484,6 +490,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -520,6 +529,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -560,17 +570,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -587,6 +596,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/pkgconfig/Makefile.in b/pkgconfig/Makefile.in
index 761d410..c31f685 100644
--- a/pkgconfig/Makefile.in
+++ b/pkgconfig/Makefile.in
@@ -106,6 +106,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -119,7 +120,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -214,8 +214,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -254,7 +258,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -262,6 +265,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -311,8 +316,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -391,7 +394,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -400,7 +402,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -413,7 +414,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -438,6 +438,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -511,10 +513,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -540,6 +546,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -576,6 +585,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -616,17 +626,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -643,6 +652,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/pkgconfig/gstreamer-gl.pc.in b/pkgconfig/gstreamer-gl.pc.in
index f6ebf36..1b98762 100644
--- a/pkgconfig/gstreamer-gl.pc.in
+++ b/pkgconfig/gstreamer-gl.pc.in
@@ -9,5 +9,5 @@
 Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@
 Version: @VERSION@
 Libs: -L${libdir} -lgstgl-@GST_API_VERSION@ @GL_LIBS@
-Cflags: -I${includedir} @GL_CFLAGS@
+Cflags: -I${includedir} -I${libdir}/gstreamer-@GST_API_VERSION@/include @GL_CFLAGS@
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0e42f00..752ccd2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,7 @@
 ext/dash/gstdashdemux.c
 ext/gl/gstgltestsrc.c
 ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml.in
+ext/opencv/gsttemplatematch.c
 ext/resindvd/resindvdsrc.c
 ext/smoothstreaming/gstmssdemux.c
 ext/sndfile/gstsfdec.c
@@ -12,6 +13,7 @@
 gst/camerabin2/gstcamerabin2.c
 gst/camerabin2/gstviewfinderbin.c
 gst/dvdspu/gstdvdspu.c
+gst-libs/gst/adaptivedemux/gstadaptivedemux.c
 gst/mpegtsdemux/mpegtsbase.c
 gst/nuvdemux/gstnuvdemux.c
 gst/videomeasure/gstvideomeasure_collector.c
diff --git a/po/af.gmo b/po/af.gmo
index 297c02d..46d780e 100644
--- a/po/af.gmo
+++ b/po/af.gmo
Binary files differ
diff --git a/po/af.po b/po/af.po
index 340ce65..0930405 100644
--- a/po/af.po
+++ b/po/af.po
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins 0.7.6\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2004-03-18 14:16+0200\n"
 "Last-Translator: Petri Jooste <rkwjpj@puk.ac.za>\n"
 "Language-Team: Afrikaans <i18n@af.org.za>\n"
@@ -16,9 +16,6 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr ""
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -28,7 +25,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -111,6 +108,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 #, fuzzy
 msgid "Could not read title information for DVD."
 msgstr "Kon nie skryf na lêer \"%s\" nie."
@@ -134,15 +134,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Kon nie lêer \"%s\" oopmaak om te lees nie."
@@ -177,6 +168,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr ""
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 #, fuzzy
 msgid "No file name specified for writing."
 msgstr "Geen lêernaam gespesifiseer."
diff --git a/po/az.gmo b/po/az.gmo
index afb9ca4..a4260ed 100644
--- a/po/az.gmo
+++ b/po/az.gmo
Binary files differ
diff --git a/po/az.po b/po/az.po
index 761d334..d6e9679 100644
--- a/po/az.po
+++ b/po/az.po
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-0.8.0\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2004-03-19 18:29+0200\n"
 "Last-Translator: Metin Amiroff <metin@karegen.com>\n"
 "Language-Team: Azerbaijani <translation-team-az@lists.sourceforge.net>\n"
@@ -17,9 +17,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: KBabel 1.0.2\n"
 
-msgid "Internal data stream error."
-msgstr ""
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 #, fuzzy
 msgid "Could not read title information for DVD."
 msgstr "\"%s\" faylına yazıla bilmədi."
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "\"%s\" faylı oxuma üçün açıla bilmədi."
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr ""
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 #, fuzzy
 msgid "No file name specified for writing."
 msgstr "Fayl adı verilməyib."
diff --git a/po/bg.gmo b/po/bg.gmo
index 2080176..ad15d10 100644
--- a/po/bg.gmo
+++ b/po/bg.gmo
Binary files differ
diff --git a/po/bg.po b/po/bg.po
index e06f7f2..a42695e 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-04-26 22:30+0300\n"
 "Last-Translator: Alexander Shopov <ash@kambanaria.org>\n"
 "Language-Team: Bulgarian <dict@fsa-bg.org>\n"
@@ -18,9 +18,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 
-msgid "Internal data stream error."
-msgstr "Вътрешна грешка в потока на данни."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -30,7 +27,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -113,6 +110,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Информацията за заглавните части на DVD-то не може да бъде прочетена."
 
@@ -136,15 +136,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Файлът „%s“ не може да се отвори за четене."
@@ -179,6 +170,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Вътрешна грешка в потока на данни."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Не е указано име на файл за запис."
 
diff --git a/po/ca.gmo b/po/ca.gmo
index 76617c9..f5f4e33 100644
--- a/po/ca.gmo
+++ b/po/ca.gmo
Binary files differ
diff --git a/po/ca.po b/po/ca.po
index 43c851e..9441c2f 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -9,7 +9,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2012-01-01 14:19+0100\n"
 "Last-Translator: Gil Forcada <gforcada@gnome.org>\n"
 "Language-Team: Catalan <ca@dodds.net>\n"
@@ -19,9 +19,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 
-msgid "Internal data stream error."
-msgstr "S'ha produït un error intern de flux de dades."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -31,7 +28,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -114,6 +111,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "No s'ha pogut llegir la informació del títol del DVD."
 
@@ -137,15 +137,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "No s'ha pogut obrir el fitxer «%s» per a la lectura."
@@ -180,6 +171,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "S'ha produït un error intern de flux de dades."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "No s'ha especificat cap nom de fitxer per a l'escriptura."
 
diff --git a/po/cs.gmo b/po/cs.gmo
index 4776bb1..b033408 100644
--- a/po/cs.gmo
+++ b/po/cs.gmo
Binary files differ
diff --git a/po/cs.po b/po/cs.po
index 4a01edd..0e809d7 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -11,7 +11,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 1.1.4\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2013-09-18 10:05+0200\n"
 "Last-Translator: Marek Černocký <marek@manet.cz>\n"
 "Language-Team: Czech <translation-team-cs@lists.sourceforge.net>\n"
@@ -22,9 +22,6 @@
 "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
 "X-Generator: Gtranslator 2.91.6\n"
 
-msgid "Internal data stream error."
-msgstr "Chyba proudu vnitřních dat."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -34,7 +31,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -117,6 +114,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Nezdařilo se přečtení informací o titulu DVD."
 
@@ -140,15 +140,6 @@
 msgid "This file contains no playable streams."
 msgstr "Tento soubor neobsahuje žádný proud, který by šel přehrát."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Nelze získat adresu URI prohlášení."
-
-msgid "Failed to get fragment URL."
-msgstr "Selhalo získání adresy URL fragmentu."
-
-msgid "Couldn't download fragments"
-msgstr "Nelze stáhnout fragmenty"
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Nezdařilo se otevření souboru „%s“ ke čtení."
@@ -185,6 +176,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Formát podřízeného obrázku nebyl nastaven před datovým tokem"
 
+msgid "Failed to get fragment URL."
+msgstr "Selhalo získání adresy URL fragmentu."
+
+msgid "Internal data stream error."
+msgstr "Chyba proudu vnitřních dat."
+
+msgid "Couldn't download fragments"
+msgstr "Nelze stáhnout fragmenty"
+
 msgid "No file name specified for writing."
 msgstr "K zápisu nebyl zadán žádný název souboru."
 
@@ -231,5 +231,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Nelze najít podrobnosti ke kanálu DVB %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Nelze získat adresu URI prohlášení."
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Nezdařil se zápis do souboru „%s“."
diff --git a/po/da.gmo b/po/da.gmo
index f0f60be..ac413cf 100644
--- a/po/da.gmo
+++ b/po/da.gmo
Binary files differ
diff --git a/po/da.po b/po/da.po
index df9ce77..5ab9031 100644
--- a/po/da.po
+++ b/po/da.po
@@ -6,10 +6,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad-1.4.1\n"
+"Project-Id-Version: gst-plugins-bad-1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-08-29 11:28+0200\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-05-24 11:28+0200\n"
 "Last-Translator: Joe Hansen <joedalton2@yahoo.dk>\n"
 "Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
 "Language: da\n"
@@ -17,99 +17,84 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr "Intern datastrømfejl."
-
 msgid "format wasn't negotiated before get function"
-msgstr "format blev ikke forhandlet før hent funktion"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "standardlydkanal for GStreamers lydhændelser"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"GStreamer kan afspille lyd via et antal udgangselementer. Nogle mulige valg "
-"er osssink, pulsesink og alsasink. Lydudgangen kan være en delvis datakanal "
-"i stedet for bare et element."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "beskrivelse af standardlydkanal for GStreamers lydhændelser"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Beskriver det valge lydkanalelement."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "standardlydkanal til GStreamers lyd/video-konference"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "beskrivelse for standardlydkanal til GStreamers lyd/video-konference"
+msgstr ""
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "standardlydkanal til GStreamers musik og film"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
-msgstr "beskrivelse for standardlydkanal til GStreamers musik og film"
+msgstr ""
 
 msgid "default GStreamer videosink"
-msgstr "standardlydkanal for GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"GStreamer kan afspille video via et antal udgangselementer. Nogle mulige "
-"valg er xvimagesink, ximagesink, sdlvideosink og aasink. Videoudgangen kan "
-"være en delvis datakanal i stedet for bare et element."
 
 msgid "description for default GStreamer videosink"
-msgstr "beskrivelse for standardvideokanal for GStreamer"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Beskriver den valgte videokanalselement."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "standardlydoptagelse for GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"GStreamer kan optage lyd via et antal indgangselementer. Nogle mulige valg "
-"er osssrc, pulsesrc og alsasrc. Lydkilden kan være en delvis datakanal i "
-"stedet for bare et element."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "beskrivelse for standardlydoptagelsen til GStreamer"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Beskriver det valgte lydoptagelseselement."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "standardvideooptager for GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"GStreamer kan optage video via et antal indgangselementer. Nogle mulige valg "
-"er v4lsrc, v4l2src og videotestsrc. Videokilden kan være en delvis datakanal "
-"i stedet for bare et element."
 
 msgid "description for default GStreamer videosrc"
-msgstr "beskrivelse for standardvideooptageren til GStreamer"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Beskriver det valgte videooptagerelement."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "Standardvisualisering for GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -117,16 +102,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"GStreamer kan placere visualiseringsudvidelsesmoduler i en datakanal for at "
-"transformere lydstrømme i videobilleder. Nogle mulige valg er goom, goom2k1 "
-"og synaesthesia. Visualiseringsudvidelsesmodulerne kan være en delvis "
-"datakanal i stedet for bare et element."
 
 msgid "description for default GStreamer visualization"
-msgstr "beskrivelse for standardvisualisering til GStreamer"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Beskriver det valgte visualiseringselement."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Kunne ikke læse titelinformation for dvd."
@@ -151,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr "Denne fil indeholder ingen spilbare strømme."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Kunne ikke indhente Manifestens adresse"
-
-msgid "Failed to get fragment URL."
-msgstr "Kunne ikke indhente fragmentadresse."
-
-msgid "Couldn't download fragments"
-msgstr "Kunne ikke hente fragmenter"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Kunne ikke åbne sndfile-strøm for læsning."
 
@@ -193,6 +168,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Format for underbillede blev ikke konfigureret før datastrøm"
 
+msgid "Failed to get fragment URL."
+msgstr "Kunne ikke indhente fragmentadresse."
+
+msgid "Internal data stream error."
+msgstr "Intern datastrømfejl."
+
+msgid "Couldn't download fragments"
+msgstr "Kunne ikke hente fragmenter"
+
 msgid "No file name specified for writing."
 msgstr "Intet filnavn er angivet til skrivning."
 
@@ -239,5 +223,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Kunne ikke finde detaljer for DVB-kanalen %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Kunne ikke indhente Manifestens adresse"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Kunne ikke skrive til fil »%s«."
diff --git a/po/de.gmo b/po/de.gmo
index 82f18ec..a9eca7d 100644
--- a/po/de.gmo
+++ b/po/de.gmo
Binary files differ
diff --git a/po/de.po b/po/de.po
index 56a995d..6e5a53c 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,4 +1,4 @@
-# German po for gst-plugins-bad 1.4.1
+# German po for gst-plugins-bad 1.3.2
 # Copyright (C) 2007 Free Software Foundation, Inc.
 # This file is distributed under the same license as the gst-plugins-bad package.
 # Andre Klapper <ak-47@gmx.net>, 2008.
@@ -6,10 +6,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.1\n"
+"Project-Id-Version: gst-plugins-bad 1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-08-31 19:37+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-05-22 18:27+0100\n"
 "Last-Translator: Christian Kirbach <christian.kirbach@gmail.com>\n"
 "Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
 "Language: de\n"
@@ -19,106 +19,84 @@
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 "X-Generator: Poedit 1.5.4\n"
 
-msgid "Internal data stream error."
-msgstr "Interner Datenstromfehler."
-
 msgid "format wasn't negotiated before get function"
-msgstr "das Format wurde vor der get-Funktion nicht ausgehandelt"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "Voreingestellte GStreamer Tonereignis-Audioziel"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"GStreamer kann Ton mit einer beliebigen Anzahl an Ausgabeelementen "
-"wiedergeben. Einige Wahlmöglichkeiten sind »osssink«, »pulsesink« und "
-"»alsasink«. Das Audioziel kann eine anteilige Weiterleitung anstelle eines "
-"einzigen Elements sein."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "Beschreibung des voreingestellten GStreamer Tonereignis-Audioziel"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Beschreibt das gewählte Audioziel-Element."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "Voreingestelltes GStreamer-Audioziel für Ton- und Videokonferenzen"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
 msgstr ""
-"Beschreibung des voreingestellten GStreamer-Audioziel für Ton- und "
-"Videokonferenzen"
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "Voreingestelltes GStreamer-Audioziel für Musik und Filme"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
 msgstr ""
-"Beschreibung des voreingestellten GStreamer-Audioziel für Musik und Filme"
 
 msgid "default GStreamer videosink"
-msgstr "Voreingestelltes GStreamer-Videoziel"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"GStreamer kann Video mit einer beliebigen Anzahl an Ausgabeelementen "
-"wiedergeben. Einige Wahlmöglichkeiten sind »xvimagesink«, »ximagesink«, "
-"»sdlvideosink« und »aasink«. Das Videoziel kann eine anteilige Weiterleitung "
-"anstelle eines einzigen Elements sein."
 
 msgid "description for default GStreamer videosink"
-msgstr "Beschreibung des voreingestellten GStreamer-Videoziel"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Beschreibt das gewählte Videoziel-Element."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "Voreingestelltes GStreamer-audiosrc"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"GStreamer kann Ton mit einer beliebigen Anzahl an Eingabeelementen "
-"aufzeichnen. Einige Wahlmöglichkeiten sind »osssrc«, »pulsesrc« und "
-"»alsasrc«. Die Audioquelle kann eine anteilige Weiterleitung anstelle eines "
-"einzigen Elements sein."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "Beschreibung des voreingestellten GStreamer-audiosrc"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Beschreibt das gewählte audiosrc-Element."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "Voreingestelltes GStreamer-videosrc"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"GStreamer kann Video mit einer beliebigen Anzahl an Eingabeelementen "
-"aufzeichnen. Einige Wahlmöglichkeiten sind »v4lsrc«, »v4l2src« und "
-"»videotestsrc«. Die Videoquelle kann eine anteilige Weiterleitung anstelle "
-"eines einzigen Elements sein."
 
 msgid "description for default GStreamer videosrc"
-msgstr "Beschreibung des voreingestellten GStreamer-videosrc"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Beschreibt das gewählte videosrc-Element."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "Voreingestellte GStreamer-Visualisierung"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -126,16 +104,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"GStreamer kann Visualisierungs-Plugins in eine Weiterleitung integrieren, um "
-"Audioströme in Videobilder umzuwandeln. Einige Wahlmöglichkeiten sind "
-"»goom«, »goom2k1« und »synaesthesia«. Das Visualisierungs-Plugin kann eine "
-"anteilige Weiterleitung anstelle eines einzigen Elements sein."
 
 msgid "description for default GStreamer visualization"
-msgstr "Beschreibung der voreingestellten GStreamer-Visualisierung"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Beschreibt das gewählte Visualisierungselement."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Die Titelinformationen der DVD konnten nicht gelesen werden."
@@ -161,15 +138,6 @@
 msgid "This file contains no playable streams."
 msgstr "Diese Datei enthält keine abspielbaren Ströme."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Adresse der Frachtliste konnte nicht ermittelt werden"
-
-msgid "Failed to get fragment URL."
-msgstr "Ermitteln der Fragment-Adresse schlug fehl."
-
-msgid "Couldn't download fragments"
-msgstr "Fragmente konnten nicht heruntergeladen werden"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "sndfile-Datenstrom konnte nicht zum Lesen geöffnet werden."
 
@@ -206,6 +174,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Format des Unterbilds wurde nicht vor dem Datenfluss konfiguriert"
 
+msgid "Failed to get fragment URL."
+msgstr "Ermitteln der Fragment-Adresse schlug fehl."
+
+msgid "Internal data stream error."
+msgstr "Interner Datenstromfehler."
+
+msgid "Couldn't download fragments"
+msgstr "Fragmente konnten nicht heruntergeladen werden"
+
 msgid "No file name specified for writing."
 msgstr "Kein Dateiname zum Schreiben angegeben."
 
@@ -255,6 +232,9 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Details zu DVB-Kanal %s konnten nicht gefunden werden"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Adresse der Frachtliste konnte nicht ermittelt werden"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Es konnte nicht in Datei »%s« geschrieben werden."
 
diff --git a/po/el.gmo b/po/el.gmo
index e36ed7b..840665a 100644
--- a/po/el.gmo
+++ b/po/el.gmo
Binary files differ
diff --git a/po/el.po b/po/el.po
index ed58b3f..343aeec 100644
--- a/po/el.po
+++ b/po/el.po
@@ -9,7 +9,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2012-05-05 19:17+0100\n"
 "Last-Translator: Savvas Radevic <vicedar@gmail.com>\n"
 "Language-Team: Greek <team@lists.gnome.gr>\n"
@@ -19,9 +19,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=n>1;\n"
 
-msgid "Internal data stream error."
-msgstr "Εσωτερικό σφάλμα ροής δεδομένων."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -31,7 +28,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -114,6 +111,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Αδυναμία ανάγνωσης πληροφοριών τίτλου του DVD."
 
@@ -138,15 +138,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Αδυναμία ανοίγματος αρχείου \"%s\" για ανάγνωση."
@@ -181,6 +172,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Εσωτερικό σφάλμα ροής δεδομένων."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Δεν έχει καθορισθεί όνομα αρχείου για εγγραφή."
 
diff --git a/po/en_GB.gmo b/po/en_GB.gmo
index 813d824..99b79c2 100644
--- a/po/en_GB.gmo
+++ b/po/en_GB.gmo
Binary files differ
diff --git a/po/en_GB.po b/po/en_GB.po
index f1f12fa..bb8d6a6 100644
--- a/po/en_GB.po
+++ b/po/en_GB.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins 0.8.1\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2004-04-26 10:41-0400\n"
 "Last-Translator: Gareth Owen <gowen72@yahoo.com>\n"
 "Language-Team: English (British) <en_gb@li.org>\n"
@@ -15,9 +15,6 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr ""
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -27,7 +24,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -110,6 +107,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 #, fuzzy
 msgid "Could not read title information for DVD."
 msgstr "Could not write to file \"%s\"."
@@ -133,15 +133,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Could not open file \"%s\" for reading."
@@ -176,6 +167,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr ""
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 #, fuzzy
 msgid "No file name specified for writing."
 msgstr "No filename specified."
diff --git a/po/eo.gmo b/po/eo.gmo
index 947292a..1110cc2 100644
--- a/po/eo.gmo
+++ b/po/eo.gmo
Binary files differ
diff --git a/po/eo.po b/po/eo.po
index 3fd7c8e..2e11bbe 100644
--- a/po/eo.po
+++ b/po/eo.po
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-06-04 22:18+0200\n"
 "Last-Translator: Kristjan SCHMIDT <kristjan.schmidt@googlemail.com>\n"
 "Language-Team: Esperanto <translation-team-eo@lists.sourceforge.net>\n"
@@ -17,9 +17,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1)\n"
 
-msgid "Internal data stream error."
-msgstr "Interna datum-flu-eraro."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Ne eblis legi la titol-informojn de la DVD."
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Ne eblis malfermi la dosieron \"%s\" por legi."
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Interna datum-flu-eraro."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Neniu dosiernomo estas specifite por skribi."
 
diff --git a/po/es.gmo b/po/es.gmo
index 36bd52f..7eb92e4 100644
--- a/po/es.gmo
+++ b/po/es.gmo
Binary files differ
diff --git a/po/es.po b/po/es.po
index ac826a0..4667e85 100644
--- a/po/es.po
+++ b/po/es.po
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-10-02 15:47+0200\n"
 "Last-Translator: Jorge González González <aloriel@gmail.com>\n"
 "Language-Team: Spanish <es@li.org>\n"
@@ -17,9 +17,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n!=1);\n"
 
-msgid "Internal data stream error."
-msgstr "Error en el flujo de datos interno."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "No se pudo leer la información del título para el DVD."
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "No se pudo abrir el archivo «%s» para leer."
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Error en el flujo de datos interno."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "No se especificó un nombre de archivo para su escritura."
 
diff --git a/po/eu.gmo b/po/eu.gmo
index 8b59794..c49c679 100644
--- a/po/eu.gmo
+++ b/po/eu.gmo
Binary files differ
diff --git a/po/eu.po b/po/eu.po
index b61e77b..74d31b8 100644
--- a/po/eu.po
+++ b/po/eu.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad-0.10.17.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2010-03-25 12:30+0100\n"
 "Last-Translator: Mikel Olasagasti Uranga <hey_neken@mundurat.net>\n"
 "Language-Team: Basque <translation-team-eu@lists.sourceforge.net>\n"
@@ -19,9 +19,6 @@
 "X-Generator: KBabel 1.11.4\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-msgid "Internal data stream error."
-msgstr "Datu-korrontearen barne-errorea."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -31,7 +28,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -114,6 +111,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Ezin izan da DVDaren tituluaren informazioa irakurri."
 
@@ -136,15 +136,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Ezin izan da \"%s\" fitxategia ireki irakurtzeko."
@@ -179,6 +170,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Datu-korrontearen barne-errorea."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Ez da fitxategi-izenik zehaztu idazteko."
 
diff --git a/po/fi.gmo b/po/fi.gmo
index 85c8de4..5d506dc 100644
--- a/po/fi.gmo
+++ b/po/fi.gmo
Binary files differ
diff --git a/po/fi.po b/po/fi.po
index 23e6980..0758e6c 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -11,7 +11,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.13.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2009-08-12 22:13+0300\n"
 "Last-Translator: Tommi Vainikainen <Tommi.Vainikainen@iki.fi>\n"
 "Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n"
@@ -22,9 +22,6 @@
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 "X-Generator: KBabel 1.11.2\n"
 
-msgid "Internal data stream error."
-msgstr "Sisäisen tietovirran virhe."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -34,7 +31,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -117,6 +114,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "DVD:n otsikkotietoja ei voitu lukea."
 
@@ -139,15 +139,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Tiedostoa \"%s\" ei voi avata luettavaksi."
@@ -182,6 +173,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Sisäisen tietovirran virhe."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Kirjoitettavaa tiedostonimeä ei annettu."
 
diff --git a/po/fr.gmo b/po/fr.gmo
index 8c602ff..f093dc4 100644
--- a/po/fr.gmo
+++ b/po/fr.gmo
Binary files differ
diff --git a/po/fr.po b/po/fr.po
index 73ef922..22bd82f 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-04-28 09:13+0200\n"
 "Last-Translator: Claude Paroz <claude@2xlibre.net>\n"
 "Language-Team: French <traduc@traduc.org>\n"
@@ -17,9 +17,6 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr "Erreur interne de flux de données."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Impossible de lire les informations de titre du DVD."
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Impossible d'ouvrir le fichier « %s » en lecture."
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Erreur interne de flux de données."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Aucun nom de fichier indiqué pour l'écriture."
 
diff --git a/po/gl.gmo b/po/gl.gmo
index 1174940..cd24db0 100644
--- a/po/gl.gmo
+++ b/po/gl.gmo
Binary files differ
diff --git a/po/gl.po b/po/gl.po
index 9efb514..4552466 100644
--- a/po/gl.po
+++ b/po/gl.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-09-05 12:50+0200\n"
 "Last-Translator: Fran Dieguez <frandieguez@ubuntu.com>\n"
 "Language-Team: Galician <proxecto@trasno.net>\n"
@@ -19,9 +19,6 @@
 "Plural-Forms: nplurals=2; plural=(n!=1);\n"
 "X-Poedit-Language: galego\n"
 
-msgid "Internal data stream error."
-msgstr "Produciuse un erro interno no fluxo de datos."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -31,7 +28,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -114,6 +111,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Non foi posíbel ler a información do título do DVD"
 
@@ -137,15 +137,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Non foi posíbel abrir o ficheiro «%s» para ler."
@@ -180,6 +171,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Produciuse un erro interno no fluxo de datos."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Non se especificou ningún nome de ficheiro para a súa escritura."
 
diff --git a/po/gst-plugins-bad-1.0.pot b/po/gst-plugins-bad-1.0.pot
index b25cc12..7eb4e83 100644
--- a/po/gst-plugins-bad-1.0.pot
+++ b/po/gst-plugins-bad-1.0.pot
@@ -5,9 +5,9 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.5\n"
+"Project-Id-Version: gst-plugins-bad 1.5.0.1\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,13 +16,7 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: ext/dash/gstdashdemux.c:1513 ext/smoothstreaming/gstmssdemux.c:1532
-#: gst/mpegtsdemux/mpegtsbase.c:1353 gst/mpegtsdemux/mpegtsbase.c:1357
-#: gst/nuvdemux/gstnuvdemux.c:737
-msgid "Internal data stream error."
-msgstr ""
-
-#: ext/gl/gstgltestsrc.c:550
+#: ext/gl/gstgltestsrc.c:707
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -36,7 +30,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 #: ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml.in:13
@@ -143,6 +137,10 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+#: ext/opencv/gsttemplatematch.c:441
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 #: ext/resindvd/resindvdsrc.c:362
 msgid "Could not read title information for DVD."
 msgstr ""
@@ -166,22 +164,11 @@
 msgid "Could not read DVD."
 msgstr ""
 
-#: ext/smoothstreaming/gstmssdemux.c:802 ext/smoothstreaming/gstmssdemux.c:995
+#: ext/smoothstreaming/gstmssdemux.c:378
+#: gst-libs/gst/adaptivedemux/gstadaptivedemux.c:514
 msgid "This file contains no playable streams."
 msgstr ""
 
-#: ext/smoothstreaming/gstmssdemux.c:961
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-#: ext/smoothstreaming/gstmssdemux.c:1437
-msgid "Failed to get fragment URL."
-msgstr ""
-
-#: ext/smoothstreaming/gstmssdemux.c:1578
-msgid "Couldn't download fragments"
-msgstr ""
-
 #: ext/sndfile/gstsfdec.c:769
 msgid "Could not open sndfile stream for reading."
 msgstr ""
@@ -202,28 +189,42 @@
 msgid "Could not start sndio"
 msgstr ""
 
-#: gst/aiff/aiffparse.c:1462
+#: gst/aiff/aiffparse.c:1458
 msgid "Internal data flow error."
 msgstr ""
 
-#: gst/asfmux/gstasfmux.c:1807
+#: gst/asfmux/gstasfmux.c:1803
 msgid "Generated file has a larger preroll time than its streams duration"
 msgstr ""
 
-#: gst/camerabin2/camerabingeneral.c:166 gst/camerabin2/gstcamerabin2.c:1874
+#: gst/camerabin2/camerabingeneral.c:166 gst/camerabin2/gstcamerabin2.c:1876
 #: gst/camerabin2/gstviewfinderbin.c:271
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
 msgstr ""
 
-#: gst/camerabin2/gstcamerabin2.c:370
+#: gst/camerabin2/gstcamerabin2.c:364
 msgid "File location is set to NULL, please set it to a valid filename"
 msgstr ""
 
-#: gst/dvdspu/gstdvdspu.c:1037
+#: gst/dvdspu/gstdvdspu.c:1036
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+#: gst-libs/gst/adaptivedemux/gstadaptivedemux.c:1912
+msgid "Failed to get fragment URL."
+msgstr ""
+
+#: gst-libs/gst/adaptivedemux/gstadaptivedemux.c:2107
+#: gst/mpegtsdemux/mpegtsbase.c:1361 gst/mpegtsdemux/mpegtsbase.c:1365
+#: gst/nuvdemux/gstnuvdemux.c:736
+msgid "Internal data stream error."
+msgstr ""
+
+#: gst-libs/gst/adaptivedemux/gstadaptivedemux.c:2208
+msgid "Couldn't download fragments"
+msgstr ""
+
 #: gst/videomeasure/gstvideomeasure_collector.c:294
 msgid "No file name specified for writing."
 msgstr ""
@@ -238,45 +239,45 @@
 msgid "Could not open file \"%s\" for writing."
 msgstr ""
 
-#: sys/dvb/gstdvbsrc.c:1118 sys/dvb/gstdvbsrc.c:1304
+#: sys/dvb/gstdvbsrc.c:1565 sys/dvb/gstdvbsrc.c:1754
 #, c-format
 msgid "Device \"%s\" does not exist."
 msgstr ""
 
-#: sys/dvb/gstdvbsrc.c:1122
+#: sys/dvb/gstdvbsrc.c:1569
 #, c-format
 msgid "Could not open frontend device \"%s\"."
 msgstr ""
 
-#: sys/dvb/gstdvbsrc.c:1135
+#: sys/dvb/gstdvbsrc.c:1583
 #, c-format
 msgid "Could not get settings from frontend device \"%s\"."
 msgstr ""
 
-#: sys/dvb/gstdvbsrc.c:1151
+#: sys/dvb/gstdvbsrc.c:1600
 #, c-format
 msgid "Cannot enumerate delivery systems from frontend device \"%s\"."
 msgstr ""
 
-#: sys/dvb/gstdvbsrc.c:1308
+#: sys/dvb/gstdvbsrc.c:1758
 #, c-format
 msgid "Could not open file \"%s\" for reading."
 msgstr ""
 
-#: sys/dvb/parsechannels.c:159
+#: sys/dvb/parsechannels.c:168
 msgid "Couldn't find DVB channel configuration file"
 msgstr ""
 
-#: sys/dvb/parsechannels.c:162
+#: sys/dvb/parsechannels.c:171
 #, c-format
 msgid "Couldn't load DVB channel configuration file: %s"
 msgstr ""
 
-#: sys/dvb/parsechannels.c:171
+#: sys/dvb/parsechannels.c:180
 msgid "DVB channel configuration file doesn't contain any channels"
 msgstr ""
 
-#: sys/dvb/parsechannels.c:447
+#: sys/dvb/parsechannels.c:456
 #, c-format
 msgid "Couldn't find details for DVB channel %s"
 msgstr ""
diff --git a/po/hr.gmo b/po/hr.gmo
index 0cf77af..56d6302 100644
--- a/po/hr.gmo
+++ b/po/hr.gmo
Binary files differ
diff --git a/po/hr.po b/po/hr.po
index 2448344..cceca5a 100644
--- a/po/hr.po
+++ b/po/hr.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2012-04-16 02:06+0200\n"
 "Last-Translator: Tomislav Krznar <tomislav.krznar@gmail.com>\n"
 "Language-Team: Croatian <lokalizacija@linux.hr>\n"
@@ -17,9 +17,6 @@
 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
 
-msgid "Internal data stream error."
-msgstr "Greška unutarnjeg niza podataka."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Ne mogu čitati informacije o naslovu DVD-a."
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Ne mogu otvoriti datoteku „%s” za čitanje."
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Greška unutarnjeg niza podataka."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Nije navedena datoteka za pisanje."
 
diff --git a/po/hu.gmo b/po/hu.gmo
index 27ce66c..d7a5527 100644
--- a/po/hu.gmo
+++ b/po/hu.gmo
Binary files differ
diff --git a/po/hu.po b/po/hu.po
index 2894435..eb79537 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -3,13 +3,13 @@
 # Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
 #
 # Gabor Kelemen <kelemeng@gnome.hu>, 2007, 2008, 2009, 2012.
-# Balázs Úr <urbalazs@gmail.com>, 2014.
+# Balázs Úr <urbalazs at gmail dot com>, 2014.
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.1\n"
+"Project-Id-Version: gst-plugins-bad 1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-08-31 11:18+0200\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-05-23 20:42+0200\n"
 "Last-Translator: Balázs Úr <urbalazs@gmail.com>\n"
 "Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n"
 "Language: hu\n"
@@ -19,104 +19,84 @@
 "X-Generator: Lokalize 1.5\n"
 "Plural-Forms:  nplurals=2; plural=(n != 1);\n"
 
-msgid "Internal data stream error."
-msgstr "Belső adatfolyamhiba."
-
 msgid "format wasn't negotiated before get function"
-msgstr "a formátum nem lett egyeztetve a függvény lekérése előtt"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "alapértelmezett GStreamer hangesemények audiosink"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"A GStreamer képes hangot lejátszani bármilyen számú kimeneti elem "
-"használatával. Néhány lehetséges választás a következő lehet: osssink, "
-"pulsesink és alsasink. Az audiosink lehet egy részleges adatcsatorna is "
-"egyetlen elem helyett."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "az alapértelmezett GStreamer hangesemények audiosink leírása"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Leírja a kiválasztott audiosink elemet."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "alapértelmezett GStreamer audiosink a hang/videó konferenciához"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
 msgstr ""
-"az alapértelmezett GStreamer audiosink leírása a hang/videó konferenciához"
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "alapértelmezett GStreamer audiosink zenékhez és filmekhez"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
-msgstr "az alapértelmezett GStreamer audiosink leírása zenékhez és filmekhez"
+msgstr ""
 
 msgid "default GStreamer videosink"
-msgstr "alapértelmezett GStreamer videosink"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"A GStreamer képes videót lejátszani bármilyen számú kimeneti elem "
-"használatával. Néhány lehetséges választás a következő lehet: xvimagesink, "
-"ximagesink, sdlvideosink és aasink. Az videosink lehet egy részleges "
-"adatcsatorna is egyetlen elem helyett."
 
 msgid "description for default GStreamer videosink"
-msgstr "az alapértelmezett GStreamer videosink leírása"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Leírja a kiválasztott videosink elemet."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "alapértelmezett GStreamer audiosrc"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"A GStreamer képes hangot felvenni bármilyen számú bemeneti elem "
-"használatával. Néhány lehetséges választás a következő lehet: osssrc, "
-"pulsesrc és alsasrc. A hangforrás lehet egy részleges adatcsatorna is "
-"egyetlen elem helyett."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "az alapértelmezett GStreamer audiosrc leírása"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Leírja a kiválasztott audiosrc elemet."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "alapértelmezett GStreamer videosrc"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"A GStreamer képes videót felvenni bármilyen számú bemeneti elem "
-"használatával. Néhány lehetséges választás a következő lehet: v4lsrc, "
-"v4l2src és videotestsrc. A videoforrás lehet egy részleges adatcsatorna is "
-"egyetlen elem helyett."
 
 msgid "description for default GStreamer videosrc"
-msgstr "az alapértelmezett GStreamer videosrc leírása"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Leírja a kiválasztott videosrc elemet."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "alapértelmezett GStreamer képi megjelenítés"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -124,17 +104,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"A GStreamer képes képi megjelenítő bővítményeket elhelyezni egy "
-"adatcsatornába a videoképkockákban lévő hangfolyamok átalakításához. Néhány "
-"lehetséges választás a következő lehet: goom, goom2k1 és synaesthesia. A "
-"képi megjelenítő bővítmény lehet egy részleges adatcsatorna is egyetlen elem "
-"helyett."
 
 msgid "description for default GStreamer visualization"
-msgstr "az alapértelmezett GStreamer képi megjelenítés leírása"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Leírja a kiválasztott képi megjelenítés elemet."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Nem lehet címinformációkat olvasni a DVD-ről."
@@ -159,15 +137,6 @@
 msgid "This file contains no playable streams."
 msgstr "Ez a fájl nem tartalmaz lejátszható folyamokat."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Nem kérhető le a Manifest URL-e"
-
-msgid "Failed to get fragment URL."
-msgstr "Nem sikerült lekérni a töredék URL-t."
-
-msgid "Couldn't download fragments"
-msgstr "Nem sikerült letölteni a töredékeket"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "A hangfájl folyam nem nyitható meg olvasásra."
 
@@ -203,6 +172,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "A részkép formátuma nem lett beállítva az adatfolyam előtt"
 
+msgid "Failed to get fragment URL."
+msgstr "Nem sikerült lekérni a töredék URL-t."
+
+msgid "Internal data stream error."
+msgstr "Belső adatfolyamhiba."
+
+msgid "Couldn't download fragments"
+msgstr "Nem sikerült letölteni a töredékeket"
+
 msgid "No file name specified for writing."
 msgstr "Nincs megadva fájlnév az íráshoz."
 
@@ -250,6 +228,9 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Nem találhatók a(z) %s DVB-csatorna részletei"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Nem kérhető le a Manifest URL-e"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Nem lehet írni a fájlba („%s”)."
 
diff --git a/po/id.gmo b/po/id.gmo
index 2a4a19c..ef12db4 100644
--- a/po/id.gmo
+++ b/po/id.gmo
Binary files differ
diff --git a/po/id.po b/po/id.po
index 4b50479..94747ec 100644
--- a/po/id.po
+++ b/po/id.po
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2014-05-31 22:16+0700\n"
 "Last-Translator: Andhika Padmawan <andhika.padmawan@gmail.com>\n"
 "Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n"
@@ -17,9 +17,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: Poedit 1.5.7\n"
 
-msgid "Internal data stream error."
-msgstr "Galat arus data internal."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Tak dapat membaca informasi judul untuk DVD."
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr "Berkas ini tidak memuat stream yang dapat dimainkan."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Tak bisa memperoleh URI Manifes"
-
-msgid "Failed to get fragment URL."
-msgstr "Gagal mendapat URL fragmen."
-
-msgid "Couldn't download fragments"
-msgstr "Tak bisa mengunduh fragmen."
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Tak dapat membuka stream sndfile untuk dibaca."
 
@@ -177,6 +168,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Format subgambar tak ditata sebelum aliran data"
 
+msgid "Failed to get fragment URL."
+msgstr "Gagal mendapat URL fragmen."
+
+msgid "Internal data stream error."
+msgstr "Galat arus data internal."
+
+msgid "Couldn't download fragments"
+msgstr "Tak bisa mengunduh fragmen."
+
 msgid "No file name specified for writing."
 msgstr "Tak ada nama berkas yang ditentukan untuk ditulis."
 
@@ -225,5 +225,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Tak bisa temukan rincian untuk kanal DVB %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Tak bisa memperoleh URI Manifes"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Tak dapat menulis ke berkas \"%s\"."
diff --git a/po/it.gmo b/po/it.gmo
index 83de353..b719847 100644
--- a/po/it.gmo
+++ b/po/it.gmo
Binary files differ
diff --git a/po/it.po b/po/it.po
index 1fd105c..a1ff11d 100644
--- a/po/it.po
+++ b/po/it.po
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.13.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2009-08-14 00:12+0200\n"
 "Last-Translator: Luca Ferretti <elle.uca@infinito.it>\n"
 "Language-Team: Italian <tp@lists.linux.it>\n"
@@ -16,9 +16,6 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr "Errore interno nello stream di dati."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -28,7 +25,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -111,6 +108,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Impossibile leggere le informazioni del titolo per il DVD."
 
@@ -133,15 +133,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Impossibile aprire il file «%s» in lettura."
@@ -176,6 +167,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Errore interno nello stream di dati."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Nessun nome di file specificato per la scrittura."
 
diff --git a/po/ja.gmo b/po/ja.gmo
index 829325b..1cb927e 100644
--- a/po/ja.gmo
+++ b/po/ja.gmo
Binary files differ
diff --git a/po/ja.po b/po/ja.po
index 13de1ea..0be8b44 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-04-26 19:38+0900\n"
 "Last-Translator: Makoto Kato <makoto.kt@gmail.com>\n"
 "Language-Team: Japanese <translation-team-ja@lists.sourceforge.net>\n"
@@ -17,9 +17,6 @@
 "X-Generator: Lokalize 0.3\n"
 "Plural-Forms: nplurals=1; plural=0;\n"
 
-msgid "Internal data stream error."
-msgstr "内部データストリームエラー。"
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "DVDのタイトル情報を読み込むことができませんでした。"
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "読み込み用にファイル \"%s\" を開くことができません。"
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "内部データストリームエラー。"
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "書き込み用にファイル名が指定されていません。"
 
diff --git a/po/ky.gmo b/po/ky.gmo
index ef4db3e..bd885ff 100644
--- a/po/ky.gmo
+++ b/po/ky.gmo
Binary files differ
diff --git a/po/ky.po b/po/ky.po
index fa406f7..eed1f32 100644
--- a/po/ky.po
+++ b/po/ky.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.5\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2007-11-13 17:16+0600\n"
 "Last-Translator: Ilyas Bakirov <just_ilyas@yahoo.com>\n"
 "Language-Team: Kirghiz <i18n-team-ky-kyrgyz@lists.sourceforge.net>\n"
@@ -17,9 +17,6 @@
 "X-Poedit-Language: Kyrgyz\n"
 "X-Poedit-Country: KYRGYZSTAN\n"
 
-msgid "Internal data stream error."
-msgstr ""
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr ""
 
@@ -133,15 +133,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "\"%s\"  файлы окууга ачылган жок."
@@ -175,6 +166,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr ""
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr ""
 
@@ -219,3 +219,7 @@
 #, c-format
 msgid "Couldn't find details for DVB channel %s"
 msgstr ""
+
+#, fuzzy
+#~ msgid "Could not write to file \"%s\"."
+#~ msgstr "Алдын \"%s\" жабдыкты ачалган жок."
diff --git a/po/lt.gmo b/po/lt.gmo
index fe560b7..0d9865f 100644
--- a/po/lt.gmo
+++ b/po/lt.gmo
Binary files differ
diff --git a/po/lt.po b/po/lt.po
index bd0efb9..29431e5 100644
--- a/po/lt.po
+++ b/po/lt.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad-0.10.6.3\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2008-05-14 02:13+0300\n"
 "Last-Translator: Gintautas Miliauskas <gintas@akl.lt>\n"
 "Language-Team: Lithuanian <komp_lt@konferencijos.lt>\n"
@@ -18,9 +18,6 @@
 "Plural-Forms:  nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n"
 "%100<10 || n%100>=20) ? 1 : 2);\n"
 
-msgid "Internal data stream error."
-msgstr "Vidinė duomenų srauto klaida."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -30,7 +27,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -113,6 +110,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 #, fuzzy
 msgid "Could not read title information for DVD."
 msgstr "Nepavyko rašyti į failą „%s“."
@@ -136,15 +136,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Nepavyko atverti failo „%s“ skaitymui."
@@ -180,6 +171,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Vidinė duomenų srauto klaida."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Nenurodytas failo rašymui pavadinimas."
 
diff --git a/po/lv.gmo b/po/lv.gmo
index acae771..b1945bc 100644
--- a/po/lv.gmo
+++ b/po/lv.gmo
Binary files differ
diff --git a/po/lv.po b/po/lv.po
index 77a2079..af5c461 100644
--- a/po/lv.po
+++ b/po/lv.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 1.2.1\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2014-04-20 15:52+0300\n"
 "Last-Translator: Rihards Prieditis <rprieditis@gmail.com>\n"
 "Language-Team: Latvian <translation-team-lv@lists.sourceforge.net>\n"
@@ -22,9 +22,6 @@
 "2);\n"
 "X-Generator: Lokalize 1.5\n"
 
-msgid "Internal data stream error."
-msgstr "Iekšējās datu plūsmas kļūda."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -34,7 +31,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -117,6 +114,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Nevarēja nolasīt virsrakstu informāciju no DVD."
 
@@ -140,15 +140,6 @@
 msgid "This file contains no playable streams."
 msgstr "Šī datne nesatur atskaņojamas straumes."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Nevarēja saņemt manifesta URI"
-
-msgid "Failed to get fragment URL."
-msgstr "Neizdevās saņemt fragmenta URL."
-
-msgid "Couldn't download fragments"
-msgstr "Nevarēja lejupielādēt fragmentus"
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Nevarēja atvērt datni “%s” lasīšanai."
@@ -183,6 +174,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Apakšattēla formāts netika konfigurēts pirms datu plūsmas"
 
+msgid "Failed to get fragment URL."
+msgstr "Neizdevās saņemt fragmenta URL."
+
+msgid "Internal data stream error."
+msgstr "Iekšējās datu plūsmas kļūda."
+
+msgid "Couldn't download fragments"
+msgstr "Nevarēja lejupielādēt fragmentus"
+
 msgid "No file name specified for writing."
 msgstr "Ierakstīšanai nav norādīts neviens datnes nosaukums."
 
@@ -230,6 +230,9 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Nevarēja atrast sīkāku informāciju par DVB kanālu %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Nevarēja saņemt manifesta URI"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Nevarēja ierakstīt datnē “%s”."
 
diff --git a/po/mt.gmo b/po/mt.gmo
index fe61bb8..638449a 100644
--- a/po/mt.gmo
+++ b/po/mt.gmo
Binary files differ
diff --git a/po/mt.po b/po/mt.po
index e549123..4f5dbcd 100644
--- a/po/mt.po
+++ b/po/mt.po
@@ -5,7 +5,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad-0.10.8.3\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2008-10-26 20:27+0100\n"
 "Last-Translator: Michel Bugeja <michelbugeja@rabatmalta.com>\n"
 "Language-Team: Maltese <translation-team-mt@lists.sourceforge.net>\n"
@@ -18,9 +18,6 @@
 "X-Poedit-SourceCharset: utf-8\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-msgid "Internal data stream error."
-msgstr "Internal data stream error."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -30,7 +27,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -113,6 +110,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Ma stajtx naqra informazzjoni fuq it-titlu tad-DVD."
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Ma nistax naqra mill-fajl \"%s\"."
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Internal data stream error."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "L-ebda isem speċifikat biex nikteb."
 
diff --git a/po/nb.gmo b/po/nb.gmo
index 398015c..111ee95 100644
--- a/po/nb.gmo
+++ b/po/nb.gmo
Binary files differ
diff --git a/po/nb.po b/po/nb.po
index 330f226..4c0332e 100644
--- a/po/nb.po
+++ b/po/nb.po
@@ -6,10 +6,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.0\n"
+"Project-Id-Version: gst-plugins-bad 1.2.1\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-07-22 12:38+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-01-22 17:56+0100\n"
 "Last-Translator: Johnny A. Solbu <johnny@solbu.net>\n"
 "Language-Team: Norwegian Bokmaal <i18n-nb@lister.ping.uio.no>\n"
 "Language: nb_NO\n"
@@ -18,11 +18,8 @@
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: Poedit 1.5.4\n"
 
-msgid "Internal data stream error."
-msgstr "Intern feil i datastrøm."
-
 msgid "format wasn't negotiated before get function"
-msgstr "formatet ble ikke forhandlet før get-funksjon"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
 msgstr ""
@@ -30,7 +27,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -113,6 +110,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Kunne ikke lese tittelinformasjonen til DVD-en."
 
@@ -136,17 +136,9 @@
 msgid "This file contains no playable streams."
 msgstr "Denne filen inneholder ingen spillbare strømmer."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Kunne ikke hente Manifest-nettadressen."
-
-msgid "Failed to get fragment URL."
-msgstr "Klarte ikke å hente fragment-nettadresse."
-
-msgid "Couldn't download fragments"
-msgstr "Kunne ikke laste ned fragmenter"
-
+#, fuzzy
 msgid "Could not open sndfile stream for reading."
-msgstr "Kunne ikke åpne sndfile for lesing."
+msgstr "Kunne ikke åpne filen «%s» for lesing."
 
 msgid "Could not establish connection to sndio"
 msgstr "Kunne ikke opprette forbindelse til sndio"
@@ -177,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Underbildeformat er ikke konfigurert før dataflyt"
 
+msgid "Failed to get fragment URL."
+msgstr "Klarte ikke å hente fragment-nettadresse."
+
+msgid "Internal data stream error."
+msgstr "Intern feil i datastrøm."
+
+msgid "Couldn't download fragments"
+msgstr "Kunne ikke laste ned fragmenter"
+
 msgid "No file name specified for writing."
 msgstr "Ingen filnavn oppgitt for skriving."
 
@@ -200,9 +201,9 @@
 msgid "Could not get settings from frontend device \"%s\"."
 msgstr "Kunne ikke hente innstillinger fra frontenhet «%s»."
 
-#, c-format
+#, fuzzy, c-format
 msgid "Cannot enumerate delivery systems from frontend device \"%s\"."
-msgstr "Kan ikke nummerere leveringssystemer fra frontenhet «%s»."
+msgstr "Kunne ikke hente innstillinger fra frontenhet «%s»."
 
 #, c-format
 msgid "Could not open file \"%s\" for reading."
@@ -222,5 +223,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Kunne ikke finne detaljer for DVB-kanal %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Kunne ikke hente Manifest-nettadressen."
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Kunne ikke skrive til fil «%s»."
diff --git a/po/nl.gmo b/po/nl.gmo
index 75588dc..85759b4 100644
--- a/po/nl.gmo
+++ b/po/nl.gmo
Binary files differ
diff --git a/po/nl.po b/po/nl.po
index 35e3227..af108f9 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -1,4 +1,4 @@
-# translation of gst-plugins-bad-1.4.0.nl.po to Dutch
+# translation of gst-plugins-bad-1.3.2.nl.po to Dutch
 # translation of gst-plugins-bad to Dutch
 # Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 #
@@ -6,10 +6,10 @@
 # Freek de Kruijf <f.de.kruijf@gmail.com>, 2007, 2008, 2009, 2011, 2013, 2014.
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.0\n"
+"Project-Id-Version: gst-plugins-bad 1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-07-22 10:49+0200\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-05-22 00:31+0200\n"
 "Last-Translator: Freek de Kruijf <f.de.kruijf@gmail.com>\n"
 "Language-Team: Dutch <vertaling@vrijschrift.org>\n"
 "Language: nl\n"
@@ -19,11 +19,8 @@
 "X-Generator: Lokalize 1.5\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 
-msgid "Internal data stream error."
-msgstr "Interne fout in gegevensstroom."
-
 msgid "format wasn't negotiated before get function"
-msgstr "formaat is niet onderhandeld vóór get-functie"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
 msgstr ""
@@ -31,7 +28,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -114,6 +111,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Kan de titelinformatie voor de DVD niet lezen."
 
@@ -137,15 +137,6 @@
 msgid "This file contains no playable streams."
 msgstr "Dit bestand bevat geen af te spelen streams."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "De URI van het manifest verkrijgen lukt niet"
-
-msgid "Failed to get fragment URL."
-msgstr "Verkrijgen van de URL van het fragment is mislukt."
-
-msgid "Couldn't download fragments"
-msgstr "Kan fragmenten niet downloaden"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Kan sndfile-stream niet openen om te lezen."
 
@@ -181,6 +172,15 @@
 msgstr ""
 "Het format van de subafbeelding was niet ingesteld voor de gegevensstroom"
 
+msgid "Failed to get fragment URL."
+msgstr "Verkrijgen van de URL van het fragment is mislukt."
+
+msgid "Internal data stream error."
+msgstr "Interne fout in gegevensstroom."
+
+msgid "Couldn't download fragments"
+msgstr "Kan fragmenten niet downloaden"
+
 msgid "No file name specified for writing."
 msgstr "Geen bestandsnaam gespecificeerd voor de uitvoer."
 
@@ -228,6 +228,9 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Kon de details voor het DVB-kanaal %s niet vinden"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "De URI van het manifest verkrijgen lukt niet"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Kan niet in bestand \"%s\" schrijven."
 
diff --git a/po/or.gmo b/po/or.gmo
index e5a200e..f7ae2fe 100644
--- a/po/or.gmo
+++ b/po/or.gmo
Binary files differ
diff --git a/po/or.po b/po/or.po
index 4337e84..4df1c9b 100644
--- a/po/or.po
+++ b/po/or.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-0.8.3\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2004-09-27 13:32+0530\n"
 "Last-Translator: Gora Mohanty <gora_mohanty@yahoo.co.in>\n"
 "Language-Team: Oriya <gora_mohanty@yahoo.co.in>\n"
@@ -17,9 +17,6 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr ""
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 #, fuzzy
 msgid "Could not read title information for DVD."
 msgstr "\"%s\" ଫାଇଲ ଲେଖିହେଲା ନାହିଁ."
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "\"%s\" ଫାଇଲ ପଢ଼ିବା ପାଇଁ ଖୋଲିହେଲା ନାହିଁ."
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr ""
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 #, fuzzy
 msgid "No file name specified for writing."
 msgstr "କୌଣସି ଫାଇଲନାମ ଉଲ୍ଲେଖିତ ହୋଇ ନାହିଁ."
diff --git a/po/pl.gmo b/po/pl.gmo
index ed4de04..f3e4a22 100644
--- a/po/pl.gmo
+++ b/po/pl.gmo
Binary files differ
diff --git a/po/pl.po b/po/pl.po
index 07d2f33..70f064c 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -4,10 +4,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.1\n"
+"Project-Id-Version: gst-plugins-bad 1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-08-29 15:47+0200\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-05-22 18:34+0200\n"
 "Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n"
 "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
 "Language: pl\n"
@@ -15,105 +15,84 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr "Błąd wewnętrzny strumienia danych."
-
 msgid "format wasn't negotiated before get function"
-msgstr "format nie został wynegocjowany przed funkcją pobrania"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "domyślny element GStreamera pochłaniający zdarzenia dźwiękowe"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"GStreamer może odtwarzać dźwięk przy użyciu dowolnej liczby elementów "
-"wyjściowych. Niektóre z możliwości to osssink, pulsesink oraz alsasink. "
-"Wyjście dźwięku może być częściowym potokiem zamiast pojedynczego elementu."
 
 msgid "description for default GStreamer sound events audiosink"
 msgstr ""
-"opis domyślnego elementu GStreamera pochłaniającego zdarzenia dźwiękowe"
 
 msgid "Describes the selected audiosink element."
-msgstr "Opisuje wybrany element wyjściowy dźwięku."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
 msgstr ""
-"domyślny element GStreamera pochłaniający dźwięk dla konferencji audio/video"
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
 msgstr ""
-"opis domyślnego elementu wyjściowego dźwięku GStreamera dla konferencji "
-"audio/video"
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "domyślny element wyjściowy dźwięku GStreamera dla muzyki i filmów"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
 msgstr ""
-"opis domyślnego elementu wyjściowego dźwięku GStreamera dla muzyki i filmów"
 
 msgid "default GStreamer videosink"
-msgstr "domyślny element GStreamera pochłaniający obraz"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"GStreamer może odtwarzać obraz przy użyciu dowolnej liczby elementów "
-"wyjściowych. Niektóre z możliwości to xvimagesink, ximagesink, sdlvideosink "
-"oraz aasink. Wyjście obrazu może być częściowym potokiem zamiast "
-"pojedynczego elementu."
 
 msgid "description for default GStreamer videosink"
-msgstr "opis domyślnego elementu GStreamera pochłaniającego obraz"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Opisuje wybrany element wyjściowy obrazu."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "domyślne źródło dźwięku GStreamera"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"GStreamer może nagrywać dźwięk z dowolnej liczby elementów wejściowych. "
-"Niektóre możliwości to osssrc, pulsesrc oraz alsasrc. Źródło dźwięku może "
-"być częściowym potokiem zamiast pojedynczego elementu."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "opis domyślnego źródła dźwięku GStreamera"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Opisuje wybrany element źródłowy dźwięku."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "domyślne źródło obrazu GStreamera"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"GStreamer może nagrywać obraz z dowolnej liczby elementów wejściowych. "
-"Niektóre możliwości to v4lsrc, v4l2src oraz videotestsrc. Źródło obrazu może "
-"być częściowym potokiem zamiast pojedynczego elementu."
 
 msgid "description for default GStreamer videosrc"
-msgstr "opis domyślnego źródła obrazu GStreamera"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Opisuje wybrany element źródłowy obrazu."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "domyślna wizualizacja GStreamera"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -121,16 +100,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"GStreamer może umieszczać wtyczki wizualizujące w potoku w celu "
-"przekształcania strumieni dźwiękowych na klatki obrazu. Niektóre możliwości "
-"to goom, goom2k1 oraz synaesthesia. Wtyczka wizualizująca może być "
-"częściowym potokiem zamiast pojedynczego elementu."
 
 msgid "description for default GStreamer visualization"
-msgstr "opis domyślego elementu wizualizującego GStreamera"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Opisuje wybrany element wizualizujący."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Nie udało się odczytać informacji o tytułach dla DVD."
@@ -155,15 +133,6 @@
 msgid "This file contains no playable streams."
 msgstr "Ten plik nie zawiera strumieni do odtworzenia."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Nie udało się uzyskać URI Manifestu"
-
-msgid "Failed to get fragment URL."
-msgstr "Nie udało się uzyskać URL-a fragmentu."
-
-msgid "Couldn't download fragments"
-msgstr "Nie udało się pobrać fragmentów"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Nie udało się otworzyć strumienia sndfile do odczytu."
 
@@ -197,6 +166,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Format podobrazu nie został skonfigurowany przed przepływem danych"
 
+msgid "Failed to get fragment URL."
+msgstr "Nie udało się uzyskać URL-a fragmentu."
+
+msgid "Internal data stream error."
+msgstr "Błąd wewnętrzny strumienia danych."
+
+msgid "Couldn't download fragments"
+msgstr "Nie udało się pobrać fragmentów"
+
 msgid "No file name specified for writing."
 msgstr "Nie określono nazwy pliku do zapisu."
 
@@ -245,5 +223,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Nie udało się odnaleźć szczegółów dla kanału DVB %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Nie udało się uzyskać URI Manifestu"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Nie udało się zapisać danych do pliku \"%s\"."
diff --git a/po/pt_BR.gmo b/po/pt_BR.gmo
index 679ce27..74030a0 100644
--- a/po/pt_BR.gmo
+++ b/po/pt_BR.gmo
Binary files differ
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 72f3d78..829c47f 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad-1.2.1\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2013-12-17 01:09-0200\n"
 "Last-Translator: Fabrício Godoy <skarllot@gmail.com>\n"
 "Language-Team: Brazilian Portuguese <ldpbr-translation@lists.sourceforge."
@@ -19,9 +19,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
-msgid "Internal data stream error."
-msgstr "Erro interno de fluxo de dados."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -31,7 +28,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -114,6 +111,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Não foi possível ler as informações de título do DVD."
 
@@ -137,15 +137,6 @@
 msgid "This file contains no playable streams."
 msgstr "Este arquivo não contém fluxos reproduzíveis."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Não foi possível obter a URI do manifesto"
-
-msgid "Failed to get fragment URL."
-msgstr "Falha ao obter um fragmento de URL."
-
-msgid "Couldn't download fragments"
-msgstr "Não foi possível baixar os fragmentos"
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Não foi possível abrir o arquivo \"%s\" para leitura."
@@ -181,6 +172,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "O formato de subimagem não foi configurado antes do fluxo de dados"
 
+msgid "Failed to get fragment URL."
+msgstr "Falha ao obter um fragmento de URL."
+
+msgid "Internal data stream error."
+msgstr "Erro interno de fluxo de dados."
+
+msgid "Couldn't download fragments"
+msgstr "Não foi possível baixar os fragmentos"
+
 msgid "No file name specified for writing."
 msgstr "Nenhum nome de arquivo especificado para gravação."
 
@@ -230,5 +230,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Não foi possível encontrar detalhes para o canal DVB %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Não foi possível obter a URI do manifesto"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Não foi possível gravar no arquivo \"%s\"."
diff --git a/po/ro.gmo b/po/ro.gmo
index 79c0acf..1b1a1d9 100644
--- a/po/ro.gmo
+++ b/po/ro.gmo
Binary files differ
diff --git a/po/ro.po b/po/ro.po
index 0e773de..fe85b30 100644
--- a/po/ro.po
+++ b/po/ro.po
@@ -5,7 +5,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.18.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2010-08-16 03:11+0300\n"
 "Last-Translator: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>\n"
 "Language-Team: Romanian <translation-team-ro@lists.sourceforge.net>\n"
@@ -17,9 +17,6 @@
 "20)) ? 1 : 2);;\n"
 "X-Generator: Virtaal 0.6.1\n"
 
-msgid "Internal data stream error."
-msgstr "Eroare internă a fluxului de date."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -29,7 +26,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -112,6 +109,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Nu s-au putut citi informațiile despre titlu pentru DVD."
 
@@ -134,15 +134,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Nu s-a putut deschide fișierul „%s” pentru citire."
@@ -177,6 +168,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Eroare internă a fluxului de date."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Niciun nume de fișier specificat pentru scriere."
 
diff --git a/po/ru.gmo b/po/ru.gmo
index 023e08c..ee190c1 100644
--- a/po/ru.gmo
+++ b/po/ru.gmo
Binary files differ
diff --git a/po/ru.po b/po/ru.po
index b809866..e16f882 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,10 +6,10 @@
 # Yuri Kozlov <yuray@komyakino.ru>, 2011, 2013, 2014.
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.1\n"
+"Project-Id-Version: gst-plugins-bad 1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-09-06 10:56+0400\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-05-22 19:59+0400\n"
 "Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
 "Language-Team: Russian <gnu@mx.ru>\n"
 "Language: ru\n"
@@ -20,99 +20,84 @@
 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
 
-msgid "Internal data stream error."
-msgstr "Внутренняя ошибка потока данных."
-
 msgid "format wasn't negotiated before get function"
-msgstr "перед функцией получения не был согласован формат"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "GStreamer audiosink по умолчанию для звуковых событий"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"GStreamer может воспроизводить аудио через любой выходной элемент. Некоторые "
-"варианты: osssink, pulsesink и alsasink. Аudiosink может быть конвейером, а "
-"не одиночным элементом."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "описание GStreamer audiosink по умолчанию для звуковых событий"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Описывает выбранный элемент audiosink."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "GStreamer audiosink по умолчанию для аудио-видео конференций"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "описание GStreamer audiosink по умолчанию для аудио-видео конференций"
+msgstr ""
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "GStreamer audiosink по умолчанию для музыки и фильмов"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
-msgstr "описание GStreamer audiosink по умолчанию для музыки и фильмов"
+msgstr ""
 
 msgid "default GStreamer videosink"
-msgstr "GStreamer videosink по умолчанию"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"GStreamer может воспроизводить видео через любой выходной элемент. Некоторые "
-"варианты: xvimagesink, ximagesink, sdlvideosink и aasink. Videosink может "
-"быть конвейером, а не одиночным элементом."
 
 msgid "description for default GStreamer videosink"
-msgstr "описание GStreamer videosink по умолчанию"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Описывает выбранный элемент videosink."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "GStreamer audiosrc по умолчанию"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"GStreamer может записывать аудио с любого входного элемента. Некоторые "
-"варианты: osssrc, pulsesrc и alsasrc. Источником аудио может быть конвейер, "
-"а не одиночный элемент."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "описание GStreamer audiosrc по умолчанию"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Описывает выбранный элемент audiosrc."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "GStreamer videosrc по умолчанию"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"GStreamer может записывать видео с любого входного элемента. Некоторые "
-"варианты: v4lsrc, v4l2src и videotestsrc. Источником видео может быть "
-"конвейер, а не одиночный элемент."
 
 msgid "description for default GStreamer videosrc"
-msgstr "описание GStreamer videosrc по умолчанию"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Описывает выбранный элемент videosrc."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "GStreamer visualization по умолчанию"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -120,15 +105,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"GStreamer может помещать модули визуализации для преобразования аудио "
-"потоков видео фрагментов. Некоторые варианты: goom, goom2k1 и synaesthesia. "
-"Модуль визуализации может быть конвейером, а не одиночным элементом."
 
 msgid "description for default GStreamer visualization"
-msgstr "описание GStreamer visualization по умолчанию"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Описывает выбранный элемент visualization."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Не удалось прочитать информацию о структуре DVD."
@@ -153,15 +138,6 @@
 msgid "This file contains no playable streams."
 msgstr "Файл не содержит воспроизводимых потоков."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Не удалось получить URI манифеста"
-
-msgid "Failed to get fragment URL."
-msgstr "Ошибка при получении URL фрагмента."
-
-msgid "Couldn't download fragments"
-msgstr "Не удалось скачать фрагменты"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Не удалось открыть поток sndfile для чтения."
 
@@ -195,6 +171,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Не настроен формат субграфики (subpicture) до потока данных"
 
+msgid "Failed to get fragment URL."
+msgstr "Ошибка при получении URL фрагмента."
+
+msgid "Internal data stream error."
+msgstr "Внутренняя ошибка потока данных."
+
+msgid "Couldn't download fragments"
+msgstr "Не удалось скачать фрагменты"
+
 msgid "No file name specified for writing."
 msgstr "Не указано имя файла для записи."
 
@@ -242,6 +227,9 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Не удалось найти настройки DVB-канала %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Не удалось получить URI манифеста"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Не удалось осуществить запись в файл «%s»."
 
diff --git a/po/sk.gmo b/po/sk.gmo
index 427e06a..cf28033 100644
--- a/po/sk.gmo
+++ b/po/sk.gmo
Binary files differ
diff --git a/po/sk.po b/po/sk.po
index d58f972..6bd978e 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 1.2.1\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2014-01-30 10:44+0100\n"
 "Last-Translator: Peter Tuharsky <tuharsky@misbb.sk>\n"
 "Language-Team: Slovak <sk-i18n@lists.linux.sk>\n"
@@ -21,9 +21,6 @@
 "X-Poedit-Language: Slovak\n"
 "X-Poedit-Country: SLOVAKIA\n"
 
-msgid "Internal data stream error."
-msgstr "Vnútorná chyba prúdu údajov."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -33,7 +30,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -116,6 +113,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Nepodarilo sa prečítať titulok DVD."
 
@@ -139,15 +139,6 @@
 msgid "This file contains no playable streams."
 msgstr "Tento súbor neobsahuje prehrateľné prúdy údajov."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Nepodarilo sa získať URI Manifestu"
-
-msgid "Failed to get fragment URL."
-msgstr "Nepodarilo sa získať URL fragmentu."
-
-msgid "Couldn't download fragments"
-msgstr "Nepodarilo sa získať fragmenty"
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Nepodarilo sa otvoriť súbor \"%s\" na čítanie."
@@ -183,6 +174,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Formát podobrázku nebol nastavený pred prúdom údajov."
 
+msgid "Failed to get fragment URL."
+msgstr "Nepodarilo sa získať URL fragmentu."
+
+msgid "Internal data stream error."
+msgstr "Vnútorná chyba prúdu údajov."
+
+msgid "Couldn't download fragments"
+msgstr "Nepodarilo sa získať fragmenty"
+
 msgid "No file name specified for writing."
 msgstr "Nebolo zadané žiadne meno súboru pre zápis."
 
@@ -230,6 +230,9 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Nepodarilo sa nájsť podrobnosti o DVB kanáli %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Nepodarilo sa získať URI Manifestu"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Nepodarilo sa zapísať do súboru \"%s\"."
 
diff --git a/po/sl.gmo b/po/sl.gmo
index 43cb2a5..36cf5dc 100644
--- a/po/sl.gmo
+++ b/po/sl.gmo
Binary files differ
diff --git a/po/sl.po b/po/sl.po
index 4c4ecba..b008e6f 100644
--- a/po/sl.po
+++ b/po/sl.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-04-26 15:21+0100\n"
 "Last-Translator: Klemen Košir <klemen.kosir@gmx.com>\n"
 "Language-Team: Slovenian <translation-team-sl@lists.sourceforge.net>\n"
@@ -22,9 +22,6 @@
 "X-Poedit-Country: SLOVENIA\n"
 "X-Poedit-SourceCharset: utf-8\n"
 
-msgid "Internal data stream error."
-msgstr "Notranja napaka pretoka podatkov."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -34,7 +31,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -117,6 +114,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "Podatkov naslova DVD-ja ni mogoče prebrati."
 
@@ -140,15 +140,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Datoteke \"%s\" ni mogoče odpreti za branje."
@@ -183,6 +174,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Notranja napaka pretoka podatkov."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Ni navedenega imena datoteke za pisanje."
 
diff --git a/po/sq.gmo b/po/sq.gmo
index a86ed7f..baf3157 100644
--- a/po/sq.gmo
+++ b/po/sq.gmo
Binary files differ
diff --git a/po/sq.po b/po/sq.po
index 4950569..be7b476 100644
--- a/po/sq.po
+++ b/po/sq.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.7.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2008-08-15 16:07+0200\n"
 "Last-Translator: Laurent Dhima <laurenti@alblinux.net>\n"
 "Language-Team: Albanian <translation-team-sq@lists.sourceforge.net>\n"
@@ -15,9 +15,6 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr "Gabim i brendshëm tek stream i të dhënave."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -27,7 +24,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -110,6 +107,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 #, fuzzy
 msgid "Could not read title information for DVD."
 msgstr "I pamundur shkrimi tek file \"%s\"."
@@ -133,15 +133,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "E pamundur hapja e file \"%s\" për lexim."
@@ -177,6 +168,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "Gabim i brendshëm tek stream i të dhënave."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Asnjë emër file specifikuar për shkrim."
 
diff --git a/po/sr.gmo b/po/sr.gmo
index 76843b7..f82d259 100644
--- a/po/sr.gmo
+++ b/po/sr.gmo
Binary files differ
diff --git a/po/sr.po b/po/sr.po
index 8f29685..94a07f0 100644
--- a/po/sr.po
+++ b/po/sr.po
@@ -2,13 +2,13 @@
 # Copyright (C) 2014 Free Software Foundation, Inc.
 # This file is distributed under the same license as the gst-plugins-bad package.
 # Danilo Segan <dsegan@gmx.net>, 2004.
-# Мирослав Николић <miroslavnikolic@rocketmail.com>, 2011—2014.
+# Мирослав Николић <miroslavnikolic@rocketmail.com>, 2011-2014.
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad-1.4.1\n"
+"Project-Id-Version: gst-plugins-bad-1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-09-13 10:39+0200\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-06-18 19:15+0200\n"
 "Last-Translator: Мирослав Николић <miroslavnikolic@rocketmail.com>\n"
 "Language-Team: Serbian <(nothing)>\n"
 "Language: sr\n"
@@ -18,100 +18,84 @@
 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
 
-msgid "Internal data stream error."
-msgstr "Унутрашња грешка тока података."
-
 msgid "format wasn't negotiated before get function"
-msgstr "запис није договорен пре функције добављања (get)"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "основни аудио усклађивач звучних догађаја Гстримера"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"Гстример може да пушта аудио користећи било који број излазних елемената. "
-"Неки могући избори су „osssink“, „pulsesink“ и „alsasink“. Аудио усклађивач "
-"може бити делимична спојка уместо само једног елемента."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "опис основног аудио усклађивача звучних догађаја Гстримера"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Описује изабрани елемент аудио усклађивача."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "основни аудио усклађивач Гстримера за аудио/видео састанчење"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "опис основног аудио усклађивач Гстримера за аудио/видео састанчење"
+msgstr ""
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "основни аудио усклађивач Гстримера за музику и филмове"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
-msgstr "опис основног аудио усклађивача Гстримера за музику и филмове"
+msgstr ""
 
 msgid "default GStreamer videosink"
-msgstr "основни видео усклађивач Гстримера"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"Гстример може да пушта видео користећи било који број излазних елемената. "
-"Неки могући избори су „xvimagesink“, „ximagesink“, „sdlvideosink“ и "
-"„aasink“. Видео усклађивач може бити делимична спојка уместо само једног "
-"елемента."
 
 msgid "description for default GStreamer videosink"
-msgstr "опис основног видео усклађивача Гстримера"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Описује изабрани елемент видео усклађивача."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "основни аудио извор Гстримера"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"Гстример може да снима аудио користећи било који број излазних елемената. "
-"Неки могући избори су „osssrc“, „pulsesrc“ и „alsasrc“. Извор звука може "
-"бити делимична спојка уместо само једног елемента."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "опис основног аудио извора Гстримера"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Описује изабрани елемент аудио извора."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "основни видео извор Гстримера"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"Гстример може да снима видео користећи било који број излазних елемената. "
-"Неки могући избори су „v4lsrc“, „v4l2src“ и “videotestsrc“. Извор видеа може "
-"бити делимична спојка уместо само једног елемента."
 
 msgid "description for default GStreamer videosrc"
-msgstr "опис основног видео извора Гстримера"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Описује изабрани елемент видео извора."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "основно приказивање Гстримера"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -119,16 +103,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"Гстример може да стави прикључке приказивања у спојку да претвори аудио "
-"токове у видео кадрове. Неки могући избори су „goom“, „goom2k1“ и "
-"„synaesthesia“. Прикључак приказивања може бити делимична спојка уместо само "
-"једног елемента."
 
 msgid "description for default GStreamer visualization"
-msgstr "опис основног приказивања Гстримера"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Описује изабрани елемент приказивања."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Не могу да прочитам информације о наслову ДВД-а."
@@ -153,15 +136,6 @@
 msgid "This file contains no playable streams."
 msgstr "Ова датотека не садржи токове за пуштање."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Не могу да добавим путању Манифеста"
-
-msgid "Failed to get fragment URL."
-msgstr "Нисам успео да добијем адресу одломка."
-
-msgid "Couldn't download fragments"
-msgstr "Не могу да преузмем одломке"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Не могу да отворим ток датотеке звука за читање."
 
@@ -194,6 +168,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Запис подслике није подешен пре протока података"
 
+msgid "Failed to get fragment URL."
+msgstr "Нисам успео да добијем адресу одломка."
+
+msgid "Internal data stream error."
+msgstr "Унутрашња грешка тока података."
+
+msgid "Couldn't download fragments"
+msgstr "Не могу да преузмем одломке"
+
 msgid "No file name specified for writing."
 msgstr "Није наведен назив датотеке за упис."
 
@@ -241,5 +224,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Не могу да пронађем податке за ДВБ канал „%s“"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Не могу да добавим путању Манифеста"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Не могу да пишем у датотеку „%s“."
diff --git a/po/sv.gmo b/po/sv.gmo
index 68bbf00..ef193a7 100644
--- a/po/sv.gmo
+++ b/po/sv.gmo
Binary files differ
diff --git a/po/sv.po b/po/sv.po
index 8e75e17..3189391 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -6,10 +6,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.1\n"
+"Project-Id-Version: gst-plugins-bad 1.3.90\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-09-19 02:43+0200\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-07-11 02:52+0200\n"
 "Last-Translator: Sebastian Rasmussen <sebras@gmail.com>\n"
 "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
 "Language: sv\n"
@@ -17,100 +17,84 @@
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr "Internt fel i dataström."
-
 msgid "format wasn't negotiated before get function"
-msgstr "formatet förhandlades inte fram innan hämtfunktionen"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "standard GStreamer-ljudutgång för ljudhändelser"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"GStreamer kan spela upp ljud via ett antal utgångselement. Några möjliga val "
-"är osssink, pulsesink och alsasink. Ljudutgången kan vara en delrörledning "
-"istället för bara ett element."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "beskrivning för standard GStreamer-ljudutgång för ljudhändelser"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Beskriver det valda ljudutgångselementet."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "standard GStreamer-ljudutgång för ljud/video-konferenser"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
 msgstr ""
-"beskrivning för standard GStreamer-ljudutgång för ljud/video-konferenser"
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "standard GStreamer-ljudutgång för musik och filmer"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
-msgstr "beskrivning för standard GStreamer-ljudutgång för musik och filmer"
+msgstr ""
 
 msgid "default GStreamer videosink"
-msgstr "standard GStreamer-videoutgång"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"GStreamer kan spela upp video via ett antal utgångselement. Några möjliga "
-"val är xvimagesink, ximagesink, sdlvideosink och aasink. Videoutgången kan "
-"vara en delrörledning istället för bara ett element."
 
 msgid "description for default GStreamer videosink"
-msgstr "beskrivning för standard GStreamer-videoutgång"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Beskriver det valda videoutgångselementet."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "standard GStreamer-ljudkälla"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"GStreamer kan spela in ljud från ett antal ingångslement. Några möjliga val "
-"är osssrc, pulsesrc och alsasrc. Ljudkällan kan vara en delrörleding "
-"istället för bara ett element."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "beskrivning för standard GStreamer-ljudkälla"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Beskriver det valda ljudkällselementet."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "standard GStreamer-videokälla"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"GStreamer kan spela in video från ett antal ingångselement. Några möjliga "
-"val är v4lsrc, v4l2src och videotestsrc. Videokällan kan vara en "
-"delrörledning istället för bara ett element."
 
 msgid "description for default GStreamer videosrc"
-msgstr "beskrivning för standard GStreamer-videokälla"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Beskriver det valda videokällselementet."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "standard GStreamer-visualisering"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -118,16 +102,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"GStreamer kan lägga in insticksmoduler för visualisering i en pipeline för "
-"att transformera ljudströmmar till videobilder. Några möjliga val är goom, "
-"goom2k1 och synaesthesia. Visualiseringsinsticksmodulen kan vara en "
-"delrörledning istället för bara ett element."
 
 msgid "description for default GStreamer visualization"
-msgstr "beskrivning för standard GStreamer-visualisering"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Beskriver det valda visualiseringselementet."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Kunde inte läsa titelinformation för dvd."
@@ -152,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr "Den här filen innehåller inga spelbara strömmar."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Kunde ej hämta manifestets URI"
-
-msgid "Failed to get fragment URL."
-msgstr "Misslyckades att hämta fragment-URL"
-
-msgid "Couldn't download fragments"
-msgstr "Kunde ej ladda ner fragment"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Kunde inte öppna sndfile-ström för läsning."
 
@@ -193,6 +167,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Delbildsformat var inte konfigurerat före dataflöde"
 
+msgid "Failed to get fragment URL."
+msgstr "Misslyckades att hämta fragment-URL"
+
+msgid "Internal data stream error."
+msgstr "Internt fel i dataström."
+
+msgid "Couldn't download fragments"
+msgstr "Kunde ej ladda ner fragment"
+
 msgid "No file name specified for writing."
 msgstr "Inget filnamn angavs för skrivning."
 
@@ -238,5 +221,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Kunde ej hitta detaljer för DVB-kanal %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Kunde ej hämta manifestets URI"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Kunde inte skriva till filen \"%s\"."
diff --git a/po/tr.gmo b/po/tr.gmo
index 68a3562..b781e73 100644
--- a/po/tr.gmo
+++ b/po/tr.gmo
Binary files differ
diff --git a/po/tr.po b/po/tr.po
index 8cf60de..b800e06 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -6,7 +6,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad-0.10.21.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2011-04-26 19:21+0200\n"
 "Last-Translator: Server Acim <serveracim@gmail.com>\n"
 "Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\n"
@@ -16,9 +16,6 @@
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: KBabel 1.11.4\n"
 
-msgid "Internal data stream error."
-msgstr "İç veri akım hatası."
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -28,7 +25,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -111,6 +108,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "DVD'deki başlık bilgisi okunamıyor."
 
@@ -134,15 +134,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "Dosyayı \"%s\" okumak için açamıyor."
@@ -177,6 +168,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "İç veri akım hatası."
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "Yazmak için dosya adı belirtilmedi."
 
diff --git a/po/uk.gmo b/po/uk.gmo
index fd15541..976cead 100644
--- a/po/uk.gmo
+++ b/po/uk.gmo
Binary files differ
diff --git a/po/uk.po b/po/uk.po
index 61f1469..1dea347 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -6,10 +6,10 @@
 # Yuri Chornoivan <yurchor@ukr.net>, 2011, 2013, 2014.
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad 1.4.1\n"
+"Project-Id-Version: gst-plugins-bad 1.3.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-08-29 08:35+0300\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-05-22 07:31+0300\n"
 "Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
 "Language-Team: Ukrainian <translation-team-uk@lists.sourceforge.net>\n"
 "Language: uk\n"
@@ -20,104 +20,84 @@
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
 "X-Generator: Lokalize 1.5\n"
 
-msgid "Internal data stream error."
-msgstr "Помилка внутрішнього потоку даних."
-
 msgid "format wasn't negotiated before get function"
-msgstr "формат не було узгоджено до виклику функції get"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "типовий приймач звукових подій GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"У GStreamer передбачено можливість відтворення звукових даних за допомогою "
-"довільної кількості елементів виведення. Серед можливих варіантів osssink, "
-"pulsesink та alsasink. Звуковий приймач може бути окремим каналом з "
-"декількох обробників, а не одним елементом."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "опис типового приймача звукових подій GStreamer"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Описує вибраний елемент audiosink."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "типовий звуковий приймач GStreamer для звукових та відеоконференцій"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
 msgstr ""
-"опис типового звукового приймача GStreamer для звукових та відеоконференцій"
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "типовий звуковий приймач GStreamer для музики і фільмів"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
-msgstr "опис типового звукового приймача GStreamer для музики і фільмів"
+msgstr ""
 
 msgid "default GStreamer videosink"
-msgstr "типовий відеоприймач GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"У GStreamer передбачено відтворення відео за допомогою довільної кількості "
-"елементів виведення. Серед можливих варіантів xvimagesink, ximagesink, "
-"sdlvideosink та aasink. Приймач відеоданих може бути окремим каналом з "
-"декількох обробників, а не просто одним елементом."
 
 msgid "description for default GStreamer videosink"
-msgstr "опис типового відеоприймача GStreamer"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Описує вибраний елемент videosink."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "типове джерело звуку GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"У GStreamer передбачено можливість запису звукових даних за допомогою "
-"довільної кількості елементів вхідних даних. Серед можливих варіантів "
-"osssrc, pulsesrc та alsasrc. Джерелом звукових даних може бути окремий канал "
-"з декількох елементів, а не просто один елемент."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "опис типового джерела звуку GStreamer"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Описує вибраний елемент audiosrc."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "типове джерело відео GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"У GStreamer передбачено можливість запису відеоданих за допомогою довільної "
-"кількості елементів вхідних даних. Серед можливих варіантів v4lsrc, v4l2src "
-"та videotestsrc. Джерелом відеоданих може бути окремий канал з декількох "
-"елементів, а не просто один елемент."
 
 msgid "description for default GStreamer videosrc"
-msgstr "опис типового джерела відео GStreamer"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Описує вибраний елемент videosrc."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "типова візуалізація GStreamer"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -125,16 +105,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"У GStreamer передбачено додавання до каналу обробки додатків візуалізації "
-"для обробки потоків звукових даних у кадрах відео. Серед можливих варіантів "
-"goom, goom2k1 та synaesthesia. Додаток візуалізації може бути окремим "
-"каналом, а не просто одним елементом."
 
 msgid "description for default GStreamer visualization"
-msgstr "опис типової візуалізації GStreamer"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Описує вибраний елемент візуалізації."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Не вдалося прочитати дані щодо записів на DVD."
@@ -159,15 +138,6 @@
 msgid "This file contains no playable streams."
 msgstr "Файл не містить потоків, які можна відтворити."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Не вдалося отримати адреси Manifest"
-
-msgid "Failed to get fragment URL."
-msgstr "Не вдалося отримати адреси фрагмента."
-
-msgid "Couldn't download fragments"
-msgstr "Не вдалося отримати фрагменти"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Не вдалося відкрити потік sndfile для читання."
 
@@ -204,6 +174,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Формат підзображення не було налаштовано до створення потоку даних"
 
+msgid "Failed to get fragment URL."
+msgstr "Не вдалося отримати адреси фрагмента."
+
+msgid "Internal data stream error."
+msgstr "Помилка внутрішнього потоку даних."
+
+msgid "Couldn't download fragments"
+msgstr "Не вдалося отримати фрагменти"
+
 msgid "No file name specified for writing."
 msgstr "Не вказано назви файла для запису."
 
@@ -253,5 +232,8 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Не вдалося знайти параметрів каналу DVB %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Не вдалося отримати адреси Manifest"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Спроба запису до файла «%s» завершилася невдало"
diff --git a/po/vi.gmo b/po/vi.gmo
index ae81764..efc67de 100644
--- a/po/vi.gmo
+++ b/po/vi.gmo
Binary files differ
diff --git a/po/vi.po b/po/vi.po
index 03fbb0f..b101484 100644
--- a/po/vi.po
+++ b/po/vi.po
@@ -6,10 +6,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: gst-plugins-bad-1.4.1\n"
+"Project-Id-Version: gst-plugins-bad-1.3.90\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
-"PO-Revision-Date: 2014-08-29 15:09+0700\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
+"PO-Revision-Date: 2014-06-30 08:59+0700\n"
 "Last-Translator: Trần Ngọc Quân <vnwildman@gmail.com>\n"
 "Language-Team: Vietnamese <translation-team-vi@lists.sourceforge.net>\n"
 "Language: vi\n"
@@ -23,99 +23,84 @@
 "X-Poedit-Language: Vietnamese\n"
 "X-Poedit-Country: VIET NAM\n"
 
-msgid "Internal data stream error."
-msgstr "Lỗi luồng dữ liệu nội bộ."
-
 msgid "format wasn't negotiated before get function"
-msgstr "định dạng không được dàn xếp trước hàm"
+msgstr ""
 
 msgid "default GStreamer sound events audiosink"
-msgstr "các sự kiện âm thanh GStreamer mặc định cho “audiosink”"
+msgstr ""
 
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
-"GStreamer có thể chạy nhạc với bất kỳ số lượng phần tử đầu ra nào. Một số có "
-"thể chọn lựa là osssink, pulsesink và alsasink. “audiosink” có thể là đường "
-"ống đặc biệt thay vì chỉ một phần tử."
 
 msgid "description for default GStreamer sound events audiosink"
-msgstr "mô tả cho các sự kiện âm thanh GStreamer mặc định dành cho “audiosink”"
+msgstr ""
 
 msgid "Describes the selected audiosink element."
-msgstr "Mô tả về phần tử “audiosink” đã chọn."
+msgstr ""
 
 msgid "default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "“GStreamer audiosink” mặc định dành cho Hội nghị Nhạc/Phim"
+msgstr ""
 
 msgid ""
 "description for default GStreamer audiosink for Audio/Video Conferencing"
-msgstr "mô tả cho GStreamer audiosink mặc định dành cho Hội nghị Nhạc/Phim"
+msgstr ""
 
 msgid "default GStreamer audiosink for Music and Movies"
-msgstr "GStreamer audiosink mặc định dành cho Âm nhạc và Phim"
+msgstr ""
 
 msgid "description for default GStreamer audiosink for Music and Movies"
-msgstr "mô tả cho GStreamer audiosink mặc định dành cho Âm nhạc và Phim"
+msgstr ""
 
 msgid "default GStreamer videosink"
-msgstr "GStreamer videosink mặc định"
+msgstr ""
 
 msgid ""
 "GStreamer can play video using any number of output elements. Some possible "
 "choices are xvimagesink, ximagesink, sdlvideosink and aasink. The videosink "
 "can be a partial pipeline instead of just one element."
 msgstr ""
-"GStreamer có thể chạy phim với bất kỳ số lượng phần tử đầu ra nào. Một số có "
-"thể chọn lựa là xvimagesink, ximagesink, sdlvideosink và aasink. “videosink” "
-"có thể là đường ống đặc biệt thay vì chỉ một phần tử."
 
 msgid "description for default GStreamer videosink"
-msgstr "mô tả phần tử nguồn hình ảnh GStreamer mặc định"
+msgstr ""
 
 msgid "Describes the selected videosink element."
-msgstr "Mô tả phần tử videosink đã chọn."
+msgstr ""
 
 msgid "default GStreamer audiosrc"
-msgstr "nguồn âm thanh GStreamer mặc định"
+msgstr ""
 
 msgid ""
 "GStreamer can record audio using any number of input elements. Some possible "
 "choices are osssrc, pulsesrc and alsasrc. The audio source can be a partial "
 "pipeline instead of just one element."
 msgstr ""
-"GStreamer có thể ghi âm thanh dùng bao nhiêu phần tử đầu vào cũng được. Một "
-"số lựa chọn là osssrc, plusesrc và alsasrc. Nguồn âm thanh có thể là các "
-"đường ống cục bộ nào đó thay vì chỉ một phần tử nguồn."
 
 msgid "description for default GStreamer audiosrc"
-msgstr "mô tả phần tử nguồn âm thanh GStreamer mặc định"
+msgstr ""
 
 msgid "Describes the selected audiosrc element."
-msgstr "Mô tả phần tử nguồn âm thanh đã chọn."
+msgstr ""
 
 msgid "default GStreamer videosrc"
-msgstr "nguồn hình ảnh GStreamer mặc định"
+msgstr ""
 
 msgid ""
 "GStreamer can record video from any number of input elements. Some possible "
 "choices are v4lsrc, v4l2src and videotestsrc. The video source can be a "
 "partial pipeline instead of just one element."
 msgstr ""
-"GStreamer có thể chạy phim với bất kỳ số lượng phần tử đầu vào nào. Một số "
-"có thể chọn lựa là v4lsrc, v4l2src và videotestsrc. Nguồn hình có thể là "
-"đường ống đặc biệt thay vì chỉ một phần tử."
 
 msgid "description for default GStreamer videosrc"
-msgstr "mô tả cho nguồn hình GStreamer mặc định"
+msgstr ""
 
 msgid "Describes the selected videosrc element."
-msgstr "Mô tả phần tử nguồn hình ảnh đã chọn."
+msgstr ""
 
 msgid "default GStreamer visualization"
-msgstr "hiện hình GStreamer mặc định"
+msgstr ""
 
 msgid ""
 "GStreamer can put visualization plugins in a pipeline to transform audio "
@@ -123,16 +108,15 @@
 "synaesthesia. The visualization plugin can be a partial pipeline instead of "
 "just one element."
 msgstr ""
-"GStreamer có thể đặt phần bổ xung hiện hình trong một đường ống để mà chuyển "
-"dạng luồng dữ liệu âm thanh trong khung hình phim. Một số có thể chọn lựa là "
-"goom, goom2k1 và synaesthesia. Phần bổ xung hiện hình có thể là đường ống "
-"đặc biệt thay vì chỉ một phần tử."
 
 msgid "description for default GStreamer visualization"
-msgstr "mô tả về hiện hình GStreamer mặc định"
+msgstr ""
 
 msgid "Describes the selected visualization element."
-msgstr "Mô tả về phần tử hiện hình đã chọn."
+msgstr ""
+
+msgid "OpenCV failed to load template image"
+msgstr ""
 
 msgid "Could not read title information for DVD."
 msgstr "Không thể đọc thông tin tựa đề của đĩa DVD."
@@ -157,15 +141,6 @@
 msgid "This file contains no playable streams."
 msgstr "Tập tin này không chứa luồng dữ liệu có thể phát."
 
-msgid "Couldn't get the Manifest's URI"
-msgstr "Không thể lấy URI của Manifest"
-
-msgid "Failed to get fragment URL."
-msgstr "Gặp lỗi khi lấy URL phân mảnh."
-
-msgid "Couldn't download fragments"
-msgstr "Không thể tải về các phân mảnh"
-
 msgid "Could not open sndfile stream for reading."
 msgstr "Không thể mở luồng dữ liệu tập tin snd để đọc."
 
@@ -190,7 +165,7 @@
 
 #, c-format
 msgid "Missing element '%s' - check your GStreamer installation."
-msgstr "Thiếu phần tử “%s” — hãy kiểm tra lại phần cài đặt GStreamer."
+msgstr "Thiếu phần tử “%s” — hãy kiểm tra lại cài đặt GStreamer."
 
 msgid "File location is set to NULL, please set it to a valid filename"
 msgstr ""
@@ -199,6 +174,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr "Định dạng ảnh phụ chưa được cấu hình trước khi dữ liệu truyền đến"
 
+msgid "Failed to get fragment URL."
+msgstr "Gặp lỗi khi lấy URL phân mảnh."
+
+msgid "Internal data stream error."
+msgstr "Lỗi luồng dữ liệu nội bộ."
+
+msgid "Couldn't download fragments"
+msgstr "Không thể tải về các phân mảnh"
+
 msgid "No file name specified for writing."
 msgstr "Chưa chỉ định tên tập tin để ghi vào."
 
@@ -247,6 +231,9 @@
 msgid "Couldn't find details for DVB channel %s"
 msgstr "Không thể tìm thấy chi tiết cho kênh DVB %s"
 
+#~ msgid "Couldn't get the Manifest's URI"
+#~ msgstr "Không thể lấy URI của Manifest"
+
 #~ msgid "Could not write to file \"%s\"."
 #~ msgstr "Không thể ghi vào tập tin “%s”."
 
diff --git a/po/zh_CN.gmo b/po/zh_CN.gmo
index 2837e46..a25acae 100644
--- a/po/zh_CN.gmo
+++ b/po/zh_CN.gmo
Binary files differ
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 1d8fffb..ef1bc2c 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -9,7 +9,7 @@
 msgstr ""
 "Project-Id-Version: gst-plugins-bad 0.10.16.2\n"
 "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n"
-"POT-Creation-Date: 2014-12-18 12:07+0100\n"
+"POT-Creation-Date: 2015-03-17 09:28+0100\n"
 "PO-Revision-Date: 2009-11-20 18:12中国标准时间\n"
 "Last-Translator: Ji ZhengYu <zhengyuji@gmail.com>\n"
 "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
@@ -18,9 +18,6 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-msgid "Internal data stream error."
-msgstr "内部数据流错误。"
-
 msgid "format wasn't negotiated before get function"
 msgstr ""
 
@@ -30,7 +27,7 @@
 msgid ""
 "GStreamer can play audio using any number of output elements. Some possible "
 "choices are osssink, pulsesink and alsasink. The audiosink can be a partial "
-"pipeline instea of just one element."
+"pipeline instead of just one element."
 msgstr ""
 
 msgid "description for default GStreamer sound events audiosink"
@@ -113,6 +110,9 @@
 msgid "Describes the selected visualization element."
 msgstr ""
 
+msgid "OpenCV failed to load template image"
+msgstr ""
+
 msgid "Could not read title information for DVD."
 msgstr "无法读取 DVD 的标题信息。"
 
@@ -135,15 +135,6 @@
 msgid "This file contains no playable streams."
 msgstr ""
 
-msgid "Couldn't get the Manifest's URI"
-msgstr ""
-
-msgid "Failed to get fragment URL."
-msgstr ""
-
-msgid "Couldn't download fragments"
-msgstr ""
-
 #, fuzzy
 msgid "Could not open sndfile stream for reading."
 msgstr "无法以读方式打开文件“%s”。"
@@ -178,6 +169,15 @@
 msgid "Subpicture format was not configured before data flow"
 msgstr ""
 
+msgid "Failed to get fragment URL."
+msgstr ""
+
+msgid "Internal data stream error."
+msgstr "内部数据流错误。"
+
+msgid "Couldn't download fragments"
+msgstr ""
+
 msgid "No file name specified for writing."
 msgstr "未指定写入文件名。"
 
diff --git a/sys/Makefile.am b/sys/Makefile.am
index 28528be..1051ce5 100644
--- a/sys/Makefile.am
+++ b/sys/Makefile.am
@@ -52,12 +52,6 @@
 DECKLINK_DIR=
 endif
 
-if USE_DIRECTDRAW
-DIRECTDRAW_DIR=directdraw
-else
-DIRECTDRAW_DIR=
-endif
-
 if USE_WINKS
 WINKS_DIR=winks
 else
@@ -94,12 +88,6 @@
 LINSYS_DIR=
 endif
 
-if USE_OSX_VIDEO
-OSX_VIDEO_DIR=osxvideo
-else
-OSX_VIDEO_DIR=
-endif
-
 if USE_PVR
 PVR_DIR=pvr2d
 else
@@ -124,12 +112,6 @@
 # QCAM_DIR=
 # endif
 
-if USE_QUICKTIME
-QT_DIR=qtwrapper
-else
-QT_DIR=
-endif
-
 if USE_WININET
 WININET_DIR=wininet
 else
@@ -160,9 +142,9 @@
 UVCH264_DIR=
 endif
 
-SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(OSX_VIDEO_DIR) $(PVR_DIR) $(QT_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR)
+SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(PVR_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR)
 
-DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia applemedia-nonpublic avc bluez d3dvideosink decklink directdraw directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \
-		opensles osxvideo pvr2d qtwrapper shm uvch264 vcd vdpau wasapi wininet winks winscreencap
+DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia applemedia-nonpublic avc bluez d3dvideosink decklink directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \
+		opensles pvr2d shm uvch264 vcd vdpau wasapi wininet winks winscreencap
 
 include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/sys/Makefile.in b/sys/Makefile.in
index b29bc98..45db0d3 100644
--- a/sys/Makefile.in
+++ b/sys/Makefile.in
@@ -93,6 +93,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -106,7 +107,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -223,8 +223,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -263,7 +267,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -271,6 +274,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -320,8 +325,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -400,7 +403,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -409,7 +411,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -422,7 +423,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -447,6 +447,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -520,10 +522,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -549,6 +555,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -585,6 +594,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -625,17 +635,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -652,6 +661,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -725,8 +735,6 @@
 @USE_DIRECT3D_TRUE@D3DVIDEOSINK_DIR = d3dvideosink
 @USE_DECKLINK_FALSE@DECKLINK_DIR = 
 @USE_DECKLINK_TRUE@DECKLINK_DIR = decklink
-@USE_DIRECTDRAW_FALSE@DIRECTDRAW_DIR = 
-@USE_DIRECTDRAW_TRUE@DIRECTDRAW_DIR = directdraw
 @USE_WINKS_FALSE@WINKS_DIR = 
 @USE_WINKS_TRUE@WINKS_DIR = winks
 @USE_DIRECTSOUND_FALSE@DIRECTSOUND_DIR = 
@@ -743,23 +751,19 @@
 # DXR3_DIR=
 # endif
 @USE_LINSYS_TRUE@LINSYS_DIR = linsys
-@USE_OSX_VIDEO_FALSE@OSX_VIDEO_DIR = 
-@USE_OSX_VIDEO_TRUE@OSX_VIDEO_DIR = osxvideo
 @USE_PVR_FALSE@PVR_DIR = 
 @USE_PVR_TRUE@PVR_DIR = pvr2d
 @USE_SHM_FALSE@SHM_DIR = 
 @USE_SHM_TRUE@SHM_DIR = shm
 @USE_OPENSLES_FALSE@OPENSLES_DIR = 
 @USE_OPENSLES_TRUE@OPENSLES_DIR = opensles
-@USE_QUICKTIME_FALSE@QT_DIR = 
+@USE_WININET_FALSE@WININET_DIR = 
 
 # if USE_QCAM
 # QCAM_DIR=qcam
 # else
 # QCAM_DIR=
 # endif
-@USE_QUICKTIME_TRUE@QT_DIR = qtwrapper
-@USE_WININET_FALSE@WININET_DIR = 
 @USE_WININET_TRUE@WININET_DIR = wininet
 @USE_VCD_FALSE@VCD_DIR = 
 @USE_VCD_TRUE@VCD_DIR = vcd
@@ -769,9 +773,9 @@
 @USE_WINSCREENCAP_TRUE@WINSCREENCAP_DIR = winscreencap
 @USE_UVCH264_FALSE@UVCH264_DIR = 
 @USE_UVCH264_TRUE@UVCH264_DIR = uvch264
-SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(OSX_VIDEO_DIR) $(PVR_DIR) $(QT_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR)
-DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia applemedia-nonpublic avc bluez d3dvideosink decklink directdraw directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \
-		opensles osxvideo pvr2d qtwrapper shm uvch264 vcd vdpau wasapi wininet winks winscreencap
+SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(PVR_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR)
+DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia applemedia-nonpublic avc bluez d3dvideosink decklink directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \
+		opensles pvr2d shm uvch264 vcd vdpau wasapi wininet winks winscreencap
 
 all: all-recursive
 
diff --git a/sys/acmenc/Makefile.in b/sys/acmenc/Makefile.in
index d48f0df..2915066 100644
--- a/sys/acmenc/Makefile.in
+++ b/sys/acmenc/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -242,8 +242,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -282,7 +286,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -290,6 +293,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -339,8 +344,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -419,7 +422,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -428,7 +430,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -441,7 +442,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -466,6 +466,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -539,10 +541,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -568,6 +574,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -604,6 +613,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -644,17 +654,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -671,6 +680,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/acmenc/acmenc.c b/sys/acmenc/acmenc.c
index 22ed967..99a0804 100644
--- a/sys/acmenc/acmenc.c
+++ b/sys/acmenc/acmenc.c
@@ -568,7 +568,7 @@
 
   /* register type */
   if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type)) {
-    g_warning ("Failed to register %s", type_name);;
+    g_warning ("Failed to register %s", type_name);
     g_type_set_qdata (type, ACMENC_PARAMS_QDATA, NULL);
     g_free (name);
     g_free (type_name);
diff --git a/sys/acmmp3dec/Makefile.in b/sys/acmmp3dec/Makefile.in
index 2d21ec4..3de5259 100644
--- a/sys/acmmp3dec/Makefile.in
+++ b/sys/acmmp3dec/Makefile.in
@@ -89,6 +89,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -102,7 +103,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -242,8 +242,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -282,7 +286,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -290,6 +293,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -339,8 +344,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -419,7 +422,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -428,7 +430,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -441,7 +442,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -466,6 +466,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -539,10 +541,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -568,6 +574,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -604,6 +613,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -644,17 +654,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -671,6 +680,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/androidmedia/Makefile.am b/sys/androidmedia/Makefile.am
index 3f17588..937ce32 100644
--- a/sys/androidmedia/Makefile.am
+++ b/sys/androidmedia/Makefile.am
@@ -4,14 +4,16 @@
 	gstamc.c \
 	gstamcaudiodec.c \
 	gstamcvideodec.c \
-	gstamcvideoenc.c
+	gstamcvideoenc.c \
+	gstjniutils.c
 
 noinst_HEADERS = \
 	gstamc.h \
 	gstamc-constants.h \
 	gstamcaudiodec.h \
 	gstamcvideodec.h \
-	gstamcvideoenc.h
+	gstamcvideoenc.h \
+	gstjniutils.h
 
 libgstandroidmedia_la_CFLAGS = \
 	$(GST_PLUGINS_BASE_CFLAGS) \
diff --git a/sys/androidmedia/Makefile.in b/sys/androidmedia/Makefile.in
index 47e9a30..9d1d4a0 100644
--- a/sys/androidmedia/Makefile.in
+++ b/sys/androidmedia/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -160,7 +160,8 @@
 am_libgstandroidmedia_la_OBJECTS = libgstandroidmedia_la-gstamc.lo \
 	libgstandroidmedia_la-gstamcaudiodec.lo \
 	libgstandroidmedia_la-gstamcvideodec.lo \
-	libgstandroidmedia_la-gstamcvideoenc.lo
+	libgstandroidmedia_la-gstamcvideoenc.lo \
+	libgstandroidmedia_la-gstjniutils.lo
 libgstandroidmedia_la_OBJECTS = $(am_libgstandroidmedia_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -248,8 +249,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +293,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +300,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +351,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +429,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +437,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +449,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +473,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +548,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +581,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +620,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +661,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +687,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -733,14 +744,16 @@
 	gstamc.c \
 	gstamcaudiodec.c \
 	gstamcvideodec.c \
-	gstamcvideoenc.c
+	gstamcvideoenc.c \
+	gstjniutils.c
 
 noinst_HEADERS = \
 	gstamc.h \
 	gstamc-constants.h \
 	gstamcaudiodec.h \
 	gstamcvideodec.h \
-	gstamcvideoenc.h
+	gstamcvideoenc.h \
+	gstjniutils.h
 
 libgstandroidmedia_la_CFLAGS = \
 	$(GST_PLUGINS_BASE_CFLAGS) \
@@ -842,6 +855,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstandroidmedia_la-gstamcaudiodec.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstandroidmedia_la-gstamcvideodec.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstandroidmedia_la-gstamcvideoenc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstandroidmedia_la-gstjniutils.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -895,6 +909,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstandroidmedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstandroidmedia_la_CFLAGS) $(CFLAGS) -c -o libgstandroidmedia_la-gstamcvideoenc.lo `test -f 'gstamcvideoenc.c' || echo '$(srcdir)/'`gstamcvideoenc.c
 
+libgstandroidmedia_la-gstjniutils.lo: gstjniutils.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstandroidmedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstandroidmedia_la_CFLAGS) $(CFLAGS) -MT libgstandroidmedia_la-gstjniutils.lo -MD -MP -MF $(DEPDIR)/libgstandroidmedia_la-gstjniutils.Tpo -c -o libgstandroidmedia_la-gstjniutils.lo `test -f 'gstjniutils.c' || echo '$(srcdir)/'`gstjniutils.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstandroidmedia_la-gstjniutils.Tpo $(DEPDIR)/libgstandroidmedia_la-gstjniutils.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstjniutils.c' object='libgstandroidmedia_la-gstjniutils.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstandroidmedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstandroidmedia_la_CFLAGS) $(CFLAGS) -c -o libgstandroidmedia_la-gstjniutils.lo `test -f 'gstjniutils.c' || echo '$(srcdir)/'`gstjniutils.c
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
diff --git a/sys/androidmedia/gstamc.c b/sys/androidmedia/gstamc.c
index 36e4372..1f45f31 100644
--- a/sys/androidmedia/gstamc.c
+++ b/sys/androidmedia/gstamc.c
@@ -34,215 +34,12 @@
 #include "gstamcvideodec.h"
 #include "gstamcvideoenc.h"
 #include "gstamcaudiodec.h"
+#include "gstjniutils.h"
 
-#include <gmodule.h>
 #include <gst/gst.h>
 #include <gst/video/video.h>
 #include <gst/audio/audio.h>
 #include <string.h>
-#include <jni.h>
-
-/* getExceptionSummary() and getStackTrace() taken from Android's
- *   platform/libnativehelper/JNIHelp.cpp
- * Modified to work with normal C strings and without C++.
- *
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Returns a human-readable summary of an exception object. The buffer will
- * be populated with the "binary" class name and, if present, the
- * exception message.
- */
-static gchar *
-getExceptionSummary (JNIEnv * env, jthrowable exception)
-{
-  GString *gs = g_string_new ("");
-  jclass exceptionClass = NULL, classClass = NULL;
-  jmethodID classGetNameMethod, getMessage;
-  jstring classNameStr = NULL, messageStr = NULL;
-  const char *classNameChars, *messageChars;
-
-  /* get the name of the exception's class */
-  exceptionClass = (*env)->GetObjectClass (env, exception);
-  classClass = (*env)->GetObjectClass (env, exceptionClass);
-  classGetNameMethod =
-      (*env)->GetMethodID (env, classClass, "getName", "()Ljava/lang/String;");
-
-  classNameStr =
-      (jstring) (*env)->CallObjectMethod (env, exceptionClass,
-      classGetNameMethod);
-
-  if (classNameStr == NULL) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    g_string_append (gs, "<error getting class name>");
-    goto done;
-  }
-
-  classNameChars = (*env)->GetStringUTFChars (env, classNameStr, NULL);
-  if (classNameChars == NULL) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    g_string_append (gs, "<error getting class name UTF-8>");
-    goto done;
-  }
-
-  g_string_append (gs, classNameChars);
-
-  (*env)->ReleaseStringUTFChars (env, classNameStr, classNameChars);
-
-  /* if the exception has a detail message, get that */
-  getMessage =
-      (*env)->GetMethodID (env, exceptionClass, "getMessage",
-      "()Ljava/lang/String;");
-  messageStr = (jstring) (*env)->CallObjectMethod (env, exception, getMessage);
-  if (messageStr == NULL) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    goto done;
-  }
-  g_string_append (gs, ": ");
-
-  messageChars = (*env)->GetStringUTFChars (env, messageStr, NULL);
-  if (messageChars != NULL) {
-    g_string_append (gs, messageChars);
-    (*env)->ReleaseStringUTFChars (env, messageStr, messageChars);
-  } else {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    g_string_append (gs, "<error getting message>");
-  }
-
-done:
-  if (exceptionClass)
-    (*env)->DeleteLocalRef (env, exceptionClass);
-  if (classClass)
-    (*env)->DeleteLocalRef (env, classClass);
-  if (classNameStr)
-    (*env)->DeleteLocalRef (env, classNameStr);
-  if (messageStr)
-    (*env)->DeleteLocalRef (env, messageStr);
-
-  return g_string_free (gs, FALSE);
-}
-
-/*
- * Returns an exception (with stack trace) as a string.
- */
-static gchar *
-getStackTrace (JNIEnv * env, jthrowable exception)
-{
-  GString *gs = g_string_new ("");
-  jclass stringWriterClass = NULL, printWriterClass = NULL;
-  jclass exceptionClass = NULL;
-  jmethodID stringWriterCtor, stringWriterToStringMethod;
-  jmethodID printWriterCtor, printStackTraceMethod;
-  jobject stringWriter = NULL, printWriter = NULL;
-  jstring messageStr = NULL;
-  const char *utfChars;
-
-  stringWriterClass = (*env)->FindClass (env, "java/io/StringWriter");
-
-  if (stringWriterClass == NULL) {
-    g_string_append (gs, "<error getting java.io.StringWriter class>");
-    goto done;
-  }
-
-  stringWriterCtor =
-      (*env)->GetMethodID (env, stringWriterClass, "<init>", "()V");
-  stringWriterToStringMethod =
-      (*env)->GetMethodID (env, stringWriterClass, "toString",
-      "()Ljava/lang/String;");
-
-  printWriterClass = (*env)->FindClass (env, "java/io/PrintWriter");
-  if (printWriterClass == NULL) {
-    g_string_append (gs, "<error getting java.io.PrintWriter class>");
-    goto done;
-  }
-
-  printWriterCtor =
-      (*env)->GetMethodID (env, printWriterClass, "<init>",
-      "(Ljava/io/Writer;)V");
-  stringWriter = (*env)->NewObject (env, stringWriterClass, stringWriterCtor);
-  if (stringWriter == NULL) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    g_string_append (gs, "<error creating new StringWriter instance>");
-    goto done;
-  }
-
-  printWriter =
-      (*env)->NewObject (env, printWriterClass, printWriterCtor, stringWriter);
-  if (printWriter == NULL) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    g_string_append (gs, "<error creating new PrintWriter instance>");
-    goto done;
-  }
-
-  exceptionClass = (*env)->GetObjectClass (env, exception);
-  printStackTraceMethod =
-      (*env)->GetMethodID (env, exceptionClass, "printStackTrace",
-      "(Ljava/io/PrintWriter;)V");
-  (*env)->CallVoidMethod (env, exception, printStackTraceMethod, printWriter);
-  if ((*env)->ExceptionCheck (env)) {
-    (*env)->ExceptionClear (env);
-    g_string_append (gs, "<exception while printing stack trace>");
-    goto done;
-  }
-
-  messageStr = (jstring) (*env)->CallObjectMethod (env, stringWriter,
-      stringWriterToStringMethod);
-  if (messageStr == NULL) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    g_string_append (gs, "<failed to call StringWriter.toString()>");
-    goto done;
-  }
-
-  utfChars = (*env)->GetStringUTFChars (env, messageStr, NULL);
-  if (utfChars == NULL) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    g_string_append (gs, "<failed to get UTF chars for message>");
-    goto done;
-  }
-
-  g_string_append (gs, utfChars);
-
-  (*env)->ReleaseStringUTFChars (env, messageStr, utfChars);
-
-done:
-  if (stringWriterClass)
-    (*env)->DeleteLocalRef (env, stringWriterClass);
-  if (printWriterClass)
-    (*env)->DeleteLocalRef (env, printWriterClass);
-  if (exceptionClass)
-    (*env)->DeleteLocalRef (env, exceptionClass);
-  if (stringWriter)
-    (*env)->DeleteLocalRef (env, stringWriter);
-  if (printWriter)
-    (*env)->DeleteLocalRef (env, printWriter);
-  if (messageStr)
-    (*env)->DeleteLocalRef (env, messageStr);
-
-  return g_string_free (gs, FALSE);
-}
-
-#include <pthread.h>
 
 GST_DEBUG_CATEGORY (gst_amc_debug);
 #define GST_CAT_DEFAULT gst_amc_debug
@@ -256,13 +53,6 @@
 static gboolean ignore_unknown_color_formats = FALSE;
 #endif
 
-static GModule *java_module;
-static jint (*get_created_java_vms) (JavaVM ** vmBuf, jsize bufLen,
-    jsize * nVMs);
-static jint (*create_java_vm) (JavaVM ** p_vm, JNIEnv ** p_env, void *vm_args);
-static JavaVM *java_vm;
-static gboolean started_java_vm = FALSE;
-
 static gboolean accepted_color_formats (GstAmcCodecType * type,
     gboolean is_encoder);
 
@@ -315,233 +105,6 @@
   jmethodID set_byte_buffer;
 } media_format;
 
-static pthread_key_t current_jni_env;
-
-static JNIEnv *
-gst_amc_attach_current_thread (void)
-{
-  JNIEnv *env;
-  JavaVMAttachArgs args;
-
-  GST_DEBUG ("Attaching thread %p", g_thread_self ());
-  args.version = JNI_VERSION_1_6;
-  args.name = NULL;
-  args.group = NULL;
-
-  if ((*java_vm)->AttachCurrentThread (java_vm, &env, &args) < 0) {
-    GST_ERROR ("Failed to attach current thread");
-    return NULL;
-  }
-
-  return env;
-}
-
-static void
-gst_amc_detach_current_thread (void *env)
-{
-  GST_DEBUG ("Detaching thread %p", g_thread_self ());
-  (*java_vm)->DetachCurrentThread (java_vm);
-}
-
-static JNIEnv *
-gst_amc_get_jni_env (void)
-{
-  JNIEnv *env;
-
-  if ((env = pthread_getspecific (current_jni_env)) == NULL) {
-    env = gst_amc_attach_current_thread ();
-    pthread_setspecific (current_jni_env, env);
-  }
-
-  return env;
-}
-
-static gboolean
-check_nativehelper (void)
-{
-  GModule *module;
-  void **jni_invocation = NULL;
-  gboolean ret = FALSE;
-
-  module = g_module_open (NULL, G_MODULE_BIND_LOCAL);
-  if (!module)
-    return ret;
-
-  /* Check if libnativehelper is loaded in the process and if
-   * it has these awful wrappers for JNI_CreateJavaVM and
-   * JNI_GetCreatedJavaVMs that crash the app if you don't
-   * create a JniInvocation instance first. If it isn't we
-   * just fail here and don't initialize anything.
-   * See this code for reference:
-   * https://android.googlesource.com/platform/libnativehelper/+/master/JniInvocation.cpp
-   */
-  if (!g_module_symbol (module, "_ZN13JniInvocation15jni_invocation_E",
-          (gpointer *) & jni_invocation)) {
-    ret = TRUE;
-  } else {
-    ret = (jni_invocation != NULL && *jni_invocation != NULL);
-  }
-
-  g_module_close (module);
-
-  return ret;
-}
-
-static gboolean
-load_java_module (const gchar * name)
-{
-  java_module = g_module_open (name, G_MODULE_BIND_LOCAL);
-  if (!java_module)
-    goto load_failed;
-
-  if (!g_module_symbol (java_module, "JNI_CreateJavaVM",
-          (gpointer *) & create_java_vm))
-    goto symbol_error;
-
-  if (!g_module_symbol (java_module, "JNI_GetCreatedJavaVMs",
-          (gpointer *) & get_created_java_vms))
-    goto symbol_error;
-
-  return TRUE;
-
-load_failed:
-  {
-    GST_ERROR ("Failed to load Java module '%s': %s", GST_STR_NULL (name),
-        g_module_error ());
-    return FALSE;
-  }
-symbol_error:
-  {
-    GST_ERROR ("Failed to locate required JNI symbols in '%s': %s",
-        GST_STR_NULL (name), g_module_error ());
-    g_module_close (java_module);
-    java_module = NULL;
-    return FALSE;
-  }
-}
-
-static gboolean
-initialize_java_vm (void)
-{
-  jsize n_vms;
-
-  /* Returns TRUE if we can safely
-   * a) get the current VMs and
-   * b) start a VM if none is started yet
-   *
-   * FIXME: On Android >= 4.4 we won't be able to safely start a
-   * VM on our own without using private C++ API!
-   */
-  if (!check_nativehelper ()) {
-    GST_ERROR ("Can't safely check for VMs or start a VM");
-    return FALSE;
-  }
-
-  if (!load_java_module (NULL)) {
-    if (!load_java_module ("libdvm"))
-      return FALSE;
-  }
-
-  n_vms = 0;
-  if (get_created_java_vms (&java_vm, 1, &n_vms) < 0)
-    goto get_created_failed;
-
-  if (n_vms > 0) {
-    GST_DEBUG ("Successfully got existing Java VM %p", java_vm);
-  } else {
-    JNIEnv *env;
-    JavaVMInitArgs vm_args;
-    JavaVMOption options[4];
-
-    GST_DEBUG ("Found no existing Java VM, trying to start one");
-
-    options[0].optionString = "-verbose:jni";
-    options[1].optionString = "-verbose:gc";
-    options[2].optionString = "-Xcheck:jni";
-    options[3].optionString = "-Xdebug";
-
-    vm_args.version = JNI_VERSION_1_4;
-    vm_args.options = options;
-    vm_args.nOptions = 4;
-    vm_args.ignoreUnrecognized = JNI_TRUE;
-    if (create_java_vm (&java_vm, &env, &vm_args) < 0)
-      goto create_failed;
-    GST_DEBUG ("Successfully created Java VM %p", java_vm);
-
-    started_java_vm = TRUE;
-  }
-
-  return java_vm != NULL;
-
-get_created_failed:
-  {
-    GST_ERROR ("Failed to get already created VMs");
-    g_module_close (java_module);
-    java_module = NULL;
-    return FALSE;
-  }
-create_failed:
-  {
-    GST_ERROR ("Failed to create a Java VM");
-    g_module_close (java_module);
-    java_module = NULL;
-    return FALSE;
-  }
-}
-
-static void
-gst_amc_set_error_string (JNIEnv * env, GQuark domain, gint code, GError ** err,
-    const gchar * message)
-{
-  jthrowable exception;
-
-  if (!err) {
-    if ((*env)->ExceptionCheck (env))
-      (*env)->ExceptionClear (env);
-    return;
-  }
-
-  if ((*env)->ExceptionCheck (env)) {
-    if ((exception = (*env)->ExceptionOccurred (env))) {
-      gchar *exception_description, *exception_stacktrace;
-
-      /* Clear exception so that we can call Java methods again */
-      (*env)->ExceptionClear (env);
-
-      exception_description = getExceptionSummary (env, exception);
-      exception_stacktrace = getStackTrace (env, exception);
-      g_set_error (err, domain, code, "%s: %s\n%s", message,
-          exception_description, exception_stacktrace);
-      g_free (exception_description);
-      g_free (exception_stacktrace);
-
-      (*env)->DeleteLocalRef (env, exception);
-    } else {
-      (*env)->ExceptionClear (env);
-      g_set_error (err, domain, code, "%s", message);
-    }
-  } else {
-    g_set_error (err, domain, code, "%s", message);
-  }
-}
-
-G_GNUC_PRINTF (5, 6)
-     static void
-         gst_amc_set_error (JNIEnv * env, GQuark domain, gint code,
-    GError ** err, const gchar * format, ...)
-{
-  gchar *message;
-  va_list var_args;
-
-  va_start (var_args, format);
-  message = g_strdup_vprintf (format, var_args);
-  va_end (var_args);
-
-  gst_amc_set_error_string (env, domain, code, err, message);
-
-  g_free (message);
-}
-
 GstAmcCodec *
 gst_amc_codec_new (const gchar * name, GError ** err)
 {
@@ -552,11 +115,11 @@
 
   g_return_val_if_fail (name != NULL, NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   name_str = (*env)->NewStringUTF (env, name);
   if (name_str == NULL) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create Java String");
     goto error;
   }
@@ -567,14 +130,14 @@
       (*env)->CallStaticObjectMethod (env, media_codec.klass,
       media_codec.create_by_codec_name, name_str);
   if ((*env)->ExceptionCheck (env) || !object) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create codec '%s'", name);
     goto error;
   }
 
   codec->object = (*env)->NewGlobalRef (env, object);
   if (!codec->object) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create global codec reference");
     goto error;
   }
@@ -602,7 +165,7 @@
 
   g_return_if_fail (codec != NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
   (*env)->DeleteGlobalRef (env, codec->object);
   g_slice_free (GstAmcCodec, codec);
 }
@@ -617,13 +180,13 @@
   g_return_val_if_fail (codec != NULL, FALSE);
   g_return_val_if_fail (format != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   (*env)->CallVoidMethod (env, codec->object, media_codec.configure,
       format->object, NULL, NULL, flags);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_SETTINGS, err,
-        "Failed to configure codec");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_SETTINGS,
+        err, "Failed to configure codec");
     ret = FALSE;
     goto done;
   }
@@ -642,14 +205,14 @@
 
   g_return_val_if_fail (codec != NULL, NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   object =
       (*env)->CallObjectMethod (env, codec->object,
       media_codec.get_output_format);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_SETTINGS, err,
-        "Failed to get output format");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_SETTINGS,
+        err, "Failed to get output format");
     goto done;
   }
 
@@ -657,8 +220,8 @@
 
   ret->object = (*env)->NewGlobalRef (env, object);
   if (!ret->object) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_SETTINGS, err,
-        "Failed to create global format reference");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_SETTINGS,
+        err, "Failed to create global format reference");
     g_slice_free (GstAmcFormat, ret);
     ret = NULL;
   }
@@ -678,12 +241,12 @@
 
   g_return_val_if_fail (codec != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   (*env)->CallVoidMethod (env, codec->object, media_codec.start);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to start codec");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to start codec");
     ret = FALSE;
     goto done;
   }
@@ -701,12 +264,12 @@
 
   g_return_val_if_fail (codec != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   (*env)->CallVoidMethod (env, codec->object, media_codec.stop);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to stop codec");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to stop codec");
     ret = FALSE;
     goto done;
   }
@@ -724,12 +287,12 @@
 
   g_return_val_if_fail (codec != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   (*env)->CallVoidMethod (env, codec->object, media_codec.flush);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to flush codec");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to flush codec");
     ret = FALSE;
     goto done;
   }
@@ -747,12 +310,12 @@
 
   g_return_val_if_fail (codec != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   (*env)->CallVoidMethod (env, codec->object, media_codec.release);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to release codec");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to release codec");
     ret = FALSE;
     goto done;
   }
@@ -770,7 +333,7 @@
 
   g_return_if_fail (buffers != NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   for (i = 0; i < n_buffers; i++) {
     if (buffers[i].object)
@@ -793,21 +356,21 @@
   g_return_val_if_fail (n_buffers != NULL, NULL);
 
   *n_buffers = 0;
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   output_buffers =
       (*env)->CallObjectMethod (env, codec->object,
       media_codec.get_output_buffers);
   if ((*env)->ExceptionCheck (env) || !output_buffers) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get output buffers");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get output buffers");
     goto done;
   }
 
   n_output_buffers = (*env)->GetArrayLength (env, output_buffers);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get output buffers array length");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get output buffers array length");
     goto done;
   }
 
@@ -819,23 +382,23 @@
 
     buffer = (*env)->GetObjectArrayElement (env, output_buffers, i);
     if ((*env)->ExceptionCheck (env) || !buffer) {
-      gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-          "Failed to get output buffer %d", i);
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+          err, "Failed to get output buffer %d", i);
       goto error;
     }
 
     ret[i].object = (*env)->NewGlobalRef (env, buffer);
     (*env)->DeleteLocalRef (env, buffer);
     if (!ret[i].object) {
-      gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-          "Failed to create global output buffer reference %d", i);
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+          err, "Failed to create global output buffer reference %d", i);
       goto error;
     }
 
     ret[i].data = (*env)->GetDirectBufferAddress (env, ret[i].object);
     if (!ret[i].data) {
-      gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-          "Failed to get output buffer address %d", i);
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+          err, "Failed to get output buffer address %d", i);
       goto error;
     }
     ret[i].size = (*env)->GetDirectBufferCapacity (env, ret[i].object);
@@ -869,21 +432,21 @@
   g_return_val_if_fail (n_buffers != NULL, NULL);
 
   *n_buffers = 0;
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   input_buffers =
       (*env)->CallObjectMethod (env, codec->object,
       media_codec.get_input_buffers);
   if ((*env)->ExceptionCheck (env) || !input_buffers) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get input buffers");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get input buffers");
     goto done;
   }
 
   n_input_buffers = (*env)->GetArrayLength (env, input_buffers);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get input buffers array length");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get input buffers array length");
     goto done;
   }
 
@@ -895,23 +458,23 @@
 
     buffer = (*env)->GetObjectArrayElement (env, input_buffers, i);
     if ((*env)->ExceptionCheck (env) || !buffer) {
-      gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-          "Failed to get input buffer %d", i);
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+          err, "Failed to get input buffer %d", i);
       goto error;
     }
 
     ret[i].object = (*env)->NewGlobalRef (env, buffer);
     (*env)->DeleteLocalRef (env, buffer);
     if (!ret[i].object) {
-      gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-          "Failed to create global input buffer reference %d", i);
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+          err, "Failed to create global input buffer reference %d", i);
       goto error;
     }
 
     ret[i].data = (*env)->GetDirectBufferAddress (env, ret[i].object);
     if (!ret[i].data) {
-      gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-          "Failed to get input buffer address %d", i);
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+          err, "Failed to get input buffer address %d", i);
       goto error;
     }
     ret[i].size = (*env)->GetDirectBufferCapacity (env, ret[i].object);
@@ -940,14 +503,14 @@
 
   g_return_val_if_fail (codec != NULL, G_MININT);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   ret =
       (*env)->CallIntMethod (env, codec->object,
       media_codec.dequeue_input_buffer, timeoutUs);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to dequeue input buffer");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to dequeue input buffer");
     ret = G_MININT;
     goto done;
   }
@@ -966,16 +529,16 @@
   info->flags =
       (*env)->GetIntField (env, buffer_info, media_codec_buffer_info.flags);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get buffer info flags");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get buffer info flags");
     return FALSE;
   }
 
   info->offset =
       (*env)->GetIntField (env, buffer_info, media_codec_buffer_info.offset);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get buffer info offset");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get buffer info offset");
     return FALSE;
   }
 
@@ -983,8 +546,8 @@
       (*env)->GetLongField (env, buffer_info,
       media_codec_buffer_info.presentation_time_us);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get buffer info pts");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get buffer info pts");
     return FALSE;
   }
 
@@ -992,8 +555,8 @@
       (*env)->GetIntField (env, buffer_info, media_codec_buffer_info.size);
   if ((*env)->ExceptionCheck (env)) {
     (*env)->ExceptionClear (env);
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get buffer info size");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get buffer info size");
     return FALSE;
   }
 
@@ -1010,14 +573,14 @@
 
   g_return_val_if_fail (codec != NULL, G_MININT);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   info_o =
       (*env)->NewObject (env, media_codec_buffer_info.klass,
       media_codec_buffer_info.constructor);
   if (!info_o) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create buffer info instance");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create buffer info instance");
     goto done;
   }
 
@@ -1025,8 +588,8 @@
       (*env)->CallIntMethod (env, codec->object,
       media_codec.dequeue_output_buffer, info_o, timeoutUs);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to dequeue output buffer");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to dequeue output buffer");
     ret = G_MININT;
     goto done;
   }
@@ -1054,13 +617,13 @@
   g_return_val_if_fail (codec != NULL, FALSE);
   g_return_val_if_fail (info != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   (*env)->CallVoidMethod (env, codec->object, media_codec.queue_input_buffer,
       index, info->offset, info->size, info->presentation_time_us, info->flags);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to queue input buffer");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to queue input buffer");
     ret = FALSE;
     goto done;
   }
@@ -1079,13 +642,13 @@
 
   g_return_val_if_fail (codec != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   (*env)->CallVoidMethod (env, codec->object, media_codec.release_output_buffer,
       index, JNI_FALSE);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to release output buffer");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to release output buffer");
     ret = FALSE;
     goto done;
   }
@@ -1106,11 +669,11 @@
 
   g_return_val_if_fail (mime != NULL, NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   mime_str = (*env)->NewStringUTF (env, mime);
   if (mime_str == NULL) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create Java string");
     goto error;
   }
@@ -1121,14 +684,14 @@
       (*env)->CallStaticObjectMethod (env, media_format.klass,
       media_format.create_audio_format, mime_str, sample_rate, channels);
   if ((*env)->ExceptionCheck (env) || !object) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create format instance '%s'", mime);
     goto error;
   }
 
   format->object = (*env)->NewGlobalRef (env, object);
   if (!format->object) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create global format reference");
     goto error;
   }
@@ -1160,11 +723,11 @@
 
   g_return_val_if_fail (mime != NULL, NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   mime_str = (*env)->NewStringUTF (env, mime);
   if (mime_str == NULL) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create Java string");
     goto error;
   }
@@ -1175,14 +738,14 @@
       (*env)->CallStaticObjectMethod (env, media_format.klass,
       media_format.create_video_format, mime_str, width, height);
   if ((*env)->ExceptionCheck (env) || !object) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create format instance '%s'", mime);
     goto error;
   }
 
   format->object = (*env)->NewGlobalRef (env, object);
   if (!format->object) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_INIT, err,
         "Failed to create global format reference");
     goto error;
   }
@@ -1210,7 +773,7 @@
 
   g_return_if_fail (format != NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
   (*env)->DeleteGlobalRef (env, format->object);
   g_slice_free (GstAmcFormat, format);
 }
@@ -1225,20 +788,20 @@
 
   g_return_val_if_fail (format != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   v_str =
       (*env)->CallObjectMethod (env, format->object, media_format.to_string);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to convert format to string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to convert format to string");
     goto done;
   }
 
   v = (*env)->GetStringUTFChars (env, v_str, NULL);
   if (!v) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to get UTF8 string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to get UTF8 string");
     goto done;
   }
 
@@ -1264,12 +827,12 @@
   g_return_val_if_fail (format != NULL, FALSE);
   g_return_val_if_fail (key != NULL, FALSE);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
@@ -1277,8 +840,8 @@
       (*env)->CallBooleanMethod (env, format->object, media_format.contains_key,
       key_str);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to check if format contains key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to check if format contains key '%s'", key);
     goto done;
   }
 
@@ -1302,12 +865,12 @@
   g_return_val_if_fail (value != NULL, FALSE);
 
   *value = 0;
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
@@ -1315,8 +878,8 @@
       (*env)->CallFloatMethod (env, format->object, media_format.get_float,
       key_str);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed get float key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed get float key '%s'", key);
     goto done;
   }
   ret = TRUE;
@@ -1338,20 +901,20 @@
   g_return_if_fail (format != NULL);
   g_return_if_fail (key != NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
   (*env)->CallVoidMethod (env, format->object, media_format.set_float, key_str,
       value);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed set float key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed set float key '%s'", key);
     goto done;
   }
 
@@ -1373,12 +936,12 @@
   g_return_val_if_fail (value != NULL, FALSE);
 
   *value = 0;
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
@@ -1386,8 +949,8 @@
       (*env)->CallIntMethod (env, format->object, media_format.get_integer,
       key_str);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed get integer key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed get integer key '%s'", key);
     goto done;
   }
   ret = TRUE;
@@ -1410,20 +973,20 @@
   g_return_if_fail (format != NULL);
   g_return_if_fail (key != NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
   (*env)->CallVoidMethod (env, format->object, media_format.set_integer,
       key_str, value);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed set integer key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed set integer key '%s'", key);
     goto done;
   }
 
@@ -1447,12 +1010,12 @@
   g_return_val_if_fail (value != NULL, FALSE);
 
   *value = 0;
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
@@ -1460,15 +1023,15 @@
       (*env)->CallObjectMethod (env, format->object, media_format.get_string,
       key_str);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed get string key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed get string key '%s'", key);
     goto done;
   }
 
   v = (*env)->GetStringUTFChars (env, v_str, NULL);
   if (!v) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed get string UTF8 characters");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed get string UTF8 characters");
     goto done;
   }
 
@@ -1499,27 +1062,27 @@
   g_return_if_fail (key != NULL);
   g_return_if_fail (value != NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
   v_str = (*env)->NewStringUTF (env, value);
   if (!v_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
   (*env)->CallVoidMethod (env, format->object, media_format.set_string, key_str,
       v_str);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed set string key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed set string key '%s'", key);
     goto done;
   }
 
@@ -1546,27 +1109,27 @@
 
   *data = NULL;
   *size = 0;
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
   v = (*env)->CallObjectMethod (env, format->object,
       media_format.get_byte_buffer, key_str);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed get buffer key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed get buffer key '%s'", key);
     goto done;
   }
 
   *data = (*env)->GetDirectBufferAddress (env, v);
   if (!data) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed get buffer address");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed get buffer address");
     goto done;
   }
   *size = (*env)->GetDirectBufferCapacity (env, v);
@@ -1595,28 +1158,28 @@
   g_return_if_fail (key != NULL);
   g_return_if_fail (data != NULL);
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   key_str = (*env)->NewStringUTF (env, key);
   if (!key_str) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed to create Java string");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to create Java string");
     goto done;
   }
 
   /* FIXME: The memory must remain valid until the codec is stopped */
   v = (*env)->NewDirectByteBuffer (env, data, size);
   if (!v) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed create Java byte buffer");
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed create Java byte buffer");
     goto done;
   }
 
   (*env)->CallVoidMethod (env, format->object, media_format.set_byte_buffer,
       key_str, v);
   if ((*env)->ExceptionCheck (env)) {
-    gst_amc_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, err,
-        "Failed set buffer key '%s'", key);
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed set buffer key '%s'", key);
     goto done;
   }
 
@@ -1636,7 +1199,7 @@
 
   GST_DEBUG ("Retrieving Java classes");
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   tmp = (*env)->FindClass (env, "java/lang/String");
   if (!tmp) {
@@ -1968,7 +1531,7 @@
     return TRUE;
   }
 
-  env = gst_amc_get_jni_env ();
+  env = gst_amc_jni_get_env ();
 
   codec_list_class = (*env)->FindClass (env, "android/media/MediaCodecList");
   if (!codec_list_class) {
@@ -2006,7 +1569,7 @@
     goto done;
   }
 
-  GST_LOG ("Found %d available codecs", codec_count);
+  GST_INFO ("Found %d available codecs", codec_count);
 
   for (i = 0; i < codec_count; i++) {
     GstAmcCodecInfo *gst_codec_info;
@@ -2108,7 +1671,8 @@
      * VM via the non-public AndroidRuntime class. Can we somehow
      * initialize all this?
      */
-    if (started_java_vm && !g_str_has_prefix (name_str, "OMX.google.")) {
+    if (gst_amc_jni_is_vm_started () &&
+        !g_str_has_prefix (name_str, "OMX.google.")) {
       GST_INFO ("Skipping non-Google codec '%s' in standalone mode", name_str);
       valid_codec = FALSE;
       goto next_codec;
@@ -3709,9 +3273,7 @@
 
   GST_DEBUG_CATEGORY_INIT (gst_amc_debug, "amc", 0, "android-media-codec");
 
-  pthread_key_create (&current_jni_env, gst_amc_detach_current_thread);
-
-  if (!initialize_java_vm ())
+  if (!gst_amc_jni_initialize ())
     return FALSE;
 
   gst_plugin_add_dependency_simple (plugin, NULL, "/etc", "media_codecs.xml",
diff --git a/sys/androidmedia/gstamcaudiodec.c b/sys/androidmedia/gstamcaudiodec.c
index 5ee745f..034591e 100644
--- a/sys/androidmedia/gstamcaudiodec.c
+++ b/sys/androidmedia/gstamcaudiodec.c
@@ -466,16 +466,16 @@
           goto get_output_buffers_error;
 
         goto retry;
-        break;
+
       }
       case INFO_TRY_AGAIN_LATER:
         GST_DEBUG_OBJECT (self, "Dequeueing output buffer timed out");
         goto retry;
-        break;
+
       case G_MININT:
         GST_ERROR_OBJECT (self, "Failure dequeueing output buffer");
         goto dequeue_error;
-        break;
+
       default:
         g_assert_not_reached ();
         break;
@@ -492,7 +492,6 @@
   is_eos = ! !(buffer_info.flags & BUFFER_FLAG_END_OF_STREAM);
 
   if (buffer_info.size > 0) {
-    GstAmcAudioDecClass *klass = GST_AMC_AUDIO_DEC_GET_CLASS (self);
     GstBuffer *outbuf;
     GstAmcBuffer *buf;
     GstMapInfo minfo;
@@ -550,7 +549,6 @@
         nframes);
   }
 
-done:
   if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) {
     if (self->flushing) {
       g_clear_error (&err);
@@ -592,6 +590,10 @@
     gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -602,6 +604,10 @@
     gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -616,6 +622,10 @@
     gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 failed_release:
@@ -625,6 +635,10 @@
     gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 flushing:
@@ -655,6 +669,10 @@
       gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     }
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -666,6 +684,10 @@
     gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 invalid_buffer_size:
@@ -680,6 +702,10 @@
     gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -695,6 +721,10 @@
     gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_AUDIO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 }
@@ -706,7 +736,7 @@
 
   self = GST_AMC_AUDIO_DEC (decoder);
   self->last_upstream_ts = 0;
-  self->eos = FALSE;
+  self->drained = TRUE;
   self->downstream_flow_ret = GST_FLOW_OK;
   self->started = FALSE;
   self->flushing = TRUE;
@@ -747,7 +777,7 @@
   self->codec_datas = NULL;
 
   self->downstream_flow_ret = GST_FLOW_FLUSHING;
-  self->eos = FALSE;
+  self->drained = TRUE;
   g_mutex_lock (&self->drain_lock);
   self->draining = FALSE;
   g_cond_broadcast (&self->drain_cond);
@@ -978,7 +1008,7 @@
 
   /* Start the srcpad loop again */
   self->last_upstream_ts = 0;
-  self->eos = FALSE;
+  self->drained = TRUE;
   self->downstream_flow_ret = GST_FLOW_OK;
   gst_pad_start_task (GST_AUDIO_DECODER_SRC_PAD (self),
       (GstTaskFunction) gst_amc_audio_dec_loop, decoder, NULL);
@@ -1017,13 +1047,6 @@
     return GST_FLOW_NOT_NEGOTIATED;
   }
 
-  if (self->eos) {
-    GST_WARNING_OBJECT (self, "Got frame after EOS");
-    if (inbuf)
-      gst_buffer_unref (inbuf);
-    return GST_FLOW_EOS;
-  }
-
   if (self->flushing)
     goto flushing;
 
@@ -1132,6 +1155,7 @@
       }
       goto queue_error;
     }
+    self->drained = FALSE;
   }
   gst_buffer_unmap (inbuf, &minfo);
   gst_buffer_unref (inbuf);
@@ -1200,9 +1224,9 @@
     return GST_FLOW_OK;
   }
 
-  /* Don't send EOS buffer twice, this doesn't work */
-  if (self->eos) {
-    GST_DEBUG_OBJECT (self, "Codec is EOS already");
+  /* Don't send drain buffer twice, this doesn't work */
+  if (self->drained) {
+    GST_DEBUG_OBJECT (self, "Codec is drained already");
     return GST_FLOW_OK;
   }
 
@@ -1246,6 +1270,8 @@
       }
     }
 
+    self->drained = TRUE;
+    self->draining = FALSE;
     g_mutex_unlock (&self->drain_lock);
     GST_AUDIO_DECODER_STREAM_LOCK (self);
   } else if (idx >= self->n_input_buffers) {
diff --git a/sys/androidmedia/gstamcaudiodec.h b/sys/androidmedia/gstamcaudiodec.h
index dc435fe..6c6124e 100644
--- a/sys/androidmedia/gstamcaudiodec.h
+++ b/sys/androidmedia/gstamcaudiodec.h
@@ -78,9 +78,8 @@
   GCond drain_cond;
   /* TRUE if EOS buffers shouldn't be forwarded */
   gboolean draining;
-
-  /* TRUE if upstream is EOS */
-  gboolean eos;
+  /* TRUE if the component is drained currently */
+  gboolean drained;
 
   GstFlowReturn downstream_flow_ret;
 };
diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c
index dc9a5cd..00f9b18 100644
--- a/sys/androidmedia/gstamcvideodec.c
+++ b/sys/androidmedia/gstamcvideodec.c
@@ -88,8 +88,7 @@
 static gboolean gst_amc_video_dec_decide_allocation (GstVideoDecoder * bdec,
     GstQuery * query);
 
-static GstFlowReturn gst_amc_video_dec_drain (GstAmcVideoDec * self,
-    gboolean at_eos);
+static GstFlowReturn gst_amc_video_dec_drain (GstAmcVideoDec * self);
 
 enum
 {
@@ -653,16 +652,13 @@
           goto get_output_buffers_error;
 
         goto retry;
-        break;
       }
       case INFO_TRY_AGAIN_LATER:
         GST_DEBUG_OBJECT (self, "Dequeueing output buffer timed out");
         goto retry;
-        break;
       case G_MININT:
         GST_ERROR_OBJECT (self, "Failure dequeueing output buffer");
         goto dequeue_error;
-        break;
       default:
         g_assert_not_reached ();
         break;
@@ -789,6 +785,10 @@
     gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -799,6 +799,10 @@
     gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -813,6 +817,10 @@
     gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 failed_release:
@@ -822,6 +830,10 @@
     gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 flushing:
@@ -852,6 +864,10 @@
       gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
     }
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -863,6 +879,10 @@
     gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_NOT_NEGOTIATED;
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 }
@@ -874,7 +894,7 @@
 
   self = GST_AMC_VIDEO_DEC (decoder);
   self->last_upstream_ts = 0;
-  self->eos = FALSE;
+  self->drained = TRUE;
   self->downstream_flow_ret = GST_FLOW_OK;
   self->started = FALSE;
   self->flushing = TRUE;
@@ -909,7 +929,7 @@
   gst_pad_stop_task (GST_VIDEO_DECODER_SRC_PAD (decoder));
 
   self->downstream_flow_ret = GST_FLOW_FLUSHING;
-  self->eos = FALSE;
+  self->drained = TRUE;
   g_mutex_lock (&self->drain_lock);
   self->draining = FALSE;
   g_cond_broadcast (&self->drain_cond);
@@ -983,7 +1003,7 @@
   }
 
   if (needs_disable && is_format_change) {
-    gst_amc_video_dec_drain (self, FALSE);
+    gst_amc_video_dec_drain (self);
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
     gst_amc_video_dec_stop (GST_VIDEO_DECODER (self));
     GST_VIDEO_DECODER_STREAM_LOCK (self);
@@ -1104,7 +1124,7 @@
 
   /* Start the srcpad loop again */
   self->last_upstream_ts = 0;
-  self->eos = FALSE;
+  self->drained = TRUE;
   self->downstream_flow_ret = GST_FLOW_OK;
   gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self),
       (GstTaskFunction) gst_amc_video_dec_loop, decoder, NULL);
@@ -1139,12 +1159,6 @@
     return GST_FLOW_NOT_NEGOTIATED;
   }
 
-  if (self->eos) {
-    GST_WARNING_OBJECT (self, "Got frame after EOS");
-    gst_video_codec_frame_unref (frame);
-    return GST_FLOW_EOS;
-  }
-
   if (self->flushing)
     goto flushing;
 
@@ -1254,6 +1268,7 @@
       }
       goto queue_error;
     }
+    self->drained = FALSE;
   }
 
   gst_buffer_unmap (frame->input_buffer, &minfo);
@@ -1312,11 +1327,11 @@
 
   self = GST_AMC_VIDEO_DEC (decoder);
 
-  return gst_amc_video_dec_drain (self, TRUE);
+  return gst_amc_video_dec_drain (self);
 }
 
 static GstFlowReturn
-gst_amc_video_dec_drain (GstAmcVideoDec * self, gboolean at_eos)
+gst_amc_video_dec_drain (GstAmcVideoDec * self)
 {
   GstFlowReturn ret;
   gint idx;
@@ -1328,13 +1343,11 @@
     return GST_FLOW_OK;
   }
 
-  /* Don't send EOS buffer twice, this doesn't work */
-  if (self->eos) {
-    GST_DEBUG_OBJECT (self, "Codec is EOS already");
+  /* Don't send drain buffer twice, this doesn't work */
+  if (self->drained) {
+    GST_DEBUG_OBJECT (self, "Codec is drained already");
     return GST_FLOW_OK;
   }
-  if (at_eos)
-    self->eos = TRUE;
 
   /* Make sure to release the base class stream lock, otherwise
    * _loop() can't call _finish_frame() and we might block forever
@@ -1376,6 +1389,8 @@
       }
     }
 
+    self->drained = TRUE;
+    self->draining = FALSE;
     g_mutex_unlock (&self->drain_lock);
     GST_VIDEO_DECODER_STREAM_LOCK (self);
   } else if (idx >= self->n_input_buffers) {
diff --git a/sys/androidmedia/gstamcvideodec.h b/sys/androidmedia/gstamcvideodec.h
index e5efcae..a4ef11c 100644
--- a/sys/androidmedia/gstamcvideodec.h
+++ b/sys/androidmedia/gstamcvideodec.h
@@ -75,9 +75,8 @@
   GCond drain_cond;
   /* TRUE if EOS buffers shouldn't be forwarded */
   gboolean draining;
-
-  /* TRUE if upstream is EOS */
-  gboolean eos;
+  /* TRUE if the component is drained currently */
+  gboolean drained;
 
   GstFlowReturn downstream_flow_ret;
 };
diff --git a/sys/androidmedia/gstamcvideoenc.c b/sys/androidmedia/gstamcvideoenc.c
index 3a0a7a1..4384c76 100644
--- a/sys/androidmedia/gstamcvideoenc.c
+++ b/sys/androidmedia/gstamcvideoenc.c
@@ -1090,6 +1090,10 @@
     gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -1100,6 +1104,10 @@
     gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -1114,6 +1122,10 @@
     gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 failed_release:
@@ -1123,6 +1135,10 @@
     gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_ERROR;
     GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 flushing:
@@ -1150,6 +1166,10 @@
       gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
     }
     GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 
@@ -1161,6 +1181,10 @@
     gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
     self->downstream_flow_ret = GST_FLOW_NOT_NEGOTIATED;
     GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
+    g_mutex_lock (&self->drain_lock);
+    self->draining = FALSE;
+    g_cond_broadcast (&self->drain_cond);
+    g_mutex_unlock (&self->drain_lock);
     return;
   }
 }
@@ -1172,7 +1196,7 @@
 
   self = GST_AMC_VIDEO_ENC (encoder);
   self->last_upstream_ts = 0;
-  self->eos = FALSE;
+  self->drained = TRUE;
   self->downstream_flow_ret = GST_FLOW_OK;
   self->started = FALSE;
   self->flushing = TRUE;
@@ -1207,7 +1231,7 @@
   gst_pad_stop_task (GST_VIDEO_ENCODER_SRC_PAD (encoder));
 
   self->downstream_flow_ret = GST_FLOW_FLUSHING;
-  self->eos = FALSE;
+  self->drained = TRUE;
   g_mutex_lock (&self->drain_lock);
   self->draining = FALSE;
   g_cond_broadcast (&self->drain_cond);
@@ -1384,7 +1408,7 @@
 
   /* Start the srcpad loop again */
   self->last_upstream_ts = 0;
-  self->eos = FALSE;
+  self->drained = TRUE;
   self->downstream_flow_ret = GST_FLOW_OK;
   gst_pad_start_task (GST_VIDEO_ENCODER_SRC_PAD (self),
       (GstTaskFunction) gst_amc_video_enc_loop, encoder, NULL);
@@ -1416,12 +1440,6 @@
     return GST_FLOW_NOT_NEGOTIATED;
   }
 
-  if (self->eos) {
-    GST_WARNING_OBJECT (self, "Got frame after EOS");
-    gst_video_codec_frame_unref (frame);
-    return GST_FLOW_EOS;
-  }
-
   if (self->flushing)
     goto flushing;
 
@@ -1527,6 +1545,8 @@
     goto queue_error;
   }
 
+  self->drained = FALSE;
+
   gst_video_codec_frame_unref (frame);
 
   return self->downstream_flow_ret;
@@ -1578,57 +1598,10 @@
 gst_amc_video_enc_finish (GstVideoEncoder * encoder)
 {
   GstAmcVideoEnc *self;
-  gint idx;
-  GError *err = NULL;
 
   self = GST_AMC_VIDEO_ENC (encoder);
-  GST_DEBUG_OBJECT (self, "Sending EOS to the component");
 
-  /* Don't send EOS buffer twice, this doesn't work */
-  if (self->eos) {
-    GST_DEBUG_OBJECT (self, "Component is already EOS");
-    return GST_VIDEO_ENCODER_FLOW_DROPPED;
-  }
-  self->eos = TRUE;
-
-  /* Make sure to release the base class stream lock, otherwise
-   * _loop() can't call _finish_frame() and we might block forever
-   * because no input buffers are released */
-  GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
-  /* Send an EOS buffer to the component and let the base
-   * class drop the EOS event. We will send it later when
-   * the EOS buffer arrives on the output port.
-   * Wait at most 0.5s here. */
-  idx = gst_amc_codec_dequeue_input_buffer (self->codec, 500000, &err);
-  GST_VIDEO_ENCODER_STREAM_LOCK (self);
-
-  if (idx >= 0 && idx < self->n_input_buffers) {
-    GstAmcBufferInfo buffer_info;
-
-    memset (&buffer_info, 0, sizeof (buffer_info));
-    buffer_info.size = 0;
-    buffer_info.presentation_time_us =
-        gst_util_uint64_scale (self->last_upstream_ts, 1, GST_USECOND);
-    buffer_info.flags |= BUFFER_FLAG_END_OF_STREAM;
-
-    if (gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, &err)) {
-      GST_DEBUG_OBJECT (self, "Sent EOS to the codec");
-    } else {
-      GST_ERROR_OBJECT (self, "Failed to send EOS to the codec");
-      if (!self->flushing)
-        GST_ELEMENT_WARNING_FROM_ERROR (self, err);
-      g_clear_error (&err);
-    }
-  } else if (idx >= self->n_input_buffers) {
-    GST_ERROR_OBJECT (self, "Invalid input buffer index %d of %d",
-        idx, self->n_input_buffers);
-  } else {
-    GST_ERROR_OBJECT (self, "Failed to dequeue input buffer for EOS: %d", idx);
-    if (err)
-      GST_ELEMENT_WARNING_FROM_ERROR (self, err);
-  }
-
-  return GST_VIDEO_ENCODER_FLOW_DROPPED;
+  return gst_amc_video_enc_drain (self);
 }
 
 static GstFlowReturn
@@ -1644,9 +1617,9 @@
     return GST_FLOW_OK;
   }
 
-  /* Don't send EOS buffer twice, this doesn't work */
-  if (self->eos) {
-    GST_DEBUG_OBJECT (self, "Codec is EOS already");
+  /* Don't send drain buffer twice, this doesn't work */
+  if (self->drained) {
+    GST_DEBUG_OBJECT (self, "Codec is drained already");
     return GST_FLOW_OK;
   }
 
@@ -1690,6 +1663,8 @@
       }
     }
 
+    self->drained = TRUE;
+    self->draining = FALSE;
     g_mutex_unlock (&self->drain_lock);
     GST_VIDEO_ENCODER_STREAM_LOCK (self);
   } else if (idx >= self->n_input_buffers) {
diff --git a/sys/androidmedia/gstamcvideoenc.h b/sys/androidmedia/gstamcvideoenc.h
index 8373ce3..60a3687 100644
--- a/sys/androidmedia/gstamcvideoenc.h
+++ b/sys/androidmedia/gstamcvideoenc.h
@@ -78,9 +78,8 @@
   GCond drain_cond;
   /* TRUE if EOS buffers shouldn't be forwarded */
   gboolean draining;
-
-  /* TRUE if upstream is EOS */
-  gboolean eos;
+  /* TRUE if the component is drained */
+  gboolean drained;
 
   GstFlowReturn downstream_flow_ret;
 };
diff --git a/sys/androidmedia/gstjniutils.c b/sys/androidmedia/gstjniutils.c
new file mode 100644
index 0000000..0deadfa
--- /dev/null
+++ b/sys/androidmedia/gstjniutils.c
@@ -0,0 +1,772 @@
+/*
+ * Copyright (C) 2012, Collabora Ltd.
+ *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2013, Fluendo S.A.
+ *   Author: Andoni Morales <amorales@fluendo.com>
+ * Copyright (C) 2014, Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2014, Collabora Ltd.
+ *   Author: Matthieu Bouron <matthieu.bouron@collabora.com>
+ *
+ * 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
+ * version 2.1 of the License.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <pthread.h>
+#include <gmodule.h>
+
+#include "gstjniutils.h"
+
+static GModule *java_module;
+static jint (*get_created_java_vms) (JavaVM ** vmBuf, jsize bufLen,
+    jsize * nVMs);
+static jint (*create_java_vm) (JavaVM ** p_vm, JNIEnv ** p_env, void *vm_args);
+static JavaVM *java_vm;
+static gboolean initialized = FALSE;
+static gboolean started_java_vm = FALSE;
+static pthread_key_t current_jni_env;
+
+jclass
+gst_amc_jni_get_class (JNIEnv * env, const gchar * name)
+{
+  jclass tmp, ret = NULL;
+
+  GST_DEBUG ("Retrieving Java class %s", name);
+
+  tmp = (*env)->FindClass (env, name);
+  if (!tmp) {
+    ret = FALSE;
+    (*env)->ExceptionClear (env);
+    GST_ERROR ("Failed to get %s class", name);
+    goto done;
+  }
+
+  ret = (*env)->NewGlobalRef (env, tmp);
+  if (!ret) {
+    (*env)->ExceptionClear (env);
+    GST_ERROR ("Failed to get %s class global reference", name);
+  }
+
+done:
+  if (tmp)
+    (*env)->DeleteLocalRef (env, tmp);
+  tmp = NULL;
+
+  return ret;
+}
+
+jmethodID
+gst_amc_jni_get_method (JNIEnv * env, jclass klass, const gchar * name,
+    const gchar * signature)
+{
+  jmethodID ret;
+
+  ret = (*env)->GetMethodID (env, klass, name, signature);
+  if (!ret) {
+    (*env)->ExceptionClear (env);
+    GST_ERROR ("Failed to get method ID %s", name);
+  }
+  return ret;
+}
+
+jmethodID
+gst_amc_jni_get_static_method (JNIEnv * env, jclass klass, const gchar * name,
+    const gchar * signature)
+{
+  jmethodID ret;
+
+  ret = (*env)->GetStaticMethodID (env, klass, name, signature);
+  if (!ret) {
+    (*env)->ExceptionClear (env);
+    GST_ERROR ("Failed to get static method id %s", name);
+  }
+  return ret;
+}
+
+jfieldID
+gst_amc_jni_get_field_id (JNIEnv * env, jclass klass, const gchar * name,
+    const gchar * type)
+{
+  jfieldID ret;
+
+  ret = (*env)->GetFieldID (env, klass, name, type);
+  if (!ret) {
+    (*env)->ExceptionClear (env);
+    GST_ERROR ("Failed to get field ID %s", name);
+  }
+  return ret;
+}
+
+jobject
+gst_amc_jni_new_object (JNIEnv * env, jclass klass, jmethodID constructor, ...)
+{
+  jobject tmp;
+  va_list args;
+
+  va_start (args, constructor);
+  tmp = (*env)->NewObjectV (env, klass, constructor, args);
+  va_end (args);
+
+  if (!tmp) {
+    (*env)->ExceptionClear (env);
+    GST_ERROR ("Failed to create object");
+    return NULL;
+  }
+
+  return gst_amc_jni_object_make_global (env, tmp);
+}
+
+jobject
+gst_amc_jni_new_object_from_static (JNIEnv * env, jclass klass,
+    jmethodID method, ...)
+{
+  jobject tmp;
+  va_list args;
+
+  va_start (args, method);
+  tmp = (*env)->CallStaticObjectMethodV (env, klass, method, args);
+  va_end (args);
+
+  if ((*env)->ExceptionCheck (env) || !tmp) {
+    (*env)->ExceptionClear (env);
+    GST_ERROR ("Failed to create object from static method");
+    return NULL;
+  }
+
+  return gst_amc_jni_object_make_global (env, tmp);
+}
+
+jobject
+gst_amc_jni_object_make_global (JNIEnv * env, jobject object)
+{
+  jobject ret;
+
+  ret = (*env)->NewGlobalRef (env, object);
+  if (!ret) {
+    GST_ERROR ("Failed to create global reference");
+    (*env)->ExceptionClear (env);
+  } else {
+    gst_amc_jni_object_local_unref (env, object);
+  }
+  return ret;
+}
+
+jobject
+gst_amc_jni_object_ref (JNIEnv * env, jobject object)
+{
+  jobject ret;
+
+  ret = (*env)->NewGlobalRef (env, object);
+  if (!ret) {
+    GST_ERROR ("Failed to create global reference");
+    (*env)->ExceptionClear (env);
+  }
+  return ret;
+}
+
+void
+gst_amc_jni_object_unref (JNIEnv * env, jobject object)
+{
+  (*env)->DeleteGlobalRef (env, object);
+}
+
+void
+gst_amc_jni_object_local_unref (JNIEnv * env, jobject object)
+{
+  (*env)->DeleteLocalRef (env, object);
+}
+
+jstring
+gst_amc_jni_string_from_gchar (JNIEnv * env, const gchar * string)
+{
+  return (*env)->NewStringUTF (env, string);
+}
+
+gchar *
+gst_amc_jni_string_to_gchar (JNIEnv * env, jstring string, gboolean release)
+{
+  const gchar *s = NULL;
+  gchar *ret = NULL;
+
+  s = (*env)->GetStringUTFChars (env, string, NULL);
+  if (!s) {
+    GST_ERROR ("Failed to convert string to UTF8");
+    (*env)->ExceptionClear (env);
+    return ret;
+  }
+
+  ret = g_strdup (s);
+  (*env)->ReleaseStringUTFChars (env, string, s);
+
+  if (release) {
+    (*env)->DeleteLocalRef (env, string);
+  }
+  return ret;
+}
+
+/* getExceptionSummary() and getStackTrace() taken from Android's
+ *   platform/libnativehelper/JNIHelp.cpp
+ * Modified to work with normal C strings and without C++.
+ *
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Returns a human-readable summary of an exception object. The buffer will
+ * be populated with the "binary" class name and, if present, the
+ * exception message.
+ */
+static gchar *
+getExceptionSummary (JNIEnv * env, jthrowable exception)
+{
+  GString *gs = g_string_new ("");
+  jclass exceptionClass = NULL, classClass = NULL;
+  jmethodID classGetNameMethod, getMessage;
+  jstring classNameStr = NULL, messageStr = NULL;
+  const char *classNameChars, *messageChars;
+
+  /* get the name of the exception's class */
+  exceptionClass = (*env)->GetObjectClass (env, exception);
+  classClass = (*env)->GetObjectClass (env, exceptionClass);
+  classGetNameMethod =
+      (*env)->GetMethodID (env, classClass, "getName", "()Ljava/lang/String;");
+
+  classNameStr =
+      (jstring) (*env)->CallObjectMethod (env, exceptionClass,
+      classGetNameMethod);
+
+  if (classNameStr == NULL) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    g_string_append (gs, "<error getting class name>");
+    goto done;
+  }
+
+  classNameChars = (*env)->GetStringUTFChars (env, classNameStr, NULL);
+  if (classNameChars == NULL) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    g_string_append (gs, "<error getting class name UTF-8>");
+    goto done;
+  }
+
+  g_string_append (gs, classNameChars);
+
+  (*env)->ReleaseStringUTFChars (env, classNameStr, classNameChars);
+
+  /* if the exception has a detail message, get that */
+  getMessage =
+      (*env)->GetMethodID (env, exceptionClass, "getMessage",
+      "()Ljava/lang/String;");
+  messageStr = (jstring) (*env)->CallObjectMethod (env, exception, getMessage);
+  if (messageStr == NULL) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    goto done;
+  }
+  g_string_append (gs, ": ");
+
+  messageChars = (*env)->GetStringUTFChars (env, messageStr, NULL);
+  if (messageChars != NULL) {
+    g_string_append (gs, messageChars);
+    (*env)->ReleaseStringUTFChars (env, messageStr, messageChars);
+  } else {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    g_string_append (gs, "<error getting message>");
+  }
+
+done:
+  if (exceptionClass)
+    (*env)->DeleteLocalRef (env, exceptionClass);
+  if (classClass)
+    (*env)->DeleteLocalRef (env, classClass);
+  if (classNameStr)
+    (*env)->DeleteLocalRef (env, classNameStr);
+  if (messageStr)
+    (*env)->DeleteLocalRef (env, messageStr);
+
+  return g_string_free (gs, FALSE);
+}
+
+/*
+ * Returns an exception (with stack trace) as a string.
+ */
+static gchar *
+getStackTrace (JNIEnv * env, jthrowable exception)
+{
+  GString *gs = g_string_new ("");
+  jclass stringWriterClass = NULL, printWriterClass = NULL;
+  jclass exceptionClass = NULL;
+  jmethodID stringWriterCtor, stringWriterToStringMethod;
+  jmethodID printWriterCtor, printStackTraceMethod;
+  jobject stringWriter = NULL, printWriter = NULL;
+  jstring messageStr = NULL;
+  const char *utfChars;
+
+  stringWriterClass = (*env)->FindClass (env, "java/io/StringWriter");
+
+  if (stringWriterClass == NULL) {
+    g_string_append (gs, "<error getting java.io.StringWriter class>");
+    goto done;
+  }
+
+  stringWriterCtor =
+      (*env)->GetMethodID (env, stringWriterClass, "<init>", "()V");
+  stringWriterToStringMethod =
+      (*env)->GetMethodID (env, stringWriterClass, "toString",
+      "()Ljava/lang/String;");
+
+  printWriterClass = (*env)->FindClass (env, "java/io/PrintWriter");
+  if (printWriterClass == NULL) {
+    g_string_append (gs, "<error getting java.io.PrintWriter class>");
+    goto done;
+  }
+
+  printWriterCtor =
+      (*env)->GetMethodID (env, printWriterClass, "<init>",
+      "(Ljava/io/Writer;)V");
+  stringWriter = (*env)->NewObject (env, stringWriterClass, stringWriterCtor);
+  if (stringWriter == NULL) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    g_string_append (gs, "<error creating new StringWriter instance>");
+    goto done;
+  }
+
+  printWriter =
+      (*env)->NewObject (env, printWriterClass, printWriterCtor, stringWriter);
+  if (printWriter == NULL) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    g_string_append (gs, "<error creating new PrintWriter instance>");
+    goto done;
+  }
+
+  exceptionClass = (*env)->GetObjectClass (env, exception);
+  printStackTraceMethod =
+      (*env)->GetMethodID (env, exceptionClass, "printStackTrace",
+      "(Ljava/io/PrintWriter;)V");
+  (*env)->CallVoidMethod (env, exception, printStackTraceMethod, printWriter);
+  if ((*env)->ExceptionCheck (env)) {
+    (*env)->ExceptionClear (env);
+    g_string_append (gs, "<exception while printing stack trace>");
+    goto done;
+  }
+
+  messageStr = (jstring) (*env)->CallObjectMethod (env, stringWriter,
+      stringWriterToStringMethod);
+  if (messageStr == NULL) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    g_string_append (gs, "<failed to call StringWriter.toString()>");
+    goto done;
+  }
+
+  utfChars = (*env)->GetStringUTFChars (env, messageStr, NULL);
+  if (utfChars == NULL) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    g_string_append (gs, "<failed to get UTF chars for message>");
+    goto done;
+  }
+
+  g_string_append (gs, utfChars);
+
+  (*env)->ReleaseStringUTFChars (env, messageStr, utfChars);
+
+done:
+  if (stringWriterClass)
+    (*env)->DeleteLocalRef (env, stringWriterClass);
+  if (printWriterClass)
+    (*env)->DeleteLocalRef (env, printWriterClass);
+  if (exceptionClass)
+    (*env)->DeleteLocalRef (env, exceptionClass);
+  if (stringWriter)
+    (*env)->DeleteLocalRef (env, stringWriter);
+  if (printWriter)
+    (*env)->DeleteLocalRef (env, printWriter);
+  if (messageStr)
+    (*env)->DeleteLocalRef (env, messageStr);
+
+  return g_string_free (gs, FALSE);
+}
+
+static JNIEnv *
+gst_amc_jni_attach_current_thread (void)
+{
+  JNIEnv *env;
+  JavaVMAttachArgs args;
+
+  GST_DEBUG ("Attaching thread %p", g_thread_self ());
+  args.version = JNI_VERSION_1_6;
+  args.name = NULL;
+  args.group = NULL;
+
+  if ((*java_vm)->AttachCurrentThread (java_vm, &env, &args) < 0) {
+    GST_ERROR ("Failed to attach current thread");
+    return NULL;
+  }
+
+  return env;
+}
+
+static void
+gst_amc_jni_detach_current_thread (void *env)
+{
+  GST_DEBUG ("Detaching thread %p", g_thread_self ());
+  (*java_vm)->DetachCurrentThread (java_vm);
+}
+
+static gboolean
+check_nativehelper (void)
+{
+  GModule *module;
+  void **jni_invocation = NULL;
+  gboolean ret = FALSE;
+
+  module = g_module_open (NULL, G_MODULE_BIND_LOCAL);
+  if (!module)
+    return ret;
+
+  /* Check if libnativehelper is loaded in the process and if
+   * it has these awful wrappers for JNI_CreateJavaVM and
+   * JNI_GetCreatedJavaVMs that crash the app if you don't
+   * create a JniInvocation instance first. If it isn't we
+   * just fail here and don't initialize anything.
+   * See this code for reference:
+   * https://android.googlesource.com/platform/libnativehelper/+/master/JniInvocation.cpp
+   */
+  if (!g_module_symbol (module, "_ZN13JniInvocation15jni_invocation_E",
+          (gpointer *) & jni_invocation)) {
+    ret = TRUE;
+  } else {
+    ret = (jni_invocation != NULL && *jni_invocation != NULL);
+  }
+
+  g_module_close (module);
+
+  return ret;
+}
+
+static gboolean
+load_java_module (const gchar * name)
+{
+  java_module = g_module_open (name, G_MODULE_BIND_LOCAL);
+  if (!java_module)
+    goto load_failed;
+
+  if (!g_module_symbol (java_module, "JNI_CreateJavaVM",
+          (gpointer *) & create_java_vm))
+    goto symbol_error;
+
+  if (!g_module_symbol (java_module, "JNI_GetCreatedJavaVMs",
+          (gpointer *) & get_created_java_vms))
+    goto symbol_error;
+
+  return TRUE;
+
+load_failed:
+  {
+    GST_ERROR ("Failed to load Java module '%s': %s", GST_STR_NULL (name),
+        g_module_error ());
+    return FALSE;
+  }
+symbol_error:
+  {
+    GST_ERROR ("Failed to locate required JNI symbols in '%s': %s",
+        GST_STR_NULL (name), g_module_error ());
+    g_module_close (java_module);
+    java_module = NULL;
+    return FALSE;
+  }
+}
+
+static gboolean
+gst_amc_jni_initialize_java_vm (void)
+{
+  jsize n_vms;
+
+  /* Returns TRUE if we can safely
+   * a) get the current VMs and
+   * b) start a VM if none is started yet
+   *
+   * FIXME: On Android >= 4.4 we won't be able to safely start a
+   * VM on our own without using private C++ API!
+   */
+  if (!check_nativehelper ()) {
+    GST_ERROR ("Can't safely check for VMs or start a VM");
+    return FALSE;
+  }
+
+  if (!load_java_module (NULL)) {
+    if (!load_java_module ("libdvm"))
+      return FALSE;
+  }
+
+  n_vms = 0;
+  if (get_created_java_vms (&java_vm, 1, &n_vms) < 0)
+    goto get_created_failed;
+
+  if (n_vms > 0) {
+    GST_DEBUG ("Successfully got existing Java VM %p", java_vm);
+  } else {
+    JNIEnv *env;
+    JavaVMInitArgs vm_args;
+    JavaVMOption options[4];
+
+    GST_DEBUG ("Found no existing Java VM, trying to start one");
+
+    options[0].optionString = "-verbose:jni";
+    options[1].optionString = "-verbose:gc";
+    options[2].optionString = "-Xcheck:jni";
+    options[3].optionString = "-Xdebug";
+
+    vm_args.version = JNI_VERSION_1_4;
+    vm_args.options = options;
+    vm_args.nOptions = 4;
+    vm_args.ignoreUnrecognized = JNI_TRUE;
+    if (create_java_vm (&java_vm, &env, &vm_args) < 0)
+      goto create_failed;
+    GST_DEBUG ("Successfully created Java VM %p", java_vm);
+
+    started_java_vm = TRUE;
+  }
+
+  return java_vm != NULL;
+
+get_created_failed:
+  {
+    GST_ERROR ("Failed to get already created VMs");
+    g_module_close (java_module);
+    java_module = NULL;
+    return FALSE;
+  }
+create_failed:
+  {
+    GST_ERROR ("Failed to create a Java VM");
+    g_module_close (java_module);
+    java_module = NULL;
+    return FALSE;
+  }
+}
+
+static void
+gst_amc_jni_set_error_string (JNIEnv * env, GQuark domain, gint code,
+    GError ** err, const gchar * message)
+{
+  jthrowable exception;
+
+  if (!err) {
+    if ((*env)->ExceptionCheck (env))
+      (*env)->ExceptionClear (env);
+    return;
+  }
+
+  if ((*env)->ExceptionCheck (env)) {
+    if ((exception = (*env)->ExceptionOccurred (env))) {
+      gchar *exception_description, *exception_stacktrace;
+
+      /* Clear exception so that we can call Java methods again */
+      (*env)->ExceptionClear (env);
+
+      exception_description = getExceptionSummary (env, exception);
+      exception_stacktrace = getStackTrace (env, exception);
+      g_set_error (err, domain, code, "%s: %s\n%s", message,
+          exception_description, exception_stacktrace);
+      g_free (exception_description);
+      g_free (exception_stacktrace);
+
+      (*env)->DeleteLocalRef (env, exception);
+    } else {
+      (*env)->ExceptionClear (env);
+      g_set_error (err, domain, code, "%s", message);
+    }
+  } else {
+    g_set_error (err, domain, code, "%s", message);
+  }
+}
+
+G_GNUC_PRINTF (5, 6)
+     void gst_amc_jni_set_error (JNIEnv * env, GQuark domain, gint code,
+    GError ** err, const gchar * format, ...)
+{
+  gchar *message;
+  va_list var_args;
+
+  va_start (var_args, format);
+  message = g_strdup_vprintf (format, var_args);
+  va_end (var_args);
+
+  gst_amc_jni_set_error_string (env, domain, code, err, message);
+
+  g_free (message);
+}
+
+
+gboolean
+gst_amc_jni_initialize (void)
+{
+  if (!initialized) {
+    pthread_key_create (&current_jni_env, gst_amc_jni_detach_current_thread);
+    initialized = gst_amc_jni_initialize_java_vm ();
+  }
+  return initialized;
+}
+
+JNIEnv *
+gst_amc_jni_get_env (void)
+{
+  JNIEnv *env;
+
+  if ((env = pthread_getspecific (current_jni_env)) == NULL) {
+    env = gst_amc_jni_attach_current_thread ();
+    pthread_setspecific (current_jni_env, env);
+  }
+
+  return env;
+}
+
+gboolean
+gst_amc_jni_is_vm_started (void)
+{
+  return started_java_vm;
+}
+
+#define CALL_STATIC_TYPE_METHOD(_type, _name,  _jname, _retval)                                                     \
+_type gst_amc_jni_call_static_##_name##_method (JNIEnv *env, GError ** err, jclass klass, jmethodID methodID, ...)   \
+  {                                                                                                          \
+    _type ret;                                                                                               \
+    va_list args;                                                                                            \
+    va_start(args, methodID);                                                                                \
+    ret = (*env)->CallStatic##_jname##MethodV(env, klass, methodID, args);                                           \
+    if ((*env)->ExceptionCheck (env)) {                                                                      \
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,                               \
+          err, "Failed to call static Java method");                                                                \
+      (*env)->ExceptionClear (env);                                                                          \
+      ret = _retval;                                                                                         \
+    }                                                                                                        \
+    va_end(args);                                                                                            \
+    return (_type) ret;                                                                                      \
+  }
+
+CALL_STATIC_TYPE_METHOD (gboolean, boolean, Boolean, FALSE);
+CALL_STATIC_TYPE_METHOD (gint8, byte, Byte, G_MININT8);
+CALL_STATIC_TYPE_METHOD (gshort, short, Short, G_MINSHORT);
+CALL_STATIC_TYPE_METHOD (gint, int, Int, G_MININT);
+CALL_STATIC_TYPE_METHOD (gchar, char, Char, 0);
+CALL_STATIC_TYPE_METHOD (glong, long, Long, G_MINLONG);
+CALL_STATIC_TYPE_METHOD (gfloat, float, Float, G_MINFLOAT);
+CALL_STATIC_TYPE_METHOD (gdouble, double, Double, G_MINDOUBLE);
+CALL_STATIC_TYPE_METHOD (jobject, object, Object, NULL);
+
+gboolean
+gst_amc_jni_call_static_void_method (JNIEnv * env, GError ** err, jclass klass,
+    jmethodID methodID, ...)
+{
+  gboolean ret = TRUE;
+  va_list args;
+  va_start (args, methodID);
+
+  (*env)->CallStaticVoidMethodV (env, klass, methodID, args);
+  if ((*env)->ExceptionCheck (env)) {
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to call static Java method");
+    (*env)->ExceptionClear (env);
+    ret = FALSE;
+  }
+  va_end (args);
+  return ret;
+}
+
+#define CALL_TYPE_METHOD(_type, _name,  _jname, _retval)                                                     \
+_type gst_amc_jni_call_##_name##_method (JNIEnv *env, GError ** err, jobject obj, jmethodID methodID, ...)   \
+  {                                                                                                          \
+    _type ret;                                                                                               \
+    va_list args;                                                                                            \
+    va_start(args, methodID);                                                                                \
+    ret = (*env)->Call##_jname##MethodV(env, obj, methodID, args);                                           \
+    if ((*env)->ExceptionCheck (env)) {                                                                      \
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,                               \
+          err, "Failed to call Java method");                                                                \
+      (*env)->ExceptionClear (env);                                                                          \
+      ret = _retval;                                                                                         \
+    }                                                                                                        \
+    va_end(args);                                                                                            \
+    return (_type) ret;                                                                                      \
+  }
+
+CALL_TYPE_METHOD (gboolean, boolean, Boolean, FALSE);
+CALL_TYPE_METHOD (gint8, byte, Byte, G_MININT8);
+CALL_TYPE_METHOD (gshort, short, Short, G_MINSHORT);
+CALL_TYPE_METHOD (gint, int, Int, G_MININT);
+CALL_TYPE_METHOD (gchar, char, Char, 0);
+CALL_TYPE_METHOD (glong, long, Long, G_MINLONG);
+CALL_TYPE_METHOD (gfloat, float, Float, G_MINFLOAT);
+CALL_TYPE_METHOD (gdouble, double, Double, G_MINDOUBLE);
+CALL_TYPE_METHOD (jobject, object, Object, NULL);
+
+gboolean
+gst_amc_jni_call_void_method (JNIEnv * env, GError ** err, jobject obj,
+    jmethodID methodID, ...)
+{
+  gboolean ret = TRUE;
+  va_list args;
+  va_start (args, methodID);
+
+  (*env)->CallVoidMethodV (env, obj, methodID, args);
+  if ((*env)->ExceptionCheck (env)) {
+    gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,
+        err, "Failed to call Java method");
+    (*env)->ExceptionClear (env);
+    ret = FALSE;
+  }
+  va_end (args);
+  return ret;
+}
+
+#define GET_TYPE_FIELD(_type, _name, _jname, _retval)                                               \
+_type gst_amc_jni_get_##_name##_field (JNIEnv *env, GError ** err, jobject obj, jfieldID fieldID)   \
+  {                                                                                                 \
+    _type res;                                                                                      \
+                                                                                                    \
+    res = (*env)->Get##_jname##Field(env, obj, fieldID);                                            \
+    if ((*env)->ExceptionCheck (env)) {                                                             \
+      gst_amc_jni_set_error (env, GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED,                      \
+          err, "Failed to call Java field");                                                        \
+      (*env)->ExceptionClear (env);                                                                 \
+      res = _retval;                                                                                \
+    }                                                                                               \
+    return res;                                                                                     \
+  }
+
+GET_TYPE_FIELD (gint, int, Int, G_MININT);
+GET_TYPE_FIELD (glong, long, Long, G_MINLONG);
diff --git a/sys/androidmedia/gstjniutils.h b/sys/androidmedia/gstjniutils.h
new file mode 100644
index 0000000..0c75c45
--- /dev/null
+++ b/sys/androidmedia/gstjniutils.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2012, Collabora Ltd.
+ *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2013, Fluendo S.A.
+ *   Author: Andoni Morales <amorales@fluendo.com>
+ * Copyright (C) 2014, Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2014, Collabora Ltd.
+ *   Author: Matthieu Bouron <matthieu.bouron@collabora.com>
+ *
+ * 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
+ * version 2.1 of the License.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ */
+#ifndef __GST_AMC_JNI_UTILS_H__
+#define __GST_AMC_JNI_UTILS_H__
+
+#include <jni.h>
+#include <glib.h>
+#include <gst/gst.h>
+
+jclass    gst_amc_jni_get_class              (JNIEnv * env,
+                                             const gchar * name);
+
+jmethodID gst_amc_jni_get_method             (JNIEnv * env,
+                                             jclass klass,
+                                             const gchar * name,
+                                             const gchar * signature);
+
+jmethodID gst_amc_jni_get_static_method      (JNIEnv * env,
+                                             jclass klass,
+                                             const gchar * name,
+                                             const gchar * signature);
+
+jfieldID gst_amc_jni_get_field_id            (JNIEnv * env,
+                                             jclass klass,
+                                             const gchar * name,
+                                             const gchar * type);
+
+jobject gst_amc_jni_new_object               (JNIEnv * env,
+                                             jclass klass,
+                                             jmethodID constructor, ...);
+
+jobject gst_amc_jni_new_object_from_static   (JNIEnv * env,
+                                             jclass klass,
+                                             jmethodID constructor, ...);
+
+jobject gst_amc_jni_object_make_global       (JNIEnv * env,
+                                             jobject object);
+
+jobject gst_amc_jni_object_ref               (JNIEnv * env,
+                                             jobject object);
+
+void gst_amc_jni_object_unref                (JNIEnv * env,
+                                             jobject object);
+
+void gst_amc_jni_object_local_unref          (JNIEnv * env,
+                                             jobject object);
+
+gchar *gst_amc_jni_string_to_gchar           (JNIEnv * env,
+                                             jstring string,
+                                             gboolean release);
+
+jstring gst_amc_jni_string_from_gchar        (JNIEnv * env,
+                                             const gchar * string);
+
+G_GNUC_PRINTF (5, 6)
+void gst_amc_jni_set_error                   (JNIEnv * env,
+                                              GQuark domain,
+                                              gint code,
+                                              GError ** error,
+                                              const gchar * format, ...);
+
+gboolean gst_amc_jni_initialize              (void);
+
+gboolean gst_amc_jni_is_vm_started           (void);
+
+JNIEnv *gst_amc_jni_get_env                  (void);
+
+#define DEF_CALL_STATIC_TYPE_METHOD(_type, _name,  _jname, _retval) \
+_type gst_amc_jni_call_static_##_name##_method (JNIEnv *env, GError ** err, jclass klass, jmethodID methodID, ...)
+
+DEF_CALL_STATIC_TYPE_METHOD (gboolean, boolean, Boolean, FALSE);
+DEF_CALL_STATIC_TYPE_METHOD (gint8, byte, Byte, G_MININT8);
+DEF_CALL_STATIC_TYPE_METHOD (gshort, short, Short, G_MINSHORT);
+DEF_CALL_STATIC_TYPE_METHOD (gint, int, Int, G_MININT);
+DEF_CALL_STATIC_TYPE_METHOD (gchar, char, Char, 0);
+DEF_CALL_STATIC_TYPE_METHOD (glong, long, Long, G_MINLONG);
+DEF_CALL_STATIC_TYPE_METHOD (gfloat, float, Float, G_MINFLOAT);
+DEF_CALL_STATIC_TYPE_METHOD (gdouble, double, Double, G_MINDOUBLE);
+DEF_CALL_STATIC_TYPE_METHOD (jobject, object, Object, NULL);
+
+gboolean gst_amc_jni_call_static_void_method        (JNIEnv * env,
+                                                    GError ** error,
+                                                    jclass klass,
+                                                    jmethodID method, ...);
+
+#define DEF_CALL_TYPE_METHOD(_type, _name,  _jname, _retval) \
+_type gst_amc_jni_call_##_name##_method (JNIEnv *env, GError ** err, jobject obj, jmethodID methodID, ...)
+
+DEF_CALL_TYPE_METHOD (gboolean, boolean, Boolean, FALSE);
+DEF_CALL_TYPE_METHOD (gint8, byte, Byte, G_MININT8);
+DEF_CALL_TYPE_METHOD (gshort, short, Short, G_MINSHORT);
+DEF_CALL_TYPE_METHOD (gint, int, Int, G_MININT);
+DEF_CALL_TYPE_METHOD (gchar, char, Char, 0);
+DEF_CALL_TYPE_METHOD (glong, long, Long, G_MINLONG);
+DEF_CALL_TYPE_METHOD (gfloat, float, Float, G_MINFLOAT);
+DEF_CALL_TYPE_METHOD (gdouble, double, Double, G_MINDOUBLE);
+DEF_CALL_TYPE_METHOD (jobject, object, Object, NULL);
+
+gboolean gst_amc_jni_call_void_method        (JNIEnv * env,
+                                             GError ** error,
+                                             jobject obj,
+                                             jmethodID method, ...);
+
+#define DEF_GET_TYPE_FIELD(_type, _name, _jname, _retval) \
+_type gst_amc_jni_get_##_name##_field (JNIEnv *env, GError ** err, jobject obj, jfieldID fieldID)
+
+DEF_GET_TYPE_FIELD (gint, int, Int, G_MININT);
+DEF_GET_TYPE_FIELD (glong, long, Long, G_MINLONG);
+
+#endif
diff --git a/sys/applemedia-nonpublic/Makefile.in b/sys/applemedia-nonpublic/Makefile.in
index d4aca37..f50fd26 100644
--- a/sys/applemedia-nonpublic/Makefile.in
+++ b/sys/applemedia-nonpublic/Makefile.in
@@ -99,6 +99,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -112,7 +113,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -286,8 +286,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -326,7 +330,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -334,6 +337,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -383,8 +388,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -463,7 +466,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -472,7 +474,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -485,7 +486,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -510,6 +510,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -583,10 +585,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -612,6 +618,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -648,6 +657,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -688,17 +698,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -715,6 +724,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/applemedia/Makefile.am b/sys/applemedia/Makefile.am
index e05c092..795832c 100644
--- a/sys/applemedia/Makefile.am
+++ b/sys/applemedia/Makefile.am
@@ -5,6 +5,7 @@
 	vtutil.c				\
 	corevideobuffer.c			\
 	coremediabuffer.c			\
+	corevideotexturecache.m 		\
 	atdec.c
 
 libgstapplemedia_la_CPPFLAGS =			\
@@ -15,11 +16,15 @@
 	-Dgst_core_video_buffer_get_type=gst_core_video_buffer_priv_get_type
 
 libgstapplemedia_la_CFLAGS =			\
+	-I$(top_srcdir)/gst-libs                \
+	-I$(top_builddir)/gst-libs              \
 	$(GST_CFLAGS)				\
 	$(GST_BASE_CFLAGS)			\
 	$(GST_PLUGINS_BASE_CFLAGS)
 
 libgstapplemedia_la_OBJCFLAGS =			\
+	-I$(top_srcdir)/gst-libs                \
+	-I$(top_builddir)/gst-libs              \
 	$(GST_OBJCFLAGS)			\
 	$(GST_BASE_CFLAGS)			\
 	$(GST_PLUGINS_BASE_CFLAGS)
@@ -28,12 +33,13 @@
 libgstapplemedia_la_OBJCFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
 endif
 
-libgstapplemedia_la_LIBADD =			\
-	$(GST_BASE_LIBS)			\
-	$(GST_PLUGINS_BASE_LIBS)		\
-	-lgstvideo-$(GST_API_VERSION) 		\
-	-lgstaudio-$(GST_API_VERSION)		\
-	-lgstpbutils-$(GST_API_VERSION) 	\
+libgstapplemedia_la_LIBADD =						\
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la 	\
+	$(GST_BASE_LIBS)						\
+	$(GST_PLUGINS_BASE_LIBS)					\
+	-lgstvideo-$(GST_API_VERSION) 					\
+	-lgstaudio-$(GST_API_VERSION)					\
+	-lgstpbutils-$(GST_API_VERSION) 				\
 	$(GMODULE_NO_EXPORT_LIBS)
 
 libgstapplemedia_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) --tag=CC
@@ -83,7 +89,8 @@
 
 libgstapplemedia_la_SOURCES +=			\
 	avfvideosrc.m				\
-	avfassetsrc.m
+	avfassetsrc.m				\
+	avsamplevideosink.m
 
 libgstapplemedia_la_LDFLAGS +=			\
 	-Wl,-framework -Wl,AVFoundation
diff --git a/sys/applemedia/Makefile.in b/sys/applemedia/Makefile.in
index 85b238d..0b442a7 100644
--- a/sys/applemedia/Makefile.in
+++ b/sys/applemedia/Makefile.in
@@ -97,7 +97,8 @@
 
 @HAVE_AVFOUNDATION_TRUE@am__append_6 = \
 @HAVE_AVFOUNDATION_TRUE@	avfvideosrc.m				\
-@HAVE_AVFOUNDATION_TRUE@	avfassetsrc.m
+@HAVE_AVFOUNDATION_TRUE@	avfassetsrc.m				\
+@HAVE_AVFOUNDATION_TRUE@	avsamplevideosink.m
 
 @HAVE_AVFOUNDATION_TRUE@am__append_7 = \
 @HAVE_AVFOUNDATION_TRUE@	-Wl,-framework -Wl,AVFoundation
@@ -117,6 +118,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -130,7 +132,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -181,22 +182,26 @@
 am__installdirs = "$(DESTDIR)$(plugindir)"
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libgstapplemedia_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+libgstapplemedia_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am__libgstapplemedia_la_SOURCES_DIST = plugin.m vtutil.c \
-	corevideobuffer.c coremediabuffer.c atdec.c iosassetsrc.m \
-	qtkitvideosrc.m avfvideosrc.m avfassetsrc.m vtenc.c vtdec.c
+	corevideobuffer.c coremediabuffer.c corevideotexturecache.m \
+	atdec.c iosassetsrc.m qtkitvideosrc.m avfvideosrc.m \
+	avfassetsrc.m avsamplevideosink.m vtenc.c vtdec.c
 @HAVE_IOS_TRUE@am__objects_1 = libgstapplemedia_la-iosassetsrc.lo
 @HAVE_IOS_FALSE@am__objects_2 = libgstapplemedia_la-qtkitvideosrc.lo
 @HAVE_AVFOUNDATION_TRUE@am__objects_3 =  \
 @HAVE_AVFOUNDATION_TRUE@	libgstapplemedia_la-avfvideosrc.lo \
-@HAVE_AVFOUNDATION_TRUE@	libgstapplemedia_la-avfassetsrc.lo
+@HAVE_AVFOUNDATION_TRUE@	libgstapplemedia_la-avfassetsrc.lo \
+@HAVE_AVFOUNDATION_TRUE@	libgstapplemedia_la-avsamplevideosink.lo
 @HAVE_VIDEOTOOLBOX_TRUE@am__objects_4 = libgstapplemedia_la-vtenc.lo \
 @HAVE_VIDEOTOOLBOX_TRUE@	libgstapplemedia_la-vtdec.lo
 am_libgstapplemedia_la_OBJECTS = libgstapplemedia_la-plugin.lo \
 	libgstapplemedia_la-vtutil.lo \
 	libgstapplemedia_la-corevideobuffer.lo \
 	libgstapplemedia_la-coremediabuffer.lo \
+	libgstapplemedia_la-corevideotexturecache.lo \
 	libgstapplemedia_la-atdec.lo $(am__objects_1) $(am__objects_2) \
 	$(am__objects_3) $(am__objects_4)
 libgstapplemedia_la_OBJECTS = $(am_libgstapplemedia_la_OBJECTS)
@@ -304,8 +309,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -344,7 +353,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -352,6 +360,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -401,8 +411,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -481,7 +489,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -490,7 +497,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -503,7 +509,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -528,6 +533,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -601,10 +608,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -630,6 +641,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -666,6 +680,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -706,17 +721,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -733,6 +747,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -786,8 +801,9 @@
 wayland_scanner = @wayland_scanner@
 plugin_LTLIBRARIES = libgstapplemedia.la
 libgstapplemedia_la_SOURCES = plugin.m vtutil.c corevideobuffer.c \
-	coremediabuffer.c atdec.c $(am__append_2) $(am__append_4) \
-	$(am__append_6) $(am__append_8)
+	coremediabuffer.c corevideotexturecache.m atdec.c \
+	$(am__append_2) $(am__append_4) $(am__append_6) \
+	$(am__append_8)
 libgstapplemedia_la_CPPFLAGS = \
 	-Dgst_core_media_buffer_new=gst_core_media_buffer_priv_new		\
 	-Dgst_core_media_buffer_get_type=gst_core_media_buffer_priv_get_type	\
@@ -796,18 +812,22 @@
 	-Dgst_core_video_buffer_get_type=gst_core_video_buffer_priv_get_type
 
 libgstapplemedia_la_CFLAGS = \
+	-I$(top_srcdir)/gst-libs                \
+	-I$(top_builddir)/gst-libs              \
 	$(GST_CFLAGS)				\
 	$(GST_BASE_CFLAGS)			\
 	$(GST_PLUGINS_BASE_CFLAGS)
 
-libgstapplemedia_la_OBJCFLAGS = $(GST_OBJCFLAGS) $(GST_BASE_CFLAGS) \
+libgstapplemedia_la_OBJCFLAGS = -I$(top_srcdir)/gst-libs \
+	-I$(top_builddir)/gst-libs $(GST_OBJCFLAGS) $(GST_BASE_CFLAGS) \
 	$(GST_PLUGINS_BASE_CFLAGS) $(am__append_1)
 libgstapplemedia_la_LIBADD = \
-	$(GST_BASE_LIBS)			\
-	$(GST_PLUGINS_BASE_LIBS)		\
-	-lgstvideo-$(GST_API_VERSION) 		\
-	-lgstaudio-$(GST_API_VERSION)		\
-	-lgstpbutils-$(GST_API_VERSION) 	\
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la 	\
+	$(GST_BASE_LIBS)						\
+	$(GST_PLUGINS_BASE_LIBS)					\
+	-lgstvideo-$(GST_API_VERSION) 					\
+	-lgstaudio-$(GST_API_VERSION)					\
+	-lgstpbutils-$(GST_API_VERSION) 				\
 	$(GMODULE_NO_EXPORT_LIBS)
 
 libgstapplemedia_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) --tag=CC
@@ -910,8 +930,10 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-atdec.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-avfassetsrc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-avfvideosrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-avsamplevideosink.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-coremediabuffer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-corevideobuffer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-corevideotexturecache.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-iosassetsrc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-plugin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstapplemedia_la-qtkitvideosrc.Plo@am__quote@
@@ -1016,6 +1038,13 @@
 @AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstapplemedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstapplemedia_la_CPPFLAGS) $(CPPFLAGS) $(libgstapplemedia_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstapplemedia_la-plugin.lo `test -f 'plugin.m' || echo '$(srcdir)/'`plugin.m
 
+libgstapplemedia_la-corevideotexturecache.lo: corevideotexturecache.m
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(LIBTOOL) $(AM_V_lt) $(libgstapplemedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstapplemedia_la_CPPFLAGS) $(CPPFLAGS) $(libgstapplemedia_la_OBJCFLAGS) $(OBJCFLAGS) -MT libgstapplemedia_la-corevideotexturecache.lo -MD -MP -MF $(DEPDIR)/libgstapplemedia_la-corevideotexturecache.Tpo -c -o libgstapplemedia_la-corevideotexturecache.lo `test -f 'corevideotexturecache.m' || echo '$(srcdir)/'`corevideotexturecache.m
+@am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstapplemedia_la-corevideotexturecache.Tpo $(DEPDIR)/libgstapplemedia_la-corevideotexturecache.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='corevideotexturecache.m' object='libgstapplemedia_la-corevideotexturecache.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstapplemedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstapplemedia_la_CPPFLAGS) $(CPPFLAGS) $(libgstapplemedia_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstapplemedia_la-corevideotexturecache.lo `test -f 'corevideotexturecache.m' || echo '$(srcdir)/'`corevideotexturecache.m
+
 libgstapplemedia_la-iosassetsrc.lo: iosassetsrc.m
 @am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(LIBTOOL) $(AM_V_lt) $(libgstapplemedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstapplemedia_la_CPPFLAGS) $(CPPFLAGS) $(libgstapplemedia_la_OBJCFLAGS) $(OBJCFLAGS) -MT libgstapplemedia_la-iosassetsrc.lo -MD -MP -MF $(DEPDIR)/libgstapplemedia_la-iosassetsrc.Tpo -c -o libgstapplemedia_la-iosassetsrc.lo `test -f 'iosassetsrc.m' || echo '$(srcdir)/'`iosassetsrc.m
 @am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstapplemedia_la-iosassetsrc.Tpo $(DEPDIR)/libgstapplemedia_la-iosassetsrc.Plo
@@ -1044,6 +1073,13 @@
 @AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstapplemedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstapplemedia_la_CPPFLAGS) $(CPPFLAGS) $(libgstapplemedia_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstapplemedia_la-avfassetsrc.lo `test -f 'avfassetsrc.m' || echo '$(srcdir)/'`avfassetsrc.m
 
+libgstapplemedia_la-avsamplevideosink.lo: avsamplevideosink.m
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(LIBTOOL) $(AM_V_lt) $(libgstapplemedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstapplemedia_la_CPPFLAGS) $(CPPFLAGS) $(libgstapplemedia_la_OBJCFLAGS) $(OBJCFLAGS) -MT libgstapplemedia_la-avsamplevideosink.lo -MD -MP -MF $(DEPDIR)/libgstapplemedia_la-avsamplevideosink.Tpo -c -o libgstapplemedia_la-avsamplevideosink.lo `test -f 'avsamplevideosink.m' || echo '$(srcdir)/'`avsamplevideosink.m
+@am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstapplemedia_la-avsamplevideosink.Tpo $(DEPDIR)/libgstapplemedia_la-avsamplevideosink.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='avsamplevideosink.m' object='libgstapplemedia_la-avsamplevideosink.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(libgstapplemedia_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstapplemedia_la_CPPFLAGS) $(CPPFLAGS) $(libgstapplemedia_la_OBJCFLAGS) $(OBJCFLAGS) -c -o libgstapplemedia_la-avsamplevideosink.lo `test -f 'avsamplevideosink.m' || echo '$(srcdir)/'`avsamplevideosink.m
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
diff --git a/sys/applemedia/avfassetsrc.m b/sys/applemedia/avfassetsrc.m
index ac77900..0a40c0d 100644
--- a/sys/applemedia/avfassetsrc.m
+++ b/sys/applemedia/avfassetsrc.m
@@ -1083,7 +1083,7 @@
     return NULL;
   }
 
-  buf = gst_core_media_buffer_new (cmbuf, FALSE);
+  buf = gst_core_media_buffer_new (cmbuf, FALSE, TRUE);
   dur = CMSampleBufferGetDuration (cmbuf);
   ts = CMSampleBufferGetPresentationTimeStamp (cmbuf);
   if (dur.value != 0) {
diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m
index b943c97..f04a977 100644
--- a/sys/applemedia/avfvideosrc.m
+++ b/sys/applemedia/avfvideosrc.m
@@ -24,8 +24,13 @@
 #include "avfvideosrc.h"
 
 #import <AVFoundation/AVFoundation.h>
+#if !HAVE_IOS
+#import <AppKit/AppKit.h>
+#endif
 #include <gst/video/video.h>
+#include <gst/gl/gstglcontext.h>
 #include "coremediabuffer.h"
+#include "corevideotexturecache.h"
 
 #define DEFAULT_DEVICE_INDEX  -1
 #define DEFAULT_DO_STATS      FALSE
@@ -52,6 +57,10 @@
         "framerate = " GST_VIDEO_FPS_RANGE ", "
         "width = " GST_VIDEO_SIZE_RANGE ", "
         "height = " GST_VIDEO_SIZE_RANGE "; "
+
+        GST_VIDEO_CAPS_MAKE_WITH_FEATURES
+        (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
+            "RGBA") "; "
 ));
 
 typedef enum _QueueState {
@@ -69,14 +78,12 @@
 
   gint deviceIndex;
   BOOL doStats;
-#if !HAVE_IOS
-  CGDirectDisplayID displayId;
-#endif
 
   AVCaptureSession *session;
   AVCaptureInput *input;
   AVCaptureVideoDataOutput *output;
   AVCaptureDevice *device;
+  CMClockRef inputClock;
 
   dispatch_queue_t mainQueue;
   dispatch_queue_t workerQueue;
@@ -100,6 +107,7 @@
   BOOL captureScreenMouseClicks;
 
   BOOL useVideoMeta;
+  GstCoreVideoTextureCache *textureCache;
 }
 
 - (id)init;
@@ -118,6 +126,9 @@
 - (BOOL)openDevice;
 - (void)closeDevice;
 - (GstVideoFormat)getGstVideoFormat:(NSNumber *)pixel_format;
+#if !HAVE_IOS
+- (CGDirectDisplayID)getDisplayIdFromDeviceIndex;
+#endif
 - (BOOL)getDeviceCaps:(GstCaps *)result;
 - (BOOL)setDeviceCaps:(GstVideoInfo *)info;
 - (BOOL)getSessionPresetCaps:(GstCaps *)result;
@@ -131,7 +142,6 @@
 - (BOOL)query:(GstQuery *)query;
 - (GstStateChangeReturn)changeState:(GstStateChange)transition;
 - (GstFlowReturn)create:(GstBuffer **)buf;
-- (void)timestampBuffer:(GstBuffer *)buf sampleBuffer:(CMSampleBufferRef)sampleBuffer;
 - (void)updateStatistics;
 - (void)captureOutput:(AVCaptureOutput *)captureOutput
 didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
@@ -161,9 +171,7 @@
     captureScreenCursor = NO;
     captureScreenMouseClicks = NO;
     useVideoMeta = NO;
-#if !HAVE_IOS
-    displayId = kCGDirectMainDisplay;
-#endif
+    textureCache = NULL;
 
     mainQueue =
         dispatch_queue_create ("org.freedesktop.gstreamer.avfvideosrc.main", NULL);
@@ -192,7 +200,7 @@
   NSString *mediaType = AVMediaTypeVideo;
   NSError *err;
 
-  if (deviceIndex == -1) {
+  if (deviceIndex == DEFAULT_DEVICE_INDEX) {
     device = [AVCaptureDevice defaultDeviceWithMediaType:mediaType];
     if (device == nil) {
       GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
@@ -233,8 +241,14 @@
 #if HAVE_IOS
   return NO;
 #else
+  CGDirectDisplayID displayId;
+
   GST_DEBUG_OBJECT (element, "Opening screen input");
 
+  displayId = [self getDisplayIdFromDeviceIndex];
+  if (displayId == 0)
+    return NO;
+
   AVCaptureScreenInput *screenInput =
       [[AVCaptureScreenInput alloc] initWithDisplayID:displayId];
 
@@ -318,9 +332,11 @@
 
     if (caps)
       gst_caps_unref (caps);
+    caps = NULL;
   });
 }
 
+
 #define GST_AVF_CAPS_NEW(format, w, h, fps_n, fps_d)                  \
     (gst_caps_new_simple ("video/x-raw",                              \
         "width", G_TYPE_INT, w,                                       \
@@ -343,6 +359,9 @@
   case kCVPixelFormatType_32BGRA: /* BGRA */
     gst_format = GST_VIDEO_FORMAT_BGRA;
     break;
+  case kCVPixelFormatType_32RGBA: /* RGBA */
+    gst_format = GST_VIDEO_FORMAT_RGBA;
+    break;
   case kCVPixelFormatType_422YpCbCr8_yuvs: /* yuvs */
     gst_format = GST_VIDEO_FORMAT_YUY2;
     break;
@@ -355,6 +374,26 @@
   return gst_format;
 }
 
+#if !HAVE_IOS
+- (CGDirectDisplayID)getDisplayIdFromDeviceIndex
+{
+  NSDictionary *description;
+  NSNumber *displayId;
+  NSArray *screens = [NSScreen screens];
+
+  if (deviceIndex == DEFAULT_DEVICE_INDEX)
+    return kCGDirectMainDisplay;
+  if (deviceIndex >= [screens count]) {
+    GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
+                        ("Invalid screen capture device index"), (NULL));
+    return 0;
+  }
+  description = [[screens objectAtIndex:deviceIndex] deviceDescription];
+  displayId = [description objectForKey:@"NSScreenNumber"];
+  return [displayId unsignedIntegerValue];
+}
+#endif
+
 - (BOOL)getDeviceCaps:(GstCaps *)result
 {
   NSArray *formats = [device valueForKey:@"formats"];
@@ -383,6 +422,12 @@
         GstVideoFormat gst_format = [self getGstVideoFormat:pixel_format];
         if (gst_format != GST_VIDEO_FORMAT_UNKNOWN)
           gst_caps_append (result, GST_AVF_CAPS_NEW (gst_format, dimensions.width, dimensions.height, fps_n, fps_d));
+
+        if (gst_format == GST_VIDEO_FORMAT_BGRA) {
+          GstCaps *rgba_caps = GST_AVF_CAPS_NEW (GST_VIDEO_FORMAT_RGBA, dimensions.width, dimensions.height, fps_n, fps_d);
+          gst_caps_set_features (rgba_caps, 0, gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
+          gst_caps_append (result, rgba_caps);
+        }
       }
     }
   }
@@ -422,7 +467,8 @@
             [device setValue:min_frame_duration forKey:@"activeVideoMinFrameDuration"];
             @try {
               /* Only available on OSX >= 10.8 and iOS >= 7.0 */
-              [device setValue:max_frame_duration forKey:@"activeVideoMaxFrameDuration"];
+              // Restrict activeVideoMaxFrameDuration to the minimum value so we get a better capture frame rate
+              [device setValue:min_frame_duration forKey:@"activeVideoMaxFrameDuration"];
             } @catch (NSException *exception) {
               if (![[exception name] isEqualToString:NSUndefinedKeyException]) {
                 GST_WARNING ("An unexcepted error occured: %s",
@@ -528,7 +574,7 @@
 
   if (captureScreen) {
 #if !HAVE_IOS
-    CGRect rect = CGDisplayBounds (displayId);
+    CGRect rect = CGDisplayBounds ([self getDisplayIdFromDeviceIndex]);
     for (NSNumber *pixel_format in pixel_formats) {
       GstVideoFormat gst_format = [self getGstVideoFormat:pixel_format];
       if (gst_format != GST_VIDEO_FORMAT_UNKNOWN)
@@ -622,6 +668,10 @@
       case GST_VIDEO_FORMAT_YUY2:
          newformat = kCVPixelFormatType_422YpCbCr8_yuvs;
         break;
+      case GST_VIDEO_FORMAT_RGBA:
+        /* In order to do RGBA, we negotiate BGRA (since RGBA is not supported
+         * if not in textures) and then we get RGBA textures via
+         * CVOpenGL*TextureCacheCreateTextureFromImage. Computers. */
       case GST_VIDEO_FORMAT_BGRA:
          newformat = kCVPixelFormatType_32BGRA;
         break;
@@ -641,6 +691,8 @@
         dictionaryWithObject:[NSNumber numberWithInt:newformat]
         forKey:(NSString*)kCVPixelBufferPixelFormatTypeKey];
 
+    if (caps)
+      gst_caps_unref (caps);
     caps = gst_caps_copy (new_caps);
     [session startRunning];
 
@@ -662,6 +714,7 @@
   latency = GST_CLOCK_TIME_NONE;
   startAVFTimestamp = GST_CLOCK_TIME_NONE;
   startTimestamp = GST_CLOCK_TIME_NONE;
+  inputClock = nil;
 
   lastSampling = GST_CLOCK_TIME_NONE;
   count = 0;
@@ -679,6 +732,11 @@
   bufQueueLock = nil;
   [bufQueue release];
   bufQueue = nil;
+  inputClock = nil;
+
+  if (textureCache)
+      gst_core_video_texture_cache_free (textureCache);
+  textureCache = NULL;
 
   return YES;
 }
@@ -688,7 +746,7 @@
   BOOL result = NO;
 
   if (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY) {
-    if (device != nil) {
+    if (device != nil && caps != NULL) {
       GstClockTime min_latency, max_latency;
 
       min_latency = max_latency = latency;
@@ -711,6 +769,29 @@
   useVideoMeta = gst_query_find_allocation_meta (query,
       GST_VIDEO_META_API_TYPE, NULL);
 
+  guint idx;
+  if (gst_query_find_allocation_meta (query,
+        GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx)) {
+    GstGLContext *context;
+    const GstStructure *upload_meta_params;
+
+    gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params);
+    if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext",
+          GST_GL_TYPE_CONTEXT, &context, NULL) && context) {
+      GstCaps *query_caps;
+      GstCapsFeatures *features;
+
+      gst_query_parse_allocation (query, &query_caps, NULL);
+      features = gst_caps_get_features (query_caps, 0);
+      if (gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
+        textureCache = gst_core_video_texture_cache_new (context);
+        gst_core_video_texture_cache_set_format (textureCache,
+            "NV12", query_caps);
+      }
+      gst_object_unref (context);
+    }
+  }
+
   return YES;
 }
 
@@ -753,6 +834,8 @@
 didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
        fromConnection:(AVCaptureConnection *)connection
 {
+  GstClockTime timestamp, duration;
+
   [bufQueueLock lock];
 
   if (stopRequest) {
@@ -760,10 +843,16 @@
     return;
   }
 
+  if (inputClock == nil)
+    inputClock = ((AVCaptureInputPort *)connection.inputPorts[0]).clock;
+  [self getSampleBuffer:sampleBuffer timestamp:&timestamp duration:&duration];
+
   if ([bufQueue count] == BUFFER_QUEUE_SIZE)
     [bufQueue removeLastObject];
 
-  [bufQueue insertObject:(id)sampleBuffer
+  [bufQueue insertObject:@{@"sbuf": (id)sampleBuffer,
+                           @"timestamp": @(timestamp),
+                           @"duration": @(duration)}
                  atIndex:0];
 
   [bufQueueLock unlockWithCondition:HAS_BUFFER_OR_STOP_REQUEST];
@@ -775,6 +864,7 @@
   CVImageBufferRef image_buf;
   CVPixelBufferRef pixel_buf;
   size_t cur_width, cur_height;
+  GstClockTime timestamp, duration;
 
   [bufQueueLock lockWhenCondition:HAS_BUFFER_OR_STOP_REQUEST];
   if (stopRequest) {
@@ -782,7 +872,10 @@
     return GST_FLOW_FLUSHING;
   }
 
-  sbuf = (CMSampleBufferRef) [bufQueue lastObject];
+  NSDictionary *dic = (NSDictionary *) [bufQueue lastObject];
+  sbuf = (CMSampleBufferRef) dic[@"sbuf"];
+  timestamp = (GstClockTime) [dic[@"timestamp"] longLongValue];
+  duration = (GstClockTime) [dic[@"duration"] longLongValue];
   CFRetain (sbuf);
   [bufQueue removeLastObject];
   [bufQueueLock unlockWithCondition:
@@ -809,10 +902,25 @@
     }
   }
 
-  *buf = gst_core_media_buffer_new (sbuf, useVideoMeta);
+  *buf = gst_core_media_buffer_new (sbuf, useVideoMeta, textureCache == NULL);
+  if (format == GST_VIDEO_FORMAT_RGBA) {
+    /* So now buf contains BGRA data (!) . Since downstream is actually going to
+     * use the GL upload meta to get RGBA textures (??), we need to override the
+     * VideoMeta format (!!!). Yes this is confusing, see setCaps:  */
+    GstVideoMeta *video_meta = gst_buffer_get_video_meta (*buf);
+    if (video_meta) {
+      video_meta->format = format;
+    }
+  }
   CFRelease (sbuf);
 
-  [self timestampBuffer:*buf sampleBuffer:sbuf];
+  if (textureCache != NULL)
+    *buf = gst_core_video_texture_cache_get_gl_buffer (textureCache, *buf);
+
+  GST_BUFFER_OFFSET (*buf) = offset++;
+  GST_BUFFER_OFFSET_END (*buf) = GST_BUFFER_OFFSET (buf) + 1;
+  GST_BUFFER_TIMESTAMP (*buf) = timestamp;
+  GST_BUFFER_DURATION (*buf) = duration;
 
   if (doStats)
     [self updateStatistics];
@@ -820,43 +928,39 @@
   return GST_FLOW_OK;
 }
 
-- (void)timestampBuffer:(GstBuffer *)buf
-           sampleBuffer:(CMSampleBufferRef)sbuf
+- (void)getSampleBuffer:(CMSampleBufferRef)sbuf
+              timestamp:(GstClockTime *)outTimestamp
+               duration:(GstClockTime *)outDuration
 {
   CMSampleTimingInfo time_info;
-  GstClockTime timestamp, duration;
+  GstClockTime timestamp, duration, inputClockNow, running_time;
   CMItemCount num_timings;
+  GstClock *clock;
+  CMTime now;
 
   timestamp = GST_CLOCK_TIME_NONE;
   duration = GST_CLOCK_TIME_NONE;
   if (CMSampleBufferGetOutputSampleTimingInfoArray(sbuf, 1, &time_info, &num_timings) == noErr) {
     timestamp = gst_util_uint64_scale (GST_SECOND,
             time_info.presentationTimeStamp.value, time_info.presentationTimeStamp.timescale);
-    duration = gst_util_uint64_scale (GST_SECOND,
-            time_info.duration.value, time_info.duration.timescale);
 
-    if (offset == 0) {
-      GstClock *clock;
+    if (CMTIME_IS_VALID (time_info.duration) && time_info.duration.timescale != 0)
+      duration = gst_util_uint64_scale (GST_SECOND,
+          time_info.duration.value, time_info.duration.timescale);
 
-      GST_OBJECT_LOCK (element);
-      clock = GST_ELEMENT_CLOCK (element);
-      if (clock != NULL) {
-        startTimestamp = gst_clock_get_time (clock) - element->base_time;
-      }
-      GST_OBJECT_UNLOCK (element);
+    now = CMClockGetTime(inputClock);
+    inputClockNow = gst_util_uint64_scale (GST_SECOND,
+        now.value, now.timescale);
 
-      startAVFTimestamp = timestamp;
-    }
-
-    if (GST_CLOCK_TIME_IS_VALID (startAVFTimestamp) &&
-        GST_CLOCK_TIME_IS_VALID (startTimestamp))
-      timestamp = startTimestamp + (timestamp - startAVFTimestamp);
+    GST_OBJECT_LOCK (element);
+    clock = GST_ELEMENT_CLOCK (element);
+    running_time = gst_clock_get_time (clock) - element->base_time;
+    timestamp = running_time + (inputClockNow - timestamp);
+    GST_OBJECT_UNLOCK (element);
   }
 
-  GST_BUFFER_OFFSET (buf) = offset++;
-  GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET (buf) + 1;
-  GST_BUFFER_TIMESTAMP (buf) = timestamp;
-  GST_BUFFER_DURATION (buf) = duration;
+  *outTimestamp = timestamp;
+  *outDuration = duration;
 }
 
 - (void)updateStatistics
diff --git a/sys/applemedia/avsamplevideosink.m b/sys/applemedia/avsamplevideosink.m
new file mode 100644
index 0000000..b6ae56a
--- /dev/null
+++ b/sys/applemedia/avsamplevideosink.m
@@ -0,0 +1,839 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:element-avsamplebufferlayersink
+ *
+ * avsamplebufferlayersink renders video frames to a CALayer that can placed
+ * inside a Core Animation render tree.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "avsamplevideosink.h"
+
+GST_DEBUG_CATEGORY (gst_debug_av_sink);
+#define GST_CAT_DEFAULT gst_debug_av_sink
+
+static void gst_av_sample_video_sink_finalize (GObject * object);
+static void gst_av_sample_video_sink_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * param_spec);
+static void gst_av_sample_video_sink_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * param_spec);
+
+static gboolean gst_av_sample_video_sink_start (GstBaseSink * bsink);
+static gboolean gst_av_sample_video_sink_stop (GstBaseSink * bsink);
+
+static void gst_av_sample_video_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
+    GstClockTime * start, GstClockTime * end);
+static gboolean gst_av_sample_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps);
+static GstCaps * gst_av_sample_video_sink_get_caps (GstBaseSink * bsink, GstCaps * filter);
+static GstFlowReturn gst_av_sample_video_sink_prepare (GstBaseSink * bsink,
+    GstBuffer * buf);
+static GstFlowReturn gst_av_sample_video_sink_show_frame (GstVideoSink * bsink,
+    GstBuffer * buf);
+static gboolean gst_av_sample_video_sink_propose_allocation (GstBaseSink * bsink,
+    GstQuery * query);
+
+static GstStaticPadTemplate gst_av_sample_video_sink_template =
+    GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ RGB, BGR, ARGB, BGRA, ABGR, RGBA, YUY2, UYVY, NV12, I420 }"))
+    );
+
+enum
+{
+  PROR_0,
+  PROP_FORCE_ASPECT_RATIO,
+  PROP_LAYER,
+};
+
+#define gst_av_sample_video_sink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstAVSampleVideoSink, gst_av_sample_video_sink,
+    GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT (gst_debug_av_sink, "avsamplevideosink", 0,
+        "AV Sample Video Sink"));
+
+static void
+gst_av_sample_video_sink_class_init (GstAVSampleVideoSinkClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+  GstBaseSinkClass *gstbasesink_class;
+  GstVideoSinkClass *gstvideosink_class;
+  GstElementClass *element_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+  gstbasesink_class = (GstBaseSinkClass *) klass;
+  gstvideosink_class = (GstVideoSinkClass *) klass;
+  element_class = GST_ELEMENT_CLASS (klass);
+
+  gobject_class->set_property = gst_av_sample_video_sink_set_property;
+  gobject_class->get_property = gst_av_sample_video_sink_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
+      g_param_spec_boolean ("force-aspect-ratio",
+          "Force aspect ratio",
+          "When enabled, scaling will respect original aspect ratio", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_LAYER,
+      g_param_spec_pointer ("layer", "CALayer",
+          "The CoreAnimation layer that can be placed in the render tree",
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  gst_element_class_set_metadata (element_class, "AV Sample video sink",
+      "Sink/Video", "A videosink based on AVSampleBuffer's",
+      "Matthew Waters <matthew@centricular.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_av_sample_video_sink_template));
+
+  gobject_class->finalize = gst_av_sample_video_sink_finalize;
+
+  gstbasesink_class->get_caps = gst_av_sample_video_sink_get_caps;
+  gstbasesink_class->set_caps = gst_av_sample_video_sink_set_caps;
+  gstbasesink_class->get_times = gst_av_sample_video_sink_get_times;
+  gstbasesink_class->prepare = gst_av_sample_video_sink_prepare;
+  gstbasesink_class->propose_allocation = gst_av_sample_video_sink_propose_allocation;
+  gstbasesink_class->stop = gst_av_sample_video_sink_stop;
+  gstbasesink_class->start = gst_av_sample_video_sink_start;
+
+  gstvideosink_class->show_frame =
+      GST_DEBUG_FUNCPTR (gst_av_sample_video_sink_show_frame);
+}
+
+static void
+gst_av_sample_video_sink_init (GstAVSampleVideoSink * av_sink)
+{
+  av_sink->keep_aspect_ratio = TRUE;
+
+  g_mutex_init (&av_sink->render_lock);
+}
+
+static void
+gst_av_sample_video_sink_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstAVSampleVideoSink *av_sink;
+
+  g_return_if_fail (GST_IS_AV_SAMPLE_VIDEO_SINK (object));
+
+  av_sink = GST_AV_SAMPLE_VIDEO_SINK (object);
+
+  switch (prop_id) {
+    case PROP_FORCE_ASPECT_RATIO:
+    {
+      av_sink->keep_aspect_ratio = g_value_get_boolean (value);
+      break;
+    }
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_av_sample_video_sink_finalize (GObject * object)
+{
+  GstAVSampleVideoSink *av_sink = GST_AV_SAMPLE_VIDEO_SINK (object);
+
+  if (av_sink->layer) {
+    dispatch_async (dispatch_get_main_queue (), ^{
+      [av_sink->layer release];
+    });
+  }
+
+  g_mutex_clear (&av_sink->render_lock);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_av_sample_video_sink_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstAVSampleVideoSink *av_sink;
+
+  g_return_if_fail (GST_IS_AV_SAMPLE_VIDEO_SINK (object));
+
+  av_sink = GST_AV_SAMPLE_VIDEO_SINK (object);
+
+  switch (prop_id) {
+    case PROP_FORCE_ASPECT_RATIO:
+      g_value_set_boolean (value, av_sink->keep_aspect_ratio);
+      break;
+    case PROP_LAYER:
+      g_value_set_pointer (value, av_sink->layer);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_av_sample_video_sink_start (GstBaseSink * bsink)
+{
+  GstAVSampleVideoSink *av_sink = GST_AV_SAMPLE_VIDEO_SINK (bsink);
+
+  if ([NSThread isMainThread]) {
+    av_sink->layer = [[AVSampleBufferDisplayLayer alloc] init];
+    if (av_sink->keep_aspect_ratio)
+      av_sink->layer.videoGravity = AVLayerVideoGravityResizeAspect;
+    else
+      av_sink->layer.videoGravity = AVLayerVideoGravityResize;
+    g_object_notify (G_OBJECT (av_sink), "layer");
+  } else {
+    dispatch_sync (dispatch_get_main_queue (), ^{
+      av_sink->layer = [[AVSampleBufferDisplayLayer alloc] init];
+      if (av_sink->keep_aspect_ratio)
+        av_sink->layer.videoGravity = AVLayerVideoGravityResizeAspect;
+      else
+        av_sink->layer.videoGravity = AVLayerVideoGravityResize;
+      g_object_notify (G_OBJECT (av_sink), "layer");
+    });
+  }
+
+  return TRUE;
+}
+
+/* with render lock */
+static void
+_stop_requesting_data (GstAVSampleVideoSink * av_sink)
+{
+  if (av_sink->layer) {
+    if (av_sink->layer_requesting_data)
+      [av_sink->layer stopRequestingMediaData];
+    av_sink->layer_requesting_data = FALSE;
+  }
+}
+
+static gboolean
+gst_av_sample_video_sink_stop (GstBaseSink * bsink)
+{
+  GstAVSampleVideoSink *av_sink = GST_AV_SAMPLE_VIDEO_SINK (bsink);
+
+  if (av_sink->pool) {
+    gst_object_unref (av_sink->pool);
+    av_sink->pool = NULL;
+  }
+
+  if (av_sink->layer) {
+    g_mutex_lock (&av_sink->render_lock);
+    _stop_requesting_data (av_sink);
+    g_mutex_unlock (&av_sink->render_lock);
+    [av_sink->layer flushAndRemoveImage];
+  }
+
+  return TRUE;
+}
+
+static void
+gst_av_sample_video_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
+    GstClockTime * start, GstClockTime * end)
+{
+  GstAVSampleVideoSink *av_sink;
+
+  av_sink = GST_AV_SAMPLE_VIDEO_SINK (bsink);
+
+  if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+    *start = GST_BUFFER_TIMESTAMP (buf);
+    if (GST_BUFFER_DURATION_IS_VALID (buf))
+      *end = *start + GST_BUFFER_DURATION (buf);
+    else {
+      if (GST_VIDEO_INFO_FPS_N (&av_sink->info) > 0) {
+        *end = *start +
+            gst_util_uint64_scale_int (GST_SECOND,
+            GST_VIDEO_INFO_FPS_D (&av_sink->info),
+            GST_VIDEO_INFO_FPS_N (&av_sink->info));
+      }
+    }
+  }
+}
+
+static unsigned int
+_cv_pixel_format_type_from_video_format (GstVideoFormat format)
+{
+  switch (format) {
+    case GST_VIDEO_FORMAT_BGRA:
+      return kCVPixelFormatType_32BGRA;
+    case GST_VIDEO_FORMAT_ARGB:
+      return kCVPixelFormatType_32ARGB;
+    case GST_VIDEO_FORMAT_ABGR:
+      return kCVPixelFormatType_32ABGR;
+    case GST_VIDEO_FORMAT_RGBA:
+      return kCVPixelFormatType_32RGBA;
+    case GST_VIDEO_FORMAT_RGB:
+      return kCVPixelFormatType_24RGB;
+    case GST_VIDEO_FORMAT_BGR:
+      return kCVPixelFormatType_24BGR;
+#if 0
+    /* FIXME doesn't seem to work */
+    case GST_VIDEO_FORMAT_NV12:
+      return kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
+#endif
+    case GST_VIDEO_FORMAT_I420:
+      return kCVPixelFormatType_420YpCbCr8Planar;
+    case GST_VIDEO_FORMAT_YUY2:
+      return kCVPixelFormatType_422YpCbCr8_yuvs;
+    case GST_VIDEO_FORMAT_UYVY:
+      return kCVPixelFormatType_422YpCbCr8;
+    default:
+      return 0;
+  }
+}
+
+static GstVideoFormat
+_pixel_format_description_to_video_format (CFDictionaryRef attrs)
+{
+  CFNumberRef id_ref;
+  unsigned int id;
+
+  id_ref = (CFNumberRef) CFDictionaryGetValue (attrs, kCVPixelFormatConstant);
+  CFNumberGetValue (id_ref, kCFNumberIntType, &id);
+
+  GST_TRACE ("pixel format description id %u", id);
+
+  CFRelease (id_ref);
+
+  switch (id) {
+    case kCVPixelFormatType_32BGRA:
+      return GST_VIDEO_FORMAT_BGRA;
+    case kCVPixelFormatType_32ARGB:
+      return GST_VIDEO_FORMAT_ARGB;
+    case kCVPixelFormatType_32ABGR:
+      return GST_VIDEO_FORMAT_ABGR;
+    case kCVPixelFormatType_32RGBA:
+      return GST_VIDEO_FORMAT_RGBA;
+    case kCVPixelFormatType_24RGB:
+      return GST_VIDEO_FORMAT_RGB;
+    case kCVPixelFormatType_24BGR:
+      return GST_VIDEO_FORMAT_BGR;
+#if 0
+    case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
+      return GST_VIDEO_FORMAT_NV12;
+#endif
+    case kCVPixelFormatType_420YpCbCr8Planar:
+      return GST_VIDEO_FORMAT_I420;
+    case kCVPixelFormatType_422YpCbCr8_yuvs:
+      return GST_VIDEO_FORMAT_YUY2;
+    case kCVPixelFormatType_422YpCbCr8:
+      return GST_VIDEO_FORMAT_UYVY;
+    default:
+      return GST_VIDEO_FORMAT_UNKNOWN;
+  }
+}
+
+static GstCaps *
+gst_av_sample_video_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
+{
+  GstAVSampleVideoSink *av_sink = GST_AV_SAMPLE_VIDEO_SINK (bsink);
+  CFArrayRef formats;
+  GstCaps *ret, *tmp;
+  int i, n;
+
+  formats =
+      CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes
+      (kCFAllocatorDefault);
+
+  ret = gst_caps_new_empty ();
+
+  n = CFArrayGetCount (formats);
+  for (i = 0; i < n; i++) {
+    CFDictionaryRef attrs;
+    CFNumberRef fourcc;
+    unsigned int pixel_format;
+    GstVideoFormat v_format;
+    const char *format_str;
+    char *caps_str;
+
+    fourcc = (CFNumberRef)CFArrayGetValueAtIndex(formats, i);
+    CFNumberGetValue (fourcc, kCFNumberIntType, &pixel_format);
+    attrs = CVPixelFormatDescriptionCreateWithPixelFormatType (kCFAllocatorDefault,
+        pixel_format);
+
+    CFRelease (fourcc);
+
+    v_format = _pixel_format_description_to_video_format (attrs);
+    if (v_format != GST_VIDEO_FORMAT_UNKNOWN) {
+      format_str = gst_video_format_to_string (v_format);
+
+      caps_str = g_strdup_printf ("video/x-raw, format=%s", format_str);
+
+      ret = gst_caps_merge (ret, gst_caps_from_string (caps_str));
+
+      g_free (caps_str);
+    }
+
+    CFRelease (attrs);
+  }
+
+  ret = gst_caps_simplify (ret);
+
+  gst_caps_set_simple (ret, "width", GST_TYPE_INT_RANGE, 0, G_MAXINT, "height",
+      GST_TYPE_INT_RANGE, 0, G_MAXINT, "framerate", GST_TYPE_FRACTION_RANGE, 0,
+      1, G_MAXINT, 1, NULL);
+  GST_DEBUG_OBJECT (av_sink, "returning caps %" GST_PTR_FORMAT, ret);
+
+  if (filter) {
+    tmp = gst_caps_intersect_full (ret, filter, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (ret);
+    ret = tmp;
+  }
+
+  CFRelease (formats);
+
+  return ret;
+}
+
+static gboolean
+gst_av_sample_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
+{
+  GstAVSampleVideoSink *av_sink;
+  gint width;
+  gint height;
+  gboolean ok;
+  gint par_n, par_d;
+  gint display_par_n, display_par_d;
+  guint display_ratio_num, display_ratio_den;
+  GstVideoInfo vinfo;
+  GstStructure *structure;
+  GstBufferPool *newpool, *oldpool;
+
+  GST_DEBUG_OBJECT (bsink, "set caps with %" GST_PTR_FORMAT, caps);
+
+  av_sink = GST_AV_SAMPLE_VIDEO_SINK (bsink);
+
+  ok = gst_video_info_from_caps (&vinfo, caps);
+  if (!ok)
+    return FALSE;
+
+  width = GST_VIDEO_INFO_WIDTH (&vinfo);
+  height = GST_VIDEO_INFO_HEIGHT (&vinfo);
+
+  par_n = GST_VIDEO_INFO_PAR_N (&vinfo);
+  par_d = GST_VIDEO_INFO_PAR_D (&vinfo);
+
+  if (!par_n)
+    par_n = 1;
+
+  display_par_n = 1;
+  display_par_d = 1;
+
+  ok = gst_video_calculate_display_ratio (&display_ratio_num,
+      &display_ratio_den, width, height, par_n, par_d, display_par_n,
+      display_par_d);
+
+  if (!ok)
+    return FALSE;
+
+  GST_TRACE_OBJECT (bsink, "PAR: %u/%u DAR:%u/%u", par_n, par_d, display_par_n,
+      display_par_d);
+
+  if (height % display_ratio_den == 0) {
+    GST_DEBUG_OBJECT (bsink, "keeping video height");
+    GST_VIDEO_SINK_WIDTH (av_sink) = (guint)
+        gst_util_uint64_scale_int (height, display_ratio_num,
+        display_ratio_den);
+    GST_VIDEO_SINK_HEIGHT (av_sink) = height;
+  } else if (width % display_ratio_num == 0) {
+    GST_DEBUG_OBJECT (bsink, "keeping video width");
+    GST_VIDEO_SINK_WIDTH (av_sink) = width;
+    GST_VIDEO_SINK_HEIGHT (av_sink) = (guint)
+        gst_util_uint64_scale_int (width, display_ratio_den, display_ratio_num);
+  } else {
+    GST_DEBUG_OBJECT (bsink, "approximating while keeping video height");
+    GST_VIDEO_SINK_WIDTH (av_sink) = (guint)
+        gst_util_uint64_scale_int (height, display_ratio_num,
+        display_ratio_den);
+    GST_VIDEO_SINK_HEIGHT (av_sink) = height;
+  }
+  GST_DEBUG_OBJECT (bsink, "scaling to %dx%d", GST_VIDEO_SINK_WIDTH (av_sink),
+      GST_VIDEO_SINK_HEIGHT (av_sink));
+
+  av_sink->info = vinfo;
+
+  newpool = gst_video_buffer_pool_new ();
+  structure = gst_buffer_pool_get_config (newpool);
+  gst_buffer_pool_config_set_params (structure, caps, vinfo.size, 2, 0);
+  gst_buffer_pool_set_config (newpool, structure);
+
+  oldpool = av_sink->pool;
+  /* we don't activate the pool yet, this will be done by downstream after it
+   * has configured the pool. If downstream does not want our pool we will
+   * activate it when we render into it */
+  av_sink->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);
+  }
+
+  return TRUE;
+}
+
+static void
+_unmap_planar_frame (GstVideoFrame * v_frame, const void * data, gsize dataSize,
+    gsize numberOfPlanes, const void *planeAddressed[])
+{
+  GST_TRACE ("freeing video frame %p", v_frame);
+
+  gst_video_frame_unmap (v_frame);
+  g_free (v_frame);
+}
+
+static void
+_unmap_frame (GstVideoFrame * v_frame, const void * data)
+{
+  GST_TRACE ("freeing video frame %p", v_frame);
+
+  gst_video_frame_unmap (v_frame);
+  g_free (v_frame);
+}
+
+/* with render lock */
+static gboolean
+_enqueue_sample (GstAVSampleVideoSink * av_sink, GstBuffer *buf)
+{
+  CVPixelBufferRef pbuf;
+  CMVideoFormatDescriptionRef v_format_desc;
+  GstVideoFrame *v_frame;
+  CMSampleTimingInfo sample_time;
+  __block CMSampleBufferRef sample_buf;
+  CFArrayRef sample_attachments;
+  gsize l, r, t, b;
+  gint i;
+
+  GST_TRACE_OBJECT (av_sink, "redisplay of size:%ux%u, window size:%ux%u",
+      GST_VIDEO_INFO_WIDTH (&av_sink->info),
+      GST_VIDEO_INFO_HEIGHT (&av_sink->info),
+      GST_VIDEO_SINK_WIDTH (av_sink),
+      GST_VIDEO_SINK_HEIGHT (av_sink));
+
+  v_frame = g_new0 (GstVideoFrame, 1);
+
+  if (!gst_video_frame_map (v_frame, &av_sink->info, buf, GST_MAP_READ)) {
+    GST_ERROR_OBJECT (av_sink, "Failed to map input video frame");
+    g_free (v_frame);
+    return FALSE;
+  }
+
+  if (GST_VIDEO_INFO_N_PLANES (&v_frame->info) == 1) {
+    /* single plane */
+    if (kCVReturnSuccess != CVPixelBufferCreateWithBytes (NULL,
+        GST_VIDEO_INFO_WIDTH (&v_frame->info),
+        GST_VIDEO_INFO_HEIGHT (&v_frame->info),
+        _cv_pixel_format_type_from_video_format (GST_VIDEO_INFO_FORMAT (&v_frame->info)),
+        v_frame->data[0], v_frame->info.stride[0],
+        (CVPixelBufferReleaseBytesCallback) _unmap_frame, v_frame, NULL,
+        &pbuf)) {
+      GST_ERROR_OBJECT (av_sink, "Error creating Core Video pixel buffer");
+      gst_video_frame_unmap (v_frame);
+      g_free (v_frame);
+      return FALSE;
+    }
+  } else {
+    /* multi-planar */
+    gsize widths[GST_VIDEO_MAX_PLANES] = { 0, };
+    gsize heights[GST_VIDEO_MAX_PLANES] = { 0, };
+    gsize strides[GST_VIDEO_MAX_PLANES] = { 0, };
+    gint i;
+
+    for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&v_frame->info); i++) {
+      widths[i] = GST_VIDEO_INFO_COMP_WIDTH (&v_frame->info, i);
+      heights[i] = GST_VIDEO_INFO_COMP_HEIGHT (&v_frame->info, i);
+      strides[i] = GST_VIDEO_INFO_COMP_STRIDE (&v_frame->info, i);
+    }
+
+    if (kCVReturnSuccess != CVPixelBufferCreateWithPlanarBytes (NULL,
+        GST_VIDEO_INFO_WIDTH (&v_frame->info),
+        GST_VIDEO_INFO_HEIGHT (&v_frame->info),
+        _cv_pixel_format_type_from_video_format (GST_VIDEO_INFO_FORMAT (&v_frame->info)),
+         /* have to put something for these two parameters otherwise
+          * the callback is not called resulting in a big leak */
+        v_frame, v_frame->info.size,
+        GST_VIDEO_INFO_N_PLANES (&v_frame->info), v_frame->data,
+        widths, heights, strides,
+        (CVPixelBufferReleasePlanarBytesCallback) _unmap_planar_frame,
+        v_frame, NULL, &pbuf)) {
+      GST_ERROR_OBJECT (av_sink, "Error creating Core Video pixel buffer");
+      gst_video_frame_unmap (v_frame);
+      g_free (v_frame);
+      return FALSE;
+    }
+  }
+
+  CVPixelBufferLockBaseAddress (pbuf, kCVPixelBufferLock_ReadOnly);
+
+  CVPixelBufferGetExtendedPixels (pbuf, &l, &r, &t, &b);
+
+  GST_TRACE_OBJECT (av_sink, "CVPixelBuffer n_planes %u width %u height %u"
+      " data size %" G_GSIZE_FORMAT " extra pixels l %u r %u t %u b %u",
+      (guint) CVPixelBufferGetPlaneCount (pbuf),
+      (guint) CVPixelBufferGetWidth (pbuf),
+      (guint) CVPixelBufferGetHeight (pbuf),
+      CVPixelBufferGetDataSize (pbuf),
+      (guint) l, (guint) r, (guint) t, (guint) b);
+
+  GST_TRACE_OBJECT (av_sink, "GstVideoFrame n_planes %u width %u height %u"
+      " data size %"G_GSIZE_FORMAT " extra pixels l %u r %u t %u b %u",
+      GST_VIDEO_INFO_N_PLANES (&v_frame->info),
+      GST_VIDEO_INFO_WIDTH (&v_frame->info),
+      GST_VIDEO_INFO_HEIGHT (&v_frame->info),
+      v_frame->info.size, 0, 0, 0, 0);
+
+  if (GST_VIDEO_INFO_N_PLANES (&v_frame->info) > 1) {
+    for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&v_frame->info); i++) {
+      GST_TRACE_OBJECT (av_sink, "plane %i CVPixelBuffer width %u height %u "
+          "stride %u data %p", i,
+          (guint) CVPixelBufferGetWidthOfPlane (pbuf, i),
+          (guint) CVPixelBufferGetHeightOfPlane (pbuf, i),
+          (guint) CVPixelBufferGetBytesPerRowOfPlane (pbuf, i),
+          CVPixelBufferGetBaseAddressOfPlane (pbuf, i));
+      GST_TRACE_OBJECT (av_sink, "plane %i GstVideoFrame width %u height %u "
+          "stride %u data %p", i,
+          GST_VIDEO_INFO_COMP_WIDTH (&v_frame->info, i),
+          GST_VIDEO_INFO_COMP_HEIGHT (&v_frame->info, i),
+          GST_VIDEO_INFO_COMP_STRIDE (&v_frame->info, i),
+          CVPixelBufferGetBaseAddressOfPlane (pbuf, i));
+    }
+  } else {
+    GST_TRACE_OBJECT (av_sink, "CVPixelBuffer attrs stride %u data %p",
+      (guint) CVPixelBufferGetBytesPerRow (pbuf),
+      CVPixelBufferGetBaseAddress (pbuf));
+    GST_TRACE_OBJECT (av_sink, "GstVideoFrame attrs stride %u data %p",
+        v_frame->info.stride[0], v_frame->data[0]);
+  }
+
+  CVPixelBufferUnlockBaseAddress (pbuf, kCVPixelBufferLock_ReadOnly);
+
+  if (0 != CMVideoFormatDescriptionCreateForImageBuffer (kCFAllocatorDefault,
+        pbuf, &v_format_desc)) {
+    GST_ERROR_OBJECT (av_sink, "Failed to retreive video format from "
+        "pixel buffer");
+    CFRelease (pbuf);
+    return FALSE;
+  }
+
+  sample_time.duration = CMTimeMake (GST_BUFFER_DURATION (buf), GST_SECOND);
+  sample_time.presentationTimeStamp = CMTimeMake (GST_BUFFER_PTS (buf), GST_SECOND);
+  sample_time.decodeTimeStamp = kCMTimeInvalid;
+
+  if (0 != CMSampleBufferCreateForImageBuffer (kCFAllocatorDefault, pbuf, TRUE,
+        NULL, NULL, v_format_desc, &sample_time, &sample_buf)) {
+    GST_ERROR_OBJECT (av_sink, "Failed to create CMSampleBuffer from "
+        "CVImageBuffer");
+    CFRelease (v_format_desc);
+    CFRelease (pbuf);
+    return FALSE;
+  }
+  CFRelease (v_format_desc);
+
+  sample_attachments = CMSampleBufferGetSampleAttachmentsArray (sample_buf, TRUE);
+  for (i = 0; i < CFArrayGetCount (sample_attachments); i++) {
+    CFMutableDictionaryRef attachments =
+       (CFMutableDictionaryRef) CFArrayGetValueAtIndex (sample_attachments, i);
+    /* Until we slave the CoreMedia clock, just display everything ASAP */
+    CFDictionarySetValue (attachments, kCMSampleAttachmentKey_DisplayImmediately,
+        kCFBooleanTrue);
+  }
+
+  if (av_sink->keep_aspect_ratio)
+    av_sink->layer.videoGravity = AVLayerVideoGravityResizeAspect;
+  else
+    av_sink->layer.videoGravity = AVLayerVideoGravityResize;
+  [av_sink->layer enqueueSampleBuffer:sample_buf];
+
+  CFRelease (pbuf);
+  CFRelease (sample_buf);
+
+  return TRUE;
+}
+
+static void
+_request_data (GstAVSampleVideoSink * av_sink)
+{
+  av_sink->layer_requesting_data = TRUE;
+
+  [av_sink->layer requestMediaDataWhenReadyOnQueue:
+        dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
+        usingBlock:^{
+    while (TRUE) {
+      /* don't needlessly fill up avsamplebufferdisplaylayer's queue.
+       * This also allows us to skip displaying late frames */
+      if (!av_sink->layer.readyForMoreMediaData)
+        break;
+
+      g_mutex_lock (&av_sink->render_lock);
+
+      if (!av_sink->buffer || av_sink->render_flow_return != GST_FLOW_OK) {
+        _stop_requesting_data (av_sink);
+        g_mutex_unlock (&av_sink->render_lock);
+        break;
+      }
+
+      if (!_enqueue_sample (av_sink, av_sink->buffer)) {
+        gst_buffer_unref (av_sink->buffer);
+        av_sink->buffer = NULL;
+        av_sink->render_flow_return = GST_FLOW_ERROR;
+        g_mutex_unlock (&av_sink->render_lock);
+        break;
+      }
+
+      gst_buffer_unref (av_sink->buffer);
+      av_sink->buffer = NULL;
+      av_sink->render_flow_return = GST_FLOW_OK;
+      g_mutex_unlock (&av_sink->render_lock);
+    }
+  }];
+}
+
+static GstFlowReturn
+gst_av_sample_video_sink_prepare (GstBaseSink * bsink, GstBuffer * buf)
+{
+  GstAVSampleVideoSink *av_sink;
+
+  av_sink = GST_AV_SAMPLE_VIDEO_SINK (bsink);
+
+  GST_LOG_OBJECT (bsink, "preparing buffer:%p", buf);
+
+  if (GST_VIDEO_SINK_WIDTH (av_sink) < 1 ||
+      GST_VIDEO_SINK_HEIGHT (av_sink) < 1) {
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+
+  return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+gst_av_sample_video_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
+{
+  GstAVSampleVideoSink *av_sink;
+  GstFlowReturn ret;
+
+  GST_TRACE_OBJECT (vsink, "rendering buffer:%p", buf);
+
+  av_sink = GST_AV_SAMPLE_VIDEO_SINK (vsink);
+
+  g_mutex_lock (&av_sink->render_lock);
+  if (av_sink->buffer)
+    gst_buffer_unref (av_sink->buffer);
+  av_sink->buffer = gst_buffer_ref (buf);
+  ret = av_sink->render_flow_return;
+
+  if (!av_sink->layer_requesting_data)
+    _request_data (av_sink);
+  g_mutex_unlock (&av_sink->render_lock);
+
+  if ([av_sink->layer status] == AVQueuedSampleBufferRenderingStatusFailed) {
+    GST_ERROR_OBJECT (av_sink, "failed to enqueue buffer on layer, %s",
+        [[[av_sink->layer error] description] UTF8String]);
+    return GST_FLOW_ERROR;
+  }
+
+  return ret;
+}
+
+static gboolean
+gst_av_sample_video_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
+{
+  GstAVSampleVideoSink *av_sink = GST_AV_SAMPLE_VIDEO_SINK (bsink);
+  GstBufferPool *pool;
+  GstStructure *config;
+  GstCaps *caps;
+  guint size;
+  gboolean need_pool;
+
+  gst_query_parse_allocation (query, &caps, &need_pool);
+
+  if (caps == NULL)
+    goto no_caps;
+
+  if ((pool = av_sink->pool))
+    gst_object_ref (pool);
+
+  if (pool != NULL) {
+    GstCaps *pcaps;
+
+    /* we had a pool, check caps */
+    GST_DEBUG_OBJECT (av_sink, "check existing pool caps");
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
+
+    if (!gst_caps_is_equal (caps, pcaps)) {
+      GST_DEBUG_OBJECT (av_sink, "pool has different caps");
+      /* different caps, we can't use this pool */
+      gst_object_unref (pool);
+      pool = NULL;
+    }
+    gst_structure_free (config);
+  }
+
+  if (pool == NULL && need_pool) {
+    GstVideoInfo info;
+
+    if (!gst_video_info_from_caps (&info, caps))
+      goto invalid_caps;
+
+    GST_DEBUG_OBJECT (av_sink, "create new pool");
+    pool = gst_video_buffer_pool_new ();
+
+    /* the normal size of a frame */
+    size = info.size;
+
+    config = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_set_params (config, caps, size, 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 */
+  if (pool) {
+    gst_query_add_allocation_pool (query, pool, size, 2, 0);
+    gst_object_unref (pool);
+  }
+
+  /* we also support various metadata */
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
+
+  return TRUE;
+
+  /* ERRORS */
+no_caps:
+  {
+    GST_DEBUG_OBJECT (bsink, "no caps specified");
+    return FALSE;
+  }
+invalid_caps:
+  {
+    GST_DEBUG_OBJECT (bsink, "invalid caps specified");
+    return FALSE;
+  }
+config_failed:
+  {
+    GST_DEBUG_OBJECT (bsink, "failed setting config");
+    return FALSE;
+  }
+}
diff --git a/sys/applemedia/coremediabuffer.c b/sys/applemedia/coremediabuffer.c
index 74b814b..1070da5 100644
--- a/sys/applemedia/coremediabuffer.c
+++ b/sys/applemedia/coremediabuffer.c
@@ -76,6 +76,8 @@
       return GST_VIDEO_FORMAT_UYVY;
     case kCVPixelFormatType_32BGRA:
       return GST_VIDEO_FORMAT_BGRA;
+    case kCVPixelFormatType_32RGBA:
+      return GST_VIDEO_FORMAT_RGBA;
     default:
       GST_WARNING ("Unknown OSType format: %d", (gint) format);
       return GST_VIDEO_FORMAT_UNKNOWN;
@@ -84,7 +86,7 @@
 
 static gboolean
 gst_core_media_buffer_wrap_pixel_buffer (GstBuffer * buf, GstVideoInfo * info,
-    CVPixelBufferRef pixel_buf, gboolean * has_padding)
+    CVPixelBufferRef pixel_buf, gboolean * has_padding, gboolean map)
 {
   guint n_planes;
   gsize offset[GST_VIDEO_MAX_PLANES] = { 0 };
@@ -92,7 +94,7 @@
   GstVideoMeta *video_meta;
   UInt32 size;
 
-  if (CVPixelBufferLockBaseAddress (pixel_buf, 0) != kCVReturnSuccess) {
+  if (map && CVPixelBufferLockBaseAddress (pixel_buf, 0) != kCVReturnSuccess) {
     GST_ERROR ("Could not lock pixel buffer base address");
     return FALSE;
   }
@@ -114,10 +116,12 @@
       offset[i] = plane_offset;
       plane_offset += size;
 
-      gst_buffer_append_memory (buf,
-          gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
-              CVPixelBufferGetBaseAddressOfPlane (pixel_buf, i), size, 0, size,
-              NULL, NULL));
+      if (map) {
+        gst_buffer_append_memory (buf,
+            gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
+                CVPixelBufferGetBaseAddressOfPlane (pixel_buf, i), size, 0,
+                size, NULL, NULL));
+      }
     }
   } else {
 
@@ -126,10 +130,12 @@
     offset[0] = 0;
     size = stride[0] * CVPixelBufferGetHeight (pixel_buf);
 
-    gst_buffer_append_memory (buf,
-        gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
-            CVPixelBufferGetBaseAddress (pixel_buf), size, 0, size, NULL,
-            NULL));
+    if (map) {
+      gst_buffer_append_memory (buf,
+          gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
+              CVPixelBufferGetBaseAddress (pixel_buf), size, 0, size, NULL,
+              NULL));
+    }
   }
 
   video_meta =
@@ -235,7 +241,7 @@
 
 GstBuffer *
 gst_core_media_buffer_new (CMSampleBufferRef sample_buf,
-    gboolean use_video_meta)
+    gboolean use_video_meta, gboolean map)
 {
   CVImageBufferRef image_buf;
   CMBlockBufferRef block_buf;
@@ -269,13 +275,13 @@
     }
 
     if (!gst_core_media_buffer_wrap_pixel_buffer (buf, &info, meta->pixel_buf,
-            &has_padding)) {
+            &has_padding, map)) {
       goto error;
     }
 
     /* If the video meta API is not supported, remove padding by
      * copying the core media buffer to a system memory buffer */
-    if (has_padding && !use_video_meta) {
+    if (map && has_padding && !use_video_meta) {
       GstBuffer *copy_buf;
       copy_buf = gst_core_media_buffer_new_from_buffer (buf, &info);
       if (!copy_buf) {
@@ -287,11 +293,9 @@
     }
 
   } else if (block_buf != NULL) {
-
-    if (!gst_core_media_buffer_wrap_block_buffer (buf, block_buf)) {
+    if (map && !gst_core_media_buffer_wrap_block_buffer (buf, block_buf)) {
       goto error;
     }
-
   } else {
     goto error;
   }
diff --git a/sys/applemedia/coremediabuffer.h b/sys/applemedia/coremediabuffer.h
index bc18acf..2b3b74d 100644
--- a/sys/applemedia/coremediabuffer.h
+++ b/sys/applemedia/coremediabuffer.h
@@ -43,7 +43,8 @@
 
 
 GstBuffer * gst_core_media_buffer_new      (CMSampleBufferRef sample_buf,
-                                            gboolean use_video_meta);
+                                            gboolean use_video_meta,
+                                            gboolean map);
 CVPixelBufferRef gst_core_media_buffer_get_pixel_buffer
                                            (GstBuffer * buf);
 GType gst_core_media_meta_api_get_type (void);
diff --git a/sys/applemedia/corevideobuffer.c b/sys/applemedia/corevideobuffer.c
index b1da334..269e19d 100644
--- a/sys/applemedia/corevideobuffer.c
+++ b/sys/applemedia/corevideobuffer.c
@@ -59,7 +59,8 @@
 }
 
 GstBuffer *
-gst_core_video_buffer_new (CVBufferRef cvbuf, GstVideoInfo * vinfo)
+gst_core_video_buffer_new (CVBufferRef cvbuf, GstVideoInfo * vinfo,
+    gboolean map)
 {
   CVPixelBufferRef pixbuf = NULL;
   GstBuffer *buf;
@@ -74,7 +75,7 @@
 
   pixbuf = (CVPixelBufferRef) cvbuf;
 
-  if (CVPixelBufferLockBaseAddress (pixbuf, 0) != kCVReturnSuccess) {
+  if (map && CVPixelBufferLockBaseAddress (pixbuf, 0) != kCVReturnSuccess) {
     goto error;
   }
 
@@ -101,10 +102,12 @@
       offset[i] = off;
       off += size;
 
-      gst_buffer_append_memory (buf,
-          gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
-              CVPixelBufferGetBaseAddressOfPlane (pixbuf, i), size, 0, size,
-              NULL, NULL));
+      if (map) {
+        gst_buffer_append_memory (buf,
+            gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
+                CVPixelBufferGetBaseAddressOfPlane (pixbuf, i), size, 0, size,
+                NULL, NULL));
+      }
     }
   } else {
     int size;
@@ -114,9 +117,11 @@
     offset[0] = 0;
     size = stride[0] * CVPixelBufferGetHeight (pixbuf);
 
-    gst_buffer_append_memory (buf,
-        gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
-            CVPixelBufferGetBaseAddress (pixbuf), size, 0, size, NULL, NULL));
+    if (map) {
+      gst_buffer_append_memory (buf,
+          gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
+              CVPixelBufferGetBaseAddress (pixbuf), size, 0, size, NULL, NULL));
+    }
   }
 
   if (vinfo) {
diff --git a/sys/applemedia/corevideobuffer.h b/sys/applemedia/corevideobuffer.h
index 53b16a9..8f58a6e 100644
--- a/sys/applemedia/corevideobuffer.h
+++ b/sys/applemedia/corevideobuffer.h
@@ -41,7 +41,8 @@
 } GstCoreVideoMeta;
 
 GstBuffer * gst_core_video_buffer_new      (CVBufferRef cvbuf,
-                                            GstVideoInfo *info);
+                                            GstVideoInfo *info,
+                                            gboolean map);
 GType gst_core_video_meta_api_get_type (void);
 
 G_END_DECLS
diff --git a/sys/applemedia/corevideotexturecache.m b/sys/applemedia/corevideotexturecache.m
new file mode 100644
index 0000000..0bd4afa
--- /dev/null
+++ b/sys/applemedia/corevideotexturecache.m
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2010 Ole André Vadla Ravnås <oleavr@soundrop.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#if !HAVE_IOS
+#import <AppKit/AppKit.h>
+#include <gst/gl/cocoa/gstglcontext_cocoa.h>
+#endif
+#include "corevideotexturecache.h"
+#include "coremediabuffer.h"
+#include "corevideobuffer.h"
+#include "vtutil.h"
+
+typedef struct _ContextThreadData
+{
+  GstCoreVideoTextureCache *cache;
+  GstBuffer *input_buffer;
+  GstBuffer *output_buffer;
+} ContextThreadData;
+
+GstCoreVideoTextureCache *
+gst_core_video_texture_cache_new (GstGLContext * ctx)
+{
+  g_return_val_if_fail (ctx != NULL, NULL);
+
+  GstCoreVideoTextureCache *cache = g_new0 (GstCoreVideoTextureCache, 1);
+  cache->ctx = gst_object_ref (ctx);
+  gst_video_info_init (&cache->input_info);
+  cache->convert = gst_gl_color_convert_new (cache->ctx);
+
+#if !HAVE_IOS
+  CGLPixelFormatObj pixelFormat =
+      gst_gl_context_cocoa_get_pixel_format (GST_GL_CONTEXT_COCOA (ctx));
+  CGLContextObj platform_ctx =
+      (CGLContextObj) gst_gl_context_get_gl_context (ctx);
+  CVOpenGLTextureCacheCreate (kCFAllocatorDefault, NULL, platform_ctx,
+      pixelFormat, NULL, &cache->cache);
+#else
+  CFMutableDictionaryRef cache_attrs =
+      CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
+      &kCFTypeDictionaryValueCallBacks);
+  gst_vtutil_dict_set_i32 (cache_attrs,
+      kCVOpenGLESTextureCacheMaximumTextureAgeKey, 0);
+  CVOpenGLESTextureCacheCreate (kCFAllocatorDefault, (CFDictionaryRef) cache_attrs,
+      (CVEAGLContext) gst_gl_context_get_gl_context (ctx), NULL, &cache->cache);
+#endif
+
+  return cache;
+}
+
+void
+gst_core_video_texture_cache_free (GstCoreVideoTextureCache * cache)
+{
+  g_return_if_fail (cache != NULL);
+
+#if !HAVE_IOS
+  CVOpenGLTextureCacheRelease (cache->cache);
+#else
+  /* FIXME: how do we release ->cache ? */
+#endif
+  gst_object_unref (cache->convert);
+  gst_object_unref (cache->ctx);
+  g_free (cache);
+}
+
+void
+gst_core_video_texture_cache_set_format (GstCoreVideoTextureCache * cache,
+    const gchar * input_format, GstCaps * out_caps)
+{
+  GstCaps *in_caps;
+  GstCapsFeatures *features;
+
+  g_return_if_fail (gst_caps_is_fixed (out_caps));
+
+  out_caps = gst_caps_copy (out_caps);
+  features = gst_caps_get_features (out_caps, 0);
+  gst_caps_features_add (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  gst_video_info_from_caps (&cache->output_info, out_caps); 
+  
+  in_caps = gst_caps_copy (out_caps);
+  gst_caps_set_simple (in_caps, "format", G_TYPE_STRING, input_format, NULL);
+  features = gst_caps_get_features (in_caps, 0);
+  gst_caps_features_add (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
+  gst_video_info_from_caps (&cache->input_info, in_caps);
+
+  gst_gl_color_convert_set_caps (cache->convert, in_caps, out_caps);
+
+  gst_caps_unref (out_caps);
+  gst_caps_unref (in_caps);
+}
+
+static CVPixelBufferRef
+cv_pixel_buffer_from_gst_buffer (GstBuffer * buffer)
+{
+  GstCoreMediaMeta *cm_meta =
+      (GstCoreMediaMeta *) gst_buffer_get_meta (buffer,
+      gst_core_media_meta_api_get_type ());
+  GstCoreVideoMeta *cv_meta =
+      (GstCoreVideoMeta *) gst_buffer_get_meta (buffer,
+      gst_core_video_meta_api_get_type ());
+
+  g_return_val_if_fail (cm_meta || cv_meta, NULL);
+
+  return cm_meta ? cm_meta->pixel_buf : cv_meta->pixbuf;
+}
+
+static gboolean
+gl_mem_from_buffer (GstCoreVideoTextureCache * cache,
+        GstBuffer * buffer, GstMemory **mem1, GstMemory **mem2)
+{
+#if !HAVE_IOS
+  CVOpenGLTextureRef texture = NULL;
+#else
+  CVOpenGLESTextureRef texture = NULL;
+#endif
+  CVPixelBufferRef pixel_buf = cv_pixel_buffer_from_gst_buffer (buffer);
+
+  *mem1 = NULL;
+  *mem2 = NULL;
+
+#if !HAVE_IOS
+  CVOpenGLTextureCacheFlush (cache->cache, 0);
+
+  if (CVOpenGLTextureCacheCreateTextureFromImage (kCFAllocatorDefault,
+      cache->cache, pixel_buf, NULL, &texture) != kCVReturnSuccess)
+    goto error;
+
+  *mem1 = (GstMemory *) gst_gl_memory_wrapped_texture (cache->ctx,
+      CVOpenGLTextureGetName (texture), CVOpenGLTextureGetTarget (texture),
+      &cache->input_info, 0, NULL, texture, (GDestroyNotify) CFRelease);
+#else
+  CVOpenGLESTextureCacheFlush (cache->cache, 0);
+
+  if (CVOpenGLESTextureCacheCreateTextureFromImage (kCFAllocatorDefault,
+      cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, GL_LUMINANCE,
+      GST_VIDEO_INFO_WIDTH (&cache->input_info),
+      GST_VIDEO_INFO_HEIGHT (&cache->input_info),
+      GL_LUMINANCE, GL_UNSIGNED_BYTE, 0, &texture) != kCVReturnSuccess)
+    goto error;
+
+  *mem1 = (GstMemory *) gst_gl_memory_wrapped_texture (cache->ctx,
+      CVOpenGLESTextureGetName (texture), CVOpenGLESTextureGetTarget (texture),
+      &cache->input_info, 0, NULL, texture, (GDestroyNotify) CFRelease);
+
+  if (CVOpenGLESTextureCacheCreateTextureFromImage (kCFAllocatorDefault,
+      cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, GL_LUMINANCE_ALPHA,
+      GST_VIDEO_INFO_WIDTH (&cache->input_info) / 2,
+      GST_VIDEO_INFO_HEIGHT (&cache->input_info) / 2,
+      GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 1, &texture) != kCVReturnSuccess)
+    goto error;
+
+  *mem2 = (GstMemory *) gst_gl_memory_wrapped_texture (cache->ctx,
+      CVOpenGLESTextureGetName (texture), CVOpenGLESTextureGetTarget (texture),
+      &cache->input_info, 0, NULL, texture, (GDestroyNotify) CFRelease);
+#endif
+
+  return TRUE;
+
+error:
+  if (*mem1)
+      gst_memory_unref (*mem1);
+  if (*mem2)
+      gst_memory_unref (*mem2);
+
+  return FALSE;
+}
+
+static void
+_do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
+{
+  GstMemory *mem1 = NULL, *mem2 = NULL;
+  GstCoreVideoTextureCache *cache = data->cache;
+  GstBuffer *buffer = data->input_buffer;
+
+  if (!gl_mem_from_buffer (cache, buffer, &mem1, &mem2)) {
+    gst_buffer_unref (buffer);
+    data->output_buffer = NULL;
+    return;
+  }
+
+  gst_buffer_append_memory (buffer, mem1);
+  if (mem2)
+    gst_buffer_append_memory (buffer, mem2);
+
+  data->output_buffer = gst_gl_color_convert_perform (cache->convert, buffer);
+  gst_buffer_unref (buffer);
+}
+
+GstBuffer *
+gst_core_video_texture_cache_get_gl_buffer (GstCoreVideoTextureCache * cache,
+        GstBuffer * cv_buffer)
+{
+  ContextThreadData data = {cache, cv_buffer, NULL};
+  gst_gl_context_thread_add (cache->ctx,
+      (GstGLContextThreadFunc) _do_get_gl_buffer, &data);
+  return data.output_buffer;
+}
diff --git a/sys/applemedia/plugin.m b/sys/applemedia/plugin.m
index 44ff3e4..7bd2445 100644
--- a/sys/applemedia/plugin.m
+++ b/sys/applemedia/plugin.m
@@ -30,6 +30,7 @@
 #ifdef HAVE_AVFOUNDATION
 #include "avfvideosrc.h"
 #include "avfassetsrc.h"
+#include "avsamplevideosink.h"
 #endif
 #ifdef HAVE_VIDEOTOOLBOX
 #include "vtdec.h"
@@ -77,6 +78,8 @@
       GST_TYPE_AVF_VIDEO_SRC);
   res &= gst_element_register (plugin, "avfassetsrc", AV_RANK,
       GST_TYPE_AVF_ASSET_SRC);
+  res &= gst_element_register (plugin, "avsamplebufferlayersink",
+      GST_RANK_NONE, GST_TYPE_AV_SAMPLE_VIDEO_SINK);
 #endif
 
   res &= gst_element_register (plugin, "atdec", GST_RANK_MARGINAL, GST_TYPE_ATDEC);
@@ -84,11 +87,12 @@
 #ifdef HAVE_VIDEOTOOLBOX
   /* Check if the framework actually exists at runtime */
   if (VTCompressionSessionCreate != NULL) {
-    res &= gst_element_register (plugin, "vtdec", GST_RANK_PRIMARY, GST_TYPE_VTDEC);
+    gst_vtdec_register_elements (plugin);
     gst_vtenc_register_elements (plugin);
   }
 #endif
 
+
   return res;
 }
 
diff --git a/sys/applemedia/qtkitvideosrc.m b/sys/applemedia/qtkitvideosrc.m
index e6b427f..2c15bb5 100644
--- a/sys/applemedia/qtkitvideosrc.m
+++ b/sys/applemedia/qtkitvideosrc.m
@@ -434,7 +434,7 @@
   [queueLock unlockWithCondition:
       ([queue count] == 0) ? NO_FRAMES : HAS_FRAME_OR_STOP_REQUEST];
 
-  *buf = gst_core_video_buffer_new ((CVBufferRef)frame, NULL);
+  *buf = gst_core_video_buffer_new ((CVBufferRef)frame, NULL, TRUE);
   CVBufferRelease (frame);
 
   [self timestampBuffer:*buf];
diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c
index 82757b0..1f550e1 100644
--- a/sys/applemedia/vtdec.c
+++ b/sys/applemedia/vtdec.c
@@ -35,13 +35,15 @@
 #include "config.h"
 #endif
 
+#include <string.h>
 #include <gst/gst.h>
 #include <gst/video/video.h>
 #include <gst/video/gstvideodecoder.h>
+#include <gst/gl/gstglcontext.h>
 #include "vtdec.h"
 #include "vtutil.h"
 #include "corevideobuffer.h"
-#include <string.h>
+#include "coremediabuffer.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_vtdec_debug_category);
 #define GST_CAT_DEFAULT gst_vtdec_debug_category
@@ -50,6 +52,8 @@
 
 static gboolean gst_vtdec_start (GstVideoDecoder * decoder);
 static gboolean gst_vtdec_stop (GstVideoDecoder * decoder);
+static gboolean gst_vtdec_decide_allocation (GstVideoDecoder * decoder,
+    GstQuery * query);
 static gboolean gst_vtdec_set_format (GstVideoDecoder * decoder,
     GstVideoCodecState * state);
 static gboolean gst_vtdec_flush (GstVideoDecoder * decoder);
@@ -57,7 +61,8 @@
 static GstFlowReturn gst_vtdec_handle_frame (GstVideoDecoder * decoder,
     GstVideoCodecFrame * frame);
 
-static gboolean gst_vtdec_create_session (GstVtdec * vtdec);
+static gboolean gst_vtdec_create_session (GstVtdec * vtdec,
+    GstVideoFormat format);
 static void gst_vtdec_invalidate_session (GstVtdec * vtdec);
 static CMSampleBufferRef cm_sample_buffer_from_gst_buffer (GstVtdec * vtdec,
     GstBuffer * buf);
@@ -86,29 +91,29 @@
         "video/mpeg, mpegversion=2;" "image/jpeg")
     );
 
-#ifdef HAVE_IOS
-#define GST_VTDEC_VIDEO_FORMAT_STR "NV12"
-#define GST_VTDEC_VIDEO_FORMAT GST_VIDEO_FORMAT_NV12
-#define GST_VTDEC_CV_VIDEO_FORMAT kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
-#else
-#define GST_VTDEC_VIDEO_FORMAT_STR "UYVY"
-#define GST_VTDEC_VIDEO_FORMAT GST_VIDEO_FORMAT_UYVY
-#define GST_VTDEC_CV_VIDEO_FORMAT kCVPixelFormatType_422YpCbCr8
-#endif
-
 /* define EnableHardwareAcceleratedVideoDecoder in < 10.9 */
 #if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED < 1090
 const CFStringRef
     kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder =
 CFSTR ("EnableHardwareAcceleratedVideoDecoder");
+const CFStringRef
+    kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder =
+CFSTR ("RequireHardwareAcceleratedVideoDecoder");
+#endif
+
+#ifdef HAVE_IOS
+#define GST_VTDEC_VIDEO_FORMAT_STR "NV12"
+#else
+#define GST_VTDEC_VIDEO_FORMAT_STR "UYVY"
 #endif
 
 #define VIDEO_SRC_CAPS \
-    GST_VIDEO_CAPS_MAKE("{" GST_VTDEC_VIDEO_FORMAT_STR "}")
+    GST_VIDEO_CAPS_MAKE(GST_VTDEC_VIDEO_FORMAT_STR) ";" \
+    GST_VIDEO_CAPS_MAKE_WITH_FEATURES \
+    (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, \
+        "RGBA") ";"
 
-G_DEFINE_TYPE_WITH_CODE (GstVtdec, gst_vtdec, GST_TYPE_VIDEO_DECODER,
-    GST_DEBUG_CATEGORY_INIT (gst_vtdec_debug_category, "vtdec", 0,
-        "debug category for vtdec element"));
+G_DEFINE_TYPE (GstVtdec, gst_vtdec, GST_TYPE_VIDEO_DECODER);
 
 static void
 gst_vtdec_class_init (GstVtdecClass * klass)
@@ -134,6 +139,8 @@
   gobject_class->finalize = gst_vtdec_finalize;
   video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_vtdec_start);
   video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_vtdec_stop);
+  video_decoder_class->decide_allocation =
+      GST_DEBUG_FUNCPTR (gst_vtdec_decide_allocation);
   video_decoder_class->set_format = GST_DEBUG_FUNCPTR (gst_vtdec_set_format);
   video_decoder_class->flush = GST_DEBUG_FUNCPTR (gst_vtdec_flush);
   video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_vtdec_finish);
@@ -156,6 +163,7 @@
 
   g_async_queue_unref (vtdec->reorder_queue);
 
+
   G_OBJECT_CLASS (gst_vtdec_parent_class)->finalize (object);
 }
 
@@ -177,12 +185,74 @@
   if (vtdec->session)
     gst_vtdec_invalidate_session (vtdec);
 
+  if (vtdec->texture_cache)
+    gst_core_video_texture_cache_free (vtdec->texture_cache);
+  vtdec->texture_cache = NULL;
+
   GST_DEBUG_OBJECT (vtdec, "stop");
 
   return TRUE;
 }
 
 static gboolean
+gst_vtdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
+{
+  gboolean ret;
+  GstVtdec *vtdec = GST_VTDEC (decoder);
+
+  ret =
+      GST_VIDEO_DECODER_CLASS (gst_vtdec_parent_class)->decide_allocation
+      (decoder, query);
+  if (ret) {
+    GstCaps *caps;
+    GstCapsFeatures *features;
+    guint idx;
+
+    gst_query_parse_allocation (query, &caps, NULL);
+    if (caps) {
+      features = gst_caps_get_features (caps, 0);
+
+      if (gst_caps_features_contains (features,
+              GST_CAPS_FEATURE_MEMORY_GL_MEMORY)
+          && gst_query_find_allocation_meta (query,
+              GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx)) {
+        GstGLContext *context;
+        const GstStructure *upload_meta_params;
+
+        gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params);
+        if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext",
+                GST_GL_TYPE_CONTEXT, &context, NULL) && context) {
+          vtdec->texture_cache = gst_core_video_texture_cache_new (context);
+          gst_object_unref (context);
+        }
+      }
+    }
+  }
+
+  return ret;
+}
+
+static GstVideoFormat
+gst_vtdec_negotiate_output_format (GstVtdec * vtdec)
+{
+  GstCaps *caps = NULL;
+  GstVideoFormat format;
+  GstStructure *structure;
+  const gchar *s;
+
+  caps = gst_pad_get_allowed_caps (GST_VIDEO_DECODER_SRC_PAD (vtdec));
+  if (!caps)
+    caps = gst_pad_query_caps (GST_VIDEO_DECODER_SRC_PAD (vtdec), NULL);
+  caps = gst_caps_truncate (caps);
+  structure = gst_caps_get_structure (caps, 0);
+  s = gst_structure_get_string (structure, "format");
+  format = gst_video_format_from_string (s);
+  gst_caps_unref (caps);
+
+  return format;
+}
+
+static gboolean
 gst_vtdec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
 {
   GstStructure *structure;
@@ -190,6 +260,8 @@
   CMFormatDescriptionRef format_description = NULL;
   const char *caps_name;
   GstVtdec *vtdec = GST_VTDEC (decoder);
+  GstVideoFormat output_format;
+  GstVideoCodecState *output_state;
 
   GST_DEBUG_OBJECT (vtdec, "set_format");
 
@@ -229,12 +301,18 @@
     CFRelease (vtdec->format_description);
   vtdec->format_description = format_description;
 
-  if (!gst_vtdec_create_session (vtdec))
+  output_format = gst_vtdec_negotiate_output_format (vtdec);
+
+  if (!gst_vtdec_create_session (vtdec, output_format))
     return FALSE;
 
-  gst_video_decoder_set_output_state (decoder,
-      GST_VTDEC_VIDEO_FORMAT, vtdec->video_info.width, vtdec->video_info.height,
-      state);
+  output_state = gst_video_decoder_set_output_state (decoder,
+      output_format, vtdec->video_info.width, vtdec->video_info.height, state);
+  output_state->caps = gst_video_info_to_caps (&output_state->info);
+  if (output_state->info.finfo->format == GST_VIDEO_FORMAT_RGBA) {
+    gst_caps_set_features (output_state->caps, 0,
+        gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
+  }
 
   return TRUE;
 }
@@ -312,12 +390,32 @@
 }
 
 static gboolean
-gst_vtdec_create_session (GstVtdec * vtdec)
+gst_vtdec_create_session (GstVtdec * vtdec, GstVideoFormat format)
 {
   CFMutableDictionaryRef output_image_buffer_attrs;
   VTDecompressionOutputCallbackRecord callback;
   CFMutableDictionaryRef videoDecoderSpecification;
   OSStatus status;
+  guint32 cv_format;
+
+  switch (format) {
+    case GST_VIDEO_FORMAT_NV12:
+      cv_format = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
+      break;
+    case GST_VIDEO_FORMAT_UYVY:
+      cv_format = kCVPixelFormatType_422YpCbCr8;
+      break;
+    case GST_VIDEO_FORMAT_RGBA:
+#ifdef HAVE_IOS
+      cv_format = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
+#else
+      cv_format = kCVPixelFormatType_422YpCbCr8;
+#endif
+      break;
+    default:
+      g_warn_if_reached ();
+      break;
+  }
 
   videoDecoderSpecification =
       CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
@@ -327,13 +425,17 @@
 #ifndef HAVE_IOS
   gst_vtutil_dict_set_boolean (videoDecoderSpecification,
       kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder, TRUE);
+  if (vtdec->require_hardware)
+    gst_vtutil_dict_set_boolean (videoDecoderSpecification,
+        kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
+        TRUE);
 #endif
 
   output_image_buffer_attrs =
       CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
       &kCFTypeDictionaryValueCallBacks);
   gst_vtutil_dict_set_i32 (output_image_buffer_attrs,
-      kCVPixelBufferPixelFormatTypeKey, GST_VTDEC_CV_VIDEO_FORMAT);
+      kCVPixelBufferPixelFormatTypeKey, cv_format);
   gst_vtutil_dict_set_i32 (output_image_buffer_attrs, kCVPixelBufferWidthKey,
       vtdec->video_info.width);
   gst_vtutil_dict_set_i32 (output_image_buffer_attrs, kCVPixelBufferHeightKey,
@@ -477,6 +579,7 @@
   status =
       CMSampleBufferCreate (NULL, bbuf, TRUE, 0, 0, vtdec->format_description,
       1, 1, time_array, 0, NULL, &sbuf);
+  CFRelease (bbuf);
   if (status != noErr)
     goto sample_error;
 
@@ -555,15 +658,16 @@
      * segment.format being undefined */
     goto release;
   }
-  buf = gst_core_video_buffer_new (image_buffer, &state->info);
+  buf =
+      gst_core_video_buffer_new (image_buffer, &state->info,
+      vtdec->texture_cache == NULL);
   gst_video_codec_state_unref (state);
-  frame->output_buffer = buf;
 
   gst_buffer_copy_into (buf, frame->input_buffer,
       GST_BUFFER_COPY_METADATA | GST_BUFFER_COPY_FLAGS, 0, -1);
   GST_BUFFER_PTS (buf) = pts.value;
   GST_BUFFER_DURATION (buf) = duration.value;
-
+  frame->output_buffer = buf;
   g_async_queue_push_sorted (vtdec->reorder_queue, frame,
       sort_frames_by_pts, NULL);
 
@@ -590,6 +694,19 @@
   GstFlowReturn ret = GST_FLOW_OK;
   GstVideoDecoder *decoder = GST_VIDEO_DECODER (vtdec);
 
+  /* negotiate now so that we know whether we need to use the GL upload meta or
+   * not */
+  if (gst_pad_check_reconfigure (decoder->srcpad)) {
+    gst_video_decoder_negotiate (decoder);
+    if (vtdec->texture_cache) {
+      GstVideoCodecState *output_state =
+          gst_video_decoder_get_output_state (decoder);
+      gst_core_video_texture_cache_set_format (vtdec->texture_cache,
+          GST_VTDEC_VIDEO_FORMAT_STR, output_state->caps);
+      gst_video_codec_state_unref (output_state);
+    }
+  }
+
   if (drain)
     VTDecompressionSessionWaitForAsynchronousFrames (vtdec->session);
 
@@ -599,6 +716,14 @@
   while ((g_async_queue_length (vtdec->reorder_queue) >=
           vtdec->reorder_queue_length) || drain || flush) {
     frame = (GstVideoCodecFrame *) g_async_queue_try_pop (vtdec->reorder_queue);
+    if (frame && vtdec->texture_cache != NULL) {
+      frame->output_buffer =
+          gst_core_video_texture_cache_get_gl_buffer (vtdec->texture_cache,
+          frame->output_buffer);
+      if (!frame->output_buffer)
+        GST_ERROR_OBJECT (vtdec, "couldn't get textures from buffer");
+    }
+
     /* we need to check this in case reorder_queue_length=0 (jpeg for
      * example) or we're draining/flushing
      */
@@ -777,3 +902,51 @@
       vtdec->reorder_queue_length, GST_TIME_ARGS (latency));
   gst_video_decoder_set_latency (GST_VIDEO_DECODER (vtdec), latency, latency);
 }
+
+#ifndef HAVE_IOS
+#define GST_TYPE_VTDEC_HW   (gst_vtdec_hw_get_type())
+#define GST_VTDEC_HW(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VTDEC_HW,GstVtdecHw))
+#define GST_VTDEC_HW_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VTDEC_HW,GstVtdecHwClass))
+#define GST_IS_VTDEC_HW(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VTDEC_HW))
+#define GST_IS_VTDEC_HW_CLASS(obj)   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VTDEC_HW))
+
+typedef GstVtdec GstVtdecHw;
+typedef GstVtdecClass GstVtdecHwClass;
+
+GType gst_vtdec_hw_get_type (void);
+
+G_DEFINE_TYPE (GstVtdecHw, gst_vtdec_hw, GST_TYPE_VTDEC);
+
+static void
+gst_vtdec_hw_class_init (GstVtdecHwClass * klass)
+{
+  gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (klass),
+      "Apple VideoToolbox decoder (hardware only)",
+      "Codec/Decoder/Video",
+      "Apple VideoToolbox Decoder",
+      "Ole André Vadla Ravnås <oleavr@soundrop.com>; "
+      "Alessandro Decina <alessandro.d@gmail.com>");
+}
+
+static void
+gst_vtdec_hw_init (GstVtdecHw * vtdec)
+{
+  GST_VTDEC (vtdec)->require_hardware = TRUE;
+}
+
+#endif
+
+void
+gst_vtdec_register_elements (GstPlugin * plugin)
+{
+  GST_DEBUG_CATEGORY_INIT (gst_vtdec_debug_category, "vtdec", 0,
+      "debug category for vtdec element");
+
+#ifdef HAVE_IOS
+  gst_element_register (plugin, "vtdec", GST_RANK_PRIMARY, GST_TYPE_VTDEC);
+#else
+  gst_element_register (plugin, "vtdec_hw", GST_RANK_PRIMARY + 1,
+      GST_TYPE_VTDEC_HW);
+  gst_element_register (plugin, "vtdec", GST_RANK_SECONDARY, GST_TYPE_VTDEC);
+#endif
+}
diff --git a/sys/applemedia/vtdec.h b/sys/applemedia/vtdec.h
index bc029bc..4b9c788 100644
--- a/sys/applemedia/vtdec.h
+++ b/sys/applemedia/vtdec.h
@@ -25,6 +25,7 @@
 #include <gst/video/gstvideodecoder.h>
 #include <CoreMedia/CoreMedia.h>
 #include <VideoToolbox/VideoToolbox.h>
+#include "corevideotexturecache.h"
 
 G_BEGIN_DECLS
 
@@ -45,6 +46,9 @@
   VTDecompressionSessionRef session;
   GAsyncQueue *reorder_queue;
   gint reorder_queue_length;
+  GstCoreVideoTextureCache *texture_cache;
+
+  gboolean require_hardware;
 };
 
 struct _GstVtdecClass
@@ -54,6 +58,8 @@
 
 GType gst_vtdec_get_type (void);
 
+void gst_vtdec_register_elements (GstPlugin * plugin);
+
 G_END_DECLS
 
 #endif
diff --git a/sys/applemedia/vtenc.c b/sys/applemedia/vtenc.c
index 8230883..ef18784 100644
--- a/sys/applemedia/vtenc.c
+++ b/sys/applemedia/vtenc.c
@@ -734,9 +734,15 @@
   GstFlowReturn ret = GST_FLOW_OK;
   OSStatus vt_status;
 
+  /* We need to unlock the stream lock here because
+   * it can wait for gst_vtenc_enqueue_buffer() to
+   * handle a buffer... which will take the stream
+   * lock from another thread and then deadlock */
+  GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
   vt_status =
       VTCompressionSessionCompleteFrames (self->session,
       kCMTimePositiveInfinity);
+  GST_VIDEO_ENCODER_STREAM_LOCK (self);
   if (vt_status != noErr) {
     GST_WARNING_OBJECT (self, "VTCompressionSessionCompleteFrames returned %d",
         (int) vt_status);
@@ -1008,6 +1014,11 @@
 
   status = VTSessionCopyProperty (self->session,
       kVTCompressionPropertyKey_NumberOfPendingFrames, NULL, &value);
+  if (status != noErr || !value) {
+    GST_INFO_OBJECT (self, "failed to get NumberOfPendingFrames: %d", status);
+    return;
+  }
+
   CFNumberGetValue (value, kCFNumberSInt32Type, &frames);
   if (self->latency_frames == -1 || self->latency_frames != frames) {
     self->latency_frames = frames;
@@ -1092,7 +1103,8 @@
       goto cv_error;
     }
 
-    outbuf = gst_core_video_buffer_new ((CVBufferRef) pbuf, &self->video_info);
+    outbuf =
+        gst_core_video_buffer_new ((CVBufferRef) pbuf, &self->video_info, TRUE);
     if (!gst_video_frame_map (&outframe, &self->video_info, outbuf,
             GST_MAP_WRITE)) {
       gst_video_frame_unmap (&inframe);
@@ -1253,6 +1265,11 @@
       gst_video_encoder_get_frame (GST_VIDEO_ENCODER_CAST (self),
       GPOINTER_TO_INT (sourceFrameRefCon));
 
+  if (!frame) {
+    GST_WARNING_OBJECT (self, "No corresponding frame found!");
+    goto beach;
+  }
+
   if (is_keyframe) {
     GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
     gst_vtenc_clear_cached_caps_downstream (self);
@@ -1260,7 +1277,7 @@
 
   /* We are dealing with block buffers here, so we don't need
    * to enable the use of the video meta API on the core media buffer */
-  frame->output_buffer = gst_core_media_buffer_new (sampleBuffer, FALSE);
+  frame->output_buffer = gst_core_media_buffer_new (sampleBuffer, FALSE, TRUE);
 
   g_async_queue_push (self->cur_outframes, frame);
 
@@ -1349,7 +1366,7 @@
   g_type_set_qdata (type, GST_VTENC_CODEC_DETAILS_QDATA,
       (gpointer) codec_details);
 
-  result = gst_element_register (plugin, type_name, GST_RANK_NONE, type);
+  result = gst_element_register (plugin, type_name, GST_RANK_PRIMARY, type);
   if (!result) {
     GST_ERROR_OBJECT (plugin, "failed to register element %s", type_name);
   }
diff --git a/sys/avc/Makefile.in b/sys/avc/Makefile.in
index d3ed387..15f9238 100644
--- a/sys/avc/Makefile.in
+++ b/sys/avc/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -245,8 +245,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -285,7 +289,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -293,6 +296,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -342,8 +347,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -422,7 +425,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -431,7 +433,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -444,7 +445,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -469,6 +469,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -542,10 +544,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -571,6 +577,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -607,6 +616,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -647,17 +657,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -674,6 +683,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/bluez/Makefile.in b/sys/bluez/Makefile.in
index f173045..b1249b6 100644
--- a/sys/bluez/Makefile.in
+++ b/sys/bluez/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/bluez/gstavdtputil.c b/sys/bluez/gstavdtputil.c
index caf7275..787a063 100644
--- a/sys/bluez/gstavdtputil.c
+++ b/sys/bluez/gstavdtputil.c
@@ -49,7 +49,9 @@
 {
   DBusMessage *msg, *reply;
   DBusError err;
+#ifdef HAVE_BLUEZ4
   const char *access_type = "rw";
+#endif
   int fd;
   uint16_t imtu, omtu;
 
@@ -63,11 +65,16 @@
   if (conn->data.conn == NULL)
     conn->data.conn = dbus_bus_get (DBUS_BUS_SYSTEM, &err);
 
+#ifdef HAVE_BLUEZ4
   msg = dbus_message_new_method_call ("org.bluez", conn->transport,
       "org.bluez.MediaTransport", "Acquire");
 
   dbus_message_append_args (msg, DBUS_TYPE_STRING, &access_type,
       DBUS_TYPE_INVALID);
+#else
+  msg = dbus_message_new_method_call ("org.bluez", conn->transport,
+      "org.bluez.MediaTransport1", "Acquire");
+#endif
 
   reply = dbus_connection_send_with_reply_and_block (conn->data.conn,
       msg, -1, &err);
@@ -106,6 +113,7 @@
 gst_avdtp_connection_transport_release (GstAvdtpConnection * conn)
 {
   DBusMessage *msg;
+#ifdef HAVE_BLUEZ4
   const char *access_type = "rw";
 
   msg = dbus_message_new_method_call ("org.bluez", conn->transport,
@@ -113,7 +121,10 @@
 
   dbus_message_append_args (msg, DBUS_TYPE_STRING, &access_type,
       DBUS_TYPE_INVALID);
-
+#else
+  msg = dbus_message_new_method_call ("org.bluez", conn->transport,
+      "org.bluez.MediaTransport1", "Release");
+#endif
   dbus_connection_send (conn->data.conn, msg, NULL);
 
   dbus_message_unref (msg);
@@ -258,17 +269,28 @@
   DBusMessage *msg, *reply;
   DBusMessageIter arg_i, ele_i;
   DBusError err;
+#ifndef HAVE_BLUEZ4
+  const char *interface;
+#endif
 
   dbus_error_init (&err);
 
+#ifdef HAVE_BLUEZ4
   msg = dbus_message_new_method_call ("org.bluez", conn->transport,
       "org.bluez.MediaTransport", "GetProperties");
-
+#else
+  msg = dbus_message_new_method_call ("org.bluez", conn->transport,
+      "org.freedesktop.DBus.Properties", "GetAll");
+#endif
   if (!msg) {
     GST_ERROR ("D-Bus Memory allocation failed");
     return FALSE;
   }
-
+#ifndef HAVE_BLUEZ4
+  interface = "org.bluez.MediaTransport1";
+  dbus_message_append_args (msg, DBUS_TYPE_STRING, &interface,
+        DBUS_TYPE_INVALID);
+#endif
   reply = dbus_connection_send_with_reply_and_block (conn->data.conn,
       msg, -1, &err);
 
diff --git a/sys/d3dvideosink/Makefile.in b/sys/d3dvideosink/Makefile.in
index ca7fa27..a30c3a1 100644
--- a/sys/d3dvideosink/Makefile.in
+++ b/sys/d3dvideosink/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/d3dvideosink/d3dhelpers.c b/sys/d3dvideosink/d3dhelpers.c
index 312b913..28815d6 100644
--- a/sys/d3dvideosink/d3dhelpers.c
+++ b/sys/d3dvideosink/d3dhelpers.c
@@ -1062,7 +1062,12 @@
   LOCK_SINK (sink);
 
   if (sink->d3d.window_handle == NULL) {
-    GST_DEBUG_OBJECT (sink, "No window handle has been set..");
+    GST_DEBUG_OBJECT (sink, "No window handle has been set.");
+    goto end;
+  }
+
+  if (sink->d3d.device_lost) {
+    GST_DEBUG_OBJECT (sink, "Device is lost, waiting for reset.");
     goto end;
   }
 
@@ -1308,6 +1313,10 @@
   GST_DEBUG ("Direct3D stretch rect texture filter: %d", d3d_filtertype);
 
   sink->d3d.filtertype = d3d_filtertype;
+
+  if (sink->d3d.swapchain != NULL)
+    IDirect3DSwapChain9_Release (sink->d3d.swapchain);
+
   sink->d3d.swapchain = d3d_swapchain;
 
   ret = TRUE;
@@ -1342,6 +1351,10 @@
     goto end;
   }
 
+  gst_buffer_replace (&sink->fallback_buffer, NULL);
+  if (sink->fallback_pool)
+    gst_buffer_pool_set_active (sink->fallback_pool, FALSE);
+
   if (sink->d3d.swapchain) {
     ref_count = IDirect3DSwapChain9_Release (sink->d3d.swapchain);
     sink->d3d.swapchain = NULL;
diff --git a/sys/d3dvideosink/d3dvideosink.c b/sys/d3dvideosink/d3dvideosink.c
index 5568075..a06d494 100644
--- a/sys/d3dvideosink/d3dvideosink.c
+++ b/sys/d3dvideosink/d3dvideosink.c
@@ -398,8 +398,10 @@
 
   if (oldpool)
     gst_object_unref (oldpool);
-  if (oldfbpool)
+  if (oldfbpool) {
+    gst_buffer_pool_set_active (oldfbpool, FALSE);
     gst_object_unref (oldfbpool);
+  }
 
   return TRUE;
   /* ERRORS */
diff --git a/sys/decklink/Makefile.am b/sys/decklink/Makefile.am
index 89af7c2..d3ec19d 100644
--- a/sys/decklink/Makefile.am
+++ b/sys/decklink/Makefile.am
@@ -8,6 +8,7 @@
 	$(DECKLINK_CXXFLAGS)
 libgstdecklink_la_LIBADD = \
 	$(GST_PLUGINS_BASE_LIBS) \
+	-lgstaudio-@GST_API_VERSION@ \
 	-lgstvideo-@GST_API_VERSION@ \
 	$(GST_BASE_LIBS) \
 	$(GST_LIBS) \
@@ -23,39 +24,46 @@
 libgstdecklink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
 
 libgstdecklink_la_SOURCES = \
-	gstdecklinksink.cpp \
-	gstdecklinksrc.cpp \
 	gstdecklink.cpp \
-	capture.cpp
+	gstdecklinkaudiosink.cpp \
+	gstdecklinkvideosink.cpp \
+	gstdecklinkaudiosrc.cpp \
+	gstdecklinkvideosrc.cpp
 
 if DECKLINK_OSX
 libgstdecklink_la_SOURCES += \
-	osx/DeckLinkAPIDispatch-osx.cpp
+	osx/DeckLinkAPIDispatch.cpp
 else
 libgstdecklink_la_SOURCES += \
 	linux/DeckLinkAPIDispatch.cpp
 endif
 
-
 noinst_HEADERS = \
 	gstdecklink.h \
-	gstdecklinksrc.h \
-	gstdecklinksink.h \
-	capture.h \
+	gstdecklinkaudiosink.h \
+	gstdecklinkvideosink.h \
+	gstdecklinkaudiosrc.h \
+	gstdecklinkvideosrc.h \
+	linux/DeckLinkAPIConfiguration.h \
+	linux/DeckLinkAPIDeckControl.h \
+	linux/DeckLinkAPIDiscovery.h \
 	linux/DeckLinkAPI.h \
+	linux/DeckLinkAPIModes.h \
+	linux/DeckLinkAPITypes.h \
 	linux/LinuxCOM.h \
-	osx/DeckLinkAPI.h \
 	osx/DeckLinkAPIConfiguration.h \
 	osx/DeckLinkAPIDeckControl.h \
 	osx/DeckLinkAPIDiscovery.h \
+	osx/DeckLinkAPI.h \
 	osx/DeckLinkAPIModes.h \
 	osx/DeckLinkAPIStreaming.h \
 	osx/DeckLinkAPITypes.h \
-	osx/DeckLinkAPIVersion.h
+	osx/DeckLinkAPIVersion.h \
+	win/DeckLinkAPI.h
 
 EXTRA_DIST = \
-	win/DeckLinkAPI.h \
-	win/DeckLinkAPIDispatch.cpp \
-	win/DeckLinkAPI_i.c
+	linux/DeckLinkAPIDispatch.cpp \
+	osx/DeckLinkAPIDispatch.cpp \
+	win/DeckLinkAPIDispatch.cpp
 
 
diff --git a/sys/decklink/Makefile.in b/sys/decklink/Makefile.in
index e848621..4692406 100644
--- a/sys/decklink/Makefile.in
+++ b/sys/decklink/Makefile.in
@@ -84,7 +84,7 @@
 @DECKLINK_OSX_TRUE@	-Wl,-framework,CoreFoundation
 
 @DECKLINK_OSX_TRUE@am__append_2 = \
-@DECKLINK_OSX_TRUE@	osx/DeckLinkAPIDispatch-osx.cpp
+@DECKLINK_OSX_TRUE@	osx/DeckLinkAPIDispatch.cpp
 
 @DECKLINK_OSX_FALSE@am__append_3 = \
 @DECKLINK_OSX_FALSE@	linux/DeckLinkAPIDispatch.cpp
@@ -99,6 +99,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -112,7 +113,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -166,16 +166,19 @@
 libgstdecklink_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__libgstdecklink_la_SOURCES_DIST = gstdecklinksink.cpp \
-	gstdecklinksrc.cpp gstdecklink.cpp capture.cpp \
-	osx/DeckLinkAPIDispatch-osx.cpp linux/DeckLinkAPIDispatch.cpp
+am__libgstdecklink_la_SOURCES_DIST = gstdecklink.cpp \
+	gstdecklinkaudiosink.cpp gstdecklinkvideosink.cpp \
+	gstdecklinkaudiosrc.cpp gstdecklinkvideosrc.cpp \
+	osx/DeckLinkAPIDispatch.cpp linux/DeckLinkAPIDispatch.cpp
 am__dirstamp = $(am__leading_dot)dirstamp
-@DECKLINK_OSX_TRUE@am__objects_1 = osx/libgstdecklink_la-DeckLinkAPIDispatch-osx.lo
+@DECKLINK_OSX_TRUE@am__objects_1 = osx/libgstdecklink_la-DeckLinkAPIDispatch.lo
 @DECKLINK_OSX_FALSE@am__objects_2 = linux/libgstdecklink_la-DeckLinkAPIDispatch.lo
-am_libgstdecklink_la_OBJECTS = libgstdecklink_la-gstdecklinksink.lo \
-	libgstdecklink_la-gstdecklinksrc.lo \
-	libgstdecklink_la-gstdecklink.lo libgstdecklink_la-capture.lo \
-	$(am__objects_1) $(am__objects_2)
+am_libgstdecklink_la_OBJECTS = libgstdecklink_la-gstdecklink.lo \
+	libgstdecklink_la-gstdecklinkaudiosink.lo \
+	libgstdecklink_la-gstdecklinkvideosink.lo \
+	libgstdecklink_la-gstdecklinkaudiosrc.lo \
+	libgstdecklink_la-gstdecklinkvideosrc.lo $(am__objects_1) \
+	$(am__objects_2)
 libgstdecklink_la_OBJECTS = $(am_libgstdecklink_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -263,8 +266,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -303,7 +310,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -311,6 +317,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -360,8 +368,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -440,7 +446,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -449,7 +454,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -462,7 +466,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -487,6 +490,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -560,10 +565,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -589,6 +598,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -625,6 +637,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -665,17 +678,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -692,6 +704,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -753,6 +766,7 @@
 
 libgstdecklink_la_LIBADD = \
 	$(GST_PLUGINS_BASE_LIBS) \
+	-lgstaudio-@GST_API_VERSION@ \
 	-lgstvideo-@GST_API_VERSION@ \
 	$(GST_BASE_LIBS) \
 	$(GST_LIBS) \
@@ -761,28 +775,36 @@
 
 libgstdecklink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(am__append_1)
 libgstdecklink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-libgstdecklink_la_SOURCES = gstdecklinksink.cpp gstdecklinksrc.cpp \
-	gstdecklink.cpp capture.cpp $(am__append_2) $(am__append_3)
+libgstdecklink_la_SOURCES = gstdecklink.cpp gstdecklinkaudiosink.cpp \
+	gstdecklinkvideosink.cpp gstdecklinkaudiosrc.cpp \
+	gstdecklinkvideosrc.cpp $(am__append_2) $(am__append_3)
 noinst_HEADERS = \
 	gstdecklink.h \
-	gstdecklinksrc.h \
-	gstdecklinksink.h \
-	capture.h \
+	gstdecklinkaudiosink.h \
+	gstdecklinkvideosink.h \
+	gstdecklinkaudiosrc.h \
+	gstdecklinkvideosrc.h \
+	linux/DeckLinkAPIConfiguration.h \
+	linux/DeckLinkAPIDeckControl.h \
+	linux/DeckLinkAPIDiscovery.h \
 	linux/DeckLinkAPI.h \
+	linux/DeckLinkAPIModes.h \
+	linux/DeckLinkAPITypes.h \
 	linux/LinuxCOM.h \
-	osx/DeckLinkAPI.h \
 	osx/DeckLinkAPIConfiguration.h \
 	osx/DeckLinkAPIDeckControl.h \
 	osx/DeckLinkAPIDiscovery.h \
+	osx/DeckLinkAPI.h \
 	osx/DeckLinkAPIModes.h \
 	osx/DeckLinkAPIStreaming.h \
 	osx/DeckLinkAPITypes.h \
-	osx/DeckLinkAPIVersion.h
+	osx/DeckLinkAPIVersion.h \
+	win/DeckLinkAPI.h
 
 EXTRA_DIST = \
-	win/DeckLinkAPI.h \
-	win/DeckLinkAPIDispatch.cpp \
-	win/DeckLinkAPI_i.c
+	linux/DeckLinkAPIDispatch.cpp \
+	osx/DeckLinkAPIDispatch.cpp \
+	win/DeckLinkAPIDispatch.cpp
 
 all: all-am
 
@@ -859,7 +881,7 @@
 osx/$(DEPDIR)/$(am__dirstamp):
 	@$(MKDIR_P) osx/$(DEPDIR)
 	@: > osx/$(DEPDIR)/$(am__dirstamp)
-osx/libgstdecklink_la-DeckLinkAPIDispatch-osx.lo: osx/$(am__dirstamp) \
+osx/libgstdecklink_la-DeckLinkAPIDispatch.lo: osx/$(am__dirstamp) \
 	osx/$(DEPDIR)/$(am__dirstamp)
 linux/$(am__dirstamp):
 	@$(MKDIR_P) linux
@@ -883,12 +905,13 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-capture.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-gstdecklink.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-gstdecklinksink.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-gstdecklinksrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosink.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-gstdecklinkvideosink.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdecklink_la-gstdecklinkvideosrc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@linux/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch-osx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch.Plo@am__quote@
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -914,20 +937,6 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
 
-libgstdecklink_la-gstdecklinksink.lo: gstdecklinksink.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-gstdecklinksink.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-gstdecklinksink.Tpo -c -o libgstdecklink_la-gstdecklinksink.lo `test -f 'gstdecklinksink.cpp' || echo '$(srcdir)/'`gstdecklinksink.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-gstdecklinksink.Tpo $(DEPDIR)/libgstdecklink_la-gstdecklinksink.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstdecklinksink.cpp' object='libgstdecklink_la-gstdecklinksink.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-gstdecklinksink.lo `test -f 'gstdecklinksink.cpp' || echo '$(srcdir)/'`gstdecklinksink.cpp
-
-libgstdecklink_la-gstdecklinksrc.lo: gstdecklinksrc.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-gstdecklinksrc.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-gstdecklinksrc.Tpo -c -o libgstdecklink_la-gstdecklinksrc.lo `test -f 'gstdecklinksrc.cpp' || echo '$(srcdir)/'`gstdecklinksrc.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-gstdecklinksrc.Tpo $(DEPDIR)/libgstdecklink_la-gstdecklinksrc.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstdecklinksrc.cpp' object='libgstdecklink_la-gstdecklinksrc.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-gstdecklinksrc.lo `test -f 'gstdecklinksrc.cpp' || echo '$(srcdir)/'`gstdecklinksrc.cpp
-
 libgstdecklink_la-gstdecklink.lo: gstdecklink.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-gstdecklink.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-gstdecklink.Tpo -c -o libgstdecklink_la-gstdecklink.lo `test -f 'gstdecklink.cpp' || echo '$(srcdir)/'`gstdecklink.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-gstdecklink.Tpo $(DEPDIR)/libgstdecklink_la-gstdecklink.Plo
@@ -935,19 +944,40 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-gstdecklink.lo `test -f 'gstdecklink.cpp' || echo '$(srcdir)/'`gstdecklink.cpp
 
-libgstdecklink_la-capture.lo: capture.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-capture.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-capture.Tpo -c -o libgstdecklink_la-capture.lo `test -f 'capture.cpp' || echo '$(srcdir)/'`capture.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-capture.Tpo $(DEPDIR)/libgstdecklink_la-capture.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='capture.cpp' object='libgstdecklink_la-capture.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdecklink_la-gstdecklinkaudiosink.lo: gstdecklinkaudiosink.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-gstdecklinkaudiosink.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosink.Tpo -c -o libgstdecklink_la-gstdecklinkaudiosink.lo `test -f 'gstdecklinkaudiosink.cpp' || echo '$(srcdir)/'`gstdecklinkaudiosink.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosink.Tpo $(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosink.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstdecklinkaudiosink.cpp' object='libgstdecklink_la-gstdecklinkaudiosink.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-capture.lo `test -f 'capture.cpp' || echo '$(srcdir)/'`capture.cpp
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-gstdecklinkaudiosink.lo `test -f 'gstdecklinkaudiosink.cpp' || echo '$(srcdir)/'`gstdecklinkaudiosink.cpp
 
-osx/libgstdecklink_la-DeckLinkAPIDispatch-osx.lo: osx/DeckLinkAPIDispatch-osx.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT osx/libgstdecklink_la-DeckLinkAPIDispatch-osx.lo -MD -MP -MF osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch-osx.Tpo -c -o osx/libgstdecklink_la-DeckLinkAPIDispatch-osx.lo `test -f 'osx/DeckLinkAPIDispatch-osx.cpp' || echo '$(srcdir)/'`osx/DeckLinkAPIDispatch-osx.cpp
-@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch-osx.Tpo osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch-osx.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='osx/DeckLinkAPIDispatch-osx.cpp' object='osx/libgstdecklink_la-DeckLinkAPIDispatch-osx.lo' libtool=yes @AMDEPBACKSLASH@
+libgstdecklink_la-gstdecklinkvideosink.lo: gstdecklinkvideosink.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-gstdecklinkvideosink.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-gstdecklinkvideosink.Tpo -c -o libgstdecklink_la-gstdecklinkvideosink.lo `test -f 'gstdecklinkvideosink.cpp' || echo '$(srcdir)/'`gstdecklinkvideosink.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-gstdecklinkvideosink.Tpo $(DEPDIR)/libgstdecklink_la-gstdecklinkvideosink.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstdecklinkvideosink.cpp' object='libgstdecklink_la-gstdecklinkvideosink.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o osx/libgstdecklink_la-DeckLinkAPIDispatch-osx.lo `test -f 'osx/DeckLinkAPIDispatch-osx.cpp' || echo '$(srcdir)/'`osx/DeckLinkAPIDispatch-osx.cpp
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-gstdecklinkvideosink.lo `test -f 'gstdecklinkvideosink.cpp' || echo '$(srcdir)/'`gstdecklinkvideosink.cpp
+
+libgstdecklink_la-gstdecklinkaudiosrc.lo: gstdecklinkaudiosrc.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-gstdecklinkaudiosrc.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosrc.Tpo -c -o libgstdecklink_la-gstdecklinkaudiosrc.lo `test -f 'gstdecklinkaudiosrc.cpp' || echo '$(srcdir)/'`gstdecklinkaudiosrc.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosrc.Tpo $(DEPDIR)/libgstdecklink_la-gstdecklinkaudiosrc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstdecklinkaudiosrc.cpp' object='libgstdecklink_la-gstdecklinkaudiosrc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-gstdecklinkaudiosrc.lo `test -f 'gstdecklinkaudiosrc.cpp' || echo '$(srcdir)/'`gstdecklinkaudiosrc.cpp
+
+libgstdecklink_la-gstdecklinkvideosrc.lo: gstdecklinkvideosrc.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgstdecklink_la-gstdecklinkvideosrc.lo -MD -MP -MF $(DEPDIR)/libgstdecklink_la-gstdecklinkvideosrc.Tpo -c -o libgstdecklink_la-gstdecklinkvideosrc.lo `test -f 'gstdecklinkvideosrc.cpp' || echo '$(srcdir)/'`gstdecklinkvideosrc.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdecklink_la-gstdecklinkvideosrc.Tpo $(DEPDIR)/libgstdecklink_la-gstdecklinkvideosrc.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='gstdecklinkvideosrc.cpp' object='libgstdecklink_la-gstdecklinkvideosrc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgstdecklink_la-gstdecklinkvideosrc.lo `test -f 'gstdecklinkvideosrc.cpp' || echo '$(srcdir)/'`gstdecklinkvideosrc.cpp
+
+osx/libgstdecklink_la-DeckLinkAPIDispatch.lo: osx/DeckLinkAPIDispatch.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT osx/libgstdecklink_la-DeckLinkAPIDispatch.lo -MD -MP -MF osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch.Tpo -c -o osx/libgstdecklink_la-DeckLinkAPIDispatch.lo `test -f 'osx/DeckLinkAPIDispatch.cpp' || echo '$(srcdir)/'`osx/DeckLinkAPIDispatch.cpp
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch.Tpo osx/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='osx/DeckLinkAPIDispatch.cpp' object='osx/libgstdecklink_la-DeckLinkAPIDispatch.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o osx/libgstdecklink_la-DeckLinkAPIDispatch.lo `test -f 'osx/DeckLinkAPIDispatch.cpp' || echo '$(srcdir)/'`osx/DeckLinkAPIDispatch.cpp
 
 linux/libgstdecklink_la-DeckLinkAPIDispatch.lo: linux/DeckLinkAPIDispatch.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(libgstdecklink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgstdecklink_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT linux/libgstdecklink_la-DeckLinkAPIDispatch.lo -MD -MP -MF linux/$(DEPDIR)/libgstdecklink_la-DeckLinkAPIDispatch.Tpo -c -o linux/libgstdecklink_la-DeckLinkAPIDispatch.lo `test -f 'linux/DeckLinkAPIDispatch.cpp' || echo '$(srcdir)/'`linux/DeckLinkAPIDispatch.cpp
diff --git a/sys/decklink/capture.cpp b/sys/decklink/capture.cpp
deleted file mode 100644
index 85bedf6..0000000
--- a/sys/decklink/capture.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -LICENSE-START-
-** Copyright (c) 2009 Blackmagic Design
-**
-** Permission is hereby granted, free of charge, to any person or organization
-** obtaining a copy of the software and accompanying documentation covered by
-** this license (the "Software") to use, reproduce, display, distribute,
-** execute, and transmit the Software, and to prepare derivative works of the
-** Software, and to permit third-parties to whom the Software is furnished to
-** do so, all subject to the following:
-** 
-** The copyright notices in the Software and this entire statement, including
-** the above license grant, this restriction and the following disclaimer,
-** must be included in all copies of the Software, in whole or in part, and
-** all derivative works of the Software, unless such copies or derivative
-** works are solely in the form of machine-executable object code generated by
-** a source language processor.
-** 
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-** DEALINGS IN THE SOFTWARE.
-** -LICENSE-END-
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "gstdecklinksrc.h"
-
-#include "capture.h"
-
-#define GST_CAT_DEFAULT gst_decklink_src_debug_category
-
-static BMDTimecodeFormat g_timecodeFormat = (BMDTimecodeFormat) 0;
-
-DeckLinkCaptureDelegate::DeckLinkCaptureDelegate ():priv (NULL), m_refCount (0)
-{
-  g_mutex_init (&m_mutex);
-}
-
-DeckLinkCaptureDelegate::~DeckLinkCaptureDelegate ()
-{
-  g_mutex_clear (&m_mutex);
-}
-
-ULONG DeckLinkCaptureDelegate::AddRef (void)
-{
-  g_mutex_lock (&m_mutex);
-  m_refCount++;
-  g_mutex_unlock (&m_mutex);
-
-  return (ULONG) m_refCount;
-}
-
-ULONG DeckLinkCaptureDelegate::Release (void)
-{
-  g_mutex_lock (&m_mutex);
-  m_refCount--;
-  g_mutex_unlock (&m_mutex);
-
-  if (m_refCount == 0) {
-    delete
-        this;
-    return 0;
-  }
-
-  return (ULONG) m_refCount;
-}
-
-HRESULT
-    DeckLinkCaptureDelegate::VideoInputFrameArrived (IDeckLinkVideoInputFrame *
-    videoFrame, IDeckLinkAudioInputPacket * audioFrame)
-{
-  GstDecklinkSrc *decklinksrc;
-  const char *timecodeString = NULL;
-
-  g_return_val_if_fail (priv != NULL, S_OK);
-  g_return_val_if_fail (GST_IS_DECKLINK_SRC (priv), S_OK);
-
-  decklinksrc = GST_DECKLINK_SRC (priv);
-
-  if (videoFrame == NULL) {
-    GST_WARNING_OBJECT (decklinksrc, "video frame is NULL");
-    return S_OK;
-  }
-
-  if (audioFrame == NULL) {
-    GST_WARNING_OBJECT (decklinksrc, "audio frame is NULL");
-    return S_OK;
-  }
-
-  if (videoFrame->GetFlags () & bmdFrameHasNoInputSource) {
-    GST_DEBUG_OBJECT (decklinksrc, "Frame received - No input signal detected");
-    return S_OK;
-  }
-
-  /* FIXME: g_timecodeFormat is inited to 0 and never changed? dead code? */
-  if (g_timecodeFormat != 0) {
-    IDeckLinkTimecode *timecode;
-    if (videoFrame->GetTimecode (g_timecodeFormat, &timecode) == S_OK) {
-      timecode->GetString (&timecodeString);
-      CONVERT_COM_STRING (timecodeString);
-    }
-  }
-
-  GST_DEBUG_OBJECT (decklinksrc, "Frame received [%s] - %s - Size: %li bytes",
-      timecodeString != NULL ? timecodeString : "No timecode",
-      "Valid Frame", videoFrame->GetRowBytes () * videoFrame->GetHeight ());
-
-  if (timecodeString)
-    FREE_COM_STRING (timecodeString);
-
-  g_mutex_lock (&decklinksrc->mutex);
-  if (decklinksrc->video_frame != NULL) {
-    decklinksrc->dropped_frames++;
-    decklinksrc->video_frame->Release();
-    if (decklinksrc->audio_frame) {
-      decklinksrc->audio_frame->Release();
-    }
-  }
-  videoFrame->AddRef ();
-  decklinksrc->video_frame = videoFrame;
-  if (audioFrame) {
-    audioFrame->AddRef ();
-    decklinksrc->audio_frame = audioFrame;
-  }
-
-  /* increment regardless whether frame was dropped or not */
-  decklinksrc->frame_num++;
-
-  g_cond_signal (&decklinksrc->cond);
-  g_mutex_unlock (&decklinksrc->mutex);
-
-  return S_OK;
-}
-
-HRESULT
-DeckLinkCaptureDelegate::VideoInputFormatChanged (
-    BMDVideoInputFormatChangedEvents events, IDeckLinkDisplayMode * mode,
-    BMDDetectedVideoInputFormatFlags)
-{
-  GstDecklinkSrc *decklinksrc;
-
-  g_return_val_if_fail (priv != NULL, S_OK);
-  g_return_val_if_fail (GST_IS_DECKLINK_SRC (priv), S_OK);
-
-  decklinksrc = GST_DECKLINK_SRC (priv);
-
-  GST_ERROR_OBJECT (decklinksrc, "unimplemented: video input format changed");
-
-  return S_OK;
-}
diff --git a/sys/decklink/capture.h b/sys/decklink/capture.h
deleted file mode 100644
index 029500f..0000000
--- a/sys/decklink/capture.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef __CAPTURE_H__
-#define __CAPTURE_H__
-
-#include "gstdecklink.h"
-
-class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
-{
-  public:
-    DeckLinkCaptureDelegate();
-    ~DeckLinkCaptureDelegate();
-
-    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
-    virtual ULONG STDMETHODCALLTYPE AddRef(void);
-    virtual ULONG STDMETHODCALLTYPE  Release(void);
-    virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
-    virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
-
-    void *priv;
-
-  private:
-    ULONG m_refCount;
-    GMutex m_mutex;
-};
-
-#endif
diff --git a/sys/decklink/gstdecklink.cpp b/sys/decklink/gstdecklink.cpp
index 7807752..7335ab3 100644
--- a/sys/decklink/gstdecklink.cpp
+++ b/sys/decklink/gstdecklink.cpp
@@ -1,5 +1,7 @@
 /* GStreamer
  * Copyright (C) 2011 David Schleef <ds@schleef.org>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -23,14 +25,21 @@
 
 #include <gst/gst.h>
 #include "gstdecklink.h"
-#include "gstdecklinksrc.h"
-#include "gstdecklinksink.h"
+#include "gstdecklinkaudiosink.h"
+#include "gstdecklinkvideosink.h"
+#include "gstdecklinkaudiosrc.h"
+#include "gstdecklinkvideosrc.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_decklink_debug);
+#define GST_CAT_DEFAULT gst_decklink_debug
 
 GType
 gst_decklink_mode_get_type (void)
 {
   static gsize id = 0;
   static const GEnumValue modes[] = {
+    {GST_DECKLINK_MODE_AUTO, "auto", "Automatic detection"},
+
     {GST_DECKLINK_MODE_NTSC, "ntsc", "NTSC SD 60i"},
     {GST_DECKLINK_MODE_NTSC2398, "ntsc2398", "NTSC SD 60i (24 fps)"},
     {GST_DECKLINK_MODE_PAL, "pal", "PAL SD 50i"},
@@ -55,6 +64,19 @@
     {GST_DECKLINK_MODE_720p5994, "720p5994", "HD720 59.94p"},
     {GST_DECKLINK_MODE_720p60, "720p60", "HD720 60p"},
 
+    {GST_DECKLINK_MODE_2048p2398, "2048p2398", "2k 23.98p"},
+    {GST_DECKLINK_MODE_2048p24, "2048p24", "2k 24p"},
+    {GST_DECKLINK_MODE_2048p25, "2048p25", "2k 25p"},
+
+    {GST_DECKLINK_MODE_3184p2398, "3184p2398", "4k 23.98p"},
+    {GST_DECKLINK_MODE_3184p24, "3184p24", "4k 24p"},
+    {GST_DECKLINK_MODE_3184p25, "3184p25", "4k 25p"},
+    {GST_DECKLINK_MODE_3184p2997, "3184p2997", "4k 29.97p"},
+    {GST_DECKLINK_MODE_3184p30, "3184p30", "4k 30p"},
+    {GST_DECKLINK_MODE_3184p50, "3184p50", "4k 50p"},
+    {GST_DECKLINK_MODE_3184p5994, "3184p5994", "4k 59.94p"},
+    {GST_DECKLINK_MODE_3184p60, "3184p60", "4k 60p"},
+
     {0, NULL, NULL}
   };
 
@@ -71,6 +93,7 @@
 {
   static gsize id = 0;
   static const GEnumValue connections[] = {
+    {GST_DECKLINK_CONNECTION_AUTO, "auto", "Auto"},
     {GST_DECKLINK_CONNECTION_SDI, "sdi", "SDI"},
     {GST_DECKLINK_CONNECTION_HDMI, "hdmi", "HDMI"},
     {GST_DECKLINK_CONNECTION_OPTICAL_SDI, "optical-sdi", "Optical SDI"},
@@ -98,6 +121,10 @@
         "SDI/HDMI embedded audio"},
     {GST_DECKLINK_AUDIO_CONNECTION_AES_EBU, "aes", "AES/EBU input"},
     {GST_DECKLINK_AUDIO_CONNECTION_ANALOG, "analog", "Analog input"},
+    {GST_DECKLINK_AUDIO_CONNECTION_ANALOG_XLR, "analog-xlr",
+        "Analog input (XLR)"},
+    {GST_DECKLINK_AUDIO_CONNECTION_ANALOG_RCA, "analog-rca",
+        "Analog input (RCA)"},
     {0, NULL, NULL}
   };
 
@@ -110,11 +137,14 @@
   return (GType) id;
 }
 
-#define NTSC 10, 11, false, false
-#define PAL 12, 11, true, false
-#define HD 1, 1, false, true
+#define NTSC 10, 11, false, "bt601"
+#define PAL 12, 11, true, "bt601"
+#define HD 1, 1, false, "bt709"
+#define UHD 1, 1, false, "bt2020"
 
 static const GstDecklinkMode modes[] = {
+  {bmdModeNTSC, 720, 486, 30000, 1001, true, NTSC},     // default is ntsc
+
   {bmdModeNTSC, 720, 486, 30000, 1001, true, NTSC},
   {bmdModeNTSC2398, 720, 486, 24000, 1001, true, NTSC},
   {bmdModePAL, 720, 576, 25, 1, true, PAL},
@@ -127,9 +157,9 @@
   {bmdModeHD1080p2997, 1920, 1080, 30000, 1001, false, HD},
   {bmdModeHD1080p30, 1920, 1080, 30, 1, false, HD},
 
-  {bmdModeHD1080i50, 1920, 1080, 50, 1, true, HD},
-  {bmdModeHD1080i5994, 1920, 1080, 60000, 1001, true, HD},
-  {bmdModeHD1080i6000, 1920, 1080, 60, 1, true, HD},
+  {bmdModeHD1080i50, 1920, 1080, 25, 1, true, HD},
+  {bmdModeHD1080i5994, 1920, 1080, 30000, 1001, true, HD},
+  {bmdModeHD1080i6000, 1920, 1080, 30, 1, true, HD},
 
   {bmdModeHD1080p50, 1920, 1080, 50, 1, false, HD},
   {bmdModeHD1080p5994, 1920, 1080, 60000, 1001, false, HD},
@@ -137,16 +167,154 @@
 
   {bmdModeHD720p50, 1280, 720, 50, 1, false, HD},
   {bmdModeHD720p5994, 1280, 720, 60000, 1001, false, HD},
-  {bmdModeHD720p60, 1280, 720, 60, 1, false, HD}
+  {bmdModeHD720p60, 1280, 720, 60, 1, false, HD},
 
+  {bmdMode2k2398, 2048, 1556, 24000, 1001, false, HD},
+  {bmdMode2k24, 2048, 1556, 24, 1, false, HD},
+  {bmdMode2k25, 2048, 1556, 25, 1, false, HD},
+
+  {bmdMode4K2160p2398, 3840, 2160, 24000, 1001, false, UHD},
+  {bmdMode4K2160p24, 3840, 2160, 24, 1, false, UHD},
+  {bmdMode4K2160p25, 3840, 2160, 25, 1, false, UHD},
+  {bmdMode4K2160p2997, 3840, 2160, 30000, 1001, false, UHD},
+  {bmdMode4K2160p30, 3840, 2160, 30, 1, false, UHD},
+  {bmdMode4K2160p50, 3840, 2160, 55, 1, false, UHD},
+  {bmdMode4K2160p5994, 3840, 2160, 60000, 1001, false, UHD},
+  {bmdMode4K2160p60, 3840, 2160, 60, 1, false, UHD}
 };
 
 const GstDecklinkMode *
 gst_decklink_get_mode (GstDecklinkModeEnum e)
 {
+  if (e < GST_DECKLINK_MODE_AUTO || e > GST_DECKLINK_MODE_3184p60)
+    return NULL;
   return &modes[e];
 }
 
+const GstDecklinkModeEnum
+gst_decklink_get_mode_enum_from_bmd (BMDDisplayMode mode)
+{
+  GstDecklinkModeEnum displayMode = GST_DECKLINK_MODE_NTSC;
+  switch (mode) {
+    case bmdModeNTSC:
+      displayMode = GST_DECKLINK_MODE_NTSC;
+      break;
+    case bmdModeNTSC2398:
+      displayMode = GST_DECKLINK_MODE_NTSC2398;
+      break;
+    case bmdModePAL:
+      displayMode = GST_DECKLINK_MODE_PAL;
+      break;
+    case bmdModeNTSCp:
+      displayMode = GST_DECKLINK_MODE_NTSC_P;
+      break;
+    case bmdModePALp:
+      displayMode = GST_DECKLINK_MODE_PAL_P;
+      break;
+    case bmdModeHD1080p2398:
+      displayMode = GST_DECKLINK_MODE_1080p2398;
+      break;
+    case bmdModeHD1080p24:
+      displayMode = GST_DECKLINK_MODE_1080p24;
+      break;
+    case bmdModeHD1080p25:
+      displayMode = GST_DECKLINK_MODE_1080p25;
+      break;
+    case bmdModeHD1080p2997:
+      displayMode = GST_DECKLINK_MODE_1080p2997;
+      break;
+    case bmdModeHD1080p30:
+      displayMode = GST_DECKLINK_MODE_1080p30;
+      break;
+    case bmdModeHD1080i50:
+      displayMode = GST_DECKLINK_MODE_1080i50;
+      break;
+    case bmdModeHD1080i5994:
+      displayMode = GST_DECKLINK_MODE_1080i5994;
+      break;
+    case bmdModeHD1080i6000:
+      displayMode = GST_DECKLINK_MODE_1080i60;
+      break;
+    case bmdModeHD1080p50:
+      displayMode = GST_DECKLINK_MODE_1080p50;
+      break;
+    case bmdModeHD1080p5994:
+      displayMode = GST_DECKLINK_MODE_1080p5994;
+      break;
+    case bmdModeHD1080p6000:
+      displayMode = GST_DECKLINK_MODE_1080p60;
+      break;
+    case bmdModeHD720p50:
+      displayMode = GST_DECKLINK_MODE_720p50;
+      break;
+    case bmdModeHD720p5994:
+      displayMode = GST_DECKLINK_MODE_720p5994;
+      break;
+    case bmdModeHD720p60:
+      displayMode = GST_DECKLINK_MODE_720p60;
+      break;
+    case bmdMode2k2398:
+      displayMode = GST_DECKLINK_MODE_2048p2398;
+      break;
+    case bmdMode2k24:
+      displayMode = GST_DECKLINK_MODE_2048p24;
+      break;
+    case bmdMode2k25:
+      displayMode = GST_DECKLINK_MODE_2048p25;
+      break;
+    case bmdMode4K2160p2398:
+      displayMode = GST_DECKLINK_MODE_3184p2398;
+      break;
+    case bmdMode4K2160p24:
+      displayMode = GST_DECKLINK_MODE_3184p24;
+      break;
+    case bmdMode4K2160p25:
+      displayMode = GST_DECKLINK_MODE_3184p25;
+      break;
+    case bmdMode4K2160p2997:
+      displayMode = GST_DECKLINK_MODE_3184p2997;
+      break;
+    case bmdMode4K2160p30:
+      displayMode = GST_DECKLINK_MODE_3184p30;
+      break;
+    case bmdMode4K2160p50:
+      displayMode = GST_DECKLINK_MODE_3184p50;
+      break;
+    case bmdMode4K2160p5994:
+      displayMode = GST_DECKLINK_MODE_3184p5994;
+      break;
+    case bmdMode4K2160p60:
+      displayMode = GST_DECKLINK_MODE_3184p60;
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+  return displayMode;
+}
+
+static const BMDVideoConnection connections[] = {
+  0,                            /* auto */
+  bmdVideoConnectionSDI,
+  bmdVideoConnectionHDMI,
+  bmdVideoConnectionOpticalSDI,
+  bmdVideoConnectionComponent,
+  bmdVideoConnectionComposite,
+  bmdVideoConnectionSVideo
+};
+
+const BMDVideoConnection
+gst_decklink_get_connection (GstDecklinkConnectionEnum e)
+{
+  g_return_val_if_fail (e != GST_DECKLINK_CONNECTION_AUTO,
+      bmdVideoConnectionSDI);
+
+  if (e <= GST_DECKLINK_CONNECTION_AUTO || e > GST_DECKLINK_CONNECTION_SVIDEO)
+    e = GST_DECKLINK_CONNECTION_SDI;
+
+  return connections[e];
+}
+
 static GstStructure *
 gst_decklink_mode_get_structure (GstDecklinkModeEnum e)
 {
@@ -157,10 +325,10 @@
       "width", G_TYPE_INT, mode->width,
       "height", G_TYPE_INT, mode->height,
       "framerate", GST_TYPE_FRACTION, mode->fps_n, mode->fps_d,
-      "interlace-mode", G_TYPE_STRING, mode->interlaced ? "interleaved" : "progressive",
-      "pixel-aspect-ratio", GST_TYPE_FRACTION, mode->par_n, mode->par_d,
-      "colorimetry", G_TYPE_STRING, mode->is_hdtv ? "bt709" : "bt601",
-      "chroma-site", G_TYPE_STRING, "mpeg2", NULL);
+      "interlace-mode", G_TYPE_STRING,
+      mode->interlaced ? "interleaved" : "progressive", "pixel-aspect-ratio",
+      GST_TYPE_FRACTION, mode->par_n, mode->par_d, "colorimetry", G_TYPE_STRING,
+      mode->colorimetry, "chroma-site", G_TYPE_STRING, "mpeg2", NULL);
 }
 
 GstCaps *
@@ -190,58 +358,304 @@
   return caps;
 }
 
-typedef struct _Device Device;
-struct _Device {
-  IDeckLink *decklink;
-  IDeckLinkInput *input;
-  IDeckLinkOutput *output;
-  IDeckLinkConfiguration *config;
+#define GST_TYPE_DECKLINK_CLOCK \
+  (gst_decklink_clock_get_type())
+#define GST_DECKLINK_CLOCK(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECKLINK_CLOCK,GstDecklinkClock))
+#define GST_DECKLINK_CLOCK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECKLINK_CLOCK,GstDecklinkClockClass))
+#define GST_IS_Decklink_CLOCK(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECKLINK_CLOCK))
+#define GST_IS_Decklink_CLOCK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECKLINK_CLOCK))
+#define GST_DECKLINK_CLOCK_CAST(obj) \
+  ((GstDecklinkClock*)(obj))
+
+typedef struct _GstDecklinkClock GstDecklinkClock;
+typedef struct _GstDecklinkClockClass GstDecklinkClockClass;
+
+struct _GstDecklinkClock
+{
+  GstSystemClock clock;
+
+  GstDecklinkInput *input;
+  GstDecklinkOutput *output;
 };
 
+struct _GstDecklinkClockClass
+{
+  GstSystemClockClass parent_class;
+};
+
+GType gst_decklink_clock_get_type (void);
+static GstClock *gst_decklink_clock_new (const gchar * name);
+
+typedef struct _Device Device;
+struct _Device
+{
+  GstDecklinkOutput output;
+  GstDecklinkInput input;
+};
+
+class GStreamerDecklinkInputCallback:public IDeckLinkInputCallback
+{
+private:
+  GstDecklinkInput * m_input;
+  GMutex m_mutex;
+  gint m_refcount;
+public:
+    GStreamerDecklinkInputCallback (GstDecklinkInput * input)
+  : IDeckLinkInputCallback (), m_refcount (1)
+  {
+    m_input = input;
+    g_mutex_init (&m_mutex);
+  }
+
+  virtual ~ GStreamerDecklinkInputCallback ()
+  {
+    g_mutex_clear (&m_mutex);
+  }
+
+  virtual HRESULT STDMETHODCALLTYPE QueryInterface (REFIID, LPVOID *)
+  {
+    return E_NOINTERFACE;
+  }
+
+  virtual ULONG STDMETHODCALLTYPE AddRef (void)
+  {
+    ULONG ret;
+
+    g_mutex_lock (&m_mutex);
+    m_refcount++;
+    ret = m_refcount;
+    g_mutex_unlock (&m_mutex);
+
+    return ret;
+  }
+
+  virtual ULONG STDMETHODCALLTYPE Release (void)
+  {
+    ULONG ret;
+
+    g_mutex_lock (&m_mutex);
+    m_refcount--;
+    ret = m_refcount;
+    g_mutex_unlock (&m_mutex);
+
+
+    if (ret == 0) {
+      delete this;
+    }
+
+    return ret;
+  }
+
+  virtual HRESULT STDMETHODCALLTYPE
+      VideoInputFormatChanged (BMDVideoInputFormatChangedEvents,
+      IDeckLinkDisplayMode * mode, BMDDetectedVideoInputFormatFlags)
+  {
+    GST_INFO ("Video input format changed");
+
+    g_mutex_lock (&m_input->lock);
+    m_input->input->PauseStreams ();
+    m_input->input->EnableVideoInput (mode->GetDisplayMode (),
+        bmdFormat8BitYUV, bmdVideoInputEnableFormatDetection);
+    m_input->input->FlushStreams ();
+    m_input->input->StartStreams ();
+    m_input->mode =
+        gst_decklink_get_mode (gst_decklink_get_mode_enum_from_bmd
+        (mode->GetDisplayMode ()));
+    g_mutex_unlock (&m_input->lock);
+
+    return S_OK;
+  }
+
+  virtual HRESULT STDMETHODCALLTYPE
+      VideoInputFrameArrived (IDeckLinkVideoInputFrame * video_frame,
+      IDeckLinkAudioInputPacket * audio_packet)
+  {
+    GstElement *videosrc = NULL, *audiosrc = NULL;
+    void (*got_video_frame) (GstElement * videosrc,
+        IDeckLinkVideoInputFrame * frame, GstDecklinkModeEnum mode,
+        GstClockTime capture_time, GstClockTime capture_duration) = NULL;
+    void (*got_audio_packet) (GstElement * videosrc,
+        IDeckLinkAudioInputPacket * packet, GstClockTime capture_time) = NULL;
+    GstDecklinkModeEnum mode;
+    BMDTimeValue capture_time, capture_duration;
+    HRESULT res;
+
+    res =
+        video_frame->GetHardwareReferenceTimestamp (GST_SECOND, &capture_time,
+        &capture_duration);
+    if (res != S_OK) {
+      GST_ERROR ("Failed to get capture time: 0x%08x", res);
+      capture_time = GST_CLOCK_TIME_NONE;
+      capture_duration = GST_CLOCK_TIME_NONE;
+    }
+
+    g_mutex_lock (&m_input->lock);
+
+    if (capture_time > (BMDTimeValue) m_input->clock_start_time)
+      capture_time -= m_input->clock_start_time;
+    else
+      capture_time = 0;
+
+    if (capture_time > (BMDTimeValue) m_input->clock_offset)
+      capture_time -= m_input->clock_offset;
+    else
+      capture_time = 0;
+
+    if (m_input->videosrc) {
+      videosrc = GST_ELEMENT_CAST (gst_object_ref (m_input->videosrc));
+      got_video_frame = m_input->got_video_frame;
+    }
+    mode = gst_decklink_get_mode_enum_from_bmd (m_input->mode->mode);
+
+    if (m_input->audiosrc) {
+      audiosrc = GST_ELEMENT_CAST (gst_object_ref (m_input->audiosrc));
+      got_audio_packet = m_input->got_audio_packet;
+    }
+    g_mutex_unlock (&m_input->lock);
+
+    if (got_video_frame && videosrc) {
+      got_video_frame (videosrc, video_frame, mode, capture_time,
+          capture_duration);
+    }
+
+    if (got_audio_packet && audiosrc) {
+      m_input->got_audio_packet (audiosrc, audio_packet, capture_time);
+    }
+
+    gst_object_replace ((GstObject **) & videosrc, NULL);
+    gst_object_replace ((GstObject **) & audiosrc, NULL);
+
+    return S_OK;
+  }
+};
+
+#ifdef _MSC_VER
+/* FIXME: We currently never deinit this */
+
+static GMutex com_init_lock;
+static GMutex com_deinit_lock;
+static GCond com_init_cond;
+static GCond com_deinit_cond;
+static GCond com_deinited_cond;
+static gboolean com_initialized = FALSE;
+
+/* COM initialization/uninitialization thread */
+static gpointer
+gst_decklink_com_thread (gpointer data)
+{
+  HRESULT res;
+
+  g_mutex_lock (&com_init_lock);
+
+  /* Initialize COM with a MTA for this process. This thread will
+   * be the first one to enter the apartement and the last one to leave
+   * it, unitializing COM properly */
+
+  res = CoInitializeEx (0, COINIT_MULTITHREADED);
+  if (res == S_FALSE)
+    GST_WARNING ("COM has been already initialized in the same process");
+  else if (res == RPC_E_CHANGED_MODE)
+    GST_WARNING ("The concurrency model of COM has changed.");
+  else
+    GST_INFO ("COM intialized succesfully");
+
+  com_initialized = TRUE;
+
+  /* Signal other threads waiting on this condition that COM was initialized */
+  g_cond_signal (&com_init_cond);
+
+  g_mutex_unlock (&com_init_lock);
+
+  /* Wait until the unitialize condition is met to leave the COM apartement */
+  g_mutex_lock (&com_deinit_lock);
+  g_cond_wait (&com_deinit_cond, &com_deinit_lock);
+
+  CoUninitialize ();
+  GST_INFO ("COM unintialized succesfully");
+  com_initialized = FALSE;
+  g_cond_signal (&com_deinited_cond);
+  g_mutex_unlock (&com_deinit_lock);
+
+  return NULL;
+}
+#endif /* _MSC_VER */
+
+static GOnce devices_once = G_ONCE_INIT;
 static int n_devices;
 static Device devices[10];
 
-static void
-init_devices (void)
+static gpointer
+init_devices (gpointer data)
 {
   IDeckLinkIterator *iterator;
   IDeckLink *decklink = NULL;
   HRESULT ret;
   int i;
-  static gboolean inited = FALSE;
 
-  if (inited) return;
-  inited = TRUE;
+#ifdef _MSC_VER
+  // Start COM thread for Windows
+
+  g_mutex_lock (&com_init_lock);
+
+  /* create the COM initialization thread */
+  g_thread_create ((GThreadFunc) gst_decklink_com_thread, NULL, FALSE, NULL);
+
+  /* wait until the COM thread signals that COM has been initialized */
+  g_cond_wait (&com_init_cond, &com_init_lock);
+  g_mutex_unlock (&com_init_lock);
+#endif /* _MSC_VER */
 
   iterator = CreateDeckLinkIteratorInstance ();
   if (iterator == NULL) {
     GST_ERROR ("no driver");
-    return;
+    return NULL;
   }
 
   i = 0;
   ret = iterator->Next (&decklink);
   while (ret == S_OK) {
-    devices[i].decklink = decklink;
-
     ret = decklink->QueryInterface (IID_IDeckLinkInput,
-        (void **) &devices[i].input);
+        (void **) &devices[i].input.input);
     if (ret != S_OK) {
       GST_WARNING ("selected device does not have input interface");
+    } else {
+      devices[i].input.device = decklink;
+      devices[i].input.clock = gst_decklink_clock_new ("GstDecklinkInputClock");
+      GST_DECKLINK_CLOCK_CAST (devices[i].input.clock)->input =
+          &devices[i].input;
+      devices[i].input.
+          input->SetCallback (new GStreamerDecklinkInputCallback (&devices[i].
+              input));
     }
 
     ret = decklink->QueryInterface (IID_IDeckLinkOutput,
-        (void **) &devices[i].output);
+        (void **) &devices[i].output.output);
     if (ret != S_OK) {
       GST_WARNING ("selected device does not have output interface");
+    } else {
+      devices[i].output.device = decklink;
+      devices[i].output.clock =
+          gst_decklink_clock_new ("GstDecklinkOutputClock");
+      GST_DECKLINK_CLOCK_CAST (devices[i].output.clock)->output =
+          &devices[i].output;
     }
 
     ret = decklink->QueryInterface (IID_IDeckLinkConfiguration,
-        (void **) &devices[i].config);
+        (void **) &devices[i].input.config);
     if (ret != S_OK) {
       GST_WARNING ("selected device does not have config interface");
     }
 
+    ret = decklink->QueryInterface (IID_IDeckLinkAttributes,
+        (void **) &devices[i].input.attributes);
+    if (ret != S_OK) {
+      GST_WARNING ("selected device does not have attributes interface");
+    }
+
     ret = iterator->Next (&decklink);
     i++;
 
@@ -253,47 +667,291 @@
 
   n_devices = i;
 
-  iterator->Release();
+  iterator->Release ();
+
+  return NULL;
 }
 
-IDeckLink *
-gst_decklink_get_nth_device (int n)
+GstDecklinkOutput *
+gst_decklink_acquire_nth_output (gint n, GstElement * sink, gboolean is_audio)
 {
-  init_devices ();
-  return devices[n].decklink;
+  GstDecklinkOutput *output;
+
+  g_once (&devices_once, init_devices, NULL);
+
+  if (n >= n_devices)
+    return NULL;
+
+  output = &devices[n].output;
+  if (!output->output) {
+    GST_ERROR ("Device %d has no output", n);
+    return NULL;
+  }
+
+  g_mutex_lock (&output->lock);
+  if (is_audio && !output->audiosink) {
+    output->audiosink = GST_ELEMENT_CAST (gst_object_ref (sink));
+    g_mutex_unlock (&output->lock);
+    return output;
+  } else if (!output->videosink) {
+    output->videosink = GST_ELEMENT_CAST (gst_object_ref (sink));
+    g_mutex_unlock (&output->lock);
+    return output;
+  }
+  g_mutex_unlock (&output->lock);
+
+  GST_ERROR ("Output device %d (audio: %d) in use already", n, is_audio);
+  return NULL;
 }
 
-IDeckLinkInput *
-gst_decklink_get_nth_input (int n)
+void
+gst_decklink_release_nth_output (gint n, GstElement * sink, gboolean is_audio)
 {
-  init_devices ();
-  return devices[n].input;
+  GstDecklinkOutput *output;
+
+  if (n >= n_devices)
+    return;
+
+  output = &devices[n].output;
+  g_assert (output->output);
+
+  g_mutex_lock (&output->lock);
+  if (is_audio) {
+    g_assert (output->audiosink == sink);
+    gst_object_unref (sink);
+    output->audiosink = NULL;
+  } else {
+    g_assert (output->videosink == sink);
+    gst_object_unref (sink);
+    output->videosink = NULL;
+  }
+  g_mutex_unlock (&output->lock);
 }
 
-IDeckLinkOutput *
-gst_decklink_get_nth_output (int n)
+void
+gst_decklink_output_set_audio_clock (GstDecklinkOutput * output,
+    GstClock * clock)
 {
-  init_devices ();
-  return devices[n].output;
+  g_mutex_lock (&output->lock);
+  if (output->audio_clock)
+    gst_object_unref (output->audio_clock);
+  output->audio_clock = clock;
+  if (clock)
+    gst_object_ref (clock);
+  g_mutex_unlock (&output->lock);
 }
 
-IDeckLinkConfiguration *
-gst_decklink_get_nth_config (int n)
+
+GstClock *
+gst_decklink_output_get_audio_clock (GstDecklinkOutput * output)
 {
-  init_devices ();
-  return devices[n].config;
+  GstClock *ret = NULL;
+
+  g_mutex_lock (&output->lock);
+  if (output->audio_clock)
+    ret = GST_CLOCK_CAST (gst_object_ref (output->audio_clock));
+  g_mutex_unlock (&output->lock);
+
+  return ret;
+}
+
+GstDecklinkInput *
+gst_decklink_acquire_nth_input (gint n, GstElement * src, gboolean is_audio)
+{
+  GstDecklinkInput *input;
+
+  g_once (&devices_once, init_devices, NULL);
+
+  if (n >= n_devices)
+    return NULL;
+
+  input = &devices[n].input;
+  if (!input->input) {
+    GST_ERROR ("Device %d has no input", n);
+    return NULL;
+  }
+
+  g_mutex_lock (&input->lock);
+  if (is_audio && !input->audiosrc) {
+    input->audiosrc = GST_ELEMENT_CAST (gst_object_ref (src));
+    g_mutex_unlock (&input->lock);
+    return input;
+  } else if (!input->videosrc) {
+    input->videosrc = GST_ELEMENT_CAST (gst_object_ref (src));
+    g_mutex_unlock (&input->lock);
+    return input;
+  }
+  g_mutex_unlock (&input->lock);
+
+  GST_ERROR ("Input device %d (audio: %d) in use already", n, is_audio);
+  return NULL;
+}
+
+void
+gst_decklink_release_nth_input (gint n, GstElement * src, gboolean is_audio)
+{
+  GstDecklinkInput *input;
+
+  if (n >= n_devices)
+    return;
+
+  input = &devices[n].input;
+  g_assert (input->input);
+
+  g_mutex_lock (&input->lock);
+  if (is_audio) {
+    g_assert (input->audiosrc == src);
+    gst_object_unref (src);
+    input->audiosrc = NULL;
+  } else {
+    g_assert (input->videosrc == src);
+    gst_object_unref (src);
+    input->videosrc = NULL;
+  }
+  g_mutex_unlock (&input->lock);
+}
+
+G_DEFINE_TYPE (GstDecklinkClock, gst_decklink_clock, GST_TYPE_SYSTEM_CLOCK);
+
+static GstClockTime gst_decklink_clock_get_internal_time (GstClock * clock);
+
+static void
+gst_decklink_clock_class_init (GstDecklinkClockClass * klass)
+{
+  GstClockClass *clock_class = (GstClockClass *) klass;
+
+  clock_class->get_internal_time = gst_decklink_clock_get_internal_time;
+}
+
+static void
+gst_decklink_clock_init (GstDecklinkClock * clock)
+{
+  GST_OBJECT_FLAG_SET (clock, GST_CLOCK_FLAG_CAN_SET_MASTER);
+}
+
+static GstClock *
+gst_decklink_clock_new (const gchar * name)
+{
+  GstDecklinkClock *self =
+      GST_DECKLINK_CLOCK (g_object_new (GST_TYPE_DECKLINK_CLOCK, "name", name,
+          "clock-type", GST_CLOCK_TYPE_OTHER, NULL));
+
+  return GST_CLOCK_CAST (self);
+}
+
+static GstClockTime
+gst_decklink_clock_get_internal_time (GstClock * clock)
+{
+  GstDecklinkClock *self = GST_DECKLINK_CLOCK (clock);
+  GstClockTime result, start_time, last_time;
+  GstClockTimeDiff offset;
+  BMDTimeValue time;
+  HRESULT ret;
+
+  if (self->input != NULL) {
+    g_mutex_lock (&self->input->lock);
+    start_time = self->input->clock_start_time;
+    offset = self->input->clock_offset;
+    last_time = self->input->clock_last_time;
+    time = -1;
+    if (!self->input->started) {
+      result = last_time;
+      ret = -1;
+    } else {
+      ret =
+          self->input->input->GetHardwareReferenceClock (GST_SECOND, &time,
+          NULL, NULL);
+      if (ret == S_OK && time >= 0) {
+        result = time;
+        if (start_time == GST_CLOCK_TIME_NONE)
+          start_time = self->input->clock_start_time = result;
+
+        if (result > start_time)
+          result -= start_time;
+        else
+          result = 0;
+
+        if (self->input->clock_restart) {
+          self->input->clock_offset = result - last_time;
+          offset = self->input->clock_offset;
+          self->input->clock_restart = FALSE;
+        }
+        result = MAX (last_time, result);
+        result -= offset;
+        result = MAX (last_time, result);
+      } else {
+        result = last_time;
+      }
+
+      self->input->clock_last_time = result;
+    }
+    g_mutex_unlock (&self->input->lock);
+  } else if (self->output != NULL) {
+    g_mutex_lock (&self->output->lock);
+    start_time = self->output->clock_start_time;
+    offset = self->output->clock_offset;
+    last_time = self->output->clock_last_time;
+    time = -1;
+    if (!self->output->started) {
+      result = last_time;
+      ret = -1;
+    } else {
+      ret =
+          self->output->output->GetHardwareReferenceClock (GST_SECOND, &time,
+          NULL, NULL);
+      if (ret == S_OK && time >= 0) {
+        result = time;
+
+        if (start_time == GST_CLOCK_TIME_NONE)
+          start_time = self->output->clock_start_time = result;
+
+        if (result > start_time)
+          result -= start_time;
+        else
+          result = 0;
+
+        if (self->output->clock_restart) {
+          self->output->clock_offset = result - last_time;
+          offset = self->output->clock_offset;
+          self->output->clock_restart = FALSE;
+        }
+        result = MAX (last_time, result);
+        result -= offset;
+        result = MAX (last_time, result);
+      } else {
+        result = last_time;
+      }
+
+      self->output->clock_last_time = result;
+    }
+    g_mutex_unlock (&self->output->lock);
+  } else {
+    g_assert_not_reached ();
+  }
+  GST_LOG_OBJECT (clock,
+      "result %" GST_TIME_FORMAT " time %" GST_TIME_FORMAT " last time %"
+      GST_TIME_FORMAT " offset %" GST_TIME_FORMAT " start time %"
+      GST_TIME_FORMAT " (ret: 0x%08x)", GST_TIME_ARGS (result),
+      GST_TIME_ARGS (time), GST_TIME_ARGS (last_time), GST_TIME_ARGS (offset),
+      GST_TIME_ARGS (start_time), ret);
+
+  return result;
 }
 
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
+  GST_DEBUG_CATEGORY_INIT (gst_decklink_debug, "decklink", 0,
+      "debug category for decklink plugin");
 
-  gst_element_register (plugin, "decklinksrc", GST_RANK_NONE,
-      gst_decklink_src_get_type ());
-
-  gst_element_register (plugin, "decklinksink", GST_RANK_NONE,
-      gst_decklink_sink_get_type ());
-
+  gst_element_register (plugin, "decklinkaudiosink", GST_RANK_NONE,
+      GST_TYPE_DECKLINK_AUDIO_SINK);
+  gst_element_register (plugin, "decklinkvideosink", GST_RANK_NONE,
+      GST_TYPE_DECKLINK_VIDEO_SINK);
+  gst_element_register (plugin, "decklinkaudiosrc", GST_RANK_NONE,
+      GST_TYPE_DECKLINK_AUDIO_SRC);
+  gst_element_register (plugin, "decklinkvideosrc", GST_RANK_NONE,
+      GST_TYPE_DECKLINK_VIDEO_SRC);
   return TRUE;
 }
 
diff --git a/sys/decklink/gstdecklink.h b/sys/decklink/gstdecklink.h
index a204c78..51071e7 100644
--- a/sys/decklink/gstdecklink.h
+++ b/sys/decklink/gstdecklink.h
@@ -1,5 +1,7 @@
 /* GStreamer
  * Copyright (C) 2011 David Schleef <ds@schleef.org>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -42,6 +44,8 @@
 #endif /* _MSC_VER */
 
 typedef enum {
+  GST_DECKLINK_MODE_AUTO,
+
   GST_DECKLINK_MODE_NTSC,
   GST_DECKLINK_MODE_NTSC2398,
   GST_DECKLINK_MODE_PAL,
@@ -64,12 +68,26 @@
 
   GST_DECKLINK_MODE_720p50,
   GST_DECKLINK_MODE_720p5994,
-  GST_DECKLINK_MODE_720p60
+  GST_DECKLINK_MODE_720p60,
+
+  GST_DECKLINK_MODE_2048p2398,
+  GST_DECKLINK_MODE_2048p24,
+  GST_DECKLINK_MODE_2048p25,
+
+  GST_DECKLINK_MODE_3184p2398,
+  GST_DECKLINK_MODE_3184p24,
+  GST_DECKLINK_MODE_3184p25,
+  GST_DECKLINK_MODE_3184p2997,
+  GST_DECKLINK_MODE_3184p30,
+  GST_DECKLINK_MODE_3184p50,
+  GST_DECKLINK_MODE_3184p5994,
+  GST_DECKLINK_MODE_3184p60
 } GstDecklinkModeEnum;
 #define GST_TYPE_DECKLINK_MODE (gst_decklink_mode_get_type ())
 GType gst_decklink_mode_get_type (void);
 
 typedef enum {
+  GST_DECKLINK_CONNECTION_AUTO,
   GST_DECKLINK_CONNECTION_SDI,
   GST_DECKLINK_CONNECTION_HDMI,
   GST_DECKLINK_CONNECTION_OPTICAL_SDI,
@@ -84,7 +102,9 @@
   GST_DECKLINK_AUDIO_CONNECTION_AUTO,
   GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED,
   GST_DECKLINK_AUDIO_CONNECTION_AES_EBU,
-  GST_DECKLINK_AUDIO_CONNECTION_ANALOG
+  GST_DECKLINK_AUDIO_CONNECTION_ANALOG,
+  GST_DECKLINK_AUDIO_CONNECTION_ANALOG_XLR,
+  GST_DECKLINK_AUDIO_CONNECTION_ANALOG_RCA
 } GstDecklinkAudioConnectionEnum;
 #define GST_TYPE_DECKLINK_AUDIO_CONNECTION (gst_decklink_audio_connection_get_type ())
 GType gst_decklink_audio_connection_get_type (void);
@@ -100,16 +120,76 @@
   int par_n;
   int par_d;
   gboolean tff;
-  gboolean is_hdtv;
+  const gchar *colorimetry;
 };
 
 const GstDecklinkMode * gst_decklink_get_mode (GstDecklinkModeEnum e);
+const GstDecklinkModeEnum gst_decklink_get_mode_enum_from_bmd (BMDDisplayMode mode);
+const BMDVideoConnection gst_decklink_get_connection (GstDecklinkConnectionEnum e);
 GstCaps * gst_decklink_mode_get_caps (GstDecklinkModeEnum e);
 GstCaps * gst_decklink_mode_get_template_caps (void);
 
-IDeckLink * gst_decklink_get_nth_device (int n);
-IDeckLinkInput * gst_decklink_get_nth_input (int n);
-IDeckLinkOutput * gst_decklink_get_nth_output (int n);
-IDeckLinkConfiguration * gst_decklink_get_nth_config (int n);
+typedef struct _GstDecklinkOutput GstDecklinkOutput;
+struct _GstDecklinkOutput {
+  IDeckLink *device;
+  IDeckLinkOutput *output;
+  GstClock *clock;
+  GstClockTime clock_start_time, clock_last_time;
+  GstClockTimeDiff clock_offset;
+  gboolean started, clock_restart;
+
+  /* Everything below protected by mutex */
+  GMutex lock;
+
+  /* Set by the video source */
+  /* Configured mode or NULL */
+  const GstDecklinkMode *mode;
+
+  /* Set by the audio sink */
+  GstClock *audio_clock;
+
+  GstElement *audiosink;
+  gboolean audio_enabled;
+  GstElement *videosink;
+  gboolean video_enabled;
+  void (*start_scheduled_playback) (GstElement *videosink);
+};
+
+typedef struct _GstDecklinkInput GstDecklinkInput;
+struct _GstDecklinkInput {
+  IDeckLink *device;
+  IDeckLinkInput *input;
+  IDeckLinkConfiguration *config;
+  IDeckLinkAttributes *attributes;
+  GstClock *clock;
+  GstClockTime clock_start_time, clock_offset, clock_last_time;
+  gboolean started, clock_restart;
+
+  /* Everything below protected by mutex */
+  GMutex lock;
+
+  /* Set by the video source */
+  void (*got_video_frame) (GstElement *videosrc, IDeckLinkVideoInputFrame * frame, GstDecklinkModeEnum mode, GstClockTime capture_time, GstClockTime capture_duration);
+  /* Configured mode or NULL */
+  const GstDecklinkMode *mode;
+
+  /* Set by the audio source */
+  void (*got_audio_packet) (GstElement *videosrc, IDeckLinkAudioInputPacket * packet, GstClockTime capture_time);
+
+  GstElement *audiosrc;
+  gboolean audio_enabled;
+  GstElement *videosrc;
+  gboolean video_enabled;
+  void (*start_streams) (GstElement *videosrc);
+};
+
+GstDecklinkOutput * gst_decklink_acquire_nth_output (gint n, GstElement * sink, gboolean is_audio);
+void                gst_decklink_release_nth_output (gint n, GstElement * sink, gboolean is_audio);
+
+void                gst_decklink_output_set_audio_clock (GstDecklinkOutput * output, GstClock * clock);
+GstClock *          gst_decklink_output_get_audio_clock (GstDecklinkOutput * output);
+
+GstDecklinkInput *  gst_decklink_acquire_nth_input (gint n, GstElement * src, gboolean is_audio);
+void                gst_decklink_release_nth_input (gint n, GstElement * src, gboolean is_audio);
 
 #endif
diff --git a/sys/decklink/gstdecklinkaudiosink.cpp b/sys/decklink/gstdecklinkaudiosink.cpp
new file mode 100644
index 0000000..1db9339
--- /dev/null
+++ b/sys/decklink/gstdecklinkaudiosink.cpp
@@ -0,0 +1,670 @@
+/* GStreamer
+ * Copyright (C) 2011 David Schleef <ds@entropywave.com>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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., 51 Franklin Street, Suite 500,
+ * Boston, MA 02110-1335, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdecklinkaudiosink.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_decklink_audio_sink_debug);
+#define GST_CAT_DEFAULT gst_decklink_audio_sink_debug
+
+// Ringbuffer implementation
+
+#define GST_TYPE_DECKLINK_AUDIO_SINK_RING_BUFFER \
+  (gst_decklink_audio_sink_ringbuffer_get_type())
+#define GST_DECKLINK_AUDIO_SINK_RING_BUFFER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECKLINK_AUDIO_SINK_RING_BUFFER,GstDecklinkAudioSinkRingBuffer))
+#define GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST(obj) \
+  ((GstDecklinkAudioSinkRingBuffer*) obj)
+#define GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECKLINK_AUDIO_SINK_RING_BUFFER,GstDecklinkAudioSinkRingBufferClass))
+#define GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_DECKLINK_AUDIO_SINK_RING_BUFFER,GstDecklinkAudioSinkRingBufferClass))
+#define GST_IS_DECKLINK_AUDIO_SINK_RING_BUFFER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECKLINK_AUDIO_SINK_RING_BUFFER))
+#define GST_IS_DECKLINK_AUDIO_SINK_RING_BUFFER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECKLINK_AUDIO_SINK_RING_BUFFER))
+
+typedef struct _GstDecklinkAudioSinkRingBuffer GstDecklinkAudioSinkRingBuffer;
+typedef struct _GstDecklinkAudioSinkRingBufferClass
+    GstDecklinkAudioSinkRingBufferClass;
+
+struct _GstDecklinkAudioSinkRingBuffer
+{
+  GstAudioRingBuffer object;
+
+  GstDecklinkOutput *output;
+  GstDecklinkAudioSink *sink;
+
+  GMutex clock_id_lock;
+  GstClockID clock_id;
+};
+
+struct _GstDecklinkAudioSinkRingBufferClass
+{
+  GstAudioRingBufferClass parent_class;
+};
+
+GType gst_decklink_audio_sink_ringbuffer_get_type (void);
+
+static void gst_decklink_audio_sink_ringbuffer_finalize (GObject * object);
+
+static void gst_decklink_audio_sink_ringbuffer_clear_all (GstAudioRingBuffer *
+    rb);
+static guint gst_decklink_audio_sink_ringbuffer_delay (GstAudioRingBuffer * rb);
+static gboolean gst_decklink_audio_sink_ringbuffer_start (GstAudioRingBuffer *
+    rb);
+static gboolean gst_decklink_audio_sink_ringbuffer_pause (GstAudioRingBuffer *
+    rb);
+static gboolean gst_decklink_audio_sink_ringbuffer_stop (GstAudioRingBuffer *
+    rb);
+static gboolean gst_decklink_audio_sink_ringbuffer_acquire (GstAudioRingBuffer *
+    rb, GstAudioRingBufferSpec * spec);
+static gboolean gst_decklink_audio_sink_ringbuffer_release (GstAudioRingBuffer *
+    rb);
+static gboolean
+gst_decklink_audio_sink_ringbuffer_open_device (GstAudioRingBuffer * rb);
+static gboolean
+gst_decklink_audio_sink_ringbuffer_close_device (GstAudioRingBuffer * rb);
+
+#define ringbuffer_parent_class gst_decklink_audio_sink_ringbuffer_parent_class
+G_DEFINE_TYPE (GstDecklinkAudioSinkRingBuffer,
+    gst_decklink_audio_sink_ringbuffer, GST_TYPE_AUDIO_RING_BUFFER);
+
+static void
+    gst_decklink_audio_sink_ringbuffer_class_init
+    (GstDecklinkAudioSinkRingBufferClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstAudioRingBufferClass *gstringbuffer_class =
+      GST_AUDIO_RING_BUFFER_CLASS (klass);
+
+  gobject_class->finalize = gst_decklink_audio_sink_ringbuffer_finalize;
+
+  gstringbuffer_class->open_device =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_open_device);
+  gstringbuffer_class->close_device =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_close_device);
+  gstringbuffer_class->acquire =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_acquire);
+  gstringbuffer_class->release =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_release);
+  gstringbuffer_class->start =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_start);
+  gstringbuffer_class->pause =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_pause);
+  gstringbuffer_class->resume =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_start);
+  gstringbuffer_class->stop =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_stop);
+  gstringbuffer_class->delay =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_delay);
+  gstringbuffer_class->clear_all =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_ringbuffer_clear_all);
+}
+
+static void
+gst_decklink_audio_sink_ringbuffer_init (GstDecklinkAudioSinkRingBuffer * self)
+{
+  g_mutex_init (&self->clock_id_lock);
+}
+
+static void
+gst_decklink_audio_sink_ringbuffer_finalize (GObject * object)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (object);
+
+  gst_object_unref (self->sink);
+  self->sink = NULL;
+  g_mutex_clear (&self->clock_id_lock);
+
+  G_OBJECT_CLASS (ringbuffer_parent_class)->finalize (object);
+}
+
+class GStreamerAudioOutputCallback:public IDeckLinkAudioOutputCallback
+{
+public:
+  GStreamerAudioOutputCallback (GstDecklinkAudioSinkRingBuffer * ringbuffer)
+  :IDeckLinkAudioOutputCallback (), m_refcount (1)
+  {
+    m_ringbuffer =
+        GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (gst_object_ref (ringbuffer));
+    g_mutex_init (&m_mutex);
+  }
+
+  virtual HRESULT QueryInterface (REFIID, LPVOID *)
+  {
+    return E_NOINTERFACE;
+  }
+
+  virtual ULONG AddRef (void)
+  {
+    ULONG ret;
+
+    g_mutex_lock (&m_mutex);
+    m_refcount++;
+    ret = m_refcount;
+    g_mutex_unlock (&m_mutex);
+
+    return ret;
+  }
+
+  virtual ULONG Release (void)
+  {
+    ULONG ret;
+
+    g_mutex_lock (&m_mutex);
+    m_refcount--;
+    ret = m_refcount;
+    g_mutex_unlock (&m_mutex);
+
+    if (ret == 0) {
+      delete this;
+    }
+
+    return ret;
+  }
+
+  virtual ~ GStreamerAudioOutputCallback () {
+    gst_object_unref (m_ringbuffer);
+    g_mutex_clear (&m_mutex);
+  }
+
+  virtual HRESULT RenderAudioSamples (bool preroll)
+  {
+    guint8 *ptr;
+    gint seg;
+    gint len;
+    gint bpf;
+    guint written, written_sum;
+    HRESULT res;
+    const GstAudioRingBufferSpec *spec =
+        &GST_AUDIO_RING_BUFFER_CAST (m_ringbuffer)->spec;
+    guint delay, max_delay;
+
+    GST_LOG_OBJECT (m_ringbuffer->sink, "Writing audio samples (preroll: %d)",
+        preroll);
+
+    delay =
+        gst_audio_ring_buffer_delay (GST_AUDIO_RING_BUFFER_CAST (m_ringbuffer));
+    max_delay = MAX ((spec->segtotal * spec->segsize) / 2, spec->segsize);
+    max_delay /= GST_AUDIO_INFO_BPF (&spec->info);
+    if (delay > max_delay) {
+      GstClock *clock =
+          gst_element_get_clock (GST_ELEMENT_CAST (m_ringbuffer->sink));
+      GstClockTime wait_time;
+      GstClockID clock_id;
+      GstClockReturn clock_ret;
+
+      GST_DEBUG_OBJECT (m_ringbuffer->sink, "Delay %u > max delay %u", delay,
+          max_delay);
+
+      wait_time =
+          gst_util_uint64_scale (delay - max_delay, GST_SECOND,
+          GST_AUDIO_INFO_RATE (&spec->info));
+      GST_DEBUG_OBJECT (m_ringbuffer->sink, "Waiting for %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (wait_time));
+      wait_time += gst_clock_get_time (clock);
+
+      g_mutex_lock (&m_ringbuffer->clock_id_lock);
+      if (!GST_AUDIO_RING_BUFFER_CAST (m_ringbuffer)->acquired) {
+        GST_DEBUG_OBJECT (m_ringbuffer->sink,
+            "Ringbuffer not acquired anymore");
+        g_mutex_unlock (&m_ringbuffer->clock_id_lock);
+        gst_object_unref (clock);
+        return S_OK;
+      }
+      clock_id = gst_clock_new_single_shot_id (clock, wait_time);
+      m_ringbuffer->clock_id = clock_id;
+      g_mutex_unlock (&m_ringbuffer->clock_id_lock);
+      gst_object_unref (clock);
+
+      clock_ret = gst_clock_id_wait (clock_id, NULL);
+
+      g_mutex_lock (&m_ringbuffer->clock_id_lock);
+      gst_clock_id_unref (clock_id);
+      m_ringbuffer->clock_id = NULL;
+      g_mutex_unlock (&m_ringbuffer->clock_id_lock);
+
+      if (clock_ret == GST_CLOCK_UNSCHEDULED) {
+        GST_DEBUG_OBJECT (m_ringbuffer->sink, "Flushing");
+        return S_OK;
+      }
+    }
+
+    if (!gst_audio_ring_buffer_prepare_read (GST_AUDIO_RING_BUFFER_CAST
+            (m_ringbuffer), &seg, &ptr, &len)) {
+      GST_WARNING_OBJECT (m_ringbuffer->sink, "No segment available");
+      return E_FAIL;
+    }
+
+    bpf =
+        GST_AUDIO_INFO_BPF (&GST_AUDIO_RING_BUFFER_CAST (m_ringbuffer)->
+        spec.info);
+    len /= bpf;
+    GST_LOG_OBJECT (m_ringbuffer->sink,
+        "Write audio samples: %p size %d segment: %d", ptr, len, seg);
+
+    written_sum = 0;
+    do {
+      res =
+          m_ringbuffer->output->output->ScheduleAudioSamples (ptr, len,
+          0, 0, &written);
+      len -= written;
+      ptr += written * bpf;
+      written_sum += written;
+    } while (len > 0 && res == S_OK);
+
+    GST_LOG_OBJECT (m_ringbuffer->sink, "Wrote %u samples: 0x%08x", written_sum,
+        res);
+
+    gst_audio_ring_buffer_clear (GST_AUDIO_RING_BUFFER_CAST (m_ringbuffer),
+        seg);
+    gst_audio_ring_buffer_advance (GST_AUDIO_RING_BUFFER_CAST (m_ringbuffer),
+        1);
+
+    return res;
+  }
+
+private:
+  GstDecklinkAudioSinkRingBuffer * m_ringbuffer;
+  GMutex m_mutex;
+  gint m_refcount;
+};
+
+static void
+gst_decklink_audio_sink_ringbuffer_clear_all (GstAudioRingBuffer * rb)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb);
+
+  GST_DEBUG_OBJECT (self->sink, "Flushing");
+
+  if (self->output)
+    self->output->output->FlushBufferedAudioSamples ();
+}
+
+static guint
+gst_decklink_audio_sink_ringbuffer_delay (GstAudioRingBuffer * rb)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb);
+  guint ret = 0;
+
+  if (self->output) {
+    if (self->output->output->GetBufferedAudioSampleFrameCount (&ret) != S_OK)
+      ret = 0;
+  }
+
+  GST_DEBUG_OBJECT (self->sink, "Delay: %u", ret);
+
+  return ret;
+}
+
+#if 0
+static gboolean
+in_same_pipeline (GstElement * a, GstElement * b)
+{
+  GstObject *root = NULL, *tmp;
+  gboolean ret = FALSE;
+
+  tmp = gst_object_get_parent (GST_OBJECT_CAST (a));
+  while (tmp != NULL) {
+    if (root)
+      gst_object_unref (root);
+    root = tmp;
+    tmp = gst_object_get_parent (root);
+  }
+
+  ret = root && gst_object_has_ancestor (GST_OBJECT_CAST (b), root);
+
+  if (root)
+    gst_object_unref (root);
+
+  return ret;
+}
+#endif
+
+static gboolean
+gst_decklink_audio_sink_ringbuffer_start (GstAudioRingBuffer * rb)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb);
+  GstElement *videosink = NULL;
+  gboolean ret = TRUE;
+
+  // Check if there is a video sink for this output too and if it
+  // is actually in the same pipeline
+  g_mutex_lock (&self->output->lock);
+  if (self->output->videosink)
+    videosink = GST_ELEMENT_CAST (gst_object_ref (self->output->videosink));
+  g_mutex_unlock (&self->output->lock);
+
+  if (!videosink) {
+    GST_ELEMENT_ERROR (self->sink, STREAM, FAILED,
+        (NULL), ("Audio sink needs a video sink for its operation"));
+    ret = FALSE;
+  }
+  // FIXME: This causes deadlocks sometimes  
+#if 0
+  else if (!in_same_pipeline (GST_ELEMENT_CAST (self->sink), videosink)) {
+    GST_ELEMENT_ERROR (self->sink, STREAM, FAILED,
+        (NULL), ("Audio sink and video sink need to be in the same pipeline"));
+    ret = FALSE;
+  }
+#endif
+
+  if (videosink)
+    gst_object_unref (videosink);
+  return ret;
+}
+
+static gboolean
+gst_decklink_audio_sink_ringbuffer_pause (GstAudioRingBuffer * rb)
+{
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_sink_ringbuffer_stop (GstAudioRingBuffer * rb)
+{
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_sink_ringbuffer_acquire (GstAudioRingBuffer * rb,
+    GstAudioRingBufferSpec * spec)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb);
+  HRESULT ret;
+  BMDAudioSampleType sample_depth;
+
+  GST_DEBUG_OBJECT (self->sink, "Acquire");
+
+  if (spec->info.finfo->format == GST_AUDIO_FORMAT_S16LE) {
+    sample_depth = bmdAudioSampleType16bitInteger;
+  } else {
+    sample_depth = bmdAudioSampleType32bitInteger;
+  }
+
+  ret = self->output->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
+      sample_depth, 2, bmdAudioOutputStreamContinuous);
+  if (ret != S_OK) {
+    GST_WARNING_OBJECT (self->sink, "Failed to enable audio output 0x%08x",
+        ret);
+    return FALSE;
+  }
+
+  ret =
+      self->output->
+      output->SetAudioCallback (new GStreamerAudioOutputCallback (self));
+  if (ret != S_OK) {
+    GST_WARNING_OBJECT (self->sink,
+        "Failed to set audio output callback 0x%08x", ret);
+    return FALSE;
+  }
+
+  spec->segsize =
+      (spec->latency_time * GST_AUDIO_INFO_RATE (&spec->info) /
+      G_USEC_PER_SEC) * GST_AUDIO_INFO_BPF (&spec->info);
+  spec->segtotal = spec->buffer_time / spec->latency_time;
+  // set latency to one more segment as we need some headroom
+  spec->seglatency = spec->segtotal + 1;
+
+  rb->size = spec->segtotal * spec->segsize;
+  rb->memory = (guint8 *) g_malloc0 (rb->size);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_sink_ringbuffer_release (GstAudioRingBuffer * rb)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb);
+
+  GST_DEBUG_OBJECT (self->sink, "Release");
+
+  if (self->output) {
+    g_mutex_lock (&self->clock_id_lock);
+    if (self->clock_id)
+      gst_clock_id_unschedule (self->clock_id);
+    g_mutex_unlock (&self->clock_id_lock);
+
+    g_mutex_lock (&self->output->lock);
+    self->output->audio_enabled = FALSE;
+    if (self->output->start_scheduled_playback && self->output->videosink)
+      self->output->start_scheduled_playback (self->output->videosink);
+    g_mutex_unlock (&self->output->lock);
+
+    self->output->output->DisableAudioOutput ();
+  }
+  // free the buffer
+  g_free (rb->memory);
+  rb->memory = NULL;
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_sink_ringbuffer_open_device (GstAudioRingBuffer * rb)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb);
+
+  GST_DEBUG_OBJECT (self->sink, "Open device");
+
+  self->output =
+      gst_decklink_acquire_nth_output (self->sink->device_number,
+      GST_ELEMENT_CAST (self), TRUE);
+  if (!self->output) {
+    GST_ERROR_OBJECT (self, "Failed to acquire output");
+    return FALSE;
+  }
+
+  gst_decklink_output_set_audio_clock (self->output,
+      GST_AUDIO_BASE_SINK_CAST (self->sink)->provided_clock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_sink_ringbuffer_close_device (GstAudioRingBuffer * rb)
+{
+  GstDecklinkAudioSinkRingBuffer *self =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (rb);
+
+  GST_DEBUG_OBJECT (self->sink, "Close device");
+
+  if (self->output) {
+    gst_decklink_output_set_audio_clock (self->output, NULL);
+    gst_decklink_release_nth_output (self->sink->device_number,
+        GST_ELEMENT_CAST (self), TRUE);
+    self->output = NULL;
+  }
+
+  return TRUE;
+}
+
+enum
+{
+  PROP_0,
+  PROP_DEVICE_NUMBER
+};
+
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS
+    ("audio/x-raw, format={S16LE,S32LE}, channels=2, rate=48000, "
+        "layout=interleaved")
+    );
+
+static void gst_decklink_audio_sink_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec);
+static void gst_decklink_audio_sink_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec);
+static void gst_decklink_audio_sink_finalize (GObject * object);
+
+static GstStateChangeReturn gst_decklink_audio_sink_change_state (GstElement *
+    element, GstStateChange transition);
+
+static GstAudioRingBuffer
+    * gst_decklink_audio_sink_create_ringbuffer (GstAudioBaseSink * absink);
+
+#define parent_class gst_decklink_audio_sink_parent_class
+G_DEFINE_TYPE (GstDecklinkAudioSink, gst_decklink_audio_sink,
+    GST_TYPE_AUDIO_BASE_SINK);
+
+static void
+gst_decklink_audio_sink_class_init (GstDecklinkAudioSinkClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+  GstAudioBaseSinkClass *audiobasesink_class =
+      GST_AUDIO_BASE_SINK_CLASS (klass);
+
+  gobject_class->set_property = gst_decklink_audio_sink_set_property;
+  gobject_class->get_property = gst_decklink_audio_sink_get_property;
+  gobject_class->finalize = gst_decklink_audio_sink_finalize;
+
+  element_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_change_state);
+
+  audiobasesink_class->create_ringbuffer =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_sink_create_ringbuffer);
+
+  g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER,
+      g_param_spec_int ("device-number", "Device number",
+          "Output device instance to use", 0, G_MAXINT, 0,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_template));
+
+  gst_element_class_set_static_metadata (element_class, "Decklink Audio Sink",
+      "Audio/Sink", "Decklink Sink", "David Schleef <ds@entropywave.com>, "
+      "Sebastian Dröge <sebastian@centricular.com>");
+
+  GST_DEBUG_CATEGORY_INIT (gst_decklink_audio_sink_debug, "decklinkaudiosink",
+      0, "debug category for decklinkaudiosink element");
+}
+
+static void
+gst_decklink_audio_sink_init (GstDecklinkAudioSink * self)
+{
+  self->device_number = 0;
+
+  // 25.000ms latency time seems to be needed at least,
+  // everything below can cause drop-outs
+  // TODO: This is probably related to the video mode that
+  // is selected, but not directly it seems. Choosing the
+  // duration of a frame does not work.
+  GST_AUDIO_BASE_SINK_CAST (self)->latency_time = 25000;
+}
+
+void
+gst_decklink_audio_sink_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkAudioSink *self = GST_DECKLINK_AUDIO_SINK_CAST (object);
+
+  switch (property_id) {
+    case PROP_DEVICE_NUMBER:
+      self->device_number = g_value_get_int (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_audio_sink_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkAudioSink *self = GST_DECKLINK_AUDIO_SINK_CAST (object);
+
+  switch (property_id) {
+    case PROP_DEVICE_NUMBER:
+      g_value_set_int (value, self->device_number);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_audio_sink_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static GstStateChangeReturn
+gst_decklink_audio_sink_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstDecklinkAudioSink *self = GST_DECKLINK_AUDIO_SINK_CAST (element);
+  GstDecklinkAudioSinkRingBuffer *buf =
+      GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (GST_AUDIO_BASE_SINK_CAST
+      (self)->ringbuffer);
+  GstStateChangeReturn ret;
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  if (ret == GST_STATE_CHANGE_FAILURE)
+    return ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      g_mutex_lock (&buf->output->lock);
+      buf->output->audio_enabled = TRUE;
+      if (buf->output->start_scheduled_playback && buf->output->videosink)
+        buf->output->start_scheduled_playback (buf->output->videosink);
+      g_mutex_unlock (&buf->output->lock);
+      break;
+    default:
+      break;
+  }
+
+  return ret;
+}
+
+static GstAudioRingBuffer *
+gst_decklink_audio_sink_create_ringbuffer (GstAudioBaseSink * absink)
+{
+  GstAudioRingBuffer *ret;
+
+  GST_DEBUG_OBJECT (absink, "Creating ringbuffer");
+
+  ret =
+      GST_AUDIO_RING_BUFFER_CAST (g_object_new
+      (GST_TYPE_DECKLINK_AUDIO_SINK_RING_BUFFER, NULL));
+
+  GST_DECKLINK_AUDIO_SINK_RING_BUFFER_CAST (ret)->sink =
+      (GstDecklinkAudioSink *) gst_object_ref (absink);
+
+  return ret;
+}
diff --git a/sys/decklink/gstdecklinkaudiosink.h b/sys/decklink/gstdecklinkaudiosink.h
new file mode 100644
index 0000000..82d20c3
--- /dev/null
+++ b/sys/decklink/gstdecklinkaudiosink.h
@@ -0,0 +1,64 @@
+/* GStreamer
+ *
+ * Copyright (C) 2011 David Schleef <ds@schleef.org>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_DECKLINK_AUDIO_SINK_H__
+#define __GST_DECKLINK_AUDIO_SINK_H__
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+#include "gstdecklink.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DECKLINK_AUDIO_SINK \
+  (gst_decklink_audio_sink_get_type())
+#define GST_DECKLINK_AUDIO_SINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DECKLINK_AUDIO_SINK, GstDecklinkAudioSink))
+#define GST_DECKLINK_AUDIO_SINK_CAST(obj) \
+  ((GstDecklinkAudioSink*)obj)
+#define GST_DECKLINK_AUDIO_SINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DECKLINK_AUDIO_SINK, GstDecklinkAudioSinkClass))
+#define GST_IS_DECKLINK_AUDIO_SINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DECKLINK_AUDIO_SINK))
+#define GST_IS_DECKLINK_AUDIO_SINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DECKLINK_AUDIO_SINK))
+
+typedef struct _GstDecklinkAudioSink GstDecklinkAudioSink;
+typedef struct _GstDecklinkAudioSinkClass GstDecklinkAudioSinkClass;
+
+struct _GstDecklinkAudioSink
+{
+  GstAudioBaseSink parent;
+
+  GstDecklinkModeEnum mode;
+  gint device_number;
+};
+
+struct _GstDecklinkAudioSinkClass
+{
+  GstAudioBaseSinkClass parent_class;
+};
+
+GType gst_decklink_audio_sink_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_DECKLINK_AUDIO_SINK_H__ */
diff --git a/sys/decklink/gstdecklinkaudiosrc.cpp b/sys/decklink/gstdecklinkaudiosrc.cpp
new file mode 100644
index 0000000..70cfa74
--- /dev/null
+++ b/sys/decklink/gstdecklinkaudiosrc.cpp
@@ -0,0 +1,785 @@
+/* GStreamer
+ * Copyright (C) 2011 David Schleef <ds@entropywave.com>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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., 51 Franklin Street, Suite 500,
+ * Boston, MA 02110-1335, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdecklinkaudiosrc.h"
+#include "gstdecklinkvideosrc.h"
+#include <string.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_decklink_audio_src_debug);
+#define GST_CAT_DEFAULT gst_decklink_audio_src_debug
+
+#define DEFAULT_CONNECTION            (GST_DECKLINK_AUDIO_CONNECTION_AUTO)
+#define DEFAULT_BUFFER_SIZE           (5)
+
+#define DEFAULT_ALIGNMENT_THRESHOLD   (40 * GST_MSECOND)
+#define DEFAULT_DISCONT_WAIT          (1 * GST_SECOND)
+
+enum
+{
+  PROP_0,
+  PROP_CONNECTION,
+  PROP_DEVICE_NUMBER,
+  PROP_ALIGNMENT_THRESHOLD,
+  PROP_DISCONT_WAIT,
+  PROP_BUFFER_SIZE
+};
+
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS
+    ("audio/x-raw, format={S16LE,S32LE}, channels=2, rate=48000, "
+        "layout=interleaved")
+    );
+
+typedef struct
+{
+  IDeckLinkAudioInputPacket *packet;
+  GstClockTime capture_time;
+} CapturePacket;
+
+static void
+capture_packet_free (void *data)
+{
+  CapturePacket *packet = (CapturePacket *) data;
+
+  packet->packet->Release ();
+  g_free (packet);
+}
+
+typedef struct
+{
+  IDeckLinkAudioInputPacket *packet;
+  IDeckLinkInput *input;
+} AudioPacket;
+
+static void
+audio_packet_free (void *data)
+{
+  AudioPacket *packet = (AudioPacket *) data;
+
+  packet->packet->Release ();
+  packet->input->Release ();
+  g_free (packet);
+}
+
+static void gst_decklink_audio_src_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec);
+static void gst_decklink_audio_src_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec);
+static void gst_decklink_audio_src_finalize (GObject * object);
+
+static GstStateChangeReturn
+gst_decklink_audio_src_change_state (GstElement * element,
+    GstStateChange transition);
+
+static gboolean gst_decklink_audio_src_set_caps (GstBaseSrc * bsrc,
+    GstCaps * caps);
+static GstCaps *gst_decklink_audio_src_get_caps (GstBaseSrc * bsrc,
+    GstCaps * filter);
+static gboolean gst_decklink_audio_src_unlock (GstBaseSrc * bsrc);
+static gboolean gst_decklink_audio_src_unlock_stop (GstBaseSrc * bsrc);
+static gboolean gst_decklink_audio_src_query (GstBaseSrc * bsrc,
+    GstQuery * query);
+
+static GstFlowReturn gst_decklink_audio_src_create (GstPushSrc * psrc,
+    GstBuffer ** buffer);
+
+static gboolean gst_decklink_audio_src_open (GstDecklinkAudioSrc * self);
+static gboolean gst_decklink_audio_src_close (GstDecklinkAudioSrc * self);
+
+#define parent_class gst_decklink_audio_src_parent_class
+G_DEFINE_TYPE (GstDecklinkAudioSrc, gst_decklink_audio_src, GST_TYPE_PUSH_SRC);
+
+static void
+gst_decklink_audio_src_class_init (GstDecklinkAudioSrcClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+  GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass);
+  GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
+
+  gobject_class->set_property = gst_decklink_audio_src_set_property;
+  gobject_class->get_property = gst_decklink_audio_src_get_property;
+  gobject_class->finalize = gst_decklink_audio_src_finalize;
+
+  element_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_src_change_state);
+
+  basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_decklink_audio_src_get_caps);
+  basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_decklink_audio_src_set_caps);
+  basesrc_class->query = GST_DEBUG_FUNCPTR (gst_decklink_audio_src_query);
+  basesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_decklink_audio_src_unlock);
+  basesrc_class->unlock_stop =
+      GST_DEBUG_FUNCPTR (gst_decklink_audio_src_unlock_stop);
+
+  pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_decklink_audio_src_create);
+
+  g_object_class_install_property (gobject_class, PROP_CONNECTION,
+      g_param_spec_enum ("connection", "Connection",
+          "Audio input connection to use",
+          GST_TYPE_DECKLINK_AUDIO_CONNECTION, DEFAULT_CONNECTION,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER,
+      g_param_spec_int ("device-number", "Device number",
+          "Output device instance to use", 0, G_MAXINT, 0,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  g_object_class_install_property (gobject_class, PROP_ALIGNMENT_THRESHOLD,
+      g_param_spec_uint64 ("alignment-threshold", "Alignment Threshold",
+          "Timestamp alignment threshold in nanoseconds", 0,
+          G_MAXUINT64 - 1, DEFAULT_ALIGNMENT_THRESHOLD,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_DISCONT_WAIT,
+      g_param_spec_uint64 ("discont-wait", "Discont Wait",
+          "Window of time in nanoseconds to wait before "
+          "creating a discontinuity", 0,
+          G_MAXUINT64 - 1, DEFAULT_DISCONT_WAIT,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  g_object_class_install_property (gobject_class, PROP_BUFFER_SIZE,
+      g_param_spec_uint ("buffer-size", "Buffer Size",
+          "Size of internal buffer in number of video frames", 1,
+          G_MAXINT, DEFAULT_BUFFER_SIZE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_template));
+
+  gst_element_class_set_static_metadata (element_class, "Decklink Audio Source",
+      "Audio/Src", "Decklink Source", "David Schleef <ds@entropywave.com>, "
+      "Sebastian Dröge <sebastian@centricular.com>");
+
+  GST_DEBUG_CATEGORY_INIT (gst_decklink_audio_src_debug, "decklinkaudiosrc",
+      0, "debug category for decklinkaudiosrc element");
+}
+
+static void
+gst_decklink_audio_src_init (GstDecklinkAudioSrc * self)
+{
+  self->device_number = 0;
+  self->alignment_threshold = DEFAULT_ALIGNMENT_THRESHOLD;
+  self->discont_wait = DEFAULT_DISCONT_WAIT;
+  self->buffer_size = DEFAULT_BUFFER_SIZE;
+
+  gst_base_src_set_live (GST_BASE_SRC (self), TRUE);
+  gst_base_src_set_format (GST_BASE_SRC (self), GST_FORMAT_TIME);
+
+  g_mutex_init (&self->lock);
+  g_cond_init (&self->cond);
+
+  g_queue_init (&self->current_packets);
+}
+
+void
+gst_decklink_audio_src_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (object);
+
+  switch (property_id) {
+    case PROP_CONNECTION:
+      self->connection =
+          (GstDecklinkAudioConnectionEnum) g_value_get_enum (value);
+      break;
+    case PROP_DEVICE_NUMBER:
+      self->device_number = g_value_get_int (value);
+      break;
+    case PROP_ALIGNMENT_THRESHOLD:
+      self->alignment_threshold = g_value_get_uint64 (value);
+      break;
+    case PROP_DISCONT_WAIT:
+      self->discont_wait = g_value_get_uint64 (value);
+      break;
+    case PROP_BUFFER_SIZE:
+      self->buffer_size = g_value_get_uint (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_audio_src_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (object);
+
+  switch (property_id) {
+    case PROP_CONNECTION:
+      g_value_set_enum (value, self->connection);
+      break;
+    case PROP_DEVICE_NUMBER:
+      g_value_set_int (value, self->device_number);
+      break;
+    case PROP_ALIGNMENT_THRESHOLD:
+      g_value_set_uint64 (value, self->alignment_threshold);
+      break;
+    case PROP_DISCONT_WAIT:
+      g_value_set_uint64 (value, self->discont_wait);
+      break;
+    case PROP_BUFFER_SIZE:
+      g_value_set_uint (value, self->buffer_size);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_audio_src_finalize (GObject * object)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (object);
+
+  g_mutex_clear (&self->lock);
+  g_cond_clear (&self->cond);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+gst_decklink_audio_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (bsrc);
+  BMDAudioSampleType sample_depth;
+  GstCaps *current_caps;
+  HRESULT ret;
+  BMDAudioConnection conn = (BMDAudioConnection) - 1;
+
+  GST_DEBUG_OBJECT (self, "Setting caps %" GST_PTR_FORMAT, caps);
+
+  if ((current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (bsrc)))) {
+    GST_DEBUG_OBJECT (self, "Pad already has caps %" GST_PTR_FORMAT, caps);
+
+    if (!gst_caps_is_equal (caps, current_caps)) {
+      GST_ERROR_OBJECT (self, "New caps are not equal to old caps");
+      gst_caps_unref (current_caps);
+      return FALSE;
+    } else {
+      gst_caps_unref (current_caps);
+      return TRUE;
+    }
+  }
+
+  if (!gst_audio_info_from_caps (&self->info, caps))
+    return FALSE;
+
+  if (self->info.finfo->format == GST_AUDIO_FORMAT_S16LE) {
+    sample_depth = bmdAudioSampleType16bitInteger;
+  } else {
+    sample_depth = bmdAudioSampleType32bitInteger;
+  }
+
+  switch (self->connection) {
+    case GST_DECKLINK_AUDIO_CONNECTION_AUTO:{
+      GstElement *videosrc = NULL;
+      GstDecklinkConnectionEnum vconn;
+
+      // Try to get the connection from the videosrc and try
+      // to select a sensible audio connection based on that
+      g_mutex_lock (&self->input->lock);
+      if (self->input->videosrc)
+        videosrc = GST_ELEMENT_CAST (gst_object_ref (self->input->videosrc));
+      g_mutex_unlock (&self->input->lock);
+
+      if (videosrc) {
+        g_object_get (videosrc, "connection", &vconn, NULL);
+        gst_object_unref (videosrc);
+
+        switch (vconn) {
+          case GST_DECKLINK_CONNECTION_SDI:
+            conn = bmdAudioConnectionEmbedded;
+            break;
+          case GST_DECKLINK_CONNECTION_HDMI:
+            conn = bmdAudioConnectionEmbedded;
+            break;
+          case GST_DECKLINK_CONNECTION_OPTICAL_SDI:
+            conn = bmdAudioConnectionEmbedded;
+            break;
+          case GST_DECKLINK_CONNECTION_COMPONENT:
+            conn = bmdAudioConnectionAnalog;
+            break;
+          case GST_DECKLINK_CONNECTION_COMPOSITE:
+            conn = bmdAudioConnectionAnalog;
+            break;
+          case GST_DECKLINK_CONNECTION_SVIDEO:
+            conn = bmdAudioConnectionAnalog;
+            break;
+          default:
+            // Use default
+            break;
+        }
+      }
+
+      break;
+    }
+    case GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED:
+      conn = bmdAudioConnectionEmbedded;
+      break;
+    case GST_DECKLINK_AUDIO_CONNECTION_AES_EBU:
+      conn = bmdAudioConnectionAESEBU;
+      break;
+    case GST_DECKLINK_AUDIO_CONNECTION_ANALOG:
+      conn = bmdAudioConnectionAnalog;
+      break;
+    case GST_DECKLINK_AUDIO_CONNECTION_ANALOG_XLR:
+      conn = bmdAudioConnectionAnalogXLR;
+      break;
+    case GST_DECKLINK_AUDIO_CONNECTION_ANALOG_RCA:
+      conn = bmdAudioConnectionAnalogRCA;
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+
+  if (conn != (BMDAudioConnection) - 1) {
+    ret =
+        self->input->config->SetInt (bmdDeckLinkConfigAudioInputConnection,
+        conn);
+    if (ret != S_OK) {
+      GST_ERROR ("set configuration (audio input connection)");
+      return FALSE;
+    }
+  }
+
+  ret = self->input->input->EnableAudioInput (bmdAudioSampleRate48kHz,
+      sample_depth, 2);
+  if (ret != S_OK) {
+    GST_WARNING_OBJECT (self, "Failed to enable audio input");
+    return FALSE;
+  }
+
+  g_mutex_lock (&self->input->lock);
+  self->input->audio_enabled = TRUE;
+  if (self->input->start_streams && self->input->videosrc)
+    self->input->start_streams (self->input->videosrc);
+  g_mutex_unlock (&self->input->lock);
+
+  return TRUE;
+}
+
+static GstCaps *
+gst_decklink_audio_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
+{
+  GstCaps *caps;
+
+  // We don't support renegotiation
+  caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (bsrc));
+
+  if (!caps)
+    caps = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
+
+  if (filter) {
+    GstCaps *tmp =
+        gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (caps);
+    caps = tmp;
+  }
+
+  return caps;
+}
+
+static void
+gst_decklink_audio_src_got_packet (GstElement * element,
+    IDeckLinkAudioInputPacket * packet, GstClockTime capture_time)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (element);
+  GstDecklinkVideoSrc *videosrc = NULL;
+
+  GST_LOG_OBJECT (self, "Got audio packet at %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (capture_time));
+
+  g_mutex_lock (&self->input->lock);
+  if (self->input->videosrc)
+    videosrc =
+        GST_DECKLINK_VIDEO_SRC_CAST (gst_object_ref (self->input->videosrc));
+  g_mutex_unlock (&self->input->lock);
+
+  if (videosrc) {
+    gst_decklink_video_src_convert_to_external_clock (videosrc, &capture_time,
+        NULL);
+    gst_object_unref (videosrc);
+    GST_LOG_OBJECT (self, "Actual timestamp %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (capture_time));
+  }
+
+  g_mutex_lock (&self->lock);
+  if (!self->flushing) {
+    CapturePacket *p;
+
+    while (g_queue_get_length (&self->current_packets) >= self->buffer_size) {
+      p = (CapturePacket *) g_queue_pop_head (&self->current_packets);
+      GST_WARNING_OBJECT (self, "Dropping old packet at %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (p->capture_time));
+      capture_packet_free (p);
+    }
+
+    p = (CapturePacket *) g_malloc0 (sizeof (CapturePacket));
+    p->packet = packet;
+    p->capture_time = capture_time;
+    packet->AddRef ();
+    g_queue_push_tail (&self->current_packets, p);
+    g_cond_signal (&self->cond);
+  }
+  g_mutex_unlock (&self->lock);
+}
+
+static GstFlowReturn
+gst_decklink_audio_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (bsrc);
+  GstFlowReturn flow_ret = GST_FLOW_OK;
+  const guint8 *data;
+  glong sample_count;
+  gsize data_size;
+  CapturePacket *p;
+  AudioPacket *ap;
+  GstClockTime timestamp, duration;
+  GstClockTime start_time, end_time;
+  guint64 start_offset, end_offset;
+  gboolean discont = FALSE;
+
+  g_mutex_lock (&self->lock);
+  while (g_queue_is_empty (&self->current_packets) && !self->flushing) {
+    g_cond_wait (&self->cond, &self->lock);
+  }
+
+  p = (CapturePacket *) g_queue_pop_head (&self->current_packets);
+  g_mutex_unlock (&self->lock);
+
+  if (self->flushing) {
+    if (p)
+      capture_packet_free (p);
+    GST_DEBUG_OBJECT (self, "Flushing");
+    return GST_FLOW_FLUSHING;
+  }
+
+  p->packet->GetBytes ((gpointer *) & data);
+  sample_count = p->packet->GetSampleFrameCount ();
+  data_size = self->info.bpf * sample_count;
+
+  ap = (AudioPacket *) g_malloc0 (sizeof (AudioPacket));
+
+  *buffer =
+      gst_buffer_new_wrapped_full ((GstMemoryFlags) GST_MEMORY_FLAG_READONLY,
+      (gpointer) data, data_size, 0, data_size, ap,
+      (GDestroyNotify) audio_packet_free);
+
+  ap->packet = p->packet;
+  p->packet->AddRef ();
+  ap->input = self->input->input;
+  ap->input->AddRef ();
+
+  timestamp = p->capture_time;
+
+  // Jitter and discontinuity handling, based on audiobasesrc
+  start_time = timestamp;
+
+  // Convert to the sample numbers
+  start_offset =
+      gst_util_uint64_scale (start_time, self->info.rate, GST_SECOND);
+
+  end_offset = start_offset + sample_count;
+  end_time = gst_util_uint64_scale_int (end_offset, GST_SECOND,
+      self->info.rate);
+
+  duration = end_time - start_time;
+
+  if (self->next_offset == (guint64) - 1) {
+    discont = TRUE;
+  } else {
+    guint64 diff, max_sample_diff;
+
+    // Check discont
+    if (start_offset <= self->next_offset)
+      diff = self->next_offset - start_offset;
+    else
+      diff = start_offset - self->next_offset;
+
+    max_sample_diff =
+        gst_util_uint64_scale_int (self->alignment_threshold, self->info.rate,
+        GST_SECOND);
+
+    // Discont!
+    if (G_UNLIKELY (diff >= max_sample_diff)) {
+      if (self->discont_wait > 0) {
+        if (self->discont_time == GST_CLOCK_TIME_NONE) {
+          self->discont_time = start_time;
+        } else if (start_time - self->discont_time >= self->discont_wait) {
+          discont = TRUE;
+          self->discont_time = GST_CLOCK_TIME_NONE;
+        }
+      } else {
+        discont = TRUE;
+      }
+    } else if (G_UNLIKELY (self->discont_time != GST_CLOCK_TIME_NONE)) {
+      // we have had a discont, but are now back on track!
+      self->discont_time = GST_CLOCK_TIME_NONE;
+    }
+  }
+
+  if (discont) {
+    // Have discont, need resync and use the capture timestamps
+    if (self->next_offset != (guint64) - 1)
+      GST_INFO_OBJECT (self, "Have discont. Expected %"
+          G_GUINT64_FORMAT ", got %" G_GUINT64_FORMAT,
+          self->next_offset, start_offset);
+    GST_BUFFER_FLAG_SET (*buffer, GST_BUFFER_FLAG_DISCONT);
+    self->next_offset = end_offset;
+  } else {
+    // No discont, just keep counting
+    self->discont_time = GST_CLOCK_TIME_NONE;
+    timestamp =
+        gst_util_uint64_scale (self->next_offset, GST_SECOND, self->info.rate);
+    self->next_offset += sample_count;
+    duration =
+        gst_util_uint64_scale (self->next_offset, GST_SECOND,
+        self->info.rate) - timestamp;
+  }
+
+  GST_BUFFER_TIMESTAMP (*buffer) = timestamp;
+  GST_BUFFER_DURATION (*buffer) = duration;
+
+  GST_DEBUG_OBJECT (self,
+      "Outputting buffer %p with timestamp %" GST_TIME_FORMAT " and duration %"
+      GST_TIME_FORMAT, *buffer, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*buffer)),
+      GST_TIME_ARGS (GST_BUFFER_DURATION (*buffer)));
+
+  capture_packet_free (p);
+
+  return flow_ret;
+}
+
+static gboolean
+gst_decklink_audio_src_query (GstBaseSrc * bsrc, GstQuery * query)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (bsrc);
+  gboolean ret = TRUE;
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_LATENCY:{
+      if (self->input) {
+        g_mutex_lock (&self->input->lock);
+        if (self->input->mode) {
+          GstClockTime min, max;
+
+          min =
+              gst_util_uint64_scale_ceil (GST_SECOND, self->input->mode->fps_d,
+              self->input->mode->fps_n);
+          max = self->buffer_size * min;
+
+          gst_query_set_latency (query, TRUE, min, max);
+          ret = TRUE;
+        } else {
+          ret = FALSE;
+        }
+        g_mutex_unlock (&self->input->lock);
+      } else {
+        ret = FALSE;
+      }
+
+      break;
+    }
+    default:
+      ret = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
+      break;
+  }
+
+  return ret;
+}
+
+static gboolean
+gst_decklink_audio_src_unlock (GstBaseSrc * bsrc)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (bsrc);
+
+  g_mutex_lock (&self->lock);
+  self->flushing = TRUE;
+  g_cond_signal (&self->cond);
+  g_mutex_unlock (&self->lock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_src_unlock_stop (GstBaseSrc * bsrc)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (bsrc);
+
+  g_mutex_lock (&self->lock);
+  self->flushing = FALSE;
+  g_queue_foreach (&self->current_packets, (GFunc) capture_packet_free, NULL);
+  g_queue_clear (&self->current_packets);
+  g_mutex_unlock (&self->lock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_src_open (GstDecklinkAudioSrc * self)
+{
+  GST_DEBUG_OBJECT (self, "Starting");
+
+  self->input =
+      gst_decklink_acquire_nth_input (self->device_number,
+      GST_ELEMENT_CAST (self), TRUE);
+  if (!self->input) {
+    GST_ERROR_OBJECT (self, "Failed to acquire input");
+    return FALSE;
+  }
+
+  g_mutex_lock (&self->input->lock);
+  self->input->got_audio_packet = gst_decklink_audio_src_got_packet;
+  g_mutex_unlock (&self->input->lock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_audio_src_close (GstDecklinkAudioSrc * self)
+{
+
+  GST_DEBUG_OBJECT (self, "Stopping");
+
+  if (self->input) {
+    g_mutex_lock (&self->input->lock);
+    self->input->got_audio_packet = NULL;
+    self->input->audio_enabled = FALSE;
+    if (self->input->start_streams && self->input->videosrc)
+      self->input->start_streams (self->input->videosrc);
+    g_mutex_unlock (&self->input->lock);
+
+    self->input->input->DisableAudioInput ();
+    gst_decklink_release_nth_input (self->device_number,
+        GST_ELEMENT_CAST (self), TRUE);
+    self->input = NULL;
+  }
+
+  return TRUE;
+}
+
+#if 0
+static gboolean
+in_same_pipeline (GstElement * a, GstElement * b)
+{
+  GstObject *root = NULL, *tmp;
+  gboolean ret = FALSE;
+
+  tmp = gst_object_get_parent (GST_OBJECT_CAST (a));
+  while (tmp != NULL) {
+    if (root)
+      gst_object_unref (root);
+    root = tmp;
+    tmp = gst_object_get_parent (root);
+  }
+
+  ret = root && gst_object_has_ancestor (GST_OBJECT_CAST (b), root);
+
+  if (root)
+    gst_object_unref (root);
+
+  return ret;
+}
+#endif
+
+static GstStateChangeReturn
+gst_decklink_audio_src_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstDecklinkAudioSrc *self = GST_DECKLINK_AUDIO_SRC_CAST (element);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!gst_decklink_audio_src_open (self)) {
+        ret = GST_STATE_CHANGE_FAILURE;
+        goto out;
+      }
+      break;
+    case GST_STATE_CHANGE_READY_TO_PAUSED:{
+      GstElement *videosrc = NULL;
+
+      // Check if there is a video src for this input too and if it
+      // is actually in the same pipeline
+      g_mutex_lock (&self->input->lock);
+      if (self->input->videosrc)
+        videosrc = GST_ELEMENT_CAST (gst_object_ref (self->input->videosrc));
+      g_mutex_unlock (&self->input->lock);
+
+      if (!videosrc) {
+        GST_ELEMENT_ERROR (self, STREAM, FAILED,
+            (NULL), ("Audio src needs a video src for its operation"));
+        ret = GST_STATE_CHANGE_FAILURE;
+        goto out;
+      }
+      // FIXME: This causes deadlocks sometimes
+#if 0
+      else if (!in_same_pipeline (GST_ELEMENT_CAST (self), videosrc)) {
+        GST_ELEMENT_ERROR (self, STREAM, FAILED,
+            (NULL),
+            ("Audio src and video src need to be in the same pipeline"));
+        ret = GST_STATE_CHANGE_FAILURE;
+        gst_object_unref (videosrc);
+        goto out;
+      }
+#endif
+
+      if (videosrc)
+        gst_object_unref (videosrc);
+
+      self->flushing = FALSE;
+      self->next_offset = -1;
+      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_PAUSED_TO_READY:
+      g_queue_foreach (&self->current_packets, (GFunc) capture_packet_free,
+          NULL);
+      g_queue_clear (&self->current_packets);
+      break;
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      gst_decklink_audio_src_close (self);
+      break;
+    default:
+      break;
+  }
+out:
+
+  return ret;
+}
diff --git a/sys/decklink/gstdecklinkaudiosrc.h b/sys/decklink/gstdecklinkaudiosrc.h
new file mode 100644
index 0000000..9d0af77
--- /dev/null
+++ b/sys/decklink/gstdecklinkaudiosrc.h
@@ -0,0 +1,87 @@
+/* GStreamer
+ *
+ * Copyright (C) 2011 David Schleef <ds@schleef.org>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_DECKLINK_AUDIO_SRC_H__
+#define __GST_DECKLINK_AUDIO_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/base/base.h>
+#include <gst/audio/audio.h>
+#include "gstdecklink.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DECKLINK_AUDIO_SRC \
+  (gst_decklink_audio_src_get_type())
+#define GST_DECKLINK_AUDIO_SRC(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DECKLINK_AUDIO_SRC, GstDecklinkAudioSrc))
+#define GST_DECKLINK_AUDIO_SRC_CAST(obj) \
+  ((GstDecklinkAudioSrc*)obj)
+#define GST_DECKLINK_AUDIO_SRC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DECKLINK_AUDIO_SRC, GstDecklinkAudioSrcClass))
+#define GST_IS_DECKLINK_AUDIO_SRC(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DECKLINK_AUDIO_SRC))
+#define GST_IS_DECKLINK_AUDIO_SRC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DECKLINK_AUDIO_SRC))
+
+typedef struct _GstDecklinkAudioSrc GstDecklinkAudioSrc;
+typedef struct _GstDecklinkAudioSrcClass GstDecklinkAudioSrcClass;
+
+struct _GstDecklinkAudioSrc
+{
+  GstPushSrc parent;
+
+  GstDecklinkModeEnum mode;
+  GstDecklinkAudioConnectionEnum connection;
+  gint device_number;
+
+  GstAudioInfo info;
+
+  GstDecklinkInput *input;
+
+  GCond cond;
+  GMutex lock;
+  gboolean flushing;
+  GQueue current_packets;
+
+  /* properties for handling jittery timestamps */
+  GstClockTime alignment_threshold;
+  GstClockTime discont_wait;
+
+  /* counter to keep track of timestamps */
+  guint64 next_offset;
+
+  /* Last time we noticed a discont */
+  GstClockTime discont_time;
+
+  guint buffer_size;
+};
+
+struct _GstDecklinkAudioSrcClass
+{
+  GstPushSrcClass parent_class;
+};
+
+GType gst_decklink_audio_src_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_DECKLINK_AUDIO_SRC_H__ */
diff --git a/sys/decklink/gstdecklinksink.cpp b/sys/decklink/gstdecklinksink.cpp
deleted file mode 100644
index df77d02..0000000
--- a/sys/decklink/gstdecklinksink.cpp
+++ /dev/null
@@ -1,755 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 David Schleef <ds@entropywave.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., 51 Franklin Street, Suite 500,
- * Boston, MA 02110-1335, USA.
- */
-/**
- * SECTION:element-gstdecklinksink
- *
- * The decklinksink element is a sink element for BlackMagic DeckLink
- * cards.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch-1.0 -v videotestsrc ! decklinksink
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include "gstdecklink.h"
-#include "gstdecklinksink.h"
-#include <string.h>
-
-/* FIXME:
- *  - handle ALLOCATION query
- *  - provide buffer pool with suitable strides/alignment for video
- *  - handle video meta
- */
-
-GST_DEBUG_CATEGORY_STATIC (gst_decklink_sink_debug_category);
-#define GST_CAT_DEFAULT gst_decklink_sink_debug_category
-
-static void gst_decklink_sink_set_property (GObject * object,
-    guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_decklink_sink_get_property (GObject * object,
-    guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_decklink_sink_finalize (GObject * object);
-
-static GstStateChangeReturn
-gst_decklink_sink_change_state (GstElement * element,
-    GstStateChange transition);
-
-static GstFlowReturn gst_decklink_sink_videosink_chain (GstPad * pad,
-    GstObject * parent, GstBuffer * buffer);
-static gboolean gst_decklink_sink_videosink_event (GstPad * pad,
-    GstObject * parent, GstEvent * event);
-static gboolean gst_decklink_sink_videosink_query (GstPad * pad,
-    GstObject * parent, GstQuery * query);
-
-static GstFlowReturn gst_decklink_sink_audiosink_chain (GstPad * pad,
-    GstObject * parent, GstBuffer * buffer);
-static gboolean gst_decklink_sink_audiosink_event (GstPad * pad,
-    GstObject * parent, GstEvent * event);
-static gboolean gst_decklink_sink_audiosink_query (GstPad * pad,
-    GstObject * parent, GstQuery * query);
-
-#ifdef _MSC_VER
-/* COM initialization/uninitialization thread */
-static void gst_decklink_sink_com_thread (GstDecklinkSink * sink);
-#endif /* _MSC_VER */
-
-enum
-{
-  PROP_0,
-  PROP_MODE,
-  PROP_DEVICE_NUMBER
-};
-
-/* pad templates */
-
-/* the video sink pad template is created on the fly */
-
-static GstStaticPadTemplate gst_decklink_sink_audiosink_template =
-GST_STATIC_PAD_TEMPLATE ("audiosink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw, format=S16LE, channels=2, rate=48000, "
-        "layout=interleaved")
-    );
-
-#define parent_class gst_decklink_sink_parent_class
-G_DEFINE_TYPE (GstDecklinkSink, gst_decklink_sink, GST_TYPE_ELEMENT);
-
-static void
-gst_decklink_sink_class_init (GstDecklinkSinkClass * klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gobject_class->set_property = gst_decklink_sink_set_property;
-  gobject_class->get_property = gst_decklink_sink_get_property;
-  gobject_class->finalize = gst_decklink_sink_finalize;
-
-  element_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_decklink_sink_change_state);
-
-  g_object_class_install_property (gobject_class, PROP_MODE,
-      g_param_spec_enum ("mode", "Playback Mode",
-          "Video Mode to use for playback",
-          GST_TYPE_DECKLINK_MODE, GST_DECKLINK_MODE_NTSC,
-          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-              G_PARAM_CONSTRUCT)));
-
-  g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER,
-      g_param_spec_int ("device-number", "Device number",
-          "Output device instance to use", 0, G_MAXINT, 0,
-          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-              G_PARAM_CONSTRUCT)));
-
-  gst_element_class_add_pad_template (element_class,
-      gst_pad_template_new ("videosink", GST_PAD_SINK, GST_PAD_ALWAYS,
-          gst_decklink_mode_get_template_caps ()));
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_decklink_sink_audiosink_template));
-
-  gst_element_class_set_static_metadata (element_class, "Decklink Sink",
-      "Video/Sink", "Decklink Sink", "David Schleef <ds@entropywave.com>");
-
-  GST_DEBUG_CATEGORY_INIT (gst_decklink_sink_debug_category, "decklinksink", 0,
-      "debug category for decklinksink element");
-}
-
-static void
-gst_decklink_sink_init (GstDecklinkSink * decklinksink)
-{
-  GstDecklinkSinkClass *decklinksink_class;
-
-  decklinksink_class = GST_DECKLINK_SINK_GET_CLASS (decklinksink);
-
-  decklinksink->videosinkpad =
-      gst_pad_new_from_template (gst_element_class_get_pad_template
-      (GST_ELEMENT_CLASS (decklinksink_class), "videosink"), "videosink");
-  gst_pad_set_chain_function (decklinksink->videosinkpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_chain));
-  gst_pad_set_event_function (decklinksink->videosinkpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_event));
-  gst_pad_set_query_function (decklinksink->videosinkpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_query));
-  gst_element_add_pad (GST_ELEMENT (decklinksink), decklinksink->videosinkpad);
-
-  decklinksink->audiosinkpad =
-      gst_pad_new_from_static_template (&gst_decklink_sink_audiosink_template,
-      "audiosink");
-  gst_pad_set_chain_function (decklinksink->audiosinkpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_chain));
-  gst_pad_set_event_function (decklinksink->audiosinkpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_event));
-  gst_pad_set_query_function (decklinksink->audiosinkpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_query));
-  gst_element_add_pad (GST_ELEMENT (decklinksink), decklinksink->audiosinkpad);
-
-  GST_OBJECT_FLAG_SET (decklinksink, GST_ELEMENT_FLAG_SINK);
-
-  g_cond_init (&decklinksink->cond);
-  g_mutex_init (&decklinksink->mutex);
-  g_mutex_init (&decklinksink->audio_mutex);
-  g_cond_init (&decklinksink->audio_cond);
-
-  decklinksink->mode = GST_DECKLINK_MODE_NTSC;
-  decklinksink->device_number = 0;
-
-  decklinksink->callback = new Output;
-  decklinksink->callback->decklinksink = decklinksink;
-
-#ifdef _MSC_VER
-  g_mutex_init (&decklinksink->com_init_lock);
-  g_mutex_init (&decklinksink->com_deinit_lock);
-  g_cond_init (&decklinksink->com_initialized);
-  g_cond_init (&decklinksink->com_uninitialize);
-  g_cond_init (&decklinksink->com_uninitialized);
-
-  g_mutex_lock (&decklinksink->com_init_lock);
-
-  /* create the COM initialization thread */
-  g_thread_create ((GThreadFunc) gst_decklink_sink_com_thread,
-      decklinksink, FALSE, NULL);
-
-  /* wait until the COM thread signals that COM has been initialized */
-  g_cond_wait (&decklinksink->com_initialized, &decklinksink->com_init_lock);
-  g_mutex_unlock (&decklinksink->com_init_lock);
-#endif /* _MSC_VER */
-}
-
-void
-gst_decklink_sink_set_property (GObject * object, guint property_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstDecklinkSink *decklinksink;
-
-  g_return_if_fail (GST_IS_DECKLINK_SINK (object));
-  decklinksink = GST_DECKLINK_SINK (object);
-
-  switch (property_id) {
-    case PROP_MODE:
-      decklinksink->mode = (GstDecklinkModeEnum) g_value_get_enum (value);
-      break;
-    case PROP_DEVICE_NUMBER:
-      decklinksink->device_number = g_value_get_int (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
-}
-
-void
-gst_decklink_sink_get_property (GObject * object, guint property_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstDecklinkSink *decklinksink;
-
-  g_return_if_fail (GST_IS_DECKLINK_SINK (object));
-  decklinksink = GST_DECKLINK_SINK (object);
-
-  switch (property_id) {
-    case PROP_MODE:
-      g_value_set_enum (value, decklinksink->mode);
-      break;
-    case PROP_DEVICE_NUMBER:
-      g_value_set_int (value, decklinksink->device_number);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
-}
-
-#ifdef _MSC_VER
-static void
-gst_decklink_sink_com_thread (GstDecklinkSink * sink)
-{
-  HRESULT res;
-
-  g_mutex_lock (sink->com_init_lock);
-
-  /* Initialize COM with a MTA for this process. This thread will
-   * be the first one to enter the apartement and the last one to leave
-   * it, unitializing COM properly */
-
-  res = CoInitializeEx (0, COINIT_MULTITHREADED);
-  if (res == S_FALSE)
-    GST_WARNING_OBJECT (sink,
-        "COM has been already initialized in the same process");
-  else if (res == RPC_E_CHANGED_MODE)
-    GST_WARNING_OBJECT (sink, "The concurrency model of COM has changed.");
-  else
-    GST_INFO_OBJECT (sink, "COM intialized succesfully");
-
-  sink->comInitialized = TRUE;
-
-  /* Signal other threads waiting on this condition that COM was initialized */
-  g_cond_signal (sink->com_initialized);
-
-  g_mutex_unlock (sink->com_init_lock);
-
-  /* Wait until the unitialize condition is met to leave the COM apartement */
-  g_mutex_lock (sink->com_deinit_lock);
-  g_cond_wait (sink->com_uninitialize, sink->com_deinit_lock);
-
-  CoUninitialize ();
-  GST_INFO_OBJECT (sink, "COM unintialized succesfully");
-  sink->comInitialized = FALSE;
-  g_cond_signal (sink->com_uninitialized);
-  g_mutex_unlock (sink->com_deinit_lock);
-}
-#endif /* _MSC_VER */
-
-void
-gst_decklink_sink_finalize (GObject * object)
-{
-  GstDecklinkSink *decklinksink;
-
-  decklinksink = GST_DECKLINK_SINK (object);
-
-  g_cond_clear (&decklinksink->cond);
-  g_mutex_clear (&decklinksink->mutex);
-  g_cond_clear (&decklinksink->audio_cond);
-  g_mutex_clear (&decklinksink->audio_mutex);
-
-  delete decklinksink->callback;
-
-#ifdef _MSC_VER
-  /* signal the COM thread that it should uninitialize COM */
-  if (decklinksink->comInitialized) {
-    g_mutex_lock (&decklinksink->com_deinit_lock);
-    g_cond_signal (&decklinksink->com_uninitialize);
-    g_cond_wait (&decklinksink->com_uninitialized,
-        &decklinksink->com_deinit_lock);
-    g_mutex_unlock (&decklinksink->com_deinit_lock);
-  }
-
-  g_mutex_clear (&decklinksink->com_init_lock);
-  g_mutex_clear (&decklinksink->com_deinit_lock);
-  g_cond_clear (&decklinksink->com_initialized);
-  g_cond_clear (&decklinksink->com_uninitialize);
-  g_cond_clear (&decklinksink->com_uninitialized);
-#endif /* _MSC_VER */
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* FIXME: post error messages for the misc. failures */
-static gboolean
-gst_decklink_sink_start (GstDecklinkSink * decklinksink)
-{
-  HRESULT ret;
-  const GstDecklinkMode *mode;
-  BMDAudioSampleType sample_depth;
-
-  decklinksink->decklink =
-      gst_decklink_get_nth_device (decklinksink->device_number);
-  if (!decklinksink->decklink) {
-    GST_WARNING ("failed to get device %d", decklinksink->device_number);
-    return FALSE;
-  }
-
-  decklinksink->output =
-      gst_decklink_get_nth_output (decklinksink->device_number);
-  if (!decklinksink->output) {
-    GST_WARNING ("no output for device %d", decklinksink->device_number);
-    return FALSE;
-  }
-
-  decklinksink->output->SetAudioCallback (decklinksink->callback);
-
-  mode = gst_decklink_get_mode (decklinksink->mode);
-
-  ret = decklinksink->output->EnableVideoOutput (mode->mode,
-      bmdVideoOutputFlagDefault);
-  if (ret != S_OK) {
-    GST_WARNING ("failed to enable video output");
-    return FALSE;
-  }
-  //decklinksink->video_enabled = TRUE;
-
-  decklinksink->output->SetScheduledFrameCompletionCallback (decklinksink->
-      callback);
-
-  sample_depth = bmdAudioSampleType16bitInteger;
-  ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
-      sample_depth, 2, bmdAudioOutputStreamContinuous);
-  if (ret != S_OK) {
-    GST_WARNING ("failed to enable audio output");
-    return FALSE;
-  }
-  decklinksink->audio_adapter = gst_adapter_new ();
-
-  decklinksink->num_frames = 0;
-
-  return TRUE;
-}
-
-static gboolean
-gst_decklink_sink_force_stop (GstDecklinkSink * decklinksink)
-{
-  g_mutex_lock (&decklinksink->mutex);
-  decklinksink->stop = TRUE;
-  g_cond_signal (&decklinksink->cond);
-  g_mutex_unlock (&decklinksink->mutex);
-
-  g_mutex_lock (&decklinksink->audio_mutex);
-  g_cond_signal (&decklinksink->audio_cond);
-  g_mutex_unlock (&decklinksink->audio_mutex);
-
-  return TRUE;
-}
-
-static gboolean
-gst_decklink_sink_stop (GstDecklinkSink * decklinksink)
-{
-  decklinksink->output->StopScheduledPlayback (0, NULL, 0);
-  decklinksink->output->DisableAudioOutput ();
-  decklinksink->output->DisableVideoOutput ();
-
-  return TRUE;
-}
-
-static GstStateChangeReturn
-gst_decklink_sink_change_state (GstElement * element, GstStateChange transition)
-{
-  GstDecklinkSink *decklinksink;
-  GstStateChangeReturn ret;
-
-  decklinksink = GST_DECKLINK_SINK (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      if (!gst_decklink_sink_start (decklinksink)) {
-        ret = GST_STATE_CHANGE_FAILURE;
-        goto out;
-      }
-      break;
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-      gst_decklink_sink_force_stop (decklinksink);
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      gst_decklink_sink_stop (decklinksink);
-      break;
-    default:
-      break;
-  }
-
-out:
-  return ret;
-}
-
-static GstFlowReturn
-gst_decklink_sink_videosink_chain (GstPad * pad, GstObject * parent,
-    GstBuffer * buffer)
-{
-  GstDecklinkSink *decklinksink;
-  IDeckLinkMutableVideoFrame *frame;
-  void *data;
-  GstFlowReturn flow_ret;
-  const GstDecklinkMode *mode;
-  HRESULT ret;
-
-  decklinksink = GST_DECKLINK_SINK (parent);
-
-#if 0
-  if (!decklinksink->video_enabled) {
-    HRESULT ret;
-    ret = decklinksink->output->EnableVideoOutput (decklinksink->display_mode,
-        bmdVideoOutputFlagDefault);
-    if (ret != S_OK) {
-      GST_WARNING ("failed to enable video output");
-      //return FALSE;
-    }
-    decklinksink->video_enabled = TRUE;
-  }
-#endif
-
-  mode = gst_decklink_get_mode (decklinksink->mode);
-
-  ret = decklinksink->output->CreateVideoFrame (mode->width,
-      mode->height, mode->width * 2, decklinksink->pixel_format,
-      bmdFrameFlagDefault, &frame);
-  if (ret != S_OK) {
-    GST_ELEMENT_ERROR (decklinksink, STREAM, FAILED,
-        (NULL), ("Failed to create video frame: 0x%08x", ret));
-    return GST_FLOW_ERROR;
-  }
-
-  frame->GetBytes (&data);
-  gst_buffer_extract (buffer, 0, data, gst_buffer_get_size (buffer));
-  gst_buffer_unref (buffer);
-
-  g_mutex_lock (&decklinksink->mutex);
-  while (decklinksink->queued_frames > 2 && !decklinksink->stop) {
-    g_cond_wait (&decklinksink->cond, &decklinksink->mutex);
-  }
-  if (!decklinksink->stop) {
-    decklinksink->queued_frames++;
-  }
-  g_mutex_unlock (&decklinksink->mutex);
-
-  if (!decklinksink->stop) {
-    ret = decklinksink->output->ScheduleVideoFrame (frame,
-        decklinksink->num_frames * mode->fps_d, mode->fps_d, mode->fps_n);
-    if (ret != S_OK) {
-      GST_ELEMENT_ERROR (decklinksink, STREAM, FAILED,
-          (NULL), ("Failed to schedule frame: 0x%08x", ret));
-      flow_ret = GST_FLOW_ERROR;
-      goto out;
-    }
-
-    decklinksink->num_frames++;
-
-    if (!decklinksink->sched_started) {
-      ret = decklinksink->output->StartScheduledPlayback (0, mode->fps_d, 1.0);
-      if (ret != S_OK) {
-        GST_ELEMENT_ERROR (decklinksink, STREAM, FAILED,
-            (NULL), ("Failed to start scheduled playback: 0x%08x", ret));
-        flow_ret = GST_FLOW_ERROR;
-        goto out;
-      }
-      decklinksink->sched_started = TRUE;
-    }
-
-    flow_ret = GST_FLOW_OK;
-  } else {
-    flow_ret = GST_FLOW_FLUSHING;
-  }
-
-out:
-  frame->Release ();
-
-  return flow_ret;
-}
-
-static gboolean
-gst_decklink_sink_videosink_event (GstPad * pad, GstObject * parent,
-    GstEvent * event)
-{
-  gboolean res;
-  GstDecklinkSink *decklinksink;
-
-  decklinksink = GST_DECKLINK_SINK (parent);
-
-  GST_DEBUG_OBJECT (pad, "event: %" GST_PTR_FORMAT, event);
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_CAPS:{
-      decklinksink->pixel_format = bmdFormat8BitYUV;
-      res = TRUE;
-      /* FIXME: this makes no sense, template caps don't contain v210 */
-#if 0
-      GstCaps *caps;
-
-      gst_event_parse_caps (event, &caps);
-      ret = gst_video_format_parse_caps (caps, &format, &width, &height);
-      if (ret) {
-        if (format == GST_VIDEO_FORMAT_v210) {
-          decklinksink->pixel_format = bmdFormat10BitYUV;
-        } else {
-          decklinksink->pixel_format = bmdFormat8BitYUV;
-        }
-      }
-#endif
-      break;
-    }
-    case GST_EVENT_EOS:
-      /* FIXME: EOS aggregation with audio pad looks wrong */
-      decklinksink->video_eos = TRUE;
-      decklinksink->video_seqnum = gst_event_get_seqnum (event);
-      {
-        GstMessage *message;
-
-        message = gst_message_new_eos (GST_OBJECT_CAST (decklinksink));
-        gst_message_set_seqnum (message, decklinksink->video_seqnum);
-        gst_element_post_message (GST_ELEMENT_CAST (decklinksink), message);
-      }
-      res = gst_pad_event_default (pad, parent, event);
-      break;
-    default:
-      res = gst_pad_event_default (pad, parent, event);
-      break;
-  }
-
-  return res;
-}
-
-static gboolean
-gst_decklink_sink_videosink_query (GstPad * pad, GstObject * parent,
-    GstQuery * query)
-{
-  gboolean res;
-  GstDecklinkSink *decklinksink;
-
-  decklinksink = GST_DECKLINK_SINK (parent);
-
-  GST_DEBUG_OBJECT (decklinksink, "query");
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_CAPS:{
-      GstCaps *mode_caps, *filter, *caps;
-
-      /* FIXME: do we change mode if incoming caps change? If yes, we
-       * should probably return the template caps instead */
-      mode_caps = gst_decklink_mode_get_caps (decklinksink->mode);
-      gst_query_parse_caps (query, &filter);
-      if (filter) {
-        caps =
-            gst_caps_intersect_full (filter, mode_caps,
-            GST_CAPS_INTERSECT_FIRST);
-        gst_caps_unref (mode_caps);
-      } else {
-        caps = mode_caps;
-      }
-      gst_query_set_caps_result (query, caps);
-      gst_caps_unref (caps);
-      res = TRUE;
-      break;
-    }
-    default:
-      res = gst_pad_query_default (pad, parent, query);
-      break;
-  }
-
-  return res;
-}
-
-static GstFlowReturn
-gst_decklink_sink_audiosink_chain (GstPad * pad, GstObject * parent,
-    GstBuffer * buffer)
-{
-  GstDecklinkSink *decklinksink;
-  GstFlowReturn ret;
-
-  decklinksink = GST_DECKLINK_SINK (parent);
-
-  if (decklinksink->stop)
-    return GST_FLOW_FLUSHING;
-
-  g_mutex_lock (&decklinksink->audio_mutex);
-  while (!decklinksink->stop &&
-      gst_adapter_available (decklinksink->audio_adapter) > 1600 * 4 * 2) {
-    g_cond_wait (&decklinksink->audio_cond, &decklinksink->audio_mutex);
-  }
-  gst_adapter_push (decklinksink->audio_adapter, buffer);
-  g_mutex_unlock (&decklinksink->audio_mutex);
-
-  ret = GST_FLOW_OK;
-  return ret;
-}
-
-static gboolean
-gst_decklink_sink_audiosink_event (GstPad * pad, GstObject * parent,
-    GstEvent * event)
-{
-  gboolean res;
-  GstDecklinkSink *decklinksink;
-
-  decklinksink = GST_DECKLINK_SINK (parent);
-
-  GST_DEBUG_OBJECT (pad, "event: %" GST_PTR_FORMAT, event);
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_EOS:
-      /* FIXME: EOS aggregation with video pad looks wrong */
-      decklinksink->audio_eos = TRUE;
-      decklinksink->audio_seqnum = gst_event_get_seqnum (event);
-      res = gst_pad_event_default (pad, parent, event);
-      break;
-    default:
-      res = gst_pad_event_default (pad, parent, event);
-      break;
-  }
-
-  return res;
-}
-
-static gboolean
-gst_decklink_sink_audiosink_query (GstPad * pad, GstObject * parent,
-    GstQuery * query)
-{
-  gboolean res;
-
-  GST_DEBUG_OBJECT (pad, "query: %" GST_PTR_FORMAT, query);
-
-  switch (GST_QUERY_TYPE (query)) {
-    default:
-      res = gst_pad_query_default (pad, parent, query);
-      break;
-  }
-
-  return res;
-}
-
-HRESULT
-    Output::ScheduledFrameCompleted (IDeckLinkVideoFrame * completedFrame,
-    BMDOutputFrameCompletionResult result)
-{
-  GST_DEBUG ("ScheduledFrameCompleted");
-
-  g_mutex_lock (&decklinksink->mutex);
-  g_cond_signal (&decklinksink->cond);
-  decklinksink->queued_frames--;
-  g_mutex_unlock (&decklinksink->mutex);
-
-  return S_OK;
-}
-
-HRESULT
-Output::ScheduledPlaybackHasStopped ()
-{
-  GST_DEBUG ("ScheduledPlaybackHasStopped");
-  return S_OK;
-}
-
-HRESULT
-Output::RenderAudioSamples (bool preroll)
-{
-  uint32_t samplesWritten;
-  HRESULT ret;
-
-  // guint64 samplesToWrite;
-
-  if (decklinksink->stop) {
-    GST_DEBUG ("decklinksink->stop set TRUE!");
-    decklinksink->output->BeginAudioPreroll ();
-    // running = true;
-  } else {
-    gconstpointer data;
-    int n;
-
-    g_mutex_lock (&decklinksink->audio_mutex);
-
-    n = gst_adapter_available (decklinksink->audio_adapter);
-    if (n > 0) {
-      data = gst_adapter_map (decklinksink->audio_adapter, n);
-
-      ret = decklinksink->output->ScheduleAudioSamples ((void *) data, n / 4,
-          0, 0, &samplesWritten);
-
-      gst_adapter_unmap (decklinksink->audio_adapter);
-      gst_adapter_flush (decklinksink->audio_adapter, samplesWritten * 4);
-      if (ret != S_OK) {
-        GST_ELEMENT_ERROR (decklinksink, STREAM, FAILED,
-            (NULL), ("Failed to schedule audio samples: 0x%08x", ret));
-      } else {
-        GST_DEBUG ("wrote %d samples, %d available", samplesWritten, n / 4);
-      }
-
-      g_cond_signal (&decklinksink->audio_cond);
-    } else {
-      if (decklinksink->audio_eos) {
-        GstMessage *message;
-
-        message = gst_message_new_eos (GST_OBJECT_CAST (decklinksink));
-        gst_message_set_seqnum (message, decklinksink->audio_seqnum);
-        gst_element_post_message (GST_ELEMENT_CAST (decklinksink), message);
-      }
-    }
-    g_mutex_unlock (&decklinksink->audio_mutex);
-
-  }
-
-  GST_DEBUG ("RenderAudioSamples");
-
-  return S_OK;
-}
diff --git a/sys/decklink/gstdecklinksink.h b/sys/decklink/gstdecklinksink.h
deleted file mode 100644
index 47ca22f..0000000
--- a/sys/decklink/gstdecklinksink.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_DECKLINK_SINK_H_
-#define _GST_DECKLINK_SINK_H_
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-#include "gstdecklink.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_DECKLINK_SINK   (gst_decklink_sink_get_type())
-#define GST_DECKLINK_SINK(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECKLINK_SINK,GstDecklinkSink))
-#define GST_DECKLINK_SINK_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECKLINK_SINK,GstDecklinkSinkClass))
-#define GST_DECKLINK_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DECKLINK_SINK, GstDecklinkSinkClass))
-#define GST_IS_DECKLINK_SINK(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECKLINK_SINK))
-#define GST_IS_DECKLINK_SINK_CLASS(obj)   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECKLINK_SINK))
-
-typedef struct _GstDecklinkSink GstDecklinkSink;
-typedef struct _GstDecklinkSinkClass GstDecklinkSinkClass;
-
-class Output : public IDeckLinkVideoOutputCallback,
-public IDeckLinkAudioOutputCallback
-{
-  public:
-    GstDecklinkSink *decklinksink;
-
-    virtual HRESULT STDMETHODCALLTYPE QueryInterface (REFIID iid, LPVOID *ppv)        {return E_NOINTERFACE;}
-    virtual ULONG STDMETHODCALLTYPE AddRef () {return 1;}
-    virtual ULONG STDMETHODCALLTYPE Release () {return 1;}
-    virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted (IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result);
-    virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped ();
-    virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples (bool preroll);
-};
-
-struct _GstDecklinkSink
-{
-  GstElement base_decklinksink;
-  GstAdapter *audio_adapter;
-
-  GstPad *videosinkpad;
-  GstPad *audiosinkpad;
-
-  GMutex mutex;
-  GCond  cond;
-  GMutex audio_mutex;
-  GCond  audio_cond;
-  int queued_frames;
-  gboolean stop;
-  gboolean video_eos;
-  gboolean audio_eos;
-  int video_seqnum;
-  int audio_seqnum;
-
-  IDeckLink *decklink;
-  IDeckLinkOutput *output;
-  Output *callback;
-  BMDDisplayMode display_mode;
-  BMDPixelFormat pixel_format;
-  gboolean video_enabled;
-  gboolean sched_started;
-
-  int num_frames;
-
-  /* properties */
-  GstDecklinkModeEnum mode;
-  int device_number;
-
-#ifdef _MSC_VER
-  gboolean comInitialized;
-  GMutex   com_init_lock;
-  GMutex   com_deinit_lock;
-  GCond    com_initialized;
-  GCond    com_uninitialize;
-  GCond    com_uninitialized;
-#endif /* _MSC_VER */
-};
-
-struct _GstDecklinkSinkClass
-{
-  GstElementClass base_decklinksink_class;
-};
-
-GType gst_decklink_sink_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/sys/decklink/gstdecklinksrc.cpp b/sys/decklink/gstdecklinksrc.cpp
deleted file mode 100644
index 1dc554d..0000000
--- a/sys/decklink/gstdecklinksrc.cpp
+++ /dev/null
@@ -1,969 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 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., 51 Franklin Street, Suite 500,
- * Boston, MA 02110-1335, USA.
- */
-/**
- * SECTION:element-gstdecklinksrc
- *
- * The decklinksrc element is a source element for Blackmagic
- * Decklink cards.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch-1.0 -v decklinksrc ! videoconvert ! xvimagesink
- * ]|
- * 
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include "gstdecklink.h"
-#include "gstdecklinksrc.h"
-#include "capture.h"
-#include <string.h>
-
-
-GST_DEBUG_CATEGORY (gst_decklink_src_debug_category);
-#define GST_CAT_DEFAULT gst_decklink_src_debug_category
-
-typedef struct _VideoFrame VideoFrame;
-struct _VideoFrame
-{
-  IDeckLinkVideoInputFrame *frame;
-  IDeckLinkInput *input;
-};
-
-static void gst_decklink_src_set_property (GObject * object,
-    guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_decklink_src_get_property (GObject * object,
-    guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_decklink_src_finalize (GObject * object);
-
-static GstStateChangeReturn
-gst_decklink_src_change_state (GstElement * element, GstStateChange transition);
-static gboolean gst_decklink_src_send_event (GstElement * element,
-    GstEvent * event);
-
-static gboolean gst_decklink_src_audio_src_query (GstPad * pad,
-    GstObject * parent, GstQuery * query);
-static gboolean gst_decklink_src_video_src_query (GstPad * pad,
-    GstObject * parent, GstQuery * query);
-
-static void gst_decklink_src_task (void *priv);
-
-#ifdef _MSC_VER
-/* COM initialization/uninitialization thread */
-static void gst_decklink_src_com_thread (GstDecklinkSrc * src);
-#endif /* _MSC_VER */
-
-enum
-{
-  PROP_0,
-  PROP_MODE,
-  PROP_CONNECTION,
-  PROP_AUDIO_INPUT,
-  PROP_DEVICE_NUMBER
-};
-
-static GstStaticPadTemplate gst_decklink_src_audio_src_template =
-GST_STATIC_PAD_TEMPLATE ("audiosrc",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw, format=S16LE, channels=2, rate=48000, "
-        "layout=interleaved")
-    );
-
-/* the video source pad template is created on the fly */
-
-#define parent_class gst_decklink_src_parent_class
-G_DEFINE_TYPE (GstDecklinkSrc, gst_decklink_src, GST_TYPE_ELEMENT);
-
-static void
-gst_decklink_src_class_init (GstDecklinkSrcClass * klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gobject_class->set_property = gst_decklink_src_set_property;
-  gobject_class->get_property = gst_decklink_src_get_property;
-  gobject_class->finalize = gst_decklink_src_finalize;
-
-  element_class->send_event = GST_DEBUG_FUNCPTR (gst_decklink_src_send_event);
-  element_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_decklink_src_change_state);
-
-  g_object_class_install_property (gobject_class, PROP_MODE,
-      g_param_spec_enum ("mode", "Mode", "Video mode to use for capture",
-          GST_TYPE_DECKLINK_MODE, GST_DECKLINK_MODE_NTSC,
-          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-              G_PARAM_CONSTRUCT)));
-
-  g_object_class_install_property (gobject_class, PROP_CONNECTION,
-      g_param_spec_enum ("connection", "Connection",
-          "Video input connection to use",
-          GST_TYPE_DECKLINK_CONNECTION, GST_DECKLINK_CONNECTION_SDI,
-          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-              G_PARAM_CONSTRUCT)));
-
-  g_object_class_install_property (gobject_class, PROP_AUDIO_INPUT,
-      g_param_spec_enum ("audio-input", "Audio Input",
-          "Audio input connection",
-          GST_TYPE_DECKLINK_AUDIO_CONNECTION,
-          GST_DECKLINK_AUDIO_CONNECTION_AUTO,
-          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-              G_PARAM_CONSTRUCT)));
-
-  g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER,
-      g_param_spec_int ("device-number", "Device number",
-          "Capture device instance to use", 0, G_MAXINT, 0,
-          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-              G_PARAM_CONSTRUCT)));
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_decklink_src_audio_src_template));
-
-  gst_element_class_add_pad_template (element_class,
-      gst_pad_template_new ("videosrc", GST_PAD_SRC, GST_PAD_ALWAYS,
-          gst_decklink_mode_get_template_caps ()));
-
-  gst_element_class_set_static_metadata (element_class, "Decklink source",
-      "Source/Video", "DeckLink Source", "David Schleef <ds@entropywave.com>");
-}
-
-static void
-gst_decklink_src_init (GstDecklinkSrc * decklinksrc)
-{
-  GstDecklinkSrcClass *decklinksrc_class;
-
-  decklinksrc_class = GST_DECKLINK_SRC_GET_CLASS (decklinksrc);
-
-  g_rec_mutex_init (&decklinksrc->task_mutex);
-  decklinksrc->task = gst_task_new (gst_decklink_src_task, decklinksrc, NULL);
-  gst_task_set_lock (decklinksrc->task, &decklinksrc->task_mutex);
-
-  decklinksrc->audiosrcpad =
-      gst_pad_new_from_static_template (&gst_decklink_src_audio_src_template,
-      "audiosrc");
-  gst_pad_set_query_function (decklinksrc->audiosrcpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_query));
-  gst_element_add_pad (GST_ELEMENT (decklinksrc), decklinksrc->audiosrcpad);
-
-
-
-  decklinksrc->videosrcpad =
-      gst_pad_new_from_template (gst_element_class_get_pad_template
-      (GST_ELEMENT_CLASS (decklinksrc_class), "videosrc"), "videosrc");
-  gst_pad_set_query_function (decklinksrc->videosrcpad,
-      GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_query));
-  gst_element_add_pad (GST_ELEMENT (decklinksrc), decklinksrc->videosrcpad);
-
-  GST_OBJECT_FLAG_SET (decklinksrc, GST_ELEMENT_FLAG_SOURCE);
-
-  g_cond_init (&decklinksrc->cond);
-  g_mutex_init (&decklinksrc->mutex);
-
-  /* FIXME: turn this into a property? */
-  decklinksrc->copy_data = TRUE;
-  decklinksrc->mode = GST_DECKLINK_MODE_NTSC;
-  decklinksrc->connection = GST_DECKLINK_CONNECTION_SDI;
-  decklinksrc->audio_connection = GST_DECKLINK_AUDIO_CONNECTION_AUTO;
-  decklinksrc->device_number = 0;
-
-  decklinksrc->stop = FALSE;
-  decklinksrc->dropped_frames = 0;
-  decklinksrc->dropped_frames_old = 0;
-  decklinksrc->frame_num = -1;  /* -1 so will be 0 after incrementing */
-
-#ifdef _MSC_VER
-  g_mutex_init (&decklinksrc->com_init_lock);
-  g_mutex_init (&decklinksrc->com_deinit_lock);
-  g_cond_init (&decklinksrc->com_initialized);
-  g_cond_init (&decklinksrc->com_uninitialize);
-  g_cond_init (&decklinksrc->com_uninitialized);
-
-  g_mutex_lock (&decklinksrc->com_init_lock);
-
-  /* create the COM initialization thread */
-  g_thread_create ((GThreadFunc) gst_decklink_src_com_thread,
-      decklinksrc, FALSE, NULL);
-
-  /* wait until the COM thread signals that COM has been initialized */
-  g_cond_wait (&decklinksrc->com_initialized, &decklinksrc->com_init_lock);
-  g_mutex_unlock (&decklinksrc->com_init_lock);
-#endif /* _MSC_VER */
-
-  GST_DEBUG_CATEGORY_INIT (gst_decklink_src_debug_category, "decklinksrc", 0,
-      "debug category for decklinksrc element");
-}
-
-void
-gst_decklink_src_set_property (GObject * object, guint property_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstDecklinkSrc *decklinksrc;
-
-  decklinksrc = GST_DECKLINK_SRC (object);
-
-  switch (property_id) {
-    case PROP_MODE:
-      decklinksrc->mode = (GstDecklinkModeEnum) g_value_get_enum (value);
-      break;
-    case PROP_CONNECTION:
-      decklinksrc->connection =
-          (GstDecklinkConnectionEnum) g_value_get_enum (value);
-      break;
-    case PROP_AUDIO_INPUT:
-      decklinksrc->audio_connection =
-          (GstDecklinkAudioConnectionEnum) g_value_get_enum (value);
-      break;
-    case PROP_DEVICE_NUMBER:
-      decklinksrc->device_number = g_value_get_int (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
-}
-
-void
-gst_decklink_src_get_property (GObject * object, guint property_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstDecklinkSrc *decklinksrc;
-
-  decklinksrc = GST_DECKLINK_SRC (object);
-
-  switch (property_id) {
-    case PROP_MODE:
-      g_value_set_enum (value, decklinksrc->mode);
-      break;
-    case PROP_CONNECTION:
-      g_value_set_enum (value, decklinksrc->connection);
-      break;
-    case PROP_AUDIO_INPUT:
-      g_value_set_enum (value, decklinksrc->audio_connection);
-      break;
-    case PROP_DEVICE_NUMBER:
-      g_value_set_int (value, decklinksrc->device_number);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-  }
-}
-
-#ifdef _MSC_VER
-static void
-gst_decklink_src_com_thread (GstDecklinkSrc * src)
-{
-  HRESULT res;
-
-  g_mutex_lock (src->com_init_lock);
-
-  /* Initialize COM with a MTA for this process. This thread will
-   * be the first one to enter the apartement and the last one to leave
-   * it, unitializing COM properly */
-
-  res = CoInitializeEx (0, COINIT_MULTITHREADED);
-  if (res == S_FALSE)
-    GST_WARNING_OBJECT (src,
-        "COM has been already initialized in the same process");
-  else if (res == RPC_E_CHANGED_MODE)
-    GST_WARNING_OBJECT (src, "The concurrency model of COM has changed.");
-  else
-    GST_INFO_OBJECT (src, "COM intialized succesfully");
-
-  src->comInitialized = TRUE;
-
-  /* Signal other threads waiting on this condition that COM was initialized */
-  g_cond_signal (src->com_initialized);
-
-  g_mutex_unlock (src->com_init_lock);
-
-  /* Wait until the unitialize condition is met to leave the COM apartement */
-  g_mutex_lock (src->com_deinit_lock);
-  g_cond_wait (src->com_uninitialize, src->com_deinit_lock);
-
-  CoUninitialize ();
-  GST_INFO_OBJECT (src, "COM unintialized succesfully");
-  src->comInitialized = FALSE;
-  g_cond_signal (src->com_uninitialized);
-  g_mutex_unlock (src->com_deinit_lock);
-}
-#endif /* _MSC_VER */
-
-void
-gst_decklink_src_finalize (GObject * object)
-{
-  GstDecklinkSrc *decklinksrc;
-
-  g_return_if_fail (GST_IS_DECKLINK_SRC (object));
-  decklinksrc = GST_DECKLINK_SRC (object);
-
-  /* clean up object here */
-
-  g_cond_clear (&decklinksrc->cond);
-  g_mutex_clear (&decklinksrc->mutex);
-  gst_task_set_lock (decklinksrc->task, NULL);
-  g_object_unref (decklinksrc->task);
-
-#ifdef _MSC_VER
-  /* signal the COM thread that it should uninitialize COM */
-  if (decklinksrc->comInitialized) {
-    g_mutex_lock (&decklinksrc->com_deinit_lock);
-    g_cond_signal (&decklinksrc->com_uninitialize);
-    g_cond_wait (&decklinksrc->com_uninitialized, &decklinksrc->com_deinit_lock);
-    g_mutex_unlock (&decklinksrc->com_deinit_lock);
-  }
-
-  g_mutex_clear (&decklinksrc->com_init_lock);
-  g_mutex_clear (&decklinksrc->com_deinit_lock);
-  g_cond_clear (&decklinksrc->com_initialized);
-  g_cond_clear (&decklinksrc->com_uninitialize);
-  g_cond_clear (&decklinksrc->com_uninitialized);
-#endif /* _MSC_VER */
-
-  g_rec_mutex_clear (&decklinksrc->task_mutex);
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* events sent to this element directly, mainly from the application */
-static gboolean
-gst_decklink_src_send_event (GstElement * element, GstEvent * event)
-{
-  GstDecklinkSrc *src;
-  gboolean result = FALSE;
-
-  src = GST_DECKLINK_SRC (element);
-
-  GST_DEBUG_OBJECT (src, "handling event %p %" GST_PTR_FORMAT, event, event);
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_EOS:
-      g_atomic_int_set (&src->pending_eos, TRUE);
-      GST_INFO_OBJECT (src, "EOS pending");
-      g_cond_signal (&src->cond);
-      result = TRUE;
-      break;
-      break;
-    case GST_EVENT_TAG:
-    case GST_EVENT_CUSTOM_DOWNSTREAM:
-    case GST_EVENT_CUSTOM_BOTH:
-      /* Insert TAG, CUSTOM_DOWNSTREAM, CUSTOM_BOTH in the dataflow */
-      GST_OBJECT_LOCK (src);
-      src->pending_events = g_list_append (src->pending_events, event);
-      g_atomic_int_set (&src->have_events, TRUE);
-      GST_OBJECT_UNLOCK (src);
-      event = NULL;
-      result = TRUE;
-      break;
-    case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
-    case GST_EVENT_CUSTOM_BOTH_OOB:
-      /* insert a random custom event into the pipeline */
-      GST_DEBUG_OBJECT (src, "pushing custom OOB event downstream");
-      result = gst_pad_push_event (src->videosrcpad, gst_event_ref (event));
-      result |= gst_pad_push_event (src->audiosrcpad, event);
-      /* we gave away the ref to the event in the push */
-      event = NULL;
-      break;
-    case GST_EVENT_CUSTOM_UPSTREAM:
-      /* drop */
-    case GST_EVENT_SEGMENT:
-      /* sending random SEGMENT downstream can break sync - drop */
-    default:
-      GST_LOG_OBJECT (src, "dropping %s event", GST_EVENT_TYPE_NAME (event));
-      break;
-  }
-
-  /* if we still have a ref to the event, unref it now */
-  if (event)
-    gst_event_unref (event);
-
-  return result;
-}
-
-/* FIXME: post error messages for the misc. failures */
-static gboolean
-gst_decklink_src_start (GstElement * element)
-{
-  GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (element);
-  DeckLinkCaptureDelegate *delegate;
-  BMDAudioSampleType sample_depth;
-  int channels;
-  HRESULT ret;
-  const GstDecklinkMode *mode;
-  IDeckLinkConfiguration *config;
-  BMDVideoConnection conn;
-  BMDAudioConnection aconn;
-
-  GST_DEBUG_OBJECT (decklinksrc, "start");
-
-  decklinksrc->decklink = gst_decklink_get_nth_device (decklinksrc->device_number);
-  if (decklinksrc->decklink == NULL) {
-    return FALSE;
-  }
-
-  decklinksrc->input = gst_decklink_get_nth_input (decklinksrc->device_number);
-  if (decklinksrc->input == NULL) {
-    GST_ERROR ("no input source for device %i", decklinksrc->device_number);
-    return FALSE;
-  }
-
-  delegate = new DeckLinkCaptureDelegate ();
-  delegate->priv = decklinksrc;
-  ret = decklinksrc->input->SetCallback (delegate);
-  if (ret != S_OK) {
-    GST_ERROR ("set callback failed (input source)");
-    return FALSE;
-  }
-
-  decklinksrc->config = gst_decklink_get_nth_config (decklinksrc->device_number);
-  config = decklinksrc->config;
-  if (decklinksrc->config == NULL) {
-    GST_ERROR ("no config for device %i", decklinksrc->device_number);
-    return FALSE;
-  }
-
-  switch (decklinksrc->connection) {
-    default:
-    case GST_DECKLINK_CONNECTION_SDI:
-      conn = bmdVideoConnectionSDI;
-      aconn = bmdAudioConnectionEmbedded;
-      break;
-    case GST_DECKLINK_CONNECTION_HDMI:
-      conn = bmdVideoConnectionHDMI;
-      aconn = bmdAudioConnectionEmbedded;
-      break;
-    case GST_DECKLINK_CONNECTION_OPTICAL_SDI:
-      conn = bmdVideoConnectionOpticalSDI;
-      aconn = bmdAudioConnectionEmbedded;
-      break;
-    case GST_DECKLINK_CONNECTION_COMPONENT:
-      conn = bmdVideoConnectionComponent;
-      aconn = bmdAudioConnectionAnalog;
-      break;
-    case GST_DECKLINK_CONNECTION_COMPOSITE:
-      conn = bmdVideoConnectionComposite;
-      aconn = bmdAudioConnectionAnalog;
-      break;
-    case GST_DECKLINK_CONNECTION_SVIDEO:
-      conn = bmdVideoConnectionSVideo;
-      aconn = bmdAudioConnectionAnalog;
-      break;
-  }
-
-  ret = config->SetInt (bmdDeckLinkConfigVideoInputConnection, conn);
-  if (ret != S_OK) {
-    GST_ERROR ("set configuration (input source)");
-    return FALSE;
-  }
-
-  if (decklinksrc->connection == GST_DECKLINK_CONNECTION_COMPOSITE) {
-    ret = config->SetInt (bmdDeckLinkConfigAnalogVideoInputFlags,
-        bmdAnalogVideoFlagCompositeSetup75);
-    if (ret != S_OK) {
-      GST_ERROR ("set configuration (composite setup)");
-      return FALSE;
-    }
-  }
-
-  switch (decklinksrc->audio_connection) {
-    default:
-    case GST_DECKLINK_AUDIO_CONNECTION_AUTO:
-      /* set above */
-      break;
-    case GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED:
-      aconn = bmdAudioConnectionEmbedded;
-      break;
-    case GST_DECKLINK_AUDIO_CONNECTION_AES_EBU:
-      aconn = bmdAudioConnectionAESEBU;
-      break;
-    case GST_DECKLINK_AUDIO_CONNECTION_ANALOG:
-      aconn = bmdAudioConnectionAnalog;
-      break;
-  }
-  ret = config->SetInt (bmdDeckLinkConfigAudioInputConnection, aconn);
-  if (ret != S_OK) {
-    GST_ERROR ("set configuration (audio input connection)");
-    return FALSE;
-  }
-
-  mode = gst_decklink_get_mode (decklinksrc->mode);
-
-  ret = decklinksrc->input->EnableVideoInput (mode->mode, bmdFormat8BitYUV, 0);
-  if (ret != S_OK) {
-    GST_ERROR ("enable video input failed");
-    return FALSE;
-  }
-
-  sample_depth = bmdAudioSampleType16bitInteger;
-  channels = 2;
-  ret = decklinksrc->input->EnableAudioInput (bmdAudioSampleRate48kHz,
-      sample_depth, channels);
-  if (ret != S_OK) {
-    GST_ERROR ("enable video input failed");
-    return FALSE;
-  }
-
-  ret = decklinksrc->input->StartStreams ();
-  if (ret != S_OK) {
-    GST_ERROR ("start streams failed");
-    return FALSE;
-  }
-
-  g_rec_mutex_lock (&decklinksrc->task_mutex);
-  gst_task_start (decklinksrc->task);
-  g_rec_mutex_unlock (&decklinksrc->task_mutex);
-
-  return TRUE;
-}
-
-static gboolean
-gst_decklink_src_stop (GstElement * element)
-{
-  GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (element);
-
-  gst_task_stop (decklinksrc->task);
-
-  g_mutex_lock (&decklinksrc->mutex);
-  decklinksrc->stop = TRUE;
-  g_cond_signal (&decklinksrc->cond);
-  g_mutex_unlock (&decklinksrc->mutex);
-
-  gst_task_join (decklinksrc->task);
-
-  decklinksrc->input->StopStreams ();
-  decklinksrc->input->DisableVideoInput ();
-  decklinksrc->input->DisableAudioInput ();
-
-  g_list_free_full (decklinksrc->pending_events,
-      (GDestroyNotify) gst_mini_object_unref);
-  decklinksrc->pending_events = NULL;
-  decklinksrc->have_events = FALSE;
-  decklinksrc->pending_eos = FALSE;
-
-  return TRUE;
-}
-
-static GstStateChangeReturn
-gst_decklink_src_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn ret;
-  gboolean no_preroll = FALSE;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      if (!gst_decklink_src_start (element)) {
-        ret = GST_STATE_CHANGE_FAILURE;
-        goto out;
-      }
-      break;
-    case GST_STATE_CHANGE_READY_TO_PAUSED:
-      no_preroll = TRUE;
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
-      no_preroll = TRUE;
-      break;
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      gst_decklink_src_stop (element);
-      break;
-    default:
-      break;
-  }
-
-  if (no_preroll && ret == GST_STATE_CHANGE_SUCCESS)
-    ret = GST_STATE_CHANGE_NO_PREROLL;
-
-out:
-  return ret;
-}
-
-static gboolean
-gst_decklink_src_audio_src_query (GstPad * pad, GstObject * parent,
-    GstQuery * query)
-{
-  gboolean res;
-
-  GST_DEBUG_OBJECT (pad, "query: %" GST_PTR_FORMAT, query);
-
-  switch (GST_QUERY_TYPE (query)) {
-    /* FIXME: report live-ness and latency for audio too */
-    case GST_QUERY_LATENCY:
-      GST_FIXME_OBJECT (parent, "should report live-ness and audio latency");
-      res = gst_pad_query_default (pad, parent, query);
-      break;
-    default:
-      res = gst_pad_query_default (pad, parent, query);
-      break;
-  }
-
-  return res;
-}
-
-static gboolean
-gst_decklink_src_video_src_query (GstPad * pad, GstObject * parent,
-    GstQuery * query)
-{
-  GstDecklinkSrc *decklinksrc;
-  gboolean ret = FALSE;
-
-  decklinksrc = GST_DECKLINK_SRC (parent);
-
-  GST_DEBUG_OBJECT (pad, "query: %" GST_PTR_FORMAT, query);
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_LATENCY:{
-      GstClockTime min_latency, max_latency;
-      const GstDecklinkMode *mode;
-
-      /* device must be open */
-      if (decklinksrc->decklink == NULL) {
-        GST_WARNING_OBJECT (decklinksrc,
-            "Can't give latency since device isn't open !");
-        goto done;
-      }
-
-      mode = gst_decklink_get_mode (decklinksrc->mode);
-
-      /* min latency is the time to capture one frame */
-      min_latency =
-          gst_util_uint64_scale_int (GST_SECOND, mode->fps_d, mode->fps_n);
-
-      /* max latency is total duration of the frame buffer */
-      max_latency = 2 * min_latency;
-
-      GST_DEBUG_OBJECT (decklinksrc,
-          "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);
-
-      ret = TRUE;
-      break;
-    }
-    default:
-      ret = gst_pad_query_default (pad, parent, query);
-      break;
-  }
-
-done:
-  return ret;
-}
-
-static void
-video_frame_free (void *data)
-{
-  VideoFrame *video_frame = (VideoFrame *) data;
-
-  video_frame->frame->Release ();
-  video_frame->input->Release ();
-  g_free (video_frame);
-}
-
-static void
-gst_decklink_src_send_initial_events (GstDecklinkSrc * src)
-{
-  GstSegment segment;
-  GstEvent *event;
-  guint group_id;
-  guint32 audio_id, video_id;
-  gchar stream_id[9];
-
-  /* stream-start */
-  audio_id = g_random_int ();
-  video_id = g_random_int ();
-  while (video_id == audio_id)
-    video_id = g_random_int ();
-
-  group_id = gst_util_group_id_next ();
-  g_snprintf (stream_id, sizeof (stream_id), "%08x", audio_id);
-  event = gst_event_new_stream_start (stream_id);
-  gst_event_set_group_id (event, group_id);
-  gst_pad_push_event (src->audiosrcpad, event);
-
-  g_snprintf (stream_id, sizeof (stream_id), "%08x", video_id);
-  event = gst_event_new_stream_start (stream_id);
-  gst_event_set_group_id (event, group_id);
-  gst_pad_push_event (src->videosrcpad, event);
-
-  /* caps */
-  gst_pad_push_event (src->audiosrcpad,
-      gst_event_new_caps (gst_caps_new_simple ("audio/x-raw",
-          "format", G_TYPE_STRING, "S16LE", "channels", G_TYPE_INT, 2,
-          "rate", G_TYPE_INT, 48000, "layout", G_TYPE_STRING, "interleaved",
-          NULL)));
-
-  gst_pad_push_event (src->videosrcpad,
-      gst_event_new_caps (gst_decklink_mode_get_caps (src->mode)));
-
-  /* segment */
-  gst_segment_init (&segment, GST_FORMAT_TIME);
-  event = gst_event_new_segment (&segment);
-  gst_pad_push_event (src->videosrcpad, gst_event_ref (event));
-  gst_pad_push_event (src->audiosrcpad, event);
-}
-
-static void
-gst_decklink_src_task (void *priv)
-{
-  GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (priv);
-  GstBuffer *buffer;
-  GstBuffer *audio_buffer;
-  IDeckLinkVideoInputFrame *video_frame;
-  IDeckLinkAudioInputPacket *audio_frame;
-  void *data;
-  gsize data_size;
-  int n_samples;
-  GstFlowReturn video_flow, audio_flow, flow;
-  const GstDecklinkMode *mode;
-  gboolean discont = FALSE;
-
-  GST_DEBUG_OBJECT (decklinksrc, "task");
-
-  g_mutex_lock (&decklinksrc->mutex);
-  while (decklinksrc->video_frame == NULL && !decklinksrc->stop &&
-      !decklinksrc->pending_eos) {
-    g_cond_wait (&decklinksrc->cond, &decklinksrc->mutex);
-  }
-  video_frame = decklinksrc->video_frame;
-  audio_frame = decklinksrc->audio_frame;
-  decklinksrc->video_frame = NULL;
-  decklinksrc->audio_frame = NULL;
-  g_mutex_unlock (&decklinksrc->mutex);
-
-  if (decklinksrc->stop) {
-    if (video_frame)
-      video_frame->Release ();
-    if (audio_frame)
-      audio_frame->Release ();
-    GST_DEBUG ("stopping task");
-    return;
-  }
-
-  if (g_atomic_int_compare_and_exchange (&decklinksrc->pending_eos, TRUE,
-      FALSE)) {
-    GST_INFO_OBJECT (decklinksrc, "EOS pending");
-    flow = GST_FLOW_EOS;
-    goto pause;
-  }
-
-  /* warning on dropped frames */
-  /* FIXME: post QoS message */
-  if (decklinksrc->dropped_frames - decklinksrc->dropped_frames_old > 0) {
-    GST_ELEMENT_WARNING (decklinksrc, RESOURCE, READ,
-        ("Dropped %d frame(s), for a total of %d frame(s)",
-            decklinksrc->dropped_frames - decklinksrc->dropped_frames_old,
-            decklinksrc->dropped_frames), (NULL));
-    decklinksrc->dropped_frames_old = decklinksrc->dropped_frames;
-    /* FIXME: discont = TRUE; ? */
-  }
-
-  if (!decklinksrc->started) {
-    gst_decklink_src_send_initial_events (decklinksrc);
-    decklinksrc->started = TRUE;
-  }
-
-  if (g_atomic_int_get (&decklinksrc->have_events)) {
-    GList *l;
-
-    GST_OBJECT_LOCK (decklinksrc);
-    for (l = decklinksrc->pending_events; l != NULL; l = l->next) {
-      GstEvent *event = GST_EVENT (l->data);
-
-      GST_DEBUG_OBJECT (decklinksrc, "pushing %s event",
-          GST_EVENT_TYPE_NAME (event));
-      gst_pad_push_event (decklinksrc->videosrcpad, gst_event_ref (event));
-      gst_pad_push_event (decklinksrc->audiosrcpad, event);
-      l->data = NULL;
-    }
-    g_list_free (decklinksrc->pending_events);
-    decklinksrc->pending_events = NULL;
-    g_atomic_int_set (&decklinksrc->have_events, FALSE);
-    GST_OBJECT_UNLOCK (decklinksrc);
-  }
-
-  mode = gst_decklink_get_mode (decklinksrc->mode);
-
-  video_frame->GetBytes (&data);
-
-  data_size = mode->width * mode->height * 2;
-
-  if (decklinksrc->copy_data) {
-    buffer = gst_buffer_new_and_alloc (data_size);
-
-    gst_buffer_fill (buffer, 0, data, data_size);
-
-    video_frame->Release ();
-  } else {
-    VideoFrame *vf;
-
-    vf = (VideoFrame *) g_malloc0 (sizeof (VideoFrame));
-
-    buffer = gst_buffer_new_wrapped_full ((GstMemoryFlags) 0, data, data_size,
-        0, data_size, vf, (GDestroyNotify) video_frame_free);
-
-    vf->frame = video_frame;
-    vf->input = decklinksrc->input;
-    vf->input->AddRef ();
-  }
-
-  GST_BUFFER_TIMESTAMP (buffer) =
-      gst_util_uint64_scale_int (decklinksrc->frame_num * GST_SECOND,
-      mode->fps_d, mode->fps_n);
-  GST_BUFFER_DURATION (buffer) =
-      gst_util_uint64_scale_int ((decklinksrc->frame_num + 1) * GST_SECOND,
-      mode->fps_d, mode->fps_n) - GST_BUFFER_TIMESTAMP (buffer);
-  GST_BUFFER_OFFSET (buffer) = decklinksrc->frame_num;
-  GST_BUFFER_OFFSET_END (buffer) = decklinksrc->frame_num; /* FIXME: +1? */
-
-  /* FIXME: set video meta */
-
-  if (decklinksrc->frame_num == 0)
-    discont = TRUE;
-
-  if (discont)
-    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
-  else
-    GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
-
-  video_flow = gst_pad_push (decklinksrc->videosrcpad, buffer);
-
-  if (gst_pad_is_linked (decklinksrc->audiosrcpad)) {
-    n_samples = audio_frame->GetSampleFrameCount ();
-    audio_frame->GetBytes (&data);
-    audio_buffer = gst_buffer_new_and_alloc (n_samples * 2 * 2);
-    gst_buffer_fill (audio_buffer, 0, data, n_samples * 2 * 2);
-
-    GST_BUFFER_TIMESTAMP (audio_buffer) =
-        gst_util_uint64_scale_int (decklinksrc->num_audio_samples * GST_SECOND,
-        1, 48000);
-    /* FIXME: should be next_timestamp - timestamp for perfect stream */
-    GST_BUFFER_DURATION (audio_buffer) =
-        gst_util_uint64_scale_int (n_samples * GST_SECOND, 1, 48000);
-    GST_BUFFER_OFFSET (audio_buffer) = decklinksrc->num_audio_samples;
-    GST_BUFFER_OFFSET_END (audio_buffer) =
-        GST_BUFFER_OFFSET (audio_buffer) + n_samples;
-
-    decklinksrc->num_audio_samples += n_samples;
-
-    if (discont)
-      GST_BUFFER_FLAG_SET (audio_buffer, GST_BUFFER_FLAG_DISCONT);
-    else
-      GST_BUFFER_FLAG_UNSET (audio_buffer, GST_BUFFER_FLAG_DISCONT);
-
-    audio_flow = gst_pad_push (decklinksrc->audiosrcpad, audio_buffer);
-  } else {
-    audio_flow = GST_FLOW_NOT_LINKED;
-  }
-
-  if (audio_flow == GST_FLOW_NOT_LINKED)
-    flow = video_flow;
-  else if (video_flow == GST_FLOW_NOT_LINKED)
-    flow = audio_flow;
-  else if (video_flow == GST_FLOW_FLUSHING || audio_flow == GST_FLOW_FLUSHING)
-    flow = GST_FLOW_FLUSHING;
-  else if (video_flow < GST_FLOW_EOS)
-    flow = video_flow;
-  else if (audio_flow < GST_FLOW_EOS)
-    flow = audio_flow;
-  else if (video_flow == GST_FLOW_EOS || audio_flow == GST_FLOW_EOS)
-    flow = GST_FLOW_EOS;
-  else
-    flow = video_flow;
-
-  if (flow != GST_FLOW_OK)
-    goto pause;
-
-done:
-
-  if (audio_frame)
-    audio_frame->Release ();
-
-  return;
-
-pause:
-  {
-    const gchar *reason = gst_flow_get_name (flow);
-    GstEvent *event = NULL;
-
-    GST_DEBUG_OBJECT (decklinksrc, "pausing task, reason %s", reason);
-    gst_task_pause (decklinksrc->task);
-    if (flow == GST_FLOW_EOS) {
-      /* perform EOS logic (very crude, we don't even keep a GstSegment) */
-      event = gst_event_new_eos ();
-    } else if (flow == GST_FLOW_NOT_LINKED || flow < GST_FLOW_EOS) {
-      event = gst_event_new_eos ();
-      /* for fatal errors we post an error message, post the error
-       * first so the app knows about the error first.
-       * Also don't do this for FLUSHING because it happens
-       * due to flushing and posting an error message because of
-       * that is the wrong thing to do, e.g. when we're doing
-       * a flushing seek. */
-      GST_ELEMENT_ERROR (decklinksrc, STREAM, FAILED,
-          ("Internal data flow error."),
-          ("streaming task paused, reason %s (%d)", reason, flow));
-    }
-    if (event != NULL) {
-      GST_INFO_OBJECT (decklinksrc->videosrcpad, "pushing EOS event");
-      gst_pad_push_event (decklinksrc->videosrcpad, gst_event_ref (event));
-      GST_INFO_OBJECT (decklinksrc->audiosrcpad, "pushing EOS event");
-      gst_pad_push_event (decklinksrc->audiosrcpad, event);
-    }
-    goto done;
-  }
-}
-
-#if 0
-/* former device probe code, redux */
-static void
-gst_decklinksrc_list_devices (void)
-{
-  IDeckLinkIterator *iterator;
-  IDeckLink *decklink;
-  int n_devices;
-
-  n_devices = 0;
-  iterator = CreateDeckLinkIteratorInstance ();
-  if (iterator) {
-    while (iterator->Next (&decklink) == S_OK) {
-      n_devices++;
-    }
-  }
-  iterator->Release();
-
-  g_print ("%d devices\n", n_devices);
-}
-#endif
diff --git a/sys/decklink/gstdecklinksrc.h b/sys/decklink/gstdecklinksrc.h
deleted file mode 100644
index f071b66..0000000
--- a/sys/decklink/gstdecklinksrc.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_DECKLINK_SRC_H_
-#define _GST_DECKLINK_SRC_H_
-
-#include <gst/gst.h>
-#include "gstdecklink.h"
-
-G_BEGIN_DECLS
-
-GST_DEBUG_CATEGORY_EXTERN (gst_decklink_src_debug_category);
-
-#define GST_TYPE_DECKLINK_SRC   (gst_decklink_src_get_type())
-#define GST_DECKLINK_SRC(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECKLINK_SRC,GstDecklinkSrc))
-#define GST_DECKLINK_SRC_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECKLINK_SRC,GstDecklinkSrcClass))
-#define GST_DECKLINK_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DECKLINK_SRC, GstDecklinkSrcClass))
-#define GST_IS_DECKLINK_SRC(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECKLINK_SRC))
-#define GST_IS_DECKLINK_SRC_CLASS(obj)   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECKLINK_SRC))
-
-typedef struct _GstDecklinkSrc GstDecklinkSrc;
-typedef struct _GstDecklinkSrcClass GstDecklinkSrcClass;
-
-struct _GstDecklinkSrc
-{
-  GstElement base_decklinksrc;
-
-  GstPad *audiosrcpad;
-  GstPad *videosrcpad;
-
-  gboolean  pending_eos;    /* ATOMIC */
-
-  gboolean  have_events;    /* ATOMIC */
-  GList    *pending_events; /* OBJECT_LOCK */
-
-  IDeckLink *decklink;
-  IDeckLinkInput *input;
-  IDeckLinkConfiguration *config;
-
-  GMutex mutex;
-  GCond cond;
-  int dropped_frames;
-  int dropped_frames_old;
-  gboolean stop;
-  IDeckLinkVideoInputFrame *video_frame;
-  IDeckLinkAudioInputPacket * audio_frame;
-
-  GstTask *task;
-  GRecMutex task_mutex;
-
-  guint64 num_audio_samples;
-
-  guint64 frame_num;
-  int fps_n;
-  int fps_d;
-  int width;
-  int height;
-  gboolean interlaced;
-  BMDDisplayMode bmd_mode;
-
-  /* so we send a stream-start, caps, and newsegment events before buffers */
-  gboolean started;
-
-  /* properties */
-  gboolean copy_data;
-  GstDecklinkModeEnum mode;
-  GstDecklinkConnectionEnum connection;
-  GstDecklinkAudioConnectionEnum audio_connection;
-  int device_number;
-
-#ifdef _MSC_VER
-  gboolean comInitialized;
-  GMutex   *com_init_lock;
-  GMutex   *com_deinit_lock;
-  GCond    *com_initialized;
-  GCond    *com_uninitialize;
-  GCond    *com_uninitialized;
-#endif /* _MSC_VER */
-};
-
-struct _GstDecklinkSrcClass
-{
-  GstElementClass base_decklinksrc_class;
-};
-
-GType gst_decklink_src_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/sys/decklink/gstdecklinkvideosink.cpp b/sys/decklink/gstdecklinkvideosink.cpp
new file mode 100644
index 0000000..0096d9e
--- /dev/null
+++ b/sys/decklink/gstdecklinkvideosink.cpp
@@ -0,0 +1,833 @@
+/* GStreamer
+ * Copyright (C) 2011 David Schleef <ds@entropywave.com>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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., 51 Franklin Street, Suite 500,
+ * Boston, MA 02110-1335, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdecklinkvideosink.h"
+#include <string.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_decklink_video_sink_debug);
+#define GST_CAT_DEFAULT gst_decklink_video_sink_debug
+
+class GStreamerVideoOutputCallback:public IDeckLinkVideoOutputCallback
+{
+public:
+  GStreamerVideoOutputCallback (GstDecklinkVideoSink * sink)
+  :IDeckLinkVideoOutputCallback (), m_refcount (1)
+  {
+    m_sink = GST_DECKLINK_VIDEO_SINK_CAST (gst_object_ref (sink));
+    g_mutex_init (&m_mutex);
+  }
+
+  virtual HRESULT QueryInterface (REFIID, LPVOID *)
+  {
+    return E_NOINTERFACE;
+  }
+
+  virtual ULONG AddRef (void)
+  {
+    ULONG ret;
+
+    g_mutex_lock (&m_mutex);
+    m_refcount++;
+    ret = m_refcount;
+    g_mutex_unlock (&m_mutex);
+
+    return ret;
+  }
+
+  virtual ULONG Release (void)
+  {
+    ULONG ret;
+
+    g_mutex_lock (&m_mutex);
+    m_refcount--;
+    ret = m_refcount;
+    g_mutex_unlock (&m_mutex);
+
+    if (ret == 0) {
+      delete this;
+    }
+
+    return ret;
+  }
+
+  virtual HRESULT ScheduledFrameCompleted (IDeckLinkVideoFrame * completedFrame,
+      BMDOutputFrameCompletionResult result)
+  {
+    switch (result) {
+      case bmdOutputFrameCompleted:
+        GST_LOG_OBJECT (m_sink, "Completed frame %p", completedFrame);
+        break;
+      case bmdOutputFrameDisplayedLate:
+        GST_INFO_OBJECT (m_sink, "Late Frame %p", completedFrame);
+        break;
+      case bmdOutputFrameDropped:
+        GST_INFO_OBJECT (m_sink, "Dropped Frame %p", completedFrame);
+        break;
+      case bmdOutputFrameFlushed:
+        GST_DEBUG_OBJECT (m_sink, "Flushed Frame %p", completedFrame);
+        break;
+      default:
+        GST_INFO_OBJECT (m_sink, "Unknown Frame %p: %d", completedFrame,
+            (gint) result);
+        break;
+    }
+
+    return S_OK;
+  }
+
+  virtual HRESULT ScheduledPlaybackHasStopped (void)
+  {
+    GST_LOG_OBJECT (m_sink, "Scheduled playback stopped");
+
+    return S_OK;
+  }
+
+  virtual ~ GStreamerVideoOutputCallback () {
+    gst_object_unref (m_sink);
+    g_mutex_clear (&m_mutex);
+  }
+
+private:
+  GstDecklinkVideoSink * m_sink;
+  GMutex m_mutex;
+  gint m_refcount;
+};
+
+enum
+{
+  PROP_0,
+  PROP_MODE,
+  PROP_DEVICE_NUMBER
+};
+
+static void gst_decklink_video_sink_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec);
+static void gst_decklink_video_sink_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec);
+static void gst_decklink_video_sink_finalize (GObject * object);
+
+static GstStateChangeReturn
+gst_decklink_video_sink_change_state (GstElement * element,
+    GstStateChange transition);
+static GstClock *gst_decklink_video_sink_provide_clock (GstElement * element);
+
+static GstCaps *gst_decklink_video_sink_get_caps (GstBaseSink * bsink,
+    GstCaps * filter);
+static gboolean gst_decklink_video_sink_set_caps (GstBaseSink * bsink,
+    GstCaps * caps);
+static GstFlowReturn gst_decklink_video_sink_prepare (GstBaseSink * bsink,
+    GstBuffer * buffer);
+static GstFlowReturn gst_decklink_video_sink_render (GstBaseSink * bsink,
+    GstBuffer * buffer);
+static gboolean gst_decklink_video_sink_open (GstBaseSink * bsink);
+static gboolean gst_decklink_video_sink_close (GstBaseSink * bsink);
+static gboolean gst_decklink_video_sink_propose_allocation (GstBaseSink * bsink,
+    GstQuery * query);
+
+static void
+gst_decklink_video_sink_start_scheduled_playback (GstElement * element);
+
+#define parent_class gst_decklink_video_sink_parent_class
+G_DEFINE_TYPE (GstDecklinkVideoSink, gst_decklink_video_sink,
+    GST_TYPE_BASE_SINK);
+
+static void
+gst_decklink_video_sink_class_init (GstDecklinkVideoSinkClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+  GstBaseSinkClass *basesink_class = GST_BASE_SINK_CLASS (klass);
+  GstCaps *templ_caps;
+
+  gobject_class->set_property = gst_decklink_video_sink_set_property;
+  gobject_class->get_property = gst_decklink_video_sink_get_property;
+  gobject_class->finalize = gst_decklink_video_sink_finalize;
+
+  element_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_sink_change_state);
+  element_class->provide_clock =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_sink_provide_clock);
+
+  basesink_class->get_caps =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_sink_get_caps);
+  basesink_class->set_caps =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_sink_set_caps);
+  basesink_class->prepare = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_prepare);
+  basesink_class->render = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_render);
+  // FIXME: These are misnamed in basesink!
+  basesink_class->start = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_open);
+  basesink_class->stop = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_close);
+  basesink_class->propose_allocation =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_sink_propose_allocation);
+
+  g_object_class_install_property (gobject_class, PROP_MODE,
+      g_param_spec_enum ("mode", "Playback Mode",
+          "Video Mode to use for playback",
+          GST_TYPE_DECKLINK_MODE, GST_DECKLINK_MODE_NTSC,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER,
+      g_param_spec_int ("device-number", "Device number",
+          "Output device instance to use", 0, G_MAXINT, 0,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  templ_caps = gst_decklink_mode_get_template_caps ();
+  gst_element_class_add_pad_template (element_class,
+      gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, templ_caps));
+  gst_caps_unref (templ_caps);
+
+  gst_element_class_set_static_metadata (element_class, "Decklink Video Sink",
+      "Video/Sink", "Decklink Sink", "David Schleef <ds@entropywave.com>, "
+      "Sebastian Dröge <sebastian@centricular.com>");
+
+  GST_DEBUG_CATEGORY_INIT (gst_decklink_video_sink_debug, "decklinkvideosink",
+      0, "debug category for decklinkvideosink element");
+}
+
+static void
+gst_decklink_video_sink_init (GstDecklinkVideoSink * self)
+{
+  self->mode = GST_DECKLINK_MODE_NTSC;
+  self->device_number = 0;
+
+  gst_base_sink_set_max_lateness (GST_BASE_SINK_CAST (self), 20 * GST_MSECOND);
+  gst_base_sink_set_qos_enabled (GST_BASE_SINK_CAST (self), TRUE);
+}
+
+void
+gst_decklink_video_sink_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (object);
+
+  switch (property_id) {
+    case PROP_MODE:
+      self->mode = (GstDecklinkModeEnum) g_value_get_enum (value);
+      break;
+    case PROP_DEVICE_NUMBER:
+      self->device_number = g_value_get_int (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_video_sink_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (object);
+
+  switch (property_id) {
+    case PROP_MODE:
+      g_value_set_enum (value, self->mode);
+      break;
+    case PROP_DEVICE_NUMBER:
+      g_value_set_int (value, self->device_number);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_video_sink_finalize (GObject * object)
+{
+  //GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (object);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+gst_decklink_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink);
+  const GstDecklinkMode *mode;
+  HRESULT ret;
+
+  GST_DEBUG_OBJECT (self, "Setting caps %" GST_PTR_FORMAT, caps);
+
+  if (!gst_video_info_from_caps (&self->info, caps))
+    return FALSE;
+
+  self->output->output->SetScheduledFrameCompletionCallback (new
+      GStreamerVideoOutputCallback (self));
+
+  mode = gst_decklink_get_mode (self->mode);
+  g_assert (mode != NULL);
+
+  ret = self->output->output->EnableVideoOutput (mode->mode,
+      bmdVideoOutputFlagDefault);
+  if (ret != S_OK) {
+    GST_WARNING_OBJECT (self, "Failed to enable video output");
+    return FALSE;
+  }
+
+  g_mutex_lock (&self->output->lock);
+  self->output->mode = mode;
+  self->output->video_enabled = TRUE;
+  if (self->output->start_scheduled_playback)
+    self->output->start_scheduled_playback (self->output->videosink);
+  g_mutex_unlock (&self->output->lock);
+
+  return TRUE;
+}
+
+static GstCaps *
+gst_decklink_video_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink);
+  GstCaps *mode_caps, *caps;
+
+  mode_caps = gst_decklink_mode_get_caps (self->mode);
+  if (filter) {
+    caps =
+        gst_caps_intersect_full (filter, mode_caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (mode_caps);
+  } else {
+    caps = mode_caps;
+  }
+
+  return caps;
+}
+
+static GstFlowReturn
+gst_decklink_video_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
+{
+  return GST_FLOW_OK;
+}
+
+static void
+convert_to_internal_clock (GstDecklinkVideoSink * self,
+    GstClockTime * timestamp, GstClockTime * duration)
+{
+  GstClock *clock, *audio_clock;
+
+  g_assert (timestamp != NULL);
+
+  clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
+  audio_clock = gst_decklink_output_get_audio_clock (self->output);
+  if (clock && clock != self->output->clock && clock != audio_clock) {
+    GstClockTime internal, external, rate_n, rate_d;
+    gst_clock_get_calibration (self->output->clock, &internal, &external,
+        &rate_n, &rate_d);
+
+    if (rate_n != rate_d && self->internal_base_time != GST_CLOCK_TIME_NONE) {
+      GstClockTime external_timestamp = *timestamp;
+
+      // Convert to the running time corresponding to both clock times
+      internal -= self->internal_base_time;
+      external -= self->external_base_time;
+
+      // Get the difference in the external time, note
+      // that the running time is external time.
+      // Then scale this difference and offset it to
+      // our internal time. Now we have the running time
+      // according to our internal clock.
+      //
+      // For the duration we just scale
+      if (external > external_timestamp) {
+        guint64 diff = external - external_timestamp;
+        diff = gst_util_uint64_scale (diff, rate_d, rate_n);
+        *timestamp = internal - diff;
+      } else {
+        guint64 diff = external_timestamp - external;
+        diff = gst_util_uint64_scale (diff, rate_d, rate_n);
+        *timestamp = internal + diff;
+      }
+
+      GST_LOG_OBJECT (self,
+          "Converted %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " (internal: %"
+          GST_TIME_FORMAT " external %" GST_TIME_FORMAT " rate: %lf)",
+          GST_TIME_ARGS (external_timestamp), GST_TIME_ARGS (*timestamp),
+          GST_TIME_ARGS (internal), GST_TIME_ARGS (external),
+          ((gdouble) rate_n) / ((gdouble) rate_d));
+
+      if (duration) {
+        GstClockTime external_duration = *duration;
+
+        *duration = gst_util_uint64_scale (external_duration, rate_d, rate_n);
+
+        GST_LOG_OBJECT (self,
+            "Converted duration %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT
+            " (internal: %" GST_TIME_FORMAT " external %" GST_TIME_FORMAT
+            " rate: %lf)", GST_TIME_ARGS (external_duration),
+            GST_TIME_ARGS (*duration), GST_TIME_ARGS (internal),
+            GST_TIME_ARGS (external), ((gdouble) rate_n) / ((gdouble) rate_d));
+      }
+    } else {
+      GST_LOG_OBJECT (self, "No clock conversion needed, relative rate is 1.0");
+    }
+  } else {
+    GST_LOG_OBJECT (self, "No clock conversion needed, same clocks");
+  }
+}
+
+static GstFlowReturn
+gst_decklink_video_sink_prepare (GstBaseSink * bsink, GstBuffer * buffer)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink);
+  GstVideoFrame vframe;
+  IDeckLinkMutableVideoFrame *frame;
+  guint8 *outdata, *indata;
+  GstFlowReturn flow_ret;
+  HRESULT ret;
+  GstClockTime timestamp, duration;
+  GstClockTime running_time, running_time_duration;
+  gint i;
+  GstClock *clock;
+
+  GST_DEBUG_OBJECT (self, "Preparing buffer %p", buffer);
+
+  // FIXME: Handle no timestamps
+  if (!GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
+    return GST_FLOW_ERROR;
+  }
+
+  timestamp = GST_BUFFER_TIMESTAMP (buffer);
+  duration = GST_BUFFER_DURATION (buffer);
+  if (duration == GST_CLOCK_TIME_NONE) {
+    duration =
+        gst_util_uint64_scale_int (GST_SECOND, self->info.fps_d,
+        self->info.fps_n);
+  }
+  running_time =
+      gst_segment_to_running_time (&GST_BASE_SINK_CAST (self)->segment,
+      GST_FORMAT_TIME, timestamp);
+  running_time_duration =
+      gst_segment_to_running_time (&GST_BASE_SINK_CAST (self)->segment,
+      GST_FORMAT_TIME, timestamp + duration) - running_time;
+
+  // FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=742916
+  // We need to drop late buffers here immediately instead of
+  // potentially overflowing the internal queue of the hardware
+  clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
+  if (clock) {
+    GstClockTime clock_running_time, base_time, clock_time, latency,
+        max_lateness;
+
+    base_time = gst_element_get_base_time (GST_ELEMENT_CAST (self));
+    clock_time = gst_clock_get_time (clock);
+    if (base_time != GST_CLOCK_TIME_NONE && clock_time != GST_CLOCK_TIME_NONE) {
+      clock_running_time = clock_time - base_time;
+      latency = gst_base_sink_get_latency (GST_BASE_SINK_CAST (self));
+      max_lateness = gst_base_sink_get_max_lateness (GST_BASE_SINK_CAST (self));
+
+      if (clock_running_time >
+          running_time + running_time_duration + latency + max_lateness) {
+        GST_DEBUG_OBJECT (self,
+            "Late buffer: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (clock_running_time),
+            GST_TIME_ARGS (running_time + running_time_duration));
+
+        if (self->last_render_time == GST_CLOCK_TIME_NONE
+            || (self->last_render_time < clock_running_time
+                && clock_running_time - self->last_render_time >= GST_SECOND)) {
+          GST_DEBUG_OBJECT (self,
+              "Rendering frame nonetheless because we had none for more than 1s");
+          running_time = clock_running_time;
+          running_time_duration = 0;
+        } else {
+          GST_WARNING_OBJECT (self, "Dropping frame");
+          gst_object_unref (clock);
+          return GST_FLOW_OK;
+        }
+      }
+    }
+
+    gst_object_unref (clock);
+  }
+  self->last_render_time = running_time;
+
+  ret = self->output->output->CreateVideoFrame (self->info.width,
+      self->info.height, self->info.stride[0], bmdFormat8BitYUV,
+      bmdFrameFlagDefault, &frame);
+  if (ret != S_OK) {
+    GST_ELEMENT_ERROR (self, STREAM, FAILED,
+        (NULL), ("Failed to create video frame: 0x%08x", ret));
+    return GST_FLOW_ERROR;
+  }
+
+  if (!gst_video_frame_map (&vframe, &self->info, buffer, GST_MAP_READ)) {
+    GST_ERROR_OBJECT (self, "Failed to map video frame");
+    flow_ret = GST_FLOW_ERROR;
+    goto out;
+  }
+
+  frame->GetBytes ((void **) &outdata);
+  indata = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (&vframe, 0);
+  for (i = 0; i < self->info.height; i++) {
+    memcpy (outdata, indata, GST_VIDEO_FRAME_WIDTH (&vframe) * 2);
+    indata += GST_VIDEO_FRAME_PLANE_STRIDE (&vframe, 0);
+    outdata += frame->GetRowBytes ();
+  }
+  gst_video_frame_unmap (&vframe);
+
+  convert_to_internal_clock (self, &running_time, &running_time_duration);
+
+  GST_LOG_OBJECT (self, "Scheduling video frame %p at %" GST_TIME_FORMAT
+      " with duration %" GST_TIME_FORMAT, frame, GST_TIME_ARGS (running_time),
+      GST_TIME_ARGS (running_time_duration));
+
+  ret = self->output->output->ScheduleVideoFrame (frame,
+      running_time, running_time_duration, GST_SECOND);
+  if (ret != S_OK) {
+    GST_ELEMENT_ERROR (self, STREAM, FAILED,
+        (NULL), ("Failed to schedule frame: 0x%08x", ret));
+    flow_ret = GST_FLOW_ERROR;
+    goto out;
+  }
+
+  flow_ret = GST_FLOW_OK;
+
+out:
+
+  frame->Release ();
+
+  return flow_ret;
+}
+
+static gboolean
+gst_decklink_video_sink_open (GstBaseSink * bsink)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink);
+  const GstDecklinkMode *mode;
+
+  GST_DEBUG_OBJECT (self, "Starting");
+
+  self->output =
+      gst_decklink_acquire_nth_output (self->device_number,
+      GST_ELEMENT_CAST (self), FALSE);
+  if (!self->output) {
+    GST_ERROR_OBJECT (self, "Failed to acquire output");
+    return FALSE;
+  }
+
+  mode = gst_decklink_get_mode (self->mode);
+  g_assert (mode != NULL);
+
+  g_mutex_lock (&self->output->lock);
+  self->output->mode = mode;
+  self->output->start_scheduled_playback =
+      gst_decklink_video_sink_start_scheduled_playback;
+  self->output->clock_start_time = GST_CLOCK_TIME_NONE;
+  self->output->clock_last_time = 0;
+  self->output->clock_offset = 0;
+  g_mutex_unlock (&self->output->lock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_video_sink_close (GstBaseSink * bsink)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink);
+
+  GST_DEBUG_OBJECT (self, "Stopping");
+
+  if (self->output) {
+    g_mutex_lock (&self->output->lock);
+    self->output->mode = NULL;
+    self->output->video_enabled = FALSE;
+    if (self->output->start_scheduled_playback)
+      self->output->start_scheduled_playback (self->output->videosink);
+    g_mutex_unlock (&self->output->lock);
+
+    self->output->output->DisableVideoOutput ();
+    self->output->output->SetScheduledFrameCompletionCallback (NULL);
+    gst_decklink_release_nth_output (self->device_number,
+        GST_ELEMENT_CAST (self), FALSE);
+    self->output = NULL;
+  }
+
+  return TRUE;
+}
+
+static void
+gst_decklink_video_sink_start_scheduled_playback (GstElement * element)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (element);
+  GstClockTime start_time;
+  HRESULT res;
+  bool active;
+
+  if (self->output->video_enabled && (!self->output->audiosink
+          || self->output->audio_enabled)
+      && (GST_STATE (self) == GST_STATE_PLAYING
+          || GST_STATE_PENDING (self) == GST_STATE_PLAYING)) {
+    // Need to unlock to get the clock time
+    g_mutex_unlock (&self->output->lock);
+
+    // FIXME: start time is the same for the complete pipeline,
+    // but what we need here is the start time of this element!
+    start_time = gst_element_get_base_time (element);
+    if (start_time != GST_CLOCK_TIME_NONE)
+      start_time = gst_clock_get_time (GST_ELEMENT_CLOCK (self)) - start_time;
+
+    // FIXME: This will probably not work
+    if (start_time == GST_CLOCK_TIME_NONE)
+      start_time = 0;
+
+    // Current times of internal and external clock when we go to
+    // playing. We need this to convert the pipeline running time
+    // to the running time of the hardware
+    //
+    // We can't use the normal base time for the external clock
+    // because we might go to PLAYING later than the pipeline
+    self->internal_base_time =
+        gst_clock_get_internal_time (self->output->clock);
+    self->external_base_time =
+        gst_clock_get_internal_time (GST_ELEMENT_CLOCK (self));
+
+    convert_to_internal_clock (self, &start_time, NULL);
+
+    g_mutex_lock (&self->output->lock);
+    // Check if someone else started in the meantime
+    if (self->output->started)
+      return;
+
+    active = false;
+    self->output->output->IsScheduledPlaybackRunning (&active);
+    if (active) {
+      GST_DEBUG_OBJECT (self, "Stopping scheduled playback");
+
+      self->output->started = FALSE;
+
+      res = self->output->output->StopScheduledPlayback (0, 0, 0);
+      if (res != S_OK) {
+        GST_ELEMENT_ERROR (self, STREAM, FAILED,
+            (NULL), ("Failed to stop scheduled playback: 0x%08x", res));
+        return;
+      }
+    }
+
+    GST_DEBUG_OBJECT (self,
+        "Starting scheduled playback at %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (start_time));
+
+    res =
+        self->output->output->StartScheduledPlayback (start_time,
+        GST_SECOND, 1.0);
+    if (res != S_OK) {
+      GST_ELEMENT_ERROR (self, STREAM, FAILED,
+          (NULL), ("Failed to start scheduled playback: 0x%08x", res));
+      return;
+    }
+
+    self->output->started = TRUE;
+    self->output->clock_restart = TRUE;
+
+    // Need to unlock to get the clock time
+    g_mutex_unlock (&self->output->lock);
+
+    // Sample the clocks again to get the most accurate values
+    // after we started scheduled playback
+    self->internal_base_time =
+        gst_clock_get_internal_time (self->output->clock);
+    self->external_base_time =
+        gst_clock_get_internal_time (GST_ELEMENT_CLOCK (self));
+    g_mutex_lock (&self->output->lock);
+  } else {
+    GST_DEBUG_OBJECT (self, "Not starting scheduled playback yet");
+  }
+}
+
+static GstStateChangeReturn
+gst_decklink_video_sink_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (element);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      g_mutex_lock (&self->output->lock);
+      self->output->clock_start_time = GST_CLOCK_TIME_NONE;
+      self->output->clock_last_time = 0;
+      self->output->clock_offset = 0;
+      g_mutex_unlock (&self->output->lock);
+      gst_element_post_message (element,
+          gst_message_new_clock_provide (GST_OBJECT_CAST (element),
+              self->output->clock, TRUE));
+      self->last_render_time = GST_CLOCK_TIME_NONE;
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:{
+      GstClock *clock, *audio_clock;
+
+      clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
+      audio_clock = gst_decklink_output_get_audio_clock (self->output);
+      if (clock && clock != self->output->clock && clock != audio_clock) {
+        gst_clock_set_master (self->output->clock, clock);
+      }
+      if (clock)
+        gst_object_unref (clock);
+      if (audio_clock)
+        gst_object_unref (audio_clock);
+
+      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_PAUSED_TO_READY:
+      gst_element_post_message (element,
+          gst_message_new_clock_lost (GST_OBJECT_CAST (element),
+              self->output->clock));
+      gst_clock_set_master (self->output->clock, NULL);
+      // Reset calibration to make the clock reusable next time we use it
+      gst_clock_set_calibration (self->output->clock, 0, 0, 1, 1);
+      g_mutex_lock (&self->output->lock);
+      self->output->clock_start_time = GST_CLOCK_TIME_NONE;
+      self->output->clock_last_time = 0;
+      self->output->clock_offset = 0;
+      g_mutex_unlock (&self->output->lock);
+      break;
+    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:{
+      GstClockTime start_time;
+      HRESULT res;
+
+      // FIXME: start time is the same for the complete pipeline,
+      // but what we need here is the start time of this element!
+      start_time = gst_element_get_base_time (element);
+      if (start_time != GST_CLOCK_TIME_NONE)
+        start_time = gst_clock_get_time (GST_ELEMENT_CLOCK (self)) - start_time;
+
+      // FIXME: This will probably not work
+      if (start_time == GST_CLOCK_TIME_NONE)
+        start_time = 0;
+
+      convert_to_internal_clock (self, &start_time, NULL);
+
+      // The start time is now the running time when we stopped
+      // playback
+
+      GST_DEBUG_OBJECT (self,
+          "Stopping scheduled playback at %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (start_time));
+
+      g_mutex_lock (&self->output->lock);
+      self->output->started = FALSE;
+      g_mutex_unlock (&self->output->lock);
+      res =
+          self->output->output->StopScheduledPlayback (start_time, 0,
+          GST_SECOND);
+      if (res != S_OK) {
+        GST_ELEMENT_ERROR (self, STREAM, FAILED,
+            (NULL), ("Failed to stop scheduled playback: 0x%08x", res));
+        ret = GST_STATE_CHANGE_FAILURE;
+      }
+      self->internal_base_time = GST_CLOCK_TIME_NONE;
+      self->external_base_time = GST_CLOCK_TIME_NONE;
+      break;
+    }
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:{
+      g_mutex_lock (&self->output->lock);
+      if (self->output->start_scheduled_playback)
+        self->output->start_scheduled_playback (self->output->videosink);
+      g_mutex_unlock (&self->output->lock);
+      break;
+    }
+    default:
+      break;
+  }
+
+  return ret;
+}
+
+static GstClock *
+gst_decklink_video_sink_provide_clock (GstElement * element)
+{
+  GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (element);
+
+  if (!self->output)
+    return NULL;
+
+  return GST_CLOCK_CAST (gst_object_ref (self->output->clock));
+}
+
+static gboolean
+gst_decklink_video_sink_propose_allocation (GstBaseSink * bsink,
+    GstQuery * query)
+{
+  GstCaps *caps;
+  GstVideoInfo info;
+  GstBufferPool *pool;
+  guint size;
+
+  gst_query_parse_allocation (query, &caps, NULL);
+
+  if (caps == NULL)
+    return FALSE;
+
+  if (!gst_video_info_from_caps (&info, caps))
+    return FALSE;
+
+  size = GST_VIDEO_INFO_SIZE (&info);
+
+  if (gst_query_get_n_allocation_pools (query) == 0) {
+    GstStructure *structure;
+    GstAllocator *allocator = NULL;
+    GstAllocationParams params = { (GstMemoryFlags) 0, 15, 0, 0 };
+
+    if (gst_query_get_n_allocation_params (query) > 0)
+      gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
+    else
+      gst_query_add_allocation_param (query, allocator, &params);
+
+    pool = gst_video_buffer_pool_new ();
+
+    structure = gst_buffer_pool_get_config (pool);
+    gst_buffer_pool_config_set_params (structure, caps, size, 0, 0);
+    gst_buffer_pool_config_set_allocator (structure, allocator, &params);
+
+    if (allocator)
+      gst_object_unref (allocator);
+
+    if (!gst_buffer_pool_set_config (pool, structure))
+      goto config_failed;
+
+    gst_query_add_allocation_pool (query, pool, size, 0, 0);
+    gst_object_unref (pool);
+    gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
+  }
+
+  return TRUE;
+  // ERRORS
+config_failed:
+  {
+    GST_ERROR_OBJECT (bsink, "failed to set config");
+    gst_object_unref (pool);
+    return FALSE;
+  }
+}
diff --git a/sys/decklink/gstdecklinkvideosink.h b/sys/decklink/gstdecklinkvideosink.h
new file mode 100644
index 0000000..04d5c97
--- /dev/null
+++ b/sys/decklink/gstdecklinkvideosink.h
@@ -0,0 +1,73 @@
+/* GStreamer
+ *
+ * Copyright (C) 2011 David Schleef <ds@schleef.org>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_DECKLINK_VIDEO_SINK_H__
+#define __GST_DECKLINK_VIDEO_SINK_H__
+
+#include <gst/gst.h>
+#include <gst/base/base.h>
+#include <gst/video/video.h>
+#include "gstdecklink.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DECKLINK_VIDEO_SINK \
+  (gst_decklink_video_sink_get_type())
+#define GST_DECKLINK_VIDEO_SINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DECKLINK_VIDEO_SINK, GstDecklinkVideoSink))
+#define GST_DECKLINK_VIDEO_SINK_CAST(obj) \
+  ((GstDecklinkVideoSink*)obj)
+#define GST_DECKLINK_VIDEO_SINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DECKLINK_VIDEO_SINK, GstDecklinkVideoSinkClass))
+#define GST_IS_DECKLINK_VIDEO_SINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DECKLINK_VIDEO_SINK))
+#define GST_IS_DECKLINK_VIDEO_SINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DECKLINK_VIDEO_SINK))
+
+typedef struct _GstDecklinkVideoSink GstDecklinkVideoSink;
+typedef struct _GstDecklinkVideoSinkClass GstDecklinkVideoSinkClass;
+
+struct _GstDecklinkVideoSink
+{
+  GstBaseSink parent;
+
+  GstDecklinkModeEnum mode;
+  gint device_number;
+
+  GstVideoInfo info;
+
+  GstClockTime internal_base_time;
+  GstClockTime external_base_time;
+  GstClockTime last_render_time;
+
+  GstDecklinkOutput *output;
+};
+
+struct _GstDecklinkVideoSinkClass
+{
+  GstBaseSinkClass parent_class;
+};
+
+GType gst_decklink_video_sink_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_DECKLINK_VIDEO_SINK_H__ */
diff --git a/sys/decklink/gstdecklinkvideosrc.cpp b/sys/decklink/gstdecklinkvideosrc.cpp
new file mode 100644
index 0000000..0432e8c
--- /dev/null
+++ b/sys/decklink/gstdecklinkvideosrc.cpp
@@ -0,0 +1,826 @@
+/* GStreamer
+ * Copyright (C) 2011 David Schleef <ds@entropywave.com>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.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., 51 Franklin Street, Suite 500,
+ * Boston, MA 02110-1335, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstdecklinkvideosrc.h"
+#include <string.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_decklink_video_src_debug);
+#define GST_CAT_DEFAULT gst_decklink_video_src_debug
+
+#define DEFAULT_MODE (GST_DECKLINK_MODE_AUTO)
+#define DEFAULT_CONNECTION (GST_DECKLINK_CONNECTION_AUTO)
+#define DEFAULT_BUFFER_SIZE (5)
+
+enum
+{
+  PROP_0,
+  PROP_MODE,
+  PROP_CONNECTION,
+  PROP_DEVICE_NUMBER,
+  PROP_BUFFER_SIZE
+};
+
+typedef struct
+{
+  IDeckLinkVideoInputFrame *frame;
+  GstClockTime capture_time, capture_duration;
+  GstDecklinkModeEnum mode;
+} CaptureFrame;
+
+static void
+capture_frame_free (void *data)
+{
+  CaptureFrame *frame = (CaptureFrame *) data;
+
+  frame->frame->Release ();
+  g_free (frame);
+}
+
+typedef struct
+{
+  IDeckLinkVideoInputFrame *frame;
+  IDeckLinkInput *input;
+} VideoFrame;
+
+static void
+video_frame_free (void *data)
+{
+  VideoFrame *frame = (VideoFrame *) data;
+
+  frame->frame->Release ();
+  frame->input->Release ();
+  g_free (frame);
+}
+
+static void gst_decklink_video_src_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec);
+static void gst_decklink_video_src_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec);
+static void gst_decklink_video_src_finalize (GObject * object);
+
+static GstStateChangeReturn
+gst_decklink_video_src_change_state (GstElement * element,
+    GstStateChange transition);
+static GstClock *gst_decklink_video_src_provide_clock (GstElement * element);
+
+static gboolean gst_decklink_video_src_set_caps (GstBaseSrc * bsrc,
+    GstCaps * caps);
+static GstCaps *gst_decklink_video_src_get_caps (GstBaseSrc * bsrc,
+    GstCaps * filter);
+static gboolean gst_decklink_video_src_query (GstBaseSrc * bsrc,
+    GstQuery * query);
+static gboolean gst_decklink_video_src_unlock (GstBaseSrc * bsrc);
+static gboolean gst_decklink_video_src_unlock_stop (GstBaseSrc * bsrc);
+
+static GstFlowReturn gst_decklink_video_src_create (GstPushSrc * psrc,
+    GstBuffer ** buffer);
+
+static gboolean gst_decklink_video_src_open (GstDecklinkVideoSrc * self);
+static gboolean gst_decklink_video_src_close (GstDecklinkVideoSrc * self);
+
+static void gst_decklink_video_src_start_streams (GstElement * element);
+
+#define parent_class gst_decklink_video_src_parent_class
+G_DEFINE_TYPE (GstDecklinkVideoSrc, gst_decklink_video_src, GST_TYPE_PUSH_SRC);
+
+static void
+gst_decklink_video_src_class_init (GstDecklinkVideoSrcClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+  GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass);
+  GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
+  GstCaps *templ_caps;
+
+  gobject_class->set_property = gst_decklink_video_src_set_property;
+  gobject_class->get_property = gst_decklink_video_src_get_property;
+  gobject_class->finalize = gst_decklink_video_src_finalize;
+
+  element_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_src_change_state);
+  element_class->provide_clock =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_src_provide_clock);
+
+  basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_src_get_caps);
+  basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_src_set_caps);
+  basesrc_class->query = GST_DEBUG_FUNCPTR (gst_decklink_video_src_query);
+  basesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_decklink_video_src_unlock);
+  basesrc_class->unlock_stop =
+      GST_DEBUG_FUNCPTR (gst_decklink_video_src_unlock_stop);
+
+  pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_decklink_video_src_create);
+
+  g_object_class_install_property (gobject_class, PROP_MODE,
+      g_param_spec_enum ("mode", "Playback Mode",
+          "Video Mode to use for playback",
+          GST_TYPE_DECKLINK_MODE, DEFAULT_MODE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  g_object_class_install_property (gobject_class, PROP_CONNECTION,
+      g_param_spec_enum ("connection", "Connection",
+          "Video input connection to use",
+          GST_TYPE_DECKLINK_CONNECTION, DEFAULT_CONNECTION,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER,
+      g_param_spec_int ("device-number", "Device number",
+          "Output device instance to use", 0, G_MAXINT, 0,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+              G_PARAM_CONSTRUCT)));
+
+  g_object_class_install_property (gobject_class, PROP_BUFFER_SIZE,
+      g_param_spec_uint ("buffer-size", "Buffer Size",
+          "Size of internal buffer in number of video frames", 1,
+          G_MAXINT, DEFAULT_BUFFER_SIZE,
+          (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+  templ_caps = gst_decklink_mode_get_template_caps ();
+  gst_element_class_add_pad_template (element_class,
+      gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, templ_caps));
+  gst_caps_unref (templ_caps);
+
+  gst_element_class_set_static_metadata (element_class, "Decklink Video Source",
+      "Video/Src", "Decklink Source", "David Schleef <ds@entropywave.com>, "
+      "Sebastian Dröge <sebastian@centricular.com>");
+
+  GST_DEBUG_CATEGORY_INIT (gst_decklink_video_src_debug, "decklinkvideosrc",
+      0, "debug category for decklinkvideosrc element");
+}
+
+static void
+gst_decklink_video_src_init (GstDecklinkVideoSrc * self)
+{
+  self->mode = DEFAULT_MODE;
+  self->caps_mode = GST_DECKLINK_MODE_AUTO;
+  self->connection = DEFAULT_CONNECTION;
+  self->device_number = 0;
+  self->buffer_size = DEFAULT_BUFFER_SIZE;
+
+  gst_base_src_set_live (GST_BASE_SRC (self), TRUE);
+  gst_base_src_set_format (GST_BASE_SRC (self), GST_FORMAT_TIME);
+
+  g_mutex_init (&self->lock);
+  g_cond_init (&self->cond);
+
+  g_queue_init (&self->current_frames);
+}
+
+void
+gst_decklink_video_src_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (object);
+
+  switch (property_id) {
+    case PROP_MODE:
+      self->mode = (GstDecklinkModeEnum) g_value_get_enum (value);
+      break;
+    case PROP_CONNECTION:
+      self->connection = (GstDecklinkConnectionEnum) g_value_get_enum (value);
+      break;
+    case PROP_DEVICE_NUMBER:
+      self->device_number = g_value_get_int (value);
+      break;
+    case PROP_BUFFER_SIZE:
+      self->buffer_size = g_value_get_uint (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_video_src_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (object);
+
+  switch (property_id) {
+    case PROP_MODE:
+      g_value_set_enum (value, self->mode);
+      break;
+    case PROP_CONNECTION:
+      g_value_set_enum (value, self->connection);
+      break;
+    case PROP_DEVICE_NUMBER:
+      g_value_set_int (value, self->device_number);
+      break;
+    case PROP_BUFFER_SIZE:
+      g_value_set_uint (value, self->buffer_size);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+void
+gst_decklink_video_src_finalize (GObject * object)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (object);
+
+  g_mutex_clear (&self->lock);
+  g_cond_clear (&self->cond);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+gst_decklink_video_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (bsrc);
+  GstCaps *current_caps;
+  const GstDecklinkMode *mode;
+  BMDVideoInputFlags flags;
+  HRESULT ret;
+
+  GST_DEBUG_OBJECT (self, "Setting caps %" GST_PTR_FORMAT, caps);
+
+  if ((current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (bsrc)))) {
+    GST_DEBUG_OBJECT (self, "Pad already has caps %" GST_PTR_FORMAT, caps);
+
+    if (!gst_caps_is_equal (caps, current_caps)) {
+      GST_ERROR_OBJECT (self, "New caps are not equal to old caps");
+      gst_caps_unref (current_caps);
+      return FALSE;
+    } else {
+      gst_caps_unref (current_caps);
+      return TRUE;
+    }
+  }
+
+  if (!gst_video_info_from_caps (&self->info, caps))
+    return FALSE;
+
+  if (self->input->config && self->connection != GST_DECKLINK_CONNECTION_AUTO) {
+    ret = self->input->config->SetInt (bmdDeckLinkConfigVideoInputConnection,
+        gst_decklink_get_connection (self->connection));
+    if (ret != S_OK) {
+      GST_ERROR_OBJECT (self, "Failed to set configuration (input source)");
+      return FALSE;
+    }
+
+    if (self->connection == GST_DECKLINK_CONNECTION_COMPOSITE) {
+      ret = self->input->config->SetInt (bmdDeckLinkConfigAnalogVideoInputFlags,
+          bmdAnalogVideoFlagCompositeSetup75);
+      if (ret != S_OK) {
+        GST_ERROR_OBJECT (self,
+            "Failed to set configuration (composite setup)");
+        return FALSE;
+      }
+    }
+  }
+
+  flags = bmdVideoInputFlagDefault;
+  if (self->mode == GST_DECKLINK_MODE_AUTO) {
+    bool autoDetection = false;
+
+    if (self->input->attributes) {
+      ret =
+          self->input->
+          attributes->GetFlag (BMDDeckLinkSupportsInputFormatDetection,
+          &autoDetection);
+      if (ret != S_OK) {
+        GST_ERROR_OBJECT (self, "Failed to get attribute (autodetection)");
+        return FALSE;
+      }
+      if (autoDetection)
+        flags |= bmdVideoInputEnableFormatDetection;
+    }
+    if (!autoDetection) {
+      GST_ERROR_OBJECT (self, "Failed to activate auto-detection");
+      return FALSE;
+    }
+  }
+
+  mode = gst_decklink_get_mode (self->mode);
+  g_assert (mode != NULL);
+
+  ret = self->input->input->EnableVideoInput (mode->mode,
+      bmdFormat8BitYUV, flags);
+  if (ret != S_OK) {
+    GST_WARNING_OBJECT (self, "Failed to enable video input");
+    return FALSE;
+  }
+
+  g_mutex_lock (&self->input->lock);
+  self->input->mode = mode;
+  self->input->video_enabled = TRUE;
+  if (self->input->start_streams)
+    self->input->start_streams (self->input->videosrc);
+  g_mutex_unlock (&self->input->lock);
+
+  return TRUE;
+}
+
+static GstCaps *
+gst_decklink_video_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (bsrc);
+  GstCaps *mode_caps, *caps;
+
+  g_mutex_lock (&self->lock);
+  if (self->caps_mode != GST_DECKLINK_MODE_AUTO)
+    mode_caps = gst_decklink_mode_get_caps (self->caps_mode);
+  else
+    mode_caps = gst_decklink_mode_get_caps (self->mode);
+  g_mutex_unlock (&self->lock);
+
+  if (filter) {
+    caps =
+        gst_caps_intersect_full (filter, mode_caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (mode_caps);
+  } else {
+    caps = mode_caps;
+  }
+
+  return caps;
+}
+
+void
+gst_decklink_video_src_convert_to_external_clock (GstDecklinkVideoSrc * self,
+    GstClockTime * timestamp, GstClockTime * duration)
+{
+  GstClock *clock;
+
+  g_assert (timestamp != NULL);
+
+  if (*timestamp == GST_CLOCK_TIME_NONE)
+    return;
+
+  clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
+  if (clock && clock != self->input->clock) {
+    GstClockTime internal, external, rate_n, rate_d;
+    GstClockTimeDiff external_start_time_diff;
+
+    gst_clock_get_calibration (self->input->clock, &internal, &external,
+        &rate_n, &rate_d);
+
+    if (rate_n != rate_d && self->internal_base_time != GST_CLOCK_TIME_NONE) {
+      GstClockTime internal_timestamp = *timestamp;
+
+      // Convert to the running time corresponding to both clock times
+      internal -= self->internal_base_time;
+      external -= self->external_base_time;
+
+      // Get the difference in the internal time, note
+      // that the capture time is internal time.
+      // Then scale this difference and offset it to
+      // our external time. Now we have the running time
+      // according to our external clock.
+      //
+      // For the duration we just scale
+      if (internal > internal_timestamp) {
+        guint64 diff = internal - internal_timestamp;
+        diff = gst_util_uint64_scale (diff, rate_n, rate_d);
+        *timestamp = external - diff;
+      } else {
+        guint64 diff = internal_timestamp - internal;
+        diff = gst_util_uint64_scale (diff, rate_n, rate_d);
+        *timestamp = external + diff;
+      }
+
+      GST_LOG_OBJECT (self,
+          "Converted %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " (external: %"
+          GST_TIME_FORMAT " internal %" GST_TIME_FORMAT " rate: %lf)",
+          GST_TIME_ARGS (internal_timestamp), GST_TIME_ARGS (*timestamp),
+          GST_TIME_ARGS (external), GST_TIME_ARGS (internal),
+          ((gdouble) rate_n) / ((gdouble) rate_d));
+
+      if (duration) {
+        GstClockTime internal_duration = *duration;
+
+        *duration = gst_util_uint64_scale (internal_duration, rate_d, rate_n);
+
+        GST_LOG_OBJECT (self,
+            "Converted duration %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT
+            " (external: %" GST_TIME_FORMAT " internal %" GST_TIME_FORMAT
+            " rate: %lf)", GST_TIME_ARGS (internal_duration),
+            GST_TIME_ARGS (*duration), GST_TIME_ARGS (external),
+            GST_TIME_ARGS (internal), ((gdouble) rate_n) / ((gdouble) rate_d));
+      }
+    } else {
+      GST_LOG_OBJECT (self, "No clock conversion needed, relative rate is 1.0");
+    }
+
+    // Add the diff between the external time when we
+    // went to playing and the external time when the
+    // pipeline went to playing. Otherwise we will
+    // always start outputting from 0 instead of the
+    // current running time.
+    external_start_time_diff =
+        gst_element_get_base_time (GST_ELEMENT_CAST (self));
+    external_start_time_diff =
+        self->external_base_time - external_start_time_diff;
+    *timestamp += external_start_time_diff;
+  } else {
+    GST_LOG_OBJECT (self, "No clock conversion needed, same clocks");
+  }
+}
+
+static void
+gst_decklink_video_src_got_frame (GstElement * element,
+    IDeckLinkVideoInputFrame * frame, GstDecklinkModeEnum mode,
+    GstClockTime capture_time, GstClockTime capture_duration)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (element);
+
+  GST_LOG_OBJECT (self, "Got video frame at %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (capture_time));
+
+  gst_decklink_video_src_convert_to_external_clock (self, &capture_time,
+      &capture_duration);
+
+  GST_LOG_OBJECT (self, "Actual timestamp %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (capture_time));
+
+  g_mutex_lock (&self->lock);
+  if (!self->flushing) {
+    CaptureFrame *f;
+
+    while (g_queue_get_length (&self->current_frames) >= self->buffer_size) {
+      f = (CaptureFrame *) g_queue_pop_head (&self->current_frames);
+      GST_WARNING_OBJECT (self, "Dropping old frame at %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (f->capture_time));
+      capture_frame_free (f);
+    }
+
+    f = (CaptureFrame *) g_malloc0 (sizeof (CaptureFrame));
+    f->frame = frame;
+    f->capture_time = capture_time;
+    f->capture_duration = capture_duration;
+    f->mode = mode;
+    frame->AddRef ();
+    g_queue_push_tail (&self->current_frames, f);
+    g_cond_signal (&self->cond);
+  }
+  g_mutex_unlock (&self->lock);
+}
+
+static GstFlowReturn
+gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (bsrc);
+  GstFlowReturn flow_ret = GST_FLOW_OK;
+  const guint8 *data;
+  gsize data_size;
+  VideoFrame *vf;
+  CaptureFrame *f;
+  GstCaps *caps;
+
+  g_mutex_lock (&self->lock);
+  while (g_queue_is_empty (&self->current_frames) && !self->flushing) {
+    g_cond_wait (&self->cond, &self->lock);
+  }
+
+  f = (CaptureFrame *) g_queue_pop_head (&self->current_frames);
+  g_mutex_unlock (&self->lock);
+
+  if (self->flushing) {
+    if (f)
+      capture_frame_free (f);
+    GST_DEBUG_OBJECT (self, "Flushing");
+    return GST_FLOW_FLUSHING;
+  }
+
+  g_mutex_lock (&self->lock);
+  if (self->mode == GST_DECKLINK_MODE_AUTO && self->caps_mode != f->mode) {
+    GST_DEBUG_OBJECT (self, "Mode changed from %d to %d", self->caps_mode,
+        f->mode);
+    self->caps_mode = f->mode;
+    g_mutex_unlock (&self->lock);
+    g_mutex_lock (&self->input->lock);
+    self->input->mode = gst_decklink_get_mode (f->mode);
+    g_mutex_unlock (&self->input->lock);
+    caps = gst_decklink_mode_get_caps (f->mode);
+    gst_video_info_from_caps (&self->info, caps);
+    gst_base_src_set_caps (GST_BASE_SRC_CAST (bsrc), caps);
+    gst_element_post_message (GST_ELEMENT_CAST (self),
+        gst_message_new_latency (GST_OBJECT_CAST (self)));
+    gst_caps_unref (caps);
+  } else {
+    g_mutex_unlock (&self->lock);
+  }
+
+  f->frame->GetBytes ((gpointer *) & data);
+  data_size = self->info.size;
+
+  vf = (VideoFrame *) g_malloc0 (sizeof (VideoFrame));
+
+  *buffer =
+      gst_buffer_new_wrapped_full ((GstMemoryFlags) GST_MEMORY_FLAG_READONLY,
+      (gpointer) data, data_size, 0, data_size, vf,
+      (GDestroyNotify) video_frame_free);
+
+  vf->frame = f->frame;
+  f->frame->AddRef ();
+  vf->input = self->input->input;
+  vf->input->AddRef ();
+
+  GST_BUFFER_TIMESTAMP (*buffer) = f->capture_time;
+  GST_BUFFER_DURATION (*buffer) = f->capture_duration;
+
+  GST_DEBUG_OBJECT (self,
+      "Outputting buffer %p with timestamp %" GST_TIME_FORMAT " and duration %"
+      GST_TIME_FORMAT, *buffer, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*buffer)),
+      GST_TIME_ARGS (GST_BUFFER_DURATION (*buffer)));
+
+  capture_frame_free (f);
+
+  return flow_ret;
+}
+
+static gboolean
+gst_decklink_video_src_query (GstBaseSrc * bsrc, GstQuery * query)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (bsrc);
+  gboolean ret = TRUE;
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_LATENCY:{
+      if (self->input) {
+        GstClockTime min, max;
+        const GstDecklinkMode *mode;
+
+        g_mutex_lock (&self->lock);
+        if (self->caps_mode != GST_DECKLINK_MODE_AUTO)
+          mode = gst_decklink_get_mode (self->caps_mode);
+        else
+          mode = gst_decklink_get_mode (self->mode);
+        g_mutex_unlock (&self->lock);
+
+        min = gst_util_uint64_scale_ceil (GST_SECOND, mode->fps_d, mode->fps_n);
+        max = self->buffer_size * min;
+
+        gst_query_set_latency (query, TRUE, min, max);
+        ret = TRUE;
+      } else {
+        ret = FALSE;
+      }
+
+      break;
+    }
+    default:
+      ret = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
+      break;
+  }
+
+  return ret;
+}
+
+static gboolean
+gst_decklink_video_src_unlock (GstBaseSrc * bsrc)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (bsrc);
+
+  g_mutex_lock (&self->lock);
+  self->flushing = TRUE;
+  g_cond_signal (&self->cond);
+  g_mutex_unlock (&self->lock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_video_src_unlock_stop (GstBaseSrc * bsrc)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (bsrc);
+
+  g_mutex_lock (&self->lock);
+  self->flushing = FALSE;
+  g_queue_foreach (&self->current_frames, (GFunc) capture_frame_free, NULL);
+  g_queue_clear (&self->current_frames);
+  g_mutex_unlock (&self->lock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_video_src_open (GstDecklinkVideoSrc * self)
+{
+  const GstDecklinkMode *mode;
+
+  GST_DEBUG_OBJECT (self, "Starting");
+
+  self->input =
+      gst_decklink_acquire_nth_input (self->device_number,
+      GST_ELEMENT_CAST (self), FALSE);
+  if (!self->input) {
+    GST_ERROR_OBJECT (self, "Failed to acquire input");
+    return FALSE;
+  }
+
+  mode = gst_decklink_get_mode (self->mode);
+  g_assert (mode != NULL);
+  g_mutex_lock (&self->input->lock);
+  self->input->mode = mode;
+  self->input->got_video_frame = gst_decklink_video_src_got_frame;
+  self->input->start_streams = gst_decklink_video_src_start_streams;
+  self->input->clock_start_time = GST_CLOCK_TIME_NONE;
+  self->input->clock_last_time = 0;
+  self->input->clock_offset = 0;
+  g_mutex_unlock (&self->input->lock);
+
+  return TRUE;
+}
+
+static gboolean
+gst_decklink_video_src_close (GstDecklinkVideoSrc * self)
+{
+
+  GST_DEBUG_OBJECT (self, "Stopping");
+
+  if (self->input) {
+    g_mutex_lock (&self->input->lock);
+    self->input->got_video_frame = NULL;
+    self->input->mode = NULL;
+    self->input->video_enabled = FALSE;
+    if (self->input->start_streams)
+      self->input->start_streams (self->input->videosrc);
+    g_mutex_unlock (&self->input->lock);
+
+    self->input->input->DisableVideoInput ();
+    gst_decklink_release_nth_input (self->device_number,
+        GST_ELEMENT_CAST (self), FALSE);
+    self->input = NULL;
+  }
+
+  return TRUE;
+}
+
+static void
+gst_decklink_video_src_start_streams (GstElement * element)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (element);
+  HRESULT res;
+
+  if (self->input->video_enabled && (!self->input->audiosrc
+          || self->input->audio_enabled)
+      && (GST_STATE (self) == GST_STATE_PLAYING
+          || GST_STATE_PENDING (self) == GST_STATE_PLAYING)) {
+    GST_DEBUG_OBJECT (self, "Starting streams");
+
+    res = self->input->input->StartStreams ();
+    if (res != S_OK) {
+      GST_ELEMENT_ERROR (self, STREAM, FAILED,
+          (NULL), ("Failed to start streams: 0x%08x", res));
+      return;
+    }
+
+    self->input->started = TRUE;
+    self->input->clock_restart = TRUE;
+
+    // Need to unlock to get the clock time
+    g_mutex_unlock (&self->input->lock);
+
+    // Current times of internal and external clock when we go to
+    // playing. We need this to convert the pipeline running time
+    // to the running time of the hardware
+    //
+    // We can't use the normal base time for the external clock
+    // because we might go to PLAYING later than the pipeline
+    self->internal_base_time = gst_clock_get_internal_time (self->input->clock);
+    self->external_base_time =
+        gst_clock_get_internal_time (GST_ELEMENT_CLOCK (self));
+
+    g_mutex_lock (&self->input->lock);
+  } else {
+    GST_DEBUG_OBJECT (self, "Not starting streams yet");
+  }
+}
+
+static GstStateChangeReturn
+gst_decklink_video_src_change_state (GstElement * element,
+    GstStateChange transition)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (element);
+  GstStateChangeReturn ret;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      if (!gst_decklink_video_src_open (self)) {
+        ret = GST_STATE_CHANGE_FAILURE;
+        goto out;
+      }
+      break;
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      g_mutex_lock (&self->input->lock);
+      self->input->clock_start_time = GST_CLOCK_TIME_NONE;
+      self->input->clock_last_time = 0;
+      self->input->clock_offset = 0;
+      g_mutex_unlock (&self->input->lock);
+      gst_element_post_message (element,
+          gst_message_new_clock_provide (GST_OBJECT_CAST (element),
+              self->input->clock, TRUE));
+      self->flushing = FALSE;
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:{
+      GstClock *clock;
+
+      clock = gst_element_get_clock (GST_ELEMENT_CAST (self));
+      if (clock && clock != self->input->clock) {
+        gst_clock_set_master (self->input->clock, clock);
+      }
+      if (clock)
+        gst_object_unref (clock);
+
+      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_PAUSED_TO_READY:
+      gst_element_post_message (element,
+          gst_message_new_clock_lost (GST_OBJECT_CAST (element),
+              self->input->clock));
+      gst_clock_set_master (self->input->clock, NULL);
+      // Reset calibration to make the clock reusable next time we use it
+      gst_clock_set_calibration (self->input->clock, 0, 0, 1, 1);
+      g_mutex_lock (&self->input->lock);
+      self->input->clock_start_time = GST_CLOCK_TIME_NONE;
+      self->input->clock_last_time = 0;
+      self->input->clock_offset = 0;
+      g_mutex_unlock (&self->input->lock);
+
+      g_queue_foreach (&self->current_frames, (GFunc) capture_frame_free, NULL);
+      g_queue_clear (&self->current_frames);
+      self->caps_mode = GST_DECKLINK_MODE_AUTO;
+      break;
+    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:{
+      HRESULT res;
+
+      GST_DEBUG_OBJECT (self, "Stopping streams");
+      g_mutex_lock (&self->input->lock);
+      self->input->started = FALSE;
+      g_mutex_unlock (&self->input->lock);
+
+      res = self->input->input->StopStreams ();
+      if (res != S_OK) {
+        GST_ELEMENT_ERROR (self, STREAM, FAILED,
+            (NULL), ("Failed to stop streams: 0x%08x", res));
+        ret = GST_STATE_CHANGE_FAILURE;
+      }
+      self->internal_base_time = GST_CLOCK_TIME_NONE;
+      self->external_base_time = GST_CLOCK_TIME_NONE;
+      break;
+    }
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:{
+      g_mutex_lock (&self->input->lock);
+      if (self->input->start_streams)
+        self->input->start_streams (self->input->videosrc);
+      g_mutex_unlock (&self->input->lock);
+
+      break;
+    }
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      gst_decklink_video_src_close (self);
+      break;
+    default:
+      break;
+  }
+out:
+
+  return ret;
+}
+
+static GstClock *
+gst_decklink_video_src_provide_clock (GstElement * element)
+{
+  GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (element);
+
+  if (!self->input)
+    return NULL;
+
+  return GST_CLOCK_CAST (gst_object_ref (self->input->clock));
+}
diff --git a/sys/decklink/gstdecklinkvideosrc.h b/sys/decklink/gstdecklinkvideosrc.h
new file mode 100644
index 0000000..6cb5bb9
--- /dev/null
+++ b/sys/decklink/gstdecklinkvideosrc.h
@@ -0,0 +1,84 @@
+/* GStreamer
+ *
+ * Copyright (C) 2011 David Schleef <ds@schleef.org>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
+ * Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GST_DECKLINK_VIDEO_SRC_H__
+#define __GST_DECKLINK_VIDEO_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/base/base.h>
+#include <gst/video/video.h>
+#include "gstdecklink.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_DECKLINK_VIDEO_SRC \
+  (gst_decklink_video_src_get_type())
+#define GST_DECKLINK_VIDEO_SRC(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DECKLINK_VIDEO_SRC, GstDecklinkVideoSrc))
+#define GST_DECKLINK_VIDEO_SRC_CAST(obj) \
+  ((GstDecklinkVideoSrc*)obj)
+#define GST_DECKLINK_VIDEO_SRC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DECKLINK_VIDEO_SRC, GstDecklinkVideoSrcClass))
+#define GST_IS_DECKLINK_VIDEO_SRC(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DECKLINK_VIDEO_SRC))
+#define GST_IS_DECKLINK_VIDEO_SRC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DECKLINK_VIDEO_SRC))
+
+typedef struct _GstDecklinkVideoSrc GstDecklinkVideoSrc;
+typedef struct _GstDecklinkVideoSrcClass GstDecklinkVideoSrcClass;
+
+struct _GstDecklinkVideoSrc
+{
+  GstPushSrc parent;
+
+  GstDecklinkModeEnum mode;
+  GstDecklinkModeEnum caps_mode;
+  GstDecklinkConnectionEnum connection;
+  gint device_number;
+
+  GstVideoInfo info;
+
+  GstDecklinkInput *input;
+
+  GCond cond;
+  GMutex lock;
+  gboolean flushing;
+  GQueue current_frames;
+
+  guint buffer_size;
+
+  GstClockTime internal_base_time;
+  GstClockTime external_base_time;
+};
+
+struct _GstDecklinkVideoSrcClass
+{
+  GstPushSrcClass parent_class;
+};
+
+GType gst_decklink_video_src_get_type (void);
+void gst_decklink_video_src_convert_to_external_clock (GstDecklinkVideoSrc * self,
+    GstClockTime * timestamp, GstClockTime * duration);
+
+G_END_DECLS
+
+#endif /* __GST_DECKLINK_VIDEO_SRC_H__ */
diff --git a/sys/decklink/linux/DeckLinkAPI.h b/sys/decklink/linux/DeckLinkAPI.h
index e9c1066..c46ed77 100644
--- a/sys/decklink/linux/DeckLinkAPI.h
+++ b/sys/decklink/linux/DeckLinkAPI.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -25,454 +25,252 @@
 ** -LICENSE-END-
 */
 
-/* DeckLinkAPI.h */
-		
-#ifndef __DeckLink_API_h__
-#define __DeckLink_API_h__
-		
+#ifndef BMD_DECKLINKAPI_H
+#define BMD_DECKLINKAPI_H
+
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
+/* DeckLink API */
+
 #include <stdint.h>
 #include "LinuxCOM.h"
 
+#include "DeckLinkAPITypes.h"
+#include "DeckLinkAPIModes.h"
+#include "DeckLinkAPIDiscovery.h"
+#include "DeckLinkAPIConfiguration.h"
+#include "DeckLinkAPIDeckControl.h"
+
 #define BLACKMAGIC_DECKLINK_API_MAGIC	1
 
 // Type Declarations
 
-typedef int64_t BMDTimeValue;
-typedef int64_t BMDTimeScale;
-typedef uint32_t BMDTimecodeBCD;
-typedef uint32_t BMDTimecodeUserBits;
-
 
 // Interface ID Declarations
 
-#define IID_IDeckLinkVideoOutputCallback                 /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ (REFIID){0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE}
-#define IID_IDeckLinkInputCallback                       /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ (REFIID){0xDD,0x04,0xE5,0xEC,0x74,0x15,0x42,0xAB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A}
-#define IID_IDeckLinkMemoryAllocator                     /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ (REFIID){0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8}
-#define IID_IDeckLinkAudioOutputCallback                 /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ (REFIID){0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6}
-#define IID_IDeckLinkIterator                            /* 74E936FC-CC28-4A67-81A0-1E94E52D4E69 */ (REFIID){0x74,0xE9,0x36,0xFC,0xCC,0x28,0x4A,0x67,0x81,0xA0,0x1E,0x94,0xE5,0x2D,0x4E,0x69}
-#define IID_IDeckLinkAPIInformation                      /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ (REFIID){0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4}
-#define IID_IDeckLinkDisplayModeIterator                 /* 9C88499F-F601-4021-B80B-032E4EB41C35 */ (REFIID){0x9C,0x88,0x49,0x9F,0xF6,0x01,0x40,0x21,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35}
-#define IID_IDeckLinkDisplayMode                         /* 3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78 */ (REFIID){0x3E,0xB2,0xC1,0xAB,0x0A,0x3D,0x45,0x23,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78}
-#define IID_IDeckLink                                    /* 62BFF75D-6569-4E55-8D4D-66AA03829ABC */ (REFIID){0x62,0xBF,0xF7,0x5D,0x65,0x69,0x4E,0x55,0x8D,0x4D,0x66,0xAA,0x03,0x82,0x9A,0xBC}
-#define IID_IDeckLinkOutput                              /* A3EF0963-0862-44ED-92A9-EE89ABF431C7 */ (REFIID){0xA3,0xEF,0x09,0x63,0x08,0x62,0x44,0xED,0x92,0xA9,0xEE,0x89,0xAB,0xF4,0x31,0xC7}
-#define IID_IDeckLinkInput                               /* 6D40EF78-28B9-4E21-990D-95BB7750A04F */ (REFIID){0x6D,0x40,0xEF,0x78,0x28,0xB9,0x4E,0x21,0x99,0x0D,0x95,0xBB,0x77,0x50,0xA0,0x4F}
-#define IID_IDeckLinkTimecode                            /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ (REFIID){0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40}
-#define IID_IDeckLinkVideoFrame                          /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ (REFIID){0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17}
-#define IID_IDeckLinkMutableVideoFrame                   /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ (REFIID){0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90}
-#define IID_IDeckLinkVideoFrame3DExtensions              /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ (REFIID){0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7}
-#define IID_IDeckLinkVideoInputFrame                     /* 05CFE374-537C-4094-9A57-680525118F44 */ (REFIID){0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44}
-#define IID_IDeckLinkVideoFrameAncillary                 /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ (REFIID){0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04}
-#define IID_IDeckLinkAudioInputPacket                    /* E43D5870-2894-11DE-8C30-0800200C9A66 */ (REFIID){0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66}
-#define IID_IDeckLinkScreenPreviewCallback               /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ (REFIID){0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38}
-#define IID_IDeckLinkGLScreenPreviewHelper               /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ (REFIID){0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F}
-#define IID_IDeckLinkConfiguration                       /* C679A35B-610C-4D09-B748-1D0478100FC0 */ (REFIID){0xC6,0x79,0xA3,0x5B,0x61,0x0C,0x4D,0x09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0}
-#define IID_IDeckLinkAttributes                          /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ (REFIID){0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4}
-#define IID_IDeckLinkKeyer                               /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ (REFIID){0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3}
-#define IID_IDeckLinkVideoConversion                     /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ (REFIID){0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A}
-#define IID_IDeckLinkDeckControlStatusCallback           /* E5F693C1-4283-4716-B18F-C1431521955B */ (REFIID){0xE5,0xF6,0x93,0xC1,0x42,0x83,0x47,0x16,0xB1,0x8F,0xC1,0x43,0x15,0x21,0x95,0x5B}
-#define IID_IDeckLinkDeckControl                         /* 522A9E39-0F3C-4742-94EE-D80DE335DA1D */ (REFIID){0x52,0x2A,0x9E,0x39,0x0F,0x3C,0x47,0x42,0x94,0xEE,0xD8,0x0D,0xE3,0x35,0xDA,0x1D}
-
-
-/* Enum BMDDisplayMode - Video display modes */
-
-typedef uint32_t BMDDisplayMode;
-enum _BMDDisplayMode {
-
-    /* SD Modes */
-
-    bmdModeNTSC                                        = /* 'ntsc' */ 0x6E747363,
-    bmdModeNTSC2398                                    = /* 'nt23' */ 0x6E743233,	// 3:2 pulldown
-    bmdModePAL                                         = /* 'pal ' */ 0x70616C20,
-    bmdModeNTSCp                                       = /* 'ntsp' */ 0x6E747370,
-    bmdModePALp                                        = /* 'palp' */ 0x70616C70,
-
-    /* HD 1080 Modes */
-
-    bmdModeHD1080p2398                                 = /* '23ps' */ 0x32337073,
-    bmdModeHD1080p24                                   = /* '24ps' */ 0x32347073,
-    bmdModeHD1080p25                                   = /* 'Hp25' */ 0x48703235,
-    bmdModeHD1080p2997                                 = /* 'Hp29' */ 0x48703239,
-    bmdModeHD1080p30                                   = /* 'Hp30' */ 0x48703330,
-    bmdModeHD1080i50                                   = /* 'Hi50' */ 0x48693530,
-    bmdModeHD1080i5994                                 = /* 'Hi59' */ 0x48693539,
-    bmdModeHD1080i6000                                 = /* 'Hi60' */ 0x48693630,	// N.B. This _really_ is 60.00 Hz.
-    bmdModeHD1080p50                                   = /* 'Hp50' */ 0x48703530,
-    bmdModeHD1080p5994                                 = /* 'Hp59' */ 0x48703539,
-    bmdModeHD1080p6000                                 = /* 'Hp60' */ 0x48703630,	// N.B. This _really_ is 60.00 Hz.
-
-    /* HD 720 Modes */
-
-    bmdModeHD720p50                                    = /* 'hp50' */ 0x68703530,
-    bmdModeHD720p5994                                  = /* 'hp59' */ 0x68703539,
-    bmdModeHD720p60                                    = /* 'hp60' */ 0x68703630,
-
-    /* 2k Modes */
-
-    bmdMode2k2398                                      = /* '2k23' */ 0x326B3233,
-    bmdMode2k24                                        = /* '2k24' */ 0x326B3234,
-    bmdMode2k25                                        = /* '2k25' */ 0x326B3235
-};
-
-
-/* Enum BMDFieldDominance - Video field dominance */
-
-typedef uint32_t BMDFieldDominance;
-enum _BMDFieldDominance {
-    bmdUnknownFieldDominance                           = 0,
-    bmdLowerFieldFirst                                 = /* 'lowr' */ 0x6C6F7772,
-    bmdUpperFieldFirst                                 = /* 'uppr' */ 0x75707072,
-    bmdProgressiveFrame                                = /* 'prog' */ 0x70726F67,
-    bmdProgressiveSegmentedFrame                       = /* 'psf ' */ 0x70736620
-};
-
-
-/* Enum BMDPixelFormat - Video pixel formats supported for output/input */
-
-typedef uint32_t BMDPixelFormat;
-enum _BMDPixelFormat {
-    bmdFormat8BitYUV                                   = /* '2vuy' */ 0x32767579,
-    bmdFormat10BitYUV                                  = /* 'v210' */ 0x76323130,
-    bmdFormat8BitARGB                                  = 32,
-    bmdFormat8BitBGRA                                  = /* 'BGRA' */ 0x42475241,
-    bmdFormat10BitRGB                                  = /* 'r210' */ 0x72323130	// Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10
-};
-
-
-/* Enum BMDDisplayModeFlags - Flags to describe the characteristics of an IDeckLinkDisplayMode. */
-
-typedef uint32_t BMDDisplayModeFlags;
-enum _BMDDisplayModeFlags {
-    bmdDisplayModeSupports3D                           = 1 << 0,
-    bmdDisplayModeColorspaceRec601                     = 1 << 1,
-    bmdDisplayModeColorspaceRec709                     = 1 << 2
-};
-
+BMD_CONST REFIID IID_IDeckLinkVideoOutputCallback                 = /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ {0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE};
+BMD_CONST REFIID IID_IDeckLinkInputCallback                       = /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ {0xDD,0x04,0xE5,0xEC,0x74,0x15,0x42,0xAB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A};
+BMD_CONST REFIID IID_IDeckLinkMemoryAllocator                     = /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ {0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8};
+BMD_CONST REFIID IID_IDeckLinkAudioOutputCallback                 = /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ {0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6};
+BMD_CONST REFIID IID_IDeckLinkIterator                            = /* 50FB36CD-3063-4B73-BDBB-958087F2D8BA */ {0x50,0xFB,0x36,0xCD,0x30,0x63,0x4B,0x73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA};
+BMD_CONST REFIID IID_IDeckLinkAPIInformation                      = /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ {0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4};
+BMD_CONST REFIID IID_IDeckLinkOutput                              = /* CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564 */ {0xCC,0x5C,0x8A,0x6E,0x3F,0x2F,0x4B,0x3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64};
+BMD_CONST REFIID IID_IDeckLinkInput                               = /* AF22762B-DFAC-4846-AA79-FA8883560995 */ {0xAF,0x22,0x76,0x2B,0xDF,0xAC,0x48,0x46,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95};
+BMD_CONST REFIID IID_IDeckLinkVideoFrame                          = /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ {0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17};
+BMD_CONST REFIID IID_IDeckLinkMutableVideoFrame                   = /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ {0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90};
+BMD_CONST REFIID IID_IDeckLinkVideoFrame3DExtensions              = /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ {0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7};
+BMD_CONST REFIID IID_IDeckLinkVideoInputFrame                     = /* 05CFE374-537C-4094-9A57-680525118F44 */ {0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44};
+BMD_CONST REFIID IID_IDeckLinkVideoFrameAncillary                 = /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ {0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04};
+BMD_CONST REFIID IID_IDeckLinkAudioInputPacket                    = /* E43D5870-2894-11DE-8C30-0800200C9A66 */ {0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66};
+BMD_CONST REFIID IID_IDeckLinkScreenPreviewCallback               = /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ {0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38};
+BMD_CONST REFIID IID_IDeckLinkGLScreenPreviewHelper               = /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ {0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F};
+BMD_CONST REFIID IID_IDeckLinkNotificationCallback                = /* B002A1EC-070D-4288-8289-BD5D36E5FF0D */ {0xB0,0x02,0xA1,0xEC,0x07,0x0D,0x42,0x88,0x82,0x89,0xBD,0x5D,0x36,0xE5,0xFF,0x0D};
+BMD_CONST REFIID IID_IDeckLinkNotification                        = /* 0A1FB207-E215-441B-9B19-6FA1575946C5 */ {0x0A,0x1F,0xB2,0x07,0xE2,0x15,0x44,0x1B,0x9B,0x19,0x6F,0xA1,0x57,0x59,0x46,0xC5};
+BMD_CONST REFIID IID_IDeckLinkAttributes                          = /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ {0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4};
+BMD_CONST REFIID IID_IDeckLinkKeyer                               = /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ {0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3};
+BMD_CONST REFIID IID_IDeckLinkVideoConversion                     = /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ {0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A};
+BMD_CONST REFIID IID_IDeckLinkDeviceNotificationCallback          = /* 4997053B-0ADF-4CC8-AC70-7A50C4BE728F */ {0x49,0x97,0x05,0x3B,0x0A,0xDF,0x4C,0xC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F};
+BMD_CONST REFIID IID_IDeckLinkDiscovery                           = /* CDBF631C-BC76-45FA-B44D-C55059BC6101 */ {0xCD,0xBF,0x63,0x1C,0xBC,0x76,0x45,0xFA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01};
 
 /* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */
 
 typedef uint32_t BMDVideoOutputFlags;
 enum _BMDVideoOutputFlags {
-    bmdVideoOutputFlagDefault                          = 0,
-    bmdVideoOutputVANC                                 = 1 << 0,
-    bmdVideoOutputVITC                                 = 1 << 1,
-    bmdVideoOutputRP188                                = 1 << 2,
-    bmdVideoOutputDualStream3D                         = 1 << 4
+    bmdVideoOutputFlagDefault                                    = 0,
+    bmdVideoOutputVANC                                           = 1 << 0,
+    bmdVideoOutputVITC                                           = 1 << 1,
+    bmdVideoOutputRP188                                          = 1 << 2,
+    bmdVideoOutputDualStream3D                                   = 1 << 4
 };
 
-
 /* Enum BMDFrameFlags - Frame flags */
 
 typedef uint32_t BMDFrameFlags;
 enum _BMDFrameFlags {
-    bmdFrameFlagDefault                                = 0,
-    bmdFrameFlagFlipVertical                           = 1 << 0,
+    bmdFrameFlagDefault                                          = 0,
+    bmdFrameFlagFlipVertical                                     = 1 << 0,
 
     /* Flags that are applicable only to instances of IDeckLinkVideoInputFrame */
 
-    bmdFrameHasNoInputSource                           = 1 << 31
+    bmdFrameHasNoInputSource                                     = 1 << 31
 };
 
-
 /* Enum BMDVideoInputFlags - Flags applicable to video input */
 
 typedef uint32_t BMDVideoInputFlags;
 enum _BMDVideoInputFlags {
-    bmdVideoInputFlagDefault                           = 0,
-    bmdVideoInputEnableFormatDetection                 = 1 << 0,
-    bmdVideoInputDualStream3D                          = 1 << 1
+    bmdVideoInputFlagDefault                                     = 0,
+    bmdVideoInputEnableFormatDetection                           = 1 << 0,
+    bmdVideoInputDualStream3D                                    = 1 << 1
 };
 
-
 /* Enum BMDVideoInputFormatChangedEvents - Bitmask passed to the VideoInputFormatChanged notification to identify the properties of the input signal that have changed */
 
 typedef uint32_t BMDVideoInputFormatChangedEvents;
 enum _BMDVideoInputFormatChangedEvents {
-    bmdVideoInputDisplayModeChanged                    = 1 << 0,
-    bmdVideoInputFieldDominanceChanged                 = 1 << 1,
-    bmdVideoInputColorspaceChanged                     = 1 << 2
+    bmdVideoInputDisplayModeChanged                              = 1 << 0,
+    bmdVideoInputFieldDominanceChanged                           = 1 << 1,
+    bmdVideoInputColorspaceChanged                               = 1 << 2
 };
 
-
 /* Enum BMDDetectedVideoInputFormatFlags - Flags passed to the VideoInputFormatChanged notification to describe the detected video input signal */
 
 typedef uint32_t BMDDetectedVideoInputFormatFlags;
 enum _BMDDetectedVideoInputFormatFlags {
-    bmdDetectedVideoInputYCbCr422                      = 1 << 0,
-    bmdDetectedVideoInputRGB444                        = 1 << 1
+    bmdDetectedVideoInputYCbCr422                                = 1 << 0,
+    bmdDetectedVideoInputRGB444                                  = 1 << 1,
+    bmdDetectedVideoInputDualStream3D                            = 1 << 2
 };
 
+/* Enum BMDDeckLinkCapturePassthroughMode - Enumerates whether the video output is electrically connected to the video input or if the clean switching mode is enabled */
+
+typedef uint32_t BMDDeckLinkCapturePassthroughMode;
+enum _BMDDeckLinkCapturePassthroughMode {
+    bmdDeckLinkCapturePassthroughModeDirect                      = /* 'pdir' */ 0x70646972,
+    bmdDeckLinkCapturePassthroughModeCleanSwitch                 = /* 'pcln' */ 0x70636C6E
+};
 
 /* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */
 
 typedef uint32_t BMDOutputFrameCompletionResult;
 enum _BMDOutputFrameCompletionResult {
-    bmdOutputFrameCompleted,                          
-    bmdOutputFrameDisplayedLate,                      
-    bmdOutputFrameDropped,                            
-    bmdOutputFrameFlushed                             
+    bmdOutputFrameCompleted,                                    
+    bmdOutputFrameDisplayedLate,                                
+    bmdOutputFrameDropped,                                      
+    bmdOutputFrameFlushed                                       
 };
 
-
 /* Enum BMDReferenceStatus - GenLock input status */
 
 typedef uint32_t BMDReferenceStatus;
 enum _BMDReferenceStatus {
-    bmdReferenceNotSupportedByHardware                 = 1 << 0,
-    bmdReferenceLocked                                 = 1 << 1
+    bmdReferenceNotSupportedByHardware                           = 1 << 0,
+    bmdReferenceLocked                                           = 1 << 1
 };
 
-
 /* Enum BMDAudioSampleRate - Audio sample rates supported for output/input */
 
 typedef uint32_t BMDAudioSampleRate;
 enum _BMDAudioSampleRate {
-    bmdAudioSampleRate48kHz                            = 48000
+    bmdAudioSampleRate48kHz                                      = 48000
 };
 
-
 /* Enum BMDAudioSampleType - Audio sample sizes supported for output/input */
 
 typedef uint32_t BMDAudioSampleType;
 enum _BMDAudioSampleType {
-    bmdAudioSampleType16bitInteger                     = 16,
-    bmdAudioSampleType32bitInteger                     = 32
+    bmdAudioSampleType16bitInteger                               = 16,
+    bmdAudioSampleType32bitInteger                               = 32
 };
 
-
 /* Enum BMDAudioOutputStreamType - Audio output stream type */
 
 typedef uint32_t BMDAudioOutputStreamType;
 enum _BMDAudioOutputStreamType {
-    bmdAudioOutputStreamContinuous,                   
-    bmdAudioOutputStreamContinuousDontResample,       
-    bmdAudioOutputStreamTimestamped                   
+    bmdAudioOutputStreamContinuous,                             
+    bmdAudioOutputStreamContinuousDontResample,                 
+    bmdAudioOutputStreamTimestamped                             
 };
 
-
 /* Enum BMDDisplayModeSupport - Output mode supported flags */
 
 typedef uint32_t BMDDisplayModeSupport;
 enum _BMDDisplayModeSupport {
-    bmdDisplayModeNotSupported                         = 0,
-    bmdDisplayModeSupported,                          
-    bmdDisplayModeSupportedWithConversion             
+    bmdDisplayModeNotSupported                                   = 0,
+    bmdDisplayModeSupported,                                    
+    bmdDisplayModeSupportedWithConversion                       
 };
 
-
 /* Enum BMDTimecodeFormat - Timecode formats for frame metadata */
 
 typedef uint32_t BMDTimecodeFormat;
 enum _BMDTimecodeFormat {
-    bmdTimecodeRP188                                   = /* 'rp18' */ 0x72703138,
-    bmdTimecodeRP188Field2                             = /* 'rp12' */ 0x72703132,
-    bmdTimecodeVITC                                    = /* 'vitc' */ 0x76697463,
-    bmdTimecodeVITCField2                              = /* 'vit2' */ 0x76697432,
-    bmdTimecodeSerial                                  = /* 'seri' */ 0x73657269
+    bmdTimecodeRP188VITC1                                        = /* 'rpv1' */ 0x72707631,	// RP188 timecode where DBB1 equals VITC1 (line 9)
+    bmdTimecodeRP188VITC2                                        = /* 'rp12' */ 0x72703132,	// RP188 timecode where DBB1 equals VITC2 (line 9 for progressive or line 571 for interlaced/PsF)
+    bmdTimecodeRP188LTC                                          = /* 'rplt' */ 0x72706C74,	// RP188 timecode where DBB1 equals LTC (line 10)
+    bmdTimecodeRP188Any                                          = /* 'rp18' */ 0x72703138,	// For capture: return the first valid timecode in {VITC1, LTC ,VITC2} - For playback: set the timecode as VITC1
+    bmdTimecodeVITC                                              = /* 'vitc' */ 0x76697463,
+    bmdTimecodeVITCField2                                        = /* 'vit2' */ 0x76697432,
+    bmdTimecodeSerial                                            = /* 'seri' */ 0x73657269
 };
 
-
-/* Enum BMDTimecodeFlags - Timecode flags */
-
-typedef uint32_t BMDTimecodeFlags;
-enum _BMDTimecodeFlags {
-    bmdTimecodeFlagDefault                             = 0,
-    bmdTimecodeIsDropFrame                             = 1 << 0
-};
-
-
-/* Enum BMDVideoConnection - Video connection types */
-
-typedef uint32_t BMDVideoConnection;
-enum _BMDVideoConnection {
-    bmdVideoConnectionSDI                              = 1 << 0,
-    bmdVideoConnectionHDMI                             = 1 << 1,
-    bmdVideoConnectionOpticalSDI                       = 1 << 2,
-    bmdVideoConnectionComponent                        = 1 << 3,
-    bmdVideoConnectionComposite                        = 1 << 4,
-    bmdVideoConnectionSVideo                           = 1 << 5
-};
-
-
 /* Enum BMDAnalogVideoFlags - Analog video display flags */
 
 typedef uint32_t BMDAnalogVideoFlags;
 enum _BMDAnalogVideoFlags {
-    bmdAnalogVideoFlagCompositeSetup75                 = 1 << 0,
-    bmdAnalogVideoFlagComponentBetacamLevels           = 1 << 1
+    bmdAnalogVideoFlagCompositeSetup75                           = 1 << 0,
+    bmdAnalogVideoFlagComponentBetacamLevels                     = 1 << 1
 };
 
-
-/* Enum BMDAudioConnection - Audio connection types */
-
-typedef uint32_t BMDAudioConnection;
-enum _BMDAudioConnection {
-    bmdAudioConnectionEmbedded                         = /* 'embd' */ 0x656D6264,
-    bmdAudioConnectionAESEBU                           = /* 'aes ' */ 0x61657320,
-    bmdAudioConnectionAnalog                           = /* 'anlg' */ 0x616E6C67
-};
-
-
 /* Enum BMDAudioOutputAnalogAESSwitch - Audio output Analog/AESEBU switch */
 
 typedef uint32_t BMDAudioOutputAnalogAESSwitch;
 enum _BMDAudioOutputAnalogAESSwitch {
-    bmdAudioOutputSwitchAESEBU                         = /* 'aes ' */ 0x61657320,
-    bmdAudioOutputSwitchAnalog                         = /* 'anlg' */ 0x616E6C67
+    bmdAudioOutputSwitchAESEBU                                   = /* 'aes ' */ 0x61657320,
+    bmdAudioOutputSwitchAnalog                                   = /* 'anlg' */ 0x616E6C67
 };
 
-
 /* Enum BMDVideoOutputConversionMode - Video/audio conversion mode */
 
 typedef uint32_t BMDVideoOutputConversionMode;
 enum _BMDVideoOutputConversionMode {
-    bmdNoVideoOutputConversion                         = /* 'none' */ 0x6E6F6E65,
-    bmdVideoOutputLetterboxDownconversion              = /* 'ltbx' */ 0x6C746278,
-    bmdVideoOutputAnamorphicDownconversion             = /* 'amph' */ 0x616D7068,
-    bmdVideoOutputHD720toHD1080Conversion              = /* '720c' */ 0x37323063,
-    bmdVideoOutputHardwareLetterboxDownconversion      = /* 'HWlb' */ 0x48576C62,
-    bmdVideoOutputHardwareAnamorphicDownconversion     = /* 'HWam' */ 0x4857616D,
-    bmdVideoOutputHardwareCenterCutDownconversion      = /* 'HWcc' */ 0x48576363,
-    bmdVideoOutputHardware720p1080pCrossconversion     = /* 'xcap' */ 0x78636170,
-    bmdVideoOutputHardwareAnamorphic720pUpconversion   = /* 'ua7p' */ 0x75613770,
-    bmdVideoOutputHardwareAnamorphic1080iUpconversion  = /* 'ua1i' */ 0x75613169,
-    bmdVideoOutputHardwareAnamorphic149To720pUpconversion = /* 'u47p' */ 0x75343770,
-    bmdVideoOutputHardwareAnamorphic149To1080iUpconversion = /* 'u41i' */ 0x75343169,
-    bmdVideoOutputHardwarePillarbox720pUpconversion    = /* 'up7p' */ 0x75703770,
-    bmdVideoOutputHardwarePillarbox1080iUpconversion   = /* 'up1i' */ 0x75703169
+    bmdNoVideoOutputConversion                                   = /* 'none' */ 0x6E6F6E65,
+    bmdVideoOutputLetterboxDownconversion                        = /* 'ltbx' */ 0x6C746278,
+    bmdVideoOutputAnamorphicDownconversion                       = /* 'amph' */ 0x616D7068,
+    bmdVideoOutputHD720toHD1080Conversion                        = /* '720c' */ 0x37323063,
+    bmdVideoOutputHardwareLetterboxDownconversion                = /* 'HWlb' */ 0x48576C62,
+    bmdVideoOutputHardwareAnamorphicDownconversion               = /* 'HWam' */ 0x4857616D,
+    bmdVideoOutputHardwareCenterCutDownconversion                = /* 'HWcc' */ 0x48576363,
+    bmdVideoOutputHardware720p1080pCrossconversion               = /* 'xcap' */ 0x78636170,
+    bmdVideoOutputHardwareAnamorphic720pUpconversion             = /* 'ua7p' */ 0x75613770,
+    bmdVideoOutputHardwareAnamorphic1080iUpconversion            = /* 'ua1i' */ 0x75613169,
+    bmdVideoOutputHardwareAnamorphic149To720pUpconversion        = /* 'u47p' */ 0x75343770,
+    bmdVideoOutputHardwareAnamorphic149To1080iUpconversion       = /* 'u41i' */ 0x75343169,
+    bmdVideoOutputHardwarePillarbox720pUpconversion              = /* 'up7p' */ 0x75703770,
+    bmdVideoOutputHardwarePillarbox1080iUpconversion             = /* 'up1i' */ 0x75703169
 };
 
-
 /* Enum BMDVideoInputConversionMode - Video input conversion mode */
 
 typedef uint32_t BMDVideoInputConversionMode;
 enum _BMDVideoInputConversionMode {
-    bmdNoVideoInputConversion                          = /* 'none' */ 0x6E6F6E65,
-    bmdVideoInputLetterboxDownconversionFromHD1080     = /* '10lb' */ 0x31306C62,
-    bmdVideoInputAnamorphicDownconversionFromHD1080    = /* '10am' */ 0x3130616D,
-    bmdVideoInputLetterboxDownconversionFromHD720      = /* '72lb' */ 0x37326C62,
-    bmdVideoInputAnamorphicDownconversionFromHD720     = /* '72am' */ 0x3732616D,
-    bmdVideoInputLetterboxUpconversion                 = /* 'lbup' */ 0x6C627570,
-    bmdVideoInputAnamorphicUpconversion                = /* 'amup' */ 0x616D7570
+    bmdNoVideoInputConversion                                    = /* 'none' */ 0x6E6F6E65,
+    bmdVideoInputLetterboxDownconversionFromHD1080               = /* '10lb' */ 0x31306C62,
+    bmdVideoInputAnamorphicDownconversionFromHD1080              = /* '10am' */ 0x3130616D,
+    bmdVideoInputLetterboxDownconversionFromHD720                = /* '72lb' */ 0x37326C62,
+    bmdVideoInputAnamorphicDownconversionFromHD720               = /* '72am' */ 0x3732616D,
+    bmdVideoInputLetterboxUpconversion                           = /* 'lbup' */ 0x6C627570,
+    bmdVideoInputAnamorphicUpconversion                          = /* 'amup' */ 0x616D7570
 };
 
-
 /* Enum BMDVideo3DPackingFormat - Video 3D packing format */
 
 typedef uint32_t BMDVideo3DPackingFormat;
 enum _BMDVideo3DPackingFormat {
-    bmdVideo3DPackingSidebySideHalf                    = /* 'sbsh' */ 0x73627368,
-    bmdVideo3DPackingLinebyLine                        = /* 'lbyl' */ 0x6C62796C,
-    bmdVideo3DPackingTopAndBottom                      = /* 'tabo' */ 0x7461626F,
-    bmdVideo3DPackingFramePacking                      = /* 'frpk' */ 0x6672706B,
-    bmdVideo3DPackingLeftOnly                          = /* 'left' */ 0x6C656674,
-    bmdVideo3DPackingRightOnly                         = /* 'righ' */ 0x72696768
+    bmdVideo3DPackingSidebySideHalf                              = /* 'sbsh' */ 0x73627368,
+    bmdVideo3DPackingLinebyLine                                  = /* 'lbyl' */ 0x6C62796C,
+    bmdVideo3DPackingTopAndBottom                                = /* 'tabo' */ 0x7461626F,
+    bmdVideo3DPackingFramePacking                                = /* 'frpk' */ 0x6672706B,
+    bmdVideo3DPackingLeftOnly                                    = /* 'left' */ 0x6C656674,
+    bmdVideo3DPackingRightOnly                                   = /* 'righ' */ 0x72696768
 };
 
-
 /* Enum BMDIdleVideoOutputOperation - Video output operation when not playing video */
 
 typedef uint32_t BMDIdleVideoOutputOperation;
 enum _BMDIdleVideoOutputOperation {
-    bmdIdleVideoOutputBlack                            = /* 'blac' */ 0x626C6163,
-    bmdIdleVideoOutputLastFrame                        = /* 'lafa' */ 0x6C616661
+    bmdIdleVideoOutputBlack                                      = /* 'blac' */ 0x626C6163,
+    bmdIdleVideoOutputLastFrame                                  = /* 'lafa' */ 0x6C616661,
+    bmdIdleVideoOutputDesktop                                    = /* 'desk' */ 0x6465736B
 };
 
-
-/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */
-
-typedef uint32_t BMDDeckLinkConfigurationID;
-enum _BMDDeckLinkConfigurationID {
-
-    /* Serial port Flags */
-
-    bmdDeckLinkConfigSwapSerialRxTx                    = /* 'ssrt' */ 0x73737274,
-
-    /* Video Input/Output Flags */
-
-    bmdDeckLinkConfigUse1080pNotPsF                    = /* 'fpro' */ 0x6670726F,
-
-    /* Video Input/Output Integers */
-
-    bmdDeckLinkConfigHDMI3DPackingFormat               = /* '3dpf' */ 0x33647066,
-    bmdDeckLinkConfigBypass                            = /* 'byps' */ 0x62797073,
-
-    /* Audio Input/Output Flags */
-
-    bmdDeckLinkConfigAnalogAudioConsumerLevels         = /* 'aacl' */ 0x6161636C,
-
-    /* Video output flags */
-
-    bmdDeckLinkConfigFieldFlickerRemoval               = /* 'fdfr' */ 0x66646672,
-    bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion  = /* 'to59' */ 0x746F3539,
-    bmdDeckLinkConfig444SDIVideoOutput                 = /* '444o' */ 0x3434346F,
-    bmdDeckLinkConfig3GBpsVideoOutput                  = /* '3gbs' */ 0x33676273,
-    bmdDeckLinkConfigBlackVideoOutputDuringCapture     = /* 'bvoc' */ 0x62766F63,
-    bmdDeckLinkConfigLowLatencyVideoOutput             = /* 'llvo' */ 0x6C6C766F,
-
-    /* Video Output Integers */
-
-    bmdDeckLinkConfigVideoOutputConnection             = /* 'vocn' */ 0x766F636E,
-    bmdDeckLinkConfigVideoOutputConversionMode         = /* 'vocm' */ 0x766F636D,
-    bmdDeckLinkConfigAnalogVideoOutputFlags            = /* 'avof' */ 0x61766F66,
-    bmdDeckLinkConfigReferenceInputTimingOffset        = /* 'glot' */ 0x676C6F74,
-    bmdDeckLinkConfigVideoOutputIdleOperation          = /* 'voio' */ 0x766F696F,
-
-    /* Video Output Floats */
-
-    bmdDeckLinkConfigVideoOutputComponentLumaGain      = /* 'oclg' */ 0x6F636C67,
-    bmdDeckLinkConfigVideoOutputComponentChromaBlueGain = /* 'occb' */ 0x6F636362,
-    bmdDeckLinkConfigVideoOutputComponentChromaRedGain = /* 'occr' */ 0x6F636372,
-    bmdDeckLinkConfigVideoOutputCompositeLumaGain      = /* 'oilg' */ 0x6F696C67,
-    bmdDeckLinkConfigVideoOutputCompositeChromaGain    = /* 'oicg' */ 0x6F696367,
-    bmdDeckLinkConfigVideoOutputSVideoLumaGain         = /* 'oslg' */ 0x6F736C67,
-    bmdDeckLinkConfigVideoOutputSVideoChromaGain       = /* 'oscg' */ 0x6F736367,
-
-    /* Video Input Integers */
-
-    bmdDeckLinkConfigVideoInputConnection              = /* 'vicn' */ 0x7669636E,
-    bmdDeckLinkConfigAnalogVideoInputFlags             = /* 'avif' */ 0x61766966,
-    bmdDeckLinkConfigVideoInputConversionMode          = /* 'vicm' */ 0x7669636D,
-    bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame = /* 'pdif' */ 0x70646966,
-    bmdDeckLinkConfigVANCSourceLine1Mapping            = /* 'vsl1' */ 0x76736C31,
-    bmdDeckLinkConfigVANCSourceLine2Mapping            = /* 'vsl2' */ 0x76736C32,
-    bmdDeckLinkConfigVANCSourceLine3Mapping            = /* 'vsl3' */ 0x76736C33,
-
-    /* Video Input Floats */
-
-    bmdDeckLinkConfigVideoInputComponentLumaGain       = /* 'iclg' */ 0x69636C67,
-    bmdDeckLinkConfigVideoInputComponentChromaBlueGain = /* 'iccb' */ 0x69636362,
-    bmdDeckLinkConfigVideoInputComponentChromaRedGain  = /* 'iccr' */ 0x69636372,
-    bmdDeckLinkConfigVideoInputCompositeLumaGain       = /* 'iilg' */ 0x69696C67,
-    bmdDeckLinkConfigVideoInputCompositeChromaGain     = /* 'iicg' */ 0x69696367,
-    bmdDeckLinkConfigVideoInputSVideoLumaGain          = /* 'islg' */ 0x69736C67,
-    bmdDeckLinkConfigVideoInputSVideoChromaGain        = /* 'iscg' */ 0x69736367,
-
-    /* Audio Input Integers */
-
-    bmdDeckLinkConfigAudioInputConnection              = /* 'aicn' */ 0x6169636E,
-
-    /* Audio Input Floats */
-
-    bmdDeckLinkConfigAnalogAudioInputScaleChannel1     = /* 'ais1' */ 0x61697331,
-    bmdDeckLinkConfigAnalogAudioInputScaleChannel2     = /* 'ais2' */ 0x61697332,
-    bmdDeckLinkConfigAnalogAudioInputScaleChannel3     = /* 'ais3' */ 0x61697333,
-    bmdDeckLinkConfigAnalogAudioInputScaleChannel4     = /* 'ais4' */ 0x61697334,
-    bmdDeckLinkConfigDigitalAudioInputScale            = /* 'dais' */ 0x64616973,
-
-    /* Audio Output Integers */
-
-    bmdDeckLinkConfigAudioOutputAESAnalogSwitch        = /* 'aoaa' */ 0x616F6161,
-
-    /* Audio Output Floats */
-
-    bmdDeckLinkConfigAnalogAudioOutputScaleChannel1    = /* 'aos1' */ 0x616F7331,
-    bmdDeckLinkConfigAnalogAudioOutputScaleChannel2    = /* 'aos2' */ 0x616F7332,
-    bmdDeckLinkConfigAnalogAudioOutputScaleChannel3    = /* 'aos3' */ 0x616F7333,
-    bmdDeckLinkConfigAnalogAudioOutputScaleChannel4    = /* 'aos4' */ 0x616F7334,
-    bmdDeckLinkConfigDigitalAudioOutputScale           = /* 'daos' */ 0x64616F73
-};
-
-
 /* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */
 
 typedef uint32_t BMDDeckLinkAttributeID;
@@ -480,157 +278,89 @@
 
     /* Flags */
 
-    BMDDeckLinkSupportsInternalKeying                  = /* 'keyi' */ 0x6B657969,
-    BMDDeckLinkSupportsExternalKeying                  = /* 'keye' */ 0x6B657965,
-    BMDDeckLinkSupportsHDKeying                        = /* 'keyh' */ 0x6B657968,
-    BMDDeckLinkSupportsInputFormatDetection            = /* 'infd' */ 0x696E6664,
-    BMDDeckLinkHasReferenceInput                       = /* 'hrin' */ 0x6872696E,
-    BMDDeckLinkHasSerialPort                           = /* 'hspt' */ 0x68737074,
-    BMDDeckLinkHasAnalogVideoOutputGain                = /* 'avog' */ 0x61766F67,
-    BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain     = /* 'ovog' */ 0x6F766F67,
-    BMDDeckLinkHasVideoInputAntiAliasingFilter         = /* 'aafl' */ 0x6161666C,
-    BMDDeckLinkHasBypass                               = /* 'byps' */ 0x62797073,
+    BMDDeckLinkSupportsInternalKeying                            = /* 'keyi' */ 0x6B657969,
+    BMDDeckLinkSupportsExternalKeying                            = /* 'keye' */ 0x6B657965,
+    BMDDeckLinkSupportsHDKeying                                  = /* 'keyh' */ 0x6B657968,
+    BMDDeckLinkSupportsInputFormatDetection                      = /* 'infd' */ 0x696E6664,
+    BMDDeckLinkHasReferenceInput                                 = /* 'hrin' */ 0x6872696E,
+    BMDDeckLinkHasSerialPort                                     = /* 'hspt' */ 0x68737074,
+    BMDDeckLinkHasAnalogVideoOutputGain                          = /* 'avog' */ 0x61766F67,
+    BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain               = /* 'ovog' */ 0x6F766F67,
+    BMDDeckLinkHasVideoInputAntiAliasingFilter                   = /* 'aafl' */ 0x6161666C,
+    BMDDeckLinkHasBypass                                         = /* 'byps' */ 0x62797073,
+    BMDDeckLinkSupportsDesktopDisplay                            = /* 'extd' */ 0x65787464,
+    BMDDeckLinkSupportsClockTimingAdjustment                     = /* 'ctad' */ 0x63746164,
+    BMDDeckLinkSupportsFullDuplex                                = /* 'fdup' */ 0x66647570,
+    BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset       = /* 'frin' */ 0x6672696E,
 
     /* Integers */
 
-    BMDDeckLinkMaximumAudioChannels                    = /* 'mach' */ 0x6D616368,
-    BMDDeckLinkNumberOfSubDevices                      = /* 'nsbd' */ 0x6E736264,
-    BMDDeckLinkSubDeviceIndex                          = /* 'subi' */ 0x73756269,
-    BMDDeckLinkVideoOutputConnections                  = /* 'vocn' */ 0x766F636E,
-    BMDDeckLinkVideoInputConnections                   = /* 'vicn' */ 0x7669636E,
+    BMDDeckLinkMaximumAudioChannels                              = /* 'mach' */ 0x6D616368,
+    BMDDeckLinkMaximumAnalogAudioChannels                        = /* 'aach' */ 0x61616368,
+    BMDDeckLinkNumberOfSubDevices                                = /* 'nsbd' */ 0x6E736264,
+    BMDDeckLinkSubDeviceIndex                                    = /* 'subi' */ 0x73756269,
+    BMDDeckLinkPersistentID                                      = /* 'peid' */ 0x70656964,
+    BMDDeckLinkTopologicalID                                     = /* 'toid' */ 0x746F6964,
+    BMDDeckLinkVideoOutputConnections                            = /* 'vocn' */ 0x766F636E,
+    BMDDeckLinkVideoInputConnections                             = /* 'vicn' */ 0x7669636E,
+    BMDDeckLinkAudioOutputConnections                            = /* 'aocn' */ 0x616F636E,
+    BMDDeckLinkAudioInputConnections                             = /* 'aicn' */ 0x6169636E,
+    BMDDeckLinkDeviceBusyState                                   = /* 'dbst' */ 0x64627374,
+    BMDDeckLinkVideoIOSupport                                    = /* 'vios' */ 0x76696F73,	// Returns a BMDVideoIOSupport bit field
 
     /* Floats */
 
-    BMDDeckLinkVideoInputGainMinimum                   = /* 'vigm' */ 0x7669676D,
-    BMDDeckLinkVideoInputGainMaximum                   = /* 'vigx' */ 0x76696778,
-    BMDDeckLinkVideoOutputGainMinimum                  = /* 'vogm' */ 0x766F676D,
-    BMDDeckLinkVideoOutputGainMaximum                  = /* 'vogx' */ 0x766F6778,
+    BMDDeckLinkVideoInputGainMinimum                             = /* 'vigm' */ 0x7669676D,
+    BMDDeckLinkVideoInputGainMaximum                             = /* 'vigx' */ 0x76696778,
+    BMDDeckLinkVideoOutputGainMinimum                            = /* 'vogm' */ 0x766F676D,
+    BMDDeckLinkVideoOutputGainMaximum                            = /* 'vogx' */ 0x766F6778,
 
     /* Strings */
 
-    BMDDeckLinkSerialPortDeviceName                    = /* 'slpn' */ 0x736C706E
+    BMDDeckLinkSerialPortDeviceName                              = /* 'slpn' */ 0x736C706E
 };
 
-
 /* Enum BMDDeckLinkAPIInformationID - DeckLinkAPI information ID */
 
 typedef uint32_t BMDDeckLinkAPIInformationID;
 enum _BMDDeckLinkAPIInformationID {
-    BMDDeckLinkAPIVersion                              = /* 'vers' */ 0x76657273
+    BMDDeckLinkAPIVersion                                        = /* 'vers' */ 0x76657273
 };
 
+/* Enum BMDDeviceBusyState - Current device busy state */
 
-/* Enum BMDDeckControlMode - DeckControl mode */
-
-typedef uint32_t BMDDeckControlMode;
-enum _BMDDeckControlMode {
-    bmdDeckControlNotOpened                            = /* 'ntop' */ 0x6E746F70,
-    bmdDeckControlVTRControlMode                       = /* 'vtrc' */ 0x76747263,
-    bmdDeckControlExportMode                           = /* 'expm' */ 0x6578706D,
-    bmdDeckControlCaptureMode                          = /* 'capm' */ 0x6361706D
+typedef uint32_t BMDDeviceBusyState;
+enum _BMDDeviceBusyState {
+    bmdDeviceCaptureBusy                                         = 1 << 0,
+    bmdDevicePlaybackBusy                                        = 1 << 1,
+    bmdDeviceSerialPortBusy                                      = 1 << 2
 };
 
+/* Enum BMDVideoIOSupport - Device video input/output support */
 
-/* Enum BMDDeckControlEvent - DeckControl event */
-
-typedef uint32_t BMDDeckControlEvent;
-enum _BMDDeckControlEvent {
-    bmdDeckControlAbortedEvent                         = /* 'abte' */ 0x61627465,	// This event is triggered when a capture or edit-to-tape operation is aborted.
-
-    /* Export-To-Tape events */
-
-    bmdDeckControlPrepareForExportEvent                = /* 'pfee' */ 0x70666565,	// This event is triggered a few frames before reaching the in-point. IDeckLinkInput::StartScheduledPlayback() should be called at this point.
-    bmdDeckControlExportCompleteEvent                  = /* 'exce' */ 0x65786365,	// This event is triggered a few frames after reaching the out-point. At this point, it is safe to stop playback.
-
-    /* Capture events */
-
-    bmdDeckControlPrepareForCaptureEvent               = /* 'pfce' */ 0x70666365,	// This event is triggered a few frames before reaching the in-point. The serial timecode attached to IDeckLinkVideoInputFrames is now valid.
-    bmdDeckControlCaptureCompleteEvent                 = /* 'ccev' */ 0x63636576	// This event is triggered a few frames after reaching the out-point.
+typedef uint32_t BMDVideoIOSupport;
+enum _BMDVideoIOSupport {
+    bmdDeviceSupportsCapture                                     = 1 << 0,
+    bmdDeviceSupportsPlayback                                    = 1 << 1
 };
 
-
-/* Enum BMDDeckControlVTRControlState - VTR Control state */
-
-typedef uint32_t BMDDeckControlVTRControlState;
-enum _BMDDeckControlVTRControlState {
-    bmdDeckControlNotInVTRControlMode                  = /* 'nvcm' */ 0x6E76636D,
-    bmdDeckControlVTRControlPlaying                    = /* 'vtrp' */ 0x76747270,
-    bmdDeckControlVTRControlRecording                  = /* 'vtrr' */ 0x76747272,
-    bmdDeckControlVTRControlStill                      = /* 'vtra' */ 0x76747261,
-    bmdDeckControlVTRControlSeeking                    = /* 'vtrs' */ 0x76747273,
-    bmdDeckControlVTRControlStopped                    = /* 'vtro' */ 0x7674726F
-};
-
-
-/* Enum BMDDeckControlStatusFlags - Deck Control status flags */
-
-typedef uint32_t BMDDeckControlStatusFlags;
-enum _BMDDeckControlStatusFlags {
-    bmdDeckControlStatusDeckConnected                  = 1 << 0,
-    bmdDeckControlStatusRemoteMode                     = 1 << 1,
-    bmdDeckControlStatusRecordInhibited                = 1 << 2,
-    bmdDeckControlStatusCassetteOut                    = 1 << 3
-};
-
-
-/* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */
-
-typedef uint32_t BMDDeckControlExportModeOpsFlags;
-enum _BMDDeckControlExportModeOpsFlags {
-    bmdDeckControlExportModeInsertVideo                = 1 << 0,
-    bmdDeckControlExportModeInsertAudio1               = 1 << 1,
-    bmdDeckControlExportModeInsertAudio2               = 1 << 2,
-    bmdDeckControlExportModeInsertAudio3               = 1 << 3,
-    bmdDeckControlExportModeInsertAudio4               = 1 << 4,
-    bmdDeckControlExportModeInsertAudio5               = 1 << 5,
-    bmdDeckControlExportModeInsertAudio6               = 1 << 6,
-    bmdDeckControlExportModeInsertAudio7               = 1 << 7,
-    bmdDeckControlExportModeInsertAudio8               = 1 << 8,
-    bmdDeckControlExportModeInsertAudio9               = 1 << 9,
-    bmdDeckControlExportModeInsertAudio10              = 1 << 10,
-    bmdDeckControlExportModeInsertAudio11              = 1 << 11,
-    bmdDeckControlExportModeInsertAudio12              = 1 << 12,
-    bmdDeckControlExportModeInsertTimeCode             = 1 << 13,
-    bmdDeckControlExportModeInsertAssemble             = 1 << 14,
-    bmdDeckControlExportModeInsertPreview              = 1 << 15,
-    bmdDeckControlUseManualExport                      = 1 << 16
-};
-
-
-/* Enum BMDDeckControlError - Deck Control error */
-
-typedef uint32_t BMDDeckControlError;
-enum _BMDDeckControlError {
-    bmdDeckControlNoError                              = /* 'noer' */ 0x6E6F6572,
-    bmdDeckControlModeError                            = /* 'moer' */ 0x6D6F6572,
-    bmdDeckControlMissedInPointError                   = /* 'mier' */ 0x6D696572,
-    bmdDeckControlDeckTimeoutError                     = /* 'dter' */ 0x64746572,
-    bmdDeckControlCommandFailedError                   = /* 'cfer' */ 0x63666572,
-    bmdDeckControlDeviceAlreadyOpenedError             = /* 'dalo' */ 0x64616C6F,
-    bmdDeckControlFailedToOpenDeviceError              = /* 'fder' */ 0x66646572,
-    bmdDeckControlInLocalModeError                     = /* 'lmer' */ 0x6C6D6572,
-    bmdDeckControlEndOfTapeError                       = /* 'eter' */ 0x65746572,
-    bmdDeckControlUserAbortError                       = /* 'uaer' */ 0x75616572,
-    bmdDeckControlNoTapeInDeckError                    = /* 'nter' */ 0x6E746572,
-    bmdDeckControlNoVideoFromCardError                 = /* 'nvfc' */ 0x6E766663,
-    bmdDeckControlNoCommunicationError                 = /* 'ncom' */ 0x6E636F6D,
-    bmdDeckControlBufferTooSmallError                  = /* 'btsm' */ 0x6274736D,
-    bmdDeckControlBadChecksumError                     = /* 'chks' */ 0x63686B73,
-    bmdDeckControlUnknownError                         = /* 'uner' */ 0x756E6572
-};
-
-
 /* Enum BMD3DPreviewFormat - Linked Frame preview format */
 
 typedef uint32_t BMD3DPreviewFormat;
 enum _BMD3DPreviewFormat {
-    bmd3DPreviewFormatDefault                          = /* 'defa' */ 0x64656661,
-    bmd3DPreviewFormatLeftOnly                         = /* 'left' */ 0x6C656674,
-    bmd3DPreviewFormatRightOnly                        = /* 'righ' */ 0x72696768,
-    bmd3DPreviewFormatSideBySide                       = /* 'side' */ 0x73696465,
-    bmd3DPreviewFormatTopBottom                        = /* 'topb' */ 0x746F7062
+    bmd3DPreviewFormatDefault                                    = /* 'defa' */ 0x64656661,
+    bmd3DPreviewFormatLeftOnly                                   = /* 'left' */ 0x6C656674,
+    bmd3DPreviewFormatRightOnly                                  = /* 'righ' */ 0x72696768,
+    bmd3DPreviewFormatSideBySide                                 = /* 'side' */ 0x73696465,
+    bmd3DPreviewFormatTopBottom                                  = /* 'topb' */ 0x746F7062
 };
 
+/* Enum BMDNotifications - Events that can be subscribed through IDeckLinkNotification */
+
+typedef uint32_t BMDNotifications;
+enum _BMDNotifications {
+    bmdPreferencesChanged                                        = /* 'pref' */ 0x70726566
+};
 
 #if defined(__cplusplus)
 
@@ -642,12 +372,8 @@
 class IDeckLinkAudioOutputCallback;
 class IDeckLinkIterator;
 class IDeckLinkAPIInformation;
-class IDeckLinkDisplayModeIterator;
-class IDeckLinkDisplayMode;
-class IDeckLink;
 class IDeckLinkOutput;
 class IDeckLinkInput;
-class IDeckLinkTimecode;
 class IDeckLinkVideoFrame;
 class IDeckLinkMutableVideoFrame;
 class IDeckLinkVideoFrame3DExtensions;
@@ -656,13 +382,13 @@
 class IDeckLinkAudioInputPacket;
 class IDeckLinkScreenPreviewCallback;
 class IDeckLinkGLScreenPreviewHelper;
-class IDeckLinkConfiguration;
+class IDeckLinkNotificationCallback;
+class IDeckLinkNotification;
 class IDeckLinkAttributes;
 class IDeckLinkKeyer;
 class IDeckLinkVideoConversion;
-class IDeckLinkDeckControlStatusCallback;
-class IDeckLinkDeckControl;
-
+class IDeckLinkDeviceNotificationCallback;
+class IDeckLinkDiscovery;
 
 /* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */
 
@@ -673,10 +399,9 @@
     virtual HRESULT ScheduledPlaybackHasStopped (void) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoOutputCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoOutputCallback () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkInputCallback - Frame arrival callback. */
 
 class IDeckLinkInputCallback : public IUnknown
@@ -686,10 +411,9 @@
     virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0;
 
 protected:
-    virtual ~IDeckLinkInputCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkInputCallback () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */
 
 class IDeckLinkMemoryAllocator : public IUnknown
@@ -702,7 +426,6 @@
     virtual HRESULT Decommit (void) = 0;
 };
 
-
 /* Interface IDeckLinkAudioOutputCallback - Optional callback to allow audio samples to be pulled as required. */
 
 class IDeckLinkAudioOutputCallback : public IUnknown
@@ -711,7 +434,6 @@
     virtual HRESULT RenderAudioSamples (/* in */ bool preroll) = 0;
 };
 
-
 /* Interface IDeckLinkIterator - enumerates installed DeckLink hardware */
 
 class IDeckLinkIterator : public IUnknown
@@ -720,7 +442,6 @@
     virtual HRESULT Next (/* out */ IDeckLink **deckLinkInstance) = 0;
 };
 
-
 /* Interface IDeckLinkAPIInformation - DeckLinkAPI attribute interface */
 
 class IDeckLinkAPIInformation : public IUnknown
@@ -732,49 +453,9 @@
     virtual HRESULT GetString (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ const char **value) = 0;
 
 protected:
-    virtual ~IDeckLinkAPIInformation () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkAPIInformation () {} // call Release method to drop reference count
 };
 
-
-/* Interface IDeckLinkDisplayModeIterator - enumerates over supported input/output display modes. */
-
-class IDeckLinkDisplayModeIterator : public IUnknown
-{
-public:
-    virtual HRESULT Next (/* out */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0;
-
-protected:
-    virtual ~IDeckLinkDisplayModeIterator () {}; // call Release method to drop reference count
-};
-
-
-/* Interface IDeckLinkDisplayMode - represents a display mode */
-
-class IDeckLinkDisplayMode : public IUnknown
-{
-public:
-    virtual HRESULT GetName (/* out */ const char **name) = 0;
-    virtual BMDDisplayMode GetDisplayMode (void) = 0;
-    virtual long GetWidth (void) = 0;
-    virtual long GetHeight (void) = 0;
-    virtual HRESULT GetFrameRate (/* out */ BMDTimeValue *frameDuration, /* out */ BMDTimeScale *timeScale) = 0;
-    virtual BMDFieldDominance GetFieldDominance (void) = 0;
-    virtual BMDDisplayModeFlags GetFlags (void) = 0;
-
-protected:
-    virtual ~IDeckLinkDisplayMode () {}; // call Release method to drop reference count
-};
-
-
-/* Interface IDeckLink - represents a DeckLink device */
-
-class IDeckLink : public IUnknown
-{
-public:
-    virtual HRESULT GetModelName (/* out */ const char **modelName) = 0;
-};
-
-
 /* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */
 
 class IDeckLinkOutput : public IUnknown
@@ -826,12 +507,12 @@
     /* Hardware Timing */
 
     virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
+    virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *frameCompletionTimestamp) = 0;
 
 protected:
-    virtual ~IDeckLinkOutput () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkOutput () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */
 
 class IDeckLinkInput : public IUnknown
@@ -847,6 +528,7 @@
     virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0;
     virtual HRESULT DisableVideoInput (void) = 0;
     virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0;
+    virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
 
     /* Audio Input */
 
@@ -867,26 +549,9 @@
     virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkInput () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkInput () {} // call Release method to drop reference count
 };
 
-
-/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */
-
-class IDeckLinkTimecode : public IUnknown
-{
-public:
-    virtual BMDTimecodeBCD GetBCD (void) = 0;
-    virtual HRESULT GetComponents (/* out */ uint8_t *hours, /* out */ uint8_t *minutes, /* out */ uint8_t *seconds, /* out */ uint8_t *frames) = 0;
-    virtual HRESULT GetString (/* out */ const char **timecode) = 0;
-    virtual BMDTimecodeFlags GetFlags (void) = 0;
-    virtual HRESULT GetTimecodeUserBits (/* out */ BMDTimecodeUserBits *userBits) = 0;
-
-protected:
-    virtual ~IDeckLinkTimecode () {}; // call Release method to drop reference count
-};
-
-
 /* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */
 
 class IDeckLinkVideoFrame : public IUnknown
@@ -903,10 +568,9 @@
     virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoFrame () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoFrame () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */
 
 class IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame
@@ -920,10 +584,9 @@
     virtual HRESULT SetTimecodeUserBits (/* in */ BMDTimecodeFormat format, /* in */ BMDTimecodeUserBits userBits) = 0;
 
 protected:
-    virtual ~IDeckLinkMutableVideoFrame () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkMutableVideoFrame () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkVideoFrame3DExtensions - Optional interface implemented on IDeckLinkVideoFrame to support 3D frames */
 
 class IDeckLinkVideoFrame3DExtensions : public IUnknown
@@ -933,10 +596,9 @@
     virtual HRESULT GetFrameForRightEye (/* out */ IDeckLinkVideoFrame* *rightEyeFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoFrame3DExtensions () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoFrame3DExtensions () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */
 
 class IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame
@@ -946,10 +608,9 @@
     virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoInputFrame () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoInputFrame () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkVideoFrameAncillary - Obtained through QueryInterface() on an IDeckLinkVideoFrame object. */
 
 class IDeckLinkVideoFrameAncillary : public IUnknown
@@ -961,10 +622,9 @@
     virtual BMDDisplayMode GetDisplayMode (void) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoFrameAncillary () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoFrameAncillary () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */
 
 class IDeckLinkAudioInputPacket : public IUnknown
@@ -975,10 +635,9 @@
     virtual HRESULT GetPacketTime (/* out */ BMDTimeValue *packetTime, /* in */ BMDTimeScale timeScale) = 0;
 
 protected:
-    virtual ~IDeckLinkAudioInputPacket () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkAudioInputPacket () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */
 
 class IDeckLinkScreenPreviewCallback : public IUnknown
@@ -987,10 +646,9 @@
     virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkScreenPreviewCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkScreenPreviewCallback () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */
 
 class IDeckLinkGLScreenPreviewHelper : public IUnknown
@@ -1005,29 +663,25 @@
     virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0;
 
 protected:
-    virtual ~IDeckLinkGLScreenPreviewHelper () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkGLScreenPreviewHelper () {} // call Release method to drop reference count
 };
 
+/* Interface IDeckLinkNotificationCallback - DeckLink Notification Callback Interface */
 
-/* Interface IDeckLinkConfiguration - DeckLink Configuration interface */
-
-class IDeckLinkConfiguration : public IUnknown
+class IDeckLinkNotificationCallback : public IUnknown
 {
 public:
-    virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0;
-    virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0;
-    virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0;
-    virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0;
-    virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0;
-    virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0;
-    virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ const char *value) = 0;
-    virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ const char **value) = 0;
-    virtual HRESULT WriteConfigurationToPreferences (void) = 0;
-
-protected:
-    virtual ~IDeckLinkConfiguration () {}; // call Release method to drop reference count
+    virtual HRESULT Notify (/* in */ BMDNotifications topic, /* in */ uint64_t param1, /* in */ uint64_t param2) = 0;
 };
 
+/* Interface IDeckLinkNotification - DeckLink Notification interface */
+
+class IDeckLinkNotification : public IUnknown
+{
+public:
+    virtual HRESULT Subscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0;
+    virtual HRESULT Unsubscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0;
+};
 
 /* Interface IDeckLinkAttributes - DeckLink Attribute interface */
 
@@ -1040,10 +694,9 @@
     virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ const char **value) = 0;
 
 protected:
-    virtual ~IDeckLinkAttributes () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkAttributes () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkKeyer - DeckLink Keyer interface */
 
 class IDeckLinkKeyer : public IUnknown
@@ -1056,10 +709,9 @@
     virtual HRESULT Disable (void) = 0;
 
 protected:
-    virtual ~IDeckLinkKeyer () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkKeyer () {} // call Release method to drop reference count
 };
 
-
 /* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */
 
 class IDeckLinkVideoConversion : public IUnknown
@@ -1068,80 +720,45 @@
     virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame* srcFrame, /* in */ IDeckLinkVideoFrame* dstFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoConversion () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoConversion () {} // call Release method to drop reference count
 };
 
+/* Interface IDeckLinkDeviceNotificationCallback - DeckLink device arrival/removal notification callbacks */
 
-/* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */
-
-class IDeckLinkDeckControlStatusCallback : public IUnknown
+class IDeckLinkDeviceNotificationCallback : public IUnknown
 {
 public:
-    virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0;
-    virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState newState, /* in */ BMDDeckControlError error) = 0;
-    virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0;
-    virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0;
+    virtual HRESULT DeckLinkDeviceArrived (/* in */ IDeckLink* deckLinkDevice) = 0;
+    virtual HRESULT DeckLinkDeviceRemoved (/* in */ IDeckLink* deckLinkDevice) = 0;
 
 protected:
-    virtual ~IDeckLinkDeckControlStatusCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkDeviceNotificationCallback () {} // call Release method to drop reference count
 };
 
+/* Interface IDeckLinkDiscovery - DeckLink device discovery */
 
-/* Interface IDeckLinkDeckControl - Deck Control main interface */
-
-class IDeckLinkDeckControl : public IUnknown
+class IDeckLinkDiscovery : public IUnknown
 {
 public:
-    virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Close (/* in */ bool standbyOn) = 0;
-    virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0;
-    virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0;
-    virtual HRESULT SendCommand (/* in */ uint8_t *inBuffer, /* in */ uint32_t inBufferSize, /* out */ uint8_t *outBuffer, /* out */ uint32_t *outDataSize, /* in */ uint32_t outBufferSize, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT GetTimecodeString (/* out */ const char **currentTimeCode, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0;
-    virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0;
-    virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0;
-    virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0;
-    virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0;
-    virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0;
-    virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0;
-    virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT Abort (void) = 0;
-    virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0;
-    virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0;
+    virtual HRESULT InstallDeviceNotifications (/* in */ IDeckLinkDeviceNotificationCallback* deviceNotificationCallback) = 0;
+    virtual HRESULT UninstallDeviceNotifications (void) = 0;
 
 protected:
-    virtual ~IDeckLinkDeckControl () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkDiscovery () {} // call Release method to drop reference count
 };
 
-
 /* Functions */
 
 extern "C" {
 
     IDeckLinkIterator* CreateDeckLinkIteratorInstance (void);
+    IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void);
     IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void);
     IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void);
     IDeckLinkVideoConversion* CreateVideoConversionInstance (void);
 
-};
+}
 
 
 #endif      // defined(__cplusplus)
-#endif      // __DeckLink_API_h__
+#endif /* defined(BMD_DECKLINKAPI_H) */
diff --git a/sys/decklink/linux/DeckLinkAPIConfiguration.h b/sys/decklink/linux/DeckLinkAPIConfiguration.h
new file mode 100644
index 0000000..def498c
--- /dev/null
+++ b/sys/decklink/linux/DeckLinkAPIConfiguration.h
@@ -0,0 +1,181 @@
+/* -LICENSE-START-
+** Copyright (c) 2014 Blackmagic Design
+**
+** Permission is hereby granted, free of charge, to any person or organization
+** obtaining a copy of the software and accompanying documentation covered by
+** this license (the "Software") to use, reproduce, display, distribute,
+** execute, and transmit the Software, and to prepare derivative works of the
+** Software, and to permit third-parties to whom the Software is furnished to
+** do so, all subject to the following:
+** 
+** The copyright notices in the Software and this entire statement, including
+** the above license grant, this restriction and the following disclaimer,
+** must be included in all copies of the Software, in whole or in part, and
+** all derivative works of the Software, unless such copies or derivative
+** works are solely in the form of machine-executable object code generated by
+** a source language processor.
+** 
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+** DEALINGS IN THE SOFTWARE.
+** -LICENSE-END-
+*/
+
+#ifndef BMD_DECKLINKAPICONFIGURATION_H
+#define BMD_DECKLINKAPICONFIGURATION_H
+
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
+// Type Declarations
+
+
+// Interface ID Declarations
+
+BMD_CONST REFIID IID_IDeckLinkConfiguration                       = /* 1E69FCF6-4203-4936-8076-2A9F4CFD50CB */ {0x1E,0x69,0xFC,0xF6,0x42,0x03,0x49,0x36,0x80,0x76,0x2A,0x9F,0x4C,0xFD,0x50,0xCB};
+
+/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */
+
+typedef uint32_t BMDDeckLinkConfigurationID;
+enum _BMDDeckLinkConfigurationID {
+
+    /* Serial port Flags */
+
+    bmdDeckLinkConfigSwapSerialRxTx                              = /* 'ssrt' */ 0x73737274,
+
+    /* Video Input/Output Flags */
+
+    bmdDeckLinkConfigUse1080pNotPsF                              = /* 'fpro' */ 0x6670726F,
+
+    /* Video Input/Output Integers */
+
+    bmdDeckLinkConfigHDMI3DPackingFormat                         = /* '3dpf' */ 0x33647066,
+    bmdDeckLinkConfigBypass                                      = /* 'byps' */ 0x62797073,
+    bmdDeckLinkConfigClockTimingAdjustment                       = /* 'ctad' */ 0x63746164,
+
+    /* Audio Input/Output Flags */
+
+    bmdDeckLinkConfigAnalogAudioConsumerLevels                   = /* 'aacl' */ 0x6161636C,
+
+    /* Video output flags */
+
+    bmdDeckLinkConfigFieldFlickerRemoval                         = /* 'fdfr' */ 0x66646672,
+    bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion            = /* 'to59' */ 0x746F3539,
+    bmdDeckLinkConfig444SDIVideoOutput                           = /* '444o' */ 0x3434346F,
+    bmdDeckLinkConfigSingleLinkVideoOutput                       = /* 'sglo' */ 0x73676C6F,
+    bmdDeckLinkConfigBlackVideoOutputDuringCapture               = /* 'bvoc' */ 0x62766F63,
+    bmdDeckLinkConfigLowLatencyVideoOutput                       = /* 'llvo' */ 0x6C6C766F,
+
+    /* Video Output Integers */
+
+    bmdDeckLinkConfigVideoOutputConnection                       = /* 'vocn' */ 0x766F636E,
+    bmdDeckLinkConfigVideoOutputConversionMode                   = /* 'vocm' */ 0x766F636D,
+    bmdDeckLinkConfigAnalogVideoOutputFlags                      = /* 'avof' */ 0x61766F66,
+    bmdDeckLinkConfigReferenceInputTimingOffset                  = /* 'glot' */ 0x676C6F74,
+    bmdDeckLinkConfigVideoOutputIdleOperation                    = /* 'voio' */ 0x766F696F,
+    bmdDeckLinkConfigDefaultVideoOutputMode                      = /* 'dvom' */ 0x64766F6D,
+    bmdDeckLinkConfigDefaultVideoOutputModeFlags                 = /* 'dvof' */ 0x64766F66,
+
+    /* Video Output Floats */
+
+    bmdDeckLinkConfigVideoOutputComponentLumaGain                = /* 'oclg' */ 0x6F636C67,
+    bmdDeckLinkConfigVideoOutputComponentChromaBlueGain          = /* 'occb' */ 0x6F636362,
+    bmdDeckLinkConfigVideoOutputComponentChromaRedGain           = /* 'occr' */ 0x6F636372,
+    bmdDeckLinkConfigVideoOutputCompositeLumaGain                = /* 'oilg' */ 0x6F696C67,
+    bmdDeckLinkConfigVideoOutputCompositeChromaGain              = /* 'oicg' */ 0x6F696367,
+    bmdDeckLinkConfigVideoOutputSVideoLumaGain                   = /* 'oslg' */ 0x6F736C67,
+    bmdDeckLinkConfigVideoOutputSVideoChromaGain                 = /* 'oscg' */ 0x6F736367,
+
+    /* Video Input Flags */
+
+    bmdDeckLinkConfigVideoInputScanning                          = /* 'visc' */ 0x76697363,	// Applicable to H264 Pro Recorder only
+    bmdDeckLinkConfigUseDedicatedLTCInput                        = /* 'dltc' */ 0x646C7463,	// Use timecode from LTC input instead of SDI stream
+
+    /* Video Input Integers */
+
+    bmdDeckLinkConfigVideoInputConnection                        = /* 'vicn' */ 0x7669636E,
+    bmdDeckLinkConfigAnalogVideoInputFlags                       = /* 'avif' */ 0x61766966,
+    bmdDeckLinkConfigVideoInputConversionMode                    = /* 'vicm' */ 0x7669636D,
+    bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame      = /* 'pdif' */ 0x70646966,
+    bmdDeckLinkConfigVANCSourceLine1Mapping                      = /* 'vsl1' */ 0x76736C31,
+    bmdDeckLinkConfigVANCSourceLine2Mapping                      = /* 'vsl2' */ 0x76736C32,
+    bmdDeckLinkConfigVANCSourceLine3Mapping                      = /* 'vsl3' */ 0x76736C33,
+    bmdDeckLinkConfigCapturePassThroughMode                      = /* 'cptm' */ 0x6370746D,
+
+    /* Video Input Floats */
+
+    bmdDeckLinkConfigVideoInputComponentLumaGain                 = /* 'iclg' */ 0x69636C67,
+    bmdDeckLinkConfigVideoInputComponentChromaBlueGain           = /* 'iccb' */ 0x69636362,
+    bmdDeckLinkConfigVideoInputComponentChromaRedGain            = /* 'iccr' */ 0x69636372,
+    bmdDeckLinkConfigVideoInputCompositeLumaGain                 = /* 'iilg' */ 0x69696C67,
+    bmdDeckLinkConfigVideoInputCompositeChromaGain               = /* 'iicg' */ 0x69696367,
+    bmdDeckLinkConfigVideoInputSVideoLumaGain                    = /* 'islg' */ 0x69736C67,
+    bmdDeckLinkConfigVideoInputSVideoChromaGain                  = /* 'iscg' */ 0x69736367,
+
+    /* Audio Input Integers */
+
+    bmdDeckLinkConfigAudioInputConnection                        = /* 'aicn' */ 0x6169636E,
+
+    /* Audio Input Floats */
+
+    bmdDeckLinkConfigAnalogAudioInputScaleChannel1               = /* 'ais1' */ 0x61697331,
+    bmdDeckLinkConfigAnalogAudioInputScaleChannel2               = /* 'ais2' */ 0x61697332,
+    bmdDeckLinkConfigAnalogAudioInputScaleChannel3               = /* 'ais3' */ 0x61697333,
+    bmdDeckLinkConfigAnalogAudioInputScaleChannel4               = /* 'ais4' */ 0x61697334,
+    bmdDeckLinkConfigDigitalAudioInputScale                      = /* 'dais' */ 0x64616973,
+
+    /* Audio Output Integers */
+
+    bmdDeckLinkConfigAudioOutputAESAnalogSwitch                  = /* 'aoaa' */ 0x616F6161,
+
+    /* Audio Output Floats */
+
+    bmdDeckLinkConfigAnalogAudioOutputScaleChannel1              = /* 'aos1' */ 0x616F7331,
+    bmdDeckLinkConfigAnalogAudioOutputScaleChannel2              = /* 'aos2' */ 0x616F7332,
+    bmdDeckLinkConfigAnalogAudioOutputScaleChannel3              = /* 'aos3' */ 0x616F7333,
+    bmdDeckLinkConfigAnalogAudioOutputScaleChannel4              = /* 'aos4' */ 0x616F7334,
+    bmdDeckLinkConfigDigitalAudioOutputScale                     = /* 'daos' */ 0x64616F73
+};
+
+// Forward Declarations
+
+class IDeckLinkConfiguration;
+
+/* Interface IDeckLinkConfiguration - DeckLink Configuration interface */
+
+class IDeckLinkConfiguration : public IUnknown
+{
+public:
+    virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0;
+    virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0;
+    virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0;
+    virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0;
+    virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0;
+    virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0;
+    virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ const char *value) = 0;
+    virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ const char **value) = 0;
+    virtual HRESULT WriteConfigurationToPreferences (void) = 0;
+
+protected:
+    virtual ~IDeckLinkConfiguration () {} // call Release method to drop reference count
+};
+
+/* Functions */
+
+extern "C" {
+
+
+}
+
+
+#endif /* defined(BMD_DECKLINKAPICONFIGURATION_H) */
diff --git a/sys/decklink/linux/DeckLinkAPIDeckControl.h b/sys/decklink/linux/DeckLinkAPIDeckControl.h
new file mode 100644
index 0000000..b83d013
--- /dev/null
+++ b/sys/decklink/linux/DeckLinkAPIDeckControl.h
@@ -0,0 +1,215 @@
+/* -LICENSE-START-
+** Copyright (c) 2014 Blackmagic Design
+**
+** Permission is hereby granted, free of charge, to any person or organization
+** obtaining a copy of the software and accompanying documentation covered by
+** this license (the "Software") to use, reproduce, display, distribute,
+** execute, and transmit the Software, and to prepare derivative works of the
+** Software, and to permit third-parties to whom the Software is furnished to
+** do so, all subject to the following:
+** 
+** The copyright notices in the Software and this entire statement, including
+** the above license grant, this restriction and the following disclaimer,
+** must be included in all copies of the Software, in whole or in part, and
+** all derivative works of the Software, unless such copies or derivative
+** works are solely in the form of machine-executable object code generated by
+** a source language processor.
+** 
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+** DEALINGS IN THE SOFTWARE.
+** -LICENSE-END-
+*/
+
+#ifndef BMD_DECKLINKAPIDECKCONTROL_H
+#define BMD_DECKLINKAPIDECKCONTROL_H
+
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
+// Type Declarations
+
+
+// Interface ID Declarations
+
+BMD_CONST REFIID IID_IDeckLinkDeckControlStatusCallback           = /* 53436FFB-B434-4906-BADC-AE3060FFE8EF */ {0x53,0x43,0x6F,0xFB,0xB4,0x34,0x49,0x06,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF};
+BMD_CONST REFIID IID_IDeckLinkDeckControl                         = /* 8E1C3ACE-19C7-4E00-8B92-D80431D958BE */ {0x8E,0x1C,0x3A,0xCE,0x19,0xC7,0x4E,0x00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE};
+
+/* Enum BMDDeckControlMode - DeckControl mode */
+
+typedef uint32_t BMDDeckControlMode;
+enum _BMDDeckControlMode {
+    bmdDeckControlNotOpened                                      = /* 'ntop' */ 0x6E746F70,
+    bmdDeckControlVTRControlMode                                 = /* 'vtrc' */ 0x76747263,
+    bmdDeckControlExportMode                                     = /* 'expm' */ 0x6578706D,
+    bmdDeckControlCaptureMode                                    = /* 'capm' */ 0x6361706D
+};
+
+/* Enum BMDDeckControlEvent - DeckControl event */
+
+typedef uint32_t BMDDeckControlEvent;
+enum _BMDDeckControlEvent {
+    bmdDeckControlAbortedEvent                                   = /* 'abte' */ 0x61627465,	// This event is triggered when a capture or edit-to-tape operation is aborted.
+
+    /* Export-To-Tape events */
+
+    bmdDeckControlPrepareForExportEvent                          = /* 'pfee' */ 0x70666565,	// This event is triggered a few frames before reaching the in-point. IDeckLinkInput::StartScheduledPlayback() should be called at this point.
+    bmdDeckControlExportCompleteEvent                            = /* 'exce' */ 0x65786365,	// This event is triggered a few frames after reaching the out-point. At this point, it is safe to stop playback.
+
+    /* Capture events */
+
+    bmdDeckControlPrepareForCaptureEvent                         = /* 'pfce' */ 0x70666365,	// This event is triggered a few frames before reaching the in-point. The serial timecode attached to IDeckLinkVideoInputFrames is now valid.
+    bmdDeckControlCaptureCompleteEvent                           = /* 'ccev' */ 0x63636576	// This event is triggered a few frames after reaching the out-point.
+};
+
+/* Enum BMDDeckControlVTRControlState - VTR Control state */
+
+typedef uint32_t BMDDeckControlVTRControlState;
+enum _BMDDeckControlVTRControlState {
+    bmdDeckControlNotInVTRControlMode                            = /* 'nvcm' */ 0x6E76636D,
+    bmdDeckControlVTRControlPlaying                              = /* 'vtrp' */ 0x76747270,
+    bmdDeckControlVTRControlRecording                            = /* 'vtrr' */ 0x76747272,
+    bmdDeckControlVTRControlStill                                = /* 'vtra' */ 0x76747261,
+    bmdDeckControlVTRControlShuttleForward                       = /* 'vtsf' */ 0x76747366,
+    bmdDeckControlVTRControlShuttleReverse                       = /* 'vtsr' */ 0x76747372,
+    bmdDeckControlVTRControlJogForward                           = /* 'vtjf' */ 0x76746A66,
+    bmdDeckControlVTRControlJogReverse                           = /* 'vtjr' */ 0x76746A72,
+    bmdDeckControlVTRControlStopped                              = /* 'vtro' */ 0x7674726F
+};
+
+/* Enum BMDDeckControlStatusFlags - Deck Control status flags */
+
+typedef uint32_t BMDDeckControlStatusFlags;
+enum _BMDDeckControlStatusFlags {
+    bmdDeckControlStatusDeckConnected                            = 1 << 0,
+    bmdDeckControlStatusRemoteMode                               = 1 << 1,
+    bmdDeckControlStatusRecordInhibited                          = 1 << 2,
+    bmdDeckControlStatusCassetteOut                              = 1 << 3
+};
+
+/* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */
+
+typedef uint32_t BMDDeckControlExportModeOpsFlags;
+enum _BMDDeckControlExportModeOpsFlags {
+    bmdDeckControlExportModeInsertVideo                          = 1 << 0,
+    bmdDeckControlExportModeInsertAudio1                         = 1 << 1,
+    bmdDeckControlExportModeInsertAudio2                         = 1 << 2,
+    bmdDeckControlExportModeInsertAudio3                         = 1 << 3,
+    bmdDeckControlExportModeInsertAudio4                         = 1 << 4,
+    bmdDeckControlExportModeInsertAudio5                         = 1 << 5,
+    bmdDeckControlExportModeInsertAudio6                         = 1 << 6,
+    bmdDeckControlExportModeInsertAudio7                         = 1 << 7,
+    bmdDeckControlExportModeInsertAudio8                         = 1 << 8,
+    bmdDeckControlExportModeInsertAudio9                         = 1 << 9,
+    bmdDeckControlExportModeInsertAudio10                        = 1 << 10,
+    bmdDeckControlExportModeInsertAudio11                        = 1 << 11,
+    bmdDeckControlExportModeInsertAudio12                        = 1 << 12,
+    bmdDeckControlExportModeInsertTimeCode                       = 1 << 13,
+    bmdDeckControlExportModeInsertAssemble                       = 1 << 14,
+    bmdDeckControlExportModeInsertPreview                        = 1 << 15,
+    bmdDeckControlUseManualExport                                = 1 << 16
+};
+
+/* Enum BMDDeckControlError - Deck Control error */
+
+typedef uint32_t BMDDeckControlError;
+enum _BMDDeckControlError {
+    bmdDeckControlNoError                                        = /* 'noer' */ 0x6E6F6572,
+    bmdDeckControlModeError                                      = /* 'moer' */ 0x6D6F6572,
+    bmdDeckControlMissedInPointError                             = /* 'mier' */ 0x6D696572,
+    bmdDeckControlDeckTimeoutError                               = /* 'dter' */ 0x64746572,
+    bmdDeckControlCommandFailedError                             = /* 'cfer' */ 0x63666572,
+    bmdDeckControlDeviceAlreadyOpenedError                       = /* 'dalo' */ 0x64616C6F,
+    bmdDeckControlFailedToOpenDeviceError                        = /* 'fder' */ 0x66646572,
+    bmdDeckControlInLocalModeError                               = /* 'lmer' */ 0x6C6D6572,
+    bmdDeckControlEndOfTapeError                                 = /* 'eter' */ 0x65746572,
+    bmdDeckControlUserAbortError                                 = /* 'uaer' */ 0x75616572,
+    bmdDeckControlNoTapeInDeckError                              = /* 'nter' */ 0x6E746572,
+    bmdDeckControlNoVideoFromCardError                           = /* 'nvfc' */ 0x6E766663,
+    bmdDeckControlNoCommunicationError                           = /* 'ncom' */ 0x6E636F6D,
+    bmdDeckControlBufferTooSmallError                            = /* 'btsm' */ 0x6274736D,
+    bmdDeckControlBadChecksumError                               = /* 'chks' */ 0x63686B73,
+    bmdDeckControlUnknownError                                   = /* 'uner' */ 0x756E6572
+};
+
+// Forward Declarations
+
+class IDeckLinkDeckControlStatusCallback;
+class IDeckLinkDeckControl;
+
+/* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */
+
+class IDeckLinkDeckControlStatusCallback : public IUnknown
+{
+public:
+    virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0;
+    virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState newState, /* in */ BMDDeckControlError error) = 0;
+    virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0;
+    virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0;
+
+protected:
+    virtual ~IDeckLinkDeckControlStatusCallback () {} // call Release method to drop reference count
+};
+
+/* Interface IDeckLinkDeckControl - Deck Control main interface */
+
+class IDeckLinkDeckControl : public IUnknown
+{
+public:
+    virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Close (/* in */ bool standbyOn) = 0;
+    virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0;
+    virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0;
+    virtual HRESULT SendCommand (/* in */ uint8_t *inBuffer, /* in */ uint32_t inBufferSize, /* out */ uint8_t *outBuffer, /* out */ uint32_t *outDataSize, /* in */ uint32_t outBufferSize, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT GetTimecodeString (/* out */ const char **currentTimeCode, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0;
+    virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0;
+    virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0;
+    virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0;
+    virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0;
+    virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0;
+    virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0;
+    virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT Abort (void) = 0;
+    virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0;
+    virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0;
+
+protected:
+    virtual ~IDeckLinkDeckControl () {} // call Release method to drop reference count
+};
+
+/* Functions */
+
+extern "C" {
+
+
+}
+
+
+#endif /* defined(BMD_DECKLINKAPIDECKCONTROL_H) */
diff --git a/sys/decklink/linux/DeckLinkAPIDiscovery.h b/sys/decklink/linux/DeckLinkAPIDiscovery.h
new file mode 100644
index 0000000..424d9d5
--- /dev/null
+++ b/sys/decklink/linux/DeckLinkAPIDiscovery.h
@@ -0,0 +1,71 @@
+/* -LICENSE-START-
+** Copyright (c) 2014 Blackmagic Design
+**
+** Permission is hereby granted, free of charge, to any person or organization
+** obtaining a copy of the software and accompanying documentation covered by
+** this license (the "Software") to use, reproduce, display, distribute,
+** execute, and transmit the Software, and to prepare derivative works of the
+** Software, and to permit third-parties to whom the Software is furnished to
+** do so, all subject to the following:
+** 
+** The copyright notices in the Software and this entire statement, including
+** the above license grant, this restriction and the following disclaimer,
+** must be included in all copies of the Software, in whole or in part, and
+** all derivative works of the Software, unless such copies or derivative
+** works are solely in the form of machine-executable object code generated by
+** a source language processor.
+** 
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+** DEALINGS IN THE SOFTWARE.
+** -LICENSE-END-
+*/
+
+#ifndef BMD_DECKLINKAPIDISCOVERY_H
+#define BMD_DECKLINKAPIDISCOVERY_H
+
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
+// Type Declarations
+
+
+// Interface ID Declarations
+
+BMD_CONST REFIID IID_IDeckLink                                    = /* C418FBDD-0587-48ED-8FE5-640F0A14AF91 */ {0xC4,0x18,0xFB,0xDD,0x05,0x87,0x48,0xED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91};
+
+// Forward Declarations
+
+class IDeckLink;
+
+/* Interface IDeckLink - represents a DeckLink device */
+
+class IDeckLink : public IUnknown
+{
+public:
+    virtual HRESULT GetModelName (/* out */ const char **modelName) = 0;
+    virtual HRESULT GetDisplayName (/* out */ const char **displayName) = 0;
+
+protected:
+    virtual ~IDeckLink () {} // call Release method to drop reference count
+};
+
+/* Functions */
+
+extern "C" {
+
+
+}
+
+
+#endif /* defined(BMD_DECKLINKAPIDISCOVERY_H) */
diff --git a/sys/decklink/linux/DeckLinkAPIDispatch.cpp b/sys/decklink/linux/DeckLinkAPIDispatch.cpp
index 957f9a4..d285337 100644
--- a/sys/decklink/linux/DeckLinkAPIDispatch.cpp
+++ b/sys/decklink/linux/DeckLinkAPIDispatch.cpp
@@ -34,116 +34,115 @@
 #define kDeckLinkAPI_Name "libDeckLinkAPI.so"
 #define KDeckLinkPreviewAPI_Name "libDeckLinkPreviewAPI.so"
 
-typedef IDeckLinkIterator *(*CreateIteratorFunc) (void);
-typedef IDeckLinkAPIInformation *(*CreateAPIInformationFunc) (void);
-typedef IDeckLinkGLScreenPreviewHelper
-    *(*CreateOpenGLScreenPreviewHelperFunc) (void);
-typedef IDeckLinkVideoConversion *(*CreateVideoConversionInstanceFunc) (void);
+typedef IDeckLinkIterator* (*CreateIteratorFunc)(void);
+typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void);
+typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void);
+typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void);
+typedef IDeckLinkDiscovery* (*CreateDeckLinkDiscoveryInstanceFunc)(void);
 
-static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT;
-static pthread_once_t gPreviewOnceControl = PTHREAD_ONCE_INIT;
+static pthread_once_t					gDeckLinkOnceControl = PTHREAD_ONCE_INIT;
+static pthread_once_t					gPreviewOnceControl = PTHREAD_ONCE_INIT;
 
-static bool gLoadedDeckLinkAPI = false;
+static bool								gLoadedDeckLinkAPI = false;
 
-static CreateIteratorFunc gCreateIteratorFunc = NULL;
-static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL;
-static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL;
-static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL;
+static CreateIteratorFunc					gCreateIteratorFunc = NULL;
+static CreateAPIInformationFunc				gCreateAPIInformationFunc = NULL;
+static CreateOpenGLScreenPreviewHelperFunc	gCreateOpenGLPreviewFunc = NULL;
+static CreateVideoConversionInstanceFunc	gCreateVideoConversionFunc	= NULL;
+static CreateDeckLinkDiscoveryInstanceFunc	gCreateDeckLinkDiscoveryFunc = NULL;
 
-void InitDeckLinkAPI (void);
-void
-InitDeckLinkAPI (void)
+static void	InitDeckLinkAPI (void)
 {
-  void *libraryHandle;
-
-  libraryHandle = dlopen (kDeckLinkAPI_Name, RTLD_NOW | RTLD_GLOBAL);
-  if (!libraryHandle) {
-    fprintf (stderr, "%s\n", dlerror ());
-    return;
-  }
-
-  gLoadedDeckLinkAPI = true;
-
-  gCreateIteratorFunc =
-      (CreateIteratorFunc) dlsym (libraryHandle,
-      "CreateDeckLinkIteratorInstance_0001");
-  if (!gCreateIteratorFunc)
-    fprintf (stderr, "%s\n", dlerror ());
-  gCreateAPIInformationFunc =
-      (CreateAPIInformationFunc) dlsym (libraryHandle,
-      "CreateDeckLinkAPIInformationInstance_0001");
-  if (!gCreateAPIInformationFunc)
-    fprintf (stderr, "%s\n", dlerror ());
-  gCreateVideoConversionFunc =
-      (CreateVideoConversionInstanceFunc) dlsym (libraryHandle,
-      "CreateVideoConversionInstance_0001");
-  if (!gCreateVideoConversionFunc)
-    fprintf (stderr, "%s\n", dlerror ());
+	void *libraryHandle;
+	
+	libraryHandle = dlopen(kDeckLinkAPI_Name, RTLD_NOW|RTLD_GLOBAL);
+	if (!libraryHandle)
+	{
+		fprintf(stderr, "%s\n", dlerror());
+		return;
+	}
+	
+	gLoadedDeckLinkAPI = true;
+	
+	gCreateIteratorFunc = (CreateIteratorFunc)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance_0002");
+	if (!gCreateIteratorFunc)
+		fprintf(stderr, "%s\n", dlerror());
+	gCreateAPIInformationFunc = (CreateAPIInformationFunc)dlsym(libraryHandle, "CreateDeckLinkAPIInformationInstance_0001");
+	if (!gCreateAPIInformationFunc)
+		fprintf(stderr, "%s\n", dlerror());
+	gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)dlsym(libraryHandle, "CreateVideoConversionInstance_0001");
+	if (!gCreateVideoConversionFunc)
+		fprintf(stderr, "%s\n", dlerror());
+	gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)dlsym(libraryHandle, "CreateDeckLinkDiscoveryInstance_0001");
+	if (!gCreateDeckLinkDiscoveryFunc)
+		fprintf(stderr, "%s\n", dlerror());
 }
 
-void InitDeckLinkPreviewAPI (void);
-void
-InitDeckLinkPreviewAPI (void)
+static void	InitDeckLinkPreviewAPI (void)
 {
-  void *libraryHandle;
-
-  libraryHandle = dlopen (KDeckLinkPreviewAPI_Name, RTLD_NOW | RTLD_GLOBAL);
-  if (!libraryHandle) {
-    fprintf (stderr, "%s\n", dlerror ());
-    return;
-  }
-  gCreateOpenGLPreviewFunc =
-      (CreateOpenGLScreenPreviewHelperFunc) dlsym (libraryHandle,
-      "CreateOpenGLScreenPreviewHelper_0001");
-  if (!gCreateOpenGLPreviewFunc)
-    fprintf (stderr, "%s\n", dlerror ());
+	void *libraryHandle;
+	
+	libraryHandle = dlopen(KDeckLinkPreviewAPI_Name, RTLD_NOW|RTLD_GLOBAL);
+	if (!libraryHandle)
+	{
+		fprintf(stderr, "%s\n", dlerror());
+		return;
+	}
+	gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)dlsym(libraryHandle, "CreateOpenGLScreenPreviewHelper_0001");
+	if (!gCreateOpenGLPreviewFunc)
+		fprintf(stderr, "%s\n", dlerror());
 }
 
-bool IsDeckLinkAPIPresent (void);
-bool
-IsDeckLinkAPIPresent (void)
+#if 0
+bool		IsDeckLinkAPIPresent (void)
 {
-  // If the DeckLink API dynamic library was successfully loaded, return this knowledge to the caller
-  return gLoadedDeckLinkAPI;
+	// If the DeckLink API dynamic library was successfully loaded, return this knowledge to the caller
+	return gLoadedDeckLinkAPI;
+}
+#endif
+
+IDeckLinkIterator*		CreateDeckLinkIteratorInstance (void)
+{
+	pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
+	
+	if (gCreateIteratorFunc == NULL)
+		return NULL;
+	return gCreateIteratorFunc();
 }
 
-IDeckLinkIterator *
-CreateDeckLinkIteratorInstance (void)
+IDeckLinkAPIInformation*	CreateDeckLinkAPIInformationInstance (void)
 {
-  pthread_once (&gDeckLinkOnceControl, InitDeckLinkAPI);
-
-  if (gCreateIteratorFunc == NULL)
-    return NULL;
-  return gCreateIteratorFunc ();
+	pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
+	
+	if (gCreateAPIInformationFunc == NULL)
+		return NULL;
+	return gCreateAPIInformationFunc();
 }
 
-IDeckLinkAPIInformation *
-CreateDeckLinkAPIInformationInstance (void)
+IDeckLinkGLScreenPreviewHelper*		CreateOpenGLScreenPreviewHelper (void)
 {
-  pthread_once (&gDeckLinkOnceControl, InitDeckLinkAPI);
-
-  if (gCreateAPIInformationFunc == NULL)
-    return NULL;
-  return gCreateAPIInformationFunc ();
+	pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
+	pthread_once(&gPreviewOnceControl, InitDeckLinkPreviewAPI);
+	
+	if (gCreateOpenGLPreviewFunc == NULL)
+		return NULL;
+	return gCreateOpenGLPreviewFunc();
 }
 
-IDeckLinkGLScreenPreviewHelper *
-CreateOpenGLScreenPreviewHelper (void)
+IDeckLinkVideoConversion* CreateVideoConversionInstance (void)
 {
-  pthread_once (&gDeckLinkOnceControl, InitDeckLinkAPI);
-  pthread_once (&gPreviewOnceControl, InitDeckLinkPreviewAPI);
-
-  if (gCreateOpenGLPreviewFunc == NULL)
-    return NULL;
-  return gCreateOpenGLPreviewFunc ();
+	pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
+	
+	if (gCreateVideoConversionFunc == NULL)
+		return NULL;
+	return gCreateVideoConversionFunc();
 }
 
-IDeckLinkVideoConversion *
-CreateVideoConversionInstance (void)
+IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void)
 {
-  pthread_once (&gDeckLinkOnceControl, InitDeckLinkAPI);
-
-  if (gCreateVideoConversionFunc == NULL)
-    return NULL;
-  return gCreateVideoConversionFunc ();
+	pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
+	
+	if (gCreateDeckLinkDiscoveryFunc == NULL)
+		return NULL;
+	return gCreateDeckLinkDiscoveryFunc();
 }
diff --git a/sys/decklink/linux/DeckLinkAPIModes.h b/sys/decklink/linux/DeckLinkAPIModes.h
new file mode 100644
index 0000000..394d68c
--- /dev/null
+++ b/sys/decklink/linux/DeckLinkAPIModes.h
@@ -0,0 +1,191 @@
+/* -LICENSE-START-
+** Copyright (c) 2014 Blackmagic Design
+**
+** Permission is hereby granted, free of charge, to any person or organization
+** obtaining a copy of the software and accompanying documentation covered by
+** this license (the "Software") to use, reproduce, display, distribute,
+** execute, and transmit the Software, and to prepare derivative works of the
+** Software, and to permit third-parties to whom the Software is furnished to
+** do so, all subject to the following:
+** 
+** The copyright notices in the Software and this entire statement, including
+** the above license grant, this restriction and the following disclaimer,
+** must be included in all copies of the Software, in whole or in part, and
+** all derivative works of the Software, unless such copies or derivative
+** works are solely in the form of machine-executable object code generated by
+** a source language processor.
+** 
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+** DEALINGS IN THE SOFTWARE.
+** -LICENSE-END-
+*/
+
+#ifndef BMD_DECKLINKAPIMODES_H
+#define BMD_DECKLINKAPIMODES_H
+
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
+// Type Declarations
+
+
+// Interface ID Declarations
+
+BMD_CONST REFIID IID_IDeckLinkDisplayModeIterator                 = /* 9C88499F-F601-4021-B80B-032E4EB41C35 */ {0x9C,0x88,0x49,0x9F,0xF6,0x01,0x40,0x21,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35};
+BMD_CONST REFIID IID_IDeckLinkDisplayMode                         = /* 3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78 */ {0x3E,0xB2,0xC1,0xAB,0x0A,0x3D,0x45,0x23,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78};
+
+/* Enum BMDDisplayMode - Video display modes */
+
+typedef uint32_t BMDDisplayMode;
+enum _BMDDisplayMode {
+
+    /* SD Modes */
+
+    bmdModeNTSC                                                  = /* 'ntsc' */ 0x6E747363,
+    bmdModeNTSC2398                                              = /* 'nt23' */ 0x6E743233,	// 3:2 pulldown
+    bmdModePAL                                                   = /* 'pal ' */ 0x70616C20,
+    bmdModeNTSCp                                                 = /* 'ntsp' */ 0x6E747370,
+    bmdModePALp                                                  = /* 'palp' */ 0x70616C70,
+
+    /* HD 1080 Modes */
+
+    bmdModeHD1080p2398                                           = /* '23ps' */ 0x32337073,
+    bmdModeHD1080p24                                             = /* '24ps' */ 0x32347073,
+    bmdModeHD1080p25                                             = /* 'Hp25' */ 0x48703235,
+    bmdModeHD1080p2997                                           = /* 'Hp29' */ 0x48703239,
+    bmdModeHD1080p30                                             = /* 'Hp30' */ 0x48703330,
+    bmdModeHD1080i50                                             = /* 'Hi50' */ 0x48693530,
+    bmdModeHD1080i5994                                           = /* 'Hi59' */ 0x48693539,
+    bmdModeHD1080i6000                                           = /* 'Hi60' */ 0x48693630,	// N.B. This _really_ is 60.00 Hz.
+    bmdModeHD1080p50                                             = /* 'Hp50' */ 0x48703530,
+    bmdModeHD1080p5994                                           = /* 'Hp59' */ 0x48703539,
+    bmdModeHD1080p6000                                           = /* 'Hp60' */ 0x48703630,	// N.B. This _really_ is 60.00 Hz.
+
+    /* HD 720 Modes */
+
+    bmdModeHD720p50                                              = /* 'hp50' */ 0x68703530,
+    bmdModeHD720p5994                                            = /* 'hp59' */ 0x68703539,
+    bmdModeHD720p60                                              = /* 'hp60' */ 0x68703630,
+
+    /* 2k Modes */
+
+    bmdMode2k2398                                                = /* '2k23' */ 0x326B3233,
+    bmdMode2k24                                                  = /* '2k24' */ 0x326B3234,
+    bmdMode2k25                                                  = /* '2k25' */ 0x326B3235,
+
+    /* DCI Modes (output only) */
+
+    bmdMode2kDCI2398                                             = /* '2d23' */ 0x32643233,
+    bmdMode2kDCI24                                               = /* '2d24' */ 0x32643234,
+    bmdMode2kDCI25                                               = /* '2d25' */ 0x32643235,
+
+    /* 4k Modes */
+
+    bmdMode4K2160p2398                                           = /* '4k23' */ 0x346B3233,
+    bmdMode4K2160p24                                             = /* '4k24' */ 0x346B3234,
+    bmdMode4K2160p25                                             = /* '4k25' */ 0x346B3235,
+    bmdMode4K2160p2997                                           = /* '4k29' */ 0x346B3239,
+    bmdMode4K2160p30                                             = /* '4k30' */ 0x346B3330,
+    bmdMode4K2160p50                                             = /* '4k50' */ 0x346B3530,
+    bmdMode4K2160p5994                                           = /* '4k59' */ 0x346B3539,
+    bmdMode4K2160p60                                             = /* '4k60' */ 0x346B3630,
+
+    /* DCI Modes (output only) */
+
+    bmdMode4kDCI2398                                             = /* '4d23' */ 0x34643233,
+    bmdMode4kDCI24                                               = /* '4d24' */ 0x34643234,
+    bmdMode4kDCI25                                               = /* '4d25' */ 0x34643235,
+
+    /* Special Modes */
+
+    bmdModeUnknown                                               = /* 'iunk' */ 0x69756E6B
+};
+
+/* Enum BMDFieldDominance - Video field dominance */
+
+typedef uint32_t BMDFieldDominance;
+enum _BMDFieldDominance {
+    bmdUnknownFieldDominance                                     = 0,
+    bmdLowerFieldFirst                                           = /* 'lowr' */ 0x6C6F7772,
+    bmdUpperFieldFirst                                           = /* 'uppr' */ 0x75707072,
+    bmdProgressiveFrame                                          = /* 'prog' */ 0x70726F67,
+    bmdProgressiveSegmentedFrame                                 = /* 'psf ' */ 0x70736620
+};
+
+/* Enum BMDPixelFormat - Video pixel formats supported for output/input */
+
+typedef uint32_t BMDPixelFormat;
+enum _BMDPixelFormat {
+    bmdFormat8BitYUV                                             = /* '2vuy' */ 0x32767579,
+    bmdFormat10BitYUV                                            = /* 'v210' */ 0x76323130,
+    bmdFormat8BitARGB                                            = 32,
+    bmdFormat8BitBGRA                                            = /* 'BGRA' */ 0x42475241,
+    bmdFormat10BitRGB                                            = /* 'r210' */ 0x72323130,	// Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10
+    bmdFormat12BitRGB                                            = /* 'R12B' */ 0x52313242,	// Big-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component
+    bmdFormat12BitRGBLE                                          = /* 'R12L' */ 0x5231324C,	// Little-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component
+    bmdFormat10BitRGBXLE                                         = /* 'R10l' */ 0x5231306C,	// Little-endian 10-bit RGB with SMPTE video levels (64-940)
+    bmdFormat10BitRGBX                                           = /* 'R10b' */ 0x52313062	// Big-endian 10-bit RGB with SMPTE video levels (64-940)
+};
+
+/* Enum BMDDisplayModeFlags - Flags to describe the characteristics of an IDeckLinkDisplayMode. */
+
+typedef uint32_t BMDDisplayModeFlags;
+enum _BMDDisplayModeFlags {
+    bmdDisplayModeSupports3D                                     = 1 << 0,
+    bmdDisplayModeColorspaceRec601                               = 1 << 1,
+    bmdDisplayModeColorspaceRec709                               = 1 << 2
+};
+
+// Forward Declarations
+
+class IDeckLinkDisplayModeIterator;
+class IDeckLinkDisplayMode;
+
+/* Interface IDeckLinkDisplayModeIterator - enumerates over supported input/output display modes. */
+
+class IDeckLinkDisplayModeIterator : public IUnknown
+{
+public:
+    virtual HRESULT Next (/* out */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0;
+
+protected:
+    virtual ~IDeckLinkDisplayModeIterator () {} // call Release method to drop reference count
+};
+
+/* Interface IDeckLinkDisplayMode - represents a display mode */
+
+class IDeckLinkDisplayMode : public IUnknown
+{
+public:
+    virtual HRESULT GetName (/* out */ const char **name) = 0;
+    virtual BMDDisplayMode GetDisplayMode (void) = 0;
+    virtual long GetWidth (void) = 0;
+    virtual long GetHeight (void) = 0;
+    virtual HRESULT GetFrameRate (/* out */ BMDTimeValue *frameDuration, /* out */ BMDTimeScale *timeScale) = 0;
+    virtual BMDFieldDominance GetFieldDominance (void) = 0;
+    virtual BMDDisplayModeFlags GetFlags (void) = 0;
+
+protected:
+    virtual ~IDeckLinkDisplayMode () {} // call Release method to drop reference count
+};
+
+/* Functions */
+
+extern "C" {
+
+
+}
+
+
+#endif /* defined(BMD_DECKLINKAPIMODES_H) */
diff --git a/sys/decklink/linux/DeckLinkAPITypes.h b/sys/decklink/linux/DeckLinkAPITypes.h
new file mode 100644
index 0000000..55e015f
--- /dev/null
+++ b/sys/decklink/linux/DeckLinkAPITypes.h
@@ -0,0 +1,110 @@
+/* -LICENSE-START-
+** Copyright (c) 2014 Blackmagic Design
+**
+** Permission is hereby granted, free of charge, to any person or organization
+** obtaining a copy of the software and accompanying documentation covered by
+** this license (the "Software") to use, reproduce, display, distribute,
+** execute, and transmit the Software, and to prepare derivative works of the
+** Software, and to permit third-parties to whom the Software is furnished to
+** do so, all subject to the following:
+** 
+** The copyright notices in the Software and this entire statement, including
+** the above license grant, this restriction and the following disclaimer,
+** must be included in all copies of the Software, in whole or in part, and
+** all derivative works of the Software, unless such copies or derivative
+** works are solely in the form of machine-executable object code generated by
+** a source language processor.
+** 
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+** DEALINGS IN THE SOFTWARE.
+** -LICENSE-END-
+*/
+
+#ifndef BMD_DECKLINKAPITYPES_H
+#define BMD_DECKLINKAPITYPES_H
+
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
+// Type Declarations
+
+typedef int64_t BMDTimeValue;
+typedef int64_t BMDTimeScale;
+typedef uint32_t BMDTimecodeBCD;
+typedef uint32_t BMDTimecodeUserBits;
+
+// Interface ID Declarations
+
+BMD_CONST REFIID IID_IDeckLinkTimecode                            = /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ {0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40};
+
+/* Enum BMDTimecodeFlags - Timecode flags */
+
+typedef uint32_t BMDTimecodeFlags;
+enum _BMDTimecodeFlags {
+    bmdTimecodeFlagDefault                                       = 0,
+    bmdTimecodeIsDropFrame                                       = 1 << 0,
+    bmdTimecodeFieldMark                                         = 1 << 1
+};
+
+/* Enum BMDVideoConnection - Video connection types */
+
+typedef uint32_t BMDVideoConnection;
+enum _BMDVideoConnection {
+    bmdVideoConnectionSDI                                        = 1 << 0,
+    bmdVideoConnectionHDMI                                       = 1 << 1,
+    bmdVideoConnectionOpticalSDI                                 = 1 << 2,
+    bmdVideoConnectionComponent                                  = 1 << 3,
+    bmdVideoConnectionComposite                                  = 1 << 4,
+    bmdVideoConnectionSVideo                                     = 1 << 5
+};
+
+/* Enum BMDAudioConnection - Audio connection types */
+
+typedef uint32_t BMDAudioConnection;
+enum _BMDAudioConnection {
+    bmdAudioConnectionEmbedded                                   = 1 << 0,
+    bmdAudioConnectionAESEBU                                     = 1 << 1,
+    bmdAudioConnectionAnalog                                     = 1 << 2,
+    bmdAudioConnectionAnalogXLR                                  = 1 << 3,
+    bmdAudioConnectionAnalogRCA                                  = 1 << 4
+};
+
+// Forward Declarations
+
+class IDeckLinkTimecode;
+
+/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */
+
+class IDeckLinkTimecode : public IUnknown
+{
+public:
+    virtual BMDTimecodeBCD GetBCD (void) = 0;
+    virtual HRESULT GetComponents (/* out */ uint8_t *hours, /* out */ uint8_t *minutes, /* out */ uint8_t *seconds, /* out */ uint8_t *frames) = 0;
+    virtual HRESULT GetString (/* out */ const char **timecode) = 0;
+    virtual BMDTimecodeFlags GetFlags (void) = 0;
+    virtual HRESULT GetTimecodeUserBits (/* out */ BMDTimecodeUserBits *userBits) = 0;
+
+protected:
+    virtual ~IDeckLinkTimecode () {} // call Release method to drop reference count
+};
+
+/* Functions */
+
+extern "C" {
+
+
+}
+
+
+#endif /* defined(BMD_DECKLINKAPITYPES_H) */
diff --git a/sys/decklink/osx/DeckLinkAPI.h b/sys/decklink/osx/DeckLinkAPI.h
index b629369..8c334c0 100644
--- a/sys/decklink/osx/DeckLinkAPI.h
+++ b/sys/decklink/osx/DeckLinkAPI.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -28,6 +28,15 @@
 #ifndef BMD_DECKLINKAPI_H
 #define BMD_DECKLINKAPI_H
 
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
 /* DeckLink API */
 
 #include <CoreFoundation/CoreFoundation.h>
@@ -49,26 +58,30 @@
 
 // Interface ID Declarations
 
-#define IID_IDeckLinkVideoOutputCallback                 /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ (REFIID){0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE}
-#define IID_IDeckLinkInputCallback                       /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ (REFIID){0xDD,0x04,0xE5,0xEC,0x74,0x15,0x42,0xAB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A}
-#define IID_IDeckLinkMemoryAllocator                     /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ (REFIID){0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8}
-#define IID_IDeckLinkAudioOutputCallback                 /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ (REFIID){0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6}
-#define IID_IDeckLinkIterator                            /* 50FB36CD-3063-4B73-BDBB-958087F2D8BA */ (REFIID){0x50,0xFB,0x36,0xCD,0x30,0x63,0x4B,0x73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA}
-#define IID_IDeckLinkAPIInformation                      /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ (REFIID){0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4}
-#define IID_IDeckLinkOutput                              /* A3EF0963-0862-44ED-92A9-EE89ABF431C7 */ (REFIID){0xA3,0xEF,0x09,0x63,0x08,0x62,0x44,0xED,0x92,0xA9,0xEE,0x89,0xAB,0xF4,0x31,0xC7}
-#define IID_IDeckLinkInput                               /* 6D40EF78-28B9-4E21-990D-95BB7750A04F */ (REFIID){0x6D,0x40,0xEF,0x78,0x28,0xB9,0x4E,0x21,0x99,0x0D,0x95,0xBB,0x77,0x50,0xA0,0x4F}
-#define IID_IDeckLinkVideoFrame                          /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ (REFIID){0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17}
-#define IID_IDeckLinkMutableVideoFrame                   /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ (REFIID){0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90}
-#define IID_IDeckLinkVideoFrame3DExtensions              /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ (REFIID){0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7}
-#define IID_IDeckLinkVideoInputFrame                     /* 05CFE374-537C-4094-9A57-680525118F44 */ (REFIID){0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44}
-#define IID_IDeckLinkVideoFrameAncillary                 /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ (REFIID){0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04}
-#define IID_IDeckLinkAudioInputPacket                    /* E43D5870-2894-11DE-8C30-0800200C9A66 */ (REFIID){0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66}
-#define IID_IDeckLinkScreenPreviewCallback               /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ (REFIID){0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38}
-#define IID_IDeckLinkCocoaScreenPreviewCallback          /* D174152F-8F96-4C07-83A5-DD5F5AF0A2AA */ (REFIID){0xD1,0x74,0x15,0x2F,0x8F,0x96,0x4C,0x07,0x83,0xA5,0xDD,0x5F,0x5A,0xF0,0xA2,0xAA}
-#define IID_IDeckLinkGLScreenPreviewHelper               /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ (REFIID){0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F}
-#define IID_IDeckLinkAttributes                          /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ (REFIID){0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4}
-#define IID_IDeckLinkKeyer                               /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ (REFIID){0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3}
-#define IID_IDeckLinkVideoConversion                     /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ (REFIID){0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A}
+BMD_CONST REFIID IID_IDeckLinkVideoOutputCallback                 = /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ {0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE};
+BMD_CONST REFIID IID_IDeckLinkInputCallback                       = /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ {0xDD,0x04,0xE5,0xEC,0x74,0x15,0x42,0xAB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A};
+BMD_CONST REFIID IID_IDeckLinkMemoryAllocator                     = /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ {0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8};
+BMD_CONST REFIID IID_IDeckLinkAudioOutputCallback                 = /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ {0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6};
+BMD_CONST REFIID IID_IDeckLinkIterator                            = /* 50FB36CD-3063-4B73-BDBB-958087F2D8BA */ {0x50,0xFB,0x36,0xCD,0x30,0x63,0x4B,0x73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA};
+BMD_CONST REFIID IID_IDeckLinkAPIInformation                      = /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ {0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4};
+BMD_CONST REFIID IID_IDeckLinkOutput                              = /* CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564 */ {0xCC,0x5C,0x8A,0x6E,0x3F,0x2F,0x4B,0x3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64};
+BMD_CONST REFIID IID_IDeckLinkInput                               = /* AF22762B-DFAC-4846-AA79-FA8883560995 */ {0xAF,0x22,0x76,0x2B,0xDF,0xAC,0x48,0x46,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95};
+BMD_CONST REFIID IID_IDeckLinkVideoFrame                          = /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ {0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17};
+BMD_CONST REFIID IID_IDeckLinkMutableVideoFrame                   = /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ {0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90};
+BMD_CONST REFIID IID_IDeckLinkVideoFrame3DExtensions              = /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ {0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7};
+BMD_CONST REFIID IID_IDeckLinkVideoInputFrame                     = /* 05CFE374-537C-4094-9A57-680525118F44 */ {0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44};
+BMD_CONST REFIID IID_IDeckLinkVideoFrameAncillary                 = /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ {0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04};
+BMD_CONST REFIID IID_IDeckLinkAudioInputPacket                    = /* E43D5870-2894-11DE-8C30-0800200C9A66 */ {0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66};
+BMD_CONST REFIID IID_IDeckLinkScreenPreviewCallback               = /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ {0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38};
+BMD_CONST REFIID IID_IDeckLinkCocoaScreenPreviewCallback          = /* D174152F-8F96-4C07-83A5-DD5F5AF0A2AA */ {0xD1,0x74,0x15,0x2F,0x8F,0x96,0x4C,0x07,0x83,0xA5,0xDD,0x5F,0x5A,0xF0,0xA2,0xAA};
+BMD_CONST REFIID IID_IDeckLinkGLScreenPreviewHelper               = /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ {0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F};
+BMD_CONST REFIID IID_IDeckLinkNotificationCallback                = /* B002A1EC-070D-4288-8289-BD5D36E5FF0D */ {0xB0,0x02,0xA1,0xEC,0x07,0x0D,0x42,0x88,0x82,0x89,0xBD,0x5D,0x36,0xE5,0xFF,0x0D};
+BMD_CONST REFIID IID_IDeckLinkNotification                        = /* 0A1FB207-E215-441B-9B19-6FA1575946C5 */ {0x0A,0x1F,0xB2,0x07,0xE2,0x15,0x44,0x1B,0x9B,0x19,0x6F,0xA1,0x57,0x59,0x46,0xC5};
+BMD_CONST REFIID IID_IDeckLinkAttributes                          = /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ {0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4};
+BMD_CONST REFIID IID_IDeckLinkKeyer                               = /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ {0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3};
+BMD_CONST REFIID IID_IDeckLinkVideoConversion                     = /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ {0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A};
+BMD_CONST REFIID IID_IDeckLinkDeviceNotificationCallback          = /* 4997053B-0ADF-4CC8-AC70-7A50C4BE728F */ {0x49,0x97,0x05,0x3B,0x0A,0xDF,0x4C,0xC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F};
+BMD_CONST REFIID IID_IDeckLinkDiscovery                           = /* CDBF631C-BC76-45FA-B44D-C55059BC6101 */ {0xCD,0xBF,0x63,0x1C,0xBC,0x76,0x45,0xFA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01};
 
 /* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */
 
@@ -116,7 +129,16 @@
 typedef uint32_t BMDDetectedVideoInputFormatFlags;
 enum _BMDDetectedVideoInputFormatFlags {
     bmdDetectedVideoInputYCbCr422                                = 1 << 0,
-    bmdDetectedVideoInputRGB444                                  = 1 << 1
+    bmdDetectedVideoInputRGB444                                  = 1 << 1,
+    bmdDetectedVideoInputDualStream3D                            = 1 << 2
+};
+
+/* Enum BMDDeckLinkCapturePassthroughMode - Enumerates whether the video output is electrically connected to the video input or if the clean switching mode is enabled */
+
+typedef uint32_t BMDDeckLinkCapturePassthroughMode;
+enum _BMDDeckLinkCapturePassthroughMode {
+    bmdDeckLinkCapturePassthroughModeDirect                      = 'pdir',
+    bmdDeckLinkCapturePassthroughModeCleanSwitch                 = 'pcln'
 };
 
 /* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */
@@ -175,7 +197,7 @@
 typedef uint32_t BMDTimecodeFormat;
 enum _BMDTimecodeFormat {
     bmdTimecodeRP188VITC1                                        = 'rpv1',	// RP188 timecode where DBB1 equals VITC1 (line 9)
-    bmdTimecodeRP188VITC2                                        = 'rp12',	// RP188 timecode where DBB1 equals VITC2 (line 571)
+    bmdTimecodeRP188VITC2                                        = 'rp12',	// RP188 timecode where DBB1 equals VITC2 (line 9 for progressive or line 571 for interlaced/PsF)
     bmdTimecodeRP188LTC                                          = 'rplt',	// RP188 timecode where DBB1 equals LTC (line 10)
     bmdTimecodeRP188Any                                          = 'rp18',	// For capture: return the first valid timecode in {VITC1, LTC ,VITC2} - For playback: set the timecode as VITC1
     bmdTimecodeVITC                                              = 'vitc',
@@ -191,15 +213,6 @@
     bmdAnalogVideoFlagComponentBetacamLevels                     = 1 << 1
 };
 
-/* Enum BMDAudioConnection - Audio connection types */
-
-typedef uint32_t BMDAudioConnection;
-enum _BMDAudioConnection {
-    bmdAudioConnectionEmbedded                                   = 'embd',
-    bmdAudioConnectionAESEBU                                     = 'aes ',
-    bmdAudioConnectionAnalog                                     = 'anlg'
-};
-
 /* Enum BMDAudioOutputAnalogAESSwitch - Audio output Analog/AESEBU switch */
 
 typedef uint32_t BMDAudioOutputAnalogAESSwitch;
@@ -280,15 +293,24 @@
     BMDDeckLinkHasVideoInputAntiAliasingFilter                   = 'aafl',
     BMDDeckLinkHasBypass                                         = 'byps',
     BMDDeckLinkSupportsDesktopDisplay                            = 'extd',
+    BMDDeckLinkSupportsClockTimingAdjustment                     = 'ctad',
+    BMDDeckLinkSupportsFullDuplex                                = 'fdup',
+    BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset       = 'frin',
 
     /* Integers */
 
     BMDDeckLinkMaximumAudioChannels                              = 'mach',
+    BMDDeckLinkMaximumAnalogAudioChannels                        = 'aach',
     BMDDeckLinkNumberOfSubDevices                                = 'nsbd',
     BMDDeckLinkSubDeviceIndex                                    = 'subi',
+    BMDDeckLinkPersistentID                                      = 'peid',
+    BMDDeckLinkTopologicalID                                     = 'toid',
     BMDDeckLinkVideoOutputConnections                            = 'vocn',
     BMDDeckLinkVideoInputConnections                             = 'vicn',
+    BMDDeckLinkAudioOutputConnections                            = 'aocn',
+    BMDDeckLinkAudioInputConnections                             = 'aicn',
     BMDDeckLinkDeviceBusyState                                   = 'dbst',
+    BMDDeckLinkVideoIOSupport                                    = 'vios',	// Returns a BMDVideoIOSupport bit field
 
     /* Floats */
 
@@ -318,6 +340,14 @@
     bmdDeviceSerialPortBusy                                      = 1 << 2
 };
 
+/* Enum BMDVideoIOSupport - Device video input/output support */
+
+typedef uint32_t BMDVideoIOSupport;
+enum _BMDVideoIOSupport {
+    bmdDeviceSupportsCapture                                     = 1 << 0,
+    bmdDeviceSupportsPlayback                                    = 1 << 1
+};
+
 /* Enum BMD3DPreviewFormat - Linked Frame preview format */
 
 typedef uint32_t BMD3DPreviewFormat;
@@ -329,6 +359,13 @@
     bmd3DPreviewFormatTopBottom                                  = 'topb'
 };
 
+/* Enum BMDNotifications - Events that can be subscribed through IDeckLinkNotification */
+
+typedef uint32_t BMDNotifications;
+enum _BMDNotifications {
+    bmdPreferencesChanged                                        = 'pref'
+};
+
 #if defined(__cplusplus)
 
 // Forward Declarations
@@ -350,9 +387,13 @@
 class IDeckLinkScreenPreviewCallback;
 class IDeckLinkCocoaScreenPreviewCallback;
 class IDeckLinkGLScreenPreviewHelper;
+class IDeckLinkNotificationCallback;
+class IDeckLinkNotification;
 class IDeckLinkAttributes;
 class IDeckLinkKeyer;
 class IDeckLinkVideoConversion;
+class IDeckLinkDeviceNotificationCallback;
+class IDeckLinkDiscovery;
 
 /* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */
 
@@ -363,7 +404,7 @@
     virtual HRESULT ScheduledPlaybackHasStopped (void) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoOutputCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoOutputCallback () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkInputCallback - Frame arrival callback. */
@@ -375,7 +416,7 @@
     virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0;
 
 protected:
-    virtual ~IDeckLinkInputCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkInputCallback () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */
@@ -417,7 +458,7 @@
     virtual HRESULT GetString (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ CFStringRef *value) = 0;
 
 protected:
-    virtual ~IDeckLinkAPIInformation () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkAPIInformation () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */
@@ -471,9 +512,10 @@
     /* Hardware Timing */
 
     virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
+    virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *frameCompletionTimestamp) = 0;
 
 protected:
-    virtual ~IDeckLinkOutput () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkOutput () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */
@@ -491,6 +533,7 @@
     virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0;
     virtual HRESULT DisableVideoInput (void) = 0;
     virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0;
+    virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
 
     /* Audio Input */
 
@@ -511,7 +554,7 @@
     virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkInput () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkInput () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */
@@ -530,7 +573,7 @@
     virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoFrame () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoFrame () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */
@@ -546,7 +589,7 @@
     virtual HRESULT SetTimecodeUserBits (/* in */ BMDTimecodeFormat format, /* in */ BMDTimecodeUserBits userBits) = 0;
 
 protected:
-    virtual ~IDeckLinkMutableVideoFrame () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkMutableVideoFrame () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkVideoFrame3DExtensions - Optional interface implemented on IDeckLinkVideoFrame to support 3D frames */
@@ -558,7 +601,7 @@
     virtual HRESULT GetFrameForRightEye (/* out */ IDeckLinkVideoFrame* *rightEyeFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoFrame3DExtensions () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoFrame3DExtensions () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */
@@ -570,7 +613,7 @@
     virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoInputFrame () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoInputFrame () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkVideoFrameAncillary - Obtained through QueryInterface() on an IDeckLinkVideoFrame object. */
@@ -584,7 +627,7 @@
     virtual BMDDisplayMode GetDisplayMode (void) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoFrameAncillary () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoFrameAncillary () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */
@@ -597,7 +640,7 @@
     virtual HRESULT GetPacketTime (/* out */ BMDTimeValue *packetTime, /* in */ BMDTimeScale timeScale) = 0;
 
 protected:
-    virtual ~IDeckLinkAudioInputPacket () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkAudioInputPacket () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */
@@ -608,7 +651,7 @@
     virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkScreenPreviewCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkScreenPreviewCallback () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkCocoaScreenPreviewCallback - Screen preview callback for Cocoa-based applications */
@@ -618,7 +661,7 @@
 public:
 
 protected:
-    virtual ~IDeckLinkCocoaScreenPreviewCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkCocoaScreenPreviewCallback () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */
@@ -635,7 +678,24 @@
     virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0;
 
 protected:
-    virtual ~IDeckLinkGLScreenPreviewHelper () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkGLScreenPreviewHelper () {} // call Release method to drop reference count
+};
+
+/* Interface IDeckLinkNotificationCallback - DeckLink Notification Callback Interface */
+
+class IDeckLinkNotificationCallback : public IUnknown
+{
+public:
+    virtual HRESULT Notify (/* in */ BMDNotifications topic, /* in */ uint64_t param1, /* in */ uint64_t param2) = 0;
+};
+
+/* Interface IDeckLinkNotification - DeckLink Notification interface */
+
+class IDeckLinkNotification : public IUnknown
+{
+public:
+    virtual HRESULT Subscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0;
+    virtual HRESULT Unsubscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0;
 };
 
 /* Interface IDeckLinkAttributes - DeckLink Attribute interface */
@@ -649,7 +709,7 @@
     virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ CFStringRef *value) = 0;
 
 protected:
-    virtual ~IDeckLinkAttributes () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkAttributes () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkKeyer - DeckLink Keyer interface */
@@ -664,7 +724,7 @@
     virtual HRESULT Disable (void) = 0;
 
 protected:
-    virtual ~IDeckLinkKeyer () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkKeyer () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */
@@ -675,7 +735,31 @@
     virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame* srcFrame, /* in */ IDeckLinkVideoFrame* dstFrame) = 0;
 
 protected:
-    virtual ~IDeckLinkVideoConversion () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkVideoConversion () {} // call Release method to drop reference count
+};
+
+/* Interface IDeckLinkDeviceNotificationCallback - DeckLink device arrival/removal notification callbacks */
+
+class IDeckLinkDeviceNotificationCallback : public IUnknown
+{
+public:
+    virtual HRESULT DeckLinkDeviceArrived (/* in */ IDeckLink* deckLinkDevice) = 0;
+    virtual HRESULT DeckLinkDeviceRemoved (/* in */ IDeckLink* deckLinkDevice) = 0;
+
+protected:
+    virtual ~IDeckLinkDeviceNotificationCallback () {} // call Release method to drop reference count
+};
+
+/* Interface IDeckLinkDiscovery - DeckLink device discovery */
+
+class IDeckLinkDiscovery : public IUnknown
+{
+public:
+    virtual HRESULT InstallDeviceNotifications (/* in */ IDeckLinkDeviceNotificationCallback* deviceNotificationCallback) = 0;
+    virtual HRESULT UninstallDeviceNotifications (void) = 0;
+
+protected:
+    virtual ~IDeckLinkDiscovery () {} // call Release method to drop reference count
 };
 
 /* Functions */
@@ -683,12 +767,13 @@
 extern "C" {
 
     IDeckLinkIterator* CreateDeckLinkIteratorInstance (void);
+    IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void);
     IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void);
     IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void);
     IDeckLinkCocoaScreenPreviewCallback* CreateCocoaScreenPreview (void* /* (NSView*) */ parentView);
     IDeckLinkVideoConversion* CreateVideoConversionInstance (void);
 
-};
+}
 
 
 #endif      // defined(__cplusplus)
diff --git a/sys/decklink/osx/DeckLinkAPIConfiguration.h b/sys/decklink/osx/DeckLinkAPIConfiguration.h
index f026e73..693fa38 100644
--- a/sys/decklink/osx/DeckLinkAPIConfiguration.h
+++ b/sys/decklink/osx/DeckLinkAPIConfiguration.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -28,12 +28,21 @@
 #ifndef BMD_DECKLINKAPICONFIGURATION_H
 #define BMD_DECKLINKAPICONFIGURATION_H
 
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
 // Type Declarations
 
 
 // Interface ID Declarations
 
-#define IID_IDeckLinkConfiguration                       /* C679A35B-610C-4D09-B748-1D0478100FC0 */ (REFIID){0xC6,0x79,0xA3,0x5B,0x61,0x0C,0x4D,0x09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0}
+BMD_CONST REFIID IID_IDeckLinkConfiguration                       = /* 1E69FCF6-4203-4936-8076-2A9F4CFD50CB */ {0x1E,0x69,0xFC,0xF6,0x42,0x03,0x49,0x36,0x80,0x76,0x2A,0x9F,0x4C,0xFD,0x50,0xCB};
 
 /* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */
 
@@ -52,6 +61,7 @@
 
     bmdDeckLinkConfigHDMI3DPackingFormat                         = '3dpf',
     bmdDeckLinkConfigBypass                                      = 'byps',
+    bmdDeckLinkConfigClockTimingAdjustment                       = 'ctad',
 
     /* Audio Input/Output Flags */
 
@@ -62,7 +72,7 @@
     bmdDeckLinkConfigFieldFlickerRemoval                         = 'fdfr',
     bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion            = 'to59',
     bmdDeckLinkConfig444SDIVideoOutput                           = '444o',
-    bmdDeckLinkConfig3GBpsVideoOutput                            = '3gbs',
+    bmdDeckLinkConfigSingleLinkVideoOutput                       = 'sglo',
     bmdDeckLinkConfigBlackVideoOutputDuringCapture               = 'bvoc',
     bmdDeckLinkConfigLowLatencyVideoOutput                       = 'llvo',
 
@@ -73,6 +83,8 @@
     bmdDeckLinkConfigAnalogVideoOutputFlags                      = 'avof',
     bmdDeckLinkConfigReferenceInputTimingOffset                  = 'glot',
     bmdDeckLinkConfigVideoOutputIdleOperation                    = 'voio',
+    bmdDeckLinkConfigDefaultVideoOutputMode                      = 'dvom',
+    bmdDeckLinkConfigDefaultVideoOutputModeFlags                 = 'dvof',
 
     /* Video Output Floats */
 
@@ -87,6 +99,7 @@
     /* Video Input Flags */
 
     bmdDeckLinkConfigVideoInputScanning                          = 'visc',	// Applicable to H264 Pro Recorder only
+    bmdDeckLinkConfigUseDedicatedLTCInput                        = 'dltc',	// Use timecode from LTC input instead of SDI stream
 
     /* Video Input Integers */
 
@@ -97,6 +110,7 @@
     bmdDeckLinkConfigVANCSourceLine1Mapping                      = 'vsl1',
     bmdDeckLinkConfigVANCSourceLine2Mapping                      = 'vsl2',
     bmdDeckLinkConfigVANCSourceLine3Mapping                      = 'vsl3',
+    bmdDeckLinkConfigCapturePassThroughMode                      = 'cptm',
 
     /* Video Input Floats */
 
@@ -153,7 +167,7 @@
     virtual HRESULT WriteConfigurationToPreferences (void) = 0;
 
 protected:
-    virtual ~IDeckLinkConfiguration () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkConfiguration () {} // call Release method to drop reference count
 };
 
 /* Functions */
@@ -161,7 +175,7 @@
 extern "C" {
 
 
-};
+}
 
 
 #endif /* defined(BMD_DECKLINKAPICONFIGURATION_H) */
diff --git a/sys/decklink/osx/DeckLinkAPIDeckControl.h b/sys/decklink/osx/DeckLinkAPIDeckControl.h
index ea32657..4075f32 100644
--- a/sys/decklink/osx/DeckLinkAPIDeckControl.h
+++ b/sys/decklink/osx/DeckLinkAPIDeckControl.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -28,13 +28,22 @@
 #ifndef BMD_DECKLINKAPIDECKCONTROL_H
 #define BMD_DECKLINKAPIDECKCONTROL_H
 
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
 // Type Declarations
 
 
 // Interface ID Declarations
 
-#define IID_IDeckLinkDeckControlStatusCallback           /* 53436FFB-B434-4906-BADC-AE3060FFE8EF */ (REFIID){0x53,0x43,0x6F,0xFB,0xB4,0x34,0x49,0x06,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF}
-#define IID_IDeckLinkDeckControl                         /* 8E1C3ACE-19C7-4E00-8B92-D80431D958BE */ (REFIID){0x8E,0x1C,0x3A,0xCE,0x19,0xC7,0x4E,0x00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE}
+BMD_CONST REFIID IID_IDeckLinkDeckControlStatusCallback           = /* 53436FFB-B434-4906-BADC-AE3060FFE8EF */ {0x53,0x43,0x6F,0xFB,0xB4,0x34,0x49,0x06,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF};
+BMD_CONST REFIID IID_IDeckLinkDeckControl                         = /* 8E1C3ACE-19C7-4E00-8B92-D80431D958BE */ {0x8E,0x1C,0x3A,0xCE,0x19,0xC7,0x4E,0x00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE};
 
 /* Enum BMDDeckControlMode - DeckControl mode */
 
@@ -149,7 +158,7 @@
     virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0;
 
 protected:
-    virtual ~IDeckLinkDeckControlStatusCallback () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkDeckControlStatusCallback () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkDeckControl - Deck Control main interface */
@@ -192,7 +201,7 @@
     virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0;
 
 protected:
-    virtual ~IDeckLinkDeckControl () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkDeckControl () {} // call Release method to drop reference count
 };
 
 /* Functions */
@@ -200,7 +209,7 @@
 extern "C" {
 
 
-};
+}
 
 
 #endif /* defined(BMD_DECKLINKAPIDECKCONTROL_H) */
diff --git a/sys/decklink/osx/DeckLinkAPIDiscovery.h b/sys/decklink/osx/DeckLinkAPIDiscovery.h
index 99fc0fe..adbde29 100644
--- a/sys/decklink/osx/DeckLinkAPIDiscovery.h
+++ b/sys/decklink/osx/DeckLinkAPIDiscovery.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -28,12 +28,21 @@
 #ifndef BMD_DECKLINKAPIDISCOVERY_H
 #define BMD_DECKLINKAPIDISCOVERY_H
 
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
 // Type Declarations
 
 
 // Interface ID Declarations
 
-#define IID_IDeckLink                                    /* C418FBDD-0587-48ED-8FE5-640F0A14AF91 */ (REFIID){0xC4,0x18,0xFB,0xDD,0x05,0x87,0x48,0xED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91}
+BMD_CONST REFIID IID_IDeckLink                                    = /* C418FBDD-0587-48ED-8FE5-640F0A14AF91 */ {0xC4,0x18,0xFB,0xDD,0x05,0x87,0x48,0xED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91};
 
 // Forward Declarations
 
@@ -48,7 +57,7 @@
     virtual HRESULT GetDisplayName (/* out */ CFStringRef *displayName) = 0;
 
 protected:
-    virtual ~IDeckLink () {}; // call Release method to drop reference count
+    virtual ~IDeckLink () {} // call Release method to drop reference count
 };
 
 /* Functions */
@@ -56,7 +65,7 @@
 extern "C" {
 
 
-};
+}
 
 
 #endif /* defined(BMD_DECKLINKAPIDISCOVERY_H) */
diff --git a/sys/decklink/osx/DeckLinkAPIDispatch-osx.cpp b/sys/decklink/osx/DeckLinkAPIDispatch.cpp
similarity index 90%
rename from sys/decklink/osx/DeckLinkAPIDispatch-osx.cpp
rename to sys/decklink/osx/DeckLinkAPIDispatch.cpp
index 18b0122..cb646de 100644
--- a/sys/decklink/osx/DeckLinkAPIDispatch-osx.cpp
+++ b/sys/decklink/osx/DeckLinkAPIDispatch.cpp
@@ -33,13 +33,15 @@
 	#error The DeckLink API version of DeckLinkAPIDispatch.cpp is not the same version as DeckLinkAPI.h
 #endif
 
-#define kDeckLinkAPI_BundlePath "/Library/Application Support/Blackmagic Design/Blackmagic DeckLink/DeckLinkAPI.bundle"
+#define kDeckLinkAPI_BundlePath "/Library/Frameworks/DeckLinkAPI.framework"
+
 
 typedef IDeckLinkIterator* (*CreateIteratorFunc)(void);
 typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void);
 typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void);
 typedef IDeckLinkCocoaScreenPreviewCallback* (*CreateCocoaScreenPreviewFunc)(void*);
 typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void);
+typedef IDeckLinkDiscovery* (*CreateDeckLinkDiscoveryInstanceFunc)(void);
 
 static pthread_once_t						gDeckLinkOnceControl		= PTHREAD_ONCE_INIT;
 static CFBundleRef							gDeckLinkAPIBundleRef		= NULL;
@@ -48,6 +50,7 @@
 static CreateOpenGLScreenPreviewHelperFunc	gCreateOpenGLPreviewFunc	= NULL;
 static CreateCocoaScreenPreviewFunc			gCreateCocoaPreviewFunc		= NULL;
 static CreateVideoConversionInstanceFunc	gCreateVideoConversionFunc	= NULL;
+static CreateDeckLinkDiscoveryInstanceFunc  gCreateDeckLinkDiscoveryFunc= NULL;
 
 
 void	InitDeckLinkAPI (void)
@@ -65,6 +68,7 @@
 			gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateOpenGLScreenPreviewHelper_0001"));
 			gCreateCocoaPreviewFunc = (CreateCocoaScreenPreviewFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateCocoaScreenPreview_0001"));
 			gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateVideoConversionInstance_0001"));
+            gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)CFBundleGetFunctionPointerForName(gDeckLinkAPIBundleRef, CFSTR("CreateDeckLinkDiscoveryInstance_0001"));
 		}
 		CFRelease(bundleURL);
 	}
@@ -129,6 +133,17 @@
 	return gCreateVideoConversionFunc();
 }
 
+IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void)
+{
+	pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
+	
+	if (gCreateDeckLinkDiscoveryFunc == NULL)
+		return NULL;
+	
+	return gCreateDeckLinkDiscoveryFunc();
+}
+
+
 #define kBMDStreamingAPI_BundlePath "/Library/Application Support/Blackmagic Design/Streaming/BMDStreamingAPI.bundle"
 
 typedef IBMDStreamingDiscovery* (*CreateDiscoveryFunc)(void);
diff --git a/sys/decklink/osx/DeckLinkAPIModes.h b/sys/decklink/osx/DeckLinkAPIModes.h
index 8b07592..478a2fd 100644
--- a/sys/decklink/osx/DeckLinkAPIModes.h
+++ b/sys/decklink/osx/DeckLinkAPIModes.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -28,13 +28,22 @@
 #ifndef BMD_DECKLINKAPIMODES_H
 #define BMD_DECKLINKAPIMODES_H
 
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
 // Type Declarations
 
 
 // Interface ID Declarations
 
-#define IID_IDeckLinkDisplayModeIterator                 /* 9C88499F-F601-4021-B80B-032E4EB41C35 */ (REFIID){0x9C,0x88,0x49,0x9F,0xF6,0x01,0x40,0x21,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35}
-#define IID_IDeckLinkDisplayMode                         /* 3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78 */ (REFIID){0x3E,0xB2,0xC1,0xAB,0x0A,0x3D,0x45,0x23,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78}
+BMD_CONST REFIID IID_IDeckLinkDisplayModeIterator                 = /* 9C88499F-F601-4021-B80B-032E4EB41C35 */ {0x9C,0x88,0x49,0x9F,0xF6,0x01,0x40,0x21,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35};
+BMD_CONST REFIID IID_IDeckLinkDisplayMode                         = /* 3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78 */ {0x3E,0xB2,0xC1,0xAB,0x0A,0x3D,0x45,0x23,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78};
 
 /* Enum BMDDisplayMode - Video display modes */
 
@@ -75,6 +84,29 @@
     bmdMode2k24                                                  = '2k24',
     bmdMode2k25                                                  = '2k25',
 
+    /* DCI Modes (output only) */
+
+    bmdMode2kDCI2398                                             = '2d23',
+    bmdMode2kDCI24                                               = '2d24',
+    bmdMode2kDCI25                                               = '2d25',
+
+    /* 4k Modes */
+
+    bmdMode4K2160p2398                                           = '4k23',
+    bmdMode4K2160p24                                             = '4k24',
+    bmdMode4K2160p25                                             = '4k25',
+    bmdMode4K2160p2997                                           = '4k29',
+    bmdMode4K2160p30                                             = '4k30',
+    bmdMode4K2160p50                                             = '4k50',
+    bmdMode4K2160p5994                                           = '4k59',
+    bmdMode4K2160p60                                             = '4k60',
+
+    /* DCI Modes (output only) */
+
+    bmdMode4kDCI2398                                             = '4d23',
+    bmdMode4kDCI24                                               = '4d24',
+    bmdMode4kDCI25                                               = '4d25',
+
     /* Special Modes */
 
     bmdModeUnknown                                               = 'iunk'
@@ -99,7 +131,11 @@
     bmdFormat10BitYUV                                            = 'v210',
     bmdFormat8BitARGB                                            = 32,
     bmdFormat8BitBGRA                                            = 'BGRA',
-    bmdFormat10BitRGB                                            = 'r210'	// Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10
+    bmdFormat10BitRGB                                            = 'r210',	// Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10
+    bmdFormat12BitRGB                                            = 'R12B',	// Big-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component
+    bmdFormat12BitRGBLE                                          = 'R12L',	// Little-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component
+    bmdFormat10BitRGBXLE                                         = 'R10l',	// Little-endian 10-bit RGB with SMPTE video levels (64-940)
+    bmdFormat10BitRGBX                                           = 'R10b'	// Big-endian 10-bit RGB with SMPTE video levels (64-940)
 };
 
 /* Enum BMDDisplayModeFlags - Flags to describe the characteristics of an IDeckLinkDisplayMode. */
@@ -124,7 +160,7 @@
     virtual HRESULT Next (/* out */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0;
 
 protected:
-    virtual ~IDeckLinkDisplayModeIterator () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkDisplayModeIterator () {} // call Release method to drop reference count
 };
 
 /* Interface IDeckLinkDisplayMode - represents a display mode */
@@ -141,7 +177,7 @@
     virtual BMDDisplayModeFlags GetFlags (void) = 0;
 
 protected:
-    virtual ~IDeckLinkDisplayMode () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkDisplayMode () {} // call Release method to drop reference count
 };
 
 /* Functions */
@@ -149,7 +185,7 @@
 extern "C" {
 
 
-};
+}
 
 
 #endif /* defined(BMD_DECKLINKAPIMODES_H) */
diff --git a/sys/decklink/osx/DeckLinkAPIStreaming.h b/sys/decklink/osx/DeckLinkAPIStreaming.h
index ecffb8d..725c187 100644
--- a/sys/decklink/osx/DeckLinkAPIStreaming.h
+++ b/sys/decklink/osx/DeckLinkAPIStreaming.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -28,22 +28,31 @@
 #ifndef BMD_DECKLINKAPISTREAMING_H
 #define BMD_DECKLINKAPISTREAMING_H
 
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
 // Type Declarations
 
 
 // Interface ID Declarations
 
-#define IID_IBMDStreamingDeviceNotificationCallback      /* F9531D64-3305-4B29-A387-7F74BB0D0E84 */ (REFIID){0xF9,0x53,0x1D,0x64,0x33,0x05,0x4B,0x29,0xA3,0x87,0x7F,0x74,0xBB,0x0D,0x0E,0x84}
-#define IID_IBMDStreamingH264InputCallback               /* 823C475F-55AE-46F9-890C-537CC5CEDCCA */ (REFIID){0x82,0x3C,0x47,0x5F,0x55,0xAE,0x46,0xF9,0x89,0x0C,0x53,0x7C,0xC5,0xCE,0xDC,0xCA}
-#define IID_IBMDStreamingDiscovery                       /* 2C837444-F989-4D87-901A-47C8A36D096D */ (REFIID){0x2C,0x83,0x74,0x44,0xF9,0x89,0x4D,0x87,0x90,0x1A,0x47,0xC8,0xA3,0x6D,0x09,0x6D}
-#define IID_IBMDStreamingVideoEncodingMode               /* 1AB8035B-CD13-458D-B6DF-5E8F7C2141D9 */ (REFIID){0x1A,0xB8,0x03,0x5B,0xCD,0x13,0x45,0x8D,0xB6,0xDF,0x5E,0x8F,0x7C,0x21,0x41,0xD9}
-#define IID_IBMDStreamingMutableVideoEncodingMode        /* 19BF7D90-1E0A-400D-B2C6-FFC4E78AD49D */ (REFIID){0x19,0xBF,0x7D,0x90,0x1E,0x0A,0x40,0x0D,0xB2,0xC6,0xFF,0xC4,0xE7,0x8A,0xD4,0x9D}
-#define IID_IBMDStreamingVideoEncodingModePresetIterator /* 7AC731A3-C950-4AD0-804A-8377AA51C6C4 */ (REFIID){0x7A,0xC7,0x31,0xA3,0xC9,0x50,0x4A,0xD0,0x80,0x4A,0x83,0x77,0xAA,0x51,0xC6,0xC4}
-#define IID_IBMDStreamingDeviceInput                     /* 24B6B6EC-1727-44BB-9818-34FF086ACF98 */ (REFIID){0x24,0xB6,0xB6,0xEC,0x17,0x27,0x44,0xBB,0x98,0x18,0x34,0xFF,0x08,0x6A,0xCF,0x98}
-#define IID_IBMDStreamingH264NALPacket                   /* E260E955-14BE-4395-9775-9F02CC0A9D89 */ (REFIID){0xE2,0x60,0xE9,0x55,0x14,0xBE,0x43,0x95,0x97,0x75,0x9F,0x02,0xCC,0x0A,0x9D,0x89}
-#define IID_IBMDStreamingAudioPacket                     /* D9EB5902-1AD2-43F4-9E2C-3CFA50B5EE19 */ (REFIID){0xD9,0xEB,0x59,0x02,0x1A,0xD2,0x43,0xF4,0x9E,0x2C,0x3C,0xFA,0x50,0xB5,0xEE,0x19}
-#define IID_IBMDStreamingMPEG2TSPacket                   /* 91810D1C-4FB3-4AAA-AE56-FA301D3DFA4C */ (REFIID){0x91,0x81,0x0D,0x1C,0x4F,0xB3,0x4A,0xAA,0xAE,0x56,0xFA,0x30,0x1D,0x3D,0xFA,0x4C}
-#define IID_IBMDStreamingH264NALParser                   /* 5867F18C-5BFA-4CCC-B2A7-9DFD140417D2 */ (REFIID){0x58,0x67,0xF1,0x8C,0x5B,0xFA,0x4C,0xCC,0xB2,0xA7,0x9D,0xFD,0x14,0x04,0x17,0xD2}
+BMD_CONST REFIID IID_IBMDStreamingDeviceNotificationCallback      = /* F9531D64-3305-4B29-A387-7F74BB0D0E84 */ {0xF9,0x53,0x1D,0x64,0x33,0x05,0x4B,0x29,0xA3,0x87,0x7F,0x74,0xBB,0x0D,0x0E,0x84};
+BMD_CONST REFIID IID_IBMDStreamingH264InputCallback               = /* 823C475F-55AE-46F9-890C-537CC5CEDCCA */ {0x82,0x3C,0x47,0x5F,0x55,0xAE,0x46,0xF9,0x89,0x0C,0x53,0x7C,0xC5,0xCE,0xDC,0xCA};
+BMD_CONST REFIID IID_IBMDStreamingDiscovery                       = /* 2C837444-F989-4D87-901A-47C8A36D096D */ {0x2C,0x83,0x74,0x44,0xF9,0x89,0x4D,0x87,0x90,0x1A,0x47,0xC8,0xA3,0x6D,0x09,0x6D};
+BMD_CONST REFIID IID_IBMDStreamingVideoEncodingMode               = /* 1AB8035B-CD13-458D-B6DF-5E8F7C2141D9 */ {0x1A,0xB8,0x03,0x5B,0xCD,0x13,0x45,0x8D,0xB6,0xDF,0x5E,0x8F,0x7C,0x21,0x41,0xD9};
+BMD_CONST REFIID IID_IBMDStreamingMutableVideoEncodingMode        = /* 19BF7D90-1E0A-400D-B2C6-FFC4E78AD49D */ {0x19,0xBF,0x7D,0x90,0x1E,0x0A,0x40,0x0D,0xB2,0xC6,0xFF,0xC4,0xE7,0x8A,0xD4,0x9D};
+BMD_CONST REFIID IID_IBMDStreamingVideoEncodingModePresetIterator = /* 7AC731A3-C950-4AD0-804A-8377AA51C6C4 */ {0x7A,0xC7,0x31,0xA3,0xC9,0x50,0x4A,0xD0,0x80,0x4A,0x83,0x77,0xAA,0x51,0xC6,0xC4};
+BMD_CONST REFIID IID_IBMDStreamingDeviceInput                     = /* 24B6B6EC-1727-44BB-9818-34FF086ACF98 */ {0x24,0xB6,0xB6,0xEC,0x17,0x27,0x44,0xBB,0x98,0x18,0x34,0xFF,0x08,0x6A,0xCF,0x98};
+BMD_CONST REFIID IID_IBMDStreamingH264NALPacket                   = /* E260E955-14BE-4395-9775-9F02CC0A9D89 */ {0xE2,0x60,0xE9,0x55,0x14,0xBE,0x43,0x95,0x97,0x75,0x9F,0x02,0xCC,0x0A,0x9D,0x89};
+BMD_CONST REFIID IID_IBMDStreamingAudioPacket                     = /* D9EB5902-1AD2-43F4-9E2C-3CFA50B5EE19 */ {0xD9,0xEB,0x59,0x02,0x1A,0xD2,0x43,0xF4,0x9E,0x2C,0x3C,0xFA,0x50,0xB5,0xEE,0x19};
+BMD_CONST REFIID IID_IBMDStreamingMPEG2TSPacket                   = /* 91810D1C-4FB3-4AAA-AE56-FA301D3DFA4C */ {0x91,0x81,0x0D,0x1C,0x4F,0xB3,0x4A,0xAA,0xAE,0x56,0xFA,0x30,0x1D,0x3D,0xFA,0x4C};
+BMD_CONST REFIID IID_IBMDStreamingH264NALParser                   = /* 5867F18C-5BFA-4CCC-B2A7-9DFD140417D2 */ {0x58,0x67,0xF1,0x8C,0x5B,0xFA,0x4C,0xCC,0xB2,0xA7,0x9D,0xFD,0x14,0x04,0x17,0xD2};
 
 /* Enum BMDStreamingDeviceMode - Device modes */
 
@@ -187,7 +196,7 @@
     virtual HRESULT StreamingDeviceModeChanged (/* in */ IDeckLink* device, /* in */ BMDStreamingDeviceMode mode) = 0;
 
 protected:
-    virtual ~IBMDStreamingDeviceNotificationCallback () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingDeviceNotificationCallback () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingH264InputCallback - H264 input callbacks. */
@@ -203,7 +212,7 @@
     virtual HRESULT H264VideoInputModeChanged (void) = 0;
 
 protected:
-    virtual ~IBMDStreamingH264InputCallback () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingH264InputCallback () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingDiscovery - Installs device notifications */
@@ -215,7 +224,7 @@
     virtual HRESULT UninstallDeviceNotifications (void) = 0;
 
 protected:
-    virtual ~IBMDStreamingDiscovery () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingDiscovery () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingVideoEncodingMode - Represents an encoded video mode. */
@@ -238,7 +247,7 @@
     virtual HRESULT CreateMutableVideoEncodingMode (/* out */ IBMDStreamingMutableVideoEncodingMode** newEncodingMode) = 0; // Creates a mutable copy of the encoding mode
 
 protected:
-    virtual ~IBMDStreamingVideoEncodingMode () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingVideoEncodingMode () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingMutableVideoEncodingMode - Represents a mutable encoded video mode. */
@@ -254,7 +263,7 @@
     virtual HRESULT SetString (/* in */ BMDStreamingEncodingModePropertyID cfgID, /* in */ CFStringRef value) = 0;
 
 protected:
-    virtual ~IBMDStreamingMutableVideoEncodingMode () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingMutableVideoEncodingMode () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingVideoEncodingModePresetIterator - Enumerates encoding mode presets */
@@ -265,7 +274,7 @@
     virtual HRESULT Next (/* out */ IBMDStreamingVideoEncodingMode** videoEncodingMode) = 0;
 
 protected:
-    virtual ~IBMDStreamingVideoEncodingModePresetIterator () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingVideoEncodingModePresetIterator () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingDeviceInput - Created by QueryInterface from IDeckLink */
@@ -295,7 +304,7 @@
     virtual HRESULT SetCallback (/* in */ IUnknown* theCallback) = 0;
 
 protected:
-    virtual ~IBMDStreamingDeviceInput () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingDeviceInput () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingH264NALPacket - Represent an H.264 NAL packet */
@@ -307,10 +316,10 @@
     virtual HRESULT GetBytes (/* out */ void** buffer) = 0;
     virtual HRESULT GetBytesWithSizePrefix (/* out */ void** buffer) = 0; // Contains a 32-bit unsigned big endian size prefix
     virtual HRESULT GetDisplayTime (/* in */ uint64_t requestedTimeScale, /* out */ uint64_t* displayTime) = 0;
-    virtual HRESULT GetPacketIndex (/* out */ uint32_t* packetIndex) = 0;
+    virtual HRESULT GetPacketIndex (/* out */ uint32_t* packetIndex) = 0; // Deprecated
 
 protected:
-    virtual ~IBMDStreamingH264NALPacket () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingH264NALPacket () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingAudioPacket - Represents a chunk of audio data */
@@ -322,10 +331,10 @@
     virtual long GetPayloadSize (void) = 0;
     virtual HRESULT GetBytes (/* out */ void** buffer) = 0;
     virtual HRESULT GetPlayTime (/* in */ uint64_t requestedTimeScale, /* out */ uint64_t* playTime) = 0;
-    virtual HRESULT GetPacketIndex (/* out */ uint32_t* packetIndex) = 0;
+    virtual HRESULT GetPacketIndex (/* out */ uint32_t* packetIndex) = 0; // Deprecated
 
 protected:
-    virtual ~IBMDStreamingAudioPacket () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingAudioPacket () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingMPEG2TSPacket - Represent an MPEG2 Transport Stream packet */
@@ -337,7 +346,7 @@
     virtual HRESULT GetBytes (/* out */ void** buffer) = 0;
 
 protected:
-    virtual ~IBMDStreamingMPEG2TSPacket () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingMPEG2TSPacket () {} // call Release method to drop reference count
 };
 
 /* Interface IBMDStreamingH264NALParser - For basic NAL parsing */
@@ -350,7 +359,7 @@
     virtual HRESULT GetProfileAndLevelFromSPS (/* in */ IBMDStreamingH264NALPacket* nal, /* out */ uint32_t* profileIdc, /* out */ uint32_t* profileCompatability, /* out */ uint32_t* levelIdc) = 0;
 
 protected:
-    virtual ~IBMDStreamingH264NALParser () {}; // call Release method to drop reference count
+    virtual ~IBMDStreamingH264NALParser () {} // call Release method to drop reference count
 };
 
 /* Functions */
@@ -360,7 +369,7 @@
     IBMDStreamingDiscovery* CreateBMDStreamingDiscoveryInstance (void);
     IBMDStreamingH264NALParser* CreateBMDStreamingH264NALParser (void);
 
-};
+}
 
 
 #endif /* defined(BMD_DECKLINKAPISTREAMING_H) */
diff --git a/sys/decklink/osx/DeckLinkAPITypes.h b/sys/decklink/osx/DeckLinkAPITypes.h
index ed54d8e..396680c 100644
--- a/sys/decklink/osx/DeckLinkAPITypes.h
+++ b/sys/decklink/osx/DeckLinkAPITypes.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
-** Copyright (c) 2011 Blackmagic Design
+** Copyright (c) 2014 Blackmagic Design
 **
 ** Permission is hereby granted, free of charge, to any person or organization
 ** obtaining a copy of the software and accompanying documentation covered by
@@ -28,6 +28,15 @@
 #ifndef BMD_DECKLINKAPITYPES_H
 #define BMD_DECKLINKAPITYPES_H
 
+
+#ifndef BMD_CONST
+    #if defined(_MSC_VER)
+        #define BMD_CONST __declspec(selectany) static const
+    #else
+        #define BMD_CONST static const
+    #endif
+#endif
+
 // Type Declarations
 
 typedef int64_t BMDTimeValue;
@@ -37,14 +46,15 @@
 
 // Interface ID Declarations
 
-#define IID_IDeckLinkTimecode                            /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ (REFIID){0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40}
+BMD_CONST REFIID IID_IDeckLinkTimecode                            = /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ {0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40};
 
 /* Enum BMDTimecodeFlags - Timecode flags */
 
 typedef uint32_t BMDTimecodeFlags;
 enum _BMDTimecodeFlags {
     bmdTimecodeFlagDefault                                       = 0,
-    bmdTimecodeIsDropFrame                                       = 1 << 0
+    bmdTimecodeIsDropFrame                                       = 1 << 0,
+    bmdTimecodeFieldMark                                         = 1 << 1
 };
 
 /* Enum BMDVideoConnection - Video connection types */
@@ -59,6 +69,17 @@
     bmdVideoConnectionSVideo                                     = 1 << 5
 };
 
+/* Enum BMDAudioConnection - Audio connection types */
+
+typedef uint32_t BMDAudioConnection;
+enum _BMDAudioConnection {
+    bmdAudioConnectionEmbedded                                   = 1 << 0,
+    bmdAudioConnectionAESEBU                                     = 1 << 1,
+    bmdAudioConnectionAnalog                                     = 1 << 2,
+    bmdAudioConnectionAnalogXLR                                  = 1 << 3,
+    bmdAudioConnectionAnalogRCA                                  = 1 << 4
+};
+
 // Forward Declarations
 
 class IDeckLinkTimecode;
@@ -75,7 +96,7 @@
     virtual HRESULT GetTimecodeUserBits (/* out */ BMDTimecodeUserBits *userBits) = 0;
 
 protected:
-    virtual ~IDeckLinkTimecode () {}; // call Release method to drop reference count
+    virtual ~IDeckLinkTimecode () {} // call Release method to drop reference count
 };
 
 /* Functions */
@@ -83,7 +104,7 @@
 extern "C" {
 
 
-};
+}
 
 
 #endif /* defined(BMD_DECKLINKAPITYPES_H) */
diff --git a/sys/decklink/osx/DeckLinkAPIVersion.h b/sys/decklink/osx/DeckLinkAPIVersion.h
index 2681ed0..4e41492 100644
--- a/sys/decklink/osx/DeckLinkAPIVersion.h
+++ b/sys/decklink/osx/DeckLinkAPIVersion.h
@@ -1,5 +1,5 @@
 /* -LICENSE-START-
- * ** Copyright (c) 2011 Blackmagic Design
+ * ** Copyright (c) 2014 Blackmagic Design
  * **
  * ** Permission is hereby granted, free of charge, to any person or organization
  * ** obtaining a copy of the software and accompanying documentation covered by
@@ -27,11 +27,11 @@
 
 /* DeckLinkAPIVersion.h */
 
-#ifndef __DeckLink_API_Verison_h__
+#ifndef __DeckLink_API_Version_h__
 #define __DeckLink_API_Version_h__
 
-#define BLACKMAGIC_DECKLINK_API_VERSION					0x09000000
-#define BLACKMAGIC_DECKLINK_API_VERSION_STRING			"9.0"
+#define BLACKMAGIC_DECKLINK_API_VERSION					0x0a030100
+#define BLACKMAGIC_DECKLINK_API_VERSION_STRING			"10.3.1"
 
 #endif	// __DeckLink_API_Version_h__
 
diff --git a/sys/decklink/win/DeckLinkAPI.h b/sys/decklink/win/DeckLinkAPI.h
index 0341ce8..90d1a28 100644
--- a/sys/decklink/win/DeckLinkAPI.h
+++ b/sys/decklink/win/DeckLinkAPI.h
@@ -1,9217 +1,13312 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0500 */
-/* at Fri Jun 17 10:43:51 2011
- */
-/* Compiler settings for .\win\DeckLinkAPI.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 475
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-
-#ifndef __DeckLinkAPI_h__
-#define __DeckLinkAPI_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-#ifndef __IDeckLinkVideoOutputCallback_FWD_DEFINED__
-#define __IDeckLinkVideoOutputCallback_FWD_DEFINED__
-typedef interface IDeckLinkVideoOutputCallback IDeckLinkVideoOutputCallback;
-#endif 	/* __IDeckLinkVideoOutputCallback_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInputCallback_FWD_DEFINED__
-#define __IDeckLinkInputCallback_FWD_DEFINED__
-typedef interface IDeckLinkInputCallback IDeckLinkInputCallback;
-#endif 	/* __IDeckLinkInputCallback_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkMemoryAllocator_FWD_DEFINED__
-#define __IDeckLinkMemoryAllocator_FWD_DEFINED__
-typedef interface IDeckLinkMemoryAllocator IDeckLinkMemoryAllocator;
-#endif 	/* __IDeckLinkMemoryAllocator_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkAudioOutputCallback_FWD_DEFINED__
-#define __IDeckLinkAudioOutputCallback_FWD_DEFINED__
-typedef interface IDeckLinkAudioOutputCallback IDeckLinkAudioOutputCallback;
-#endif 	/* __IDeckLinkAudioOutputCallback_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkIterator_FWD_DEFINED__
-#define __IDeckLinkIterator_FWD_DEFINED__
-typedef interface IDeckLinkIterator IDeckLinkIterator;
-#endif 	/* __IDeckLinkIterator_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkAPIInformation_FWD_DEFINED__
-#define __IDeckLinkAPIInformation_FWD_DEFINED__
-typedef interface IDeckLinkAPIInformation IDeckLinkAPIInformation;
-#endif 	/* __IDeckLinkAPIInformation_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayModeIterator_FWD_DEFINED__
-#define __IDeckLinkDisplayModeIterator_FWD_DEFINED__
-typedef interface IDeckLinkDisplayModeIterator IDeckLinkDisplayModeIterator;
-#endif 	/* __IDeckLinkDisplayModeIterator_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayMode_FWD_DEFINED__
-#define __IDeckLinkDisplayMode_FWD_DEFINED__
-typedef interface IDeckLinkDisplayMode IDeckLinkDisplayMode;
-#endif 	/* __IDeckLinkDisplayMode_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLink_FWD_DEFINED__
-#define __IDeckLink_FWD_DEFINED__
-typedef interface IDeckLink IDeckLink;
-#endif 	/* __IDeckLink_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_FWD_DEFINED__
-#define __IDeckLinkOutput_FWD_DEFINED__
-typedef interface IDeckLinkOutput IDeckLinkOutput;
-#endif 	/* __IDeckLinkOutput_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_FWD_DEFINED__
-#define __IDeckLinkInput_FWD_DEFINED__
-typedef interface IDeckLinkInput IDeckLinkInput;
-#endif 	/* __IDeckLinkInput_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkTimecode_FWD_DEFINED__
-#define __IDeckLinkTimecode_FWD_DEFINED__
-typedef interface IDeckLinkTimecode IDeckLinkTimecode;
-#endif 	/* __IDeckLinkTimecode_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame_FWD_DEFINED__
-#define __IDeckLinkVideoFrame_FWD_DEFINED__
-typedef interface IDeckLinkVideoFrame IDeckLinkVideoFrame;
-#endif 	/* __IDeckLinkVideoFrame_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkMutableVideoFrame_FWD_DEFINED__
-#define __IDeckLinkMutableVideoFrame_FWD_DEFINED__
-typedef interface IDeckLinkMutableVideoFrame IDeckLinkMutableVideoFrame;
-#endif 	/* __IDeckLinkMutableVideoFrame_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__
-#define __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__
-typedef interface IDeckLinkVideoFrame3DExtensions IDeckLinkVideoFrame3DExtensions;
-#endif 	/* __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_FWD_DEFINED__
-#define __IDeckLinkVideoInputFrame_FWD_DEFINED__
-typedef interface IDeckLinkVideoInputFrame IDeckLinkVideoInputFrame;
-#endif 	/* __IDeckLinkVideoInputFrame_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrameAncillary_FWD_DEFINED__
-#define __IDeckLinkVideoFrameAncillary_FWD_DEFINED__
-typedef interface IDeckLinkVideoFrameAncillary IDeckLinkVideoFrameAncillary;
-#endif 	/* __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkAudioInputPacket_FWD_DEFINED__
-#define __IDeckLinkAudioInputPacket_FWD_DEFINED__
-typedef interface IDeckLinkAudioInputPacket IDeckLinkAudioInputPacket;
-#endif 	/* __IDeckLinkAudioInputPacket_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkScreenPreviewCallback_FWD_DEFINED__
-#define __IDeckLinkScreenPreviewCallback_FWD_DEFINED__
-typedef interface IDeckLinkScreenPreviewCallback IDeckLinkScreenPreviewCallback;
-#endif 	/* __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__
-#define __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__
-typedef interface IDeckLinkGLScreenPreviewHelper IDeckLinkGLScreenPreviewHelper;
-#endif 	/* __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkConfiguration_FWD_DEFINED__
-#define __IDeckLinkConfiguration_FWD_DEFINED__
-typedef interface IDeckLinkConfiguration IDeckLinkConfiguration;
-#endif 	/* __IDeckLinkConfiguration_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkAttributes_FWD_DEFINED__
-#define __IDeckLinkAttributes_FWD_DEFINED__
-typedef interface IDeckLinkAttributes IDeckLinkAttributes;
-#endif 	/* __IDeckLinkAttributes_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkKeyer_FWD_DEFINED__
-#define __IDeckLinkKeyer_FWD_DEFINED__
-typedef interface IDeckLinkKeyer IDeckLinkKeyer;
-#endif 	/* __IDeckLinkKeyer_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoConversion_FWD_DEFINED__
-#define __IDeckLinkVideoConversion_FWD_DEFINED__
-typedef interface IDeckLinkVideoConversion IDeckLinkVideoConversion;
-#endif 	/* __IDeckLinkVideoConversion_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__
-#define __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__
-typedef interface IDeckLinkDeckControlStatusCallback IDeckLinkDeckControlStatusCallback;
-#endif 	/* __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDeckControl_FWD_DEFINED__
-#define __IDeckLinkDeckControl_FWD_DEFINED__
-typedef interface IDeckLinkDeckControl IDeckLinkDeckControl;
-#endif 	/* __IDeckLinkDeckControl_FWD_DEFINED__ */
-
-
-#ifndef __CDeckLinkIterator_FWD_DEFINED__
-#define __CDeckLinkIterator_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class CDeckLinkIterator CDeckLinkIterator;
-#else
-typedef struct CDeckLinkIterator CDeckLinkIterator;
-#endif /* __cplusplus */
-
-#endif 	/* __CDeckLinkIterator_FWD_DEFINED__ */
-
-
-#ifndef __CDeckLinkAPIInformation_FWD_DEFINED__
-#define __CDeckLinkAPIInformation_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class CDeckLinkAPIInformation CDeckLinkAPIInformation;
-#else
-typedef struct CDeckLinkAPIInformation CDeckLinkAPIInformation;
-#endif /* __cplusplus */
-
-#endif 	/* __CDeckLinkAPIInformation_FWD_DEFINED__ */
-
-
-#ifndef __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__
-#define __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper;
-#else
-typedef struct CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper;
-#endif /* __cplusplus */
-
-#endif 	/* __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */
-
-
-#ifndef __CDeckLinkVideoConversion_FWD_DEFINED__
-#define __CDeckLinkVideoConversion_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class CDeckLinkVideoConversion CDeckLinkVideoConversion;
-#else
-typedef struct CDeckLinkVideoConversion CDeckLinkVideoConversion;
-#endif /* __cplusplus */
-
-#endif 	/* __CDeckLinkVideoConversion_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDeckControl_v7_9_FWD_DEFINED__
-#define __IDeckLinkDeckControl_v7_9_FWD_DEFINED__
-typedef interface IDeckLinkDeckControl_v7_9 IDeckLinkDeckControl_v7_9;
-#endif 	/* __IDeckLinkDeckControl_v7_9_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__
-#define __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkDisplayModeIterator_v7_6 IDeckLinkDisplayModeIterator_v7_6;
-#endif 	/* __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__
-#define __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkDisplayMode_v7_6 IDeckLinkDisplayMode_v7_6;
-#endif 	/* __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_v7_6_FWD_DEFINED__
-#define __IDeckLinkOutput_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkOutput_v7_6 IDeckLinkOutput_v7_6;
-#endif 	/* __IDeckLinkOutput_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_v7_6_FWD_DEFINED__
-#define __IDeckLinkInput_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkInput_v7_6 IDeckLinkInput_v7_6;
-#endif 	/* __IDeckLinkInput_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkTimecode_v7_6_FWD_DEFINED__
-#define __IDeckLinkTimecode_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkTimecode_v7_6 IDeckLinkTimecode_v7_6;
-#endif 	/* __IDeckLinkTimecode_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__
-#define __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkVideoFrame_v7_6 IDeckLinkVideoFrame_v7_6;
-#endif 	/* __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__
-#define __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkMutableVideoFrame_v7_6 IDeckLinkMutableVideoFrame_v7_6;
-#endif 	/* __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__
-#define __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkVideoInputFrame_v7_6 IDeckLinkVideoInputFrame_v7_6;
-#endif 	/* __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__
-#define __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkScreenPreviewCallback_v7_6 IDeckLinkScreenPreviewCallback_v7_6;
-#endif 	/* __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__
-#define __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkGLScreenPreviewHelper_v7_6 IDeckLinkGLScreenPreviewHelper_v7_6;
-#endif 	/* __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__
-#define __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkVideoConversion_v7_6 IDeckLinkVideoConversion_v7_6;
-#endif 	/* __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkConfiguration_v7_6_FWD_DEFINED__
-#define __IDeckLinkConfiguration_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkConfiguration_v7_6 IDeckLinkConfiguration_v7_6;
-#endif 	/* __IDeckLinkConfiguration_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__
-#define __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkVideoOutputCallback_v7_6 IDeckLinkVideoOutputCallback_v7_6;
-#endif 	/* __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInputCallback_v7_6_FWD_DEFINED__
-#define __IDeckLinkInputCallback_v7_6_FWD_DEFINED__
-typedef interface IDeckLinkInputCallback_v7_6 IDeckLinkInputCallback_v7_6;
-#endif 	/* __IDeckLinkInputCallback_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__
-#define __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class CDeckLinkGLScreenPreviewHelper_v7_6 CDeckLinkGLScreenPreviewHelper_v7_6;
-#else
-typedef struct CDeckLinkGLScreenPreviewHelper_v7_6 CDeckLinkGLScreenPreviewHelper_v7_6;
-#endif /* __cplusplus */
-
-#endif 	/* __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__
-#define __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class CDeckLinkVideoConversion_v7_6 CDeckLinkVideoConversion_v7_6;
-#else
-typedef struct CDeckLinkVideoConversion_v7_6 CDeckLinkVideoConversion_v7_6;
-#endif /* __cplusplus */
-
-#endif 	/* __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInputCallback_v7_3_FWD_DEFINED__
-#define __IDeckLinkInputCallback_v7_3_FWD_DEFINED__
-typedef interface IDeckLinkInputCallback_v7_3 IDeckLinkInputCallback_v7_3;
-#endif 	/* __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_v7_3_FWD_DEFINED__
-#define __IDeckLinkOutput_v7_3_FWD_DEFINED__
-typedef interface IDeckLinkOutput_v7_3 IDeckLinkOutput_v7_3;
-#endif 	/* __IDeckLinkOutput_v7_3_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_v7_3_FWD_DEFINED__
-#define __IDeckLinkInput_v7_3_FWD_DEFINED__
-typedef interface IDeckLinkInput_v7_3 IDeckLinkInput_v7_3;
-#endif 	/* __IDeckLinkInput_v7_3_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__
-#define __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__
-typedef interface IDeckLinkVideoInputFrame_v7_3 IDeckLinkVideoInputFrame_v7_3;
-#endif 	/* __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__
-#define __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkDisplayModeIterator_v7_1 IDeckLinkDisplayModeIterator_v7_1;
-#endif 	/* __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__
-#define __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkDisplayMode_v7_1 IDeckLinkDisplayMode_v7_1;
-#endif 	/* __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__
-#define __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkVideoFrame_v7_1 IDeckLinkVideoFrame_v7_1;
-#endif 	/* __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__
-#define __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkVideoInputFrame_v7_1 IDeckLinkVideoInputFrame_v7_1;
-#endif 	/* __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__
-#define __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkAudioInputPacket_v7_1 IDeckLinkAudioInputPacket_v7_1;
-#endif 	/* __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__
-#define __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkVideoOutputCallback_v7_1 IDeckLinkVideoOutputCallback_v7_1;
-#endif 	/* __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInputCallback_v7_1_FWD_DEFINED__
-#define __IDeckLinkInputCallback_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkInputCallback_v7_1 IDeckLinkInputCallback_v7_1;
-#endif 	/* __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_v7_1_FWD_DEFINED__
-#define __IDeckLinkOutput_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkOutput_v7_1 IDeckLinkOutput_v7_1;
-#endif 	/* __IDeckLinkOutput_v7_1_FWD_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_v7_1_FWD_DEFINED__
-#define __IDeckLinkInput_v7_1_FWD_DEFINED__
-typedef interface IDeckLinkInput_v7_1 IDeckLinkInput_v7_1;
-#endif 	/* __IDeckLinkInput_v7_1_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "unknwn.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-
-#ifndef __DeckLinkAPI_LIBRARY_DEFINED__
-#define __DeckLinkAPI_LIBRARY_DEFINED__
-
-/* library DeckLinkAPI */
-/* [helpstring][version][uuid] */ 
-
-typedef LONGLONG BMDTimeValue;
-
-typedef LONGLONG BMDTimeScale;
-
-typedef unsigned long BMDTimecodeBCD;
-
-typedef unsigned long BMDTimecodeUserBits;
-
-typedef unsigned long BMDDisplayModeFlags;
-typedef unsigned long BMDFrameFlags;
-typedef unsigned long BMDVideoInputFlags;
-typedef unsigned long BMDVideoInputFormatChangedEvents;
-typedef unsigned long BMDDetectedVideoInputFormatFlags;
-typedef unsigned long BMDTimecodeFlags;
-typedef unsigned long BMDAnalogVideoFlags;
-typedef unsigned long BMDDeckControlStatusFlags;
-typedef unsigned long BMDDeckControlExportModeOpsFlags;
-#if 0
-typedef enum _BMDDisplayModeFlags BMDDisplayModeFlags;
-
-typedef enum _BMDFrameFlags BMDFrameFlags;
-
-typedef enum _BMDVideoInputFlags BMDVideoInputFlags;
-
-typedef enum _BMDVideoInputFormatChangedEvents BMDVideoInputFormatChangedEvents;
-
-typedef enum _BMDDetectedVideoInputFormatFlags BMDDetectedVideoInputFormatFlags;
-
-typedef enum _BMDTimecodeFlags BMDTimecodeFlags;
-
-typedef enum _BMDAnalogVideoFlags BMDAnalogVideoFlags;
-
-typedef enum _BMDDeckControlStatusFlags BMDDeckControlStatusFlags;
-
-typedef enum _BMDDeckControlExportModeOpsFlags BMDDeckControlExportModeOpsFlags;
-
-#endif
-typedef /* [v1_enum] */ 
-enum _BMDDisplayMode
-    {	bmdModeNTSC	= 0x6e747363,
-	bmdModeNTSC2398	= 0x6e743233,
-	bmdModePAL	= 0x70616c20,
-	bmdModeNTSCp	= 0x6e747370,
-	bmdModePALp	= 0x70616c70,
-	bmdModeHD1080p2398	= 0x32337073,
-	bmdModeHD1080p24	= 0x32347073,
-	bmdModeHD1080p25	= 0x48703235,
-	bmdModeHD1080p2997	= 0x48703239,
-	bmdModeHD1080p30	= 0x48703330,
-	bmdModeHD1080i50	= 0x48693530,
-	bmdModeHD1080i5994	= 0x48693539,
-	bmdModeHD1080i6000	= 0x48693630,
-	bmdModeHD1080p50	= 0x48703530,
-	bmdModeHD1080p5994	= 0x48703539,
-	bmdModeHD1080p6000	= 0x48703630,
-	bmdModeHD720p50	= 0x68703530,
-	bmdModeHD720p5994	= 0x68703539,
-	bmdModeHD720p60	= 0x68703630,
-	bmdMode2k2398	= 0x326b3233,
-	bmdMode2k24	= 0x326b3234,
-	bmdMode2k25	= 0x326b3235
-    } 	BMDDisplayMode;
-
-typedef /* [v1_enum] */ 
-enum _BMDFieldDominance
-    {	bmdUnknownFieldDominance	= 0,
-	bmdLowerFieldFirst	= 0x6c6f7772,
-	bmdUpperFieldFirst	= 0x75707072,
-	bmdProgressiveFrame	= 0x70726f67,
-	bmdProgressiveSegmentedFrame	= 0x70736620
-    } 	BMDFieldDominance;
-
-typedef /* [v1_enum] */ 
-enum _BMDPixelFormat
-    {	bmdFormat8BitYUV	= 0x32767579,
-	bmdFormat10BitYUV	= 0x76323130,
-	bmdFormat8BitARGB	= 32,
-	bmdFormat8BitBGRA	= 0x42475241,
-	bmdFormat10BitRGB	= 0x72323130
-    } 	BMDPixelFormat;
-
-/* [v1_enum] */ 
-enum _BMDDisplayModeFlags
-    {	bmdDisplayModeSupports3D	= ( 1 << 0 ) ,
-	bmdDisplayModeColorspaceRec601	= ( 1 << 1 ) ,
-	bmdDisplayModeColorspaceRec709	= ( 1 << 2 ) 
-    } ;
-typedef /* [v1_enum] */ 
-enum _BMDVideoOutputFlags
-    {	bmdVideoOutputFlagDefault	= 0,
-	bmdVideoOutputVANC	= ( 1 << 0 ) ,
-	bmdVideoOutputVITC	= ( 1 << 1 ) ,
-	bmdVideoOutputRP188	= ( 1 << 2 ) ,
-	bmdVideoOutputDualStream3D	= ( 1 << 4 ) 
-    } 	BMDVideoOutputFlags;
-
-/* [v1_enum] */ 
-enum _BMDFrameFlags
-    {	bmdFrameFlagDefault	= 0,
-	bmdFrameFlagFlipVertical	= ( 1 << 0 ) ,
-	bmdFrameHasNoInputSource	= ( 1 << 31 ) 
-    } ;
-/* [v1_enum] */ 
-enum _BMDVideoInputFlags
-    {	bmdVideoInputFlagDefault	= 0,
-	bmdVideoInputEnableFormatDetection	= ( 1 << 0 ) ,
-	bmdVideoInputDualStream3D	= ( 1 << 1 ) 
-    } ;
-/* [v1_enum] */ 
-enum _BMDVideoInputFormatChangedEvents
-    {	bmdVideoInputDisplayModeChanged	= ( 1 << 0 ) ,
-	bmdVideoInputFieldDominanceChanged	= ( 1 << 1 ) ,
-	bmdVideoInputColorspaceChanged	= ( 1 << 2 ) 
-    } ;
-/* [v1_enum] */ 
-enum _BMDDetectedVideoInputFormatFlags
-    {	bmdDetectedVideoInputYCbCr422	= ( 1 << 0 ) ,
-	bmdDetectedVideoInputRGB444	= ( 1 << 1 ) 
-    } ;
-typedef /* [v1_enum] */ 
-enum _BMDOutputFrameCompletionResult
-    {	bmdOutputFrameCompleted	= 0,
-	bmdOutputFrameDisplayedLate	= ( bmdOutputFrameCompleted + 1 ) ,
-	bmdOutputFrameDropped	= ( bmdOutputFrameDisplayedLate + 1 ) ,
-	bmdOutputFrameFlushed	= ( bmdOutputFrameDropped + 1 ) 
-    } 	BMDOutputFrameCompletionResult;
-
-typedef /* [v1_enum] */ 
-enum _BMDReferenceStatus
-    {	bmdReferenceNotSupportedByHardware	= ( 1 << 0 ) ,
-	bmdReferenceLocked	= ( 1 << 1 ) 
-    } 	BMDReferenceStatus;
-
-typedef /* [v1_enum] */ 
-enum _BMDAudioSampleRate
-    {	bmdAudioSampleRate48kHz	= 48000
-    } 	BMDAudioSampleRate;
-
-typedef /* [v1_enum] */ 
-enum _BMDAudioSampleType
-    {	bmdAudioSampleType16bitInteger	= 16,
-	bmdAudioSampleType32bitInteger	= 32
-    } 	BMDAudioSampleType;
-
-typedef /* [v1_enum] */ 
-enum _BMDAudioOutputStreamType
-    {	bmdAudioOutputStreamContinuous	= 0,
-	bmdAudioOutputStreamContinuousDontResample	= ( bmdAudioOutputStreamContinuous + 1 ) ,
-	bmdAudioOutputStreamTimestamped	= ( bmdAudioOutputStreamContinuousDontResample + 1 ) 
-    } 	BMDAudioOutputStreamType;
-
-typedef /* [v1_enum] */ 
-enum _BMDDisplayModeSupport
-    {	bmdDisplayModeNotSupported	= 0,
-	bmdDisplayModeSupported	= ( bmdDisplayModeNotSupported + 1 ) ,
-	bmdDisplayModeSupportedWithConversion	= ( bmdDisplayModeSupported + 1 ) 
-    } 	BMDDisplayModeSupport;
-
-typedef /* [v1_enum] */ 
-enum _BMDTimecodeFormat
-    {	bmdTimecodeRP188	= 0x72703138,
-	bmdTimecodeRP188Field2	= 0x72703132,
-	bmdTimecodeVITC	= 0x76697463,
-	bmdTimecodeVITCField2	= 0x76697432,
-	bmdTimecodeSerial	= 0x73657269
-    } 	BMDTimecodeFormat;
-
-/* [v1_enum] */ 
-enum _BMDTimecodeFlags
-    {	bmdTimecodeFlagDefault	= 0,
-	bmdTimecodeIsDropFrame	= ( 1 << 0 ) 
-    } ;
-typedef /* [v1_enum] */ 
-enum _BMDVideoConnection
-    {	bmdVideoConnectionSDI	= ( 1 << 0 ) ,
-	bmdVideoConnectionHDMI	= ( 1 << 1 ) ,
-	bmdVideoConnectionOpticalSDI	= ( 1 << 2 ) ,
-	bmdVideoConnectionComponent	= ( 1 << 3 ) ,
-	bmdVideoConnectionComposite	= ( 1 << 4 ) ,
-	bmdVideoConnectionSVideo	= ( 1 << 5 ) 
-    } 	BMDVideoConnection;
-
-/* [v1_enum] */ 
-enum _BMDAnalogVideoFlags
-    {	bmdAnalogVideoFlagCompositeSetup75	= ( 1 << 0 ) ,
-	bmdAnalogVideoFlagComponentBetacamLevels	= ( 1 << 1 ) 
-    } ;
-typedef /* [v1_enum] */ 
-enum _BMDAudioConnection
-    {	bmdAudioConnectionEmbedded	= 0x656d6264,
-	bmdAudioConnectionAESEBU	= 0x61657320,
-	bmdAudioConnectionAnalog	= 0x616e6c67
-    } 	BMDAudioConnection;
-
-typedef /* [v1_enum] */ 
-enum _BMDAudioOutputAnalogAESSwitch
-    {	bmdAudioOutputSwitchAESEBU	= 0x61657320,
-	bmdAudioOutputSwitchAnalog	= 0x616e6c67
-    } 	BMDAudioOutputAnalogAESSwitch;
-
-typedef /* [v1_enum] */ 
-enum _BMDVideoOutputConversionMode
-    {	bmdNoVideoOutputConversion	= 0x6e6f6e65,
-	bmdVideoOutputLetterboxDownconversion	= 0x6c746278,
-	bmdVideoOutputAnamorphicDownconversion	= 0x616d7068,
-	bmdVideoOutputHD720toHD1080Conversion	= 0x37323063,
-	bmdVideoOutputHardwareLetterboxDownconversion	= 0x48576c62,
-	bmdVideoOutputHardwareAnamorphicDownconversion	= 0x4857616d,
-	bmdVideoOutputHardwareCenterCutDownconversion	= 0x48576363,
-	bmdVideoOutputHardware720p1080pCrossconversion	= 0x78636170,
-	bmdVideoOutputHardwareAnamorphic720pUpconversion	= 0x75613770,
-	bmdVideoOutputHardwareAnamorphic1080iUpconversion	= 0x75613169,
-	bmdVideoOutputHardwareAnamorphic149To720pUpconversion	= 0x75343770,
-	bmdVideoOutputHardwareAnamorphic149To1080iUpconversion	= 0x75343169,
-	bmdVideoOutputHardwarePillarbox720pUpconversion	= 0x75703770,
-	bmdVideoOutputHardwarePillarbox1080iUpconversion	= 0x75703169
-    } 	BMDVideoOutputConversionMode;
-
-typedef /* [v1_enum] */ 
-enum _BMDVideoInputConversionMode
-    {	bmdNoVideoInputConversion	= 0x6e6f6e65,
-	bmdVideoInputLetterboxDownconversionFromHD1080	= 0x31306c62,
-	bmdVideoInputAnamorphicDownconversionFromHD1080	= 0x3130616d,
-	bmdVideoInputLetterboxDownconversionFromHD720	= 0x37326c62,
-	bmdVideoInputAnamorphicDownconversionFromHD720	= 0x3732616d,
-	bmdVideoInputLetterboxUpconversion	= 0x6c627570,
-	bmdVideoInputAnamorphicUpconversion	= 0x616d7570
-    } 	BMDVideoInputConversionMode;
-
-typedef /* [v1_enum] */ 
-enum _BMDVideo3DPackingFormat
-    {	bmdVideo3DPackingSidebySideHalf	= 0x73627368,
-	bmdVideo3DPackingLinebyLine	= 0x6c62796c,
-	bmdVideo3DPackingTopAndBottom	= 0x7461626f,
-	bmdVideo3DPackingFramePacking	= 0x6672706b,
-	bmdVideo3DPackingLeftOnly	= 0x6c656674,
-	bmdVideo3DPackingRightOnly	= 0x72696768
-    } 	BMDVideo3DPackingFormat;
-
-typedef /* [v1_enum] */ 
-enum _BMDIdleVideoOutputOperation
-    {	bmdIdleVideoOutputBlack	= 0x626c6163,
-	bmdIdleVideoOutputLastFrame	= 0x6c616661
-    } 	BMDIdleVideoOutputOperation;
-
-typedef /* [v1_enum] */ 
-enum _BMDDeckLinkConfigurationID
-    {	bmdDeckLinkConfigSwapSerialRxTx	= 0x73737274,
-	bmdDeckLinkConfigUse1080pNotPsF	= 0x6670726f,
-	bmdDeckLinkConfigHDMI3DPackingFormat	= 0x33647066,
-	bmdDeckLinkConfigBypass	= 0x62797073,
-	bmdDeckLinkConfigAnalogAudioConsumerLevels	= 0x6161636c,
-	bmdDeckLinkConfigFieldFlickerRemoval	= 0x66646672,
-	bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion	= 0x746f3539,
-	bmdDeckLinkConfig444SDIVideoOutput	= 0x3434346f,
-	bmdDeckLinkConfig3GBpsVideoOutput	= 0x33676273,
-	bmdDeckLinkConfigBlackVideoOutputDuringCapture	= 0x62766f63,
-	bmdDeckLinkConfigLowLatencyVideoOutput	= 0x6c6c766f,
-	bmdDeckLinkConfigVideoOutputConnection	= 0x766f636e,
-	bmdDeckLinkConfigVideoOutputConversionMode	= 0x766f636d,
-	bmdDeckLinkConfigAnalogVideoOutputFlags	= 0x61766f66,
-	bmdDeckLinkConfigReferenceInputTimingOffset	= 0x676c6f74,
-	bmdDeckLinkConfigVideoOutputIdleOperation	= 0x766f696f,
-	bmdDeckLinkConfigVideoOutputComponentLumaGain	= 0x6f636c67,
-	bmdDeckLinkConfigVideoOutputComponentChromaBlueGain	= 0x6f636362,
-	bmdDeckLinkConfigVideoOutputComponentChromaRedGain	= 0x6f636372,
-	bmdDeckLinkConfigVideoOutputCompositeLumaGain	= 0x6f696c67,
-	bmdDeckLinkConfigVideoOutputCompositeChromaGain	= 0x6f696367,
-	bmdDeckLinkConfigVideoOutputSVideoLumaGain	= 0x6f736c67,
-	bmdDeckLinkConfigVideoOutputSVideoChromaGain	= 0x6f736367,
-	bmdDeckLinkConfigVideoInputConnection	= 0x7669636e,
-	bmdDeckLinkConfigAnalogVideoInputFlags	= 0x61766966,
-	bmdDeckLinkConfigVideoInputConversionMode	= 0x7669636d,
-	bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame	= 0x70646966,
-	bmdDeckLinkConfigVANCSourceLine1Mapping	= 0x76736c31,
-	bmdDeckLinkConfigVANCSourceLine2Mapping	= 0x76736c32,
-	bmdDeckLinkConfigVANCSourceLine3Mapping	= 0x76736c33,
-	bmdDeckLinkConfigVideoInputComponentLumaGain	= 0x69636c67,
-	bmdDeckLinkConfigVideoInputComponentChromaBlueGain	= 0x69636362,
-	bmdDeckLinkConfigVideoInputComponentChromaRedGain	= 0x69636372,
-	bmdDeckLinkConfigVideoInputCompositeLumaGain	= 0x69696c67,
-	bmdDeckLinkConfigVideoInputCompositeChromaGain	= 0x69696367,
-	bmdDeckLinkConfigVideoInputSVideoLumaGain	= 0x69736c67,
-	bmdDeckLinkConfigVideoInputSVideoChromaGain	= 0x69736367,
-	bmdDeckLinkConfigAudioInputConnection	= 0x6169636e,
-	bmdDeckLinkConfigAnalogAudioInputScaleChannel1	= 0x61697331,
-	bmdDeckLinkConfigAnalogAudioInputScaleChannel2	= 0x61697332,
-	bmdDeckLinkConfigAnalogAudioInputScaleChannel3	= 0x61697333,
-	bmdDeckLinkConfigAnalogAudioInputScaleChannel4	= 0x61697334,
-	bmdDeckLinkConfigDigitalAudioInputScale	= 0x64616973,
-	bmdDeckLinkConfigAudioOutputAESAnalogSwitch	= 0x616f6161,
-	bmdDeckLinkConfigAnalogAudioOutputScaleChannel1	= 0x616f7331,
-	bmdDeckLinkConfigAnalogAudioOutputScaleChannel2	= 0x616f7332,
-	bmdDeckLinkConfigAnalogAudioOutputScaleChannel3	= 0x616f7333,
-	bmdDeckLinkConfigAnalogAudioOutputScaleChannel4	= 0x616f7334,
-	bmdDeckLinkConfigDigitalAudioOutputScale	= 0x64616f73
-    } 	BMDDeckLinkConfigurationID;
-
-typedef /* [v1_enum] */ 
-enum _BMDDeckLinkAttributeID
-    {	BMDDeckLinkSupportsInternalKeying	= 0x6b657969,
-	BMDDeckLinkSupportsExternalKeying	= 0x6b657965,
-	BMDDeckLinkSupportsHDKeying	= 0x6b657968,
-	BMDDeckLinkSupportsInputFormatDetection	= 0x696e6664,
-	BMDDeckLinkHasReferenceInput	= 0x6872696e,
-	BMDDeckLinkHasSerialPort	= 0x68737074,
-	BMDDeckLinkHasAnalogVideoOutputGain	= 0x61766f67,
-	BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain	= 0x6f766f67,
-	BMDDeckLinkHasVideoInputAntiAliasingFilter	= 0x6161666c,
-	BMDDeckLinkHasBypass	= 0x62797073,
-	BMDDeckLinkMaximumAudioChannels	= 0x6d616368,
-	BMDDeckLinkNumberOfSubDevices	= 0x6e736264,
-	BMDDeckLinkSubDeviceIndex	= 0x73756269,
-	BMDDeckLinkVideoOutputConnections	= 0x766f636e,
-	BMDDeckLinkVideoInputConnections	= 0x7669636e,
-	BMDDeckLinkVideoInputGainMinimum	= 0x7669676d,
-	BMDDeckLinkVideoInputGainMaximum	= 0x76696778,
-	BMDDeckLinkVideoOutputGainMinimum	= 0x766f676d,
-	BMDDeckLinkVideoOutputGainMaximum	= 0x766f6778,
-	BMDDeckLinkSerialPortDeviceName	= 0x736c706e
-    } 	BMDDeckLinkAttributeID;
-
-typedef /* [v1_enum] */ 
-enum _BMDDeckLinkAPIInformationID
-    {	BMDDeckLinkAPIVersion	= 0x76657273
-    } 	BMDDeckLinkAPIInformationID;
-
-typedef /* [v1_enum] */ 
-enum _BMDDeckControlMode
-    {	bmdDeckControlNotOpened	= 0x6e746f70,
-	bmdDeckControlVTRControlMode	= 0x76747263,
-	bmdDeckControlExportMode	= 0x6578706d,
-	bmdDeckControlCaptureMode	= 0x6361706d
-    } 	BMDDeckControlMode;
-
-typedef /* [v1_enum] */ 
-enum _BMDDeckControlEvent
-    {	bmdDeckControlAbortedEvent	= 0x61627465,
-	bmdDeckControlPrepareForExportEvent	= 0x70666565,
-	bmdDeckControlExportCompleteEvent	= 0x65786365,
-	bmdDeckControlPrepareForCaptureEvent	= 0x70666365,
-	bmdDeckControlCaptureCompleteEvent	= 0x63636576
-    } 	BMDDeckControlEvent;
-
-typedef /* [v1_enum] */ 
-enum _BMDDeckControlVTRControlState
-    {	bmdDeckControlNotInVTRControlMode	= 0x6e76636d,
-	bmdDeckControlVTRControlPlaying	= 0x76747270,
-	bmdDeckControlVTRControlRecording	= 0x76747272,
-	bmdDeckControlVTRControlStill	= 0x76747261,
-	bmdDeckControlVTRControlSeeking	= 0x76747273,
-	bmdDeckControlVTRControlStopped	= 0x7674726f
-    } 	BMDDeckControlVTRControlState;
-
-/* [v1_enum] */ 
-enum _BMDDeckControlStatusFlags
-    {	bmdDeckControlStatusDeckConnected	= ( 1 << 0 ) ,
-	bmdDeckControlStatusRemoteMode	= ( 1 << 1 ) ,
-	bmdDeckControlStatusRecordInhibited	= ( 1 << 2 ) ,
-	bmdDeckControlStatusCassetteOut	= ( 1 << 3 ) 
-    } ;
-/* [v1_enum] */ 
-enum _BMDDeckControlExportModeOpsFlags
-    {	bmdDeckControlExportModeInsertVideo	= ( 1 << 0 ) ,
-	bmdDeckControlExportModeInsertAudio1	= ( 1 << 1 ) ,
-	bmdDeckControlExportModeInsertAudio2	= ( 1 << 2 ) ,
-	bmdDeckControlExportModeInsertAudio3	= ( 1 << 3 ) ,
-	bmdDeckControlExportModeInsertAudio4	= ( 1 << 4 ) ,
-	bmdDeckControlExportModeInsertAudio5	= ( 1 << 5 ) ,
-	bmdDeckControlExportModeInsertAudio6	= ( 1 << 6 ) ,
-	bmdDeckControlExportModeInsertAudio7	= ( 1 << 7 ) ,
-	bmdDeckControlExportModeInsertAudio8	= ( 1 << 8 ) ,
-	bmdDeckControlExportModeInsertAudio9	= ( 1 << 9 ) ,
-	bmdDeckControlExportModeInsertAudio10	= ( 1 << 10 ) ,
-	bmdDeckControlExportModeInsertAudio11	= ( 1 << 11 ) ,
-	bmdDeckControlExportModeInsertAudio12	= ( 1 << 12 ) ,
-	bmdDeckControlExportModeInsertTimeCode	= ( 1 << 13 ) ,
-	bmdDeckControlExportModeInsertAssemble	= ( 1 << 14 ) ,
-	bmdDeckControlExportModeInsertPreview	= ( 1 << 15 ) ,
-	bmdDeckControlUseManualExport	= ( 1 << 16 ) 
-    } ;
-typedef /* [v1_enum] */ 
-enum _BMDDeckControlError
-    {	bmdDeckControlNoError	= 0x6e6f6572,
-	bmdDeckControlModeError	= 0x6d6f6572,
-	bmdDeckControlMissedInPointError	= 0x6d696572,
-	bmdDeckControlDeckTimeoutError	= 0x64746572,
-	bmdDeckControlCommandFailedError	= 0x63666572,
-	bmdDeckControlDeviceAlreadyOpenedError	= 0x64616c6f,
-	bmdDeckControlFailedToOpenDeviceError	= 0x66646572,
-	bmdDeckControlInLocalModeError	= 0x6c6d6572,
-	bmdDeckControlEndOfTapeError	= 0x65746572,
-	bmdDeckControlUserAbortError	= 0x75616572,
-	bmdDeckControlNoTapeInDeckError	= 0x6e746572,
-	bmdDeckControlNoVideoFromCardError	= 0x6e766663,
-	bmdDeckControlNoCommunicationError	= 0x6e636f6d,
-	bmdDeckControlBufferTooSmallError	= 0x6274736d,
-	bmdDeckControlBadChecksumError	= 0x63686b73,
-	bmdDeckControlUnknownError	= 0x756e6572
-    } 	BMDDeckControlError;
-
-typedef /* [v1_enum] */ 
-enum _BMD3DPreviewFormat
-    {	bmd3DPreviewFormatDefault	= 0x64656661,
-	bmd3DPreviewFormatLeftOnly	= 0x6c656674,
-	bmd3DPreviewFormatRightOnly	= 0x72696768,
-	bmd3DPreviewFormatSideBySide	= 0x73696465,
-	bmd3DPreviewFormatTopBottom	= 0x746f7062
-    } 	BMD3DPreviewFormat;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-typedef /* [v1_enum] */ 
-enum _BMDVideoConnection_v7_6
-    {	bmdVideoConnectionSDI_v7_6	= 0x73646920,
-	bmdVideoConnectionHDMI_v7_6	= 0x68646d69,
-	bmdVideoConnectionOpticalSDI_v7_6	= 0x6f707469,
-	bmdVideoConnectionComponent_v7_6	= 0x63706e74,
-	bmdVideoConnectionComposite_v7_6	= 0x636d7374,
-	bmdVideoConnectionSVideo_v7_6	= 0x73766964
-    } 	BMDVideoConnection_v7_6;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXTERN_C const IID LIBID_DeckLinkAPI;
-
-#ifndef __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__
-#define __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoOutputCallback */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoOutputCallback;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("20AA5225-1958-47CB-820B-80A8D521A6EE")
-    IDeckLinkVideoOutputCallback : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( 
-            /* [in] */ IDeckLinkVideoFrame *completedFrame,
-            /* [in] */ BMDOutputFrameCompletionResult result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoOutputCallbackVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoOutputCallback * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoOutputCallback * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoOutputCallback * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( 
-            IDeckLinkVideoOutputCallback * This,
-            /* [in] */ IDeckLinkVideoFrame *completedFrame,
-            /* [in] */ BMDOutputFrameCompletionResult result);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( 
-            IDeckLinkVideoOutputCallback * This);
-        
-        END_INTERFACE
-    } IDeckLinkVideoOutputCallbackVtbl;
-
-    interface IDeckLinkVideoOutputCallback
-    {
-        CONST_VTBL struct IDeckLinkVideoOutputCallbackVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoOutputCallback_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoOutputCallback_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoOutputCallback_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoOutputCallback_ScheduledFrameCompleted(This,completedFrame,result)	\
-    ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) 
-
-#define IDeckLinkVideoOutputCallback_ScheduledPlaybackHasStopped(This)	\
-    ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkInputCallback_INTERFACE_DEFINED__
-#define __IDeckLinkInputCallback_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInputCallback */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInputCallback;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("DD04E5EC-7415-42AB-AE4A-E80C4DFC044A")
-    IDeckLinkInputCallback : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( 
-            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,
-            /* [in] */ IDeckLinkDisplayMode *newDisplayMode,
-            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 
-            /* [in] */ IDeckLinkVideoInputFrame *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInputCallbackVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInputCallback * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInputCallback * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInputCallback * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( 
-            IDeckLinkInputCallback * This,
-            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,
-            /* [in] */ IDeckLinkDisplayMode *newDisplayMode,
-            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 
-            IDeckLinkInputCallback * This,
-            /* [in] */ IDeckLinkVideoInputFrame *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket *audioPacket);
-        
-        END_INTERFACE
-    } IDeckLinkInputCallbackVtbl;
-
-    interface IDeckLinkInputCallback
-    {
-        CONST_VTBL struct IDeckLinkInputCallbackVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInputCallback_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInputCallback_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInputCallback_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInputCallback_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags)	\
-    ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) 
-
-#define IDeckLinkInputCallback_VideoInputFrameArrived(This,videoFrame,audioPacket)	\
-    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInputCallback_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__
-#define __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__
-
-/* interface IDeckLinkMemoryAllocator */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkMemoryAllocator;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("B36EB6E7-9D29-4AA8-92EF-843B87A289E8")
-    IDeckLinkMemoryAllocator : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE AllocateBuffer( 
-            /* [in] */ unsigned long bufferSize,
-            /* [out] */ void **allocatedBuffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( 
-            /* [in] */ void *buffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Decommit( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkMemoryAllocatorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkMemoryAllocator * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkMemoryAllocator * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkMemoryAllocator * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *AllocateBuffer )( 
-            IDeckLinkMemoryAllocator * This,
-            /* [in] */ unsigned long bufferSize,
-            /* [out] */ void **allocatedBuffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( 
-            IDeckLinkMemoryAllocator * This,
-            /* [in] */ void *buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *Commit )( 
-            IDeckLinkMemoryAllocator * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Decommit )( 
-            IDeckLinkMemoryAllocator * This);
-        
-        END_INTERFACE
-    } IDeckLinkMemoryAllocatorVtbl;
-
-    interface IDeckLinkMemoryAllocator
-    {
-        CONST_VTBL struct IDeckLinkMemoryAllocatorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkMemoryAllocator_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkMemoryAllocator_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkMemoryAllocator_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkMemoryAllocator_AllocateBuffer(This,bufferSize,allocatedBuffer)	\
-    ( (This)->lpVtbl -> AllocateBuffer(This,bufferSize,allocatedBuffer) ) 
-
-#define IDeckLinkMemoryAllocator_ReleaseBuffer(This,buffer)	\
-    ( (This)->lpVtbl -> ReleaseBuffer(This,buffer) ) 
-
-#define IDeckLinkMemoryAllocator_Commit(This)	\
-    ( (This)->lpVtbl -> Commit(This) ) 
-
-#define IDeckLinkMemoryAllocator_Decommit(This)	\
-    ( (This)->lpVtbl -> Decommit(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__
-#define __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__
-
-/* interface IDeckLinkAudioOutputCallback */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkAudioOutputCallback;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("403C681B-7F46-4A12-B993-2BB127084EE6")
-    IDeckLinkAudioOutputCallback : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples( 
-            /* [in] */ BOOL preroll) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkAudioOutputCallbackVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkAudioOutputCallback * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkAudioOutputCallback * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkAudioOutputCallback * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *RenderAudioSamples )( 
-            IDeckLinkAudioOutputCallback * This,
-            /* [in] */ BOOL preroll);
-        
-        END_INTERFACE
-    } IDeckLinkAudioOutputCallbackVtbl;
-
-    interface IDeckLinkAudioOutputCallback
-    {
-        CONST_VTBL struct IDeckLinkAudioOutputCallbackVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkAudioOutputCallback_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkAudioOutputCallback_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkAudioOutputCallback_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkAudioOutputCallback_RenderAudioSamples(This,preroll)	\
-    ( (This)->lpVtbl -> RenderAudioSamples(This,preroll) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkIterator_INTERFACE_DEFINED__
-#define __IDeckLinkIterator_INTERFACE_DEFINED__
-
-/* interface IDeckLinkIterator */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkIterator;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("74E936FC-CC28-4A67-81A0-1E94E52D4E69")
-    IDeckLinkIterator : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Next( 
-            /* [out] */ IDeckLink **deckLinkInstance) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkIteratorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkIterator * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkIterator * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkIterator * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Next )( 
-            IDeckLinkIterator * This,
-            /* [out] */ IDeckLink **deckLinkInstance);
-        
-        END_INTERFACE
-    } IDeckLinkIteratorVtbl;
-
-    interface IDeckLinkIterator
-    {
-        CONST_VTBL struct IDeckLinkIteratorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkIterator_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkIterator_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkIterator_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkIterator_Next(This,deckLinkInstance)	\
-    ( (This)->lpVtbl -> Next(This,deckLinkInstance) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkIterator_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkAPIInformation_INTERFACE_DEFINED__
-#define __IDeckLinkAPIInformation_INTERFACE_DEFINED__
-
-/* interface IDeckLinkAPIInformation */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkAPIInformation;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("7BEA3C68-730D-4322-AF34-8A7152B532A4")
-    IDeckLinkAPIInformation : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetFlag( 
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ BOOL *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetInt( 
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ LONGLONG *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFloat( 
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ double *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetString( 
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ BSTR *value) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkAPIInformationVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkAPIInformation * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkAPIInformation * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkAPIInformation * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 
-            IDeckLinkAPIInformation * This,
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ BOOL *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetInt )( 
-            IDeckLinkAPIInformation * This,
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ LONGLONG *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 
-            IDeckLinkAPIInformation * This,
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ double *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetString )( 
-            IDeckLinkAPIInformation * This,
-            /* [in] */ BMDDeckLinkAPIInformationID cfgID,
-            /* [out] */ BSTR *value);
-        
-        END_INTERFACE
-    } IDeckLinkAPIInformationVtbl;
-
-    interface IDeckLinkAPIInformation
-    {
-        CONST_VTBL struct IDeckLinkAPIInformationVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkAPIInformation_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkAPIInformation_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkAPIInformation_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkAPIInformation_GetFlag(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 
-
-#define IDeckLinkAPIInformation_GetInt(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 
-
-#define IDeckLinkAPIInformation_GetFloat(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 
-
-#define IDeckLinkAPIInformation_GetString(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkAPIInformation_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__
-#define __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDisplayModeIterator */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDisplayModeIterator;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("9C88499F-F601-4021-B80B-032E4EB41C35")
-    IDeckLinkDisplayModeIterator : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Next( 
-            /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDisplayModeIteratorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDisplayModeIterator * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDisplayModeIterator * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDisplayModeIterator * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Next )( 
-            IDeckLinkDisplayModeIterator * This,
-            /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode);
-        
-        END_INTERFACE
-    } IDeckLinkDisplayModeIteratorVtbl;
-
-    interface IDeckLinkDisplayModeIterator
-    {
-        CONST_VTBL struct IDeckLinkDisplayModeIteratorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDisplayModeIterator_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDisplayModeIterator_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDisplayModeIterator_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDisplayModeIterator_Next(This,deckLinkDisplayMode)	\
-    ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayMode_INTERFACE_DEFINED__
-#define __IDeckLinkDisplayMode_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDisplayMode */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDisplayMode;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78")
-    IDeckLinkDisplayMode : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetName( 
-            /* [out] */ BSTR *name) = 0;
-        
-        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFrameRate( 
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [out] */ BMDTimeScale *timeScale) = 0;
-        
-        virtual BMDFieldDominance STDMETHODCALLTYPE GetFieldDominance( void) = 0;
-        
-        virtual BMDDisplayModeFlags STDMETHODCALLTYPE GetFlags( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDisplayModeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDisplayMode * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDisplayMode * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDisplayMode * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetName )( 
-            IDeckLinkDisplayMode * This,
-            /* [out] */ BSTR *name);
-        
-        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 
-            IDeckLinkDisplayMode * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkDisplayMode * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkDisplayMode * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( 
-            IDeckLinkDisplayMode * This,
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [out] */ BMDTimeScale *timeScale);
-        
-        BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( 
-            IDeckLinkDisplayMode * This);
-        
-        BMDDisplayModeFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkDisplayMode * This);
-        
-        END_INTERFACE
-    } IDeckLinkDisplayModeVtbl;
-
-    interface IDeckLinkDisplayMode
-    {
-        CONST_VTBL struct IDeckLinkDisplayModeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDisplayMode_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDisplayMode_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDisplayMode_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDisplayMode_GetName(This,name)	\
-    ( (This)->lpVtbl -> GetName(This,name) ) 
-
-#define IDeckLinkDisplayMode_GetDisplayMode(This)	\
-    ( (This)->lpVtbl -> GetDisplayMode(This) ) 
-
-#define IDeckLinkDisplayMode_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkDisplayMode_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkDisplayMode_GetFrameRate(This,frameDuration,timeScale)	\
-    ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) 
-
-#define IDeckLinkDisplayMode_GetFieldDominance(This)	\
-    ( (This)->lpVtbl -> GetFieldDominance(This) ) 
-
-#define IDeckLinkDisplayMode_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDisplayMode_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLink_INTERFACE_DEFINED__
-#define __IDeckLink_INTERFACE_DEFINED__
-
-/* interface IDeckLink */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLink;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("62BFF75D-6569-4E55-8D4D-66AA03829ABC")
-    IDeckLink : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetModelName( 
-            /* [out] */ BSTR *modelName) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLink * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLink * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLink * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetModelName )( 
-            IDeckLink * This,
-            /* [out] */ BSTR *modelName);
-        
-        END_INTERFACE
-    } IDeckLinkVtbl;
-
-    interface IDeckLink
-    {
-        CONST_VTBL struct IDeckLinkVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLink_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLink_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLink_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLink_GetModelName(This,modelName)	\
-    ( (This)->lpVtbl -> GetModelName(This,modelName) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLink_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_INTERFACE_DEFINED__
-#define __IDeckLinkOutput_INTERFACE_DEFINED__
-
-/* interface IDeckLinkOutput */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkOutput;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A3EF0963-0862-44ED-92A9-EE89ABF431C7")
-    IDeckLinkOutput : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDVideoOutputFlags flags,
-            /* [out] */ BMDDisplayModeSupport *result,
-            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDVideoOutputFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 
-            /* [in] */ long width,
-            /* [in] */ long height,
-            /* [in] */ long rowBytes,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDFrameFlags flags,
-            /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( 
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 
-            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 
-            /* [in] */ IDeckLinkVideoFrame *theFrame,
-            /* [in] */ BMDTimeValue displayTime,
-            /* [in] */ BMDTimeValue displayDuration,
-            /* [in] */ BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 
-            /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( 
-            /* [out] */ unsigned long *bufferedFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 
-            /* [in] */ BMDAudioSampleRate sampleRate,
-            /* [in] */ BMDAudioSampleType sampleType,
-            /* [in] */ unsigned long channelCount,
-            /* [in] */ BMDAudioOutputStreamType streamType) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 
-            /* [in] */ void *buffer,
-            /* [in] */ unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 
-            /* [in] */ void *buffer,
-            /* [in] */ unsigned long sampleFrameCount,
-            /* [in] */ BMDTimeValue streamTime,
-            /* [in] */ BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 
-            /* [out] */ unsigned long *bufferedSampleFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 
-            /* [in] */ BMDTimeValue playbackStartTime,
-            /* [in] */ BMDTimeScale timeScale,
-            /* [in] */ double playbackSpeed) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 
-            /* [in] */ BMDTimeValue stopPlaybackAtTime,
-            /* [out] */ BMDTimeValue *actualStopTime,
-            /* [in] */ BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( 
-            /* [out] */ BOOL *active) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( 
-            /* [in] */ BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *streamTime,
-            /* [out] */ double *playbackSpeed) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( 
-            /* [out] */ BMDReferenceStatus *referenceStatus) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 
-            /* [in] */ BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkOutputVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkOutput * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkOutput * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkOutput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDVideoOutputFlags flags,
-            /* [out] */ BMDDisplayModeSupport *result,
-            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkOutput * This,
-            /* [out] */ IDeckLinkDisplayModeIterator **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 
-            IDeckLinkOutput * This,
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDVideoOutputFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 
-            IDeckLinkOutput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 
-            IDeckLinkOutput * This,
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 
-            IDeckLinkOutput * This,
-            /* [in] */ long width,
-            /* [in] */ long height,
-            /* [in] */ long rowBytes,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDFrameFlags flags,
-            /* [out] */ IDeckLinkMutableVideoFrame **outFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 
-            IDeckLinkOutput * This,
-            /* [in] */ IDeckLinkVideoFrame *theFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 
-            IDeckLinkOutput * This,
-            /* [in] */ IDeckLinkVideoFrame *theFrame,
-            /* [in] */ BMDTimeValue displayTime,
-            /* [in] */ BMDTimeValue displayDuration,
-            /* [in] */ BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 
-            IDeckLinkOutput * This,
-            /* [in] */ IDeckLinkVideoOutputCallback *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( 
-            IDeckLinkOutput * This,
-            /* [out] */ unsigned long *bufferedFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDAudioSampleRate sampleRate,
-            /* [in] */ BMDAudioSampleType sampleType,
-            /* [in] */ unsigned long channelCount,
-            /* [in] */ BMDAudioOutputStreamType streamType);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 
-            IDeckLinkOutput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 
-            IDeckLinkOutput * This,
-            /* [in] */ void *buffer,
-            /* [in] */ unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 
-            IDeckLinkOutput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 
-            IDeckLinkOutput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 
-            IDeckLinkOutput * This,
-            /* [in] */ void *buffer,
-            /* [in] */ unsigned long sampleFrameCount,
-            /* [in] */ BMDTimeValue streamTime,
-            /* [in] */ BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 
-            IDeckLinkOutput * This,
-            /* [out] */ unsigned long *bufferedSampleFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 
-            IDeckLinkOutput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 
-            IDeckLinkOutput * This,
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDTimeValue playbackStartTime,
-            /* [in] */ BMDTimeScale timeScale,
-            /* [in] */ double playbackSpeed);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDTimeValue stopPlaybackAtTime,
-            /* [out] */ BMDTimeValue *actualStopTime,
-            /* [in] */ BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( 
-            IDeckLinkOutput * This,
-            /* [out] */ BOOL *active);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *streamTime,
-            /* [out] */ double *playbackSpeed);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( 
-            IDeckLinkOutput * This,
-            /* [out] */ BMDReferenceStatus *referenceStatus);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 
-            IDeckLinkOutput * This,
-            /* [in] */ BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame);
-        
-        END_INTERFACE
-    } IDeckLinkOutputVtbl;
-
-    interface IDeckLinkOutput
-    {
-        CONST_VTBL struct IDeckLinkOutputVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkOutput_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkOutput_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkOutput_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkOutput_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) 
-
-#define IDeckLinkOutput_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkOutput_SetScreenPreviewCallback(This,previewCallback)	\
-    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 
-
-#define IDeckLinkOutput_EnableVideoOutput(This,displayMode,flags)	\
-    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) 
-
-#define IDeckLinkOutput_DisableVideoOutput(This)	\
-    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 
-
-#define IDeckLinkOutput_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\
-    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 
-
-#define IDeckLinkOutput_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\
-    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 
-
-#define IDeckLinkOutput_CreateAncillaryData(This,pixelFormat,outBuffer)	\
-    ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) 
-
-#define IDeckLinkOutput_DisplayVideoFrameSync(This,theFrame)	\
-    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 
-
-#define IDeckLinkOutput_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\
-    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 
-
-#define IDeckLinkOutput_SetScheduledFrameCompletionCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_GetBufferedVideoFrameCount(This,bufferedFrameCount)	\
-    ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) 
-
-#define IDeckLinkOutput_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType)	\
-    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) 
-
-#define IDeckLinkOutput_DisableAudioOutput(This)	\
-    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 
-
-#define IDeckLinkOutput_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_BeginAudioPreroll(This)	\
-    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_EndAudioPreroll(This)	\
-    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount)	\
-    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) 
-
-#define IDeckLinkOutput_FlushBufferedAudioSamples(This)	\
-    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 
-
-#define IDeckLinkOutput_SetAudioCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\
-    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 
-
-#define IDeckLinkOutput_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\
-    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 
-
-#define IDeckLinkOutput_IsScheduledPlaybackRunning(This,active)	\
-    ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) 
-
-#define IDeckLinkOutput_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed)	\
-    ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) 
-
-#define IDeckLinkOutput_GetReferenceStatus(This,referenceStatus)	\
-    ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) 
-
-#define IDeckLinkOutput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkOutput_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_INTERFACE_DEFINED__
-#define __IDeckLinkInput_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInput */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInput;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("6D40EF78-28B9-4E21-990D-95BB7750A04F")
-    IDeckLinkInput : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDVideoInputFlags flags,
-            /* [out] */ BMDDisplayModeSupport *result,
-            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDVideoInputFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( 
-            /* [out] */ unsigned long *availableFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 
-            /* [in] */ BMDAudioSampleRate sampleRate,
-            /* [in] */ BMDAudioSampleType sampleType,
-            /* [in] */ unsigned long channelCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( 
-            /* [out] */ unsigned long *availableSampleFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCallback( 
-            /* [in] */ IDeckLinkInputCallback *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 
-            /* [in] */ BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInputVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInput * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInput * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkInput * This,
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDVideoInputFlags flags,
-            /* [out] */ BMDDisplayModeSupport *result,
-            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkInput * This,
-            /* [out] */ IDeckLinkDisplayModeIterator **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 
-            IDeckLinkInput * This,
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 
-            IDeckLinkInput * This,
-            /* [in] */ BMDDisplayMode displayMode,
-            /* [in] */ BMDPixelFormat pixelFormat,
-            /* [in] */ BMDVideoInputFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 
-            IDeckLinkInput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( 
-            IDeckLinkInput * This,
-            /* [out] */ unsigned long *availableFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 
-            IDeckLinkInput * This,
-            /* [in] */ BMDAudioSampleRate sampleRate,
-            /* [in] */ BMDAudioSampleType sampleType,
-            /* [in] */ unsigned long channelCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 
-            IDeckLinkInput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( 
-            IDeckLinkInput * This,
-            /* [out] */ unsigned long *availableSampleFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 
-            IDeckLinkInput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 
-            IDeckLinkInput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 
-            IDeckLinkInput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *FlushStreams )( 
-            IDeckLinkInput * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 
-            IDeckLinkInput * This,
-            /* [in] */ IDeckLinkInputCallback *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 
-            IDeckLinkInput * This,
-            /* [in] */ BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame);
-        
-        END_INTERFACE
-    } IDeckLinkInputVtbl;
-
-    interface IDeckLinkInput
-    {
-        CONST_VTBL struct IDeckLinkInputVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInput_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInput_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInput_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInput_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) 
-
-#define IDeckLinkInput_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkInput_SetScreenPreviewCallback(This,previewCallback)	\
-    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 
-
-#define IDeckLinkInput_EnableVideoInput(This,displayMode,pixelFormat,flags)	\
-    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 
-
-#define IDeckLinkInput_DisableVideoInput(This)	\
-    ( (This)->lpVtbl -> DisableVideoInput(This) ) 
-
-#define IDeckLinkInput_GetAvailableVideoFrameCount(This,availableFrameCount)	\
-    ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) 
-
-#define IDeckLinkInput_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\
-    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 
-
-#define IDeckLinkInput_DisableAudioInput(This)	\
-    ( (This)->lpVtbl -> DisableAudioInput(This) ) 
-
-#define IDeckLinkInput_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount)	\
-    ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) 
-
-#define IDeckLinkInput_StartStreams(This)	\
-    ( (This)->lpVtbl -> StartStreams(This) ) 
-
-#define IDeckLinkInput_StopStreams(This)	\
-    ( (This)->lpVtbl -> StopStreams(This) ) 
-
-#define IDeckLinkInput_PauseStreams(This)	\
-    ( (This)->lpVtbl -> PauseStreams(This) ) 
-
-#define IDeckLinkInput_FlushStreams(This)	\
-    ( (This)->lpVtbl -> FlushStreams(This) ) 
-
-#define IDeckLinkInput_SetCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 
-
-#define IDeckLinkInput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInput_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkTimecode_INTERFACE_DEFINED__
-#define __IDeckLinkTimecode_INTERFACE_DEFINED__
-
-/* interface IDeckLinkTimecode */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkTimecode;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("BC6CFBD3-8317-4325-AC1C-1216391E9340")
-    IDeckLinkTimecode : public IUnknown
-    {
-    public:
-        virtual BMDTimecodeBCD STDMETHODCALLTYPE GetBCD( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetComponents( 
-            /* [out] */ unsigned char *hours,
-            /* [out] */ unsigned char *minutes,
-            /* [out] */ unsigned char *seconds,
-            /* [out] */ unsigned char *frames) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetString( 
-            /* [out] */ BSTR *timecode) = 0;
-        
-        virtual BMDTimecodeFlags STDMETHODCALLTYPE GetFlags( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecodeUserBits( 
-            /* [out] */ BMDTimecodeUserBits *userBits) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkTimecodeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkTimecode * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkTimecode * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkTimecode * This);
-        
-        BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( 
-            IDeckLinkTimecode * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetComponents )( 
-            IDeckLinkTimecode * This,
-            /* [out] */ unsigned char *hours,
-            /* [out] */ unsigned char *minutes,
-            /* [out] */ unsigned char *seconds,
-            /* [out] */ unsigned char *frames);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetString )( 
-            IDeckLinkTimecode * This,
-            /* [out] */ BSTR *timecode);
-        
-        BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkTimecode * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecodeUserBits )( 
-            IDeckLinkTimecode * This,
-            /* [out] */ BMDTimecodeUserBits *userBits);
-        
-        END_INTERFACE
-    } IDeckLinkTimecodeVtbl;
-
-    interface IDeckLinkTimecode
-    {
-        CONST_VTBL struct IDeckLinkTimecodeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkTimecode_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkTimecode_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkTimecode_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkTimecode_GetBCD(This)	\
-    ( (This)->lpVtbl -> GetBCD(This) ) 
-
-#define IDeckLinkTimecode_GetComponents(This,hours,minutes,seconds,frames)	\
-    ( (This)->lpVtbl -> GetComponents(This,hours,minutes,seconds,frames) ) 
-
-#define IDeckLinkTimecode_GetString(This,timecode)	\
-    ( (This)->lpVtbl -> GetString(This,timecode) ) 
-
-#define IDeckLinkTimecode_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkTimecode_GetTimecodeUserBits(This,userBits)	\
-    ( (This)->lpVtbl -> GetTimecodeUserBits(This,userBits) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkTimecode_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame_INTERFACE_DEFINED__
-#define __IDeckLinkVideoFrame_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoFrame */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoFrame;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3F716FE0-F023-4111-BE5D-EF4414C05B17")
-    IDeckLinkVideoFrame : public IUnknown
-    {
-    public:
-        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0;
-        
-        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;
-        
-        virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBytes( 
-            /* [out] */ void **buffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 
-            /* [in] */ BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode **timecode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( 
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoFrameVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoFrame * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoFrame * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkVideoFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkVideoFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkVideoFrame * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoFrame * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkVideoFrame * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkVideoFrame * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkVideoFrame * This,
-            /* [in] */ BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode **timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 
-            IDeckLinkVideoFrame * This,
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);
-        
-        END_INTERFACE
-    } IDeckLinkVideoFrameVtbl;
-
-    interface IDeckLinkVideoFrame
-    {
-        CONST_VTBL struct IDeckLinkVideoFrameVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoFrame_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoFrame_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoFrame_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoFrame_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkVideoFrame_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkVideoFrame_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkVideoFrame_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoFrame_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkVideoFrame_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkVideoFrame_GetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkVideoFrame_GetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoFrame_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__
-#define __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__
-
-/* interface IDeckLinkMutableVideoFrame */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkMutableVideoFrame;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("69E2639F-40DA-4E19-B6F2-20ACE815C390")
-    IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE SetFlags( 
-            /* [in] */ BMDFrameFlags newFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetTimecode( 
-            /* [in] */ BMDTimecodeFormat format,
-            /* [in] */ IDeckLinkTimecode *timecode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( 
-            /* [in] */ BMDTimecodeFormat format,
-            /* [in] */ unsigned char hours,
-            /* [in] */ unsigned char minutes,
-            /* [in] */ unsigned char seconds,
-            /* [in] */ unsigned char frames,
-            /* [in] */ BMDTimecodeFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( 
-            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetTimecodeUserBits( 
-            /* [in] */ BMDTimecodeFormat format,
-            /* [in] */ BMDTimecodeUserBits userBits) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkMutableVideoFrameVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkMutableVideoFrame * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkMutableVideoFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkMutableVideoFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkMutableVideoFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkMutableVideoFrame * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkMutableVideoFrame * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkMutableVideoFrame * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [in] */ BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode **timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetFlags )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [in] */ BMDFrameFlags newFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetTimecode )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [in] */ BMDTimecodeFormat format,
-            /* [in] */ IDeckLinkTimecode *timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [in] */ BMDTimecodeFormat format,
-            /* [in] */ unsigned char hours,
-            /* [in] */ unsigned char minutes,
-            /* [in] */ unsigned char seconds,
-            /* [in] */ unsigned char frames,
-            /* [in] */ BMDTimecodeFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetTimecodeUserBits )( 
-            IDeckLinkMutableVideoFrame * This,
-            /* [in] */ BMDTimecodeFormat format,
-            /* [in] */ BMDTimecodeUserBits userBits);
-        
-        END_INTERFACE
-    } IDeckLinkMutableVideoFrameVtbl;
-
-    interface IDeckLinkMutableVideoFrame
-    {
-        CONST_VTBL struct IDeckLinkMutableVideoFrameVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkMutableVideoFrame_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkMutableVideoFrame_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkMutableVideoFrame_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkMutableVideoFrame_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkMutableVideoFrame_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkMutableVideoFrame_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkMutableVideoFrame_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkMutableVideoFrame_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkMutableVideoFrame_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkMutableVideoFrame_GetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkMutableVideoFrame_GetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 
-
-
-#define IDeckLinkMutableVideoFrame_SetFlags(This,newFlags)	\
-    ( (This)->lpVtbl -> SetFlags(This,newFlags) ) 
-
-#define IDeckLinkMutableVideoFrame_SetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkMutableVideoFrame_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags)	\
-    ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) 
-
-#define IDeckLinkMutableVideoFrame_SetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) 
-
-#define IDeckLinkMutableVideoFrame_SetTimecodeUserBits(This,format,userBits)	\
-    ( (This)->lpVtbl -> SetTimecodeUserBits(This,format,userBits) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__
-#define __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoFrame3DExtensions */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoFrame3DExtensions;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7")
-    IDeckLinkVideoFrame3DExtensions : public IUnknown
-    {
-    public:
-        virtual BMDVideo3DPackingFormat STDMETHODCALLTYPE Get3DPackingFormat( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFrameForRightEye( 
-            /* [out] */ IDeckLinkVideoFrame **rightEyeFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoFrame3DExtensionsVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoFrame3DExtensions * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoFrame3DExtensions * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoFrame3DExtensions * This);
-        
-        BMDVideo3DPackingFormat ( STDMETHODCALLTYPE *Get3DPackingFormat )( 
-            IDeckLinkVideoFrame3DExtensions * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFrameForRightEye )( 
-            IDeckLinkVideoFrame3DExtensions * This,
-            /* [out] */ IDeckLinkVideoFrame **rightEyeFrame);
-        
-        END_INTERFACE
-    } IDeckLinkVideoFrame3DExtensionsVtbl;
-
-    interface IDeckLinkVideoFrame3DExtensions
-    {
-        CONST_VTBL struct IDeckLinkVideoFrame3DExtensionsVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoFrame3DExtensions_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoFrame3DExtensions_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoFrame3DExtensions_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoFrame3DExtensions_Get3DPackingFormat(This)	\
-    ( (This)->lpVtbl -> Get3DPackingFormat(This) ) 
-
-#define IDeckLinkVideoFrame3DExtensions_GetFrameForRightEye(This,rightEyeFrame)	\
-    ( (This)->lpVtbl -> GetFrameForRightEye(This,rightEyeFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__
-#define __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoInputFrame */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoInputFrame;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("05CFE374-537C-4094-9A57-680525118F44")
-    IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetStreamTime( 
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [in] */ BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( 
-            /* [in] */ BMDTimeScale timeScale,
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoInputFrameVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoInputFrame * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoInputFrame * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoInputFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkVideoInputFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkVideoInputFrame * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkVideoInputFrame * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoInputFrame * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkVideoInputFrame * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkVideoInputFrame * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkVideoInputFrame * This,
-            /* [in] */ BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode **timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 
-            IDeckLinkVideoInputFrame * This,
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( 
-            IDeckLinkVideoInputFrame * This,
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [in] */ BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( 
-            IDeckLinkVideoInputFrame * This,
-            /* [in] */ BMDTimeScale timeScale,
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration);
-        
-        END_INTERFACE
-    } IDeckLinkVideoInputFrameVtbl;
-
-    interface IDeckLinkVideoInputFrame
-    {
-        CONST_VTBL struct IDeckLinkVideoInputFrameVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoInputFrame_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoInputFrame_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoInputFrame_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoInputFrame_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkVideoInputFrame_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkVideoInputFrame_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkVideoInputFrame_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoInputFrame_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkVideoInputFrame_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkVideoInputFrame_GetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkVideoInputFrame_GetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 
-
-
-#define IDeckLinkVideoInputFrame_GetStreamTime(This,frameTime,frameDuration,timeScale)	\
-    ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) 
-
-#define IDeckLinkVideoInputFrame_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__
-#define __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoFrameAncillary */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoFrameAncillary;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("732E723C-D1A4-4E29-9E8E-4A88797A0004")
-    IDeckLinkVideoFrameAncillary : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetBufferForVerticalBlankingLine( 
-            /* [in] */ unsigned long lineNumber,
-            /* [out] */ void **buffer) = 0;
-        
-        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;
-        
-        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoFrameAncillaryVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoFrameAncillary * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoFrameAncillary * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoFrameAncillary * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferForVerticalBlankingLine )( 
-            IDeckLinkVideoFrameAncillary * This,
-            /* [in] */ unsigned long lineNumber,
-            /* [out] */ void **buffer);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoFrameAncillary * This);
-        
-        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 
-            IDeckLinkVideoFrameAncillary * This);
-        
-        END_INTERFACE
-    } IDeckLinkVideoFrameAncillaryVtbl;
-
-    interface IDeckLinkVideoFrameAncillary
-    {
-        CONST_VTBL struct IDeckLinkVideoFrameAncillaryVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoFrameAncillary_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoFrameAncillary_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoFrameAncillary_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoFrameAncillary_GetBufferForVerticalBlankingLine(This,lineNumber,buffer)	\
-    ( (This)->lpVtbl -> GetBufferForVerticalBlankingLine(This,lineNumber,buffer) ) 
-
-#define IDeckLinkVideoFrameAncillary_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoFrameAncillary_GetDisplayMode(This)	\
-    ( (This)->lpVtbl -> GetDisplayMode(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__
-#define __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__
-
-/* interface IDeckLinkAudioInputPacket */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkAudioInputPacket;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("E43D5870-2894-11DE-8C30-0800200C9A66")
-    IDeckLinkAudioInputPacket : public IUnknown
-    {
-    public:
-        virtual long STDMETHODCALLTYPE GetSampleFrameCount( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBytes( 
-            /* [out] */ void **buffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPacketTime( 
-            /* [out] */ BMDTimeValue *packetTime,
-            /* [in] */ BMDTimeScale timeScale) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkAudioInputPacketVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkAudioInputPacket * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkAudioInputPacket * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkAudioInputPacket * This);
-        
-        long ( STDMETHODCALLTYPE *GetSampleFrameCount )( 
-            IDeckLinkAudioInputPacket * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkAudioInputPacket * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPacketTime )( 
-            IDeckLinkAudioInputPacket * This,
-            /* [out] */ BMDTimeValue *packetTime,
-            /* [in] */ BMDTimeScale timeScale);
-        
-        END_INTERFACE
-    } IDeckLinkAudioInputPacketVtbl;
-
-    interface IDeckLinkAudioInputPacket
-    {
-        CONST_VTBL struct IDeckLinkAudioInputPacketVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkAudioInputPacket_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkAudioInputPacket_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkAudioInputPacket_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkAudioInputPacket_GetSampleFrameCount(This)	\
-    ( (This)->lpVtbl -> GetSampleFrameCount(This) ) 
-
-#define IDeckLinkAudioInputPacket_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkAudioInputPacket_GetPacketTime(This,packetTime,timeScale)	\
-    ( (This)->lpVtbl -> GetPacketTime(This,packetTime,timeScale) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__
-#define __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__
-
-/* interface IDeckLinkScreenPreviewCallback */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438")
-    IDeckLinkScreenPreviewCallback : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DrawFrame( 
-            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkScreenPreviewCallbackVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkScreenPreviewCallback * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkScreenPreviewCallback * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkScreenPreviewCallback * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DrawFrame )( 
-            IDeckLinkScreenPreviewCallback * This,
-            /* [in] */ IDeckLinkVideoFrame *theFrame);
-        
-        END_INTERFACE
-    } IDeckLinkScreenPreviewCallbackVtbl;
-
-    interface IDeckLinkScreenPreviewCallback
-    {
-        CONST_VTBL struct IDeckLinkScreenPreviewCallbackVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkScreenPreviewCallback_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkScreenPreviewCallback_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkScreenPreviewCallback_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkScreenPreviewCallback_DrawFrame(This,theFrame)	\
-    ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__
-#define __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__
-
-/* interface IDeckLinkGLScreenPreviewHelper */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("504E2209-CAC7-4C1A-9FB4-C5BB6274D22F")
-    IDeckLinkGLScreenPreviewHelper : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetFrame( 
-            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( 
-            /* [in] */ BMD3DPreviewFormat previewFormat) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkGLScreenPreviewHelperVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkGLScreenPreviewHelper * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkGLScreenPreviewHelper * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkGLScreenPreviewHelper * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *InitializeGL )( 
-            IDeckLinkGLScreenPreviewHelper * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *PaintGL )( 
-            IDeckLinkGLScreenPreviewHelper * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetFrame )( 
-            IDeckLinkGLScreenPreviewHelper * This,
-            /* [in] */ IDeckLinkVideoFrame *theFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( 
-            IDeckLinkGLScreenPreviewHelper * This,
-            /* [in] */ BMD3DPreviewFormat previewFormat);
-        
-        END_INTERFACE
-    } IDeckLinkGLScreenPreviewHelperVtbl;
-
-    interface IDeckLinkGLScreenPreviewHelper
-    {
-        CONST_VTBL struct IDeckLinkGLScreenPreviewHelperVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkGLScreenPreviewHelper_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkGLScreenPreviewHelper_InitializeGL(This)	\
-    ( (This)->lpVtbl -> InitializeGL(This) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_PaintGL(This)	\
-    ( (This)->lpVtbl -> PaintGL(This) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_SetFrame(This,theFrame)	\
-    ( (This)->lpVtbl -> SetFrame(This,theFrame) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat)	\
-    ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkConfiguration_INTERFACE_DEFINED__
-#define __IDeckLinkConfiguration_INTERFACE_DEFINED__
-
-/* interface IDeckLinkConfiguration */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkConfiguration;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("C679A35B-610C-4D09-B748-1D0478100FC0")
-    IDeckLinkConfiguration : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE SetFlag( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ BOOL value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFlag( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ BOOL *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetInt( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ LONGLONG value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetInt( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ LONGLONG *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetFloat( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ double value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFloat( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ double *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetString( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ BSTR value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetString( 
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ BSTR *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkConfigurationVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkConfiguration * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkConfiguration * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetFlag )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ BOOL value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ BOOL *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetInt )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ LONGLONG value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetInt )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ LONGLONG *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetFloat )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ double value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ double *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetString )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [in] */ BSTR value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetString )( 
-            IDeckLinkConfiguration * This,
-            /* [in] */ BMDDeckLinkConfigurationID cfgID,
-            /* [out] */ BSTR *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( 
-            IDeckLinkConfiguration * This);
-        
-        END_INTERFACE
-    } IDeckLinkConfigurationVtbl;
-
-    interface IDeckLinkConfiguration
-    {
-        CONST_VTBL struct IDeckLinkConfigurationVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkConfiguration_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkConfiguration_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkConfiguration_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkConfiguration_SetFlag(This,cfgID,value)	\
-    ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_GetFlag(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_SetInt(This,cfgID,value)	\
-    ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_GetInt(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_SetFloat(This,cfgID,value)	\
-    ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_GetFloat(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_SetString(This,cfgID,value)	\
-    ( (This)->lpVtbl -> SetString(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_GetString(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 
-
-#define IDeckLinkConfiguration_WriteConfigurationToPreferences(This)	\
-    ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkConfiguration_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkAttributes_INTERFACE_DEFINED__
-#define __IDeckLinkAttributes_INTERFACE_DEFINED__
-
-/* interface IDeckLinkAttributes */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkAttributes;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("ABC11843-D966-44CB-96E2-A1CB5D3135C4")
-    IDeckLinkAttributes : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetFlag( 
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ BOOL *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetInt( 
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ LONGLONG *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFloat( 
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ double *value) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetString( 
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ BSTR *value) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkAttributesVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkAttributes * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkAttributes * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkAttributes * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 
-            IDeckLinkAttributes * This,
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ BOOL *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetInt )( 
-            IDeckLinkAttributes * This,
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ LONGLONG *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 
-            IDeckLinkAttributes * This,
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ double *value);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetString )( 
-            IDeckLinkAttributes * This,
-            /* [in] */ BMDDeckLinkAttributeID cfgID,
-            /* [out] */ BSTR *value);
-        
-        END_INTERFACE
-    } IDeckLinkAttributesVtbl;
-
-    interface IDeckLinkAttributes
-    {
-        CONST_VTBL struct IDeckLinkAttributesVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkAttributes_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkAttributes_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkAttributes_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkAttributes_GetFlag(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 
-
-#define IDeckLinkAttributes_GetInt(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 
-
-#define IDeckLinkAttributes_GetFloat(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 
-
-#define IDeckLinkAttributes_GetString(This,cfgID,value)	\
-    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkAttributes_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkKeyer_INTERFACE_DEFINED__
-#define __IDeckLinkKeyer_INTERFACE_DEFINED__
-
-/* interface IDeckLinkKeyer */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkKeyer;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3")
-    IDeckLinkKeyer : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Enable( 
-            /* [in] */ BOOL isExternal) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetLevel( 
-            /* [in] */ unsigned char level) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RampUp( 
-            /* [in] */ unsigned long numberOfFrames) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RampDown( 
-            /* [in] */ unsigned long numberOfFrames) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Disable( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkKeyerVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkKeyer * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkKeyer * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkKeyer * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Enable )( 
-            IDeckLinkKeyer * This,
-            /* [in] */ BOOL isExternal);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
-            IDeckLinkKeyer * This,
-            /* [in] */ unsigned char level);
-        
-        HRESULT ( STDMETHODCALLTYPE *RampUp )( 
-            IDeckLinkKeyer * This,
-            /* [in] */ unsigned long numberOfFrames);
-        
-        HRESULT ( STDMETHODCALLTYPE *RampDown )( 
-            IDeckLinkKeyer * This,
-            /* [in] */ unsigned long numberOfFrames);
-        
-        HRESULT ( STDMETHODCALLTYPE *Disable )( 
-            IDeckLinkKeyer * This);
-        
-        END_INTERFACE
-    } IDeckLinkKeyerVtbl;
-
-    interface IDeckLinkKeyer
-    {
-        CONST_VTBL struct IDeckLinkKeyerVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkKeyer_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkKeyer_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkKeyer_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkKeyer_Enable(This,isExternal)	\
-    ( (This)->lpVtbl -> Enable(This,isExternal) ) 
-
-#define IDeckLinkKeyer_SetLevel(This,level)	\
-    ( (This)->lpVtbl -> SetLevel(This,level) ) 
-
-#define IDeckLinkKeyer_RampUp(This,numberOfFrames)	\
-    ( (This)->lpVtbl -> RampUp(This,numberOfFrames) ) 
-
-#define IDeckLinkKeyer_RampDown(This,numberOfFrames)	\
-    ( (This)->lpVtbl -> RampDown(This,numberOfFrames) ) 
-
-#define IDeckLinkKeyer_Disable(This)	\
-    ( (This)->lpVtbl -> Disable(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkKeyer_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoConversion_INTERFACE_DEFINED__
-#define __IDeckLinkVideoConversion_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoConversion */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoConversion;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3BBCB8A2-DA2C-42D9-B5D8-88083644E99A")
-    IDeckLinkVideoConversion : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE ConvertFrame( 
-            /* [in] */ IDeckLinkVideoFrame *srcFrame,
-            /* [in] */ IDeckLinkVideoFrame *dstFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoConversionVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoConversion * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoConversion * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoConversion * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( 
-            IDeckLinkVideoConversion * This,
-            /* [in] */ IDeckLinkVideoFrame *srcFrame,
-            /* [in] */ IDeckLinkVideoFrame *dstFrame);
-        
-        END_INTERFACE
-    } IDeckLinkVideoConversionVtbl;
-
-    interface IDeckLinkVideoConversion
-    {
-        CONST_VTBL struct IDeckLinkVideoConversionVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoConversion_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoConversion_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoConversion_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoConversion_ConvertFrame(This,srcFrame,dstFrame)	\
-    ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoConversion_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__
-#define __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDeckControlStatusCallback */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDeckControlStatusCallback;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("E5F693C1-4283-4716-B18F-C1431521955B")
-    IDeckLinkDeckControlStatusCallback : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE TimecodeUpdate( 
-            /* [in] */ BMDTimecodeBCD currentTimecode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE VTRControlStateChanged( 
-            /* [in] */ BMDDeckControlVTRControlState newState,
-            /* [in] */ BMDDeckControlError error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DeckControlEventReceived( 
-            /* [in] */ BMDDeckControlEvent event,
-            /* [in] */ BMDDeckControlError error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DeckControlStatusChanged( 
-            /* [in] */ BMDDeckControlStatusFlags flags,
-            /* [in] */ unsigned long mask) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDeckControlStatusCallbackVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDeckControlStatusCallback * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDeckControlStatusCallback * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDeckControlStatusCallback * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *TimecodeUpdate )( 
-            IDeckLinkDeckControlStatusCallback * This,
-            /* [in] */ BMDTimecodeBCD currentTimecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *VTRControlStateChanged )( 
-            IDeckLinkDeckControlStatusCallback * This,
-            /* [in] */ BMDDeckControlVTRControlState newState,
-            /* [in] */ BMDDeckControlError error);
-        
-        HRESULT ( STDMETHODCALLTYPE *DeckControlEventReceived )( 
-            IDeckLinkDeckControlStatusCallback * This,
-            /* [in] */ BMDDeckControlEvent event,
-            /* [in] */ BMDDeckControlError error);
-        
-        HRESULT ( STDMETHODCALLTYPE *DeckControlStatusChanged )( 
-            IDeckLinkDeckControlStatusCallback * This,
-            /* [in] */ BMDDeckControlStatusFlags flags,
-            /* [in] */ unsigned long mask);
-        
-        END_INTERFACE
-    } IDeckLinkDeckControlStatusCallbackVtbl;
-
-    interface IDeckLinkDeckControlStatusCallback
-    {
-        CONST_VTBL struct IDeckLinkDeckControlStatusCallbackVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDeckControlStatusCallback_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDeckControlStatusCallback_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDeckControlStatusCallback_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDeckControlStatusCallback_TimecodeUpdate(This,currentTimecode)	\
-    ( (This)->lpVtbl -> TimecodeUpdate(This,currentTimecode) ) 
-
-#define IDeckLinkDeckControlStatusCallback_VTRControlStateChanged(This,newState,error)	\
-    ( (This)->lpVtbl -> VTRControlStateChanged(This,newState,error) ) 
-
-#define IDeckLinkDeckControlStatusCallback_DeckControlEventReceived(This,event,error)	\
-    ( (This)->lpVtbl -> DeckControlEventReceived(This,event,error) ) 
-
-#define IDeckLinkDeckControlStatusCallback_DeckControlStatusChanged(This,flags,mask)	\
-    ( (This)->lpVtbl -> DeckControlStatusChanged(This,flags,mask) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDeckControl_INTERFACE_DEFINED__
-#define __IDeckLinkDeckControl_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDeckControl */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDeckControl;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("522A9E39-0F3C-4742-94EE-D80DE335DA1D")
-    IDeckLinkDeckControl : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Open( 
-            /* [in] */ BMDTimeScale timeScale,
-            /* [in] */ BMDTimeValue timeValue,
-            /* [in] */ BOOL timecodeIsDropFrame,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Close( 
-            /* [in] */ BOOL standbyOn) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetCurrentState( 
-            /* [out] */ BMDDeckControlMode *mode,
-            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,
-            /* [out] */ BMDDeckControlStatusFlags *flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetStandby( 
-            /* [in] */ BOOL standbyOn) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SendCommand( 
-            /* [in] */ unsigned char *inBuffer,
-            /* [in] */ unsigned long inBufferSize,
-            /* [out] */ unsigned char *outBuffer,
-            /* [out] */ unsigned long *outDataSize,
-            /* [in] */ unsigned long outBufferSize,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Play( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Stop( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Eject( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GoToTimecode( 
-            /* [in] */ BMDTimecodeBCD timecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FastForward( 
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Rewind( 
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StepForward( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StepBack( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Jog( 
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Shuttle( 
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( 
-            /* [out] */ BSTR *currentTimeCode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 
-            /* [out] */ IDeckLinkTimecode **currentTimecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( 
-            /* [out] */ BMDTimecodeBCD *currentTimecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetPreroll( 
-            /* [in] */ unsigned long prerollSeconds) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPreroll( 
-            /* [out] */ unsigned long *prerollSeconds) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetExportOffset( 
-            /* [in] */ long exportOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetExportOffset( 
-            /* [out] */ long *exportOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( 
-            /* [out] */ long *deckManualExportOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( 
-            /* [in] */ long captureOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( 
-            /* [out] */ long *captureOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartExport( 
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartCapture( 
-            /* [in] */ BOOL useVITC,
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDeviceID( 
-            /* [out] */ unsigned short *deviceId,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCallback( 
-            /* [in] */ IDeckLinkDeckControlStatusCallback *callback) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDeckControlVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDeckControl * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDeckControl * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Open )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BMDTimeScale timeScale,
-            /* [in] */ BMDTimeValue timeValue,
-            /* [in] */ BOOL timecodeIsDropFrame,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Close )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BOOL standbyOn);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlMode *mode,
-            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,
-            /* [out] */ BMDDeckControlStatusFlags *flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetStandby )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BOOL standbyOn);
-        
-        HRESULT ( STDMETHODCALLTYPE *SendCommand )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ unsigned char *inBuffer,
-            /* [in] */ unsigned long inBufferSize,
-            /* [out] */ unsigned char *outBuffer,
-            /* [out] */ unsigned long *outDataSize,
-            /* [in] */ unsigned long outBufferSize,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Play )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Stop )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Eject )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BMDTimecodeBCD timecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *FastForward )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Rewind )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *StepForward )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *StepBack )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Jog )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Shuttle )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BSTR *currentTimeCode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ IDeckLinkTimecode **currentTimecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDTimecodeBCD *currentTimecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetPreroll )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ unsigned long prerollSeconds);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPreroll )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ unsigned long *prerollSeconds);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ long exportOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ long *exportOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ long *deckManualExportOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ long captureOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ long *captureOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartExport )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartCapture )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ BOOL useVITC,
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ unsigned short *deviceId,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Abort )( 
-            IDeckLinkDeckControl * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( 
-            IDeckLinkDeckControl * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 
-            IDeckLinkDeckControl * This,
-            /* [in] */ IDeckLinkDeckControlStatusCallback *callback);
-        
-        END_INTERFACE
-    } IDeckLinkDeckControlVtbl;
-
-    interface IDeckLinkDeckControl
-    {
-        CONST_VTBL struct IDeckLinkDeckControlVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDeckControl_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDeckControl_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDeckControl_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDeckControl_Open(This,timeScale,timeValue,timecodeIsDropFrame,error)	\
-    ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) 
-
-#define IDeckLinkDeckControl_Close(This,standbyOn)	\
-    ( (This)->lpVtbl -> Close(This,standbyOn) ) 
-
-#define IDeckLinkDeckControl_GetCurrentState(This,mode,vtrControlState,flags)	\
-    ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) 
-
-#define IDeckLinkDeckControl_SetStandby(This,standbyOn)	\
-    ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) 
-
-#define IDeckLinkDeckControl_SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error)	\
-    ( (This)->lpVtbl -> SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) ) 
-
-#define IDeckLinkDeckControl_Play(This,error)	\
-    ( (This)->lpVtbl -> Play(This,error) ) 
-
-#define IDeckLinkDeckControl_Stop(This,error)	\
-    ( (This)->lpVtbl -> Stop(This,error) ) 
-
-#define IDeckLinkDeckControl_TogglePlayStop(This,error)	\
-    ( (This)->lpVtbl -> TogglePlayStop(This,error) ) 
-
-#define IDeckLinkDeckControl_Eject(This,error)	\
-    ( (This)->lpVtbl -> Eject(This,error) ) 
-
-#define IDeckLinkDeckControl_GoToTimecode(This,timecode,error)	\
-    ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) 
-
-#define IDeckLinkDeckControl_FastForward(This,viewTape,error)	\
-    ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) 
-
-#define IDeckLinkDeckControl_Rewind(This,viewTape,error)	\
-    ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) 
-
-#define IDeckLinkDeckControl_StepForward(This,error)	\
-    ( (This)->lpVtbl -> StepForward(This,error) ) 
-
-#define IDeckLinkDeckControl_StepBack(This,error)	\
-    ( (This)->lpVtbl -> StepBack(This,error) ) 
-
-#define IDeckLinkDeckControl_Jog(This,rate,error)	\
-    ( (This)->lpVtbl -> Jog(This,rate,error) ) 
-
-#define IDeckLinkDeckControl_Shuttle(This,rate,error)	\
-    ( (This)->lpVtbl -> Shuttle(This,rate,error) ) 
-
-#define IDeckLinkDeckControl_GetTimecodeString(This,currentTimeCode,error)	\
-    ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) 
-
-#define IDeckLinkDeckControl_GetTimecode(This,currentTimecode,error)	\
-    ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) 
-
-#define IDeckLinkDeckControl_GetTimecodeBCD(This,currentTimecode,error)	\
-    ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) 
-
-#define IDeckLinkDeckControl_SetPreroll(This,prerollSeconds)	\
-    ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) 
-
-#define IDeckLinkDeckControl_GetPreroll(This,prerollSeconds)	\
-    ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) 
-
-#define IDeckLinkDeckControl_SetExportOffset(This,exportOffsetFields)	\
-    ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) 
-
-#define IDeckLinkDeckControl_GetExportOffset(This,exportOffsetFields)	\
-    ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) 
-
-#define IDeckLinkDeckControl_GetManualExportOffset(This,deckManualExportOffsetFields)	\
-    ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) 
-
-#define IDeckLinkDeckControl_SetCaptureOffset(This,captureOffsetFields)	\
-    ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) 
-
-#define IDeckLinkDeckControl_GetCaptureOffset(This,captureOffsetFields)	\
-    ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) 
-
-#define IDeckLinkDeckControl_StartExport(This,inTimecode,outTimecode,exportModeOps,error)	\
-    ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) 
-
-#define IDeckLinkDeckControl_StartCapture(This,useVITC,inTimecode,outTimecode,error)	\
-    ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) 
-
-#define IDeckLinkDeckControl_GetDeviceID(This,deviceId,error)	\
-    ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) 
-
-#define IDeckLinkDeckControl_Abort(This)	\
-    ( (This)->lpVtbl -> Abort(This) ) 
-
-#define IDeckLinkDeckControl_CrashRecordStart(This,error)	\
-    ( (This)->lpVtbl -> CrashRecordStart(This,error) ) 
-
-#define IDeckLinkDeckControl_CrashRecordStop(This,error)	\
-    ( (This)->lpVtbl -> CrashRecordStop(This,error) ) 
-
-#define IDeckLinkDeckControl_SetCallback(This,callback)	\
-    ( (This)->lpVtbl -> SetCallback(This,callback) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDeckControl_INTERFACE_DEFINED__ */
-
-
-EXTERN_C const CLSID CLSID_CDeckLinkIterator;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("D9EDA3B3-2887-41FA-B724-017CF1EB1D37")
-CDeckLinkIterator;
-#endif
-
-EXTERN_C const CLSID CLSID_CDeckLinkAPIInformation;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("263CA19F-ED09-482E-9F9D-84005783A237")
-CDeckLinkAPIInformation;
-#endif
-
-EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("F63E77C7-B655-4A4A-9AD0-3CA85D394343")
-CDeckLinkGLScreenPreviewHelper;
-#endif
-
-EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("7DBBBB11-5B7B-467D-AEA4-CEA468FD368C")
-CDeckLinkVideoConversion;
-#endif
-
-#ifndef __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__
-#define __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDeckControl_v7_9 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDeckControl_v7_9;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A4D81043-0619-42B7-8ED6-602D29041DF7")
-    IDeckLinkDeckControl_v7_9 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Open( 
-            /* [in] */ BMDTimeScale timeScale,
-            /* [in] */ BMDTimeValue timeValue,
-            /* [in] */ BOOL timecodeIsDropFrame,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Close( 
-            /* [in] */ BOOL standbyOn) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetCurrentState( 
-            /* [out] */ BMDDeckControlMode *mode,
-            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,
-            /* [out] */ BMDDeckControlStatusFlags *flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetStandby( 
-            /* [in] */ BOOL standbyOn) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Play( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Stop( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Eject( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GoToTimecode( 
-            /* [in] */ BMDTimecodeBCD timecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FastForward( 
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Rewind( 
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StepForward( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StepBack( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Jog( 
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Shuttle( 
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( 
-            /* [out] */ BSTR *currentTimeCode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 
-            /* [out] */ IDeckLinkTimecode **currentTimecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( 
-            /* [out] */ BMDTimecodeBCD *currentTimecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetPreroll( 
-            /* [in] */ unsigned long prerollSeconds) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPreroll( 
-            /* [out] */ unsigned long *prerollSeconds) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetExportOffset( 
-            /* [in] */ long exportOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetExportOffset( 
-            /* [out] */ long *exportOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( 
-            /* [out] */ long *deckManualExportOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( 
-            /* [in] */ long captureOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( 
-            /* [out] */ long *captureOffsetFields) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartExport( 
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartCapture( 
-            /* [in] */ BOOL useVITC,
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDeviceID( 
-            /* [out] */ unsigned short *deviceId,
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( 
-            /* [out] */ BMDDeckControlError *error) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCallback( 
-            /* [in] */ IDeckLinkDeckControlStatusCallback *callback) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDeckControl_v7_9Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDeckControl_v7_9 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDeckControl_v7_9 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Open )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BMDTimeScale timeScale,
-            /* [in] */ BMDTimeValue timeValue,
-            /* [in] */ BOOL timecodeIsDropFrame,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Close )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BOOL standbyOn);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlMode *mode,
-            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,
-            /* [out] */ BMDDeckControlStatusFlags *flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetStandby )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BOOL standbyOn);
-        
-        HRESULT ( STDMETHODCALLTYPE *Play )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Stop )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Eject )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BMDTimecodeBCD timecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *FastForward )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Rewind )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BOOL viewTape,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *StepForward )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *StepBack )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Jog )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Shuttle )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ double rate,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BSTR *currentTimeCode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ IDeckLinkTimecode **currentTimecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDTimecodeBCD *currentTimecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetPreroll )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ unsigned long prerollSeconds);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPreroll )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ unsigned long *prerollSeconds);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ long exportOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ long *exportOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ long *deckManualExportOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ long captureOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ long *captureOffsetFields);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartExport )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartCapture )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ BOOL useVITC,
-            /* [in] */ BMDTimecodeBCD inTimecode,
-            /* [in] */ BMDTimecodeBCD outTimecode,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ unsigned short *deviceId,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *Abort )( 
-            IDeckLinkDeckControl_v7_9 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [out] */ BMDDeckControlError *error);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 
-            IDeckLinkDeckControl_v7_9 * This,
-            /* [in] */ IDeckLinkDeckControlStatusCallback *callback);
-        
-        END_INTERFACE
-    } IDeckLinkDeckControl_v7_9Vtbl;
-
-    interface IDeckLinkDeckControl_v7_9
-    {
-        CONST_VTBL struct IDeckLinkDeckControl_v7_9Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDeckControl_v7_9_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDeckControl_v7_9_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDeckControl_v7_9_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDeckControl_v7_9_Open(This,timeScale,timeValue,timecodeIsDropFrame,error)	\
-    ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_Close(This,standbyOn)	\
-    ( (This)->lpVtbl -> Close(This,standbyOn) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetCurrentState(This,mode,vtrControlState,flags)	\
-    ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) 
-
-#define IDeckLinkDeckControl_v7_9_SetStandby(This,standbyOn)	\
-    ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) 
-
-#define IDeckLinkDeckControl_v7_9_Play(This,error)	\
-    ( (This)->lpVtbl -> Play(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_Stop(This,error)	\
-    ( (This)->lpVtbl -> Stop(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_TogglePlayStop(This,error)	\
-    ( (This)->lpVtbl -> TogglePlayStop(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_Eject(This,error)	\
-    ( (This)->lpVtbl -> Eject(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_GoToTimecode(This,timecode,error)	\
-    ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_FastForward(This,viewTape,error)	\
-    ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_Rewind(This,viewTape,error)	\
-    ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_StepForward(This,error)	\
-    ( (This)->lpVtbl -> StepForward(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_StepBack(This,error)	\
-    ( (This)->lpVtbl -> StepBack(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_Jog(This,rate,error)	\
-    ( (This)->lpVtbl -> Jog(This,rate,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_Shuttle(This,rate,error)	\
-    ( (This)->lpVtbl -> Shuttle(This,rate,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetTimecodeString(This,currentTimeCode,error)	\
-    ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetTimecode(This,currentTimecode,error)	\
-    ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetTimecodeBCD(This,currentTimecode,error)	\
-    ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_SetPreroll(This,prerollSeconds)	\
-    ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetPreroll(This,prerollSeconds)	\
-    ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) 
-
-#define IDeckLinkDeckControl_v7_9_SetExportOffset(This,exportOffsetFields)	\
-    ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetExportOffset(This,exportOffsetFields)	\
-    ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetManualExportOffset(This,deckManualExportOffsetFields)	\
-    ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) 
-
-#define IDeckLinkDeckControl_v7_9_SetCaptureOffset(This,captureOffsetFields)	\
-    ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetCaptureOffset(This,captureOffsetFields)	\
-    ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) 
-
-#define IDeckLinkDeckControl_v7_9_StartExport(This,inTimecode,outTimecode,exportModeOps,error)	\
-    ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_StartCapture(This,useVITC,inTimecode,outTimecode,error)	\
-    ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_GetDeviceID(This,deviceId,error)	\
-    ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_Abort(This)	\
-    ( (This)->lpVtbl -> Abort(This) ) 
-
-#define IDeckLinkDeckControl_v7_9_CrashRecordStart(This,error)	\
-    ( (This)->lpVtbl -> CrashRecordStart(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_CrashRecordStop(This,error)	\
-    ( (This)->lpVtbl -> CrashRecordStop(This,error) ) 
-
-#define IDeckLinkDeckControl_v7_9_SetCallback(This,callback)	\
-    ( (This)->lpVtbl -> SetCallback(This,callback) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDisplayModeIterator_v7_6 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDisplayModeIterator_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("455D741F-1779-4800-86F5-0B5D13D79751")
-    IDeckLinkDisplayModeIterator_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Next( 
-            /* [out] */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDisplayModeIterator_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDisplayModeIterator_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDisplayModeIterator_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDisplayModeIterator_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Next )( 
-            IDeckLinkDisplayModeIterator_v7_6 * This,
-            /* [out] */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode);
-        
-        END_INTERFACE
-    } IDeckLinkDisplayModeIterator_v7_6Vtbl;
-
-    interface IDeckLinkDisplayModeIterator_v7_6
-    {
-        CONST_VTBL struct IDeckLinkDisplayModeIterator_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDisplayModeIterator_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDisplayModeIterator_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDisplayModeIterator_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDisplayModeIterator_v7_6_Next(This,deckLinkDisplayMode)	\
-    ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDisplayMode_v7_6 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDisplayMode_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("87451E84-2B7E-439E-A629-4393EA4A8550")
-    IDeckLinkDisplayMode_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetName( 
-            /* [out] */ BSTR *name) = 0;
-        
-        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFrameRate( 
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [out] */ BMDTimeScale *timeScale) = 0;
-        
-        virtual BMDFieldDominance STDMETHODCALLTYPE GetFieldDominance( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDisplayMode_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDisplayMode_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDisplayMode_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDisplayMode_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetName )( 
-            IDeckLinkDisplayMode_v7_6 * This,
-            /* [out] */ BSTR *name);
-        
-        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 
-            IDeckLinkDisplayMode_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkDisplayMode_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkDisplayMode_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( 
-            IDeckLinkDisplayMode_v7_6 * This,
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [out] */ BMDTimeScale *timeScale);
-        
-        BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( 
-            IDeckLinkDisplayMode_v7_6 * This);
-        
-        END_INTERFACE
-    } IDeckLinkDisplayMode_v7_6Vtbl;
-
-    interface IDeckLinkDisplayMode_v7_6
-    {
-        CONST_VTBL struct IDeckLinkDisplayMode_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDisplayMode_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDisplayMode_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDisplayMode_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDisplayMode_v7_6_GetName(This,name)	\
-    ( (This)->lpVtbl -> GetName(This,name) ) 
-
-#define IDeckLinkDisplayMode_v7_6_GetDisplayMode(This)	\
-    ( (This)->lpVtbl -> GetDisplayMode(This) ) 
-
-#define IDeckLinkDisplayMode_v7_6_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkDisplayMode_v7_6_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkDisplayMode_v7_6_GetFrameRate(This,frameDuration,timeScale)	\
-    ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) 
-
-#define IDeckLinkDisplayMode_v7_6_GetFieldDominance(This)	\
-    ( (This)->lpVtbl -> GetFieldDominance(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkOutput_v7_6 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkOutput_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("29228142-EB8C-4141-A621-F74026450955")
-    IDeckLinkOutput_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 
-            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 
-            BMDDisplayMode displayMode,
-            BMDVideoOutputFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( 
-            BMDPixelFormat pixelFormat,
-            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,
-            BMDTimeValue displayTime,
-            BMDTimeValue displayDuration,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 
-            /* [in] */ IDeckLinkVideoOutputCallback_v7_6 *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( 
-            /* [out] */ unsigned long *bufferedFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount,
-            BMDAudioOutputStreamType streamType) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            BMDTimeValue streamTime,
-            BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 
-            /* [out] */ unsigned long *bufferedSampleFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 
-            BMDTimeValue playbackStartTime,
-            BMDTimeScale timeScale,
-            double playbackSpeed) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 
-            BMDTimeValue stopPlaybackAtTime,
-            /* [out] */ BMDTimeValue *actualStopTime,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( 
-            /* [out] */ BOOL *active) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( 
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *streamTime,
-            /* [out] */ double *playbackSpeed) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkOutput_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkOutput_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkOutput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDDisplayMode displayMode,
-            BMDVideoOutputFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 
-            IDeckLinkOutput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 
-            IDeckLinkOutput_v7_6 * This,
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,
-            BMDTimeValue displayTime,
-            BMDTimeValue displayDuration,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ IDeckLinkVideoOutputCallback_v7_6 *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [out] */ unsigned long *bufferedFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount,
-            BMDAudioOutputStreamType streamType);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 
-            IDeckLinkOutput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 
-            IDeckLinkOutput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 
-            IDeckLinkOutput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            BMDTimeValue streamTime,
-            BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [out] */ unsigned long *bufferedSampleFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 
-            IDeckLinkOutput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDTimeValue playbackStartTime,
-            BMDTimeScale timeScale,
-            double playbackSpeed);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDTimeValue stopPlaybackAtTime,
-            /* [out] */ BMDTimeValue *actualStopTime,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( 
-            IDeckLinkOutput_v7_6 * This,
-            /* [out] */ BOOL *active);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *streamTime,
-            /* [out] */ double *playbackSpeed);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 
-            IDeckLinkOutput_v7_6 * This,
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame);
-        
-        END_INTERFACE
-    } IDeckLinkOutput_v7_6Vtbl;
-
-    interface IDeckLinkOutput_v7_6
-    {
-        CONST_VTBL struct IDeckLinkOutput_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkOutput_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkOutput_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkOutput_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkOutput_v7_6_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 
-
-#define IDeckLinkOutput_v7_6_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkOutput_v7_6_SetScreenPreviewCallback(This,previewCallback)	\
-    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 
-
-#define IDeckLinkOutput_v7_6_EnableVideoOutput(This,displayMode,flags)	\
-    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) 
-
-#define IDeckLinkOutput_v7_6_DisableVideoOutput(This)	\
-    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 
-
-#define IDeckLinkOutput_v7_6_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\
-    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 
-
-#define IDeckLinkOutput_v7_6_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\
-    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 
-
-#define IDeckLinkOutput_v7_6_CreateAncillaryData(This,pixelFormat,outBuffer)	\
-    ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) 
-
-#define IDeckLinkOutput_v7_6_DisplayVideoFrameSync(This,theFrame)	\
-    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 
-
-#define IDeckLinkOutput_v7_6_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\
-    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 
-
-#define IDeckLinkOutput_v7_6_SetScheduledFrameCompletionCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_v7_6_GetBufferedVideoFrameCount(This,bufferedFrameCount)	\
-    ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) 
-
-#define IDeckLinkOutput_v7_6_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType)	\
-    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) 
-
-#define IDeckLinkOutput_v7_6_DisableAudioOutput(This)	\
-    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 
-
-#define IDeckLinkOutput_v7_6_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_v7_6_BeginAudioPreroll(This)	\
-    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_v7_6_EndAudioPreroll(This)	\
-    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_v7_6_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_v7_6_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount)	\
-    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) 
-
-#define IDeckLinkOutput_v7_6_FlushBufferedAudioSamples(This)	\
-    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 
-
-#define IDeckLinkOutput_v7_6_SetAudioCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_v7_6_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\
-    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 
-
-#define IDeckLinkOutput_v7_6_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\
-    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 
-
-#define IDeckLinkOutput_v7_6_IsScheduledPlaybackRunning(This,active)	\
-    ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) 
-
-#define IDeckLinkOutput_v7_6_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed)	\
-    ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) 
-
-#define IDeckLinkOutput_v7_6_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkInput_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInput_v7_6 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInput_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("300C135A-9F43-48E2-9906-6D7911D93CF1")
-    IDeckLinkInput_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 
-            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            BMDVideoInputFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( 
-            /* [out] */ unsigned long *availableFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( 
-            /* [out] */ unsigned long *availableSampleFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCallback( 
-            /* [in] */ IDeckLinkInputCallback_v7_6 *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInput_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInput_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkInput_v7_6 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkInput_v7_6 * This,
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 
-            IDeckLinkInput_v7_6 * This,
-            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 
-            IDeckLinkInput_v7_6 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            BMDVideoInputFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( 
-            IDeckLinkInput_v7_6 * This,
-            /* [out] */ unsigned long *availableFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 
-            IDeckLinkInput_v7_6 * This,
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( 
-            IDeckLinkInput_v7_6 * This,
-            /* [out] */ unsigned long *availableSampleFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *FlushStreams )( 
-            IDeckLinkInput_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 
-            IDeckLinkInput_v7_6 * This,
-            /* [in] */ IDeckLinkInputCallback_v7_6 *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 
-            IDeckLinkInput_v7_6 * This,
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *hardwareTime,
-            /* [out] */ BMDTimeValue *timeInFrame,
-            /* [out] */ BMDTimeValue *ticksPerFrame);
-        
-        END_INTERFACE
-    } IDeckLinkInput_v7_6Vtbl;
-
-    interface IDeckLinkInput_v7_6
-    {
-        CONST_VTBL struct IDeckLinkInput_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInput_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInput_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInput_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInput_v7_6_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 
-
-#define IDeckLinkInput_v7_6_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkInput_v7_6_SetScreenPreviewCallback(This,previewCallback)	\
-    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 
-
-#define IDeckLinkInput_v7_6_EnableVideoInput(This,displayMode,pixelFormat,flags)	\
-    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 
-
-#define IDeckLinkInput_v7_6_DisableVideoInput(This)	\
-    ( (This)->lpVtbl -> DisableVideoInput(This) ) 
-
-#define IDeckLinkInput_v7_6_GetAvailableVideoFrameCount(This,availableFrameCount)	\
-    ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) 
-
-#define IDeckLinkInput_v7_6_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\
-    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 
-
-#define IDeckLinkInput_v7_6_DisableAudioInput(This)	\
-    ( (This)->lpVtbl -> DisableAudioInput(This) ) 
-
-#define IDeckLinkInput_v7_6_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount)	\
-    ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) 
-
-#define IDeckLinkInput_v7_6_StartStreams(This)	\
-    ( (This)->lpVtbl -> StartStreams(This) ) 
-
-#define IDeckLinkInput_v7_6_StopStreams(This)	\
-    ( (This)->lpVtbl -> StopStreams(This) ) 
-
-#define IDeckLinkInput_v7_6_PauseStreams(This)	\
-    ( (This)->lpVtbl -> PauseStreams(This) ) 
-
-#define IDeckLinkInput_v7_6_FlushStreams(This)	\
-    ( (This)->lpVtbl -> FlushStreams(This) ) 
-
-#define IDeckLinkInput_v7_6_SetCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 
-
-#define IDeckLinkInput_v7_6_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInput_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkTimecode_v7_6 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkTimecode_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("EFB9BCA6-A521-44F7-BD69-2332F24D9EE6")
-    IDeckLinkTimecode_v7_6 : public IUnknown
-    {
-    public:
-        virtual BMDTimecodeBCD STDMETHODCALLTYPE GetBCD( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetComponents( 
-            /* [out] */ unsigned char *hours,
-            /* [out] */ unsigned char *minutes,
-            /* [out] */ unsigned char *seconds,
-            /* [out] */ unsigned char *frames) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetString( 
-            /* [out] */ BSTR *timecode) = 0;
-        
-        virtual BMDTimecodeFlags STDMETHODCALLTYPE GetFlags( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkTimecode_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkTimecode_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkTimecode_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkTimecode_v7_6 * This);
-        
-        BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( 
-            IDeckLinkTimecode_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetComponents )( 
-            IDeckLinkTimecode_v7_6 * This,
-            /* [out] */ unsigned char *hours,
-            /* [out] */ unsigned char *minutes,
-            /* [out] */ unsigned char *seconds,
-            /* [out] */ unsigned char *frames);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetString )( 
-            IDeckLinkTimecode_v7_6 * This,
-            /* [out] */ BSTR *timecode);
-        
-        BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkTimecode_v7_6 * This);
-        
-        END_INTERFACE
-    } IDeckLinkTimecode_v7_6Vtbl;
-
-    interface IDeckLinkTimecode_v7_6
-    {
-        CONST_VTBL struct IDeckLinkTimecode_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkTimecode_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkTimecode_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkTimecode_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkTimecode_v7_6_GetBCD(This)	\
-    ( (This)->lpVtbl -> GetBCD(This) ) 
-
-#define IDeckLinkTimecode_v7_6_GetComponents(This,hours,minutes,seconds,frames)	\
-    ( (This)->lpVtbl -> GetComponents(This,hours,minutes,seconds,frames) ) 
-
-#define IDeckLinkTimecode_v7_6_GetString(This,timecode)	\
-    ( (This)->lpVtbl -> GetString(This,timecode) ) 
-
-#define IDeckLinkTimecode_v7_6_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoFrame_v7_6 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoFrame_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A8D8238E-6B18-4196-99E1-5AF717B83D32")
-    IDeckLinkVideoFrame_v7_6 : public IUnknown
-    {
-    public:
-        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0;
-        
-        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;
-        
-        virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBytes( 
-            /* [out] */ void **buffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 
-            BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode_v7_6 **timecode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( 
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoFrame_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoFrame_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoFrame_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkVideoFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkVideoFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkVideoFrame_v7_6 * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoFrame_v7_6 * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkVideoFrame_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkVideoFrame_v7_6 * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkVideoFrame_v7_6 * This,
-            BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 
-            IDeckLinkVideoFrame_v7_6 * This,
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);
-        
-        END_INTERFACE
-    } IDeckLinkVideoFrame_v7_6Vtbl;
-
-    interface IDeckLinkVideoFrame_v7_6
-    {
-        CONST_VTBL struct IDeckLinkVideoFrame_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoFrame_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoFrame_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoFrame_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoFrame_v7_6_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkVideoFrame_v7_6_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkVideoFrame_v7_6_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkVideoFrame_v7_6_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoFrame_v7_6_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkVideoFrame_v7_6_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkVideoFrame_v7_6_GetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkVideoFrame_v7_6_GetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkMutableVideoFrame_v7_6 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkMutableVideoFrame_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("46FCEE00-B4E6-43D0-91C0-023A7FCEB34F")
-    IDeckLinkMutableVideoFrame_v7_6 : public IDeckLinkVideoFrame_v7_6
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE SetFlags( 
-            BMDFrameFlags newFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetTimecode( 
-            BMDTimecodeFormat format,
-            /* [in] */ IDeckLinkTimecode_v7_6 *timecode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( 
-            BMDTimecodeFormat format,
-            unsigned char hours,
-            unsigned char minutes,
-            unsigned char seconds,
-            unsigned char frames,
-            BMDTimecodeFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( 
-            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkMutableVideoFrame_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetFlags )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            BMDFrameFlags newFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetTimecode )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            BMDTimecodeFormat format,
-            /* [in] */ IDeckLinkTimecode_v7_6 *timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            BMDTimecodeFormat format,
-            unsigned char hours,
-            unsigned char minutes,
-            unsigned char seconds,
-            unsigned char frames,
-            BMDTimecodeFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( 
-            IDeckLinkMutableVideoFrame_v7_6 * This,
-            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary);
-        
-        END_INTERFACE
-    } IDeckLinkMutableVideoFrame_v7_6Vtbl;
-
-    interface IDeckLinkMutableVideoFrame_v7_6
-    {
-        CONST_VTBL struct IDeckLinkMutableVideoFrame_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkMutableVideoFrame_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_GetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 
-
-
-#define IDeckLinkMutableVideoFrame_v7_6_SetFlags(This,newFlags)	\
-    ( (This)->lpVtbl -> SetFlags(This,newFlags) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_SetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags)	\
-    ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) 
-
-#define IDeckLinkMutableVideoFrame_v7_6_SetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoInputFrame_v7_6 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("9A74FA41-AE9F-47AC-8CF4-01F42DD59965")
-    IDeckLinkVideoInputFrame_v7_6 : public IDeckLinkVideoFrame_v7_6
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetStreamTime( 
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( 
-            BMDTimeScale timeScale,
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoInputFrame_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoInputFrame_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoInputFrame_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoInputFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkVideoInputFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkVideoInputFrame_v7_6 * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkVideoInputFrame_v7_6 * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoInputFrame_v7_6 * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkVideoInputFrame_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkVideoInputFrame_v7_6 * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkVideoInputFrame_v7_6 * This,
-            BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 
-            IDeckLinkVideoInputFrame_v7_6 * This,
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( 
-            IDeckLinkVideoInputFrame_v7_6 * This,
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( 
-            IDeckLinkVideoInputFrame_v7_6 * This,
-            BMDTimeScale timeScale,
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration);
-        
-        END_INTERFACE
-    } IDeckLinkVideoInputFrame_v7_6Vtbl;
-
-    interface IDeckLinkVideoInputFrame_v7_6
-    {
-        CONST_VTBL struct IDeckLinkVideoInputFrame_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoInputFrame_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoInputFrame_v7_6_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 
-
-
-#define IDeckLinkVideoInputFrame_v7_6_GetStreamTime(This,frameTime,frameDuration,timeScale)	\
-    ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) 
-
-#define IDeckLinkVideoInputFrame_v7_6_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkScreenPreviewCallback_v7_6 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("373F499D-4B4D-4518-AD22-6354E5A5825E")
-    IDeckLinkScreenPreviewCallback_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DrawFrame( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkScreenPreviewCallback_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkScreenPreviewCallback_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkScreenPreviewCallback_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkScreenPreviewCallback_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DrawFrame )( 
-            IDeckLinkScreenPreviewCallback_v7_6 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);
-        
-        END_INTERFACE
-    } IDeckLinkScreenPreviewCallback_v7_6Vtbl;
-
-    interface IDeckLinkScreenPreviewCallback_v7_6
-    {
-        CONST_VTBL struct IDeckLinkScreenPreviewCallback_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkScreenPreviewCallback_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkScreenPreviewCallback_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkScreenPreviewCallback_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkScreenPreviewCallback_v7_6_DrawFrame(This,theFrame)	\
-    ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkGLScreenPreviewHelper_v7_6 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("BA575CD9-A15E-497B-B2C2-F9AFE7BE4EBA")
-    IDeckLinkGLScreenPreviewHelper_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetFrame( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkGLScreenPreviewHelper_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkGLScreenPreviewHelper_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkGLScreenPreviewHelper_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkGLScreenPreviewHelper_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *InitializeGL )( 
-            IDeckLinkGLScreenPreviewHelper_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *PaintGL )( 
-            IDeckLinkGLScreenPreviewHelper_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetFrame )( 
-            IDeckLinkGLScreenPreviewHelper_v7_6 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);
-        
-        END_INTERFACE
-    } IDeckLinkGLScreenPreviewHelper_v7_6Vtbl;
-
-    interface IDeckLinkGLScreenPreviewHelper_v7_6
-    {
-        CONST_VTBL struct IDeckLinkGLScreenPreviewHelper_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkGLScreenPreviewHelper_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkGLScreenPreviewHelper_v7_6_InitializeGL(This)	\
-    ( (This)->lpVtbl -> InitializeGL(This) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_v7_6_PaintGL(This)	\
-    ( (This)->lpVtbl -> PaintGL(This) ) 
-
-#define IDeckLinkGLScreenPreviewHelper_v7_6_SetFrame(This,theFrame)	\
-    ( (This)->lpVtbl -> SetFrame(This,theFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoConversion_v7_6 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoConversion_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3EB504C9-F97D-40FE-A158-D407D48CB53B")
-    IDeckLinkVideoConversion_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE ConvertFrame( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *srcFrame,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *dstFrame) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoConversion_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoConversion_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoConversion_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoConversion_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( 
-            IDeckLinkVideoConversion_v7_6 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *srcFrame,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *dstFrame);
-        
-        END_INTERFACE
-    } IDeckLinkVideoConversion_v7_6Vtbl;
-
-    interface IDeckLinkVideoConversion_v7_6
-    {
-        CONST_VTBL struct IDeckLinkVideoConversion_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoConversion_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoConversion_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoConversion_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoConversion_v7_6_ConvertFrame(This,srcFrame,dstFrame)	\
-    ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkConfiguration_v7_6 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkConfiguration_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("B8EAD569-B764-47F0-A73F-AE40DF6CBF10")
-    IDeckLinkConfiguration_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetConfigurationValidator( 
-            /* [out] */ IDeckLinkConfiguration_v7_6 **configObject) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFormat( 
-            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsVideoOutputActive( 
-            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection,
-            /* [out] */ BOOL *active) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoOutputFlags( 
-            /* [in] */ BMDAnalogVideoFlags analogVideoFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoOutputFlags( 
-            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableFieldFlickerRemovalWhenPaused( 
-            /* [in] */ BOOL enable) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsEnabledFieldFlickerRemovalWhenPaused( 
-            /* [out] */ BOOL *enabled) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Set444And3GBpsVideoOutput( 
-            /* [in] */ BOOL enable444VideoOutput,
-            /* [in] */ BOOL enable3GbsOutput) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Get444And3GBpsVideoOutput( 
-            /* [out] */ BOOL *is444VideoOutputEnabled,
-            /* [out] */ BOOL *threeGbsOutputEnabled) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputConversionMode( 
-            /* [in] */ BMDVideoOutputConversionMode conversionMode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetVideoOutputConversionMode( 
-            /* [out] */ BMDVideoOutputConversionMode *conversionMode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Set_HD1080p24_to_HD1080i5994_Conversion( 
-            /* [in] */ BOOL enable) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Get_HD1080p24_to_HD1080i5994_Conversion( 
-            /* [out] */ BOOL *enabled) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoInputFormat( 
-            /* [in] */ BMDVideoConnection_v7_6 videoInputFormat) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetVideoInputFormat( 
-            /* [out] */ BMDVideoConnection_v7_6 *videoInputFormat) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoInputFlags( 
-            /* [in] */ BMDAnalogVideoFlags analogVideoFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoInputFlags( 
-            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoInputConversionMode( 
-            /* [in] */ BMDVideoInputConversionMode conversionMode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetVideoInputConversionMode( 
-            /* [out] */ BMDVideoInputConversionMode *conversionMode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetBlackVideoOutputDuringCapture( 
-            /* [in] */ BOOL blackOutInCapture) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBlackVideoOutputDuringCapture( 
-            /* [out] */ BOOL *blackOutInCapture) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Set32PulldownSequenceInitialTimecodeFrame( 
-            /* [in] */ unsigned long aFrameTimecode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Get32PulldownSequenceInitialTimecodeFrame( 
-            /* [out] */ unsigned long *aFrameTimecode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVancSourceLineMapping( 
-            /* [in] */ unsigned long activeLine1VANCsource,
-            /* [in] */ unsigned long activeLine2VANCsource,
-            /* [in] */ unsigned long activeLine3VANCsource) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetVancSourceLineMapping( 
-            /* [out] */ unsigned long *activeLine1VANCsource,
-            /* [out] */ unsigned long *activeLine2VANCsource,
-            /* [out] */ unsigned long *activeLine3VANCsource) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAudioInputFormat( 
-            /* [in] */ BMDAudioConnection audioInputFormat) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAudioInputFormat( 
-            /* [out] */ BMDAudioConnection *audioInputFormat) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkConfiguration_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkConfiguration_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkConfiguration_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetConfigurationValidator )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ IDeckLinkConfiguration_v7_6 **configObject);
-        
-        HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( 
-            IDeckLinkConfiguration_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFormat )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsVideoOutputActive )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection,
-            /* [out] */ BOOL *active);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoOutputFlags )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDAnalogVideoFlags analogVideoFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoOutputFlags )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableFieldFlickerRemovalWhenPaused )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BOOL enable);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsEnabledFieldFlickerRemovalWhenPaused )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BOOL *enabled);
-        
-        HRESULT ( STDMETHODCALLTYPE *Set444And3GBpsVideoOutput )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BOOL enable444VideoOutput,
-            /* [in] */ BOOL enable3GbsOutput);
-        
-        HRESULT ( STDMETHODCALLTYPE *Get444And3GBpsVideoOutput )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BOOL *is444VideoOutputEnabled,
-            /* [out] */ BOOL *threeGbsOutputEnabled);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputConversionMode )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDVideoOutputConversionMode conversionMode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetVideoOutputConversionMode )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BMDVideoOutputConversionMode *conversionMode);
-        
-        HRESULT ( STDMETHODCALLTYPE *Set_HD1080p24_to_HD1080i5994_Conversion )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BOOL enable);
-        
-        HRESULT ( STDMETHODCALLTYPE *Get_HD1080p24_to_HD1080i5994_Conversion )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BOOL *enabled);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoInputFormat )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDVideoConnection_v7_6 videoInputFormat);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetVideoInputFormat )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BMDVideoConnection_v7_6 *videoInputFormat);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoInputFlags )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDAnalogVideoFlags analogVideoFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoInputFlags )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoInputConversionMode )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDVideoInputConversionMode conversionMode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetVideoInputConversionMode )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BMDVideoInputConversionMode *conversionMode);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetBlackVideoOutputDuringCapture )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BOOL blackOutInCapture);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBlackVideoOutputDuringCapture )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BOOL *blackOutInCapture);
-        
-        HRESULT ( STDMETHODCALLTYPE *Set32PulldownSequenceInitialTimecodeFrame )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ unsigned long aFrameTimecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *Get32PulldownSequenceInitialTimecodeFrame )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ unsigned long *aFrameTimecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVancSourceLineMapping )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ unsigned long activeLine1VANCsource,
-            /* [in] */ unsigned long activeLine2VANCsource,
-            /* [in] */ unsigned long activeLine3VANCsource);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetVancSourceLineMapping )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ unsigned long *activeLine1VANCsource,
-            /* [out] */ unsigned long *activeLine2VANCsource,
-            /* [out] */ unsigned long *activeLine3VANCsource);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAudioInputFormat )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [in] */ BMDAudioConnection audioInputFormat);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAudioInputFormat )( 
-            IDeckLinkConfiguration_v7_6 * This,
-            /* [out] */ BMDAudioConnection *audioInputFormat);
-        
-        END_INTERFACE
-    } IDeckLinkConfiguration_v7_6Vtbl;
-
-    interface IDeckLinkConfiguration_v7_6
-    {
-        CONST_VTBL struct IDeckLinkConfiguration_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkConfiguration_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkConfiguration_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkConfiguration_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkConfiguration_v7_6_GetConfigurationValidator(This,configObject)	\
-    ( (This)->lpVtbl -> GetConfigurationValidator(This,configObject) ) 
-
-#define IDeckLinkConfiguration_v7_6_WriteConfigurationToPreferences(This)	\
-    ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetVideoOutputFormat(This,videoOutputConnection)	\
-    ( (This)->lpVtbl -> SetVideoOutputFormat(This,videoOutputConnection) ) 
-
-#define IDeckLinkConfiguration_v7_6_IsVideoOutputActive(This,videoOutputConnection,active)	\
-    ( (This)->lpVtbl -> IsVideoOutputActive(This,videoOutputConnection,active) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetAnalogVideoOutputFlags(This,analogVideoFlags)	\
-    ( (This)->lpVtbl -> SetAnalogVideoOutputFlags(This,analogVideoFlags) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetAnalogVideoOutputFlags(This,analogVideoFlags)	\
-    ( (This)->lpVtbl -> GetAnalogVideoOutputFlags(This,analogVideoFlags) ) 
-
-#define IDeckLinkConfiguration_v7_6_EnableFieldFlickerRemovalWhenPaused(This,enable)	\
-    ( (This)->lpVtbl -> EnableFieldFlickerRemovalWhenPaused(This,enable) ) 
-
-#define IDeckLinkConfiguration_v7_6_IsEnabledFieldFlickerRemovalWhenPaused(This,enabled)	\
-    ( (This)->lpVtbl -> IsEnabledFieldFlickerRemovalWhenPaused(This,enabled) ) 
-
-#define IDeckLinkConfiguration_v7_6_Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput)	\
-    ( (This)->lpVtbl -> Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput) ) 
-
-#define IDeckLinkConfiguration_v7_6_Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled)	\
-    ( (This)->lpVtbl -> Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetVideoOutputConversionMode(This,conversionMode)	\
-    ( (This)->lpVtbl -> SetVideoOutputConversionMode(This,conversionMode) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetVideoOutputConversionMode(This,conversionMode)	\
-    ( (This)->lpVtbl -> GetVideoOutputConversionMode(This,conversionMode) ) 
-
-#define IDeckLinkConfiguration_v7_6_Set_HD1080p24_to_HD1080i5994_Conversion(This,enable)	\
-    ( (This)->lpVtbl -> Set_HD1080p24_to_HD1080i5994_Conversion(This,enable) ) 
-
-#define IDeckLinkConfiguration_v7_6_Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled)	\
-    ( (This)->lpVtbl -> Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetVideoInputFormat(This,videoInputFormat)	\
-    ( (This)->lpVtbl -> SetVideoInputFormat(This,videoInputFormat) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetVideoInputFormat(This,videoInputFormat)	\
-    ( (This)->lpVtbl -> GetVideoInputFormat(This,videoInputFormat) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetAnalogVideoInputFlags(This,analogVideoFlags)	\
-    ( (This)->lpVtbl -> SetAnalogVideoInputFlags(This,analogVideoFlags) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetAnalogVideoInputFlags(This,analogVideoFlags)	\
-    ( (This)->lpVtbl -> GetAnalogVideoInputFlags(This,analogVideoFlags) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetVideoInputConversionMode(This,conversionMode)	\
-    ( (This)->lpVtbl -> SetVideoInputConversionMode(This,conversionMode) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetVideoInputConversionMode(This,conversionMode)	\
-    ( (This)->lpVtbl -> GetVideoInputConversionMode(This,conversionMode) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetBlackVideoOutputDuringCapture(This,blackOutInCapture)	\
-    ( (This)->lpVtbl -> SetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetBlackVideoOutputDuringCapture(This,blackOutInCapture)	\
-    ( (This)->lpVtbl -> GetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) 
-
-#define IDeckLinkConfiguration_v7_6_Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode)	\
-    ( (This)->lpVtbl -> Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) 
-
-#define IDeckLinkConfiguration_v7_6_Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode)	\
-    ( (This)->lpVtbl -> Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource)	\
-    ( (This)->lpVtbl -> SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource)	\
-    ( (This)->lpVtbl -> GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) 
-
-#define IDeckLinkConfiguration_v7_6_SetAudioInputFormat(This,audioInputFormat)	\
-    ( (This)->lpVtbl -> SetAudioInputFormat(This,audioInputFormat) ) 
-
-#define IDeckLinkConfiguration_v7_6_GetAudioInputFormat(This,audioInputFormat)	\
-    ( (This)->lpVtbl -> GetAudioInputFormat(This,audioInputFormat) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoOutputCallback_v7_6 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("E763A626-4A3C-49D1-BF13-E7AD3692AE52")
-    IDeckLinkVideoOutputCallback_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *completedFrame,
-            /* [in] */ BMDOutputFrameCompletionResult result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoOutputCallback_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoOutputCallback_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoOutputCallback_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoOutputCallback_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( 
-            IDeckLinkVideoOutputCallback_v7_6 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *completedFrame,
-            /* [in] */ BMDOutputFrameCompletionResult result);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( 
-            IDeckLinkVideoOutputCallback_v7_6 * This);
-        
-        END_INTERFACE
-    } IDeckLinkVideoOutputCallback_v7_6Vtbl;
-
-    interface IDeckLinkVideoOutputCallback_v7_6
-    {
-        CONST_VTBL struct IDeckLinkVideoOutputCallback_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoOutputCallback_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoOutputCallback_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoOutputCallback_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoOutputCallback_v7_6_ScheduledFrameCompleted(This,completedFrame,result)	\
-    ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) 
-
-#define IDeckLinkVideoOutputCallback_v7_6_ScheduledPlaybackHasStopped(This)	\
-    ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__
-#define __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInputCallback_v7_6 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInputCallback_v7_6;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("31D28EE7-88B6-4CB1-897A-CDBF79A26414")
-    IDeckLinkInputCallback_v7_6 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( 
-            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,
-            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,
-            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 
-            /* [in] */ IDeckLinkVideoInputFrame_v7_6 *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInputCallback_v7_6Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInputCallback_v7_6 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInputCallback_v7_6 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInputCallback_v7_6 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( 
-            IDeckLinkInputCallback_v7_6 * This,
-            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,
-            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,
-            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 
-            IDeckLinkInputCallback_v7_6 * This,
-            /* [in] */ IDeckLinkVideoInputFrame_v7_6 *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket *audioPacket);
-        
-        END_INTERFACE
-    } IDeckLinkInputCallback_v7_6Vtbl;
-
-    interface IDeckLinkInputCallback_v7_6
-    {
-        CONST_VTBL struct IDeckLinkInputCallback_v7_6Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInputCallback_v7_6_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInputCallback_v7_6_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInputCallback_v7_6_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInputCallback_v7_6_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags)	\
-    ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) 
-
-#define IDeckLinkInputCallback_v7_6_VideoInputFrameArrived(This,videoFrame,audioPacket)	\
-    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__ */
-
-
-EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper_v7_6;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("D398CEE7-4434-4CA3-9BA6-5AE34556B905")
-CDeckLinkGLScreenPreviewHelper_v7_6;
-#endif
-
-EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion_v7_6;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("FFA84F77-73BE-4FB7-B03E-B5E44B9F759B")
-CDeckLinkVideoConversion_v7_6;
-#endif
-
-#ifndef __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__
-#define __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInputCallback_v7_3 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInputCallback_v7_3;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("FD6F311D-4D00-444B-9ED4-1F25B5730AD0")
-    IDeckLinkInputCallback_v7_3 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( 
-            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,
-            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,
-            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 
-            /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInputCallback_v7_3Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInputCallback_v7_3 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInputCallback_v7_3 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInputCallback_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( 
-            IDeckLinkInputCallback_v7_3 * This,
-            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,
-            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,
-            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 
-            IDeckLinkInputCallback_v7_3 * This,
-            /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket *audioPacket);
-        
-        END_INTERFACE
-    } IDeckLinkInputCallback_v7_3Vtbl;
-
-    interface IDeckLinkInputCallback_v7_3
-    {
-        CONST_VTBL struct IDeckLinkInputCallback_v7_3Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInputCallback_v7_3_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInputCallback_v7_3_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInputCallback_v7_3_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInputCallback_v7_3_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags)	\
-    ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) 
-
-#define IDeckLinkInputCallback_v7_3_VideoInputFrameArrived(This,videoFrame,audioPacket)	\
-    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__
-#define __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__
-
-/* interface IDeckLinkOutput_v7_3 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkOutput_v7_3;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("271C65E3-C323-4344-A30F-D908BCB20AA3")
-    IDeckLinkOutput_v7_3 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 
-            BMDDisplayMode displayMode,
-            BMDVideoOutputFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( 
-            BMDPixelFormat pixelFormat,
-            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,
-            BMDTimeValue displayTime,
-            BMDTimeValue displayDuration,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 
-            /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( 
-            /* [out] */ unsigned long *bufferedFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount,
-            BMDAudioOutputStreamType streamType) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            BMDTimeValue streamTime,
-            BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 
-            /* [out] */ unsigned long *bufferedSampleFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 
-            BMDTimeValue playbackStartTime,
-            BMDTimeScale timeScale,
-            double playbackSpeed) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 
-            BMDTimeValue stopPlaybackAtTime,
-            /* [out] */ BMDTimeValue *actualStopTime,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( 
-            /* [out] */ BOOL *active) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkOutput_v7_3Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkOutput_v7_3 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkOutput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkOutput_v7_3 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 
-            IDeckLinkOutput_v7_3 * This,
-            BMDDisplayMode displayMode,
-            BMDVideoOutputFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 
-            IDeckLinkOutput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 
-            IDeckLinkOutput_v7_3 * This,
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( 
-            IDeckLinkOutput_v7_3 * This,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,
-            BMDTimeValue displayTime,
-            BMDTimeValue displayDuration,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ IDeckLinkVideoOutputCallback *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [out] */ unsigned long *bufferedFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 
-            IDeckLinkOutput_v7_3 * This,
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount,
-            BMDAudioOutputStreamType streamType);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 
-            IDeckLinkOutput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 
-            IDeckLinkOutput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 
-            IDeckLinkOutput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ void *buffer,
-            unsigned long sampleFrameCount,
-            BMDTimeValue streamTime,
-            BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [out] */ unsigned long *bufferedSampleFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 
-            IDeckLinkOutput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 
-            IDeckLinkOutput_v7_3 * This,
-            BMDTimeValue playbackStartTime,
-            BMDTimeScale timeScale,
-            double playbackSpeed);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 
-            IDeckLinkOutput_v7_3 * This,
-            BMDTimeValue stopPlaybackAtTime,
-            /* [out] */ BMDTimeValue *actualStopTime,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( 
-            IDeckLinkOutput_v7_3 * This,
-            /* [out] */ BOOL *active);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 
-            IDeckLinkOutput_v7_3 * This,
-            BMDTimeScale desiredTimeScale,
-            /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan);
-        
-        END_INTERFACE
-    } IDeckLinkOutput_v7_3Vtbl;
-
-    interface IDeckLinkOutput_v7_3
-    {
-        CONST_VTBL struct IDeckLinkOutput_v7_3Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkOutput_v7_3_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkOutput_v7_3_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkOutput_v7_3_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkOutput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 
-
-#define IDeckLinkOutput_v7_3_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkOutput_v7_3_SetScreenPreviewCallback(This,previewCallback)	\
-    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 
-
-#define IDeckLinkOutput_v7_3_EnableVideoOutput(This,displayMode,flags)	\
-    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) 
-
-#define IDeckLinkOutput_v7_3_DisableVideoOutput(This)	\
-    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 
-
-#define IDeckLinkOutput_v7_3_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\
-    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 
-
-#define IDeckLinkOutput_v7_3_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\
-    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 
-
-#define IDeckLinkOutput_v7_3_CreateAncillaryData(This,pixelFormat,outBuffer)	\
-    ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) 
-
-#define IDeckLinkOutput_v7_3_DisplayVideoFrameSync(This,theFrame)	\
-    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 
-
-#define IDeckLinkOutput_v7_3_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\
-    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 
-
-#define IDeckLinkOutput_v7_3_SetScheduledFrameCompletionCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_v7_3_GetBufferedVideoFrameCount(This,bufferedFrameCount)	\
-    ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) 
-
-#define IDeckLinkOutput_v7_3_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType)	\
-    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) 
-
-#define IDeckLinkOutput_v7_3_DisableAudioOutput(This)	\
-    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 
-
-#define IDeckLinkOutput_v7_3_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_v7_3_BeginAudioPreroll(This)	\
-    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_v7_3_EndAudioPreroll(This)	\
-    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_v7_3_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_v7_3_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount)	\
-    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) 
-
-#define IDeckLinkOutput_v7_3_FlushBufferedAudioSamples(This)	\
-    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 
-
-#define IDeckLinkOutput_v7_3_SetAudioCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_v7_3_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\
-    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 
-
-#define IDeckLinkOutput_v7_3_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\
-    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 
-
-#define IDeckLinkOutput_v7_3_IsScheduledPlaybackRunning(This,active)	\
-    ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) 
-
-#define IDeckLinkOutput_v7_3_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_v7_3_INTERFACE_DEFINED__
-#define __IDeckLinkInput_v7_3_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInput_v7_3 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInput_v7_3;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("4973F012-9925-458C-871C-18774CDBBECB")
-    IDeckLinkInput_v7_3 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            BMDVideoInputFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( 
-            /* [out] */ unsigned long *availableFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( 
-            /* [out] */ unsigned long *availableSampleFrameCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCallback( 
-            /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInput_v7_3Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInput_v7_3 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkInput_v7_3 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkInput_v7_3 * This,
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 
-            IDeckLinkInput_v7_3 * This,
-            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 
-            IDeckLinkInput_v7_3 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            BMDVideoInputFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( 
-            IDeckLinkInput_v7_3 * This,
-            /* [out] */ unsigned long *availableFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 
-            IDeckLinkInput_v7_3 * This,
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( 
-            IDeckLinkInput_v7_3 * This,
-            /* [out] */ unsigned long *availableSampleFrameCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *FlushStreams )( 
-            IDeckLinkInput_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 
-            IDeckLinkInput_v7_3 * This,
-            /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback);
-        
-        END_INTERFACE
-    } IDeckLinkInput_v7_3Vtbl;
-
-    interface IDeckLinkInput_v7_3
-    {
-        CONST_VTBL struct IDeckLinkInput_v7_3Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInput_v7_3_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInput_v7_3_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInput_v7_3_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 
-
-#define IDeckLinkInput_v7_3_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkInput_v7_3_SetScreenPreviewCallback(This,previewCallback)	\
-    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 
-
-#define IDeckLinkInput_v7_3_EnableVideoInput(This,displayMode,pixelFormat,flags)	\
-    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 
-
-#define IDeckLinkInput_v7_3_DisableVideoInput(This)	\
-    ( (This)->lpVtbl -> DisableVideoInput(This) ) 
-
-#define IDeckLinkInput_v7_3_GetAvailableVideoFrameCount(This,availableFrameCount)	\
-    ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) 
-
-#define IDeckLinkInput_v7_3_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\
-    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 
-
-#define IDeckLinkInput_v7_3_DisableAudioInput(This)	\
-    ( (This)->lpVtbl -> DisableAudioInput(This) ) 
-
-#define IDeckLinkInput_v7_3_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount)	\
-    ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) 
-
-#define IDeckLinkInput_v7_3_StartStreams(This)	\
-    ( (This)->lpVtbl -> StartStreams(This) ) 
-
-#define IDeckLinkInput_v7_3_StopStreams(This)	\
-    ( (This)->lpVtbl -> StopStreams(This) ) 
-
-#define IDeckLinkInput_v7_3_PauseStreams(This)	\
-    ( (This)->lpVtbl -> PauseStreams(This) ) 
-
-#define IDeckLinkInput_v7_3_FlushStreams(This)	\
-    ( (This)->lpVtbl -> FlushStreams(This) ) 
-
-#define IDeckLinkInput_v7_3_SetCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__
-#define __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoInputFrame_v7_3 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_3;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("CF317790-2894-11DE-8C30-0800200C9A66")
-    IDeckLinkVideoInputFrame_v7_3 : public IDeckLinkVideoFrame_v7_6
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetStreamTime( 
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration,
-            BMDTimeScale timeScale) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoInputFrame_v7_3Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoInputFrame_v7_3 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoInputFrame_v7_3 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoInputFrame_v7_3 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkVideoInputFrame_v7_3 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkVideoInputFrame_v7_3 * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkVideoInputFrame_v7_3 * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoInputFrame_v7_3 * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkVideoInputFrame_v7_3 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkVideoInputFrame_v7_3 * This,
-            /* [out] */ void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 
-            IDeckLinkVideoInputFrame_v7_3 * This,
-            BMDTimecodeFormat format,
-            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 
-            IDeckLinkVideoInputFrame_v7_3 * This,
-            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( 
-            IDeckLinkVideoInputFrame_v7_3 * This,
-            /* [out] */ BMDTimeValue *frameTime,
-            /* [out] */ BMDTimeValue *frameDuration,
-            BMDTimeScale timeScale);
-        
-        END_INTERFACE
-    } IDeckLinkVideoInputFrame_v7_3Vtbl;
-
-    interface IDeckLinkVideoInputFrame_v7_3
-    {
-        CONST_VTBL struct IDeckLinkVideoInputFrame_v7_3Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoInputFrame_v7_3_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoInputFrame_v7_3_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_GetTimecode(This,format,timecode)	\
-    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 
-
-#define IDeckLinkVideoInputFrame_v7_3_GetAncillaryData(This,ancillary)	\
-    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 
-
-
-#define IDeckLinkVideoInputFrame_v7_3_GetStreamTime(This,frameTime,frameDuration,timeScale)	\
-    ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDisplayModeIterator_v7_1 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDisplayModeIterator_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("B28131B6-59AC-4857-B5AC-CD75D5883E2F")
-    IDeckLinkDisplayModeIterator_v7_1 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Next( 
-            /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDisplayModeIterator_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDisplayModeIterator_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDisplayModeIterator_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDisplayModeIterator_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Next )( 
-            IDeckLinkDisplayModeIterator_v7_1 * This,
-            /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode);
-        
-        END_INTERFACE
-    } IDeckLinkDisplayModeIterator_v7_1Vtbl;
-
-    interface IDeckLinkDisplayModeIterator_v7_1
-    {
-        CONST_VTBL struct IDeckLinkDisplayModeIterator_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDisplayModeIterator_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDisplayModeIterator_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDisplayModeIterator_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDisplayModeIterator_v7_1_Next(This,deckLinkDisplayMode)	\
-    ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkDisplayMode_v7_1 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkDisplayMode_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("AF0CD6D5-8376-435E-8433-54F9DD530AC3")
-    IDeckLinkDisplayMode_v7_1 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetName( 
-            /* [out] */ BSTR *name) = 0;
-        
-        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetFrameRate( 
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [out] */ BMDTimeScale *timeScale) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkDisplayMode_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkDisplayMode_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkDisplayMode_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkDisplayMode_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetName )( 
-            IDeckLinkDisplayMode_v7_1 * This,
-            /* [out] */ BSTR *name);
-        
-        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 
-            IDeckLinkDisplayMode_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkDisplayMode_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkDisplayMode_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( 
-            IDeckLinkDisplayMode_v7_1 * This,
-            /* [out] */ BMDTimeValue *frameDuration,
-            /* [out] */ BMDTimeScale *timeScale);
-        
-        END_INTERFACE
-    } IDeckLinkDisplayMode_v7_1Vtbl;
-
-    interface IDeckLinkDisplayMode_v7_1
-    {
-        CONST_VTBL struct IDeckLinkDisplayMode_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkDisplayMode_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkDisplayMode_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkDisplayMode_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkDisplayMode_v7_1_GetName(This,name)	\
-    ( (This)->lpVtbl -> GetName(This,name) ) 
-
-#define IDeckLinkDisplayMode_v7_1_GetDisplayMode(This)	\
-    ( (This)->lpVtbl -> GetDisplayMode(This) ) 
-
-#define IDeckLinkDisplayMode_v7_1_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkDisplayMode_v7_1_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkDisplayMode_v7_1_GetFrameRate(This,frameDuration,timeScale)	\
-    ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoFrame_v7_1 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoFrame_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("333F3A10-8C2D-43CF-B79D-46560FEEA1CE")
-    IDeckLinkVideoFrame_v7_1 : public IUnknown
-    {
-    public:
-        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;
-        
-        virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0;
-        
-        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;
-        
-        virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBytes( 
-            void **buffer) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoFrame_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoFrame_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoFrame_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoFrame_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkVideoFrame_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkVideoFrame_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkVideoFrame_v7_1 * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoFrame_v7_1 * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkVideoFrame_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkVideoFrame_v7_1 * This,
-            void **buffer);
-        
-        END_INTERFACE
-    } IDeckLinkVideoFrame_v7_1Vtbl;
-
-    interface IDeckLinkVideoFrame_v7_1
-    {
-        CONST_VTBL struct IDeckLinkVideoFrame_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoFrame_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoFrame_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoFrame_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoFrame_v7_1_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkVideoFrame_v7_1_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkVideoFrame_v7_1_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkVideoFrame_v7_1_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoFrame_v7_1_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkVideoFrame_v7_1_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoInputFrame_v7_1 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("C8B41D95-8848-40EE-9B37-6E3417FB114B")
-    IDeckLinkVideoInputFrame_v7_1 : public IDeckLinkVideoFrame_v7_1
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetFrameTime( 
-            BMDTimeValue *frameTime,
-            BMDTimeValue *frameDuration,
-            BMDTimeScale timeScale) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoInputFrame_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoInputFrame_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoInputFrame_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoInputFrame_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetWidth )( 
-            IDeckLinkVideoInputFrame_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetHeight )( 
-            IDeckLinkVideoInputFrame_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetRowBytes )( 
-            IDeckLinkVideoInputFrame_v7_1 * This);
-        
-        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 
-            IDeckLinkVideoInputFrame_v7_1 * This);
-        
-        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 
-            IDeckLinkVideoInputFrame_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkVideoInputFrame_v7_1 * This,
-            void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFrameTime )( 
-            IDeckLinkVideoInputFrame_v7_1 * This,
-            BMDTimeValue *frameTime,
-            BMDTimeValue *frameDuration,
-            BMDTimeScale timeScale);
-        
-        END_INTERFACE
-    } IDeckLinkVideoInputFrame_v7_1Vtbl;
-
-    interface IDeckLinkVideoInputFrame_v7_1
-    {
-        CONST_VTBL struct IDeckLinkVideoInputFrame_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoInputFrame_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoInputFrame_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoInputFrame_v7_1_GetWidth(This)	\
-    ( (This)->lpVtbl -> GetWidth(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_1_GetHeight(This)	\
-    ( (This)->lpVtbl -> GetHeight(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_1_GetRowBytes(This)	\
-    ( (This)->lpVtbl -> GetRowBytes(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_1_GetPixelFormat(This)	\
-    ( (This)->lpVtbl -> GetPixelFormat(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_1_GetFlags(This)	\
-    ( (This)->lpVtbl -> GetFlags(This) ) 
-
-#define IDeckLinkVideoInputFrame_v7_1_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-
-#define IDeckLinkVideoInputFrame_v7_1_GetFrameTime(This,frameTime,frameDuration,timeScale)	\
-    ( (This)->lpVtbl -> GetFrameTime(This,frameTime,frameDuration,timeScale) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkAudioInputPacket_v7_1 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkAudioInputPacket_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("C86DE4F6-A29F-42E3-AB3A-1363E29F0788")
-    IDeckLinkAudioInputPacket_v7_1 : public IUnknown
-    {
-    public:
-        virtual long STDMETHODCALLTYPE GetSampleCount( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBytes( 
-            void **buffer) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAudioPacketTime( 
-            BMDTimeValue *packetTime,
-            BMDTimeScale timeScale) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkAudioInputPacket_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkAudioInputPacket_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkAudioInputPacket_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkAudioInputPacket_v7_1 * This);
-        
-        long ( STDMETHODCALLTYPE *GetSampleCount )( 
-            IDeckLinkAudioInputPacket_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 
-            IDeckLinkAudioInputPacket_v7_1 * This,
-            void **buffer);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAudioPacketTime )( 
-            IDeckLinkAudioInputPacket_v7_1 * This,
-            BMDTimeValue *packetTime,
-            BMDTimeScale timeScale);
-        
-        END_INTERFACE
-    } IDeckLinkAudioInputPacket_v7_1Vtbl;
-
-    interface IDeckLinkAudioInputPacket_v7_1
-    {
-        CONST_VTBL struct IDeckLinkAudioInputPacket_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkAudioInputPacket_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkAudioInputPacket_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkAudioInputPacket_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkAudioInputPacket_v7_1_GetSampleCount(This)	\
-    ( (This)->lpVtbl -> GetSampleCount(This) ) 
-
-#define IDeckLinkAudioInputPacket_v7_1_GetBytes(This,buffer)	\
-    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 
-
-#define IDeckLinkAudioInputPacket_v7_1_GetAudioPacketTime(This,packetTime,timeScale)	\
-    ( (This)->lpVtbl -> GetAudioPacketTime(This,packetTime,timeScale) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkVideoOutputCallback_v7_1 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9")
-    IDeckLinkVideoOutputCallback_v7_1 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( 
-            /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame,
-            /* [in] */ BMDOutputFrameCompletionResult result) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkVideoOutputCallback_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkVideoOutputCallback_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkVideoOutputCallback_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkVideoOutputCallback_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( 
-            IDeckLinkVideoOutputCallback_v7_1 * This,
-            /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame,
-            /* [in] */ BMDOutputFrameCompletionResult result);
-        
-        END_INTERFACE
-    } IDeckLinkVideoOutputCallback_v7_1Vtbl;
-
-    interface IDeckLinkVideoOutputCallback_v7_1
-    {
-        CONST_VTBL struct IDeckLinkVideoOutputCallback_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkVideoOutputCallback_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkVideoOutputCallback_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkVideoOutputCallback_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkVideoOutputCallback_v7_1_ScheduledFrameCompleted(This,completedFrame,result)	\
-    ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInputCallback_v7_1 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInputCallback_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("7F94F328-5ED4-4E9F-9729-76A86BDC99CC")
-    IDeckLinkInputCallback_v7_1 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 
-            /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInputCallback_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInputCallback_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInputCallback_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInputCallback_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 
-            IDeckLinkInputCallback_v7_1 * This,
-            /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame,
-            /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket);
-        
-        END_INTERFACE
-    } IDeckLinkInputCallback_v7_1Vtbl;
-
-    interface IDeckLinkInputCallback_v7_1
-    {
-        CONST_VTBL struct IDeckLinkInputCallback_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInputCallback_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInputCallback_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInputCallback_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInputCallback_v7_1_VideoInputFrameArrived(This,videoFrame,audioPacket)	\
-    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkOutput_v7_1 */
-/* [helpstring][local][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkOutput_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5")
-    IDeckLinkOutput_v7_1 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 
-            BMDDisplayMode displayMode) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            IDeckLinkVideoFrame_v7_1 **outFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameFromBuffer( 
-            void *buffer,
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            IDeckLinkVideoFrame_v7_1 **outFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 
-            IDeckLinkVideoFrame_v7_1 *theFrame) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 
-            IDeckLinkVideoFrame_v7_1 *theFrame,
-            BMDTimeValue displayTime,
-            BMDTimeValue displayDuration,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 
-            /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 
-            void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 
-            void *buffer,
-            unsigned long sampleFrameCount,
-            BMDTimeValue streamTime,
-            BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 
-            /* [out] */ unsigned long *bufferedSampleCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 
-            BMDTimeValue playbackStartTime,
-            BMDTimeScale timeScale,
-            double playbackSpeed) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 
-            BMDTimeValue stopPlaybackAtTime,
-            BMDTimeValue *actualStopTime,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 
-            BMDTimeScale desiredTimeScale,
-            BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkOutput_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkOutput_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkOutput_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkOutput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkOutput_v7_1 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkOutput_v7_1 * This,
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 
-            IDeckLinkOutput_v7_1 * This,
-            BMDDisplayMode displayMode);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 
-            IDeckLinkOutput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 
-            IDeckLinkOutput_v7_1 * This,
-            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 
-            IDeckLinkOutput_v7_1 * This,
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            IDeckLinkVideoFrame_v7_1 **outFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrameFromBuffer )( 
-            IDeckLinkOutput_v7_1 * This,
-            void *buffer,
-            long width,
-            long height,
-            long rowBytes,
-            BMDPixelFormat pixelFormat,
-            BMDFrameFlags flags,
-            IDeckLinkVideoFrame_v7_1 **outFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 
-            IDeckLinkOutput_v7_1 * This,
-            IDeckLinkVideoFrame_v7_1 *theFrame);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 
-            IDeckLinkOutput_v7_1 * This,
-            IDeckLinkVideoFrame_v7_1 *theFrame,
-            BMDTimeValue displayTime,
-            BMDTimeValue displayDuration,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 
-            IDeckLinkOutput_v7_1 * This,
-            /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 
-            IDeckLinkOutput_v7_1 * This,
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 
-            IDeckLinkOutput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 
-            IDeckLinkOutput_v7_1 * This,
-            void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 
-            IDeckLinkOutput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 
-            IDeckLinkOutput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 
-            IDeckLinkOutput_v7_1 * This,
-            void *buffer,
-            unsigned long sampleFrameCount,
-            BMDTimeValue streamTime,
-            BMDTimeScale timeScale,
-            /* [out] */ unsigned long *sampleFramesWritten);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 
-            IDeckLinkOutput_v7_1 * This,
-            /* [out] */ unsigned long *bufferedSampleCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 
-            IDeckLinkOutput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 
-            IDeckLinkOutput_v7_1 * This,
-            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 
-            IDeckLinkOutput_v7_1 * This,
-            BMDTimeValue playbackStartTime,
-            BMDTimeScale timeScale,
-            double playbackSpeed);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 
-            IDeckLinkOutput_v7_1 * This,
-            BMDTimeValue stopPlaybackAtTime,
-            BMDTimeValue *actualStopTime,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 
-            IDeckLinkOutput_v7_1 * This,
-            BMDTimeScale desiredTimeScale,
-            BMDTimeValue *elapsedTimeSinceSchedulerBegan);
-        
-        END_INTERFACE
-    } IDeckLinkOutput_v7_1Vtbl;
-
-    interface IDeckLinkOutput_v7_1
-    {
-        CONST_VTBL struct IDeckLinkOutput_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkOutput_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkOutput_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkOutput_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkOutput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 
-
-#define IDeckLinkOutput_v7_1_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkOutput_v7_1_EnableVideoOutput(This,displayMode)	\
-    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode) ) 
-
-#define IDeckLinkOutput_v7_1_DisableVideoOutput(This)	\
-    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 
-
-#define IDeckLinkOutput_v7_1_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\
-    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 
-
-#define IDeckLinkOutput_v7_1_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\
-    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 
-
-#define IDeckLinkOutput_v7_1_CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame)	\
-    ( (This)->lpVtbl -> CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame) ) 
-
-#define IDeckLinkOutput_v7_1_DisplayVideoFrameSync(This,theFrame)	\
-    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 
-
-#define IDeckLinkOutput_v7_1_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\
-    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 
-
-#define IDeckLinkOutput_v7_1_SetScheduledFrameCompletionCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_v7_1_EnableAudioOutput(This,sampleRate,sampleType,channelCount)	\
-    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount) ) 
-
-#define IDeckLinkOutput_v7_1_DisableAudioOutput(This)	\
-    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 
-
-#define IDeckLinkOutput_v7_1_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_v7_1_BeginAudioPreroll(This)	\
-    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_v7_1_EndAudioPreroll(This)	\
-    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 
-
-#define IDeckLinkOutput_v7_1_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\
-    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 
-
-#define IDeckLinkOutput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount)	\
-    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) 
-
-#define IDeckLinkOutput_v7_1_FlushBufferedAudioSamples(This)	\
-    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 
-
-#define IDeckLinkOutput_v7_1_SetAudioCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 
-
-#define IDeckLinkOutput_v7_1_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\
-    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 
-
-#define IDeckLinkOutput_v7_1_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\
-    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 
-
-#define IDeckLinkOutput_v7_1_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan)	\
-    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeckLinkInput_v7_1_INTERFACE_DEFINED__
-#define __IDeckLinkInput_v7_1_INTERFACE_DEFINED__
-
-/* interface IDeckLinkInput_v7_1 */
-/* [helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IDeckLinkInput_v7_1;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("2B54EDEF-5B32-429F-BA11-BB990596EACD")
-    IDeckLinkInput_v7_1 : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            BMDVideoInputFlags flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ReadAudioSamples( 
-            void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesRead,
-            /* [out] */ BMDTimeValue *audioPacketTime,
-            BMDTimeScale timeScale) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 
-            /* [out] */ unsigned long *bufferedSampleCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetCallback( 
-            /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeckLinkInput_v7_1Vtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeckLinkInput_v7_1 * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeckLinkInput_v7_1 * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeckLinkInput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 
-            IDeckLinkInput_v7_1 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            /* [out] */ BMDDisplayModeSupport *result);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 
-            IDeckLinkInput_v7_1 * This,
-            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 
-            IDeckLinkInput_v7_1 * This,
-            BMDDisplayMode displayMode,
-            BMDPixelFormat pixelFormat,
-            BMDVideoInputFlags flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 
-            IDeckLinkInput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 
-            IDeckLinkInput_v7_1 * This,
-            BMDAudioSampleRate sampleRate,
-            BMDAudioSampleType sampleType,
-            unsigned long channelCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 
-            IDeckLinkInput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *ReadAudioSamples )( 
-            IDeckLinkInput_v7_1 * This,
-            void *buffer,
-            unsigned long sampleFrameCount,
-            /* [out] */ unsigned long *sampleFramesRead,
-            /* [out] */ BMDTimeValue *audioPacketTime,
-            BMDTimeScale timeScale);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 
-            IDeckLinkInput_v7_1 * This,
-            /* [out] */ unsigned long *bufferedSampleCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 
-            IDeckLinkInput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 
-            IDeckLinkInput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 
-            IDeckLinkInput_v7_1 * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 
-            IDeckLinkInput_v7_1 * This,
-            /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback);
-        
-        END_INTERFACE
-    } IDeckLinkInput_v7_1Vtbl;
-
-    interface IDeckLinkInput_v7_1
-    {
-        CONST_VTBL struct IDeckLinkInput_v7_1Vtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeckLinkInput_v7_1_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeckLinkInput_v7_1_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeckLinkInput_v7_1_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeckLinkInput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\
-    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 
-
-#define IDeckLinkInput_v7_1_GetDisplayModeIterator(This,iterator)	\
-    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 
-
-#define IDeckLinkInput_v7_1_EnableVideoInput(This,displayMode,pixelFormat,flags)	\
-    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 
-
-#define IDeckLinkInput_v7_1_DisableVideoInput(This)	\
-    ( (This)->lpVtbl -> DisableVideoInput(This) ) 
-
-#define IDeckLinkInput_v7_1_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\
-    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 
-
-#define IDeckLinkInput_v7_1_DisableAudioInput(This)	\
-    ( (This)->lpVtbl -> DisableAudioInput(This) ) 
-
-#define IDeckLinkInput_v7_1_ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale)	\
-    ( (This)->lpVtbl -> ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale) ) 
-
-#define IDeckLinkInput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount)	\
-    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) 
-
-#define IDeckLinkInput_v7_1_StartStreams(This)	\
-    ( (This)->lpVtbl -> StartStreams(This) ) 
-
-#define IDeckLinkInput_v7_1_StopStreams(This)	\
-    ( (This)->lpVtbl -> StopStreams(This) ) 
-
-#define IDeckLinkInput_v7_1_PauseStreams(This)	\
-    ( (This)->lpVtbl -> PauseStreams(This) ) 
-
-#define IDeckLinkInput_v7_1_SetCallback(This,theCallback)	\
-    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ */
-
-#endif /* __DeckLinkAPI_LIBRARY_DEFINED__ */
-
-/* Additional Prototypes for ALL interfaces */
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
+

+

+/* this ALWAYS GENERATED file contains the definitions for the interfaces */

+

+

+ /* File created by MIDL compiler version 8.00.0595 */

+/* at Wed Dec 03 06:04:46 2014

+ */

+/* Compiler settings for DeckLinkAPI.idl:

+    Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595 

+    protocol : dce , ms_ext, c_ext, robust

+    error checks: allocation ref bounds_check enum stub_data 

+    VC __declspec() decoration level: 

+         __declspec(uuid()), __declspec(selectany), __declspec(novtable)

+         DECLSPEC_UUID(), MIDL_INTERFACE()

+*/

+/* @@MIDL_FILE_HEADING(  ) */

+

+#pragma warning( disable: 4049 )  /* more than 64k source lines */

+

+

+/* verify that the <rpcndr.h> version is high enough to compile this file*/

+#ifndef __REQUIRED_RPCNDR_H_VERSION__

+#define __REQUIRED_RPCNDR_H_VERSION__ 475

+#endif

+

+#include "rpc.h"

+#include "rpcndr.h"

+

+#ifndef __RPCNDR_H_VERSION__

+#error this stub requires an updated version of <rpcndr.h>

+#endif // __RPCNDR_H_VERSION__

+

+

+#ifndef __DecklinkAPI_h__

+#define __DecklinkAPI_h__

+

+#if defined(_MSC_VER) && (_MSC_VER >= 1020)

+#pragma once

+#endif

+

+/* Forward Declarations */ 

+

+#ifndef __IDeckLinkTimecode_FWD_DEFINED__

+#define __IDeckLinkTimecode_FWD_DEFINED__

+typedef interface IDeckLinkTimecode IDeckLinkTimecode;

+

+#endif 	/* __IDeckLinkTimecode_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayModeIterator_FWD_DEFINED__

+#define __IDeckLinkDisplayModeIterator_FWD_DEFINED__

+typedef interface IDeckLinkDisplayModeIterator IDeckLinkDisplayModeIterator;

+

+#endif 	/* __IDeckLinkDisplayModeIterator_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayMode_FWD_DEFINED__

+#define __IDeckLinkDisplayMode_FWD_DEFINED__

+typedef interface IDeckLinkDisplayMode IDeckLinkDisplayMode;

+

+#endif 	/* __IDeckLinkDisplayMode_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLink_FWD_DEFINED__

+#define __IDeckLink_FWD_DEFINED__

+typedef interface IDeckLink IDeckLink;

+

+#endif 	/* __IDeckLink_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkConfiguration_FWD_DEFINED__

+#define __IDeckLinkConfiguration_FWD_DEFINED__

+typedef interface IDeckLinkConfiguration IDeckLinkConfiguration;

+

+#endif 	/* __IDeckLinkConfiguration_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__

+#define __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__

+typedef interface IDeckLinkDeckControlStatusCallback IDeckLinkDeckControlStatusCallback;

+

+#endif 	/* __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControl_FWD_DEFINED__

+#define __IDeckLinkDeckControl_FWD_DEFINED__

+typedef interface IDeckLinkDeckControl IDeckLinkDeckControl;

+

+#endif 	/* __IDeckLinkDeckControl_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__

+#define __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__

+typedef interface IBMDStreamingDeviceNotificationCallback IBMDStreamingDeviceNotificationCallback;

+

+#endif 	/* __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingH264InputCallback_FWD_DEFINED__

+#define __IBMDStreamingH264InputCallback_FWD_DEFINED__

+typedef interface IBMDStreamingH264InputCallback IBMDStreamingH264InputCallback;

+

+#endif 	/* __IBMDStreamingH264InputCallback_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingDiscovery_FWD_DEFINED__

+#define __IBMDStreamingDiscovery_FWD_DEFINED__

+typedef interface IBMDStreamingDiscovery IBMDStreamingDiscovery;

+

+#endif 	/* __IBMDStreamingDiscovery_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingVideoEncodingMode_FWD_DEFINED__

+#define __IBMDStreamingVideoEncodingMode_FWD_DEFINED__

+typedef interface IBMDStreamingVideoEncodingMode IBMDStreamingVideoEncodingMode;

+

+#endif 	/* __IBMDStreamingVideoEncodingMode_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__

+#define __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__

+typedef interface IBMDStreamingMutableVideoEncodingMode IBMDStreamingMutableVideoEncodingMode;

+

+#endif 	/* __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__

+#define __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__

+typedef interface IBMDStreamingVideoEncodingModePresetIterator IBMDStreamingVideoEncodingModePresetIterator;

+

+#endif 	/* __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingDeviceInput_FWD_DEFINED__

+#define __IBMDStreamingDeviceInput_FWD_DEFINED__

+typedef interface IBMDStreamingDeviceInput IBMDStreamingDeviceInput;

+

+#endif 	/* __IBMDStreamingDeviceInput_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingH264NALPacket_FWD_DEFINED__

+#define __IBMDStreamingH264NALPacket_FWD_DEFINED__

+typedef interface IBMDStreamingH264NALPacket IBMDStreamingH264NALPacket;

+

+#endif 	/* __IBMDStreamingH264NALPacket_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingAudioPacket_FWD_DEFINED__

+#define __IBMDStreamingAudioPacket_FWD_DEFINED__

+typedef interface IBMDStreamingAudioPacket IBMDStreamingAudioPacket;

+

+#endif 	/* __IBMDStreamingAudioPacket_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__

+#define __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__

+typedef interface IBMDStreamingMPEG2TSPacket IBMDStreamingMPEG2TSPacket;

+

+#endif 	/* __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__ */

+

+

+#ifndef __IBMDStreamingH264NALParser_FWD_DEFINED__

+#define __IBMDStreamingH264NALParser_FWD_DEFINED__

+typedef interface IBMDStreamingH264NALParser IBMDStreamingH264NALParser;

+

+#endif 	/* __IBMDStreamingH264NALParser_FWD_DEFINED__ */

+

+

+#ifndef __CBMDStreamingDiscovery_FWD_DEFINED__

+#define __CBMDStreamingDiscovery_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CBMDStreamingDiscovery CBMDStreamingDiscovery;

+#else

+typedef struct CBMDStreamingDiscovery CBMDStreamingDiscovery;

+#endif /* __cplusplus */

+

+#endif 	/* __CBMDStreamingDiscovery_FWD_DEFINED__ */

+

+

+#ifndef __CBMDStreamingH264NALParser_FWD_DEFINED__

+#define __CBMDStreamingH264NALParser_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CBMDStreamingH264NALParser CBMDStreamingH264NALParser;

+#else

+typedef struct CBMDStreamingH264NALParser CBMDStreamingH264NALParser;

+#endif /* __cplusplus */

+

+#endif 	/* __CBMDStreamingH264NALParser_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoOutputCallback_FWD_DEFINED__

+#define __IDeckLinkVideoOutputCallback_FWD_DEFINED__

+typedef interface IDeckLinkVideoOutputCallback IDeckLinkVideoOutputCallback;

+

+#endif 	/* __IDeckLinkVideoOutputCallback_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInputCallback_FWD_DEFINED__

+#define __IDeckLinkInputCallback_FWD_DEFINED__

+typedef interface IDeckLinkInputCallback IDeckLinkInputCallback;

+

+#endif 	/* __IDeckLinkInputCallback_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkMemoryAllocator_FWD_DEFINED__

+#define __IDeckLinkMemoryAllocator_FWD_DEFINED__

+typedef interface IDeckLinkMemoryAllocator IDeckLinkMemoryAllocator;

+

+#endif 	/* __IDeckLinkMemoryAllocator_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkAudioOutputCallback_FWD_DEFINED__

+#define __IDeckLinkAudioOutputCallback_FWD_DEFINED__

+typedef interface IDeckLinkAudioOutputCallback IDeckLinkAudioOutputCallback;

+

+#endif 	/* __IDeckLinkAudioOutputCallback_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkIterator_FWD_DEFINED__

+#define __IDeckLinkIterator_FWD_DEFINED__

+typedef interface IDeckLinkIterator IDeckLinkIterator;

+

+#endif 	/* __IDeckLinkIterator_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkAPIInformation_FWD_DEFINED__

+#define __IDeckLinkAPIInformation_FWD_DEFINED__

+typedef interface IDeckLinkAPIInformation IDeckLinkAPIInformation;

+

+#endif 	/* __IDeckLinkAPIInformation_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_FWD_DEFINED__

+#define __IDeckLinkOutput_FWD_DEFINED__

+typedef interface IDeckLinkOutput IDeckLinkOutput;

+

+#endif 	/* __IDeckLinkOutput_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_FWD_DEFINED__

+#define __IDeckLinkInput_FWD_DEFINED__

+typedef interface IDeckLinkInput IDeckLinkInput;

+

+#endif 	/* __IDeckLinkInput_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame_FWD_DEFINED__

+#define __IDeckLinkVideoFrame_FWD_DEFINED__

+typedef interface IDeckLinkVideoFrame IDeckLinkVideoFrame;

+

+#endif 	/* __IDeckLinkVideoFrame_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkMutableVideoFrame_FWD_DEFINED__

+#define __IDeckLinkMutableVideoFrame_FWD_DEFINED__

+typedef interface IDeckLinkMutableVideoFrame IDeckLinkMutableVideoFrame;

+

+#endif 	/* __IDeckLinkMutableVideoFrame_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__

+#define __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__

+typedef interface IDeckLinkVideoFrame3DExtensions IDeckLinkVideoFrame3DExtensions;

+

+#endif 	/* __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_FWD_DEFINED__

+#define __IDeckLinkVideoInputFrame_FWD_DEFINED__

+typedef interface IDeckLinkVideoInputFrame IDeckLinkVideoInputFrame;

+

+#endif 	/* __IDeckLinkVideoInputFrame_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrameAncillary_FWD_DEFINED__

+#define __IDeckLinkVideoFrameAncillary_FWD_DEFINED__

+typedef interface IDeckLinkVideoFrameAncillary IDeckLinkVideoFrameAncillary;

+

+#endif 	/* __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkAudioInputPacket_FWD_DEFINED__

+#define __IDeckLinkAudioInputPacket_FWD_DEFINED__

+typedef interface IDeckLinkAudioInputPacket IDeckLinkAudioInputPacket;

+

+#endif 	/* __IDeckLinkAudioInputPacket_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkScreenPreviewCallback_FWD_DEFINED__

+#define __IDeckLinkScreenPreviewCallback_FWD_DEFINED__

+typedef interface IDeckLinkScreenPreviewCallback IDeckLinkScreenPreviewCallback;

+

+#endif 	/* __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__

+#define __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__

+typedef interface IDeckLinkGLScreenPreviewHelper IDeckLinkGLScreenPreviewHelper;

+

+#endif 	/* __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__

+#define __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__

+typedef interface IDeckLinkDX9ScreenPreviewHelper IDeckLinkDX9ScreenPreviewHelper;

+

+#endif 	/* __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkNotificationCallback_FWD_DEFINED__

+#define __IDeckLinkNotificationCallback_FWD_DEFINED__

+typedef interface IDeckLinkNotificationCallback IDeckLinkNotificationCallback;

+

+#endif 	/* __IDeckLinkNotificationCallback_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkNotification_FWD_DEFINED__

+#define __IDeckLinkNotification_FWD_DEFINED__

+typedef interface IDeckLinkNotification IDeckLinkNotification;

+

+#endif 	/* __IDeckLinkNotification_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkAttributes_FWD_DEFINED__

+#define __IDeckLinkAttributes_FWD_DEFINED__

+typedef interface IDeckLinkAttributes IDeckLinkAttributes;

+

+#endif 	/* __IDeckLinkAttributes_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkKeyer_FWD_DEFINED__

+#define __IDeckLinkKeyer_FWD_DEFINED__

+typedef interface IDeckLinkKeyer IDeckLinkKeyer;

+

+#endif 	/* __IDeckLinkKeyer_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoConversion_FWD_DEFINED__

+#define __IDeckLinkVideoConversion_FWD_DEFINED__

+typedef interface IDeckLinkVideoConversion IDeckLinkVideoConversion;

+

+#endif 	/* __IDeckLinkVideoConversion_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__

+#define __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__

+typedef interface IDeckLinkDeviceNotificationCallback IDeckLinkDeviceNotificationCallback;

+

+#endif 	/* __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDiscovery_FWD_DEFINED__

+#define __IDeckLinkDiscovery_FWD_DEFINED__

+typedef interface IDeckLinkDiscovery IDeckLinkDiscovery;

+

+#endif 	/* __IDeckLinkDiscovery_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkIterator_FWD_DEFINED__

+#define __CDeckLinkIterator_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkIterator CDeckLinkIterator;

+#else

+typedef struct CDeckLinkIterator CDeckLinkIterator;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkIterator_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkAPIInformation_FWD_DEFINED__

+#define __CDeckLinkAPIInformation_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkAPIInformation CDeckLinkAPIInformation;

+#else

+typedef struct CDeckLinkAPIInformation CDeckLinkAPIInformation;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkAPIInformation_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__

+#define __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper;

+#else

+typedef struct CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__

+#define __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkDX9ScreenPreviewHelper CDeckLinkDX9ScreenPreviewHelper;

+#else

+typedef struct CDeckLinkDX9ScreenPreviewHelper CDeckLinkDX9ScreenPreviewHelper;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkVideoConversion_FWD_DEFINED__

+#define __CDeckLinkVideoConversion_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkVideoConversion CDeckLinkVideoConversion;

+#else

+typedef struct CDeckLinkVideoConversion CDeckLinkVideoConversion;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkVideoConversion_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkDiscovery_FWD_DEFINED__

+#define __CDeckLinkDiscovery_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkDiscovery CDeckLinkDiscovery;

+#else

+typedef struct CDeckLinkDiscovery CDeckLinkDiscovery;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkDiscovery_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkConfiguration_v10_2_FWD_DEFINED__

+#define __IDeckLinkConfiguration_v10_2_FWD_DEFINED__

+typedef interface IDeckLinkConfiguration_v10_2 IDeckLinkConfiguration_v10_2;

+

+#endif 	/* __IDeckLinkConfiguration_v10_2_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v9_9_FWD_DEFINED__

+#define __IDeckLinkOutput_v9_9_FWD_DEFINED__

+typedef interface IDeckLinkOutput_v9_9 IDeckLinkOutput_v9_9;

+

+#endif 	/* __IDeckLinkOutput_v9_9_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v9_2_FWD_DEFINED__

+#define __IDeckLinkInput_v9_2_FWD_DEFINED__

+typedef interface IDeckLinkInput_v9_2 IDeckLinkInput_v9_2;

+

+#endif 	/* __IDeckLinkInput_v9_2_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControlStatusCallback_v8_1_FWD_DEFINED__

+#define __IDeckLinkDeckControlStatusCallback_v8_1_FWD_DEFINED__

+typedef interface IDeckLinkDeckControlStatusCallback_v8_1 IDeckLinkDeckControlStatusCallback_v8_1;

+

+#endif 	/* __IDeckLinkDeckControlStatusCallback_v8_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControl_v8_1_FWD_DEFINED__

+#define __IDeckLinkDeckControl_v8_1_FWD_DEFINED__

+typedef interface IDeckLinkDeckControl_v8_1 IDeckLinkDeckControl_v8_1;

+

+#endif 	/* __IDeckLinkDeckControl_v8_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLink_v8_0_FWD_DEFINED__

+#define __IDeckLink_v8_0_FWD_DEFINED__

+typedef interface IDeckLink_v8_0 IDeckLink_v8_0;

+

+#endif 	/* __IDeckLink_v8_0_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkIterator_v8_0_FWD_DEFINED__

+#define __IDeckLinkIterator_v8_0_FWD_DEFINED__

+typedef interface IDeckLinkIterator_v8_0 IDeckLinkIterator_v8_0;

+

+#endif 	/* __IDeckLinkIterator_v8_0_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkIterator_v8_0_FWD_DEFINED__

+#define __CDeckLinkIterator_v8_0_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkIterator_v8_0 CDeckLinkIterator_v8_0;

+#else

+typedef struct CDeckLinkIterator_v8_0 CDeckLinkIterator_v8_0;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkIterator_v8_0_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControl_v7_9_FWD_DEFINED__

+#define __IDeckLinkDeckControl_v7_9_FWD_DEFINED__

+typedef interface IDeckLinkDeckControl_v7_9 IDeckLinkDeckControl_v7_9;

+

+#endif 	/* __IDeckLinkDeckControl_v7_9_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__

+#define __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkDisplayModeIterator_v7_6 IDeckLinkDisplayModeIterator_v7_6;

+

+#endif 	/* __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__

+#define __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkDisplayMode_v7_6 IDeckLinkDisplayMode_v7_6;

+

+#endif 	/* __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v7_6_FWD_DEFINED__

+#define __IDeckLinkOutput_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkOutput_v7_6 IDeckLinkOutput_v7_6;

+

+#endif 	/* __IDeckLinkOutput_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v7_6_FWD_DEFINED__

+#define __IDeckLinkInput_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkInput_v7_6 IDeckLinkInput_v7_6;

+

+#endif 	/* __IDeckLinkInput_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkTimecode_v7_6_FWD_DEFINED__

+#define __IDeckLinkTimecode_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkTimecode_v7_6 IDeckLinkTimecode_v7_6;

+

+#endif 	/* __IDeckLinkTimecode_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__

+#define __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkVideoFrame_v7_6 IDeckLinkVideoFrame_v7_6;

+

+#endif 	/* __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__

+#define __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkMutableVideoFrame_v7_6 IDeckLinkMutableVideoFrame_v7_6;

+

+#endif 	/* __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__

+#define __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkVideoInputFrame_v7_6 IDeckLinkVideoInputFrame_v7_6;

+

+#endif 	/* __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__

+#define __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkScreenPreviewCallback_v7_6 IDeckLinkScreenPreviewCallback_v7_6;

+

+#endif 	/* __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__

+#define __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkGLScreenPreviewHelper_v7_6 IDeckLinkGLScreenPreviewHelper_v7_6;

+

+#endif 	/* __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__

+#define __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkVideoConversion_v7_6 IDeckLinkVideoConversion_v7_6;

+

+#endif 	/* __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkConfiguration_v7_6_FWD_DEFINED__

+#define __IDeckLinkConfiguration_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkConfiguration_v7_6 IDeckLinkConfiguration_v7_6;

+

+#endif 	/* __IDeckLinkConfiguration_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__

+#define __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkVideoOutputCallback_v7_6 IDeckLinkVideoOutputCallback_v7_6;

+

+#endif 	/* __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInputCallback_v7_6_FWD_DEFINED__

+#define __IDeckLinkInputCallback_v7_6_FWD_DEFINED__

+typedef interface IDeckLinkInputCallback_v7_6 IDeckLinkInputCallback_v7_6;

+

+#endif 	/* __IDeckLinkInputCallback_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__

+#define __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkGLScreenPreviewHelper_v7_6 CDeckLinkGLScreenPreviewHelper_v7_6;

+#else

+typedef struct CDeckLinkGLScreenPreviewHelper_v7_6 CDeckLinkGLScreenPreviewHelper_v7_6;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__

+#define __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__

+

+#ifdef __cplusplus

+typedef class CDeckLinkVideoConversion_v7_6 CDeckLinkVideoConversion_v7_6;

+#else

+typedef struct CDeckLinkVideoConversion_v7_6 CDeckLinkVideoConversion_v7_6;

+#endif /* __cplusplus */

+

+#endif 	/* __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInputCallback_v7_3_FWD_DEFINED__

+#define __IDeckLinkInputCallback_v7_3_FWD_DEFINED__

+typedef interface IDeckLinkInputCallback_v7_3 IDeckLinkInputCallback_v7_3;

+

+#endif 	/* __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v7_3_FWD_DEFINED__

+#define __IDeckLinkOutput_v7_3_FWD_DEFINED__

+typedef interface IDeckLinkOutput_v7_3 IDeckLinkOutput_v7_3;

+

+#endif 	/* __IDeckLinkOutput_v7_3_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v7_3_FWD_DEFINED__

+#define __IDeckLinkInput_v7_3_FWD_DEFINED__

+typedef interface IDeckLinkInput_v7_3 IDeckLinkInput_v7_3;

+

+#endif 	/* __IDeckLinkInput_v7_3_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__

+#define __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__

+typedef interface IDeckLinkVideoInputFrame_v7_3 IDeckLinkVideoInputFrame_v7_3;

+

+#endif 	/* __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__

+#define __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkDisplayModeIterator_v7_1 IDeckLinkDisplayModeIterator_v7_1;

+

+#endif 	/* __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__

+#define __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkDisplayMode_v7_1 IDeckLinkDisplayMode_v7_1;

+

+#endif 	/* __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__

+#define __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkVideoFrame_v7_1 IDeckLinkVideoFrame_v7_1;

+

+#endif 	/* __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__

+#define __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkVideoInputFrame_v7_1 IDeckLinkVideoInputFrame_v7_1;

+

+#endif 	/* __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__

+#define __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkAudioInputPacket_v7_1 IDeckLinkAudioInputPacket_v7_1;

+

+#endif 	/* __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__

+#define __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkVideoOutputCallback_v7_1 IDeckLinkVideoOutputCallback_v7_1;

+

+#endif 	/* __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInputCallback_v7_1_FWD_DEFINED__

+#define __IDeckLinkInputCallback_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkInputCallback_v7_1 IDeckLinkInputCallback_v7_1;

+

+#endif 	/* __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v7_1_FWD_DEFINED__

+#define __IDeckLinkOutput_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkOutput_v7_1 IDeckLinkOutput_v7_1;

+

+#endif 	/* __IDeckLinkOutput_v7_1_FWD_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v7_1_FWD_DEFINED__

+#define __IDeckLinkInput_v7_1_FWD_DEFINED__

+typedef interface IDeckLinkInput_v7_1 IDeckLinkInput_v7_1;

+

+#endif 	/* __IDeckLinkInput_v7_1_FWD_DEFINED__ */

+

+

+/* header files for imported files */

+#include "unknwn.h"

+

+#ifdef __cplusplus

+extern "C"{

+#endif 

+

+

+

+#ifndef __DeckLinkAPI_LIBRARY_DEFINED__

+#define __DeckLinkAPI_LIBRARY_DEFINED__

+

+/* library DeckLinkAPI */

+/* [helpstring][version][uuid] */ 

+

+typedef LONGLONG BMDTimeValue;

+

+typedef LONGLONG BMDTimeScale;

+

+typedef unsigned long BMDTimecodeBCD;

+

+typedef unsigned long BMDTimecodeUserBits;

+

+typedef unsigned long BMDTimecodeFlags;

+#if 0

+typedef enum _BMDTimecodeFlags BMDTimecodeFlags;

+

+#endif

+/* [v1_enum] */ 

+enum _BMDTimecodeFlags

+    {

+        bmdTimecodeFlagDefault	= 0,

+        bmdTimecodeIsDropFrame	= ( 1 << 0 ) ,

+        bmdTimecodeFieldMark	= ( 1 << 1 ) 

+    } ;

+typedef /* [v1_enum] */ 

+enum _BMDVideoConnection

+    {

+        bmdVideoConnectionSDI	= ( 1 << 0 ) ,

+        bmdVideoConnectionHDMI	= ( 1 << 1 ) ,

+        bmdVideoConnectionOpticalSDI	= ( 1 << 2 ) ,

+        bmdVideoConnectionComponent	= ( 1 << 3 ) ,

+        bmdVideoConnectionComposite	= ( 1 << 4 ) ,

+        bmdVideoConnectionSVideo	= ( 1 << 5 ) 

+    } 	BMDVideoConnection;

+

+typedef /* [v1_enum] */ 

+enum _BMDAudioConnection

+    {

+        bmdAudioConnectionEmbedded	= ( 1 << 0 ) ,

+        bmdAudioConnectionAESEBU	= ( 1 << 1 ) ,

+        bmdAudioConnectionAnalog	= ( 1 << 2 ) ,

+        bmdAudioConnectionAnalogXLR	= ( 1 << 3 ) ,

+        bmdAudioConnectionAnalogRCA	= ( 1 << 4 ) 

+    } 	BMDAudioConnection;

+

+

+typedef unsigned long BMDDisplayModeFlags;

+#if 0

+typedef enum _BMDDisplayModeFlags BMDDisplayModeFlags;

+

+#endif

+typedef /* [v1_enum] */ 

+enum _BMDDisplayMode

+    {

+        bmdModeNTSC	= 0x6e747363,

+        bmdModeNTSC2398	= 0x6e743233,

+        bmdModePAL	= 0x70616c20,

+        bmdModeNTSCp	= 0x6e747370,

+        bmdModePALp	= 0x70616c70,

+        bmdModeHD1080p2398	= 0x32337073,

+        bmdModeHD1080p24	= 0x32347073,

+        bmdModeHD1080p25	= 0x48703235,

+        bmdModeHD1080p2997	= 0x48703239,

+        bmdModeHD1080p30	= 0x48703330,

+        bmdModeHD1080i50	= 0x48693530,

+        bmdModeHD1080i5994	= 0x48693539,

+        bmdModeHD1080i6000	= 0x48693630,

+        bmdModeHD1080p50	= 0x48703530,

+        bmdModeHD1080p5994	= 0x48703539,

+        bmdModeHD1080p6000	= 0x48703630,

+        bmdModeHD720p50	= 0x68703530,

+        bmdModeHD720p5994	= 0x68703539,

+        bmdModeHD720p60	= 0x68703630,

+        bmdMode2k2398	= 0x326b3233,

+        bmdMode2k24	= 0x326b3234,

+        bmdMode2k25	= 0x326b3235,

+        bmdMode2kDCI2398	= 0x32643233,

+        bmdMode2kDCI24	= 0x32643234,

+        bmdMode2kDCI25	= 0x32643235,

+        bmdMode4K2160p2398	= 0x346b3233,

+        bmdMode4K2160p24	= 0x346b3234,

+        bmdMode4K2160p25	= 0x346b3235,

+        bmdMode4K2160p2997	= 0x346b3239,

+        bmdMode4K2160p30	= 0x346b3330,

+        bmdMode4K2160p50	= 0x346b3530,

+        bmdMode4K2160p5994	= 0x346b3539,

+        bmdMode4K2160p60	= 0x346b3630,

+        bmdMode4kDCI2398	= 0x34643233,

+        bmdMode4kDCI24	= 0x34643234,

+        bmdMode4kDCI25	= 0x34643235,

+        bmdModeUnknown	= 0x69756e6b

+    } 	BMDDisplayMode;

+

+typedef /* [v1_enum] */ 

+enum _BMDFieldDominance

+    {

+        bmdUnknownFieldDominance	= 0,

+        bmdLowerFieldFirst	= 0x6c6f7772,

+        bmdUpperFieldFirst	= 0x75707072,

+        bmdProgressiveFrame	= 0x70726f67,

+        bmdProgressiveSegmentedFrame	= 0x70736620

+    } 	BMDFieldDominance;

+

+typedef /* [v1_enum] */ 

+enum _BMDPixelFormat

+    {

+        bmdFormat8BitYUV	= 0x32767579,

+        bmdFormat10BitYUV	= 0x76323130,

+        bmdFormat8BitARGB	= 32,

+        bmdFormat8BitBGRA	= 0x42475241,

+        bmdFormat10BitRGB	= 0x72323130,

+        bmdFormat12BitRGB	= 0x52313242,

+        bmdFormat12BitRGBLE	= 0x5231324c,

+        bmdFormat10BitRGBXLE	= 0x5231306c,

+        bmdFormat10BitRGBX	= 0x52313062

+    } 	BMDPixelFormat;

+

+/* [v1_enum] */ 

+enum _BMDDisplayModeFlags

+    {

+        bmdDisplayModeSupports3D	= ( 1 << 0 ) ,

+        bmdDisplayModeColorspaceRec601	= ( 1 << 1 ) ,

+        bmdDisplayModeColorspaceRec709	= ( 1 << 2 ) 

+    } ;

+

+

+#if 0

+#endif

+

+#if 0

+#endif

+typedef /* [v1_enum] */ 

+enum _BMDDeckLinkConfigurationID

+    {

+        bmdDeckLinkConfigSwapSerialRxTx	= 0x73737274,

+        bmdDeckLinkConfigUse1080pNotPsF	= 0x6670726f,

+        bmdDeckLinkConfigHDMI3DPackingFormat	= 0x33647066,

+        bmdDeckLinkConfigBypass	= 0x62797073,

+        bmdDeckLinkConfigClockTimingAdjustment	= 0x63746164,

+        bmdDeckLinkConfigAnalogAudioConsumerLevels	= 0x6161636c,

+        bmdDeckLinkConfigFieldFlickerRemoval	= 0x66646672,

+        bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion	= 0x746f3539,

+        bmdDeckLinkConfig444SDIVideoOutput	= 0x3434346f,

+        bmdDeckLinkConfigSingleLinkVideoOutput	= 0x73676c6f,

+        bmdDeckLinkConfigBlackVideoOutputDuringCapture	= 0x62766f63,

+        bmdDeckLinkConfigLowLatencyVideoOutput	= 0x6c6c766f,

+        bmdDeckLinkConfigVideoOutputConnection	= 0x766f636e,

+        bmdDeckLinkConfigVideoOutputConversionMode	= 0x766f636d,

+        bmdDeckLinkConfigAnalogVideoOutputFlags	= 0x61766f66,

+        bmdDeckLinkConfigReferenceInputTimingOffset	= 0x676c6f74,

+        bmdDeckLinkConfigVideoOutputIdleOperation	= 0x766f696f,

+        bmdDeckLinkConfigDefaultVideoOutputMode	= 0x64766f6d,

+        bmdDeckLinkConfigDefaultVideoOutputModeFlags	= 0x64766f66,

+        bmdDeckLinkConfigVideoOutputComponentLumaGain	= 0x6f636c67,

+        bmdDeckLinkConfigVideoOutputComponentChromaBlueGain	= 0x6f636362,

+        bmdDeckLinkConfigVideoOutputComponentChromaRedGain	= 0x6f636372,

+        bmdDeckLinkConfigVideoOutputCompositeLumaGain	= 0x6f696c67,

+        bmdDeckLinkConfigVideoOutputCompositeChromaGain	= 0x6f696367,

+        bmdDeckLinkConfigVideoOutputSVideoLumaGain	= 0x6f736c67,

+        bmdDeckLinkConfigVideoOutputSVideoChromaGain	= 0x6f736367,

+        bmdDeckLinkConfigVideoInputScanning	= 0x76697363,

+        bmdDeckLinkConfigUseDedicatedLTCInput	= 0x646c7463,

+        bmdDeckLinkConfigVideoInputConnection	= 0x7669636e,

+        bmdDeckLinkConfigAnalogVideoInputFlags	= 0x61766966,

+        bmdDeckLinkConfigVideoInputConversionMode	= 0x7669636d,

+        bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame	= 0x70646966,

+        bmdDeckLinkConfigVANCSourceLine1Mapping	= 0x76736c31,

+        bmdDeckLinkConfigVANCSourceLine2Mapping	= 0x76736c32,

+        bmdDeckLinkConfigVANCSourceLine3Mapping	= 0x76736c33,

+        bmdDeckLinkConfigCapturePassThroughMode	= 0x6370746d,

+        bmdDeckLinkConfigVideoInputComponentLumaGain	= 0x69636c67,

+        bmdDeckLinkConfigVideoInputComponentChromaBlueGain	= 0x69636362,

+        bmdDeckLinkConfigVideoInputComponentChromaRedGain	= 0x69636372,

+        bmdDeckLinkConfigVideoInputCompositeLumaGain	= 0x69696c67,

+        bmdDeckLinkConfigVideoInputCompositeChromaGain	= 0x69696367,

+        bmdDeckLinkConfigVideoInputSVideoLumaGain	= 0x69736c67,

+        bmdDeckLinkConfigVideoInputSVideoChromaGain	= 0x69736367,

+        bmdDeckLinkConfigAudioInputConnection	= 0x6169636e,

+        bmdDeckLinkConfigAnalogAudioInputScaleChannel1	= 0x61697331,

+        bmdDeckLinkConfigAnalogAudioInputScaleChannel2	= 0x61697332,

+        bmdDeckLinkConfigAnalogAudioInputScaleChannel3	= 0x61697333,

+        bmdDeckLinkConfigAnalogAudioInputScaleChannel4	= 0x61697334,

+        bmdDeckLinkConfigDigitalAudioInputScale	= 0x64616973,

+        bmdDeckLinkConfigAudioOutputAESAnalogSwitch	= 0x616f6161,

+        bmdDeckLinkConfigAnalogAudioOutputScaleChannel1	= 0x616f7331,

+        bmdDeckLinkConfigAnalogAudioOutputScaleChannel2	= 0x616f7332,

+        bmdDeckLinkConfigAnalogAudioOutputScaleChannel3	= 0x616f7333,

+        bmdDeckLinkConfigAnalogAudioOutputScaleChannel4	= 0x616f7334,

+        bmdDeckLinkConfigDigitalAudioOutputScale	= 0x64616f73

+    } 	BMDDeckLinkConfigurationID;

+

+

+typedef unsigned long BMDDeckControlStatusFlags;

+typedef unsigned long BMDDeckControlExportModeOpsFlags;

+#if 0

+typedef enum _BMDDeckControlStatusFlags BMDDeckControlStatusFlags;

+

+typedef enum _BMDDeckControlExportModeOpsFlags BMDDeckControlExportModeOpsFlags;

+

+#endif

+typedef /* [v1_enum] */ 

+enum _BMDDeckControlMode

+    {

+        bmdDeckControlNotOpened	= 0x6e746f70,

+        bmdDeckControlVTRControlMode	= 0x76747263,

+        bmdDeckControlExportMode	= 0x6578706d,

+        bmdDeckControlCaptureMode	= 0x6361706d

+    } 	BMDDeckControlMode;

+

+typedef /* [v1_enum] */ 

+enum _BMDDeckControlEvent

+    {

+        bmdDeckControlAbortedEvent	= 0x61627465,

+        bmdDeckControlPrepareForExportEvent	= 0x70666565,

+        bmdDeckControlExportCompleteEvent	= 0x65786365,

+        bmdDeckControlPrepareForCaptureEvent	= 0x70666365,

+        bmdDeckControlCaptureCompleteEvent	= 0x63636576

+    } 	BMDDeckControlEvent;

+

+typedef /* [v1_enum] */ 

+enum _BMDDeckControlVTRControlState

+    {

+        bmdDeckControlNotInVTRControlMode	= 0x6e76636d,

+        bmdDeckControlVTRControlPlaying	= 0x76747270,

+        bmdDeckControlVTRControlRecording	= 0x76747272,

+        bmdDeckControlVTRControlStill	= 0x76747261,

+        bmdDeckControlVTRControlShuttleForward	= 0x76747366,

+        bmdDeckControlVTRControlShuttleReverse	= 0x76747372,

+        bmdDeckControlVTRControlJogForward	= 0x76746a66,

+        bmdDeckControlVTRControlJogReverse	= 0x76746a72,

+        bmdDeckControlVTRControlStopped	= 0x7674726f

+    } 	BMDDeckControlVTRControlState;

+

+/* [v1_enum] */ 

+enum _BMDDeckControlStatusFlags

+    {

+        bmdDeckControlStatusDeckConnected	= ( 1 << 0 ) ,

+        bmdDeckControlStatusRemoteMode	= ( 1 << 1 ) ,

+        bmdDeckControlStatusRecordInhibited	= ( 1 << 2 ) ,

+        bmdDeckControlStatusCassetteOut	= ( 1 << 3 ) 

+    } ;

+/* [v1_enum] */ 

+enum _BMDDeckControlExportModeOpsFlags

+    {

+        bmdDeckControlExportModeInsertVideo	= ( 1 << 0 ) ,

+        bmdDeckControlExportModeInsertAudio1	= ( 1 << 1 ) ,

+        bmdDeckControlExportModeInsertAudio2	= ( 1 << 2 ) ,

+        bmdDeckControlExportModeInsertAudio3	= ( 1 << 3 ) ,

+        bmdDeckControlExportModeInsertAudio4	= ( 1 << 4 ) ,

+        bmdDeckControlExportModeInsertAudio5	= ( 1 << 5 ) ,

+        bmdDeckControlExportModeInsertAudio6	= ( 1 << 6 ) ,

+        bmdDeckControlExportModeInsertAudio7	= ( 1 << 7 ) ,

+        bmdDeckControlExportModeInsertAudio8	= ( 1 << 8 ) ,

+        bmdDeckControlExportModeInsertAudio9	= ( 1 << 9 ) ,

+        bmdDeckControlExportModeInsertAudio10	= ( 1 << 10 ) ,

+        bmdDeckControlExportModeInsertAudio11	= ( 1 << 11 ) ,

+        bmdDeckControlExportModeInsertAudio12	= ( 1 << 12 ) ,

+        bmdDeckControlExportModeInsertTimeCode	= ( 1 << 13 ) ,

+        bmdDeckControlExportModeInsertAssemble	= ( 1 << 14 ) ,

+        bmdDeckControlExportModeInsertPreview	= ( 1 << 15 ) ,

+        bmdDeckControlUseManualExport	= ( 1 << 16 ) 

+    } ;

+typedef /* [v1_enum] */ 

+enum _BMDDeckControlError

+    {

+        bmdDeckControlNoError	= 0x6e6f6572,

+        bmdDeckControlModeError	= 0x6d6f6572,

+        bmdDeckControlMissedInPointError	= 0x6d696572,

+        bmdDeckControlDeckTimeoutError	= 0x64746572,

+        bmdDeckControlCommandFailedError	= 0x63666572,

+        bmdDeckControlDeviceAlreadyOpenedError	= 0x64616c6f,

+        bmdDeckControlFailedToOpenDeviceError	= 0x66646572,

+        bmdDeckControlInLocalModeError	= 0x6c6d6572,

+        bmdDeckControlEndOfTapeError	= 0x65746572,

+        bmdDeckControlUserAbortError	= 0x75616572,

+        bmdDeckControlNoTapeInDeckError	= 0x6e746572,

+        bmdDeckControlNoVideoFromCardError	= 0x6e766663,

+        bmdDeckControlNoCommunicationError	= 0x6e636f6d,

+        bmdDeckControlBufferTooSmallError	= 0x6274736d,

+        bmdDeckControlBadChecksumError	= 0x63686b73,

+        bmdDeckControlUnknownError	= 0x756e6572

+    } 	BMDDeckControlError;

+

+

+

+#if 0

+#endif

+typedef /* [v1_enum] */ 

+enum _BMDStreamingDeviceMode

+    {

+        bmdStreamingDeviceIdle	= 0x69646c65,

+        bmdStreamingDeviceEncoding	= 0x656e636f,

+        bmdStreamingDeviceStopping	= 0x73746f70,

+        bmdStreamingDeviceUnknown	= 0x6d756e6b

+    } 	BMDStreamingDeviceMode;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingEncodingFrameRate

+    {

+        bmdStreamingEncodedFrameRate50i	= 0x65353069,

+        bmdStreamingEncodedFrameRate5994i	= 0x65353969,

+        bmdStreamingEncodedFrameRate60i	= 0x65363069,

+        bmdStreamingEncodedFrameRate2398p	= 0x65323370,

+        bmdStreamingEncodedFrameRate24p	= 0x65323470,

+        bmdStreamingEncodedFrameRate25p	= 0x65323570,

+        bmdStreamingEncodedFrameRate2997p	= 0x65323970,

+        bmdStreamingEncodedFrameRate30p	= 0x65333070,

+        bmdStreamingEncodedFrameRate50p	= 0x65353070,

+        bmdStreamingEncodedFrameRate5994p	= 0x65353970,

+        bmdStreamingEncodedFrameRate60p	= 0x65363070

+    } 	BMDStreamingEncodingFrameRate;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingEncodingSupport

+    {

+        bmdStreamingEncodingModeNotSupported	= 0,

+        bmdStreamingEncodingModeSupported	= ( bmdStreamingEncodingModeNotSupported + 1 ) ,

+        bmdStreamingEncodingModeSupportedWithChanges	= ( bmdStreamingEncodingModeSupported + 1 ) 

+    } 	BMDStreamingEncodingSupport;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingVideoCodec

+    {

+        bmdStreamingVideoCodecH264	= 0x48323634

+    } 	BMDStreamingVideoCodec;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingH264Profile

+    {

+        bmdStreamingH264ProfileHigh	= 0x68696768,

+        bmdStreamingH264ProfileMain	= 0x6d61696e,

+        bmdStreamingH264ProfileBaseline	= 0x62617365

+    } 	BMDStreamingH264Profile;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingH264Level

+    {

+        bmdStreamingH264Level12	= 0x6c763132,

+        bmdStreamingH264Level13	= 0x6c763133,

+        bmdStreamingH264Level2	= 0x6c763220,

+        bmdStreamingH264Level21	= 0x6c763231,

+        bmdStreamingH264Level22	= 0x6c763232,

+        bmdStreamingH264Level3	= 0x6c763320,

+        bmdStreamingH264Level31	= 0x6c763331,

+        bmdStreamingH264Level32	= 0x6c763332,

+        bmdStreamingH264Level4	= 0x6c763420,

+        bmdStreamingH264Level41	= 0x6c763431,

+        bmdStreamingH264Level42	= 0x6c763432

+    } 	BMDStreamingH264Level;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingH264EntropyCoding

+    {

+        bmdStreamingH264EntropyCodingCAVLC	= 0x45564c43,

+        bmdStreamingH264EntropyCodingCABAC	= 0x45424143

+    } 	BMDStreamingH264EntropyCoding;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingAudioCodec

+    {

+        bmdStreamingAudioCodecAAC	= 0x41414320

+    } 	BMDStreamingAudioCodec;

+

+typedef /* [v1_enum] */ 

+enum _BMDStreamingEncodingModePropertyID

+    {

+        bmdStreamingEncodingPropertyVideoFrameRate	= 0x76667274,

+        bmdStreamingEncodingPropertyVideoBitRateKbps	= 0x76627274,

+        bmdStreamingEncodingPropertyH264Profile	= 0x68707266,

+        bmdStreamingEncodingPropertyH264Level	= 0x686c766c,

+        bmdStreamingEncodingPropertyH264EntropyCoding	= 0x68656e74,

+        bmdStreamingEncodingPropertyH264HasBFrames	= 0x68426672,

+        bmdStreamingEncodingPropertyAudioCodec	= 0x61636463,

+        bmdStreamingEncodingPropertyAudioSampleRate	= 0x61737274,

+        bmdStreamingEncodingPropertyAudioChannelCount	= 0x61636863,

+        bmdStreamingEncodingPropertyAudioBitRateKbps	= 0x61627274

+    } 	BMDStreamingEncodingModePropertyID;

+

+

+

+

+

+

+

+

+

+

+

+

+typedef unsigned long BMDFrameFlags;

+typedef unsigned long BMDVideoInputFlags;

+typedef unsigned long BMDVideoInputFormatChangedEvents;

+typedef unsigned long BMDDetectedVideoInputFormatFlags;

+typedef unsigned long BMDDeckLinkCapturePassthroughMode;

+typedef unsigned long BMDAnalogVideoFlags;

+typedef unsigned long BMDDeviceBusyState;

+#if 0

+typedef enum _BMDFrameFlags BMDFrameFlags;

+

+typedef enum _BMDVideoInputFlags BMDVideoInputFlags;

+

+typedef enum _BMDVideoInputFormatChangedEvents BMDVideoInputFormatChangedEvents;

+

+typedef enum _BMDDetectedVideoInputFormatFlags BMDDetectedVideoInputFormatFlags;

+

+typedef enum _BMDDeckLinkCapturePassthroughMode BMDDeckLinkCapturePassthroughMode;

+

+typedef enum _BMDAnalogVideoFlags BMDAnalogVideoFlags;

+

+typedef enum _BMDDeviceBusyState BMDDeviceBusyState;

+

+#endif

+typedef /* [v1_enum] */ 

+enum _BMDVideoOutputFlags

+    {

+        bmdVideoOutputFlagDefault	= 0,

+        bmdVideoOutputVANC	= ( 1 << 0 ) ,

+        bmdVideoOutputVITC	= ( 1 << 1 ) ,

+        bmdVideoOutputRP188	= ( 1 << 2 ) ,

+        bmdVideoOutputDualStream3D	= ( 1 << 4 ) 

+    } 	BMDVideoOutputFlags;

+

+/* [v1_enum] */ 

+enum _BMDFrameFlags

+    {

+        bmdFrameFlagDefault	= 0,

+        bmdFrameFlagFlipVertical	= ( 1 << 0 ) ,

+        bmdFrameHasNoInputSource	= ( 1 << 31 ) 

+    } ;

+/* [v1_enum] */ 

+enum _BMDVideoInputFlags

+    {

+        bmdVideoInputFlagDefault	= 0,

+        bmdVideoInputEnableFormatDetection	= ( 1 << 0 ) ,

+        bmdVideoInputDualStream3D	= ( 1 << 1 ) 

+    } ;

+/* [v1_enum] */ 

+enum _BMDVideoInputFormatChangedEvents

+    {

+        bmdVideoInputDisplayModeChanged	= ( 1 << 0 ) ,

+        bmdVideoInputFieldDominanceChanged	= ( 1 << 1 ) ,

+        bmdVideoInputColorspaceChanged	= ( 1 << 2 ) 

+    } ;

+/* [v1_enum] */ 

+enum _BMDDetectedVideoInputFormatFlags

+    {

+        bmdDetectedVideoInputYCbCr422	= ( 1 << 0 ) ,

+        bmdDetectedVideoInputRGB444	= ( 1 << 1 ) ,

+        bmdDetectedVideoInputDualStream3D	= ( 1 << 2 ) 

+    } ;

+/* [v1_enum] */ 

+enum _BMDDeckLinkCapturePassthroughMode

+    {

+        bmdDeckLinkCapturePassthroughModeDirect	= 0x70646972,

+        bmdDeckLinkCapturePassthroughModeCleanSwitch	= 0x70636c6e

+    } ;

+typedef /* [v1_enum] */ 

+enum _BMDOutputFrameCompletionResult

+    {

+        bmdOutputFrameCompleted	= 0,

+        bmdOutputFrameDisplayedLate	= ( bmdOutputFrameCompleted + 1 ) ,

+        bmdOutputFrameDropped	= ( bmdOutputFrameDisplayedLate + 1 ) ,

+        bmdOutputFrameFlushed	= ( bmdOutputFrameDropped + 1 ) 

+    } 	BMDOutputFrameCompletionResult;

+

+typedef /* [v1_enum] */ 

+enum _BMDReferenceStatus

+    {

+        bmdReferenceNotSupportedByHardware	= ( 1 << 0 ) ,

+        bmdReferenceLocked	= ( 1 << 1 ) 

+    } 	BMDReferenceStatus;

+

+typedef /* [v1_enum] */ 

+enum _BMDAudioSampleRate

+    {

+        bmdAudioSampleRate48kHz	= 48000

+    } 	BMDAudioSampleRate;

+

+typedef /* [v1_enum] */ 

+enum _BMDAudioSampleType

+    {

+        bmdAudioSampleType16bitInteger	= 16,

+        bmdAudioSampleType32bitInteger	= 32

+    } 	BMDAudioSampleType;

+

+typedef /* [v1_enum] */ 

+enum _BMDAudioOutputStreamType

+    {

+        bmdAudioOutputStreamContinuous	= 0,

+        bmdAudioOutputStreamContinuousDontResample	= ( bmdAudioOutputStreamContinuous + 1 ) ,

+        bmdAudioOutputStreamTimestamped	= ( bmdAudioOutputStreamContinuousDontResample + 1 ) 

+    } 	BMDAudioOutputStreamType;

+

+typedef /* [v1_enum] */ 

+enum _BMDDisplayModeSupport

+    {

+        bmdDisplayModeNotSupported	= 0,

+        bmdDisplayModeSupported	= ( bmdDisplayModeNotSupported + 1 ) ,

+        bmdDisplayModeSupportedWithConversion	= ( bmdDisplayModeSupported + 1 ) 

+    } 	BMDDisplayModeSupport;

+

+typedef /* [v1_enum] */ 

+enum _BMDTimecodeFormat

+    {

+        bmdTimecodeRP188VITC1	= 0x72707631,

+        bmdTimecodeRP188VITC2	= 0x72703132,

+        bmdTimecodeRP188LTC	= 0x72706c74,

+        bmdTimecodeRP188Any	= 0x72703138,

+        bmdTimecodeVITC	= 0x76697463,

+        bmdTimecodeVITCField2	= 0x76697432,

+        bmdTimecodeSerial	= 0x73657269

+    } 	BMDTimecodeFormat;

+

+/* [v1_enum] */ 

+enum _BMDAnalogVideoFlags

+    {

+        bmdAnalogVideoFlagCompositeSetup75	= ( 1 << 0 ) ,

+        bmdAnalogVideoFlagComponentBetacamLevels	= ( 1 << 1 ) 

+    } ;

+typedef /* [v1_enum] */ 

+enum _BMDAudioOutputAnalogAESSwitch

+    {

+        bmdAudioOutputSwitchAESEBU	= 0x61657320,

+        bmdAudioOutputSwitchAnalog	= 0x616e6c67

+    } 	BMDAudioOutputAnalogAESSwitch;

+

+typedef /* [v1_enum] */ 

+enum _BMDVideoOutputConversionMode

+    {

+        bmdNoVideoOutputConversion	= 0x6e6f6e65,

+        bmdVideoOutputLetterboxDownconversion	= 0x6c746278,

+        bmdVideoOutputAnamorphicDownconversion	= 0x616d7068,

+        bmdVideoOutputHD720toHD1080Conversion	= 0x37323063,

+        bmdVideoOutputHardwareLetterboxDownconversion	= 0x48576c62,

+        bmdVideoOutputHardwareAnamorphicDownconversion	= 0x4857616d,

+        bmdVideoOutputHardwareCenterCutDownconversion	= 0x48576363,

+        bmdVideoOutputHardware720p1080pCrossconversion	= 0x78636170,

+        bmdVideoOutputHardwareAnamorphic720pUpconversion	= 0x75613770,

+        bmdVideoOutputHardwareAnamorphic1080iUpconversion	= 0x75613169,

+        bmdVideoOutputHardwareAnamorphic149To720pUpconversion	= 0x75343770,

+        bmdVideoOutputHardwareAnamorphic149To1080iUpconversion	= 0x75343169,

+        bmdVideoOutputHardwarePillarbox720pUpconversion	= 0x75703770,

+        bmdVideoOutputHardwarePillarbox1080iUpconversion	= 0x75703169

+    } 	BMDVideoOutputConversionMode;

+

+typedef /* [v1_enum] */ 

+enum _BMDVideoInputConversionMode

+    {

+        bmdNoVideoInputConversion	= 0x6e6f6e65,

+        bmdVideoInputLetterboxDownconversionFromHD1080	= 0x31306c62,

+        bmdVideoInputAnamorphicDownconversionFromHD1080	= 0x3130616d,

+        bmdVideoInputLetterboxDownconversionFromHD720	= 0x37326c62,

+        bmdVideoInputAnamorphicDownconversionFromHD720	= 0x3732616d,

+        bmdVideoInputLetterboxUpconversion	= 0x6c627570,

+        bmdVideoInputAnamorphicUpconversion	= 0x616d7570

+    } 	BMDVideoInputConversionMode;

+

+typedef /* [v1_enum] */ 

+enum _BMDVideo3DPackingFormat

+    {

+        bmdVideo3DPackingSidebySideHalf	= 0x73627368,

+        bmdVideo3DPackingLinebyLine	= 0x6c62796c,

+        bmdVideo3DPackingTopAndBottom	= 0x7461626f,

+        bmdVideo3DPackingFramePacking	= 0x6672706b,

+        bmdVideo3DPackingLeftOnly	= 0x6c656674,

+        bmdVideo3DPackingRightOnly	= 0x72696768

+    } 	BMDVideo3DPackingFormat;

+

+typedef /* [v1_enum] */ 

+enum _BMDIdleVideoOutputOperation

+    {

+        bmdIdleVideoOutputBlack	= 0x626c6163,

+        bmdIdleVideoOutputLastFrame	= 0x6c616661,

+        bmdIdleVideoOutputDesktop	= 0x6465736b

+    } 	BMDIdleVideoOutputOperation;

+

+typedef /* [v1_enum] */ 

+enum _BMDDeckLinkAttributeID

+    {

+        BMDDeckLinkSupportsInternalKeying	= 0x6b657969,

+        BMDDeckLinkSupportsExternalKeying	= 0x6b657965,

+        BMDDeckLinkSupportsHDKeying	= 0x6b657968,

+        BMDDeckLinkSupportsInputFormatDetection	= 0x696e6664,

+        BMDDeckLinkHasReferenceInput	= 0x6872696e,

+        BMDDeckLinkHasSerialPort	= 0x68737074,

+        BMDDeckLinkHasAnalogVideoOutputGain	= 0x61766f67,

+        BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain	= 0x6f766f67,

+        BMDDeckLinkHasVideoInputAntiAliasingFilter	= 0x6161666c,

+        BMDDeckLinkHasBypass	= 0x62797073,

+        BMDDeckLinkSupportsDesktopDisplay	= 0x65787464,

+        BMDDeckLinkSupportsClockTimingAdjustment	= 0x63746164,

+        BMDDeckLinkSupportsFullDuplex	= 0x66647570,

+        BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset	= 0x6672696e,

+        BMDDeckLinkMaximumAudioChannels	= 0x6d616368,

+        BMDDeckLinkMaximumAnalogAudioChannels	= 0x61616368,

+        BMDDeckLinkNumberOfSubDevices	= 0x6e736264,

+        BMDDeckLinkSubDeviceIndex	= 0x73756269,

+        BMDDeckLinkPersistentID	= 0x70656964,

+        BMDDeckLinkTopologicalID	= 0x746f6964,

+        BMDDeckLinkVideoOutputConnections	= 0x766f636e,

+        BMDDeckLinkVideoInputConnections	= 0x7669636e,

+        BMDDeckLinkAudioOutputConnections	= 0x616f636e,

+        BMDDeckLinkAudioInputConnections	= 0x6169636e,

+        BMDDeckLinkDeviceBusyState	= 0x64627374,

+        BMDDeckLinkVideoIOSupport	= 0x76696f73,

+        BMDDeckLinkVideoInputGainMinimum	= 0x7669676d,

+        BMDDeckLinkVideoInputGainMaximum	= 0x76696778,

+        BMDDeckLinkVideoOutputGainMinimum	= 0x766f676d,

+        BMDDeckLinkVideoOutputGainMaximum	= 0x766f6778,

+        BMDDeckLinkSerialPortDeviceName	= 0x736c706e

+    } 	BMDDeckLinkAttributeID;

+

+typedef /* [v1_enum] */ 

+enum _BMDDeckLinkAPIInformationID

+    {

+        BMDDeckLinkAPIVersion	= 0x76657273

+    } 	BMDDeckLinkAPIInformationID;

+

+/* [v1_enum] */ 

+enum _BMDDeviceBusyState

+    {

+        bmdDeviceCaptureBusy	= ( 1 << 0 ) ,

+        bmdDevicePlaybackBusy	= ( 1 << 1 ) ,

+        bmdDeviceSerialPortBusy	= ( 1 << 2 ) 

+    } ;

+typedef /* [v1_enum] */ 

+enum _BMDVideoIOSupport

+    {

+        bmdDeviceSupportsCapture	= ( 1 << 0 ) ,

+        bmdDeviceSupportsPlayback	= ( 1 << 1 ) 

+    } 	BMDVideoIOSupport;

+

+typedef /* [v1_enum] */ 

+enum _BMD3DPreviewFormat

+    {

+        bmd3DPreviewFormatDefault	= 0x64656661,

+        bmd3DPreviewFormatLeftOnly	= 0x6c656674,

+        bmd3DPreviewFormatRightOnly	= 0x72696768,

+        bmd3DPreviewFormatSideBySide	= 0x73696465,

+        bmd3DPreviewFormatTopBottom	= 0x746f7062

+    } 	BMD3DPreviewFormat;

+

+typedef /* [v1_enum] */ 

+enum _BMDNotifications

+    {

+        bmdPreferencesChanged	= 0x70726566

+    } 	BMDNotifications;

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+typedef /* [v1_enum] */ 

+enum _BMDDeckLinkConfigurationID_v10_2

+    {

+        bmdDeckLinkConfig3GBpsVideoOutput_v10_2	= 0x33676273

+    } 	BMDDeckLinkConfigurationID_v10_2;

+

+typedef /* [v1_enum] */ 

+enum _BMDAudioConnection_v10_2

+    {

+        bmdAudioConnectionEmbedded_v10_2	= 0x656d6264,

+        bmdAudioConnectionAESEBU_v10_2	= 0x61657320,

+        bmdAudioConnectionAnalog_v10_2	= 0x616e6c67,

+        bmdAudioConnectionAnalogXLR_v10_2	= 0x61786c72,

+        bmdAudioConnectionAnalogRCA_v10_2	= 0x61726361

+    } 	BMDAudioConnection_v10_2;

+

+

+typedef /* [v1_enum] */ 

+enum _BMDDeckControlVTRControlState_v8_1

+    {

+        bmdDeckControlNotInVTRControlMode_v8_1	= 0x6e76636d,

+        bmdDeckControlVTRControlPlaying_v8_1	= 0x76747270,

+        bmdDeckControlVTRControlRecording_v8_1	= 0x76747272,

+        bmdDeckControlVTRControlStill_v8_1	= 0x76747261,

+        bmdDeckControlVTRControlSeeking_v8_1	= 0x76747273,

+        bmdDeckControlVTRControlStopped_v8_1	= 0x7674726f

+    } 	BMDDeckControlVTRControlState_v8_1;

+

+

+

+typedef /* [v1_enum] */ 

+enum _BMDVideoConnection_v7_6

+    {

+        bmdVideoConnectionSDI_v7_6	= 0x73646920,

+        bmdVideoConnectionHDMI_v7_6	= 0x68646d69,

+        bmdVideoConnectionOpticalSDI_v7_6	= 0x6f707469,

+        bmdVideoConnectionComponent_v7_6	= 0x63706e74,

+        bmdVideoConnectionComposite_v7_6	= 0x636d7374,

+        bmdVideoConnectionSVideo_v7_6	= 0x73766964

+    } 	BMDVideoConnection_v7_6;

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+EXTERN_C const IID LIBID_DeckLinkAPI;

+

+#ifndef __IDeckLinkTimecode_INTERFACE_DEFINED__

+#define __IDeckLinkTimecode_INTERFACE_DEFINED__

+

+/* interface IDeckLinkTimecode */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkTimecode;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("BC6CFBD3-8317-4325-AC1C-1216391E9340")

+    IDeckLinkTimecode : public IUnknown

+    {

+    public:

+        virtual BMDTimecodeBCD STDMETHODCALLTYPE GetBCD( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetComponents( 

+            /* [out] */ unsigned char *hours,

+            /* [out] */ unsigned char *minutes,

+            /* [out] */ unsigned char *seconds,

+            /* [out] */ unsigned char *frames) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetString( 

+            /* [out] */ BSTR *timecode) = 0;

+        

+        virtual BMDTimecodeFlags STDMETHODCALLTYPE GetFlags( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecodeUserBits( 

+            /* [out] */ BMDTimecodeUserBits *userBits) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkTimecodeVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkTimecode * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkTimecode * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkTimecode * This);

+        

+        BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( 

+            IDeckLinkTimecode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetComponents )( 

+            IDeckLinkTimecode * This,

+            /* [out] */ unsigned char *hours,

+            /* [out] */ unsigned char *minutes,

+            /* [out] */ unsigned char *seconds,

+            /* [out] */ unsigned char *frames);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IDeckLinkTimecode * This,

+            /* [out] */ BSTR *timecode);

+        

+        BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkTimecode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecodeUserBits )( 

+            IDeckLinkTimecode * This,

+            /* [out] */ BMDTimecodeUserBits *userBits);

+        

+        END_INTERFACE

+    } IDeckLinkTimecodeVtbl;

+

+    interface IDeckLinkTimecode

+    {

+        CONST_VTBL struct IDeckLinkTimecodeVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkTimecode_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkTimecode_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkTimecode_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkTimecode_GetBCD(This)	\

+    ( (This)->lpVtbl -> GetBCD(This) ) 

+

+#define IDeckLinkTimecode_GetComponents(This,hours,minutes,seconds,frames)	\

+    ( (This)->lpVtbl -> GetComponents(This,hours,minutes,seconds,frames) ) 

+

+#define IDeckLinkTimecode_GetString(This,timecode)	\

+    ( (This)->lpVtbl -> GetString(This,timecode) ) 

+

+#define IDeckLinkTimecode_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkTimecode_GetTimecodeUserBits(This,userBits)	\

+    ( (This)->lpVtbl -> GetTimecodeUserBits(This,userBits) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkTimecode_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__

+#define __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDisplayModeIterator */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDisplayModeIterator;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("9C88499F-F601-4021-B80B-032E4EB41C35")

+    IDeckLinkDisplayModeIterator : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Next( 

+            /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDisplayModeIteratorVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDisplayModeIterator * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDisplayModeIterator * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDisplayModeIterator * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Next )( 

+            IDeckLinkDisplayModeIterator * This,

+            /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode);

+        

+        END_INTERFACE

+    } IDeckLinkDisplayModeIteratorVtbl;

+

+    interface IDeckLinkDisplayModeIterator

+    {

+        CONST_VTBL struct IDeckLinkDisplayModeIteratorVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDisplayModeIterator_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDisplayModeIterator_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDisplayModeIterator_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDisplayModeIterator_Next(This,deckLinkDisplayMode)	\

+    ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayMode_INTERFACE_DEFINED__

+#define __IDeckLinkDisplayMode_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDisplayMode */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDisplayMode;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78")

+    IDeckLinkDisplayMode : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetName( 

+            /* [out] */ BSTR *name) = 0;

+        

+        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFrameRate( 

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [out] */ BMDTimeScale *timeScale) = 0;

+        

+        virtual BMDFieldDominance STDMETHODCALLTYPE GetFieldDominance( void) = 0;

+        

+        virtual BMDDisplayModeFlags STDMETHODCALLTYPE GetFlags( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDisplayModeVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDisplayMode * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDisplayMode * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDisplayMode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetName )( 

+            IDeckLinkDisplayMode * This,

+            /* [out] */ BSTR *name);

+        

+        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 

+            IDeckLinkDisplayMode * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkDisplayMode * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkDisplayMode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( 

+            IDeckLinkDisplayMode * This,

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [out] */ BMDTimeScale *timeScale);

+        

+        BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( 

+            IDeckLinkDisplayMode * This);

+        

+        BMDDisplayModeFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkDisplayMode * This);

+        

+        END_INTERFACE

+    } IDeckLinkDisplayModeVtbl;

+

+    interface IDeckLinkDisplayMode

+    {

+        CONST_VTBL struct IDeckLinkDisplayModeVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDisplayMode_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDisplayMode_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDisplayMode_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDisplayMode_GetName(This,name)	\

+    ( (This)->lpVtbl -> GetName(This,name) ) 

+

+#define IDeckLinkDisplayMode_GetDisplayMode(This)	\

+    ( (This)->lpVtbl -> GetDisplayMode(This) ) 

+

+#define IDeckLinkDisplayMode_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkDisplayMode_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkDisplayMode_GetFrameRate(This,frameDuration,timeScale)	\

+    ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) 

+

+#define IDeckLinkDisplayMode_GetFieldDominance(This)	\

+    ( (This)->lpVtbl -> GetFieldDominance(This) ) 

+

+#define IDeckLinkDisplayMode_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDisplayMode_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLink_INTERFACE_DEFINED__

+#define __IDeckLink_INTERFACE_DEFINED__

+

+/* interface IDeckLink */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLink;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("C418FBDD-0587-48ED-8FE5-640F0A14AF91")

+    IDeckLink : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetModelName( 

+            /* [out] */ BSTR *modelName) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayName( 

+            /* [out] */ BSTR *displayName) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLink * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLink * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLink * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetModelName )( 

+            IDeckLink * This,

+            /* [out] */ BSTR *modelName);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( 

+            IDeckLink * This,

+            /* [out] */ BSTR *displayName);

+        

+        END_INTERFACE

+    } IDeckLinkVtbl;

+

+    interface IDeckLink

+    {

+        CONST_VTBL struct IDeckLinkVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLink_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLink_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLink_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLink_GetModelName(This,modelName)	\

+    ( (This)->lpVtbl -> GetModelName(This,modelName) ) 

+

+#define IDeckLink_GetDisplayName(This,displayName)	\

+    ( (This)->lpVtbl -> GetDisplayName(This,displayName) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLink_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkConfiguration_INTERFACE_DEFINED__

+#define __IDeckLinkConfiguration_INTERFACE_DEFINED__

+

+/* interface IDeckLinkConfiguration */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkConfiguration;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("1E69FCF6-4203-4936-8076-2A9F4CFD50CB")

+    IDeckLinkConfiguration : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE SetFlag( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BOOL value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFlag( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BOOL *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetInt( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ LONGLONG value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetInt( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ LONGLONG *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetFloat( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ double value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFloat( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ double *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetString( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BSTR value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetString( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BSTR *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkConfigurationVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkConfiguration * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkConfiguration * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFlag )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BOOL value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BOOL *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetInt )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ LONGLONG value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetInt )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ LONGLONG *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFloat )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ double value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ double *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetString )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BSTR value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IDeckLinkConfiguration * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BSTR *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( 

+            IDeckLinkConfiguration * This);

+        

+        END_INTERFACE

+    } IDeckLinkConfigurationVtbl;

+

+    interface IDeckLinkConfiguration

+    {

+        CONST_VTBL struct IDeckLinkConfigurationVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkConfiguration_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkConfiguration_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkConfiguration_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkConfiguration_SetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_GetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_SetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_GetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_SetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_GetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_SetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetString(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_GetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_WriteConfigurationToPreferences(This)	\

+    ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkConfiguration_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__

+#define __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDeckControlStatusCallback */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDeckControlStatusCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("53436FFB-B434-4906-BADC-AE3060FFE8EF")

+    IDeckLinkDeckControlStatusCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE TimecodeUpdate( 

+            /* [in] */ BMDTimecodeBCD currentTimecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE VTRControlStateChanged( 

+            /* [in] */ BMDDeckControlVTRControlState newState,

+            /* [in] */ BMDDeckControlError error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DeckControlEventReceived( 

+            /* [in] */ BMDDeckControlEvent event,

+            /* [in] */ BMDDeckControlError error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DeckControlStatusChanged( 

+            /* [in] */ BMDDeckControlStatusFlags flags,

+            /* [in] */ unsigned long mask) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDeckControlStatusCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDeckControlStatusCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDeckControlStatusCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDeckControlStatusCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *TimecodeUpdate )( 

+            IDeckLinkDeckControlStatusCallback * This,

+            /* [in] */ BMDTimecodeBCD currentTimecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *VTRControlStateChanged )( 

+            IDeckLinkDeckControlStatusCallback * This,

+            /* [in] */ BMDDeckControlVTRControlState newState,

+            /* [in] */ BMDDeckControlError error);

+        

+        HRESULT ( STDMETHODCALLTYPE *DeckControlEventReceived )( 

+            IDeckLinkDeckControlStatusCallback * This,

+            /* [in] */ BMDDeckControlEvent event,

+            /* [in] */ BMDDeckControlError error);

+        

+        HRESULT ( STDMETHODCALLTYPE *DeckControlStatusChanged )( 

+            IDeckLinkDeckControlStatusCallback * This,

+            /* [in] */ BMDDeckControlStatusFlags flags,

+            /* [in] */ unsigned long mask);

+        

+        END_INTERFACE

+    } IDeckLinkDeckControlStatusCallbackVtbl;

+

+    interface IDeckLinkDeckControlStatusCallback

+    {

+        CONST_VTBL struct IDeckLinkDeckControlStatusCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDeckControlStatusCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDeckControlStatusCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDeckControlStatusCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDeckControlStatusCallback_TimecodeUpdate(This,currentTimecode)	\

+    ( (This)->lpVtbl -> TimecodeUpdate(This,currentTimecode) ) 

+

+#define IDeckLinkDeckControlStatusCallback_VTRControlStateChanged(This,newState,error)	\

+    ( (This)->lpVtbl -> VTRControlStateChanged(This,newState,error) ) 

+

+#define IDeckLinkDeckControlStatusCallback_DeckControlEventReceived(This,event,error)	\

+    ( (This)->lpVtbl -> DeckControlEventReceived(This,event,error) ) 

+

+#define IDeckLinkDeckControlStatusCallback_DeckControlStatusChanged(This,flags,mask)	\

+    ( (This)->lpVtbl -> DeckControlStatusChanged(This,flags,mask) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControl_INTERFACE_DEFINED__

+#define __IDeckLinkDeckControl_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDeckControl */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDeckControl;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("8E1C3ACE-19C7-4E00-8B92-D80431D958BE")

+    IDeckLinkDeckControl : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Open( 

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ BMDTimeValue timeValue,

+            /* [in] */ BOOL timecodeIsDropFrame,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Close( 

+            /* [in] */ BOOL standbyOn) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetCurrentState( 

+            /* [out] */ BMDDeckControlMode *mode,

+            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,

+            /* [out] */ BMDDeckControlStatusFlags *flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetStandby( 

+            /* [in] */ BOOL standbyOn) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SendCommand( 

+            /* [in] */ unsigned char *inBuffer,

+            /* [in] */ unsigned long inBufferSize,

+            /* [out] */ unsigned char *outBuffer,

+            /* [out] */ unsigned long *outDataSize,

+            /* [in] */ unsigned long outBufferSize,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Play( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Stop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Eject( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GoToTimecode( 

+            /* [in] */ BMDTimecodeBCD timecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FastForward( 

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Rewind( 

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StepForward( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StepBack( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Jog( 

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Shuttle( 

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( 

+            /* [out] */ BSTR *currentTimeCode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 

+            /* [out] */ IDeckLinkTimecode **currentTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( 

+            /* [out] */ BMDTimecodeBCD *currentTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetPreroll( 

+            /* [in] */ unsigned long prerollSeconds) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetPreroll( 

+            /* [out] */ unsigned long *prerollSeconds) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetExportOffset( 

+            /* [in] */ long exportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetExportOffset( 

+            /* [out] */ long *exportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( 

+            /* [out] */ long *deckManualExportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( 

+            /* [in] */ long captureOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( 

+            /* [out] */ long *captureOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartExport( 

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartCapture( 

+            /* [in] */ BOOL useVITC,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDeviceID( 

+            /* [out] */ unsigned short *deviceId,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkDeckControlStatusCallback *callback) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDeckControlVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDeckControl * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDeckControl * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Open )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ BMDTimeValue timeValue,

+            /* [in] */ BOOL timecodeIsDropFrame,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Close )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BOOL standbyOn);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlMode *mode,

+            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,

+            /* [out] */ BMDDeckControlStatusFlags *flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetStandby )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BOOL standbyOn);

+        

+        HRESULT ( STDMETHODCALLTYPE *SendCommand )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ unsigned char *inBuffer,

+            /* [in] */ unsigned long inBufferSize,

+            /* [out] */ unsigned char *outBuffer,

+            /* [out] */ unsigned long *outDataSize,

+            /* [in] */ unsigned long outBufferSize,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Play )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Stop )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Eject )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BMDTimecodeBCD timecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *FastForward )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Rewind )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StepForward )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StepBack )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Jog )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Shuttle )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BSTR *currentTimeCode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ IDeckLinkTimecode **currentTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDTimecodeBCD *currentTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetPreroll )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ unsigned long prerollSeconds);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetPreroll )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ unsigned long *prerollSeconds);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ long exportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ long *exportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ long *deckManualExportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ long captureOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ long *captureOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartExport )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartCapture )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ BOOL useVITC,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ unsigned short *deviceId,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Abort )( 

+            IDeckLinkDeckControl * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( 

+            IDeckLinkDeckControl * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkDeckControl * This,

+            /* [in] */ IDeckLinkDeckControlStatusCallback *callback);

+        

+        END_INTERFACE

+    } IDeckLinkDeckControlVtbl;

+

+    interface IDeckLinkDeckControl

+    {

+        CONST_VTBL struct IDeckLinkDeckControlVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDeckControl_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDeckControl_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDeckControl_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDeckControl_Open(This,timeScale,timeValue,timecodeIsDropFrame,error)	\

+    ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) 

+

+#define IDeckLinkDeckControl_Close(This,standbyOn)	\

+    ( (This)->lpVtbl -> Close(This,standbyOn) ) 

+

+#define IDeckLinkDeckControl_GetCurrentState(This,mode,vtrControlState,flags)	\

+    ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) 

+

+#define IDeckLinkDeckControl_SetStandby(This,standbyOn)	\

+    ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) 

+

+#define IDeckLinkDeckControl_SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error)	\

+    ( (This)->lpVtbl -> SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) ) 

+

+#define IDeckLinkDeckControl_Play(This,error)	\

+    ( (This)->lpVtbl -> Play(This,error) ) 

+

+#define IDeckLinkDeckControl_Stop(This,error)	\

+    ( (This)->lpVtbl -> Stop(This,error) ) 

+

+#define IDeckLinkDeckControl_TogglePlayStop(This,error)	\

+    ( (This)->lpVtbl -> TogglePlayStop(This,error) ) 

+

+#define IDeckLinkDeckControl_Eject(This,error)	\

+    ( (This)->lpVtbl -> Eject(This,error) ) 

+

+#define IDeckLinkDeckControl_GoToTimecode(This,timecode,error)	\

+    ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) 

+

+#define IDeckLinkDeckControl_FastForward(This,viewTape,error)	\

+    ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) 

+

+#define IDeckLinkDeckControl_Rewind(This,viewTape,error)	\

+    ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) 

+

+#define IDeckLinkDeckControl_StepForward(This,error)	\

+    ( (This)->lpVtbl -> StepForward(This,error) ) 

+

+#define IDeckLinkDeckControl_StepBack(This,error)	\

+    ( (This)->lpVtbl -> StepBack(This,error) ) 

+

+#define IDeckLinkDeckControl_Jog(This,rate,error)	\

+    ( (This)->lpVtbl -> Jog(This,rate,error) ) 

+

+#define IDeckLinkDeckControl_Shuttle(This,rate,error)	\

+    ( (This)->lpVtbl -> Shuttle(This,rate,error) ) 

+

+#define IDeckLinkDeckControl_GetTimecodeString(This,currentTimeCode,error)	\

+    ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) 

+

+#define IDeckLinkDeckControl_GetTimecode(This,currentTimecode,error)	\

+    ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) 

+

+#define IDeckLinkDeckControl_GetTimecodeBCD(This,currentTimecode,error)	\

+    ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) 

+

+#define IDeckLinkDeckControl_SetPreroll(This,prerollSeconds)	\

+    ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) 

+

+#define IDeckLinkDeckControl_GetPreroll(This,prerollSeconds)	\

+    ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) 

+

+#define IDeckLinkDeckControl_SetExportOffset(This,exportOffsetFields)	\

+    ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_GetExportOffset(This,exportOffsetFields)	\

+    ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_GetManualExportOffset(This,deckManualExportOffsetFields)	\

+    ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_SetCaptureOffset(This,captureOffsetFields)	\

+    ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) 

+

+#define IDeckLinkDeckControl_GetCaptureOffset(This,captureOffsetFields)	\

+    ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) 

+

+#define IDeckLinkDeckControl_StartExport(This,inTimecode,outTimecode,exportModeOps,error)	\

+    ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) 

+

+#define IDeckLinkDeckControl_StartCapture(This,useVITC,inTimecode,outTimecode,error)	\

+    ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) 

+

+#define IDeckLinkDeckControl_GetDeviceID(This,deviceId,error)	\

+    ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) 

+

+#define IDeckLinkDeckControl_Abort(This)	\

+    ( (This)->lpVtbl -> Abort(This) ) 

+

+#define IDeckLinkDeckControl_CrashRecordStart(This,error)	\

+    ( (This)->lpVtbl -> CrashRecordStart(This,error) ) 

+

+#define IDeckLinkDeckControl_CrashRecordStop(This,error)	\

+    ( (This)->lpVtbl -> CrashRecordStop(This,error) ) 

+

+#define IDeckLinkDeckControl_SetCallback(This,callback)	\

+    ( (This)->lpVtbl -> SetCallback(This,callback) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDeckControl_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__

+#define __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingDeviceNotificationCallback */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingDeviceNotificationCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("F9531D64-3305-4B29-A387-7F74BB0D0E84")

+    IBMDStreamingDeviceNotificationCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE StreamingDeviceArrived( 

+            /* [in] */ IDeckLink *device) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StreamingDeviceRemoved( 

+            /* [in] */ IDeckLink *device) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StreamingDeviceModeChanged( 

+            /* [in] */ IDeckLink *device,

+            /* [in] */ BMDStreamingDeviceMode mode) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingDeviceNotificationCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingDeviceNotificationCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingDeviceNotificationCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingDeviceNotificationCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *StreamingDeviceArrived )( 

+            IBMDStreamingDeviceNotificationCallback * This,

+            /* [in] */ IDeckLink *device);

+        

+        HRESULT ( STDMETHODCALLTYPE *StreamingDeviceRemoved )( 

+            IBMDStreamingDeviceNotificationCallback * This,

+            /* [in] */ IDeckLink *device);

+        

+        HRESULT ( STDMETHODCALLTYPE *StreamingDeviceModeChanged )( 

+            IBMDStreamingDeviceNotificationCallback * This,

+            /* [in] */ IDeckLink *device,

+            /* [in] */ BMDStreamingDeviceMode mode);

+        

+        END_INTERFACE

+    } IBMDStreamingDeviceNotificationCallbackVtbl;

+

+    interface IBMDStreamingDeviceNotificationCallback

+    {

+        CONST_VTBL struct IBMDStreamingDeviceNotificationCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingDeviceNotificationCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingDeviceNotificationCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingDeviceNotificationCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceArrived(This,device)	\

+    ( (This)->lpVtbl -> StreamingDeviceArrived(This,device) ) 

+

+#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceRemoved(This,device)	\

+    ( (This)->lpVtbl -> StreamingDeviceRemoved(This,device) ) 

+

+#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceModeChanged(This,device,mode)	\

+    ( (This)->lpVtbl -> StreamingDeviceModeChanged(This,device,mode) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__

+#define __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingH264InputCallback */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingH264InputCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("823C475F-55AE-46F9-890C-537CC5CEDCCA")

+    IBMDStreamingH264InputCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE H264NALPacketArrived( 

+            /* [in] */ IBMDStreamingH264NALPacket *nalPacket) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE H264AudioPacketArrived( 

+            /* [in] */ IBMDStreamingAudioPacket *audioPacket) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE MPEG2TSPacketArrived( 

+            /* [in] */ IBMDStreamingMPEG2TSPacket *tsPacket) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE H264VideoInputConnectorScanningChanged( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE H264VideoInputConnectorChanged( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE H264VideoInputModeChanged( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingH264InputCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingH264InputCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingH264InputCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingH264InputCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *H264NALPacketArrived )( 

+            IBMDStreamingH264InputCallback * This,

+            /* [in] */ IBMDStreamingH264NALPacket *nalPacket);

+        

+        HRESULT ( STDMETHODCALLTYPE *H264AudioPacketArrived )( 

+            IBMDStreamingH264InputCallback * This,

+            /* [in] */ IBMDStreamingAudioPacket *audioPacket);

+        

+        HRESULT ( STDMETHODCALLTYPE *MPEG2TSPacketArrived )( 

+            IBMDStreamingH264InputCallback * This,

+            /* [in] */ IBMDStreamingMPEG2TSPacket *tsPacket);

+        

+        HRESULT ( STDMETHODCALLTYPE *H264VideoInputConnectorScanningChanged )( 

+            IBMDStreamingH264InputCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *H264VideoInputConnectorChanged )( 

+            IBMDStreamingH264InputCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *H264VideoInputModeChanged )( 

+            IBMDStreamingH264InputCallback * This);

+        

+        END_INTERFACE

+    } IBMDStreamingH264InputCallbackVtbl;

+

+    interface IBMDStreamingH264InputCallback

+    {

+        CONST_VTBL struct IBMDStreamingH264InputCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingH264InputCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingH264InputCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingH264InputCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingH264InputCallback_H264NALPacketArrived(This,nalPacket)	\

+    ( (This)->lpVtbl -> H264NALPacketArrived(This,nalPacket) ) 

+

+#define IBMDStreamingH264InputCallback_H264AudioPacketArrived(This,audioPacket)	\

+    ( (This)->lpVtbl -> H264AudioPacketArrived(This,audioPacket) ) 

+

+#define IBMDStreamingH264InputCallback_MPEG2TSPacketArrived(This,tsPacket)	\

+    ( (This)->lpVtbl -> MPEG2TSPacketArrived(This,tsPacket) ) 

+

+#define IBMDStreamingH264InputCallback_H264VideoInputConnectorScanningChanged(This)	\

+    ( (This)->lpVtbl -> H264VideoInputConnectorScanningChanged(This) ) 

+

+#define IBMDStreamingH264InputCallback_H264VideoInputConnectorChanged(This)	\

+    ( (This)->lpVtbl -> H264VideoInputConnectorChanged(This) ) 

+

+#define IBMDStreamingH264InputCallback_H264VideoInputModeChanged(This)	\

+    ( (This)->lpVtbl -> H264VideoInputModeChanged(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingDiscovery_INTERFACE_DEFINED__

+#define __IBMDStreamingDiscovery_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingDiscovery */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingDiscovery;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("2C837444-F989-4D87-901A-47C8A36D096D")

+    IBMDStreamingDiscovery : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE InstallDeviceNotifications( 

+            /* [in] */ IBMDStreamingDeviceNotificationCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE UninstallDeviceNotifications( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingDiscoveryVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingDiscovery * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingDiscovery * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingDiscovery * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *InstallDeviceNotifications )( 

+            IBMDStreamingDiscovery * This,

+            /* [in] */ IBMDStreamingDeviceNotificationCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *UninstallDeviceNotifications )( 

+            IBMDStreamingDiscovery * This);

+        

+        END_INTERFACE

+    } IBMDStreamingDiscoveryVtbl;

+

+    interface IBMDStreamingDiscovery

+    {

+        CONST_VTBL struct IBMDStreamingDiscoveryVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingDiscovery_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingDiscovery_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingDiscovery_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingDiscovery_InstallDeviceNotifications(This,theCallback)	\

+    ( (This)->lpVtbl -> InstallDeviceNotifications(This,theCallback) ) 

+

+#define IBMDStreamingDiscovery_UninstallDeviceNotifications(This)	\

+    ( (This)->lpVtbl -> UninstallDeviceNotifications(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingDiscovery_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__

+#define __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingVideoEncodingMode */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingVideoEncodingMode;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("1AB8035B-CD13-458D-B6DF-5E8F7C2141D9")

+    IBMDStreamingVideoEncodingMode : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetName( 

+            /* [out] */ BSTR *name) = 0;

+        

+        virtual unsigned int STDMETHODCALLTYPE GetPresetID( void) = 0;

+        

+        virtual unsigned int STDMETHODCALLTYPE GetSourcePositionX( void) = 0;

+        

+        virtual unsigned int STDMETHODCALLTYPE GetSourcePositionY( void) = 0;

+        

+        virtual unsigned int STDMETHODCALLTYPE GetSourceWidth( void) = 0;

+        

+        virtual unsigned int STDMETHODCALLTYPE GetSourceHeight( void) = 0;

+        

+        virtual unsigned int STDMETHODCALLTYPE GetDestWidth( void) = 0;

+        

+        virtual unsigned int STDMETHODCALLTYPE GetDestHeight( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFlag( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ BOOL *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetInt( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ LONGLONG *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFloat( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ double *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetString( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ BSTR *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateMutableVideoEncodingMode( 

+            /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingVideoEncodingModeVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingVideoEncodingMode * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetName )( 

+            IBMDStreamingVideoEncodingMode * This,

+            /* [out] */ BSTR *name);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetPresetID )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourcePositionX )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourcePositionY )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourceWidth )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourceHeight )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetDestWidth )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetDestHeight )( 

+            IBMDStreamingVideoEncodingMode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 

+            IBMDStreamingVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ BOOL *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetInt )( 

+            IBMDStreamingVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ LONGLONG *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 

+            IBMDStreamingVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ double *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IBMDStreamingVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ BSTR *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateMutableVideoEncodingMode )( 

+            IBMDStreamingVideoEncodingMode * This,

+            /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode);

+        

+        END_INTERFACE

+    } IBMDStreamingVideoEncodingModeVtbl;

+

+    interface IBMDStreamingVideoEncodingMode

+    {

+        CONST_VTBL struct IBMDStreamingVideoEncodingModeVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingVideoEncodingMode_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingVideoEncodingMode_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingVideoEncodingMode_GetName(This,name)	\

+    ( (This)->lpVtbl -> GetName(This,name) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetPresetID(This)	\

+    ( (This)->lpVtbl -> GetPresetID(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetSourcePositionX(This)	\

+    ( (This)->lpVtbl -> GetSourcePositionX(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetSourcePositionY(This)	\

+    ( (This)->lpVtbl -> GetSourcePositionY(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetSourceWidth(This)	\

+    ( (This)->lpVtbl -> GetSourceWidth(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetSourceHeight(This)	\

+    ( (This)->lpVtbl -> GetSourceHeight(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetDestWidth(This)	\

+    ( (This)->lpVtbl -> GetDestWidth(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetDestHeight(This)	\

+    ( (This)->lpVtbl -> GetDestHeight(This) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 

+

+#define IBMDStreamingVideoEncodingMode_GetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 

+

+#define IBMDStreamingVideoEncodingMode_CreateMutableVideoEncodingMode(This,newEncodingMode)	\

+    ( (This)->lpVtbl -> CreateMutableVideoEncodingMode(This,newEncodingMode) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__

+#define __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingMutableVideoEncodingMode */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingMutableVideoEncodingMode;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("19BF7D90-1E0A-400D-B2C6-FFC4E78AD49D")

+    IBMDStreamingMutableVideoEncodingMode : public IBMDStreamingVideoEncodingMode

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE SetSourceRect( 

+            /* [in] */ unsigned long posX,

+            /* [in] */ unsigned long posY,

+            /* [in] */ unsigned long width,

+            /* [in] */ unsigned long height) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetDestSize( 

+            /* [in] */ unsigned long width,

+            /* [in] */ unsigned long height) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetFlag( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ BOOL value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetInt( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ LONGLONG value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetFloat( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ double value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetString( 

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ BSTR value) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingMutableVideoEncodingModeVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetName )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [out] */ BSTR *name);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetPresetID )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourcePositionX )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourcePositionY )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourceWidth )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetSourceHeight )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetDestWidth )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        unsigned int ( STDMETHODCALLTYPE *GetDestHeight )( 

+            IBMDStreamingMutableVideoEncodingMode * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ BOOL *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetInt )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ LONGLONG *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ double *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [out] */ BSTR *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateMutableVideoEncodingMode )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetSourceRect )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ unsigned long posX,

+            /* [in] */ unsigned long posY,

+            /* [in] */ unsigned long width,

+            /* [in] */ unsigned long height);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetDestSize )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ unsigned long width,

+            /* [in] */ unsigned long height);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFlag )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ BOOL value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetInt )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ LONGLONG value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFloat )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ double value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetString )( 

+            IBMDStreamingMutableVideoEncodingMode * This,

+            /* [in] */ BMDStreamingEncodingModePropertyID cfgID,

+            /* [in] */ BSTR value);

+        

+        END_INTERFACE

+    } IBMDStreamingMutableVideoEncodingModeVtbl;

+

+    interface IBMDStreamingMutableVideoEncodingMode

+    {

+        CONST_VTBL struct IBMDStreamingMutableVideoEncodingModeVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingMutableVideoEncodingMode_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingMutableVideoEncodingMode_GetName(This,name)	\

+    ( (This)->lpVtbl -> GetName(This,name) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetPresetID(This)	\

+    ( (This)->lpVtbl -> GetPresetID(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetSourcePositionX(This)	\

+    ( (This)->lpVtbl -> GetSourcePositionX(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetSourcePositionY(This)	\

+    ( (This)->lpVtbl -> GetSourcePositionY(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetSourceWidth(This)	\

+    ( (This)->lpVtbl -> GetSourceWidth(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetSourceHeight(This)	\

+    ( (This)->lpVtbl -> GetSourceHeight(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetDestWidth(This)	\

+    ( (This)->lpVtbl -> GetDestWidth(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetDestHeight(This)	\

+    ( (This)->lpVtbl -> GetDestHeight(This) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_GetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_CreateMutableVideoEncodingMode(This,newEncodingMode)	\

+    ( (This)->lpVtbl -> CreateMutableVideoEncodingMode(This,newEncodingMode) ) 

+

+

+#define IBMDStreamingMutableVideoEncodingMode_SetSourceRect(This,posX,posY,width,height)	\

+    ( (This)->lpVtbl -> SetSourceRect(This,posX,posY,width,height) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_SetDestSize(This,width,height)	\

+    ( (This)->lpVtbl -> SetDestSize(This,width,height) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_SetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_SetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_SetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) 

+

+#define IBMDStreamingMutableVideoEncodingMode_SetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetString(This,cfgID,value) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__

+#define __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingVideoEncodingModePresetIterator */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingVideoEncodingModePresetIterator;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("7AC731A3-C950-4AD0-804A-8377AA51C6C4")

+    IBMDStreamingVideoEncodingModePresetIterator : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Next( 

+            /* [out] */ IBMDStreamingVideoEncodingMode **videoEncodingMode) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingVideoEncodingModePresetIteratorVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingVideoEncodingModePresetIterator * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingVideoEncodingModePresetIterator * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingVideoEncodingModePresetIterator * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Next )( 

+            IBMDStreamingVideoEncodingModePresetIterator * This,

+            /* [out] */ IBMDStreamingVideoEncodingMode **videoEncodingMode);

+        

+        END_INTERFACE

+    } IBMDStreamingVideoEncodingModePresetIteratorVtbl;

+

+    interface IBMDStreamingVideoEncodingModePresetIterator

+    {

+        CONST_VTBL struct IBMDStreamingVideoEncodingModePresetIteratorVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingVideoEncodingModePresetIterator_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingVideoEncodingModePresetIterator_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingVideoEncodingModePresetIterator_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingVideoEncodingModePresetIterator_Next(This,videoEncodingMode)	\

+    ( (This)->lpVtbl -> Next(This,videoEncodingMode) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingDeviceInput_INTERFACE_DEFINED__

+#define __IBMDStreamingDeviceInput_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingDeviceInput */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingDeviceInput;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("24B6B6EC-1727-44BB-9818-34FF086ACF98")

+    IBMDStreamingDeviceInput : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoInputMode( 

+            /* [in] */ BMDDisplayMode inputMode,

+            /* [out] */ BOOL *result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetVideoInputModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoInputMode( 

+            /* [in] */ BMDDisplayMode inputMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetCurrentDetectedVideoInputMode( 

+            /* [out] */ BMDDisplayMode *detectedMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetVideoEncodingMode( 

+            /* [out] */ IBMDStreamingVideoEncodingMode **encodingMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetVideoEncodingModePresetIterator( 

+            /* [in] */ BMDDisplayMode inputMode,

+            /* [out] */ IBMDStreamingVideoEncodingModePresetIterator **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoEncodingMode( 

+            /* [in] */ BMDDisplayMode inputMode,

+            /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode,

+            /* [out] */ BMDStreamingEncodingSupport *result,

+            /* [out] */ IBMDStreamingVideoEncodingMode **changedEncodingMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoEncodingMode( 

+            /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartCapture( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopCapture( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IUnknown *theCallback) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingDeviceInputVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingDeviceInput * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingDeviceInput * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingDeviceInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoInputMode )( 

+            IBMDStreamingDeviceInput * This,

+            /* [in] */ BMDDisplayMode inputMode,

+            /* [out] */ BOOL *result);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetVideoInputModeIterator )( 

+            IBMDStreamingDeviceInput * This,

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoInputMode )( 

+            IBMDStreamingDeviceInput * This,

+            /* [in] */ BMDDisplayMode inputMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetCurrentDetectedVideoInputMode )( 

+            IBMDStreamingDeviceInput * This,

+            /* [out] */ BMDDisplayMode *detectedMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetVideoEncodingMode )( 

+            IBMDStreamingDeviceInput * This,

+            /* [out] */ IBMDStreamingVideoEncodingMode **encodingMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetVideoEncodingModePresetIterator )( 

+            IBMDStreamingDeviceInput * This,

+            /* [in] */ BMDDisplayMode inputMode,

+            /* [out] */ IBMDStreamingVideoEncodingModePresetIterator **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoEncodingMode )( 

+            IBMDStreamingDeviceInput * This,

+            /* [in] */ BMDDisplayMode inputMode,

+            /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode,

+            /* [out] */ BMDStreamingEncodingSupport *result,

+            /* [out] */ IBMDStreamingVideoEncodingMode **changedEncodingMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoEncodingMode )( 

+            IBMDStreamingDeviceInput * This,

+            /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartCapture )( 

+            IBMDStreamingDeviceInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopCapture )( 

+            IBMDStreamingDeviceInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IBMDStreamingDeviceInput * This,

+            /* [in] */ IUnknown *theCallback);

+        

+        END_INTERFACE

+    } IBMDStreamingDeviceInputVtbl;

+

+    interface IBMDStreamingDeviceInput

+    {

+        CONST_VTBL struct IBMDStreamingDeviceInputVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingDeviceInput_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingDeviceInput_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingDeviceInput_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingDeviceInput_DoesSupportVideoInputMode(This,inputMode,result)	\

+    ( (This)->lpVtbl -> DoesSupportVideoInputMode(This,inputMode,result) ) 

+

+#define IBMDStreamingDeviceInput_GetVideoInputModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetVideoInputModeIterator(This,iterator) ) 

+

+#define IBMDStreamingDeviceInput_SetVideoInputMode(This,inputMode)	\

+    ( (This)->lpVtbl -> SetVideoInputMode(This,inputMode) ) 

+

+#define IBMDStreamingDeviceInput_GetCurrentDetectedVideoInputMode(This,detectedMode)	\

+    ( (This)->lpVtbl -> GetCurrentDetectedVideoInputMode(This,detectedMode) ) 

+

+#define IBMDStreamingDeviceInput_GetVideoEncodingMode(This,encodingMode)	\

+    ( (This)->lpVtbl -> GetVideoEncodingMode(This,encodingMode) ) 

+

+#define IBMDStreamingDeviceInput_GetVideoEncodingModePresetIterator(This,inputMode,iterator)	\

+    ( (This)->lpVtbl -> GetVideoEncodingModePresetIterator(This,inputMode,iterator) ) 

+

+#define IBMDStreamingDeviceInput_DoesSupportVideoEncodingMode(This,inputMode,encodingMode,result,changedEncodingMode)	\

+    ( (This)->lpVtbl -> DoesSupportVideoEncodingMode(This,inputMode,encodingMode,result,changedEncodingMode) ) 

+

+#define IBMDStreamingDeviceInput_SetVideoEncodingMode(This,encodingMode)	\

+    ( (This)->lpVtbl -> SetVideoEncodingMode(This,encodingMode) ) 

+

+#define IBMDStreamingDeviceInput_StartCapture(This)	\

+    ( (This)->lpVtbl -> StartCapture(This) ) 

+

+#define IBMDStreamingDeviceInput_StopCapture(This)	\

+    ( (This)->lpVtbl -> StopCapture(This) ) 

+

+#define IBMDStreamingDeviceInput_SetCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingDeviceInput_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__

+#define __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingH264NALPacket */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingH264NALPacket;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("E260E955-14BE-4395-9775-9F02CC0A9D89")

+    IBMDStreamingH264NALPacket : public IUnknown

+    {

+    public:

+        virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            /* [out] */ void **buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytesWithSizePrefix( 

+            /* [out] */ void **buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayTime( 

+            /* [in] */ ULONGLONG requestedTimeScale,

+            /* [out] */ ULONGLONG *displayTime) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetPacketIndex( 

+            /* [out] */ unsigned long *packetIndex) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingH264NALPacketVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingH264NALPacket * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingH264NALPacket * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingH264NALPacket * This);

+        

+        long ( STDMETHODCALLTYPE *GetPayloadSize )( 

+            IBMDStreamingH264NALPacket * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IBMDStreamingH264NALPacket * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytesWithSizePrefix )( 

+            IBMDStreamingH264NALPacket * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayTime )( 

+            IBMDStreamingH264NALPacket * This,

+            /* [in] */ ULONGLONG requestedTimeScale,

+            /* [out] */ ULONGLONG *displayTime);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetPacketIndex )( 

+            IBMDStreamingH264NALPacket * This,

+            /* [out] */ unsigned long *packetIndex);

+        

+        END_INTERFACE

+    } IBMDStreamingH264NALPacketVtbl;

+

+    interface IBMDStreamingH264NALPacket

+    {

+        CONST_VTBL struct IBMDStreamingH264NALPacketVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingH264NALPacket_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingH264NALPacket_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingH264NALPacket_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingH264NALPacket_GetPayloadSize(This)	\

+    ( (This)->lpVtbl -> GetPayloadSize(This) ) 

+

+#define IBMDStreamingH264NALPacket_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IBMDStreamingH264NALPacket_GetBytesWithSizePrefix(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytesWithSizePrefix(This,buffer) ) 

+

+#define IBMDStreamingH264NALPacket_GetDisplayTime(This,requestedTimeScale,displayTime)	\

+    ( (This)->lpVtbl -> GetDisplayTime(This,requestedTimeScale,displayTime) ) 

+

+#define IBMDStreamingH264NALPacket_GetPacketIndex(This,packetIndex)	\

+    ( (This)->lpVtbl -> GetPacketIndex(This,packetIndex) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingAudioPacket_INTERFACE_DEFINED__

+#define __IBMDStreamingAudioPacket_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingAudioPacket */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingAudioPacket;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("D9EB5902-1AD2-43F4-9E2C-3CFA50B5EE19")

+    IBMDStreamingAudioPacket : public IUnknown

+    {

+    public:

+        virtual BMDStreamingAudioCodec STDMETHODCALLTYPE GetCodec( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            /* [out] */ void **buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetPlayTime( 

+            /* [in] */ ULONGLONG requestedTimeScale,

+            /* [out] */ ULONGLONG *playTime) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetPacketIndex( 

+            /* [out] */ unsigned long *packetIndex) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingAudioPacketVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingAudioPacket * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingAudioPacket * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingAudioPacket * This);

+        

+        BMDStreamingAudioCodec ( STDMETHODCALLTYPE *GetCodec )( 

+            IBMDStreamingAudioPacket * This);

+        

+        long ( STDMETHODCALLTYPE *GetPayloadSize )( 

+            IBMDStreamingAudioPacket * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IBMDStreamingAudioPacket * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetPlayTime )( 

+            IBMDStreamingAudioPacket * This,

+            /* [in] */ ULONGLONG requestedTimeScale,

+            /* [out] */ ULONGLONG *playTime);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetPacketIndex )( 

+            IBMDStreamingAudioPacket * This,

+            /* [out] */ unsigned long *packetIndex);

+        

+        END_INTERFACE

+    } IBMDStreamingAudioPacketVtbl;

+

+    interface IBMDStreamingAudioPacket

+    {

+        CONST_VTBL struct IBMDStreamingAudioPacketVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingAudioPacket_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingAudioPacket_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingAudioPacket_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingAudioPacket_GetCodec(This)	\

+    ( (This)->lpVtbl -> GetCodec(This) ) 

+

+#define IBMDStreamingAudioPacket_GetPayloadSize(This)	\

+    ( (This)->lpVtbl -> GetPayloadSize(This) ) 

+

+#define IBMDStreamingAudioPacket_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IBMDStreamingAudioPacket_GetPlayTime(This,requestedTimeScale,playTime)	\

+    ( (This)->lpVtbl -> GetPlayTime(This,requestedTimeScale,playTime) ) 

+

+#define IBMDStreamingAudioPacket_GetPacketIndex(This,packetIndex)	\

+    ( (This)->lpVtbl -> GetPacketIndex(This,packetIndex) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingAudioPacket_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__

+#define __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingMPEG2TSPacket */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingMPEG2TSPacket;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("91810D1C-4FB3-4AAA-AE56-FA301D3DFA4C")

+    IBMDStreamingMPEG2TSPacket : public IUnknown

+    {

+    public:

+        virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            /* [out] */ void **buffer) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingMPEG2TSPacketVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingMPEG2TSPacket * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingMPEG2TSPacket * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingMPEG2TSPacket * This);

+        

+        long ( STDMETHODCALLTYPE *GetPayloadSize )( 

+            IBMDStreamingMPEG2TSPacket * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IBMDStreamingMPEG2TSPacket * This,

+            /* [out] */ void **buffer);

+        

+        END_INTERFACE

+    } IBMDStreamingMPEG2TSPacketVtbl;

+

+    interface IBMDStreamingMPEG2TSPacket

+    {

+        CONST_VTBL struct IBMDStreamingMPEG2TSPacketVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingMPEG2TSPacket_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingMPEG2TSPacket_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingMPEG2TSPacket_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingMPEG2TSPacket_GetPayloadSize(This)	\

+    ( (This)->lpVtbl -> GetPayloadSize(This) ) 

+

+#define IBMDStreamingMPEG2TSPacket_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__ */

+

+

+#ifndef __IBMDStreamingH264NALParser_INTERFACE_DEFINED__

+#define __IBMDStreamingH264NALParser_INTERFACE_DEFINED__

+

+/* interface IBMDStreamingH264NALParser */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IBMDStreamingH264NALParser;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("5867F18C-5BFA-4CCC-B2A7-9DFD140417D2")

+    IBMDStreamingH264NALParser : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE IsNALSequenceParameterSet( 

+            /* [in] */ IBMDStreamingH264NALPacket *nal) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE IsNALPictureParameterSet( 

+            /* [in] */ IBMDStreamingH264NALPacket *nal) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetProfileAndLevelFromSPS( 

+            /* [in] */ IBMDStreamingH264NALPacket *nal,

+            /* [out] */ unsigned long *profileIdc,

+            /* [out] */ unsigned long *profileCompatability,

+            /* [out] */ unsigned long *levelIdc) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IBMDStreamingH264NALParserVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IBMDStreamingH264NALParser * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IBMDStreamingH264NALParser * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IBMDStreamingH264NALParser * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsNALSequenceParameterSet )( 

+            IBMDStreamingH264NALParser * This,

+            /* [in] */ IBMDStreamingH264NALPacket *nal);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsNALPictureParameterSet )( 

+            IBMDStreamingH264NALParser * This,

+            /* [in] */ IBMDStreamingH264NALPacket *nal);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetProfileAndLevelFromSPS )( 

+            IBMDStreamingH264NALParser * This,

+            /* [in] */ IBMDStreamingH264NALPacket *nal,

+            /* [out] */ unsigned long *profileIdc,

+            /* [out] */ unsigned long *profileCompatability,

+            /* [out] */ unsigned long *levelIdc);

+        

+        END_INTERFACE

+    } IBMDStreamingH264NALParserVtbl;

+

+    interface IBMDStreamingH264NALParser

+    {

+        CONST_VTBL struct IBMDStreamingH264NALParserVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IBMDStreamingH264NALParser_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IBMDStreamingH264NALParser_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IBMDStreamingH264NALParser_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IBMDStreamingH264NALParser_IsNALSequenceParameterSet(This,nal)	\

+    ( (This)->lpVtbl -> IsNALSequenceParameterSet(This,nal) ) 

+

+#define IBMDStreamingH264NALParser_IsNALPictureParameterSet(This,nal)	\

+    ( (This)->lpVtbl -> IsNALPictureParameterSet(This,nal) ) 

+

+#define IBMDStreamingH264NALParser_GetProfileAndLevelFromSPS(This,nal,profileIdc,profileCompatability,levelIdc)	\

+    ( (This)->lpVtbl -> GetProfileAndLevelFromSPS(This,nal,profileIdc,profileCompatability,levelIdc) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IBMDStreamingH264NALParser_INTERFACE_DEFINED__ */

+

+

+EXTERN_C const CLSID CLSID_CBMDStreamingDiscovery;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("0CAA31F6-8A26-40B0-86A4-BF58DCCA710C")

+CBMDStreamingDiscovery;

+#endif

+

+EXTERN_C const CLSID CLSID_CBMDStreamingH264NALParser;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("7753EFBD-951C-407C-97A5-23C737B73B52")

+CBMDStreamingH264NALParser;

+#endif

+

+#ifndef __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__

+#define __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoOutputCallback */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoOutputCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("20AA5225-1958-47CB-820B-80A8D521A6EE")

+    IDeckLinkVideoOutputCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( 

+            /* [in] */ IDeckLinkVideoFrame *completedFrame,

+            /* [in] */ BMDOutputFrameCompletionResult result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoOutputCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoOutputCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoOutputCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoOutputCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( 

+            IDeckLinkVideoOutputCallback * This,

+            /* [in] */ IDeckLinkVideoFrame *completedFrame,

+            /* [in] */ BMDOutputFrameCompletionResult result);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( 

+            IDeckLinkVideoOutputCallback * This);

+        

+        END_INTERFACE

+    } IDeckLinkVideoOutputCallbackVtbl;

+

+    interface IDeckLinkVideoOutputCallback

+    {

+        CONST_VTBL struct IDeckLinkVideoOutputCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoOutputCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoOutputCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoOutputCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoOutputCallback_ScheduledFrameCompleted(This,completedFrame,result)	\

+    ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) 

+

+#define IDeckLinkVideoOutputCallback_ScheduledPlaybackHasStopped(This)	\

+    ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInputCallback_INTERFACE_DEFINED__

+#define __IDeckLinkInputCallback_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInputCallback */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInputCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("DD04E5EC-7415-42AB-AE4A-E80C4DFC044A")

+    IDeckLinkInputCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( 

+            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,

+            /* [in] */ IDeckLinkDisplayMode *newDisplayMode,

+            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 

+            /* [in] */ IDeckLinkVideoInputFrame *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInputCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInputCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInputCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInputCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( 

+            IDeckLinkInputCallback * This,

+            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,

+            /* [in] */ IDeckLinkDisplayMode *newDisplayMode,

+            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 

+            IDeckLinkInputCallback * This,

+            /* [in] */ IDeckLinkVideoInputFrame *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket *audioPacket);

+        

+        END_INTERFACE

+    } IDeckLinkInputCallbackVtbl;

+

+    interface IDeckLinkInputCallback

+    {

+        CONST_VTBL struct IDeckLinkInputCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInputCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInputCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInputCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInputCallback_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags)	\

+    ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) 

+

+#define IDeckLinkInputCallback_VideoInputFrameArrived(This,videoFrame,audioPacket)	\

+    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInputCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__

+#define __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__

+

+/* interface IDeckLinkMemoryAllocator */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkMemoryAllocator;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("B36EB6E7-9D29-4AA8-92EF-843B87A289E8")

+    IDeckLinkMemoryAllocator : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE AllocateBuffer( 

+            /* [in] */ unsigned long bufferSize,

+            /* [out] */ void **allocatedBuffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( 

+            /* [in] */ void *buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Decommit( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkMemoryAllocatorVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkMemoryAllocator * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkMemoryAllocator * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkMemoryAllocator * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *AllocateBuffer )( 

+            IDeckLinkMemoryAllocator * This,

+            /* [in] */ unsigned long bufferSize,

+            /* [out] */ void **allocatedBuffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( 

+            IDeckLinkMemoryAllocator * This,

+            /* [in] */ void *buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *Commit )( 

+            IDeckLinkMemoryAllocator * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Decommit )( 

+            IDeckLinkMemoryAllocator * This);

+        

+        END_INTERFACE

+    } IDeckLinkMemoryAllocatorVtbl;

+

+    interface IDeckLinkMemoryAllocator

+    {

+        CONST_VTBL struct IDeckLinkMemoryAllocatorVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkMemoryAllocator_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkMemoryAllocator_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkMemoryAllocator_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkMemoryAllocator_AllocateBuffer(This,bufferSize,allocatedBuffer)	\

+    ( (This)->lpVtbl -> AllocateBuffer(This,bufferSize,allocatedBuffer) ) 

+

+#define IDeckLinkMemoryAllocator_ReleaseBuffer(This,buffer)	\

+    ( (This)->lpVtbl -> ReleaseBuffer(This,buffer) ) 

+

+#define IDeckLinkMemoryAllocator_Commit(This)	\

+    ( (This)->lpVtbl -> Commit(This) ) 

+

+#define IDeckLinkMemoryAllocator_Decommit(This)	\

+    ( (This)->lpVtbl -> Decommit(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__

+#define __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__

+

+/* interface IDeckLinkAudioOutputCallback */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkAudioOutputCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("403C681B-7F46-4A12-B993-2BB127084EE6")

+    IDeckLinkAudioOutputCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples( 

+            /* [in] */ BOOL preroll) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkAudioOutputCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkAudioOutputCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkAudioOutputCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkAudioOutputCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *RenderAudioSamples )( 

+            IDeckLinkAudioOutputCallback * This,

+            /* [in] */ BOOL preroll);

+        

+        END_INTERFACE

+    } IDeckLinkAudioOutputCallbackVtbl;

+

+    interface IDeckLinkAudioOutputCallback

+    {

+        CONST_VTBL struct IDeckLinkAudioOutputCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkAudioOutputCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkAudioOutputCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkAudioOutputCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkAudioOutputCallback_RenderAudioSamples(This,preroll)	\

+    ( (This)->lpVtbl -> RenderAudioSamples(This,preroll) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkIterator_INTERFACE_DEFINED__

+#define __IDeckLinkIterator_INTERFACE_DEFINED__

+

+/* interface IDeckLinkIterator */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkIterator;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("50FB36CD-3063-4B73-BDBB-958087F2D8BA")

+    IDeckLinkIterator : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Next( 

+            /* [out] */ IDeckLink **deckLinkInstance) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkIteratorVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkIterator * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkIterator * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkIterator * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Next )( 

+            IDeckLinkIterator * This,

+            /* [out] */ IDeckLink **deckLinkInstance);

+        

+        END_INTERFACE

+    } IDeckLinkIteratorVtbl;

+

+    interface IDeckLinkIterator

+    {

+        CONST_VTBL struct IDeckLinkIteratorVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkIterator_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkIterator_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkIterator_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkIterator_Next(This,deckLinkInstance)	\

+    ( (This)->lpVtbl -> Next(This,deckLinkInstance) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkIterator_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkAPIInformation_INTERFACE_DEFINED__

+#define __IDeckLinkAPIInformation_INTERFACE_DEFINED__

+

+/* interface IDeckLinkAPIInformation */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkAPIInformation;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("7BEA3C68-730D-4322-AF34-8A7152B532A4")

+    IDeckLinkAPIInformation : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetFlag( 

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ BOOL *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetInt( 

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ LONGLONG *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFloat( 

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ double *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetString( 

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ BSTR *value) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkAPIInformationVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkAPIInformation * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkAPIInformation * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkAPIInformation * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 

+            IDeckLinkAPIInformation * This,

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ BOOL *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetInt )( 

+            IDeckLinkAPIInformation * This,

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ LONGLONG *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 

+            IDeckLinkAPIInformation * This,

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ double *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IDeckLinkAPIInformation * This,

+            /* [in] */ BMDDeckLinkAPIInformationID cfgID,

+            /* [out] */ BSTR *value);

+        

+        END_INTERFACE

+    } IDeckLinkAPIInformationVtbl;

+

+    interface IDeckLinkAPIInformation

+    {

+        CONST_VTBL struct IDeckLinkAPIInformationVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkAPIInformation_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkAPIInformation_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkAPIInformation_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkAPIInformation_GetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 

+

+#define IDeckLinkAPIInformation_GetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 

+

+#define IDeckLinkAPIInformation_GetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 

+

+#define IDeckLinkAPIInformation_GetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkAPIInformation_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_INTERFACE_DEFINED__

+#define __IDeckLinkOutput_INTERFACE_DEFINED__

+

+/* interface IDeckLinkOutput */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkOutput;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564")

+    IDeckLinkOutput : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoOutputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDVideoOutputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 

+            /* [in] */ long width,

+            /* [in] */ long height,

+            /* [in] */ long rowBytes,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( 

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame,

+            /* [in] */ BMDTimeValue displayTime,

+            /* [in] */ BMDTimeValue displayDuration,

+            /* [in] */ BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 

+            /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( 

+            /* [out] */ unsigned long *bufferedFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount,

+            /* [in] */ BMDAudioOutputStreamType streamType) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [in] */ BMDTimeValue streamTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 

+            /* [out] */ unsigned long *bufferedSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 

+            /* [in] */ BMDTimeValue playbackStartTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ double playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 

+            /* [in] */ BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            /* [in] */ BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( 

+            /* [out] */ BOOL *active) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( 

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *streamTime,

+            /* [out] */ double *playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( 

+            /* [out] */ BMDReferenceStatus *referenceStatus) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFrameCompletionReferenceTimestamp( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *frameCompletionTimestamp) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkOutputVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkOutput * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkOutput * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkOutput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoOutputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkOutput * This,

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkOutput * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDVideoOutputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 

+            IDeckLinkOutput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 

+            IDeckLinkOutput * This,

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 

+            IDeckLinkOutput * This,

+            /* [in] */ long width,

+            /* [in] */ long height,

+            /* [in] */ long rowBytes,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame **outFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 

+            IDeckLinkOutput * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 

+            IDeckLinkOutput * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame,

+            /* [in] */ BMDTimeValue displayTime,

+            /* [in] */ BMDTimeValue displayDuration,

+            /* [in] */ BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 

+            IDeckLinkOutput * This,

+            /* [in] */ IDeckLinkVideoOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( 

+            IDeckLinkOutput * This,

+            /* [out] */ unsigned long *bufferedFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount,

+            /* [in] */ BMDAudioOutputStreamType streamType);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 

+            IDeckLinkOutput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 

+            IDeckLinkOutput * This,

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 

+            IDeckLinkOutput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 

+            IDeckLinkOutput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 

+            IDeckLinkOutput * This,

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [in] */ BMDTimeValue streamTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 

+            IDeckLinkOutput * This,

+            /* [out] */ unsigned long *bufferedSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 

+            IDeckLinkOutput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 

+            IDeckLinkOutput * This,

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDTimeValue playbackStartTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ double playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            /* [in] */ BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( 

+            IDeckLinkOutput * This,

+            /* [out] */ BOOL *active);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *streamTime,

+            /* [out] */ double *playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( 

+            IDeckLinkOutput * This,

+            /* [out] */ BMDReferenceStatus *referenceStatus);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkOutput * This,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFrameCompletionReferenceTimestamp )( 

+            IDeckLinkOutput * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *frameCompletionTimestamp);

+        

+        END_INTERFACE

+    } IDeckLinkOutputVtbl;

+

+    interface IDeckLinkOutput

+    {

+        CONST_VTBL struct IDeckLinkOutputVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkOutput_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkOutput_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkOutput_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkOutput_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) 

+

+#define IDeckLinkOutput_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkOutput_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkOutput_EnableVideoOutput(This,displayMode,flags)	\

+    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) 

+

+#define IDeckLinkOutput_DisableVideoOutput(This)	\

+    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 

+

+#define IDeckLinkOutput_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\

+    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 

+

+#define IDeckLinkOutput_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\

+    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 

+

+#define IDeckLinkOutput_CreateAncillaryData(This,pixelFormat,outBuffer)	\

+    ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) 

+

+#define IDeckLinkOutput_DisplayVideoFrameSync(This,theFrame)	\

+    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 

+

+#define IDeckLinkOutput_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\

+    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 

+

+#define IDeckLinkOutput_SetScheduledFrameCompletionCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_GetBufferedVideoFrameCount(This,bufferedFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) 

+

+#define IDeckLinkOutput_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType)	\

+    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) 

+

+#define IDeckLinkOutput_DisableAudioOutput(This)	\

+    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 

+

+#define IDeckLinkOutput_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_BeginAudioPreroll(This)	\

+    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_EndAudioPreroll(This)	\

+    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) 

+

+#define IDeckLinkOutput_FlushBufferedAudioSamples(This)	\

+    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 

+

+#define IDeckLinkOutput_SetAudioCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\

+    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 

+

+#define IDeckLinkOutput_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\

+    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 

+

+#define IDeckLinkOutput_IsScheduledPlaybackRunning(This,active)	\

+    ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) 

+

+#define IDeckLinkOutput_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed)	\

+    ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) 

+

+#define IDeckLinkOutput_GetReferenceStatus(This,referenceStatus)	\

+    ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) 

+

+#define IDeckLinkOutput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 

+

+#define IDeckLinkOutput_GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp)	\

+    ( (This)->lpVtbl -> GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkOutput_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_INTERFACE_DEFINED__

+#define __IDeckLinkInput_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInput */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInput;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("AF22762B-DFAC-4846-AA79-FA8883560995")

+    IDeckLinkInput : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( 

+            /* [out] */ unsigned long *availableFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoInputFrameMemoryAllocator( 

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( 

+            /* [out] */ unsigned long *availableSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkInputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInputVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInput * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInput * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkInput * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkInput * This,

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkInput * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 

+            IDeckLinkInput * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 

+            IDeckLinkInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( 

+            IDeckLinkInput * This,

+            /* [out] */ unsigned long *availableFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoInputFrameMemoryAllocator )( 

+            IDeckLinkInput * This,

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 

+            IDeckLinkInput * This,

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 

+            IDeckLinkInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( 

+            IDeckLinkInput * This,

+            /* [out] */ unsigned long *availableSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 

+            IDeckLinkInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 

+            IDeckLinkInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 

+            IDeckLinkInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushStreams )( 

+            IDeckLinkInput * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkInput * This,

+            /* [in] */ IDeckLinkInputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkInput * This,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame);

+        

+        END_INTERFACE

+    } IDeckLinkInputVtbl;

+

+    interface IDeckLinkInput

+    {

+        CONST_VTBL struct IDeckLinkInputVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInput_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInput_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInput_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInput_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) 

+

+#define IDeckLinkInput_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkInput_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkInput_EnableVideoInput(This,displayMode,pixelFormat,flags)	\

+    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 

+

+#define IDeckLinkInput_DisableVideoInput(This)	\

+    ( (This)->lpVtbl -> DisableVideoInput(This) ) 

+

+#define IDeckLinkInput_GetAvailableVideoFrameCount(This,availableFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) 

+

+#define IDeckLinkInput_SetVideoInputFrameMemoryAllocator(This,theAllocator)	\

+    ( (This)->lpVtbl -> SetVideoInputFrameMemoryAllocator(This,theAllocator) ) 

+

+#define IDeckLinkInput_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\

+    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 

+

+#define IDeckLinkInput_DisableAudioInput(This)	\

+    ( (This)->lpVtbl -> DisableAudioInput(This) ) 

+

+#define IDeckLinkInput_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) 

+

+#define IDeckLinkInput_StartStreams(This)	\

+    ( (This)->lpVtbl -> StartStreams(This) ) 

+

+#define IDeckLinkInput_StopStreams(This)	\

+    ( (This)->lpVtbl -> StopStreams(This) ) 

+

+#define IDeckLinkInput_PauseStreams(This)	\

+    ( (This)->lpVtbl -> PauseStreams(This) ) 

+

+#define IDeckLinkInput_FlushStreams(This)	\

+    ( (This)->lpVtbl -> FlushStreams(This) ) 

+

+#define IDeckLinkInput_SetCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 

+

+#define IDeckLinkInput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInput_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame_INTERFACE_DEFINED__

+#define __IDeckLinkVideoFrame_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoFrame */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoFrame;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("3F716FE0-F023-4111-BE5D-EF4414C05B17")

+    IDeckLinkVideoFrame : public IUnknown

+    {

+    public:

+        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0;

+        

+        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;

+        

+        virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            /* [out] */ void **buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 

+            /* [in] */ BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode **timecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( 

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoFrameVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoFrame * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoFrame * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkVideoFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkVideoFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkVideoFrame * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoFrame * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkVideoFrame * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkVideoFrame * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkVideoFrame * This,

+            /* [in] */ BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode **timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 

+            IDeckLinkVideoFrame * This,

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);

+        

+        END_INTERFACE

+    } IDeckLinkVideoFrameVtbl;

+

+    interface IDeckLinkVideoFrame

+    {

+        CONST_VTBL struct IDeckLinkVideoFrameVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoFrame_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoFrame_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoFrame_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoFrame_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkVideoFrame_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkVideoFrame_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkVideoFrame_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoFrame_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkVideoFrame_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkVideoFrame_GetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkVideoFrame_GetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoFrame_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__

+#define __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__

+

+/* interface IDeckLinkMutableVideoFrame */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkMutableVideoFrame;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("69E2639F-40DA-4E19-B6F2-20ACE815C390")

+    IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE SetFlags( 

+            /* [in] */ BMDFrameFlags newFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetTimecode( 

+            /* [in] */ BMDTimecodeFormat format,

+            /* [in] */ IDeckLinkTimecode *timecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( 

+            /* [in] */ BMDTimecodeFormat format,

+            /* [in] */ unsigned char hours,

+            /* [in] */ unsigned char minutes,

+            /* [in] */ unsigned char seconds,

+            /* [in] */ unsigned char frames,

+            /* [in] */ BMDTimecodeFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( 

+            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetTimecodeUserBits( 

+            /* [in] */ BMDTimecodeFormat format,

+            /* [in] */ BMDTimecodeUserBits userBits) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkMutableVideoFrameVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkMutableVideoFrame * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkMutableVideoFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkMutableVideoFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkMutableVideoFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkMutableVideoFrame * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkMutableVideoFrame * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkMutableVideoFrame * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [in] */ BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode **timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFlags )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [in] */ BMDFrameFlags newFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetTimecode )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [in] */ BMDTimecodeFormat format,

+            /* [in] */ IDeckLinkTimecode *timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [in] */ BMDTimecodeFormat format,

+            /* [in] */ unsigned char hours,

+            /* [in] */ unsigned char minutes,

+            /* [in] */ unsigned char seconds,

+            /* [in] */ unsigned char frames,

+            /* [in] */ BMDTimecodeFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetTimecodeUserBits )( 

+            IDeckLinkMutableVideoFrame * This,

+            /* [in] */ BMDTimecodeFormat format,

+            /* [in] */ BMDTimecodeUserBits userBits);

+        

+        END_INTERFACE

+    } IDeckLinkMutableVideoFrameVtbl;

+

+    interface IDeckLinkMutableVideoFrame

+    {

+        CONST_VTBL struct IDeckLinkMutableVideoFrameVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkMutableVideoFrame_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkMutableVideoFrame_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkMutableVideoFrame_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkMutableVideoFrame_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkMutableVideoFrame_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkMutableVideoFrame_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkMutableVideoFrame_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkMutableVideoFrame_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkMutableVideoFrame_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkMutableVideoFrame_GetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkMutableVideoFrame_GetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 

+

+

+#define IDeckLinkMutableVideoFrame_SetFlags(This,newFlags)	\

+    ( (This)->lpVtbl -> SetFlags(This,newFlags) ) 

+

+#define IDeckLinkMutableVideoFrame_SetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkMutableVideoFrame_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags)	\

+    ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) 

+

+#define IDeckLinkMutableVideoFrame_SetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) 

+

+#define IDeckLinkMutableVideoFrame_SetTimecodeUserBits(This,format,userBits)	\

+    ( (This)->lpVtbl -> SetTimecodeUserBits(This,format,userBits) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__

+#define __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoFrame3DExtensions */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoFrame3DExtensions;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7")

+    IDeckLinkVideoFrame3DExtensions : public IUnknown

+    {

+    public:

+        virtual BMDVideo3DPackingFormat STDMETHODCALLTYPE Get3DPackingFormat( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFrameForRightEye( 

+            /* [out] */ IDeckLinkVideoFrame **rightEyeFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoFrame3DExtensionsVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoFrame3DExtensions * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoFrame3DExtensions * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoFrame3DExtensions * This);

+        

+        BMDVideo3DPackingFormat ( STDMETHODCALLTYPE *Get3DPackingFormat )( 

+            IDeckLinkVideoFrame3DExtensions * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFrameForRightEye )( 

+            IDeckLinkVideoFrame3DExtensions * This,

+            /* [out] */ IDeckLinkVideoFrame **rightEyeFrame);

+        

+        END_INTERFACE

+    } IDeckLinkVideoFrame3DExtensionsVtbl;

+

+    interface IDeckLinkVideoFrame3DExtensions

+    {

+        CONST_VTBL struct IDeckLinkVideoFrame3DExtensionsVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoFrame3DExtensions_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoFrame3DExtensions_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoFrame3DExtensions_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoFrame3DExtensions_Get3DPackingFormat(This)	\

+    ( (This)->lpVtbl -> Get3DPackingFormat(This) ) 

+

+#define IDeckLinkVideoFrame3DExtensions_GetFrameForRightEye(This,rightEyeFrame)	\

+    ( (This)->lpVtbl -> GetFrameForRightEye(This,rightEyeFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__

+#define __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoInputFrame */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoInputFrame;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("05CFE374-537C-4094-9A57-680525118F44")

+    IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetStreamTime( 

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [in] */ BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( 

+            /* [in] */ BMDTimeScale timeScale,

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoInputFrameVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoInputFrame * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoInputFrame * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoInputFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkVideoInputFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkVideoInputFrame * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkVideoInputFrame * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoInputFrame * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkVideoInputFrame * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkVideoInputFrame * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkVideoInputFrame * This,

+            /* [in] */ BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode **timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 

+            IDeckLinkVideoInputFrame * This,

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( 

+            IDeckLinkVideoInputFrame * This,

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [in] */ BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( 

+            IDeckLinkVideoInputFrame * This,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration);

+        

+        END_INTERFACE

+    } IDeckLinkVideoInputFrameVtbl;

+

+    interface IDeckLinkVideoInputFrame

+    {

+        CONST_VTBL struct IDeckLinkVideoInputFrameVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoInputFrame_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoInputFrame_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoInputFrame_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoInputFrame_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkVideoInputFrame_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkVideoInputFrame_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkVideoInputFrame_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoInputFrame_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkVideoInputFrame_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkVideoInputFrame_GetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkVideoInputFrame_GetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 

+

+

+#define IDeckLinkVideoInputFrame_GetStreamTime(This,frameTime,frameDuration,timeScale)	\

+    ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) 

+

+#define IDeckLinkVideoInputFrame_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__

+#define __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoFrameAncillary */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoFrameAncillary;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("732E723C-D1A4-4E29-9E8E-4A88797A0004")

+    IDeckLinkVideoFrameAncillary : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetBufferForVerticalBlankingLine( 

+            /* [in] */ unsigned long lineNumber,

+            /* [out] */ void **buffer) = 0;

+        

+        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;

+        

+        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoFrameAncillaryVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoFrameAncillary * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoFrameAncillary * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoFrameAncillary * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferForVerticalBlankingLine )( 

+            IDeckLinkVideoFrameAncillary * This,

+            /* [in] */ unsigned long lineNumber,

+            /* [out] */ void **buffer);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoFrameAncillary * This);

+        

+        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 

+            IDeckLinkVideoFrameAncillary * This);

+        

+        END_INTERFACE

+    } IDeckLinkVideoFrameAncillaryVtbl;

+

+    interface IDeckLinkVideoFrameAncillary

+    {

+        CONST_VTBL struct IDeckLinkVideoFrameAncillaryVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoFrameAncillary_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoFrameAncillary_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoFrameAncillary_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoFrameAncillary_GetBufferForVerticalBlankingLine(This,lineNumber,buffer)	\

+    ( (This)->lpVtbl -> GetBufferForVerticalBlankingLine(This,lineNumber,buffer) ) 

+

+#define IDeckLinkVideoFrameAncillary_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoFrameAncillary_GetDisplayMode(This)	\

+    ( (This)->lpVtbl -> GetDisplayMode(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__

+#define __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__

+

+/* interface IDeckLinkAudioInputPacket */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkAudioInputPacket;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("E43D5870-2894-11DE-8C30-0800200C9A66")

+    IDeckLinkAudioInputPacket : public IUnknown

+    {

+    public:

+        virtual long STDMETHODCALLTYPE GetSampleFrameCount( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            /* [out] */ void **buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetPacketTime( 

+            /* [out] */ BMDTimeValue *packetTime,

+            /* [in] */ BMDTimeScale timeScale) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkAudioInputPacketVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkAudioInputPacket * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkAudioInputPacket * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkAudioInputPacket * This);

+        

+        long ( STDMETHODCALLTYPE *GetSampleFrameCount )( 

+            IDeckLinkAudioInputPacket * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkAudioInputPacket * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetPacketTime )( 

+            IDeckLinkAudioInputPacket * This,

+            /* [out] */ BMDTimeValue *packetTime,

+            /* [in] */ BMDTimeScale timeScale);

+        

+        END_INTERFACE

+    } IDeckLinkAudioInputPacketVtbl;

+

+    interface IDeckLinkAudioInputPacket

+    {

+        CONST_VTBL struct IDeckLinkAudioInputPacketVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkAudioInputPacket_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkAudioInputPacket_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkAudioInputPacket_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkAudioInputPacket_GetSampleFrameCount(This)	\

+    ( (This)->lpVtbl -> GetSampleFrameCount(This) ) 

+

+#define IDeckLinkAudioInputPacket_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkAudioInputPacket_GetPacketTime(This,packetTime,timeScale)	\

+    ( (This)->lpVtbl -> GetPacketTime(This,packetTime,timeScale) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__

+#define __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__

+

+/* interface IDeckLinkScreenPreviewCallback */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438")

+    IDeckLinkScreenPreviewCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DrawFrame( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkScreenPreviewCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkScreenPreviewCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkScreenPreviewCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkScreenPreviewCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DrawFrame )( 

+            IDeckLinkScreenPreviewCallback * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame);

+        

+        END_INTERFACE

+    } IDeckLinkScreenPreviewCallbackVtbl;

+

+    interface IDeckLinkScreenPreviewCallback

+    {

+        CONST_VTBL struct IDeckLinkScreenPreviewCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkScreenPreviewCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkScreenPreviewCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkScreenPreviewCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkScreenPreviewCallback_DrawFrame(This,theFrame)	\

+    ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__

+#define __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__

+

+/* interface IDeckLinkGLScreenPreviewHelper */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("504E2209-CAC7-4C1A-9FB4-C5BB6274D22F")

+    IDeckLinkGLScreenPreviewHelper : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetFrame( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( 

+            /* [in] */ BMD3DPreviewFormat previewFormat) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkGLScreenPreviewHelperVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkGLScreenPreviewHelper * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkGLScreenPreviewHelper * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkGLScreenPreviewHelper * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *InitializeGL )( 

+            IDeckLinkGLScreenPreviewHelper * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *PaintGL )( 

+            IDeckLinkGLScreenPreviewHelper * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFrame )( 

+            IDeckLinkGLScreenPreviewHelper * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( 

+            IDeckLinkGLScreenPreviewHelper * This,

+            /* [in] */ BMD3DPreviewFormat previewFormat);

+        

+        END_INTERFACE

+    } IDeckLinkGLScreenPreviewHelperVtbl;

+

+    interface IDeckLinkGLScreenPreviewHelper

+    {

+        CONST_VTBL struct IDeckLinkGLScreenPreviewHelperVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkGLScreenPreviewHelper_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkGLScreenPreviewHelper_InitializeGL(This)	\

+    ( (This)->lpVtbl -> InitializeGL(This) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_PaintGL(This)	\

+    ( (This)->lpVtbl -> PaintGL(This) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_SetFrame(This,theFrame)	\

+    ( (This)->lpVtbl -> SetFrame(This,theFrame) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat)	\

+    ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__

+#define __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDX9ScreenPreviewHelper */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDX9ScreenPreviewHelper;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("2094B522-D1A1-40C0-9AC7-1C012218EF02")

+    IDeckLinkDX9ScreenPreviewHelper : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Initialize( 

+            /* [in] */ void *device) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Render( 

+            /* [in] */ RECT *rc) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetFrame( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( 

+            /* [in] */ BMD3DPreviewFormat previewFormat) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDX9ScreenPreviewHelperVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDX9ScreenPreviewHelper * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDX9ScreenPreviewHelper * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDX9ScreenPreviewHelper * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Initialize )( 

+            IDeckLinkDX9ScreenPreviewHelper * This,

+            /* [in] */ void *device);

+        

+        HRESULT ( STDMETHODCALLTYPE *Render )( 

+            IDeckLinkDX9ScreenPreviewHelper * This,

+            /* [in] */ RECT *rc);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFrame )( 

+            IDeckLinkDX9ScreenPreviewHelper * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( 

+            IDeckLinkDX9ScreenPreviewHelper * This,

+            /* [in] */ BMD3DPreviewFormat previewFormat);

+        

+        END_INTERFACE

+    } IDeckLinkDX9ScreenPreviewHelperVtbl;

+

+    interface IDeckLinkDX9ScreenPreviewHelper

+    {

+        CONST_VTBL struct IDeckLinkDX9ScreenPreviewHelperVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDX9ScreenPreviewHelper_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDX9ScreenPreviewHelper_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDX9ScreenPreviewHelper_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDX9ScreenPreviewHelper_Initialize(This,device)	\

+    ( (This)->lpVtbl -> Initialize(This,device) ) 

+

+#define IDeckLinkDX9ScreenPreviewHelper_Render(This,rc)	\

+    ( (This)->lpVtbl -> Render(This,rc) ) 

+

+#define IDeckLinkDX9ScreenPreviewHelper_SetFrame(This,theFrame)	\

+    ( (This)->lpVtbl -> SetFrame(This,theFrame) ) 

+

+#define IDeckLinkDX9ScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat)	\

+    ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkNotificationCallback_INTERFACE_DEFINED__

+#define __IDeckLinkNotificationCallback_INTERFACE_DEFINED__

+

+/* interface IDeckLinkNotificationCallback */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkNotificationCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("b002a1ec-070d-4288-8289-bd5d36e5ff0d")

+    IDeckLinkNotificationCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Notify( 

+            /* [in] */ BMDNotifications topic,

+            /* [in] */ ULONGLONG param1,

+            /* [in] */ ULONGLONG param2) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkNotificationCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkNotificationCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkNotificationCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkNotificationCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Notify )( 

+            IDeckLinkNotificationCallback * This,

+            /* [in] */ BMDNotifications topic,

+            /* [in] */ ULONGLONG param1,

+            /* [in] */ ULONGLONG param2);

+        

+        END_INTERFACE

+    } IDeckLinkNotificationCallbackVtbl;

+

+    interface IDeckLinkNotificationCallback

+    {

+        CONST_VTBL struct IDeckLinkNotificationCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkNotificationCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkNotificationCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkNotificationCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkNotificationCallback_Notify(This,topic,param1,param2)	\

+    ( (This)->lpVtbl -> Notify(This,topic,param1,param2) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkNotificationCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkNotification_INTERFACE_DEFINED__

+#define __IDeckLinkNotification_INTERFACE_DEFINED__

+

+/* interface IDeckLinkNotification */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkNotification;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("0a1fb207-e215-441b-9b19-6fa1575946c5")

+    IDeckLinkNotification : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Subscribe( 

+            /* [in] */ BMDNotifications topic,

+            /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Unsubscribe( 

+            /* [in] */ BMDNotifications topic,

+            /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkNotificationVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkNotification * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkNotification * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkNotification * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Subscribe )( 

+            IDeckLinkNotification * This,

+            /* [in] */ BMDNotifications topic,

+            /* [in] */ IDeckLinkNotificationCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *Unsubscribe )( 

+            IDeckLinkNotification * This,

+            /* [in] */ BMDNotifications topic,

+            /* [in] */ IDeckLinkNotificationCallback *theCallback);

+        

+        END_INTERFACE

+    } IDeckLinkNotificationVtbl;

+

+    interface IDeckLinkNotification

+    {

+        CONST_VTBL struct IDeckLinkNotificationVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkNotification_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkNotification_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkNotification_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkNotification_Subscribe(This,topic,theCallback)	\

+    ( (This)->lpVtbl -> Subscribe(This,topic,theCallback) ) 

+

+#define IDeckLinkNotification_Unsubscribe(This,topic,theCallback)	\

+    ( (This)->lpVtbl -> Unsubscribe(This,topic,theCallback) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkNotification_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkAttributes_INTERFACE_DEFINED__

+#define __IDeckLinkAttributes_INTERFACE_DEFINED__

+

+/* interface IDeckLinkAttributes */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkAttributes;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("ABC11843-D966-44CB-96E2-A1CB5D3135C4")

+    IDeckLinkAttributes : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetFlag( 

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ BOOL *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetInt( 

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ LONGLONG *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFloat( 

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ double *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetString( 

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ BSTR *value) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkAttributesVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkAttributes * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkAttributes * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkAttributes * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 

+            IDeckLinkAttributes * This,

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ BOOL *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetInt )( 

+            IDeckLinkAttributes * This,

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ LONGLONG *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 

+            IDeckLinkAttributes * This,

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ double *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IDeckLinkAttributes * This,

+            /* [in] */ BMDDeckLinkAttributeID cfgID,

+            /* [out] */ BSTR *value);

+        

+        END_INTERFACE

+    } IDeckLinkAttributesVtbl;

+

+    interface IDeckLinkAttributes

+    {

+        CONST_VTBL struct IDeckLinkAttributesVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkAttributes_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkAttributes_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkAttributes_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkAttributes_GetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 

+

+#define IDeckLinkAttributes_GetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 

+

+#define IDeckLinkAttributes_GetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 

+

+#define IDeckLinkAttributes_GetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkAttributes_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkKeyer_INTERFACE_DEFINED__

+#define __IDeckLinkKeyer_INTERFACE_DEFINED__

+

+/* interface IDeckLinkKeyer */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkKeyer;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3")

+    IDeckLinkKeyer : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Enable( 

+            /* [in] */ BOOL isExternal) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetLevel( 

+            /* [in] */ unsigned char level) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE RampUp( 

+            /* [in] */ unsigned long numberOfFrames) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE RampDown( 

+            /* [in] */ unsigned long numberOfFrames) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Disable( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkKeyerVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkKeyer * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkKeyer * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkKeyer * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Enable )( 

+            IDeckLinkKeyer * This,

+            /* [in] */ BOOL isExternal);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetLevel )( 

+            IDeckLinkKeyer * This,

+            /* [in] */ unsigned char level);

+        

+        HRESULT ( STDMETHODCALLTYPE *RampUp )( 

+            IDeckLinkKeyer * This,

+            /* [in] */ unsigned long numberOfFrames);

+        

+        HRESULT ( STDMETHODCALLTYPE *RampDown )( 

+            IDeckLinkKeyer * This,

+            /* [in] */ unsigned long numberOfFrames);

+        

+        HRESULT ( STDMETHODCALLTYPE *Disable )( 

+            IDeckLinkKeyer * This);

+        

+        END_INTERFACE

+    } IDeckLinkKeyerVtbl;

+

+    interface IDeckLinkKeyer

+    {

+        CONST_VTBL struct IDeckLinkKeyerVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkKeyer_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkKeyer_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkKeyer_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkKeyer_Enable(This,isExternal)	\

+    ( (This)->lpVtbl -> Enable(This,isExternal) ) 

+

+#define IDeckLinkKeyer_SetLevel(This,level)	\

+    ( (This)->lpVtbl -> SetLevel(This,level) ) 

+

+#define IDeckLinkKeyer_RampUp(This,numberOfFrames)	\

+    ( (This)->lpVtbl -> RampUp(This,numberOfFrames) ) 

+

+#define IDeckLinkKeyer_RampDown(This,numberOfFrames)	\

+    ( (This)->lpVtbl -> RampDown(This,numberOfFrames) ) 

+

+#define IDeckLinkKeyer_Disable(This)	\

+    ( (This)->lpVtbl -> Disable(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkKeyer_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoConversion_INTERFACE_DEFINED__

+#define __IDeckLinkVideoConversion_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoConversion */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoConversion;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("3BBCB8A2-DA2C-42D9-B5D8-88083644E99A")

+    IDeckLinkVideoConversion : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE ConvertFrame( 

+            /* [in] */ IDeckLinkVideoFrame *srcFrame,

+            /* [in] */ IDeckLinkVideoFrame *dstFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoConversionVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoConversion * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoConversion * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoConversion * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( 

+            IDeckLinkVideoConversion * This,

+            /* [in] */ IDeckLinkVideoFrame *srcFrame,

+            /* [in] */ IDeckLinkVideoFrame *dstFrame);

+        

+        END_INTERFACE

+    } IDeckLinkVideoConversionVtbl;

+

+    interface IDeckLinkVideoConversion

+    {

+        CONST_VTBL struct IDeckLinkVideoConversionVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoConversion_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoConversion_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoConversion_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoConversion_ConvertFrame(This,srcFrame,dstFrame)	\

+    ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoConversion_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__

+#define __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDeviceNotificationCallback */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDeviceNotificationCallback;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("4997053B-0ADF-4CC8-AC70-7A50C4BE728F")

+    IDeckLinkDeviceNotificationCallback : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DeckLinkDeviceArrived( 

+            /* [in] */ IDeckLink *deckLinkDevice) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DeckLinkDeviceRemoved( 

+            /* [in] */ IDeckLink *deckLinkDevice) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDeviceNotificationCallbackVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDeviceNotificationCallback * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDeviceNotificationCallback * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDeviceNotificationCallback * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DeckLinkDeviceArrived )( 

+            IDeckLinkDeviceNotificationCallback * This,

+            /* [in] */ IDeckLink *deckLinkDevice);

+        

+        HRESULT ( STDMETHODCALLTYPE *DeckLinkDeviceRemoved )( 

+            IDeckLinkDeviceNotificationCallback * This,

+            /* [in] */ IDeckLink *deckLinkDevice);

+        

+        END_INTERFACE

+    } IDeckLinkDeviceNotificationCallbackVtbl;

+

+    interface IDeckLinkDeviceNotificationCallback

+    {

+        CONST_VTBL struct IDeckLinkDeviceNotificationCallbackVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDeviceNotificationCallback_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDeviceNotificationCallback_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDeviceNotificationCallback_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDeviceNotificationCallback_DeckLinkDeviceArrived(This,deckLinkDevice)	\

+    ( (This)->lpVtbl -> DeckLinkDeviceArrived(This,deckLinkDevice) ) 

+

+#define IDeckLinkDeviceNotificationCallback_DeckLinkDeviceRemoved(This,deckLinkDevice)	\

+    ( (This)->lpVtbl -> DeckLinkDeviceRemoved(This,deckLinkDevice) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDiscovery_INTERFACE_DEFINED__

+#define __IDeckLinkDiscovery_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDiscovery */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDiscovery;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("CDBF631C-BC76-45FA-B44D-C55059BC6101")

+    IDeckLinkDiscovery : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE InstallDeviceNotifications( 

+            /* [in] */ IDeckLinkDeviceNotificationCallback *deviceNotificationCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE UninstallDeviceNotifications( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDiscoveryVtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDiscovery * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDiscovery * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDiscovery * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *InstallDeviceNotifications )( 

+            IDeckLinkDiscovery * This,

+            /* [in] */ IDeckLinkDeviceNotificationCallback *deviceNotificationCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *UninstallDeviceNotifications )( 

+            IDeckLinkDiscovery * This);

+        

+        END_INTERFACE

+    } IDeckLinkDiscoveryVtbl;

+

+    interface IDeckLinkDiscovery

+    {

+        CONST_VTBL struct IDeckLinkDiscoveryVtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDiscovery_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDiscovery_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDiscovery_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDiscovery_InstallDeviceNotifications(This,deviceNotificationCallback)	\

+    ( (This)->lpVtbl -> InstallDeviceNotifications(This,deviceNotificationCallback) ) 

+

+#define IDeckLinkDiscovery_UninstallDeviceNotifications(This)	\

+    ( (This)->lpVtbl -> UninstallDeviceNotifications(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDiscovery_INTERFACE_DEFINED__ */

+

+

+EXTERN_C const CLSID CLSID_CDeckLinkIterator;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("1F2E109A-8F4F-49E4-9203-135595CB6FA5")

+CDeckLinkIterator;

+#endif

+

+EXTERN_C const CLSID CLSID_CDeckLinkAPIInformation;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("263CA19F-ED09-482E-9F9D-84005783A237")

+CDeckLinkAPIInformation;

+#endif

+

+EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("F63E77C7-B655-4A4A-9AD0-3CA85D394343")

+CDeckLinkGLScreenPreviewHelper;

+#endif

+

+EXTERN_C const CLSID CLSID_CDeckLinkDX9ScreenPreviewHelper;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("CC010023-E01D-4525-9D59-80C8AB3DC7A0")

+CDeckLinkDX9ScreenPreviewHelper;

+#endif

+

+EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("7DBBBB11-5B7B-467D-AEA4-CEA468FD368C")

+CDeckLinkVideoConversion;

+#endif

+

+EXTERN_C const CLSID CLSID_CDeckLinkDiscovery;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("1073A05C-D885-47E9-B3C6-129B3F9F648B")

+CDeckLinkDiscovery;

+#endif

+

+#ifndef __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__

+#define __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__

+

+/* interface IDeckLinkConfiguration_v10_2 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkConfiguration_v10_2;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("C679A35B-610C-4D09-B748-1D0478100FC0")

+    IDeckLinkConfiguration_v10_2 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE SetFlag( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BOOL value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFlag( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BOOL *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetInt( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ LONGLONG value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetInt( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ LONGLONG *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetFloat( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ double value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFloat( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ double *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetString( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BSTR value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetString( 

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BSTR *value) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkConfiguration_v10_2Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkConfiguration_v10_2 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkConfiguration_v10_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFlag )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BOOL value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFlag )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BOOL *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetInt )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ LONGLONG value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetInt )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ LONGLONG *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFloat )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ double value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFloat )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ double *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetString )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [in] */ BSTR value);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IDeckLinkConfiguration_v10_2 * This,

+            /* [in] */ BMDDeckLinkConfigurationID cfgID,

+            /* [out] */ BSTR *value);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( 

+            IDeckLinkConfiguration_v10_2 * This);

+        

+        END_INTERFACE

+    } IDeckLinkConfiguration_v10_2Vtbl;

+

+    interface IDeckLinkConfiguration_v10_2

+    {

+        CONST_VTBL struct IDeckLinkConfiguration_v10_2Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkConfiguration_v10_2_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkConfiguration_v10_2_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkConfiguration_v10_2_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkConfiguration_v10_2_SetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_GetFlag(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_SetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_GetInt(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_SetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_GetFloat(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_SetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> SetString(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_GetString(This,cfgID,value)	\

+    ( (This)->lpVtbl -> GetString(This,cfgID,value) ) 

+

+#define IDeckLinkConfiguration_v10_2_WriteConfigurationToPreferences(This)	\

+    ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v9_9_INTERFACE_DEFINED__

+#define __IDeckLinkOutput_v9_9_INTERFACE_DEFINED__

+

+/* interface IDeckLinkOutput_v9_9 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkOutput_v9_9;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("A3EF0963-0862-44ED-92A9-EE89ABF431C7")

+    IDeckLinkOutput_v9_9 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoOutputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDVideoOutputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 

+            /* [in] */ long width,

+            /* [in] */ long height,

+            /* [in] */ long rowBytes,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( 

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 

+            /* [in] */ IDeckLinkVideoFrame *theFrame,

+            /* [in] */ BMDTimeValue displayTime,

+            /* [in] */ BMDTimeValue displayDuration,

+            /* [in] */ BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 

+            /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( 

+            /* [out] */ unsigned long *bufferedFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount,

+            /* [in] */ BMDAudioOutputStreamType streamType) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [in] */ BMDTimeValue streamTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 

+            /* [out] */ unsigned long *bufferedSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 

+            /* [in] */ BMDTimeValue playbackStartTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ double playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 

+            /* [in] */ BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            /* [in] */ BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( 

+            /* [out] */ BOOL *active) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( 

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *streamTime,

+            /* [out] */ double *playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( 

+            /* [out] */ BMDReferenceStatus *referenceStatus) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkOutput_v9_9Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkOutput_v9_9 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkOutput_v9_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoOutputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDVideoOutputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 

+            IDeckLinkOutput_v9_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ long width,

+            /* [in] */ long height,

+            /* [in] */ long rowBytes,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame **outFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ IDeckLinkVideoFrame *theFrame,

+            /* [in] */ BMDTimeValue displayTime,

+            /* [in] */ BMDTimeValue displayDuration,

+            /* [in] */ BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ IDeckLinkVideoOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [out] */ unsigned long *bufferedFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount,

+            /* [in] */ BMDAudioOutputStreamType streamType);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 

+            IDeckLinkOutput_v9_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 

+            IDeckLinkOutput_v9_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 

+            IDeckLinkOutput_v9_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ void *buffer,

+            /* [in] */ unsigned long sampleFrameCount,

+            /* [in] */ BMDTimeValue streamTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [out] */ unsigned long *bufferedSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 

+            IDeckLinkOutput_v9_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDTimeValue playbackStartTime,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ double playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            /* [in] */ BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [out] */ BOOL *active);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *streamTime,

+            /* [out] */ double *playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [out] */ BMDReferenceStatus *referenceStatus);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkOutput_v9_9 * This,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame);

+        

+        END_INTERFACE

+    } IDeckLinkOutput_v9_9Vtbl;

+

+    interface IDeckLinkOutput_v9_9

+    {

+        CONST_VTBL struct IDeckLinkOutput_v9_9Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkOutput_v9_9_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkOutput_v9_9_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkOutput_v9_9_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkOutput_v9_9_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) 

+

+#define IDeckLinkOutput_v9_9_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkOutput_v9_9_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkOutput_v9_9_EnableVideoOutput(This,displayMode,flags)	\

+    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) 

+

+#define IDeckLinkOutput_v9_9_DisableVideoOutput(This)	\

+    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 

+

+#define IDeckLinkOutput_v9_9_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\

+    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 

+

+#define IDeckLinkOutput_v9_9_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\

+    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 

+

+#define IDeckLinkOutput_v9_9_CreateAncillaryData(This,pixelFormat,outBuffer)	\

+    ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) 

+

+#define IDeckLinkOutput_v9_9_DisplayVideoFrameSync(This,theFrame)	\

+    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 

+

+#define IDeckLinkOutput_v9_9_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\

+    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 

+

+#define IDeckLinkOutput_v9_9_SetScheduledFrameCompletionCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v9_9_GetBufferedVideoFrameCount(This,bufferedFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) 

+

+#define IDeckLinkOutput_v9_9_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType)	\

+    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) 

+

+#define IDeckLinkOutput_v9_9_DisableAudioOutput(This)	\

+    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 

+

+#define IDeckLinkOutput_v9_9_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v9_9_BeginAudioPreroll(This)	\

+    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v9_9_EndAudioPreroll(This)	\

+    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v9_9_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v9_9_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) 

+

+#define IDeckLinkOutput_v9_9_FlushBufferedAudioSamples(This)	\

+    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 

+

+#define IDeckLinkOutput_v9_9_SetAudioCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v9_9_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\

+    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 

+

+#define IDeckLinkOutput_v9_9_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\

+    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 

+

+#define IDeckLinkOutput_v9_9_IsScheduledPlaybackRunning(This,active)	\

+    ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) 

+

+#define IDeckLinkOutput_v9_9_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed)	\

+    ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) 

+

+#define IDeckLinkOutput_v9_9_GetReferenceStatus(This,referenceStatus)	\

+    ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) 

+

+#define IDeckLinkOutput_v9_9_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkOutput_v9_9_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v9_2_INTERFACE_DEFINED__

+#define __IDeckLinkInput_v9_2_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInput_v9_2 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInput_v9_2;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("6D40EF78-28B9-4E21-990D-95BB7750A04F")

+    IDeckLinkInput_v9_2 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( 

+            /* [out] */ unsigned long *availableFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( 

+            /* [out] */ unsigned long *availableSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkInputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInput_v9_2Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags,

+            /* [out] */ BMDDisplayModeSupport *result,

+            /* [out] */ IDeckLinkDisplayMode **resultDisplayMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [in] */ BMDDisplayMode displayMode,

+            /* [in] */ BMDPixelFormat pixelFormat,

+            /* [in] */ BMDVideoInputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [out] */ unsigned long *availableFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [in] */ BMDAudioSampleRate sampleRate,

+            /* [in] */ BMDAudioSampleType sampleType,

+            /* [in] */ unsigned long channelCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [out] */ unsigned long *availableSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushStreams )( 

+            IDeckLinkInput_v9_2 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [in] */ IDeckLinkInputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkInput_v9_2 * This,

+            /* [in] */ BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame);

+        

+        END_INTERFACE

+    } IDeckLinkInput_v9_2Vtbl;

+

+    interface IDeckLinkInput_v9_2

+    {

+        CONST_VTBL struct IDeckLinkInput_v9_2Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInput_v9_2_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInput_v9_2_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInput_v9_2_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInput_v9_2_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) 

+

+#define IDeckLinkInput_v9_2_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkInput_v9_2_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkInput_v9_2_EnableVideoInput(This,displayMode,pixelFormat,flags)	\

+    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 

+

+#define IDeckLinkInput_v9_2_DisableVideoInput(This)	\

+    ( (This)->lpVtbl -> DisableVideoInput(This) ) 

+

+#define IDeckLinkInput_v9_2_GetAvailableVideoFrameCount(This,availableFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) 

+

+#define IDeckLinkInput_v9_2_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\

+    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 

+

+#define IDeckLinkInput_v9_2_DisableAudioInput(This)	\

+    ( (This)->lpVtbl -> DisableAudioInput(This) ) 

+

+#define IDeckLinkInput_v9_2_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) 

+

+#define IDeckLinkInput_v9_2_StartStreams(This)	\

+    ( (This)->lpVtbl -> StartStreams(This) ) 

+

+#define IDeckLinkInput_v9_2_StopStreams(This)	\

+    ( (This)->lpVtbl -> StopStreams(This) ) 

+

+#define IDeckLinkInput_v9_2_PauseStreams(This)	\

+    ( (This)->lpVtbl -> PauseStreams(This) ) 

+

+#define IDeckLinkInput_v9_2_FlushStreams(This)	\

+    ( (This)->lpVtbl -> FlushStreams(This) ) 

+

+#define IDeckLinkInput_v9_2_SetCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 

+

+#define IDeckLinkInput_v9_2_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInput_v9_2_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControlStatusCallback_v8_1_INTERFACE_DEFINED__

+#define __IDeckLinkDeckControlStatusCallback_v8_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDeckControlStatusCallback_v8_1 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDeckControlStatusCallback_v8_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("E5F693C1-4283-4716-B18F-C1431521955B")

+    IDeckLinkDeckControlStatusCallback_v8_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE TimecodeUpdate( 

+            /* [in] */ BMDTimecodeBCD currentTimecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE VTRControlStateChanged( 

+            /* [in] */ BMDDeckControlVTRControlState_v8_1 newState,

+            /* [in] */ BMDDeckControlError error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DeckControlEventReceived( 

+            /* [in] */ BMDDeckControlEvent event,

+            /* [in] */ BMDDeckControlError error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DeckControlStatusChanged( 

+            /* [in] */ BMDDeckControlStatusFlags flags,

+            /* [in] */ unsigned long mask) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDeckControlStatusCallback_v8_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDeckControlStatusCallback_v8_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDeckControlStatusCallback_v8_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDeckControlStatusCallback_v8_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *TimecodeUpdate )( 

+            IDeckLinkDeckControlStatusCallback_v8_1 * This,

+            /* [in] */ BMDTimecodeBCD currentTimecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *VTRControlStateChanged )( 

+            IDeckLinkDeckControlStatusCallback_v8_1 * This,

+            /* [in] */ BMDDeckControlVTRControlState_v8_1 newState,

+            /* [in] */ BMDDeckControlError error);

+        

+        HRESULT ( STDMETHODCALLTYPE *DeckControlEventReceived )( 

+            IDeckLinkDeckControlStatusCallback_v8_1 * This,

+            /* [in] */ BMDDeckControlEvent event,

+            /* [in] */ BMDDeckControlError error);

+        

+        HRESULT ( STDMETHODCALLTYPE *DeckControlStatusChanged )( 

+            IDeckLinkDeckControlStatusCallback_v8_1 * This,

+            /* [in] */ BMDDeckControlStatusFlags flags,

+            /* [in] */ unsigned long mask);

+        

+        END_INTERFACE

+    } IDeckLinkDeckControlStatusCallback_v8_1Vtbl;

+

+    interface IDeckLinkDeckControlStatusCallback_v8_1

+    {

+        CONST_VTBL struct IDeckLinkDeckControlStatusCallback_v8_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDeckControlStatusCallback_v8_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDeckControlStatusCallback_v8_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDeckControlStatusCallback_v8_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDeckControlStatusCallback_v8_1_TimecodeUpdate(This,currentTimecode)	\

+    ( (This)->lpVtbl -> TimecodeUpdate(This,currentTimecode) ) 

+

+#define IDeckLinkDeckControlStatusCallback_v8_1_VTRControlStateChanged(This,newState,error)	\

+    ( (This)->lpVtbl -> VTRControlStateChanged(This,newState,error) ) 

+

+#define IDeckLinkDeckControlStatusCallback_v8_1_DeckControlEventReceived(This,event,error)	\

+    ( (This)->lpVtbl -> DeckControlEventReceived(This,event,error) ) 

+

+#define IDeckLinkDeckControlStatusCallback_v8_1_DeckControlStatusChanged(This,flags,mask)	\

+    ( (This)->lpVtbl -> DeckControlStatusChanged(This,flags,mask) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDeckControlStatusCallback_v8_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDeckControl_v8_1_INTERFACE_DEFINED__

+#define __IDeckLinkDeckControl_v8_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDeckControl_v8_1 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDeckControl_v8_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("522A9E39-0F3C-4742-94EE-D80DE335DA1D")

+    IDeckLinkDeckControl_v8_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Open( 

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ BMDTimeValue timeValue,

+            /* [in] */ BOOL timecodeIsDropFrame,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Close( 

+            /* [in] */ BOOL standbyOn) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetCurrentState( 

+            /* [out] */ BMDDeckControlMode *mode,

+            /* [out] */ BMDDeckControlVTRControlState_v8_1 *vtrControlState,

+            /* [out] */ BMDDeckControlStatusFlags *flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetStandby( 

+            /* [in] */ BOOL standbyOn) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SendCommand( 

+            /* [in] */ unsigned char *inBuffer,

+            /* [in] */ unsigned long inBufferSize,

+            /* [out] */ unsigned char *outBuffer,

+            /* [out] */ unsigned long *outDataSize,

+            /* [in] */ unsigned long outBufferSize,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Play( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Stop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Eject( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GoToTimecode( 

+            /* [in] */ BMDTimecodeBCD timecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FastForward( 

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Rewind( 

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StepForward( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StepBack( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Jog( 

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Shuttle( 

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( 

+            /* [out] */ BSTR *currentTimeCode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 

+            /* [out] */ IDeckLinkTimecode **currentTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( 

+            /* [out] */ BMDTimecodeBCD *currentTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetPreroll( 

+            /* [in] */ unsigned long prerollSeconds) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetPreroll( 

+            /* [out] */ unsigned long *prerollSeconds) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetExportOffset( 

+            /* [in] */ long exportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetExportOffset( 

+            /* [out] */ long *exportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( 

+            /* [out] */ long *deckManualExportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( 

+            /* [in] */ long captureOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( 

+            /* [out] */ long *captureOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartExport( 

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartCapture( 

+            /* [in] */ BOOL useVITC,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDeviceID( 

+            /* [out] */ unsigned short *deviceId,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkDeckControlStatusCallback_v8_1 *callback) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDeckControl_v8_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDeckControl_v8_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDeckControl_v8_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Open )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ BMDTimeValue timeValue,

+            /* [in] */ BOOL timecodeIsDropFrame,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Close )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BOOL standbyOn);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlMode *mode,

+            /* [out] */ BMDDeckControlVTRControlState_v8_1 *vtrControlState,

+            /* [out] */ BMDDeckControlStatusFlags *flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetStandby )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BOOL standbyOn);

+        

+        HRESULT ( STDMETHODCALLTYPE *SendCommand )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ unsigned char *inBuffer,

+            /* [in] */ unsigned long inBufferSize,

+            /* [out] */ unsigned char *outBuffer,

+            /* [out] */ unsigned long *outDataSize,

+            /* [in] */ unsigned long outBufferSize,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Play )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Stop )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Eject )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BMDTimecodeBCD timecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *FastForward )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Rewind )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StepForward )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StepBack )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Jog )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Shuttle )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BSTR *currentTimeCode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ IDeckLinkTimecode **currentTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDTimecodeBCD *currentTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetPreroll )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ unsigned long prerollSeconds);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetPreroll )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ unsigned long *prerollSeconds);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ long exportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ long *exportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ long *deckManualExportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ long captureOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ long *captureOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartExport )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartCapture )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ BOOL useVITC,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ unsigned short *deviceId,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Abort )( 

+            IDeckLinkDeckControl_v8_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkDeckControl_v8_1 * This,

+            /* [in] */ IDeckLinkDeckControlStatusCallback_v8_1 *callback);

+        

+        END_INTERFACE

+    } IDeckLinkDeckControl_v8_1Vtbl;

+

+    interface IDeckLinkDeckControl_v8_1

+    {

+        CONST_VTBL struct IDeckLinkDeckControl_v8_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDeckControl_v8_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDeckControl_v8_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDeckControl_v8_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDeckControl_v8_1_Open(This,timeScale,timeValue,timecodeIsDropFrame,error)	\

+    ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Close(This,standbyOn)	\

+    ( (This)->lpVtbl -> Close(This,standbyOn) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetCurrentState(This,mode,vtrControlState,flags)	\

+    ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) 

+

+#define IDeckLinkDeckControl_v8_1_SetStandby(This,standbyOn)	\

+    ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) 

+

+#define IDeckLinkDeckControl_v8_1_SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error)	\

+    ( (This)->lpVtbl -> SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Play(This,error)	\

+    ( (This)->lpVtbl -> Play(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Stop(This,error)	\

+    ( (This)->lpVtbl -> Stop(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_TogglePlayStop(This,error)	\

+    ( (This)->lpVtbl -> TogglePlayStop(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Eject(This,error)	\

+    ( (This)->lpVtbl -> Eject(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_GoToTimecode(This,timecode,error)	\

+    ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_FastForward(This,viewTape,error)	\

+    ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Rewind(This,viewTape,error)	\

+    ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_StepForward(This,error)	\

+    ( (This)->lpVtbl -> StepForward(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_StepBack(This,error)	\

+    ( (This)->lpVtbl -> StepBack(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Jog(This,rate,error)	\

+    ( (This)->lpVtbl -> Jog(This,rate,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Shuttle(This,rate,error)	\

+    ( (This)->lpVtbl -> Shuttle(This,rate,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetTimecodeString(This,currentTimeCode,error)	\

+    ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetTimecode(This,currentTimecode,error)	\

+    ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetTimecodeBCD(This,currentTimecode,error)	\

+    ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_SetPreroll(This,prerollSeconds)	\

+    ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetPreroll(This,prerollSeconds)	\

+    ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) 

+

+#define IDeckLinkDeckControl_v8_1_SetExportOffset(This,exportOffsetFields)	\

+    ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetExportOffset(This,exportOffsetFields)	\

+    ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetManualExportOffset(This,deckManualExportOffsetFields)	\

+    ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v8_1_SetCaptureOffset(This,captureOffsetFields)	\

+    ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetCaptureOffset(This,captureOffsetFields)	\

+    ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v8_1_StartExport(This,inTimecode,outTimecode,exportModeOps,error)	\

+    ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_StartCapture(This,useVITC,inTimecode,outTimecode,error)	\

+    ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_GetDeviceID(This,deviceId,error)	\

+    ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_Abort(This)	\

+    ( (This)->lpVtbl -> Abort(This) ) 

+

+#define IDeckLinkDeckControl_v8_1_CrashRecordStart(This,error)	\

+    ( (This)->lpVtbl -> CrashRecordStart(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_CrashRecordStop(This,error)	\

+    ( (This)->lpVtbl -> CrashRecordStop(This,error) ) 

+

+#define IDeckLinkDeckControl_v8_1_SetCallback(This,callback)	\

+    ( (This)->lpVtbl -> SetCallback(This,callback) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDeckControl_v8_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLink_v8_0_INTERFACE_DEFINED__

+#define __IDeckLink_v8_0_INTERFACE_DEFINED__

+

+/* interface IDeckLink_v8_0 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLink_v8_0;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("62BFF75D-6569-4E55-8D4D-66AA03829ABC")

+    IDeckLink_v8_0 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetModelName( 

+            /* [out] */ BSTR *modelName) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLink_v8_0Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLink_v8_0 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLink_v8_0 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLink_v8_0 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetModelName )( 

+            IDeckLink_v8_0 * This,

+            /* [out] */ BSTR *modelName);

+        

+        END_INTERFACE

+    } IDeckLink_v8_0Vtbl;

+

+    interface IDeckLink_v8_0

+    {

+        CONST_VTBL struct IDeckLink_v8_0Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLink_v8_0_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLink_v8_0_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLink_v8_0_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLink_v8_0_GetModelName(This,modelName)	\

+    ( (This)->lpVtbl -> GetModelName(This,modelName) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLink_v8_0_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkIterator_v8_0_INTERFACE_DEFINED__

+#define __IDeckLinkIterator_v8_0_INTERFACE_DEFINED__

+

+/* interface IDeckLinkIterator_v8_0 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkIterator_v8_0;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("74E936FC-CC28-4A67-81A0-1E94E52D4E69")

+    IDeckLinkIterator_v8_0 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Next( 

+            /* [out] */ IDeckLink_v8_0 **deckLinkInstance) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkIterator_v8_0Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkIterator_v8_0 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkIterator_v8_0 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkIterator_v8_0 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Next )( 

+            IDeckLinkIterator_v8_0 * This,

+            /* [out] */ IDeckLink_v8_0 **deckLinkInstance);

+        

+        END_INTERFACE

+    } IDeckLinkIterator_v8_0Vtbl;

+

+    interface IDeckLinkIterator_v8_0

+    {

+        CONST_VTBL struct IDeckLinkIterator_v8_0Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkIterator_v8_0_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkIterator_v8_0_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkIterator_v8_0_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkIterator_v8_0_Next(This,deckLinkInstance)	\

+    ( (This)->lpVtbl -> Next(This,deckLinkInstance) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkIterator_v8_0_INTERFACE_DEFINED__ */

+

+

+EXTERN_C const CLSID CLSID_CDeckLinkIterator_v8_0;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("D9EDA3B3-2887-41FA-B724-017CF1EB1D37")

+CDeckLinkIterator_v8_0;

+#endif

+

+#ifndef __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__

+#define __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDeckControl_v7_9 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDeckControl_v7_9;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("A4D81043-0619-42B7-8ED6-602D29041DF7")

+    IDeckLinkDeckControl_v7_9 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Open( 

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ BMDTimeValue timeValue,

+            /* [in] */ BOOL timecodeIsDropFrame,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Close( 

+            /* [in] */ BOOL standbyOn) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetCurrentState( 

+            /* [out] */ BMDDeckControlMode *mode,

+            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,

+            /* [out] */ BMDDeckControlStatusFlags *flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetStandby( 

+            /* [in] */ BOOL standbyOn) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Play( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Stop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Eject( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GoToTimecode( 

+            /* [in] */ BMDTimecodeBCD timecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FastForward( 

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Rewind( 

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StepForward( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StepBack( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Jog( 

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Shuttle( 

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( 

+            /* [out] */ BSTR *currentTimeCode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 

+            /* [out] */ IDeckLinkTimecode **currentTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( 

+            /* [out] */ BMDTimecodeBCD *currentTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetPreroll( 

+            /* [in] */ unsigned long prerollSeconds) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetPreroll( 

+            /* [out] */ unsigned long *prerollSeconds) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetExportOffset( 

+            /* [in] */ long exportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetExportOffset( 

+            /* [out] */ long *exportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( 

+            /* [out] */ long *deckManualExportOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( 

+            /* [in] */ long captureOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( 

+            /* [out] */ long *captureOffsetFields) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartExport( 

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartCapture( 

+            /* [in] */ BOOL useVITC,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDeviceID( 

+            /* [out] */ unsigned short *deviceId,

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( 

+            /* [out] */ BMDDeckControlError *error) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkDeckControlStatusCallback *callback) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDeckControl_v7_9Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDeckControl_v7_9 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDeckControl_v7_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Open )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BMDTimeScale timeScale,

+            /* [in] */ BMDTimeValue timeValue,

+            /* [in] */ BOOL timecodeIsDropFrame,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Close )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BOOL standbyOn);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlMode *mode,

+            /* [out] */ BMDDeckControlVTRControlState *vtrControlState,

+            /* [out] */ BMDDeckControlStatusFlags *flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetStandby )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BOOL standbyOn);

+        

+        HRESULT ( STDMETHODCALLTYPE *Play )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Stop )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Eject )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BMDTimecodeBCD timecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *FastForward )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Rewind )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BOOL viewTape,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StepForward )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StepBack )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Jog )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Shuttle )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ double rate,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BSTR *currentTimeCode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ IDeckLinkTimecode **currentTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDTimecodeBCD *currentTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetPreroll )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ unsigned long prerollSeconds);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetPreroll )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ unsigned long *prerollSeconds);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ long exportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ long *exportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ long *deckManualExportOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ long captureOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ long *captureOffsetFields);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartExport )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartCapture )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ BOOL useVITC,

+            /* [in] */ BMDTimecodeBCD inTimecode,

+            /* [in] */ BMDTimecodeBCD outTimecode,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ unsigned short *deviceId,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *Abort )( 

+            IDeckLinkDeckControl_v7_9 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [out] */ BMDDeckControlError *error);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkDeckControl_v7_9 * This,

+            /* [in] */ IDeckLinkDeckControlStatusCallback *callback);

+        

+        END_INTERFACE

+    } IDeckLinkDeckControl_v7_9Vtbl;

+

+    interface IDeckLinkDeckControl_v7_9

+    {

+        CONST_VTBL struct IDeckLinkDeckControl_v7_9Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDeckControl_v7_9_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDeckControl_v7_9_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDeckControl_v7_9_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDeckControl_v7_9_Open(This,timeScale,timeValue,timecodeIsDropFrame,error)	\

+    ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_Close(This,standbyOn)	\

+    ( (This)->lpVtbl -> Close(This,standbyOn) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetCurrentState(This,mode,vtrControlState,flags)	\

+    ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) 

+

+#define IDeckLinkDeckControl_v7_9_SetStandby(This,standbyOn)	\

+    ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) 

+

+#define IDeckLinkDeckControl_v7_9_Play(This,error)	\

+    ( (This)->lpVtbl -> Play(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_Stop(This,error)	\

+    ( (This)->lpVtbl -> Stop(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_TogglePlayStop(This,error)	\

+    ( (This)->lpVtbl -> TogglePlayStop(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_Eject(This,error)	\

+    ( (This)->lpVtbl -> Eject(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_GoToTimecode(This,timecode,error)	\

+    ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_FastForward(This,viewTape,error)	\

+    ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_Rewind(This,viewTape,error)	\

+    ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_StepForward(This,error)	\

+    ( (This)->lpVtbl -> StepForward(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_StepBack(This,error)	\

+    ( (This)->lpVtbl -> StepBack(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_Jog(This,rate,error)	\

+    ( (This)->lpVtbl -> Jog(This,rate,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_Shuttle(This,rate,error)	\

+    ( (This)->lpVtbl -> Shuttle(This,rate,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetTimecodeString(This,currentTimeCode,error)	\

+    ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetTimecode(This,currentTimecode,error)	\

+    ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetTimecodeBCD(This,currentTimecode,error)	\

+    ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_SetPreroll(This,prerollSeconds)	\

+    ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetPreroll(This,prerollSeconds)	\

+    ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) 

+

+#define IDeckLinkDeckControl_v7_9_SetExportOffset(This,exportOffsetFields)	\

+    ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetExportOffset(This,exportOffsetFields)	\

+    ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetManualExportOffset(This,deckManualExportOffsetFields)	\

+    ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v7_9_SetCaptureOffset(This,captureOffsetFields)	\

+    ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetCaptureOffset(This,captureOffsetFields)	\

+    ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) 

+

+#define IDeckLinkDeckControl_v7_9_StartExport(This,inTimecode,outTimecode,exportModeOps,error)	\

+    ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_StartCapture(This,useVITC,inTimecode,outTimecode,error)	\

+    ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_GetDeviceID(This,deviceId,error)	\

+    ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_Abort(This)	\

+    ( (This)->lpVtbl -> Abort(This) ) 

+

+#define IDeckLinkDeckControl_v7_9_CrashRecordStart(This,error)	\

+    ( (This)->lpVtbl -> CrashRecordStart(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_CrashRecordStop(This,error)	\

+    ( (This)->lpVtbl -> CrashRecordStop(This,error) ) 

+

+#define IDeckLinkDeckControl_v7_9_SetCallback(This,callback)	\

+    ( (This)->lpVtbl -> SetCallback(This,callback) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDisplayModeIterator_v7_6 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDisplayModeIterator_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("455D741F-1779-4800-86F5-0B5D13D79751")

+    IDeckLinkDisplayModeIterator_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Next( 

+            /* [out] */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDisplayModeIterator_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDisplayModeIterator_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDisplayModeIterator_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDisplayModeIterator_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Next )( 

+            IDeckLinkDisplayModeIterator_v7_6 * This,

+            /* [out] */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode);

+        

+        END_INTERFACE

+    } IDeckLinkDisplayModeIterator_v7_6Vtbl;

+

+    interface IDeckLinkDisplayModeIterator_v7_6

+    {

+        CONST_VTBL struct IDeckLinkDisplayModeIterator_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDisplayModeIterator_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDisplayModeIterator_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDisplayModeIterator_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDisplayModeIterator_v7_6_Next(This,deckLinkDisplayMode)	\

+    ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDisplayMode_v7_6 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDisplayMode_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("87451E84-2B7E-439E-A629-4393EA4A8550")

+    IDeckLinkDisplayMode_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetName( 

+            /* [out] */ BSTR *name) = 0;

+        

+        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFrameRate( 

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [out] */ BMDTimeScale *timeScale) = 0;

+        

+        virtual BMDFieldDominance STDMETHODCALLTYPE GetFieldDominance( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDisplayMode_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDisplayMode_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDisplayMode_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDisplayMode_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetName )( 

+            IDeckLinkDisplayMode_v7_6 * This,

+            /* [out] */ BSTR *name);

+        

+        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 

+            IDeckLinkDisplayMode_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkDisplayMode_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkDisplayMode_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( 

+            IDeckLinkDisplayMode_v7_6 * This,

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [out] */ BMDTimeScale *timeScale);

+        

+        BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( 

+            IDeckLinkDisplayMode_v7_6 * This);

+        

+        END_INTERFACE

+    } IDeckLinkDisplayMode_v7_6Vtbl;

+

+    interface IDeckLinkDisplayMode_v7_6

+    {

+        CONST_VTBL struct IDeckLinkDisplayMode_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDisplayMode_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDisplayMode_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDisplayMode_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDisplayMode_v7_6_GetName(This,name)	\

+    ( (This)->lpVtbl -> GetName(This,name) ) 

+

+#define IDeckLinkDisplayMode_v7_6_GetDisplayMode(This)	\

+    ( (This)->lpVtbl -> GetDisplayMode(This) ) 

+

+#define IDeckLinkDisplayMode_v7_6_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkDisplayMode_v7_6_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkDisplayMode_v7_6_GetFrameRate(This,frameDuration,timeScale)	\

+    ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) 

+

+#define IDeckLinkDisplayMode_v7_6_GetFieldDominance(This)	\

+    ( (This)->lpVtbl -> GetFieldDominance(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkOutput_v7_6 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkOutput_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("29228142-EB8C-4141-A621-F74026450955")

+    IDeckLinkOutput_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 

+            BMDDisplayMode displayMode,

+            BMDVideoOutputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( 

+            BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,

+            BMDTimeValue displayTime,

+            BMDTimeValue displayDuration,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 

+            /* [in] */ IDeckLinkVideoOutputCallback_v7_6 *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( 

+            /* [out] */ unsigned long *bufferedFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount,

+            BMDAudioOutputStreamType streamType) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            BMDTimeValue streamTime,

+            BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 

+            /* [out] */ unsigned long *bufferedSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 

+            BMDTimeValue playbackStartTime,

+            BMDTimeScale timeScale,

+            double playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 

+            BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( 

+            /* [out] */ BOOL *active) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( 

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *streamTime,

+            /* [out] */ double *playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkOutput_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkOutput_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkOutput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDDisplayMode displayMode,

+            BMDVideoOutputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 

+            IDeckLinkOutput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 

+            IDeckLinkOutput_v7_6 * This,

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,

+            BMDTimeValue displayTime,

+            BMDTimeValue displayDuration,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ IDeckLinkVideoOutputCallback_v7_6 *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [out] */ unsigned long *bufferedFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount,

+            BMDAudioOutputStreamType streamType);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 

+            IDeckLinkOutput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 

+            IDeckLinkOutput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 

+            IDeckLinkOutput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            BMDTimeValue streamTime,

+            BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [out] */ unsigned long *bufferedSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 

+            IDeckLinkOutput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDTimeValue playbackStartTime,

+            BMDTimeScale timeScale,

+            double playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( 

+            IDeckLinkOutput_v7_6 * This,

+            /* [out] */ BOOL *active);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *streamTime,

+            /* [out] */ double *playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkOutput_v7_6 * This,

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame);

+        

+        END_INTERFACE

+    } IDeckLinkOutput_v7_6Vtbl;

+

+    interface IDeckLinkOutput_v7_6

+    {

+        CONST_VTBL struct IDeckLinkOutput_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkOutput_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkOutput_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkOutput_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkOutput_v7_6_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 

+

+#define IDeckLinkOutput_v7_6_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkOutput_v7_6_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkOutput_v7_6_EnableVideoOutput(This,displayMode,flags)	\

+    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) 

+

+#define IDeckLinkOutput_v7_6_DisableVideoOutput(This)	\

+    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 

+

+#define IDeckLinkOutput_v7_6_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\

+    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 

+

+#define IDeckLinkOutput_v7_6_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\

+    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 

+

+#define IDeckLinkOutput_v7_6_CreateAncillaryData(This,pixelFormat,outBuffer)	\

+    ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) 

+

+#define IDeckLinkOutput_v7_6_DisplayVideoFrameSync(This,theFrame)	\

+    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 

+

+#define IDeckLinkOutput_v7_6_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\

+    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 

+

+#define IDeckLinkOutput_v7_6_SetScheduledFrameCompletionCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v7_6_GetBufferedVideoFrameCount(This,bufferedFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) 

+

+#define IDeckLinkOutput_v7_6_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType)	\

+    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) 

+

+#define IDeckLinkOutput_v7_6_DisableAudioOutput(This)	\

+    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 

+

+#define IDeckLinkOutput_v7_6_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v7_6_BeginAudioPreroll(This)	\

+    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v7_6_EndAudioPreroll(This)	\

+    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v7_6_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v7_6_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) 

+

+#define IDeckLinkOutput_v7_6_FlushBufferedAudioSamples(This)	\

+    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 

+

+#define IDeckLinkOutput_v7_6_SetAudioCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v7_6_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\

+    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 

+

+#define IDeckLinkOutput_v7_6_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\

+    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 

+

+#define IDeckLinkOutput_v7_6_IsScheduledPlaybackRunning(This,active)	\

+    ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) 

+

+#define IDeckLinkOutput_v7_6_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed)	\

+    ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) 

+

+#define IDeckLinkOutput_v7_6_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkInput_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInput_v7_6 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInput_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("300C135A-9F43-48E2-9906-6D7911D93CF1")

+    IDeckLinkInput_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            BMDVideoInputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( 

+            /* [out] */ unsigned long *availableFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( 

+            /* [out] */ unsigned long *availableSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkInputCallback_v7_6 *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInput_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInput_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkInput_v7_6 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkInput_v7_6 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkInput_v7_6 * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 

+            IDeckLinkInput_v7_6 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            BMDVideoInputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( 

+            IDeckLinkInput_v7_6 * This,

+            /* [out] */ unsigned long *availableFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 

+            IDeckLinkInput_v7_6 * This,

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( 

+            IDeckLinkInput_v7_6 * This,

+            /* [out] */ unsigned long *availableSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushStreams )( 

+            IDeckLinkInput_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkInput_v7_6 * This,

+            /* [in] */ IDeckLinkInputCallback_v7_6 *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkInput_v7_6 * This,

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *hardwareTime,

+            /* [out] */ BMDTimeValue *timeInFrame,

+            /* [out] */ BMDTimeValue *ticksPerFrame);

+        

+        END_INTERFACE

+    } IDeckLinkInput_v7_6Vtbl;

+

+    interface IDeckLinkInput_v7_6

+    {

+        CONST_VTBL struct IDeckLinkInput_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInput_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInput_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInput_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInput_v7_6_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 

+

+#define IDeckLinkInput_v7_6_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkInput_v7_6_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkInput_v7_6_EnableVideoInput(This,displayMode,pixelFormat,flags)	\

+    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 

+

+#define IDeckLinkInput_v7_6_DisableVideoInput(This)	\

+    ( (This)->lpVtbl -> DisableVideoInput(This) ) 

+

+#define IDeckLinkInput_v7_6_GetAvailableVideoFrameCount(This,availableFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) 

+

+#define IDeckLinkInput_v7_6_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\

+    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 

+

+#define IDeckLinkInput_v7_6_DisableAudioInput(This)	\

+    ( (This)->lpVtbl -> DisableAudioInput(This) ) 

+

+#define IDeckLinkInput_v7_6_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) 

+

+#define IDeckLinkInput_v7_6_StartStreams(This)	\

+    ( (This)->lpVtbl -> StartStreams(This) ) 

+

+#define IDeckLinkInput_v7_6_StopStreams(This)	\

+    ( (This)->lpVtbl -> StopStreams(This) ) 

+

+#define IDeckLinkInput_v7_6_PauseStreams(This)	\

+    ( (This)->lpVtbl -> PauseStreams(This) ) 

+

+#define IDeckLinkInput_v7_6_FlushStreams(This)	\

+    ( (This)->lpVtbl -> FlushStreams(This) ) 

+

+#define IDeckLinkInput_v7_6_SetCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 

+

+#define IDeckLinkInput_v7_6_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInput_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkTimecode_v7_6 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkTimecode_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("EFB9BCA6-A521-44F7-BD69-2332F24D9EE6")

+    IDeckLinkTimecode_v7_6 : public IUnknown

+    {

+    public:

+        virtual BMDTimecodeBCD STDMETHODCALLTYPE GetBCD( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetComponents( 

+            /* [out] */ unsigned char *hours,

+            /* [out] */ unsigned char *minutes,

+            /* [out] */ unsigned char *seconds,

+            /* [out] */ unsigned char *frames) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetString( 

+            /* [out] */ BSTR *timecode) = 0;

+        

+        virtual BMDTimecodeFlags STDMETHODCALLTYPE GetFlags( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkTimecode_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkTimecode_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkTimecode_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkTimecode_v7_6 * This);

+        

+        BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( 

+            IDeckLinkTimecode_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetComponents )( 

+            IDeckLinkTimecode_v7_6 * This,

+            /* [out] */ unsigned char *hours,

+            /* [out] */ unsigned char *minutes,

+            /* [out] */ unsigned char *seconds,

+            /* [out] */ unsigned char *frames);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetString )( 

+            IDeckLinkTimecode_v7_6 * This,

+            /* [out] */ BSTR *timecode);

+        

+        BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkTimecode_v7_6 * This);

+        

+        END_INTERFACE

+    } IDeckLinkTimecode_v7_6Vtbl;

+

+    interface IDeckLinkTimecode_v7_6

+    {

+        CONST_VTBL struct IDeckLinkTimecode_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkTimecode_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkTimecode_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkTimecode_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkTimecode_v7_6_GetBCD(This)	\

+    ( (This)->lpVtbl -> GetBCD(This) ) 

+

+#define IDeckLinkTimecode_v7_6_GetComponents(This,hours,minutes,seconds,frames)	\

+    ( (This)->lpVtbl -> GetComponents(This,hours,minutes,seconds,frames) ) 

+

+#define IDeckLinkTimecode_v7_6_GetString(This,timecode)	\

+    ( (This)->lpVtbl -> GetString(This,timecode) ) 

+

+#define IDeckLinkTimecode_v7_6_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoFrame_v7_6 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoFrame_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("A8D8238E-6B18-4196-99E1-5AF717B83D32")

+    IDeckLinkVideoFrame_v7_6 : public IUnknown

+    {

+    public:

+        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0;

+        

+        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;

+        

+        virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            /* [out] */ void **buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetTimecode( 

+            BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode_v7_6 **timecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( 

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoFrame_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoFrame_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoFrame_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkVideoFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkVideoFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkVideoFrame_v7_6 * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoFrame_v7_6 * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkVideoFrame_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkVideoFrame_v7_6 * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkVideoFrame_v7_6 * This,

+            BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 

+            IDeckLinkVideoFrame_v7_6 * This,

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);

+        

+        END_INTERFACE

+    } IDeckLinkVideoFrame_v7_6Vtbl;

+

+    interface IDeckLinkVideoFrame_v7_6

+    {

+        CONST_VTBL struct IDeckLinkVideoFrame_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoFrame_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoFrame_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoFrame_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoFrame_v7_6_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkVideoFrame_v7_6_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkVideoFrame_v7_6_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkVideoFrame_v7_6_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoFrame_v7_6_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkVideoFrame_v7_6_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkVideoFrame_v7_6_GetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkVideoFrame_v7_6_GetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkMutableVideoFrame_v7_6 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkMutableVideoFrame_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("46FCEE00-B4E6-43D0-91C0-023A7FCEB34F")

+    IDeckLinkMutableVideoFrame_v7_6 : public IDeckLinkVideoFrame_v7_6

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE SetFlags( 

+            BMDFrameFlags newFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetTimecode( 

+            BMDTimecodeFormat format,

+            /* [in] */ IDeckLinkTimecode_v7_6 *timecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( 

+            BMDTimecodeFormat format,

+            unsigned char hours,

+            unsigned char minutes,

+            unsigned char seconds,

+            unsigned char frames,

+            BMDTimecodeFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( 

+            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkMutableVideoFrame_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFlags )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            BMDFrameFlags newFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetTimecode )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            BMDTimecodeFormat format,

+            /* [in] */ IDeckLinkTimecode_v7_6 *timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            BMDTimecodeFormat format,

+            unsigned char hours,

+            unsigned char minutes,

+            unsigned char seconds,

+            unsigned char frames,

+            BMDTimecodeFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( 

+            IDeckLinkMutableVideoFrame_v7_6 * This,

+            /* [in] */ IDeckLinkVideoFrameAncillary *ancillary);

+        

+        END_INTERFACE

+    } IDeckLinkMutableVideoFrame_v7_6Vtbl;

+

+    interface IDeckLinkMutableVideoFrame_v7_6

+    {

+        CONST_VTBL struct IDeckLinkMutableVideoFrame_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkMutableVideoFrame_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_GetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 

+

+

+#define IDeckLinkMutableVideoFrame_v7_6_SetFlags(This,newFlags)	\

+    ( (This)->lpVtbl -> SetFlags(This,newFlags) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_SetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags)	\

+    ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) 

+

+#define IDeckLinkMutableVideoFrame_v7_6_SetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoInputFrame_v7_6 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("9A74FA41-AE9F-47AC-8CF4-01F42DD59965")

+    IDeckLinkVideoInputFrame_v7_6 : public IDeckLinkVideoFrame_v7_6

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetStreamTime( 

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( 

+            BMDTimeScale timeScale,

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoInputFrame_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoInputFrame_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoInputFrame_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoInputFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkVideoInputFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkVideoInputFrame_v7_6 * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkVideoInputFrame_v7_6 * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoInputFrame_v7_6 * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkVideoInputFrame_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkVideoInputFrame_v7_6 * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkVideoInputFrame_v7_6 * This,

+            BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 

+            IDeckLinkVideoInputFrame_v7_6 * This,

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( 

+            IDeckLinkVideoInputFrame_v7_6 * This,

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( 

+            IDeckLinkVideoInputFrame_v7_6 * This,

+            BMDTimeScale timeScale,

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration);

+        

+        END_INTERFACE

+    } IDeckLinkVideoInputFrame_v7_6Vtbl;

+

+    interface IDeckLinkVideoInputFrame_v7_6

+    {

+        CONST_VTBL struct IDeckLinkVideoInputFrame_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoInputFrame_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoInputFrame_v7_6_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 

+

+

+#define IDeckLinkVideoInputFrame_v7_6_GetStreamTime(This,frameTime,frameDuration,timeScale)	\

+    ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) 

+

+#define IDeckLinkVideoInputFrame_v7_6_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkScreenPreviewCallback_v7_6 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("373F499D-4B4D-4518-AD22-6354E5A5825E")

+    IDeckLinkScreenPreviewCallback_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DrawFrame( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkScreenPreviewCallback_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkScreenPreviewCallback_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkScreenPreviewCallback_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkScreenPreviewCallback_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DrawFrame )( 

+            IDeckLinkScreenPreviewCallback_v7_6 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);

+        

+        END_INTERFACE

+    } IDeckLinkScreenPreviewCallback_v7_6Vtbl;

+

+    interface IDeckLinkScreenPreviewCallback_v7_6

+    {

+        CONST_VTBL struct IDeckLinkScreenPreviewCallback_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkScreenPreviewCallback_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkScreenPreviewCallback_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkScreenPreviewCallback_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkScreenPreviewCallback_v7_6_DrawFrame(This,theFrame)	\

+    ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkGLScreenPreviewHelper_v7_6 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("BA575CD9-A15E-497B-B2C2-F9AFE7BE4EBA")

+    IDeckLinkGLScreenPreviewHelper_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetFrame( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkGLScreenPreviewHelper_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkGLScreenPreviewHelper_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkGLScreenPreviewHelper_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkGLScreenPreviewHelper_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *InitializeGL )( 

+            IDeckLinkGLScreenPreviewHelper_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *PaintGL )( 

+            IDeckLinkGLScreenPreviewHelper_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetFrame )( 

+            IDeckLinkGLScreenPreviewHelper_v7_6 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);

+        

+        END_INTERFACE

+    } IDeckLinkGLScreenPreviewHelper_v7_6Vtbl;

+

+    interface IDeckLinkGLScreenPreviewHelper_v7_6

+    {

+        CONST_VTBL struct IDeckLinkGLScreenPreviewHelper_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkGLScreenPreviewHelper_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkGLScreenPreviewHelper_v7_6_InitializeGL(This)	\

+    ( (This)->lpVtbl -> InitializeGL(This) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_v7_6_PaintGL(This)	\

+    ( (This)->lpVtbl -> PaintGL(This) ) 

+

+#define IDeckLinkGLScreenPreviewHelper_v7_6_SetFrame(This,theFrame)	\

+    ( (This)->lpVtbl -> SetFrame(This,theFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoConversion_v7_6 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoConversion_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("3EB504C9-F97D-40FE-A158-D407D48CB53B")

+    IDeckLinkVideoConversion_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE ConvertFrame( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *srcFrame,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *dstFrame) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoConversion_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoConversion_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoConversion_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoConversion_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( 

+            IDeckLinkVideoConversion_v7_6 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *srcFrame,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *dstFrame);

+        

+        END_INTERFACE

+    } IDeckLinkVideoConversion_v7_6Vtbl;

+

+    interface IDeckLinkVideoConversion_v7_6

+    {

+        CONST_VTBL struct IDeckLinkVideoConversion_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoConversion_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoConversion_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoConversion_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoConversion_v7_6_ConvertFrame(This,srcFrame,dstFrame)	\

+    ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkConfiguration_v7_6 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkConfiguration_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("B8EAD569-B764-47F0-A73F-AE40DF6CBF10")

+    IDeckLinkConfiguration_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetConfigurationValidator( 

+            /* [out] */ IDeckLinkConfiguration_v7_6 **configObject) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFormat( 

+            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE IsVideoOutputActive( 

+            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection,

+            /* [out] */ BOOL *active) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoOutputFlags( 

+            /* [in] */ BMDAnalogVideoFlags analogVideoFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoOutputFlags( 

+            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableFieldFlickerRemovalWhenPaused( 

+            /* [in] */ BOOL enable) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE IsEnabledFieldFlickerRemovalWhenPaused( 

+            /* [out] */ BOOL *enabled) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Set444And3GBpsVideoOutput( 

+            /* [in] */ BOOL enable444VideoOutput,

+            /* [in] */ BOOL enable3GbsOutput) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Get444And3GBpsVideoOutput( 

+            /* [out] */ BOOL *is444VideoOutputEnabled,

+            /* [out] */ BOOL *threeGbsOutputEnabled) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputConversionMode( 

+            /* [in] */ BMDVideoOutputConversionMode conversionMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetVideoOutputConversionMode( 

+            /* [out] */ BMDVideoOutputConversionMode *conversionMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Set_HD1080p24_to_HD1080i5994_Conversion( 

+            /* [in] */ BOOL enable) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Get_HD1080p24_to_HD1080i5994_Conversion( 

+            /* [out] */ BOOL *enabled) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoInputFormat( 

+            /* [in] */ BMDVideoConnection_v7_6 videoInputFormat) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetVideoInputFormat( 

+            /* [out] */ BMDVideoConnection_v7_6 *videoInputFormat) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoInputFlags( 

+            /* [in] */ BMDAnalogVideoFlags analogVideoFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoInputFlags( 

+            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoInputConversionMode( 

+            /* [in] */ BMDVideoInputConversionMode conversionMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetVideoInputConversionMode( 

+            /* [out] */ BMDVideoInputConversionMode *conversionMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetBlackVideoOutputDuringCapture( 

+            /* [in] */ BOOL blackOutInCapture) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBlackVideoOutputDuringCapture( 

+            /* [out] */ BOOL *blackOutInCapture) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Set32PulldownSequenceInitialTimecodeFrame( 

+            /* [in] */ unsigned long aFrameTimecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE Get32PulldownSequenceInitialTimecodeFrame( 

+            /* [out] */ unsigned long *aFrameTimecode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVancSourceLineMapping( 

+            /* [in] */ unsigned long activeLine1VANCsource,

+            /* [in] */ unsigned long activeLine2VANCsource,

+            /* [in] */ unsigned long activeLine3VANCsource) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetVancSourceLineMapping( 

+            /* [out] */ unsigned long *activeLine1VANCsource,

+            /* [out] */ unsigned long *activeLine2VANCsource,

+            /* [out] */ unsigned long *activeLine3VANCsource) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAudioInputFormat( 

+            /* [in] */ BMDAudioConnection_v10_2 audioInputFormat) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAudioInputFormat( 

+            /* [out] */ BMDAudioConnection_v10_2 *audioInputFormat) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkConfiguration_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkConfiguration_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkConfiguration_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetConfigurationValidator )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ IDeckLinkConfiguration_v7_6 **configObject);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( 

+            IDeckLinkConfiguration_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFormat )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsVideoOutputActive )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection,

+            /* [out] */ BOOL *active);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoOutputFlags )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDAnalogVideoFlags analogVideoFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoOutputFlags )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableFieldFlickerRemovalWhenPaused )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BOOL enable);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsEnabledFieldFlickerRemovalWhenPaused )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BOOL *enabled);

+        

+        HRESULT ( STDMETHODCALLTYPE *Set444And3GBpsVideoOutput )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BOOL enable444VideoOutput,

+            /* [in] */ BOOL enable3GbsOutput);

+        

+        HRESULT ( STDMETHODCALLTYPE *Get444And3GBpsVideoOutput )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BOOL *is444VideoOutputEnabled,

+            /* [out] */ BOOL *threeGbsOutputEnabled);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputConversionMode )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDVideoOutputConversionMode conversionMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetVideoOutputConversionMode )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BMDVideoOutputConversionMode *conversionMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *Set_HD1080p24_to_HD1080i5994_Conversion )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BOOL enable);

+        

+        HRESULT ( STDMETHODCALLTYPE *Get_HD1080p24_to_HD1080i5994_Conversion )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BOOL *enabled);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoInputFormat )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDVideoConnection_v7_6 videoInputFormat);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetVideoInputFormat )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BMDVideoConnection_v7_6 *videoInputFormat);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoInputFlags )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDAnalogVideoFlags analogVideoFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoInputFlags )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BMDAnalogVideoFlags *analogVideoFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoInputConversionMode )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDVideoInputConversionMode conversionMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetVideoInputConversionMode )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BMDVideoInputConversionMode *conversionMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetBlackVideoOutputDuringCapture )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BOOL blackOutInCapture);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBlackVideoOutputDuringCapture )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BOOL *blackOutInCapture);

+        

+        HRESULT ( STDMETHODCALLTYPE *Set32PulldownSequenceInitialTimecodeFrame )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ unsigned long aFrameTimecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *Get32PulldownSequenceInitialTimecodeFrame )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ unsigned long *aFrameTimecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVancSourceLineMapping )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ unsigned long activeLine1VANCsource,

+            /* [in] */ unsigned long activeLine2VANCsource,

+            /* [in] */ unsigned long activeLine3VANCsource);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetVancSourceLineMapping )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ unsigned long *activeLine1VANCsource,

+            /* [out] */ unsigned long *activeLine2VANCsource,

+            /* [out] */ unsigned long *activeLine3VANCsource);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAudioInputFormat )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [in] */ BMDAudioConnection_v10_2 audioInputFormat);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAudioInputFormat )( 

+            IDeckLinkConfiguration_v7_6 * This,

+            /* [out] */ BMDAudioConnection_v10_2 *audioInputFormat);

+        

+        END_INTERFACE

+    } IDeckLinkConfiguration_v7_6Vtbl;

+

+    interface IDeckLinkConfiguration_v7_6

+    {

+        CONST_VTBL struct IDeckLinkConfiguration_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkConfiguration_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkConfiguration_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkConfiguration_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkConfiguration_v7_6_GetConfigurationValidator(This,configObject)	\

+    ( (This)->lpVtbl -> GetConfigurationValidator(This,configObject) ) 

+

+#define IDeckLinkConfiguration_v7_6_WriteConfigurationToPreferences(This)	\

+    ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetVideoOutputFormat(This,videoOutputConnection)	\

+    ( (This)->lpVtbl -> SetVideoOutputFormat(This,videoOutputConnection) ) 

+

+#define IDeckLinkConfiguration_v7_6_IsVideoOutputActive(This,videoOutputConnection,active)	\

+    ( (This)->lpVtbl -> IsVideoOutputActive(This,videoOutputConnection,active) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetAnalogVideoOutputFlags(This,analogVideoFlags)	\

+    ( (This)->lpVtbl -> SetAnalogVideoOutputFlags(This,analogVideoFlags) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetAnalogVideoOutputFlags(This,analogVideoFlags)	\

+    ( (This)->lpVtbl -> GetAnalogVideoOutputFlags(This,analogVideoFlags) ) 

+

+#define IDeckLinkConfiguration_v7_6_EnableFieldFlickerRemovalWhenPaused(This,enable)	\

+    ( (This)->lpVtbl -> EnableFieldFlickerRemovalWhenPaused(This,enable) ) 

+

+#define IDeckLinkConfiguration_v7_6_IsEnabledFieldFlickerRemovalWhenPaused(This,enabled)	\

+    ( (This)->lpVtbl -> IsEnabledFieldFlickerRemovalWhenPaused(This,enabled) ) 

+

+#define IDeckLinkConfiguration_v7_6_Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput)	\

+    ( (This)->lpVtbl -> Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput) ) 

+

+#define IDeckLinkConfiguration_v7_6_Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled)	\

+    ( (This)->lpVtbl -> Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetVideoOutputConversionMode(This,conversionMode)	\

+    ( (This)->lpVtbl -> SetVideoOutputConversionMode(This,conversionMode) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetVideoOutputConversionMode(This,conversionMode)	\

+    ( (This)->lpVtbl -> GetVideoOutputConversionMode(This,conversionMode) ) 

+

+#define IDeckLinkConfiguration_v7_6_Set_HD1080p24_to_HD1080i5994_Conversion(This,enable)	\

+    ( (This)->lpVtbl -> Set_HD1080p24_to_HD1080i5994_Conversion(This,enable) ) 

+

+#define IDeckLinkConfiguration_v7_6_Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled)	\

+    ( (This)->lpVtbl -> Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetVideoInputFormat(This,videoInputFormat)	\

+    ( (This)->lpVtbl -> SetVideoInputFormat(This,videoInputFormat) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetVideoInputFormat(This,videoInputFormat)	\

+    ( (This)->lpVtbl -> GetVideoInputFormat(This,videoInputFormat) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetAnalogVideoInputFlags(This,analogVideoFlags)	\

+    ( (This)->lpVtbl -> SetAnalogVideoInputFlags(This,analogVideoFlags) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetAnalogVideoInputFlags(This,analogVideoFlags)	\

+    ( (This)->lpVtbl -> GetAnalogVideoInputFlags(This,analogVideoFlags) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetVideoInputConversionMode(This,conversionMode)	\

+    ( (This)->lpVtbl -> SetVideoInputConversionMode(This,conversionMode) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetVideoInputConversionMode(This,conversionMode)	\

+    ( (This)->lpVtbl -> GetVideoInputConversionMode(This,conversionMode) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetBlackVideoOutputDuringCapture(This,blackOutInCapture)	\

+    ( (This)->lpVtbl -> SetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetBlackVideoOutputDuringCapture(This,blackOutInCapture)	\

+    ( (This)->lpVtbl -> GetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) 

+

+#define IDeckLinkConfiguration_v7_6_Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode)	\

+    ( (This)->lpVtbl -> Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) 

+

+#define IDeckLinkConfiguration_v7_6_Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode)	\

+    ( (This)->lpVtbl -> Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource)	\

+    ( (This)->lpVtbl -> SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource)	\

+    ( (This)->lpVtbl -> GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) 

+

+#define IDeckLinkConfiguration_v7_6_SetAudioInputFormat(This,audioInputFormat)	\

+    ( (This)->lpVtbl -> SetAudioInputFormat(This,audioInputFormat) ) 

+

+#define IDeckLinkConfiguration_v7_6_GetAudioInputFormat(This,audioInputFormat)	\

+    ( (This)->lpVtbl -> GetAudioInputFormat(This,audioInputFormat) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoOutputCallback_v7_6 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("E763A626-4A3C-49D1-BF13-E7AD3692AE52")

+    IDeckLinkVideoOutputCallback_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *completedFrame,

+            /* [in] */ BMDOutputFrameCompletionResult result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoOutputCallback_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoOutputCallback_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoOutputCallback_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoOutputCallback_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( 

+            IDeckLinkVideoOutputCallback_v7_6 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *completedFrame,

+            /* [in] */ BMDOutputFrameCompletionResult result);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( 

+            IDeckLinkVideoOutputCallback_v7_6 * This);

+        

+        END_INTERFACE

+    } IDeckLinkVideoOutputCallback_v7_6Vtbl;

+

+    interface IDeckLinkVideoOutputCallback_v7_6

+    {

+        CONST_VTBL struct IDeckLinkVideoOutputCallback_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoOutputCallback_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoOutputCallback_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoOutputCallback_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoOutputCallback_v7_6_ScheduledFrameCompleted(This,completedFrame,result)	\

+    ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) 

+

+#define IDeckLinkVideoOutputCallback_v7_6_ScheduledPlaybackHasStopped(This)	\

+    ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__

+#define __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInputCallback_v7_6 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInputCallback_v7_6;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("31D28EE7-88B6-4CB1-897A-CDBF79A26414")

+    IDeckLinkInputCallback_v7_6 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( 

+            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,

+            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,

+            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 

+            /* [in] */ IDeckLinkVideoInputFrame_v7_6 *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInputCallback_v7_6Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInputCallback_v7_6 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInputCallback_v7_6 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInputCallback_v7_6 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( 

+            IDeckLinkInputCallback_v7_6 * This,

+            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,

+            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,

+            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 

+            IDeckLinkInputCallback_v7_6 * This,

+            /* [in] */ IDeckLinkVideoInputFrame_v7_6 *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket *audioPacket);

+        

+        END_INTERFACE

+    } IDeckLinkInputCallback_v7_6Vtbl;

+

+    interface IDeckLinkInputCallback_v7_6

+    {

+        CONST_VTBL struct IDeckLinkInputCallback_v7_6Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInputCallback_v7_6_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInputCallback_v7_6_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInputCallback_v7_6_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInputCallback_v7_6_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags)	\

+    ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) 

+

+#define IDeckLinkInputCallback_v7_6_VideoInputFrameArrived(This,videoFrame,audioPacket)	\

+    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__ */

+

+

+EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper_v7_6;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("D398CEE7-4434-4CA3-9BA6-5AE34556B905")

+CDeckLinkGLScreenPreviewHelper_v7_6;

+#endif

+

+EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion_v7_6;

+

+#ifdef __cplusplus

+

+class DECLSPEC_UUID("FFA84F77-73BE-4FB7-B03E-B5E44B9F759B")

+CDeckLinkVideoConversion_v7_6;

+#endif

+

+#ifndef __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__

+#define __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInputCallback_v7_3 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInputCallback_v7_3;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("FD6F311D-4D00-444B-9ED4-1F25B5730AD0")

+    IDeckLinkInputCallback_v7_3 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( 

+            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,

+            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,

+            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 

+            /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInputCallback_v7_3Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInputCallback_v7_3 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInputCallback_v7_3 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInputCallback_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( 

+            IDeckLinkInputCallback_v7_3 * This,

+            /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents,

+            /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode,

+            /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags);

+        

+        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 

+            IDeckLinkInputCallback_v7_3 * This,

+            /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket *audioPacket);

+        

+        END_INTERFACE

+    } IDeckLinkInputCallback_v7_3Vtbl;

+

+    interface IDeckLinkInputCallback_v7_3

+    {

+        CONST_VTBL struct IDeckLinkInputCallback_v7_3Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInputCallback_v7_3_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInputCallback_v7_3_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInputCallback_v7_3_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInputCallback_v7_3_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags)	\

+    ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) 

+

+#define IDeckLinkInputCallback_v7_3_VideoInputFrameArrived(This,videoFrame,audioPacket)	\

+    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__

+#define __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__

+

+/* interface IDeckLinkOutput_v7_3 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkOutput_v7_3;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("271C65E3-C323-4344-A30F-D908BCB20AA3")

+    IDeckLinkOutput_v7_3 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 

+            BMDDisplayMode displayMode,

+            BMDVideoOutputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( 

+            BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,

+            BMDTimeValue displayTime,

+            BMDTimeValue displayDuration,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 

+            /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( 

+            /* [out] */ unsigned long *bufferedFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount,

+            BMDAudioOutputStreamType streamType) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            BMDTimeValue streamTime,

+            BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 

+            /* [out] */ unsigned long *bufferedSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 

+            BMDTimeValue playbackStartTime,

+            BMDTimeScale timeScale,

+            double playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 

+            BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( 

+            /* [out] */ BOOL *active) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkOutput_v7_3Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkOutput_v7_3 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkOutput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkOutput_v7_3 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 

+            IDeckLinkOutput_v7_3 * This,

+            BMDDisplayMode displayMode,

+            BMDVideoOutputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 

+            IDeckLinkOutput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 

+            IDeckLinkOutput_v7_3 * This,

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( 

+            IDeckLinkOutput_v7_3 * This,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame,

+            BMDTimeValue displayTime,

+            BMDTimeValue displayDuration,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ IDeckLinkVideoOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [out] */ unsigned long *bufferedFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 

+            IDeckLinkOutput_v7_3 * This,

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount,

+            BMDAudioOutputStreamType streamType);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 

+            IDeckLinkOutput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 

+            IDeckLinkOutput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 

+            IDeckLinkOutput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ void *buffer,

+            unsigned long sampleFrameCount,

+            BMDTimeValue streamTime,

+            BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [out] */ unsigned long *bufferedSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 

+            IDeckLinkOutput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 

+            IDeckLinkOutput_v7_3 * This,

+            BMDTimeValue playbackStartTime,

+            BMDTimeScale timeScale,

+            double playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 

+            IDeckLinkOutput_v7_3 * This,

+            BMDTimeValue stopPlaybackAtTime,

+            /* [out] */ BMDTimeValue *actualStopTime,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( 

+            IDeckLinkOutput_v7_3 * This,

+            /* [out] */ BOOL *active);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkOutput_v7_3 * This,

+            BMDTimeScale desiredTimeScale,

+            /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan);

+        

+        END_INTERFACE

+    } IDeckLinkOutput_v7_3Vtbl;

+

+    interface IDeckLinkOutput_v7_3

+    {

+        CONST_VTBL struct IDeckLinkOutput_v7_3Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkOutput_v7_3_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkOutput_v7_3_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkOutput_v7_3_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkOutput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 

+

+#define IDeckLinkOutput_v7_3_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkOutput_v7_3_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkOutput_v7_3_EnableVideoOutput(This,displayMode,flags)	\

+    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) 

+

+#define IDeckLinkOutput_v7_3_DisableVideoOutput(This)	\

+    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 

+

+#define IDeckLinkOutput_v7_3_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\

+    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 

+

+#define IDeckLinkOutput_v7_3_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\

+    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 

+

+#define IDeckLinkOutput_v7_3_CreateAncillaryData(This,pixelFormat,outBuffer)	\

+    ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) 

+

+#define IDeckLinkOutput_v7_3_DisplayVideoFrameSync(This,theFrame)	\

+    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 

+

+#define IDeckLinkOutput_v7_3_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\

+    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 

+

+#define IDeckLinkOutput_v7_3_SetScheduledFrameCompletionCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v7_3_GetBufferedVideoFrameCount(This,bufferedFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) 

+

+#define IDeckLinkOutput_v7_3_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType)	\

+    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) 

+

+#define IDeckLinkOutput_v7_3_DisableAudioOutput(This)	\

+    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 

+

+#define IDeckLinkOutput_v7_3_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v7_3_BeginAudioPreroll(This)	\

+    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v7_3_EndAudioPreroll(This)	\

+    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v7_3_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v7_3_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) 

+

+#define IDeckLinkOutput_v7_3_FlushBufferedAudioSamples(This)	\

+    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 

+

+#define IDeckLinkOutput_v7_3_SetAudioCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v7_3_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\

+    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 

+

+#define IDeckLinkOutput_v7_3_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\

+    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 

+

+#define IDeckLinkOutput_v7_3_IsScheduledPlaybackRunning(This,active)	\

+    ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) 

+

+#define IDeckLinkOutput_v7_3_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v7_3_INTERFACE_DEFINED__

+#define __IDeckLinkInput_v7_3_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInput_v7_3 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInput_v7_3;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("4973F012-9925-458C-871C-18774CDBBECB")

+    IDeckLinkInput_v7_3 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( 

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            BMDVideoInputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( 

+            /* [out] */ unsigned long *availableFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( 

+            /* [out] */ unsigned long *availableSampleFrameCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInput_v7_3Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInput_v7_3 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkInput_v7_3 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkInput_v7_3 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( 

+            IDeckLinkInput_v7_3 * This,

+            /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 

+            IDeckLinkInput_v7_3 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            BMDVideoInputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( 

+            IDeckLinkInput_v7_3 * This,

+            /* [out] */ unsigned long *availableFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 

+            IDeckLinkInput_v7_3 * This,

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( 

+            IDeckLinkInput_v7_3 * This,

+            /* [out] */ unsigned long *availableSampleFrameCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushStreams )( 

+            IDeckLinkInput_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkInput_v7_3 * This,

+            /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback);

+        

+        END_INTERFACE

+    } IDeckLinkInput_v7_3Vtbl;

+

+    interface IDeckLinkInput_v7_3

+    {

+        CONST_VTBL struct IDeckLinkInput_v7_3Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInput_v7_3_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInput_v7_3_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInput_v7_3_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 

+

+#define IDeckLinkInput_v7_3_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkInput_v7_3_SetScreenPreviewCallback(This,previewCallback)	\

+    ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) 

+

+#define IDeckLinkInput_v7_3_EnableVideoInput(This,displayMode,pixelFormat,flags)	\

+    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 

+

+#define IDeckLinkInput_v7_3_DisableVideoInput(This)	\

+    ( (This)->lpVtbl -> DisableVideoInput(This) ) 

+

+#define IDeckLinkInput_v7_3_GetAvailableVideoFrameCount(This,availableFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) 

+

+#define IDeckLinkInput_v7_3_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\

+    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 

+

+#define IDeckLinkInput_v7_3_DisableAudioInput(This)	\

+    ( (This)->lpVtbl -> DisableAudioInput(This) ) 

+

+#define IDeckLinkInput_v7_3_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount)	\

+    ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) 

+

+#define IDeckLinkInput_v7_3_StartStreams(This)	\

+    ( (This)->lpVtbl -> StartStreams(This) ) 

+

+#define IDeckLinkInput_v7_3_StopStreams(This)	\

+    ( (This)->lpVtbl -> StopStreams(This) ) 

+

+#define IDeckLinkInput_v7_3_PauseStreams(This)	\

+    ( (This)->lpVtbl -> PauseStreams(This) ) 

+

+#define IDeckLinkInput_v7_3_FlushStreams(This)	\

+    ( (This)->lpVtbl -> FlushStreams(This) ) 

+

+#define IDeckLinkInput_v7_3_SetCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__

+#define __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoInputFrame_v7_3 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_3;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("CF317790-2894-11DE-8C30-0800200C9A66")

+    IDeckLinkVideoInputFrame_v7_3 : public IDeckLinkVideoFrame_v7_6

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetStreamTime( 

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration,

+            BMDTimeScale timeScale) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoInputFrame_v7_3Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoInputFrame_v7_3 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoInputFrame_v7_3 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoInputFrame_v7_3 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkVideoInputFrame_v7_3 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkVideoInputFrame_v7_3 * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkVideoInputFrame_v7_3 * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoInputFrame_v7_3 * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkVideoInputFrame_v7_3 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkVideoInputFrame_v7_3 * This,

+            /* [out] */ void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetTimecode )( 

+            IDeckLinkVideoInputFrame_v7_3 * This,

+            BMDTimecodeFormat format,

+            /* [out] */ IDeckLinkTimecode_v7_6 **timecode);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( 

+            IDeckLinkVideoInputFrame_v7_3 * This,

+            /* [out] */ IDeckLinkVideoFrameAncillary **ancillary);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( 

+            IDeckLinkVideoInputFrame_v7_3 * This,

+            /* [out] */ BMDTimeValue *frameTime,

+            /* [out] */ BMDTimeValue *frameDuration,

+            BMDTimeScale timeScale);

+        

+        END_INTERFACE

+    } IDeckLinkVideoInputFrame_v7_3Vtbl;

+

+    interface IDeckLinkVideoInputFrame_v7_3

+    {

+        CONST_VTBL struct IDeckLinkVideoInputFrame_v7_3Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoInputFrame_v7_3_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoInputFrame_v7_3_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_GetTimecode(This,format,timecode)	\

+    ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) 

+

+#define IDeckLinkVideoInputFrame_v7_3_GetAncillaryData(This,ancillary)	\

+    ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) 

+

+

+#define IDeckLinkVideoInputFrame_v7_3_GetStreamTime(This,frameTime,frameDuration,timeScale)	\

+    ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDisplayModeIterator_v7_1 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDisplayModeIterator_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("B28131B6-59AC-4857-B5AC-CD75D5883E2F")

+    IDeckLinkDisplayModeIterator_v7_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE Next( 

+            /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDisplayModeIterator_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDisplayModeIterator_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDisplayModeIterator_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDisplayModeIterator_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *Next )( 

+            IDeckLinkDisplayModeIterator_v7_1 * This,

+            /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode);

+        

+        END_INTERFACE

+    } IDeckLinkDisplayModeIterator_v7_1Vtbl;

+

+    interface IDeckLinkDisplayModeIterator_v7_1

+    {

+        CONST_VTBL struct IDeckLinkDisplayModeIterator_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDisplayModeIterator_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDisplayModeIterator_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDisplayModeIterator_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDisplayModeIterator_v7_1_Next(This,deckLinkDisplayMode)	\

+    ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkDisplayMode_v7_1 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkDisplayMode_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("AF0CD6D5-8376-435E-8433-54F9DD530AC3")

+    IDeckLinkDisplayMode_v7_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetName( 

+            /* [out] */ BSTR *name) = 0;

+        

+        virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetFrameRate( 

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [out] */ BMDTimeScale *timeScale) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkDisplayMode_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkDisplayMode_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkDisplayMode_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkDisplayMode_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetName )( 

+            IDeckLinkDisplayMode_v7_1 * This,

+            /* [out] */ BSTR *name);

+        

+        BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( 

+            IDeckLinkDisplayMode_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkDisplayMode_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkDisplayMode_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( 

+            IDeckLinkDisplayMode_v7_1 * This,

+            /* [out] */ BMDTimeValue *frameDuration,

+            /* [out] */ BMDTimeScale *timeScale);

+        

+        END_INTERFACE

+    } IDeckLinkDisplayMode_v7_1Vtbl;

+

+    interface IDeckLinkDisplayMode_v7_1

+    {

+        CONST_VTBL struct IDeckLinkDisplayMode_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkDisplayMode_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkDisplayMode_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkDisplayMode_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkDisplayMode_v7_1_GetName(This,name)	\

+    ( (This)->lpVtbl -> GetName(This,name) ) 

+

+#define IDeckLinkDisplayMode_v7_1_GetDisplayMode(This)	\

+    ( (This)->lpVtbl -> GetDisplayMode(This) ) 

+

+#define IDeckLinkDisplayMode_v7_1_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkDisplayMode_v7_1_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkDisplayMode_v7_1_GetFrameRate(This,frameDuration,timeScale)	\

+    ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoFrame_v7_1 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoFrame_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("333F3A10-8C2D-43CF-B79D-46560FEEA1CE")

+    IDeckLinkVideoFrame_v7_1 : public IUnknown

+    {

+    public:

+        virtual long STDMETHODCALLTYPE GetWidth( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetHeight( void) = 0;

+        

+        virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0;

+        

+        virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0;

+        

+        virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            void **buffer) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoFrame_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoFrame_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoFrame_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoFrame_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkVideoFrame_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkVideoFrame_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkVideoFrame_v7_1 * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoFrame_v7_1 * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkVideoFrame_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkVideoFrame_v7_1 * This,

+            void **buffer);

+        

+        END_INTERFACE

+    } IDeckLinkVideoFrame_v7_1Vtbl;

+

+    interface IDeckLinkVideoFrame_v7_1

+    {

+        CONST_VTBL struct IDeckLinkVideoFrame_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoFrame_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoFrame_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoFrame_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoFrame_v7_1_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkVideoFrame_v7_1_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkVideoFrame_v7_1_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkVideoFrame_v7_1_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoFrame_v7_1_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkVideoFrame_v7_1_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoInputFrame_v7_1 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("C8B41D95-8848-40EE-9B37-6E3417FB114B")

+    IDeckLinkVideoInputFrame_v7_1 : public IDeckLinkVideoFrame_v7_1

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE GetFrameTime( 

+            BMDTimeValue *frameTime,

+            BMDTimeValue *frameDuration,

+            BMDTimeScale timeScale) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoInputFrame_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoInputFrame_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoInputFrame_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoInputFrame_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetWidth )( 

+            IDeckLinkVideoInputFrame_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetHeight )( 

+            IDeckLinkVideoInputFrame_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetRowBytes )( 

+            IDeckLinkVideoInputFrame_v7_1 * This);

+        

+        BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( 

+            IDeckLinkVideoInputFrame_v7_1 * This);

+        

+        BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( 

+            IDeckLinkVideoInputFrame_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkVideoInputFrame_v7_1 * This,

+            void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetFrameTime )( 

+            IDeckLinkVideoInputFrame_v7_1 * This,

+            BMDTimeValue *frameTime,

+            BMDTimeValue *frameDuration,

+            BMDTimeScale timeScale);

+        

+        END_INTERFACE

+    } IDeckLinkVideoInputFrame_v7_1Vtbl;

+

+    interface IDeckLinkVideoInputFrame_v7_1

+    {

+        CONST_VTBL struct IDeckLinkVideoInputFrame_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoInputFrame_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoInputFrame_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoInputFrame_v7_1_GetWidth(This)	\

+    ( (This)->lpVtbl -> GetWidth(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_1_GetHeight(This)	\

+    ( (This)->lpVtbl -> GetHeight(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_1_GetRowBytes(This)	\

+    ( (This)->lpVtbl -> GetRowBytes(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_1_GetPixelFormat(This)	\

+    ( (This)->lpVtbl -> GetPixelFormat(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_1_GetFlags(This)	\

+    ( (This)->lpVtbl -> GetFlags(This) ) 

+

+#define IDeckLinkVideoInputFrame_v7_1_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+

+#define IDeckLinkVideoInputFrame_v7_1_GetFrameTime(This,frameTime,frameDuration,timeScale)	\

+    ( (This)->lpVtbl -> GetFrameTime(This,frameTime,frameDuration,timeScale) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkAudioInputPacket_v7_1 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkAudioInputPacket_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("C86DE4F6-A29F-42E3-AB3A-1363E29F0788")

+    IDeckLinkAudioInputPacket_v7_1 : public IUnknown

+    {

+    public:

+        virtual long STDMETHODCALLTYPE GetSampleCount( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBytes( 

+            void **buffer) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetAudioPacketTime( 

+            BMDTimeValue *packetTime,

+            BMDTimeScale timeScale) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkAudioInputPacket_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkAudioInputPacket_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkAudioInputPacket_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkAudioInputPacket_v7_1 * This);

+        

+        long ( STDMETHODCALLTYPE *GetSampleCount )( 

+            IDeckLinkAudioInputPacket_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBytes )( 

+            IDeckLinkAudioInputPacket_v7_1 * This,

+            void **buffer);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetAudioPacketTime )( 

+            IDeckLinkAudioInputPacket_v7_1 * This,

+            BMDTimeValue *packetTime,

+            BMDTimeScale timeScale);

+        

+        END_INTERFACE

+    } IDeckLinkAudioInputPacket_v7_1Vtbl;

+

+    interface IDeckLinkAudioInputPacket_v7_1

+    {

+        CONST_VTBL struct IDeckLinkAudioInputPacket_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkAudioInputPacket_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkAudioInputPacket_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkAudioInputPacket_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkAudioInputPacket_v7_1_GetSampleCount(This)	\

+    ( (This)->lpVtbl -> GetSampleCount(This) ) 

+

+#define IDeckLinkAudioInputPacket_v7_1_GetBytes(This,buffer)	\

+    ( (This)->lpVtbl -> GetBytes(This,buffer) ) 

+

+#define IDeckLinkAudioInputPacket_v7_1_GetAudioPacketTime(This,packetTime,timeScale)	\

+    ( (This)->lpVtbl -> GetAudioPacketTime(This,packetTime,timeScale) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkVideoOutputCallback_v7_1 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9")

+    IDeckLinkVideoOutputCallback_v7_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( 

+            /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame,

+            /* [in] */ BMDOutputFrameCompletionResult result) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkVideoOutputCallback_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkVideoOutputCallback_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkVideoOutputCallback_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkVideoOutputCallback_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( 

+            IDeckLinkVideoOutputCallback_v7_1 * This,

+            /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame,

+            /* [in] */ BMDOutputFrameCompletionResult result);

+        

+        END_INTERFACE

+    } IDeckLinkVideoOutputCallback_v7_1Vtbl;

+

+    interface IDeckLinkVideoOutputCallback_v7_1

+    {

+        CONST_VTBL struct IDeckLinkVideoOutputCallback_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkVideoOutputCallback_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkVideoOutputCallback_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkVideoOutputCallback_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkVideoOutputCallback_v7_1_ScheduledFrameCompleted(This,completedFrame,result)	\

+    ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInputCallback_v7_1 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInputCallback_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("7F94F328-5ED4-4E9F-9729-76A86BDC99CC")

+    IDeckLinkInputCallback_v7_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( 

+            /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInputCallback_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInputCallback_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInputCallback_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInputCallback_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( 

+            IDeckLinkInputCallback_v7_1 * This,

+            /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame,

+            /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket);

+        

+        END_INTERFACE

+    } IDeckLinkInputCallback_v7_1Vtbl;

+

+    interface IDeckLinkInputCallback_v7_1

+    {

+        CONST_VTBL struct IDeckLinkInputCallback_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInputCallback_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInputCallback_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInputCallback_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInputCallback_v7_1_VideoInputFrameArrived(This,videoFrame,audioPacket)	\

+    ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkOutput_v7_1 */

+/* [helpstring][local][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkOutput_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5")

+    IDeckLinkOutput_v7_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( 

+            BMDDisplayMode displayMode) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( 

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( 

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            IDeckLinkVideoFrame_v7_1 **outFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameFromBuffer( 

+            void *buffer,

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            IDeckLinkVideoFrame_v7_1 **outFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( 

+            IDeckLinkVideoFrame_v7_1 *theFrame) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( 

+            IDeckLinkVideoFrame_v7_1 *theFrame,

+            BMDTimeValue displayTime,

+            BMDTimeValue displayDuration,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( 

+            /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( 

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( 

+            void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( 

+            void *buffer,

+            unsigned long sampleFrameCount,

+            BMDTimeValue streamTime,

+            BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 

+            /* [out] */ unsigned long *bufferedSampleCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( 

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( 

+            BMDTimeValue playbackStartTime,

+            BMDTimeScale timeScale,

+            double playbackSpeed) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( 

+            BMDTimeValue stopPlaybackAtTime,

+            BMDTimeValue *actualStopTime,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( 

+            BMDTimeScale desiredTimeScale,

+            BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkOutput_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkOutput_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkOutput_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkOutput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkOutput_v7_1 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkOutput_v7_1 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( 

+            IDeckLinkOutput_v7_1 * This,

+            BMDDisplayMode displayMode);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( 

+            IDeckLinkOutput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( 

+            IDeckLinkOutput_v7_1 * This,

+            /* [in] */ IDeckLinkMemoryAllocator *theAllocator);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( 

+            IDeckLinkOutput_v7_1 * This,

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            IDeckLinkVideoFrame_v7_1 **outFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *CreateVideoFrameFromBuffer )( 

+            IDeckLinkOutput_v7_1 * This,

+            void *buffer,

+            long width,

+            long height,

+            long rowBytes,

+            BMDPixelFormat pixelFormat,

+            BMDFrameFlags flags,

+            IDeckLinkVideoFrame_v7_1 **outFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( 

+            IDeckLinkOutput_v7_1 * This,

+            IDeckLinkVideoFrame_v7_1 *theFrame);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( 

+            IDeckLinkOutput_v7_1 * This,

+            IDeckLinkVideoFrame_v7_1 *theFrame,

+            BMDTimeValue displayTime,

+            BMDTimeValue displayDuration,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( 

+            IDeckLinkOutput_v7_1 * This,

+            /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( 

+            IDeckLinkOutput_v7_1 * This,

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( 

+            IDeckLinkOutput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( 

+            IDeckLinkOutput_v7_1 * This,

+            void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( 

+            IDeckLinkOutput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( 

+            IDeckLinkOutput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( 

+            IDeckLinkOutput_v7_1 * This,

+            void *buffer,

+            unsigned long sampleFrameCount,

+            BMDTimeValue streamTime,

+            BMDTimeScale timeScale,

+            /* [out] */ unsigned long *sampleFramesWritten);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 

+            IDeckLinkOutput_v7_1 * This,

+            /* [out] */ unsigned long *bufferedSampleCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( 

+            IDeckLinkOutput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( 

+            IDeckLinkOutput_v7_1 * This,

+            /* [in] */ IDeckLinkAudioOutputCallback *theCallback);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( 

+            IDeckLinkOutput_v7_1 * This,

+            BMDTimeValue playbackStartTime,

+            BMDTimeScale timeScale,

+            double playbackSpeed);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( 

+            IDeckLinkOutput_v7_1 * This,

+            BMDTimeValue stopPlaybackAtTime,

+            BMDTimeValue *actualStopTime,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( 

+            IDeckLinkOutput_v7_1 * This,

+            BMDTimeScale desiredTimeScale,

+            BMDTimeValue *elapsedTimeSinceSchedulerBegan);

+        

+        END_INTERFACE

+    } IDeckLinkOutput_v7_1Vtbl;

+

+    interface IDeckLinkOutput_v7_1

+    {

+        CONST_VTBL struct IDeckLinkOutput_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkOutput_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkOutput_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkOutput_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkOutput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 

+

+#define IDeckLinkOutput_v7_1_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkOutput_v7_1_EnableVideoOutput(This,displayMode)	\

+    ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode) ) 

+

+#define IDeckLinkOutput_v7_1_DisableVideoOutput(This)	\

+    ( (This)->lpVtbl -> DisableVideoOutput(This) ) 

+

+#define IDeckLinkOutput_v7_1_SetVideoOutputFrameMemoryAllocator(This,theAllocator)	\

+    ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) 

+

+#define IDeckLinkOutput_v7_1_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame)	\

+    ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) 

+

+#define IDeckLinkOutput_v7_1_CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame)	\

+    ( (This)->lpVtbl -> CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame) ) 

+

+#define IDeckLinkOutput_v7_1_DisplayVideoFrameSync(This,theFrame)	\

+    ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) 

+

+#define IDeckLinkOutput_v7_1_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale)	\

+    ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) 

+

+#define IDeckLinkOutput_v7_1_SetScheduledFrameCompletionCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v7_1_EnableAudioOutput(This,sampleRate,sampleType,channelCount)	\

+    ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount) ) 

+

+#define IDeckLinkOutput_v7_1_DisableAudioOutput(This)	\

+    ( (This)->lpVtbl -> DisableAudioOutput(This) ) 

+

+#define IDeckLinkOutput_v7_1_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v7_1_BeginAudioPreroll(This)	\

+    ( (This)->lpVtbl -> BeginAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v7_1_EndAudioPreroll(This)	\

+    ( (This)->lpVtbl -> EndAudioPreroll(This) ) 

+

+#define IDeckLinkOutput_v7_1_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten)	\

+    ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) 

+

+#define IDeckLinkOutput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount)	\

+    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) 

+

+#define IDeckLinkOutput_v7_1_FlushBufferedAudioSamples(This)	\

+    ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) 

+

+#define IDeckLinkOutput_v7_1_SetAudioCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) 

+

+#define IDeckLinkOutput_v7_1_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed)	\

+    ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) 

+

+#define IDeckLinkOutput_v7_1_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale)	\

+    ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) 

+

+#define IDeckLinkOutput_v7_1_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan)	\

+    ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ */

+

+

+#ifndef __IDeckLinkInput_v7_1_INTERFACE_DEFINED__

+#define __IDeckLinkInput_v7_1_INTERFACE_DEFINED__

+

+/* interface IDeckLinkInput_v7_1 */

+/* [helpstring][uuid][object] */ 

+

+

+EXTERN_C const IID IID_IDeckLinkInput_v7_1;

+

+#if defined(__cplusplus) && !defined(CINTERFACE)

+    

+    MIDL_INTERFACE("2B54EDEF-5B32-429F-BA11-BB990596EACD")

+    IDeckLinkInput_v7_1 : public IUnknown

+    {

+    public:

+        virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( 

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( 

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            BMDVideoInputFlags flags) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( 

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE ReadAudioSamples( 

+            void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesRead,

+            /* [out] */ BMDTimeValue *audioPacketTime,

+            BMDTimeScale timeScale) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( 

+            /* [out] */ unsigned long *bufferedSampleCount) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0;

+        

+        virtual HRESULT STDMETHODCALLTYPE SetCallback( 

+            /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback) = 0;

+        

+    };

+    

+    

+#else 	/* C style interface */

+

+    typedef struct IDeckLinkInput_v7_1Vtbl

+    {

+        BEGIN_INTERFACE

+        

+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 

+            IDeckLinkInput_v7_1 * This,

+            /* [in] */ REFIID riid,

+            /* [annotation][iid_is][out] */ 

+            _COM_Outptr_  void **ppvObject);

+        

+        ULONG ( STDMETHODCALLTYPE *AddRef )( 

+            IDeckLinkInput_v7_1 * This);

+        

+        ULONG ( STDMETHODCALLTYPE *Release )( 

+            IDeckLinkInput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( 

+            IDeckLinkInput_v7_1 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            /* [out] */ BMDDisplayModeSupport *result);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( 

+            IDeckLinkInput_v7_1 * This,

+            /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( 

+            IDeckLinkInput_v7_1 * This,

+            BMDDisplayMode displayMode,

+            BMDPixelFormat pixelFormat,

+            BMDVideoInputFlags flags);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( 

+            IDeckLinkInput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( 

+            IDeckLinkInput_v7_1 * This,

+            BMDAudioSampleRate sampleRate,

+            BMDAudioSampleType sampleType,

+            unsigned long channelCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( 

+            IDeckLinkInput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *ReadAudioSamples )( 

+            IDeckLinkInput_v7_1 * This,

+            void *buffer,

+            unsigned long sampleFrameCount,

+            /* [out] */ unsigned long *sampleFramesRead,

+            /* [out] */ BMDTimeValue *audioPacketTime,

+            BMDTimeScale timeScale);

+        

+        HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( 

+            IDeckLinkInput_v7_1 * This,

+            /* [out] */ unsigned long *bufferedSampleCount);

+        

+        HRESULT ( STDMETHODCALLTYPE *StartStreams )( 

+            IDeckLinkInput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *StopStreams )( 

+            IDeckLinkInput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *PauseStreams )( 

+            IDeckLinkInput_v7_1 * This);

+        

+        HRESULT ( STDMETHODCALLTYPE *SetCallback )( 

+            IDeckLinkInput_v7_1 * This,

+            /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback);

+        

+        END_INTERFACE

+    } IDeckLinkInput_v7_1Vtbl;

+

+    interface IDeckLinkInput_v7_1

+    {

+        CONST_VTBL struct IDeckLinkInput_v7_1Vtbl *lpVtbl;

+    };

+

+    

+

+#ifdef COBJMACROS

+

+

+#define IDeckLinkInput_v7_1_QueryInterface(This,riid,ppvObject)	\

+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

+

+#define IDeckLinkInput_v7_1_AddRef(This)	\

+    ( (This)->lpVtbl -> AddRef(This) ) 

+

+#define IDeckLinkInput_v7_1_Release(This)	\

+    ( (This)->lpVtbl -> Release(This) ) 

+

+

+#define IDeckLinkInput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result)	\

+    ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) 

+

+#define IDeckLinkInput_v7_1_GetDisplayModeIterator(This,iterator)	\

+    ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) 

+

+#define IDeckLinkInput_v7_1_EnableVideoInput(This,displayMode,pixelFormat,flags)	\

+    ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) 

+

+#define IDeckLinkInput_v7_1_DisableVideoInput(This)	\

+    ( (This)->lpVtbl -> DisableVideoInput(This) ) 

+

+#define IDeckLinkInput_v7_1_EnableAudioInput(This,sampleRate,sampleType,channelCount)	\

+    ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) 

+

+#define IDeckLinkInput_v7_1_DisableAudioInput(This)	\

+    ( (This)->lpVtbl -> DisableAudioInput(This) ) 

+

+#define IDeckLinkInput_v7_1_ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale)	\

+    ( (This)->lpVtbl -> ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale) ) 

+

+#define IDeckLinkInput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount)	\

+    ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) 

+

+#define IDeckLinkInput_v7_1_StartStreams(This)	\

+    ( (This)->lpVtbl -> StartStreams(This) ) 

+

+#define IDeckLinkInput_v7_1_StopStreams(This)	\

+    ( (This)->lpVtbl -> StopStreams(This) ) 

+

+#define IDeckLinkInput_v7_1_PauseStreams(This)	\

+    ( (This)->lpVtbl -> PauseStreams(This) ) 

+

+#define IDeckLinkInput_v7_1_SetCallback(This,theCallback)	\

+    ( (This)->lpVtbl -> SetCallback(This,theCallback) ) 

+

+#endif /* COBJMACROS */

+

+

+#endif 	/* C style interface */

+

+

+

+

+#endif 	/* __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ */

+

+#endif /* __DeckLinkAPI_LIBRARY_DEFINED__ */

+

+/* Additional Prototypes for ALL interfaces */

+

+/* end of Additional Prototypes */

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif

+

+

diff --git a/sys/decklink/win/DeckLinkAPI_i.c b/sys/decklink/win/DeckLinkAPI_i.c
deleted file mode 100644
index ca14206..0000000
--- a/sys/decklink/win/DeckLinkAPI_i.c
+++ /dev/null
@@ -1,319 +0,0 @@
-
-
-/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
-
-/* link this file in with the server and any clients */
-
-
- /* File created by MIDL compiler version 7.00.0500 */
-/* at Fri Jun 17 10:43:51 2011
- */
-/* Compiler settings for .\win\DeckLinkAPI.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )        /* more than 64k source lines */
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#include <rpc.h>
-#include <rpcndr.h>
-
-#ifdef _MIDL_USE_GUIDDEF_
-
-#ifndef INITGUID
-#define INITGUID
-#include <guiddef.h>
-#undef INITGUID
-#else
-#include <guiddef.h>
-#endif
-
-#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
-        DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
-
-#else                           // !_MIDL_USE_GUIDDEF_
-
-#ifndef __IID_DEFINED__
-#define __IID_DEFINED__
-
-  typedef struct _IID
-  {
-    unsigned long x;
-    unsigned short s1;
-    unsigned short s2;
-    unsigned char c[8];
-  } IID;
-
-#endif                          // __IID_DEFINED__
-
-#ifndef CLSID_DEFINED
-#define CLSID_DEFINED
-  typedef IID CLSID;
-#endif                          // CLSID_DEFINED
-
-#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
-        const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-
-#endif                          /* !_MIDL_USE_GUIDDEF_ */
-
-    MIDL_DEFINE_GUID (IID, LIBID_DeckLinkAPI, 0xD864517A, 0xEDD5, 0x466D, 0x86,
-      0x7D, 0xC8, 0x19, 0xF1, 0xC0, 0x52, 0xBB);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoOutputCallback, 0x20AA5225, 0x1958,
-      0x47CB, 0x82, 0x0B, 0x80, 0xA8, 0xD5, 0x21, 0xA6, 0xEE);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInputCallback, 0xDD04E5EC, 0x7415,
-      0x42AB, 0xAE, 0x4A, 0xE8, 0x0C, 0x4D, 0xFC, 0x04, 0x4A);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkMemoryAllocator, 0xB36EB6E7, 0x9D29,
-      0x4AA8, 0x92, 0xEF, 0x84, 0x3B, 0x87, 0xA2, 0x89, 0xE8);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkAudioOutputCallback, 0x403C681B, 0x7F46,
-      0x4A12, 0xB9, 0x93, 0x2B, 0xB1, 0x27, 0x08, 0x4E, 0xE6);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkIterator, 0x74E936FC, 0xCC28, 0x4A67,
-      0x81, 0xA0, 0x1E, 0x94, 0xE5, 0x2D, 0x4E, 0x69);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkAPIInformation, 0x7BEA3C68, 0x730D,
-      0x4322, 0xAF, 0x34, 0x8A, 0x71, 0x52, 0xB5, 0x32, 0xA4);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDisplayModeIterator, 0x9C88499F, 0xF601,
-      0x4021, 0xB8, 0x0B, 0x03, 0x2E, 0x4E, 0xB4, 0x1C, 0x35);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDisplayMode, 0x3EB2C1AB, 0x0A3D, 0x4523,
-      0xA3, 0xAD, 0xF4, 0x0D, 0x7F, 0xB1, 0x4E, 0x78);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLink, 0x62BFF75D, 0x6569, 0x4E55, 0x8D,
-      0x4D, 0x66, 0xAA, 0x03, 0x82, 0x9A, 0xBC);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkOutput, 0xA3EF0963, 0x0862, 0x44ED,
-      0x92, 0xA9, 0xEE, 0x89, 0xAB, 0xF4, 0x31, 0xC7);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInput, 0x6D40EF78, 0x28B9, 0x4E21, 0x99,
-      0x0D, 0x95, 0xBB, 0x77, 0x50, 0xA0, 0x4F);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkTimecode, 0xBC6CFBD3, 0x8317, 0x4325,
-      0xAC, 0x1C, 0x12, 0x16, 0x39, 0x1E, 0x93, 0x40);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoFrame, 0x3F716FE0, 0xF023, 0x4111,
-      0xBE, 0x5D, 0xEF, 0x44, 0x14, 0xC0, 0x5B, 0x17);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkMutableVideoFrame, 0x69E2639F, 0x40DA,
-      0x4E19, 0xB6, 0xF2, 0x20, 0xAC, 0xE8, 0x15, 0xC3, 0x90);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoFrame3DExtensions, 0xDA0F7E4A,
-      0xEDC7, 0x48A8, 0x9C, 0xDD, 0x2D, 0xB5, 0x1C, 0x72, 0x9C, 0xD7);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoInputFrame, 0x05CFE374, 0x537C,
-      0x4094, 0x9A, 0x57, 0x68, 0x05, 0x25, 0x11, 0x8F, 0x44);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoFrameAncillary, 0x732E723C, 0xD1A4,
-      0x4E29, 0x9E, 0x8E, 0x4A, 0x88, 0x79, 0x7A, 0x00, 0x04);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkAudioInputPacket, 0xE43D5870, 0x2894,
-      0x11DE, 0x8C, 0x30, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkScreenPreviewCallback, 0xB1D3F49A,
-      0x85FE, 0x4C5D, 0x95, 0xC8, 0x0B, 0x5D, 0x5D, 0xCC, 0xD4, 0x38);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkGLScreenPreviewHelper, 0x504E2209,
-      0xCAC7, 0x4C1A, 0x9F, 0xB4, 0xC5, 0xBB, 0x62, 0x74, 0xD2, 0x2F);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkConfiguration, 0xC679A35B, 0x610C,
-      0x4D09, 0xB7, 0x48, 0x1D, 0x04, 0x78, 0x10, 0x0F, 0xC0);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkAttributes, 0xABC11843, 0xD966, 0x44CB,
-      0x96, 0xE2, 0xA1, 0xCB, 0x5D, 0x31, 0x35, 0xC4);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkKeyer, 0x89AFCAF5, 0x65F8, 0x421E, 0x98,
-      0xF7, 0x96, 0xFE, 0x5F, 0x5B, 0xFB, 0xA3);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoConversion, 0x3BBCB8A2, 0xDA2C,
-      0x42D9, 0xB5, 0xD8, 0x88, 0x08, 0x36, 0x44, 0xE9, 0x9A);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDeckControlStatusCallback, 0xE5F693C1,
-      0x4283, 0x4716, 0xB1, 0x8F, 0xC1, 0x43, 0x15, 0x21, 0x95, 0x5B);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDeckControl, 0x522A9E39, 0x0F3C, 0x4742,
-      0x94, 0xEE, 0xD8, 0x0D, 0xE3, 0x35, 0xDA, 0x1D);
-
-
-    MIDL_DEFINE_GUID (CLSID, CLSID_CDeckLinkIterator, 0xD9EDA3B3, 0x2887,
-      0x41FA, 0xB7, 0x24, 0x01, 0x7C, 0xF1, 0xEB, 0x1D, 0x37);
-
-
-    MIDL_DEFINE_GUID (CLSID, CLSID_CDeckLinkAPIInformation, 0x263CA19F, 0xED09,
-      0x482E, 0x9F, 0x9D, 0x84, 0x00, 0x57, 0x83, 0xA2, 0x37);
-
-
-    MIDL_DEFINE_GUID (CLSID, CLSID_CDeckLinkGLScreenPreviewHelper, 0xF63E77C7,
-      0xB655, 0x4A4A, 0x9A, 0xD0, 0x3C, 0xA8, 0x5D, 0x39, 0x43, 0x43);
-
-
-    MIDL_DEFINE_GUID (CLSID, CLSID_CDeckLinkVideoConversion, 0x7DBBBB11, 0x5B7B,
-      0x467D, 0xAE, 0xA4, 0xCE, 0xA4, 0x68, 0xFD, 0x36, 0x8C);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDeckControl_v7_9, 0xA4D81043, 0x0619,
-      0x42B7, 0x8E, 0xD6, 0x60, 0x2D, 0x29, 0x04, 0x1D, 0xF7);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDisplayModeIterator_v7_6, 0x455D741F,
-      0x1779, 0x4800, 0x86, 0xF5, 0x0B, 0x5D, 0x13, 0xD7, 0x97, 0x51);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDisplayMode_v7_6, 0x87451E84, 0x2B7E,
-      0x439E, 0xA6, 0x29, 0x43, 0x93, 0xEA, 0x4A, 0x85, 0x50);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkOutput_v7_6, 0x29228142, 0xEB8C, 0x4141,
-      0xA6, 0x21, 0xF7, 0x40, 0x26, 0x45, 0x09, 0x55);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInput_v7_6, 0x300C135A, 0x9F43, 0x48E2,
-      0x99, 0x06, 0x6D, 0x79, 0x11, 0xD9, 0x3C, 0xF1);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkTimecode_v7_6, 0xEFB9BCA6, 0xA521,
-      0x44F7, 0xBD, 0x69, 0x23, 0x32, 0xF2, 0x4D, 0x9E, 0xE6);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoFrame_v7_6, 0xA8D8238E, 0x6B18,
-      0x4196, 0x99, 0xE1, 0x5A, 0xF7, 0x17, 0xB8, 0x3D, 0x32);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkMutableVideoFrame_v7_6, 0x46FCEE00,
-      0xB4E6, 0x43D0, 0x91, 0xC0, 0x02, 0x3A, 0x7F, 0xCE, 0xB3, 0x4F);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoInputFrame_v7_6, 0x9A74FA41,
-      0xAE9F, 0x47AC, 0x8C, 0xF4, 0x01, 0xF4, 0x2D, 0xD5, 0x99, 0x65);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkScreenPreviewCallback_v7_6, 0x373F499D,
-      0x4B4D, 0x4518, 0xAD, 0x22, 0x63, 0x54, 0xE5, 0xA5, 0x82, 0x5E);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkGLScreenPreviewHelper_v7_6, 0xBA575CD9,
-      0xA15E, 0x497B, 0xB2, 0xC2, 0xF9, 0xAF, 0xE7, 0xBE, 0x4E, 0xBA);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoConversion_v7_6, 0x3EB504C9,
-      0xF97D, 0x40FE, 0xA1, 0x58, 0xD4, 0x07, 0xD4, 0x8C, 0xB5, 0x3B);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkConfiguration_v7_6, 0xB8EAD569, 0xB764,
-      0x47F0, 0xA7, 0x3F, 0xAE, 0x40, 0xDF, 0x6C, 0xBF, 0x10);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoOutputCallback_v7_6, 0xE763A626,
-      0x4A3C, 0x49D1, 0xBF, 0x13, 0xE7, 0xAD, 0x36, 0x92, 0xAE, 0x52);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInputCallback_v7_6, 0x31D28EE7, 0x88B6,
-      0x4CB1, 0x89, 0x7A, 0xCD, 0xBF, 0x79, 0xA2, 0x64, 0x14);
-
-
-    MIDL_DEFINE_GUID (CLSID, CLSID_CDeckLinkGLScreenPreviewHelper_v7_6,
-      0xD398CEE7, 0x4434, 0x4CA3, 0x9B, 0xA6, 0x5A, 0xE3, 0x45, 0x56, 0xB9,
-      0x05);
-
-
-    MIDL_DEFINE_GUID (CLSID, CLSID_CDeckLinkVideoConversion_v7_6, 0xFFA84F77,
-      0x73BE, 0x4FB7, 0xB0, 0x3E, 0xB5, 0xE4, 0x4B, 0x9F, 0x75, 0x9B);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInputCallback_v7_3, 0xFD6F311D, 0x4D00,
-      0x444B, 0x9E, 0xD4, 0x1F, 0x25, 0xB5, 0x73, 0x0A, 0xD0);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkOutput_v7_3, 0x271C65E3, 0xC323, 0x4344,
-      0xA3, 0x0F, 0xD9, 0x08, 0xBC, 0xB2, 0x0A, 0xA3);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInput_v7_3, 0x4973F012, 0x9925, 0x458C,
-      0x87, 0x1C, 0x18, 0x77, 0x4C, 0xDB, 0xBE, 0xCB);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoInputFrame_v7_3, 0xCF317790,
-      0x2894, 0x11DE, 0x8C, 0x30, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDisplayModeIterator_v7_1, 0xB28131B6,
-      0x59AC, 0x4857, 0xB5, 0xAC, 0xCD, 0x75, 0xD5, 0x88, 0x3E, 0x2F);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkDisplayMode_v7_1, 0xAF0CD6D5, 0x8376,
-      0x435E, 0x84, 0x33, 0x54, 0xF9, 0xDD, 0x53, 0x0A, 0xC3);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoFrame_v7_1, 0x333F3A10, 0x8C2D,
-      0x43CF, 0xB7, 0x9D, 0x46, 0x56, 0x0F, 0xEE, 0xA1, 0xCE);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoInputFrame_v7_1, 0xC8B41D95,
-      0x8848, 0x40EE, 0x9B, 0x37, 0x6E, 0x34, 0x17, 0xFB, 0x11, 0x4B);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkAudioInputPacket_v7_1, 0xC86DE4F6,
-      0xA29F, 0x42E3, 0xAB, 0x3A, 0x13, 0x63, 0xE2, 0x9F, 0x07, 0x88);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkVideoOutputCallback_v7_1, 0xEBD01AFA,
-      0xE4B0, 0x49C6, 0xA0, 0x1D, 0xED, 0xB9, 0xD1, 0xB5, 0x5F, 0xD9);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInputCallback_v7_1, 0x7F94F328, 0x5ED4,
-      0x4E9F, 0x97, 0x29, 0x76, 0xA8, 0x6B, 0xDC, 0x99, 0xCC);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkOutput_v7_1, 0xAE5B3E9B, 0x4E1E, 0x4535,
-      0xB6, 0xE8, 0x48, 0x0F, 0xF5, 0x2F, 0x6C, 0xE5);
-
-
-    MIDL_DEFINE_GUID (IID, IID_IDeckLinkInput_v7_1, 0x2B54EDEF, 0x5B32, 0x429F,
-      0xBA, 0x11, 0xBB, 0x99, 0x05, 0x96, 0xEA, 0xCD);
-
-#undef MIDL_DEFINE_GUID
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/sys/directdraw/Makefile.am b/sys/directdraw/Makefile.am
deleted file mode 100644
index f6bbb16..0000000
--- a/sys/directdraw/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-plugin_LTLIBRARIES = libgstdirectdrawsink.la
-
-libgstdirectdrawsink_la_SOURCES =  gstdirectdrawsink.c gstdirectdrawplugin.c
-libgstdirectdrawsink_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
-	$(GST_PLUGINS_BASE_CFLAGS) $(DIRECTX_CFLAGS)
-libgstdirectdrawsink_la_LIBADD = \
-	$(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
-	-lgstinterfaces-$(GST_API_VERSION) \
-	 $(DIRECTX_LDFLAGS) $(DIRECTDRAW_LIBS)
-libgstdirectdrawsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdirectdrawsink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS= gstdirectdrawsink.h
diff --git a/sys/directdraw/Makefile.in b/sys/directdraw/Makefile.in
deleted file mode 100644
index c1dccae..0000000
--- a/sys/directdraw/Makefile.in
+++ /dev/null
@@ -1,1080 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = sys/directdraw
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/depcomp $(noinst_HEADERS)
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
-	$(top_srcdir)/common/m4/as-auto-alt.m4 \
-	$(top_srcdir)/common/m4/as-compiler-flag.m4 \
-	$(top_srcdir)/common/m4/as-libtool.m4 \
-	$(top_srcdir)/common/m4/as-version.m4 \
-	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
-	$(top_srcdir)/common/m4/gst-arch.m4 \
-	$(top_srcdir)/common/m4/gst-args.m4 \
-	$(top_srcdir)/common/m4/gst-check.m4 \
-	$(top_srcdir)/common/m4/gst-default.m4 \
-	$(top_srcdir)/common/m4/gst-dowhile.m4 \
-	$(top_srcdir)/common/m4/gst-error.m4 \
-	$(top_srcdir)/common/m4/gst-feature.m4 \
-	$(top_srcdir)/common/m4/gst-gettext.m4 \
-	$(top_srcdir)/common/m4/gst-glib2.m4 \
-	$(top_srcdir)/common/m4/gst-package-release-datetime.m4 \
-	$(top_srcdir)/common/m4/gst-platform.m4 \
-	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
-	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
-	$(top_srcdir)/common/m4/gst.m4 \
-	$(top_srcdir)/common/m4/gtk-doc.m4 \
-	$(top_srcdir)/common/m4/introspection.m4 \
-	$(top_srcdir)/common/m4/orc.m4 $(top_srcdir)/common/m4/pkg.m4 \
-	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gsettings.m4 \
-	$(top_srcdir)/m4/gst-fionread.m4 $(top_srcdir)/m4/gst-sdl.m4 \
-	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
-	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libgcrypt.m4 \
-	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-	$(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(plugindir)"
-LTLIBRARIES = $(plugin_LTLIBRARIES)
-am__DEPENDENCIES_1 =
-libgstdirectdrawsink_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
-am_libgstdirectdrawsink_la_OBJECTS =  \
-	libgstdirectdrawsink_la-gstdirectdrawsink.lo \
-	libgstdirectdrawsink_la-gstdirectdrawplugin.lo
-libgstdirectdrawsink_la_OBJECTS =  \
-	$(am_libgstdirectdrawsink_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libgstdirectdrawsink_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstdirectdrawsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(libgstdirectdrawsink_la_CFLAGS) \
-	$(CFLAGS) $(libgstdirectdrawsink_la_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libgstdirectdrawsink_la_SOURCES)
-DIST_SOURCES = $(libgstdirectdrawsink_la_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-HEADERS = $(noinst_HEADERS)
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
-ACMENC_CFLAGS = @ACMENC_CFLAGS@
-ACMMP3DEC_CFLAGS = @ACMMP3DEC_CFLAGS@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-APEXSINK_CFLAGS = @APEXSINK_CFLAGS@
-APEXSINK_LIBS = @APEXSINK_LIBS@
-AR = @AR@
-AS = @AS@
-ASSRENDER_CFLAGS = @ASSRENDER_CFLAGS@
-ASSRENDER_LIBS = @ASSRENDER_LIBS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
-BZ2_LIBS = @BZ2_LIBS@
-CC = @CC@
-CCASFLAGS = @CCASFLAGS@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CHROMAPRINT_CFLAGS = @CHROMAPRINT_CFLAGS@
-CHROMAPRINT_LIBS = @CHROMAPRINT_LIBS@
-CLUTTER_CFLAGS = @CLUTTER_CFLAGS@
-CLUTTER_GLX_CFLAGS = @CLUTTER_GLX_CFLAGS@
-CLUTTER_GLX_LIBS = @CLUTTER_GLX_LIBS@
-CLUTTER_LIBS = @CLUTTER_LIBS@
-CLUTTER_X11_CFLAGS = @CLUTTER_X11_CFLAGS@
-CLUTTER_X11_LIBS = @CLUTTER_X11_LIBS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CURL_CFLAGS = @CURL_CFLAGS@
-CURL_LIBS = @CURL_LIBS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DAALA_CFLAGS = @DAALA_CFLAGS@
-DAALA_LIBS = @DAALA_LIBS@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
-DCCP_LIBS = @DCCP_LIBS@
-DECKLINK_CXXFLAGS = @DECKLINK_CXXFLAGS@
-DECKLINK_LIBS = @DECKLINK_LIBS@
-DEFAULT_AUDIOSINK = @DEFAULT_AUDIOSINK@
-DEFAULT_AUDIOSRC = @DEFAULT_AUDIOSRC@
-DEFAULT_VIDEOSINK = @DEFAULT_VIDEOSINK@
-DEFAULT_VIDEOSRC = @DEFAULT_VIDEOSRC@
-DEFAULT_VISUALIZER = @DEFAULT_VISUALIZER@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
-DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
-DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
-DIRECTFB_LIBS = @DIRECTFB_LIBS@
-DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
-DIRECTX_CFLAGS = @DIRECTX_CFLAGS@
-DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DTS_LIBS = @DTS_LIBS@
-DUMPBIN = @DUMPBIN@
-DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
-DVDNAV_LIBS = @DVDNAV_LIBS@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-ERROR_CFLAGS = @ERROR_CFLAGS@
-ERROR_CXXFLAGS = @ERROR_CXXFLAGS@
-ERROR_OBJCFLAGS = @ERROR_OBJCFLAGS@
-EXEEXT = @EXEEXT@
-EXIF_CFLAGS = @EXIF_CFLAGS@
-EXIF_LIBS = @EXIF_LIBS@
-FAAC_LIBS = @FAAC_LIBS@
-FAAD_IS_NEAAC = @FAAD_IS_NEAAC@
-FAAD_LIBS = @FAAD_LIBS@
-FFLAGS = @FFLAGS@
-FGREP = @FGREP@
-FLITE_CFLAGS = @FLITE_CFLAGS@
-FLITE_LIBS = @FLITE_LIBS@
-FLUIDSYNTH_CFLAGS = @FLUIDSYNTH_CFLAGS@
-FLUIDSYNTH_LIBS = @FLUIDSYNTH_LIBS@
-GCOV = @GCOV@
-GCOV_CFLAGS = @GCOV_CFLAGS@
-GCOV_LIBS = @GCOV_LIBS@
-GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
-GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
-GIO_CFLAGS = @GIO_CFLAGS@
-GIO_LDFLAGS = @GIO_LDFLAGS@
-GIO_LIBS = @GIO_LIBS@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
-GLIB_EXTRA_CFLAGS = @GLIB_EXTRA_CFLAGS@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GLIB_LIBS = @GLIB_LIBS@
-GLIB_MKENUMS = @GLIB_MKENUMS@
-GLIB_PREFIX = @GLIB_PREFIX@
-GLIB_REQ = @GLIB_REQ@
-GL_CFLAGS = @GL_CFLAGS@
-GL_LIBS = @GL_LIBS@
-GL_OBJCFLAGS = @GL_OBJCFLAGS@
-GME_LIBS = @GME_LIBS@
-GMODULE_EXPORT_CFLAGS = @GMODULE_EXPORT_CFLAGS@
-GMODULE_EXPORT_LIBS = @GMODULE_EXPORT_LIBS@
-GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@
-GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
-GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
-GRAPHENE_LIBS = @GRAPHENE_LIBS@
-GREP = @GREP@
-GSETTINGS_CFLAGS = @GSETTINGS_CFLAGS@
-GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
-GSETTINGS_LIBS = @GSETTINGS_LIBS@
-GSM_LIBS = @GSM_LIBS@
-GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
-GSTPB_PREFIX = @GSTPB_PREFIX@
-GST_AGE = @GST_AGE@
-GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@
-GST_API_VERSION = @GST_API_VERSION@
-GST_BASE_CFLAGS = @GST_BASE_CFLAGS@
-GST_BASE_LIBS = @GST_BASE_LIBS@
-GST_CFLAGS = @GST_CFLAGS@
-GST_CHECK_CFLAGS = @GST_CHECK_CFLAGS@
-GST_CHECK_LIBS = @GST_CHECK_LIBS@
-GST_CONTROLLER_CFLAGS = @GST_CONTROLLER_CFLAGS@
-GST_CONTROLLER_LIBS = @GST_CONTROLLER_LIBS@
-GST_CURRENT = @GST_CURRENT@
-GST_CXXFLAGS = @GST_CXXFLAGS@
-GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@
-GST_LIBS = @GST_LIBS@
-GST_LIBVERSION = @GST_LIBVERSION@
-GST_LIB_LDFLAGS = @GST_LIB_LDFLAGS@
-GST_LICENSE = @GST_LICENSE@
-GST_LT_LDFLAGS = @GST_LT_LDFLAGS@
-GST_OBJCFLAGS = @GST_OBJCFLAGS@
-GST_OPTION_CFLAGS = @GST_OPTION_CFLAGS@
-GST_OPTION_CXXFLAGS = @GST_OPTION_CXXFLAGS@
-GST_OPTION_OBJCFLAGS = @GST_OPTION_OBJCFLAGS@
-GST_PACKAGE_NAME = @GST_PACKAGE_NAME@
-GST_PACKAGE_ORIGIN = @GST_PACKAGE_ORIGIN@
-GST_PKG_CONFIG_PATH = @GST_PKG_CONFIG_PATH@
-GST_PLUGINS_ALL = @GST_PLUGINS_ALL@
-GST_PLUGINS_BAD_CFLAGS = @GST_PLUGINS_BAD_CFLAGS@
-GST_PLUGINS_BAD_CXXFLAGS = @GST_PLUGINS_BAD_CXXFLAGS@
-GST_PLUGINS_BAD_OBJCFLAGS = @GST_PLUGINS_BAD_OBJCFLAGS@
-GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@
-GST_PLUGINS_BASE_DIR = @GST_PLUGINS_BASE_DIR@
-GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@
-GST_PLUGINS_DIR = @GST_PLUGINS_DIR@
-GST_PLUGINS_GOOD_CFLAGS = @GST_PLUGINS_GOOD_CFLAGS@
-GST_PLUGINS_GOOD_DIR = @GST_PLUGINS_GOOD_DIR@
-GST_PLUGINS_GOOD_LIBS = @GST_PLUGINS_GOOD_LIBS@
-GST_PLUGINS_LIBAV_CFLAGS = @GST_PLUGINS_LIBAV_CFLAGS@
-GST_PLUGINS_LIBAV_DIR = @GST_PLUGINS_LIBAV_DIR@
-GST_PLUGINS_LIBAV_LIBS = @GST_PLUGINS_LIBAV_LIBS@
-GST_PLUGINS_NONPORTED = @GST_PLUGINS_NONPORTED@
-GST_PLUGINS_SELECTED = @GST_PLUGINS_SELECTED@
-GST_PLUGINS_UGLY_CFLAGS = @GST_PLUGINS_UGLY_CFLAGS@
-GST_PLUGINS_UGLY_DIR = @GST_PLUGINS_UGLY_DIR@
-GST_PLUGINS_UGLY_LIBS = @GST_PLUGINS_UGLY_LIBS@
-GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
-GST_PLUGIN_LIBTOOLFLAGS = @GST_PLUGIN_LIBTOOLFLAGS@
-GST_PREFIX = @GST_PREFIX@
-GST_REVISION = @GST_REVISION@
-GST_TOOLS_DIR = @GST_TOOLS_DIR@
-GST_VIDEO_CFLAGS = @GST_VIDEO_CFLAGS@
-GST_VIDEO_LIBS = @GST_VIDEO_LIBS@
-GTK3_CFLAGS = @GTK3_CFLAGS@
-GTK3_LIBS = @GTK3_LIBS@
-GTKDOC_CHECK = @GTKDOC_CHECK@
-GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
-GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
-GTKDOC_MKPDF = @GTKDOC_MKPDF@
-GTKDOC_REBASE = @GTKDOC_REBASE@
-GTK_BASE_DIR = @GTK_BASE_DIR@
-GTK_CFLAGS = @GTK_CFLAGS@
-GTK_LIBS = @GTK_LIBS@
-GTK_VERSION = @GTK_VERSION@
-G_UDEV_CFLAGS = @G_UDEV_CFLAGS@
-G_UDEV_LIBS = @G_UDEV_LIBS@
-HAVE_CLUTTER = @HAVE_CLUTTER@
-HAVE_CLUTTER_GLX = @HAVE_CLUTTER_GLX@
-HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
-HAVE_CXX = @HAVE_CXX@
-HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
-HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
-HAVE_DTS = @HAVE_DTS@
-HAVE_EGL = @HAVE_EGL@
-HAVE_FAAC = @HAVE_FAAC@
-HAVE_FAAD = @HAVE_FAAD@
-HAVE_FLITE = @HAVE_FLITE@
-HAVE_GL = @HAVE_GL@
-HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
-HAVE_GRAPHENE = @HAVE_GRAPHENE@
-HAVE_GSM = @HAVE_GSM@
-HAVE_GTK3 = @HAVE_GTK3@
-HAVE_JPEG = @HAVE_JPEG@
-HAVE_NAS = @HAVE_NAS@
-HAVE_OPENJPEG = @HAVE_OPENJPEG@
-HAVE_PNG = @HAVE_PNG@
-HAVE_SRTP = @HAVE_SRTP@
-HAVE_WASAPI = @HAVE_WASAPI@
-HAVE_WILDMIDI = @HAVE_WILDMIDI@
-HAVE_WINKS = @HAVE_WINKS@
-HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
-HAVE_X11 = @HAVE_X11@
-HTML_DIR = @HTML_DIR@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
-INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
-INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
-INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
-INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
-INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
-INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
-INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
-JPEG_LIBS = @JPEG_LIBS@
-KATE_CFLAGS = @KATE_CFLAGS@
-KATE_LIBS = @KATE_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
-LIBDC1394_LIBS = @LIBDC1394_LIBS@
-LIBDIR = @LIBDIR@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBM = @LIBM@
-LIBMMS_CFLAGS = @LIBMMS_CFLAGS@
-LIBMMS_LIBS = @LIBMMS_LIBS@
-LIBOBJS = @LIBOBJS@
-LIBPNG_CFLAGS = @LIBPNG_CFLAGS@
-LIBPNG_LIBS = @LIBPNG_LIBS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@
-LIBUDEV_LIBS = @LIBUDEV_LIBS@
-LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
-LIBUSB_LIBS = @LIBUSB_LIBS@
-LIBVISUAL_CFLAGS = @LIBVISUAL_CFLAGS@
-LIBVISUAL_LIBS = @LIBVISUAL_LIBS@
-LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
-LIBXML2_LIBS = @LIBXML2_LIBS@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LOCALEDIR = @LOCALEDIR@
-LRDF_CFLAGS = @LRDF_CFLAGS@
-LRDF_LIBS = @LRDF_LIBS@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MIMIC_CFLAGS = @MIMIC_CFLAGS@
-MIMIC_LIBS = @MIMIC_LIBS@
-MJPEG_CFLAGS = @MJPEG_CFLAGS@
-MJPEG_LIBS = @MJPEG_LIBS@
-MKDIR_P = @MKDIR_P@
-MODPLUG_CFLAGS = @MODPLUG_CFLAGS@
-MODPLUG_LIBS = @MODPLUG_LIBS@
-MPEG2ENC_CFLAGS = @MPEG2ENC_CFLAGS@
-MPEG2ENC_LIBS = @MPEG2ENC_LIBS@
-MPG123_CFLAGS = @MPG123_CFLAGS@
-MPG123_LIBS = @MPG123_LIBS@
-MPLEX_CFLAGS = @MPLEX_CFLAGS@
-MPLEX_LDFLAGS = @MPLEX_LDFLAGS@
-MPLEX_LIBS = @MPLEX_LIBS@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-MUSEPACK_LIBS = @MUSEPACK_LIBS@
-NAS_CFLAGS = @NAS_CFLAGS@
-NAS_LIBS = @NAS_LIBS@
-NEON_CFLAGS = @NEON_CFLAGS@
-NEON_LIBS = @NEON_LIBS@
-NETTLE_CFLAGS = @NETTLE_CFLAGS@
-NETTLE_LIBS = @NETTLE_LIBS@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJC = @OBJC@
-OBJCDEPMODE = @OBJCDEPMODE@
-OBJCFLAGS = @OBJCFLAGS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OFA_CFLAGS = @OFA_CFLAGS@
-OFA_LIBS = @OFA_LIBS@
-OPENAL_CFLAGS = @OPENAL_CFLAGS@
-OPENAL_LIBS = @OPENAL_LIBS@
-OPENCV_CFLAGS = @OPENCV_CFLAGS@
-OPENCV_LIBS = @OPENCV_LIBS@
-OPENCV_PREFIX = @OPENCV_PREFIX@
-OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
-OPENEXR_LIBS = @OPENEXR_LIBS@
-OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
-OPENJPEG_LIBS = @OPENJPEG_LIBS@
-OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
-OPENNI2_LIBS = @OPENNI2_LIBS@
-OPUS_CFLAGS = @OPUS_CFLAGS@
-OPUS_LIBS = @OPUS_LIBS@
-ORCC = @ORCC@
-ORCC_FLAGS = @ORCC_FLAGS@
-ORC_CFLAGS = @ORC_CFLAGS@
-ORC_LIBS = @ORC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
-PACKAGE_VERSION_MICRO = @PACKAGE_VERSION_MICRO@
-PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
-PACKAGE_VERSION_NANO = @PACKAGE_VERSION_NANO@
-PACKAGE_VERSION_RELEASE = @PACKAGE_VERSION_RELEASE@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PLUGINDIR = @PLUGINDIR@
-POSUB = @POSUB@
-PROFILE_CFLAGS = @PROFILE_CFLAGS@
-PVR_CFLAGS = @PVR_CFLAGS@
-PVR_LIBS = @PVR_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-RSVG_2_36_2_CFLAGS = @RSVG_2_36_2_CFLAGS@
-RSVG_2_36_2_LIBS = @RSVG_2_36_2_LIBS@
-RSVG_CFLAGS = @RSVG_CFLAGS@
-RSVG_LIBS = @RSVG_LIBS@
-RTMP_CFLAGS = @RTMP_CFLAGS@
-RTMP_LIBS = @RTMP_LIBS@
-SBC_CFLAGS = @SBC_CFLAGS@
-SBC_LIBS = @SBC_LIBS@
-SCHRO_CFLAGS = @SCHRO_CFLAGS@
-SCHRO_LIBS = @SCHRO_LIBS@
-SDL_CFLAGS = @SDL_CFLAGS@
-SDL_CLUTTER = @SDL_CLUTTER@
-SDL_CONFIG = @SDL_CONFIG@
-SDL_LIBS = @SDL_LIBS@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SHM_LIBS = @SHM_LIBS@
-SLV2_CFLAGS = @SLV2_CFLAGS@
-SLV2_LIBS = @SLV2_LIBS@
-SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
-SNDFILE_LIBS = @SNDFILE_LIBS@
-SNDIO_LIBS = @SNDIO_LIBS@
-SOUNDTOUCH_CFLAGS = @SOUNDTOUCH_CFLAGS@
-SOUNDTOUCH_LIBS = @SOUNDTOUCH_LIBS@
-SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
-SPANDSP_LIBS = @SPANDSP_LIBS@
-SPC_LIBS = @SPC_LIBS@
-SRTP_LIBS = @SRTP_LIBS@
-SSH2_CFLAGS = @SSH2_CFLAGS@
-SSH2_LIBS = @SSH2_LIBS@
-STRIP = @STRIP@
-TELETEXTDEC_CFLAGS = @TELETEXTDEC_CFLAGS@
-TELETEXTDEC_LIBS = @TELETEXTDEC_LIBS@
-TIGER_CFLAGS = @TIGER_CFLAGS@
-TIGER_LIBS = @TIGER_LIBS@
-TIMIDITY_CFLAGS = @TIMIDITY_CFLAGS@
-TIMIDITY_LIBS = @TIMIDITY_LIBS@
-USE_GLES2 = @USE_GLES2@
-USE_NLS = @USE_NLS@
-USE_OPENGL = @USE_OPENGL@
-VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
-VALGRIND_LIBS = @VALGRIND_LIBS@
-VALGRIND_PATH = @VALGRIND_PATH@
-VDPAU_CFLAGS = @VDPAU_CFLAGS@
-VDPAU_LIBS = @VDPAU_LIBS@
-VERSION = @VERSION@
-VOAACENC_CFLAGS = @VOAACENC_CFLAGS@
-VOAACENC_LIBS = @VOAACENC_LIBS@
-VOAMRWBENC_CFLAGS = @VOAMRWBENC_CFLAGS@
-VOAMRWBENC_LIBS = @VOAMRWBENC_LIBS@
-WARNING_CFLAGS = @WARNING_CFLAGS@
-WARNING_CXXFLAGS = @WARNING_CXXFLAGS@
-WARNING_OBJCFLAGS = @WARNING_OBJCFLAGS@
-WASAPI_LIBS = @WASAPI_LIBS@
-WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
-WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
-WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
-WAYLAND_LIBS = @WAYLAND_LIBS@
-WEBP_CFLAGS = @WEBP_CFLAGS@
-WEBP_LIBS = @WEBP_LIBS@
-WILDMIDI_CFLAGS = @WILDMIDI_CFLAGS@
-WILDMIDI_LIBS = @WILDMIDI_LIBS@
-WINKS_LIBS = @WINKS_LIBS@
-WINSCREENCAP_LIBS = @WINSCREENCAP_LIBS@
-WINSOCK2_LIBS = @WINSOCK2_LIBS@
-X11_CFLAGS = @X11_CFLAGS@
-X11_LIBS = @X11_LIBS@
-XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
-XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
-XVID_LIBS = @XVID_LIBS@
-X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-ZBAR_CFLAGS = @ZBAR_CFLAGS@
-ZBAR_LIBS = @ZBAR_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_OBJC = @ac_ct_OBJC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-gsettingsschemadir = @gsettingsschemadir@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-plugindir = @plugindir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstdirectdrawsink.la
-libgstdirectdrawsink_la_SOURCES = gstdirectdrawsink.c gstdirectdrawplugin.c
-libgstdirectdrawsink_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
-	$(GST_PLUGINS_BASE_CFLAGS) $(DIRECTX_CFLAGS)
-
-libgstdirectdrawsink_la_LIBADD = \
-	$(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
-	-lgstinterfaces-$(GST_API_VERSION) \
-	 $(DIRECTX_LDFLAGS) $(DIRECTDRAW_LIBS)
-
-libgstdirectdrawsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdirectdrawsink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-noinst_HEADERS = gstdirectdrawsink.h
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sys/directdraw/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu sys/directdraw/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
-	@$(NORMAL_INSTALL)
-	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
-	list2=; for p in $$list; do \
-	  if test -f $$p; then \
-	    list2="$$list2 $$p"; \
-	  else :; fi; \
-	done; \
-	test -z "$$list2" || { \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
-	}
-
-uninstall-pluginLTLIBRARIES:
-	@$(NORMAL_UNINSTALL)
-	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
-	done
-
-clean-pluginLTLIBRARIES:
-	-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
-	@list='$(plugin_LTLIBRARIES)'; \
-	locs=`for p in $$list; do echo $$p; done | \
-	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-	      sort -u`; \
-	test -z "$$locs" || { \
-	  echo rm -f $${locs}; \
-	  rm -f $${locs}; \
-	}
-
-libgstdirectdrawsink.la: $(libgstdirectdrawsink_la_OBJECTS) $(libgstdirectdrawsink_la_DEPENDENCIES) $(EXTRA_libgstdirectdrawsink_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstdirectdrawsink_la_LINK) -rpath $(plugindir) $(libgstdirectdrawsink_la_OBJECTS) $(libgstdirectdrawsink_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawplugin.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawsink.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
-@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
-@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
-@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
-@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libgstdirectdrawsink_la-gstdirectdrawsink.lo: gstdirectdrawsink.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdirectdrawsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdirectdrawsink_la_CFLAGS) $(CFLAGS) -MT libgstdirectdrawsink_la-gstdirectdrawsink.lo -MD -MP -MF $(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawsink.Tpo -c -o libgstdirectdrawsink_la-gstdirectdrawsink.lo `test -f 'gstdirectdrawsink.c' || echo '$(srcdir)/'`gstdirectdrawsink.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawsink.Tpo $(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawsink.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdirectdrawsink.c' object='libgstdirectdrawsink_la-gstdirectdrawsink.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdirectdrawsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdirectdrawsink_la_CFLAGS) $(CFLAGS) -c -o libgstdirectdrawsink_la-gstdirectdrawsink.lo `test -f 'gstdirectdrawsink.c' || echo '$(srcdir)/'`gstdirectdrawsink.c
-
-libgstdirectdrawsink_la-gstdirectdrawplugin.lo: gstdirectdrawplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdirectdrawsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdirectdrawsink_la_CFLAGS) $(CFLAGS) -MT libgstdirectdrawsink_la-gstdirectdrawplugin.lo -MD -MP -MF $(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawplugin.Tpo -c -o libgstdirectdrawsink_la-gstdirectdrawplugin.lo `test -f 'gstdirectdrawplugin.c' || echo '$(srcdir)/'`gstdirectdrawplugin.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawplugin.Tpo $(DEPDIR)/libgstdirectdrawsink_la-gstdirectdrawplugin.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstdirectdrawplugin.c' object='libgstdirectdrawsink_la-gstdirectdrawplugin.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstdirectdrawsink_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdirectdrawsink_la_CFLAGS) $(CFLAGS) -c -o libgstdirectdrawsink_la-gstdirectdrawplugin.lo `test -f 'gstdirectdrawplugin.c' || echo '$(srcdir)/'`gstdirectdrawplugin.c
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	set x; \
-	here=`pwd`; \
-	$(am__define_uniq_tagged_files); \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
-installdirs:
-	for dir in "$(DESTDIR)$(plugindir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
-	mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-pluginLTLIBRARIES
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pluginLTLIBRARIES
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-pluginLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-pluginLTLIBRARIES install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
-	uninstall-pluginLTLIBRARIES
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/sys/directdraw/gstdirectdrawplugin.c b/sys/directdraw/gstdirectdrawplugin.c
deleted file mode 100644
index 38267c6..0000000
--- a/sys/directdraw/gstdirectdrawplugin.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* GStreamer
-* Copyright (C) 2005 Sebastien Moutte <sebastien@moutte.net>
-* Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com>
-*
-* gstdirectdrawplugin.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., 51 Franklin St, Fifth Floor,
-* Boston, MA 02110-1301, USA.
-*
-* The development of this code was made possible due to the involvement
-* of Pioneers of the Inevitable, the creators of the Songbird Music player
-*
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdirectdrawsink.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  if (!gst_element_register (plugin, "directdrawsink", GST_RANK_SECONDARY,
-          GST_TYPE_DIRECTDRAW_SINK))
-    return FALSE;
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    directdraw,
-    "Direct Draw plugin library",
-    plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/directdraw/gstdirectdrawsink.c b/sys/directdraw/gstdirectdrawsink.c
deleted file mode 100644
index 99140f2..0000000
--- a/sys/directdraw/gstdirectdrawsink.c
+++ /dev/null
@@ -1,2208 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Sebastien Moutte <sebastien@moutte.net>
- * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * The development of this code was made possible due to the involvement
- * of Pioneers of the Inevitable, the creators of the Songbird Music player
- *
- */
-
-/**
- * SECTION:element-directdrawsink
- *
- * DirectdrawSink renders video RGB frames to any win32 window. This element
- * can receive a window ID from the application through the #XOverlay interface
- * and will then render video frames in this window.
- * If no Window ID was provided by the application, the element will create its
- * own internal window and render into it.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v videotestsrc ! directdrawsink
- * ]| a simple pipeline to test the sink
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdirectdrawsink.h"
-#include <gst/video/video.h>
-
-GST_DEBUG_CATEGORY_STATIC (directdrawsink_debug);
-#define GST_CAT_DEFAULT directdrawsink_debug
-
-static void gst_directdraw_sink_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstDirectDrawSink, gst_directdraw_sink, GstVideoSink,
-    GST_TYPE_VIDEO_SINK, gst_directdraw_sink_init_interfaces);
-
-static void gst_directdraw_sink_finalize (GObject * object);
-static void gst_directdraw_sink_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_directdraw_sink_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-static GstCaps *gst_directdraw_sink_get_caps (GstBaseSink * bsink);
-static gboolean gst_directdraw_sink_set_caps (GstBaseSink * bsink,
-    GstCaps * caps);
-static GstStateChangeReturn gst_directdraw_sink_change_state (GstElement *
-    element, GstStateChange transition);
-static GstFlowReturn gst_directdraw_sink_buffer_alloc (GstBaseSink * bsink,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-static void gst_directdraw_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
-    GstClockTime * start, GstClockTime * end);
-static GstFlowReturn gst_directdraw_sink_show_frame (GstBaseSink * bsink,
-    GstBuffer * buf);
-
-/* utils */
-static gboolean gst_directdraw_sink_setup_ddraw (GstDirectDrawSink * ddrawsink);
-static gboolean gst_directdraw_sink_create_default_window (GstDirectDrawSink *
-    ddrawsink);
-static gboolean gst_directdraw_sink_check_primary_surface (GstDirectDrawSink *
-    ddrawsink);
-static gboolean gst_directdraw_sink_check_offscreen_surface (GstDirectDrawSink *
-    ddrawsink);
-static GstCaps *gst_directdraw_sink_get_ddrawcaps (GstDirectDrawSink *
-    ddrawsink);
-static GstCaps
-    * gst_directdraw_sink_create_caps_from_surfacedesc (LPDDSURFACEDESC2 desc);
-static void gst_directdraw_sink_cleanup (GstDirectDrawSink * ddrawsink);
-static void gst_directdraw_sink_bufferpool_clear (GstDirectDrawSink *
-    ddrawsink);
-static int gst_directdraw_sink_get_depth (LPDDPIXELFORMAT lpddpfPixelFormat);
-static gboolean gst_ddrawvideosink_get_format_from_caps (GstDirectDrawSink *
-    ddrawsink, GstCaps * caps, DDPIXELFORMAT * pPixelFormat);
-static void gst_directdraw_sink_center_rect (GstDirectDrawSink * ddrawsink,
-    RECT src, RECT dst, RECT * result);
-static const char *DDErrorString (HRESULT hr);
-static long FAR PASCAL WndProc (HWND hWnd, UINT message, WPARAM wParam,
-    LPARAM lParam);
-
-/* surfaces management functions */
-static void gst_directdraw_sink_surface_destroy (GstDirectDrawSink * ddrawsink,
-    GstDDrawSurface * surface);
-static GstDDrawSurface *gst_directdraw_sink_surface_create (GstDirectDrawSink *
-    ddrawsink, GstCaps * caps, size_t size);
-static gboolean gst_directdraw_sink_surface_check (GstDirectDrawSink *
-    ddrawsink, GstDDrawSurface * surface);
-
-static GstStaticPadTemplate directdrawsink_sink_factory =
-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 ]")
-    );
-
-enum
-{
-  PROP_0,
-  PROP_KEEP_ASPECT_RATIO
-};
-
-/* XOverlay interface implementation */
-static gboolean
-gst_directdraw_sink_interface_supported (GstImplementsInterface * iface,
-    GType type)
-{
-  if (type == GST_TYPE_X_OVERLAY)
-    return TRUE;
-  else if (type == GST_TYPE_NAVIGATION)
-    return TRUE;
-  return FALSE;
-}
-
-static void
-gst_directdraw_sink_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = gst_directdraw_sink_interface_supported;
-}
-
-static void
-gst_directdraw_sink_set_window_handle (GstXOverlay * overlay,
-    guintptr window_handle)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (overlay);
-
-  GST_OBJECT_LOCK (ddrawsink);
-  /* check if we are already using this window id */
-  if (ddrawsink->video_window == (HWND) window_handle) {
-    GST_OBJECT_UNLOCK (ddrawsink);
-    return;
-  }
-
-  if (window_handle) {
-    HRESULT hres;
-    RECT rect;
-
-    /* If we had an internal window, close it first */
-    if (ddrawsink->video_window && ddrawsink->our_video_window) {
-      /* Trick to let the event thread know that it has to die silently */
-      ddrawsink->our_video_window = FALSE;
-      /* Post quit message and wait for our event window thread */
-      PostMessage (ddrawsink->video_window, WM_QUIT, 0, 0);
-    }
-
-    ddrawsink->video_window = (HWND) window_handle;
-    ddrawsink->our_video_window = FALSE;
-
-    /* Hook WndProc and user_data */
-    ddrawsink->previous_user_data = (LONG_PTR) SetWindowLongPtr (
-        (HWND) window_handle, GWLP_USERDATA, (LONG_PTR) ddrawsink);
-    ddrawsink->previous_wndproc = (WNDPROC) SetWindowLongPtr (
-        (HWND) window_handle, GWLP_WNDPROC, (LONG_PTR) WndProc);
-    if (!ddrawsink->previous_wndproc)
-      GST_DEBUG_OBJECT (ddrawsink, "Failed to hook previous WndProc");
-
-    /* Get initial window size. If it changes, we will track it from the
-     * WndProc. */
-    GetClientRect ((HWND) window_handle, &rect);
-    ddrawsink->out_width = rect.right - rect.left;
-    ddrawsink->out_height = rect.bottom - rect.top;
-
-    if (ddrawsink->setup) {
-      /* update the clipper object with the new window */
-      hres = IDirectDrawClipper_SetHWnd (ddrawsink->clipper, 0,
-          ddrawsink->video_window);
-    }
-  }
-  /* FIXME: Handle the case where window_handle is 0 and we want the sink to
-   * create a new window when playback was already started (after set_caps) */
-  GST_OBJECT_UNLOCK (ddrawsink);
-}
-
-static void
-gst_directdraw_sink_expose (GstXOverlay * overlay)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (overlay);
-
-  gst_directdraw_sink_show_frame (GST_BASE_SINK (ddrawsink), NULL);
-}
-
-static void
-gst_directdraw_sink_xoverlay_interface_init (GstXOverlayClass * iface)
-{
-  iface->set_window_handle = gst_directdraw_sink_set_window_handle;
-  iface->expose = gst_directdraw_sink_expose;
-}
-
-static void
-gst_directdraw_sink_navigation_send_event (GstNavigation * navigation,
-    GstStructure * structure)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (navigation);
-  GstEvent *event;
-  GstVideoRectangle src = { 0, };
-  GstVideoRectangle dst = { 0, };
-  GstVideoRectangle result;
-  RECT rect;
-  gdouble x, y, old_x, old_y, xscale = 1.0, yscale = 1.0;
-  GstPad *pad = NULL;
-
-  src.w = GST_VIDEO_SINK_WIDTH (ddrawsink);
-  src.h = GST_VIDEO_SINK_HEIGHT (ddrawsink);
-  GetClientRect ((HWND) ddrawsink->video_window, &rect);
-  ddrawsink->out_width = rect.right - rect.left;
-  ddrawsink->out_height = rect.bottom - rect.top;
-  dst.w = ddrawsink->out_width;
-  dst.h = ddrawsink->out_height;
-
-  event = gst_event_new_navigation (structure);
-
-  if (ddrawsink->keep_aspect_ratio) {
-    gst_video_sink_center_rect (src, dst, &result, TRUE);
-  } else {
-    result.x = 0;
-    result.y = 0;
-    result.w = dst.w;
-    result.h = dst.h;
-  }
-
-  /* We calculate scaling using the original video frames geometry to include
-     pixel aspect ratio scaling. */
-  xscale = (gdouble) ddrawsink->video_width / result.w;
-  yscale = (gdouble) ddrawsink->video_height / result.h;
-
-  /* Converting pointer coordinates to the non scaled geometry */
-  if (gst_structure_get_double (structure, "pointer_x", &old_x)) {
-    x = old_x;
-    x = MIN (x, result.x + result.w);
-    x = MAX (x - result.x, 0);
-    gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
-        (gdouble) x * xscale, NULL);
-    GST_DEBUG_OBJECT (ddrawsink,
-        "translated navigation event x coordinate from %f to %f", old_x, x);
-  }
-  if (gst_structure_get_double (structure, "pointer_y", &old_y)) {
-    y = old_y;
-    y = MIN (y, result.y + result.h);
-    y = MAX (y - result.y, 0);
-    gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
-        (gdouble) y * yscale, NULL);
-    GST_DEBUG_OBJECT (ddrawsink,
-        "translated navigation event x coordinate from %f to %f", old_y, y);
-  }
-
-  pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (ddrawsink));
-
-  if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
-    gst_pad_send_event (pad, event);
-
-    gst_object_unref (pad);
-  }
-}
-
-static void
-gst_directdraw_sink_navigation_interface_init (GstNavigationInterface * iface)
-{
-  iface->send_event = gst_directdraw_sink_navigation_send_event;
-}
-
-static void
-gst_directdraw_sink_init_interfaces (GType type)
-{
-  static const GInterfaceInfo iface_info = {
-    (GInterfaceInitFunc) gst_directdraw_sink_interface_init,
-    NULL,
-    NULL,
-  };
-
-  static const GInterfaceInfo xoverlay_info = {
-    (GInterfaceInitFunc) gst_directdraw_sink_xoverlay_interface_init,
-    NULL,
-    NULL,
-  };
-
-  static const GInterfaceInfo navigation_info = {
-    (GInterfaceInitFunc) gst_directdraw_sink_navigation_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
-      &iface_info);
-  g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &xoverlay_info);
-  g_type_add_interface_static (type, GST_TYPE_NAVIGATION, &navigation_info);
-}
-
-/* Subclass of GstBuffer which manages buffer_pool surfaces lifetime    */
-static void gst_ddrawsurface_finalize (GstMiniObject * mini_object);
-static GstBufferClass *ddrawsurface_parent_class = NULL;
-
-static void
-gst_ddrawsurface_init (GstDDrawSurface * surface, gpointer g_class)
-{
-  surface->surface = NULL;
-  surface->width = 0;
-  surface->height = 0;
-  surface->ddrawsink = NULL;
-  surface->locked = FALSE;
-  surface->system_memory = FALSE;
-  memset (&surface->dd_pixel_format, 0, sizeof (DDPIXELFORMAT));
-}
-
-static void
-gst_ddrawsurface_class_init (gpointer g_class, gpointer class_data)
-{
-  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
-  ddrawsurface_parent_class = g_type_class_peek_parent (g_class);
-
-  mini_object_class->finalize = GST_DEBUG_FUNCPTR (gst_ddrawsurface_finalize);
-}
-
-static GType
-gst_ddrawsurface_get_type (void)
-{
-  static GType _gst_ddrawsurface_type;
-
-  if (G_UNLIKELY (_gst_ddrawsurface_type == 0)) {
-    static const GTypeInfo ddrawsurface_info = {
-      sizeof (GstBufferClass),
-      NULL,
-      NULL,
-      gst_ddrawsurface_class_init,
-      NULL,
-      NULL,
-      sizeof (GstDDrawSurface),
-      0,
-      (GInstanceInitFunc) gst_ddrawsurface_init,
-      NULL
-    };
-    _gst_ddrawsurface_type = g_type_register_static (GST_TYPE_BUFFER,
-        "GstDDrawSurface", &ddrawsurface_info, 0);
-  }
-  return _gst_ddrawsurface_type;
-}
-
-static void
-gst_ddrawsurface_finalize (GstMiniObject * mini_object)
-{
-  GstDirectDrawSink *ddrawsink = NULL;
-  GstDDrawSurface *surface;
-
-  surface = (GstDDrawSurface *) mini_object;
-
-  ddrawsink = surface->ddrawsink;
-  if (!ddrawsink)
-    goto no_sink;
-
-  /* If our geometry changed we can't reuse that image. */
-  if ((surface->width != ddrawsink->video_width) ||
-      (surface->height != ddrawsink->video_height) ||
-      (memcmp (&surface->dd_pixel_format, &ddrawsink->dd_pixel_format,
-              sizeof (DDPIXELFORMAT)) != 0 ||
-          !gst_directdraw_sink_surface_check (ddrawsink, surface))
-      ) {
-    GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-        "destroy image as its size changed %dx%d vs current %dx%d",
-        surface->width, surface->height, ddrawsink->video_width,
-        ddrawsink->video_height);
-    gst_directdraw_sink_surface_destroy (ddrawsink, surface);
-    GST_MINI_OBJECT_CLASS (ddrawsurface_parent_class)->finalize (mini_object);
-  } else {
-    /* In that case we can reuse the image and add it to our image pool. */
-    GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-        "recycling image in pool");
-
-    /* need to increment the refcount again to recycle */
-    gst_buffer_ref (GST_BUFFER (surface));
-
-    g_mutex_lock (ddrawsink->pool_lock);
-    ddrawsink->buffer_pool = g_slist_prepend (ddrawsink->buffer_pool, surface);
-    g_mutex_unlock (ddrawsink->pool_lock);
-  }
-
-  return;
-
-no_sink:
-  GST_CAT_WARNING (directdrawsink_debug, "no sink found");
-  GST_MINI_OBJECT_CLASS (ddrawsurface_parent_class)->finalize (mini_object);
-  return;
-}
-
-/************************************************************************/
-/* Directdraw sink functions                                            */
-/************************************************************************/
-static void
-gst_directdraw_sink_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_static_metadata (element_class,
-      "Direct Draw Video Sink", "Sink/Video",
-      "Output to a video card via Direct Draw",
-      "Sebastien Moutte <sebastien@moutte.net>");
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&directdrawsink_sink_factory));
-}
-
-static void
-gst_directdraw_sink_class_init (GstDirectDrawSinkClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-  GstBaseSinkClass *gstbasesink_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstbasesink_class = (GstBaseSinkClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
-
-  GST_DEBUG_CATEGORY_INIT (directdrawsink_debug, "directdrawsink", 0,
-      "Directdraw sink");
-
-  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_directdraw_sink_finalize);
-  gobject_class->get_property =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_get_property);
-  gobject_class->set_property =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_set_property);
-  gstelement_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_change_state);
-  gstbasesink_class->get_caps =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_get_caps);
-  gstbasesink_class->set_caps =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_set_caps);
-  gstbasesink_class->preroll =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_show_frame);
-  gstbasesink_class->render =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_show_frame);
-  gstbasesink_class->get_times =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_get_times);
-  gstbasesink_class->buffer_alloc =
-      GST_DEBUG_FUNCPTR (gst_directdraw_sink_buffer_alloc);
-
-  /* install properties */
-  /* setup aspect ratio mode */
-  g_object_class_install_property (G_OBJECT_CLASS (klass),
-      PROP_KEEP_ASPECT_RATIO, g_param_spec_boolean ("force-aspect-ratio",
-          "Force aspect ratio",
-          "When enabled, scaling will respect original aspect ratio", TRUE,
-          G_PARAM_READWRITE));
-}
-
-static void
-gst_directdraw_sink_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (object);
-
-  switch (prop_id) {
-    case PROP_KEEP_ASPECT_RATIO:
-      ddrawsink->keep_aspect_ratio = g_value_get_boolean (value);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_directdraw_sink_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (object);
-
-  switch (prop_id) {
-    case PROP_KEEP_ASPECT_RATIO:
-      g_value_set_boolean (value, ddrawsink->keep_aspect_ratio);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_directdraw_sink_finalize (GObject * object)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (object);
-
-  if (ddrawsink->pool_lock) {
-    g_mutex_free (ddrawsink->pool_lock);
-    ddrawsink->pool_lock = NULL;
-  }
-  if (ddrawsink->caps) {
-    gst_caps_unref (ddrawsink->caps);
-    ddrawsink->caps = NULL;
-  }
-  if (ddrawsink->setup) {
-    gst_directdraw_sink_cleanup (ddrawsink);
-  }
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_directdraw_sink_init (GstDirectDrawSink * ddrawsink,
-    GstDirectDrawSinkClass * g_class)
-{
-  /*init members variables */
-  ddrawsink->ddraw_object = NULL;
-  ddrawsink->primary_surface = NULL;
-  ddrawsink->offscreen_surface = NULL;
-  ddrawsink->clipper = NULL;
-  ddrawsink->video_window = NULL;
-  ddrawsink->our_video_window = TRUE;
-  ddrawsink->previous_wndproc = NULL;
-  ddrawsink->previous_user_data = (LONG_PTR) NULL;
-  ddrawsink->last_buffer = NULL;
-  ddrawsink->caps = NULL;
-  ddrawsink->window_thread = NULL;
-  ddrawsink->setup = FALSE;
-  ddrawsink->buffer_pool = NULL;
-  ddrawsink->keep_aspect_ratio = FALSE;
-  ddrawsink->pool_lock = g_mutex_new ();
-  ddrawsink->can_blit_between_colorspace = TRUE;
-  ddrawsink->must_recreate_offscreen = FALSE;
-  memset (&ddrawsink->dd_pixel_format, 0, sizeof (DDPIXELFORMAT));
-
-  /*video default values */
-  ddrawsink->video_height = 0;
-  ddrawsink->video_width = 0;
-  ddrawsink->fps_n = 0;
-  ddrawsink->fps_d = 0;
-}
-
-static GstCaps *
-gst_directdraw_sink_get_caps (GstBaseSink * bsink)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (bsink);
-  GstCaps *caps = NULL;
-
-  if (!ddrawsink->setup) {
-    caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD
-            (ddrawsink)));
-    GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-        "getcaps called and we are not setup yet, " "returning template %"
-        GST_PTR_FORMAT, caps);
-  } else {
-    caps = gst_caps_ref (ddrawsink->caps);
-  }
-
-  return caps;
-}
-
-static gboolean
-gst_directdraw_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (bsink);
-  GstStructure *structure = NULL;
-  gboolean ret;
-  const GValue *fps;
-  gint par_n, par_d;
-
-  structure = gst_caps_get_structure (caps, 0);
-  if (!structure)
-    return FALSE;
-
-  if (!gst_video_parse_caps_pixel_aspect_ratio (caps, &par_n, &par_d)) {
-    par_n = 1;
-    par_d = 1;
-  }
-
-  ret = gst_structure_get_int (structure, "width", &ddrawsink->video_width);
-  ret &= gst_structure_get_int (structure, "height", &ddrawsink->video_height);
-  fps = gst_structure_get_value (structure, "framerate");
-  ret &= (fps != NULL);
-  ret &=
-      gst_ddrawvideosink_get_format_from_caps (ddrawsink, caps,
-      &ddrawsink->dd_pixel_format);
-  if (!ret) {
-    GST_ELEMENT_ERROR (ddrawsink, CORE, NEGOTIATION,
-        ("Failed to get caps properties from caps"), (NULL));
-    return FALSE;
-  }
-  GST_VIDEO_SINK_WIDTH (ddrawsink) = ddrawsink->video_width * par_n / par_d;
-  GST_VIDEO_SINK_HEIGHT (ddrawsink) = ddrawsink->video_height;
-
-  ddrawsink->fps_n = gst_value_get_fraction_numerator (fps);
-  ddrawsink->fps_d = gst_value_get_fraction_denominator (fps);
-
-  /* Notify application to set window id now */
-  if (!ddrawsink->video_window) {
-    gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (ddrawsink));
-  }
-
-  /* If we still don't have a window at that stage we create our own */
-  if (!ddrawsink->video_window) {
-    gst_directdraw_sink_create_default_window (ddrawsink);
-  }
-
-  /* if we are rendering to our own window, resize it to video size */
-  if (ddrawsink->video_window && ddrawsink->our_video_window) {
-    SetWindowPos (ddrawsink->video_window, NULL,
-        0, 0,
-        GST_VIDEO_SINK_WIDTH (ddrawsink) +
-        (GetSystemMetrics (SM_CXSIZEFRAME) * 2),
-        GST_VIDEO_SINK_HEIGHT (ddrawsink) + GetSystemMetrics (SM_CYCAPTION) +
-        (GetSystemMetrics (SM_CYSIZEFRAME) * 2), SWP_SHOWWINDOW | SWP_NOMOVE);
-  }
-
-  /* release the surface, we have to recreate it! */
-  if (ddrawsink->offscreen_surface) {
-    IDirectDrawSurface7_Release (ddrawsink->offscreen_surface);
-    ddrawsink->offscreen_surface = NULL;
-  }
-
-  /* create an offscreen surface with the caps */
-  ret = gst_directdraw_sink_check_offscreen_surface (ddrawsink);
-  if (!ret) {
-    GST_ELEMENT_ERROR (ddrawsink, CORE, NEGOTIATION,
-        ("Can't create a directdraw offscreen surface with the input caps"),
-        (NULL));
-  }
-
-  return ret;
-}
-
-static GstStateChangeReturn
-gst_directdraw_sink_change_state (GstElement * element,
-    GstStateChange transition)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (element);
-  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      if (!gst_directdraw_sink_setup_ddraw (ddrawsink)) {
-        ret = GST_STATE_CHANGE_FAILURE;
-        goto beach;
-      }
-
-      if (!(ddrawsink->caps = gst_directdraw_sink_get_ddrawcaps (ddrawsink))) {
-        ret = GST_STATE_CHANGE_FAILURE;
-        goto beach;
-      }
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      ddrawsink->fps_n = 0;
-      ddrawsink->fps_d = 1;
-      ddrawsink->video_width = 0;
-      ddrawsink->video_height = 0;
-      if (ddrawsink->buffer_pool)
-        gst_directdraw_sink_bufferpool_clear (ddrawsink);
-      break;
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      if (ddrawsink->setup)
-        gst_directdraw_sink_cleanup (ddrawsink);
-      break;
-    default:
-      break;
-  }
-
-beach:
-  return ret;
-}
-
-static GstFlowReturn
-gst_directdraw_sink_buffer_alloc (GstBaseSink * bsink, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (bsink);
-  GstStructure *structure;
-  gint width, height;
-  GstDDrawSurface *surface = NULL;
-  GstFlowReturn ret = GST_FLOW_OK;
-  GstCaps *buffer_caps = caps;
-  gboolean buffercaps_unref = FALSE;
-
-  GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-      "a buffer of %u bytes was requested", size);
-
-  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 (ddrawsink, "invalid caps for buffer allocation %"
-        GST_PTR_FORMAT, caps);
-    return GST_FLOW_UNEXPECTED;
-  }
-
-  g_mutex_lock (ddrawsink->pool_lock);
-
-  /* Inspect our buffer pool */
-  while (ddrawsink->buffer_pool) {
-    surface = (GstDDrawSurface *) ddrawsink->buffer_pool->data;
-    if (surface) {
-      /* Removing from the pool */
-      ddrawsink->buffer_pool = g_slist_delete_link (ddrawsink->buffer_pool,
-          ddrawsink->buffer_pool);
-
-      /* If the surface is invalid for our need, destroy */
-      if ((surface->width != width) ||
-          (surface->height != height) ||
-          (memcmp (&surface->dd_pixel_format, &ddrawsink->dd_pixel_format,
-                  sizeof (DDPIXELFORMAT)) ||
-              !gst_directdraw_sink_surface_check (ddrawsink, surface))
-          ) {
-        gst_directdraw_sink_surface_destroy (ddrawsink, surface);
-        gst_buffer_unref (GST_BUFFER_CAST (surface));
-        surface = NULL;
-      } else {
-        /* We found a suitable surface */
-        break;
-      }
-    }
-  }
-
-  if (!ddrawsink->can_blit_between_colorspace) {
-    /* Hardware doesn't support blit from one colorspace to another.
-     * Check if the colorspace of the current display mode has changed since
-     * the last negociation. If it's the case, we will have to renegociate
-     */
-    guint depth;
-    HRESULT hres;
-    DDSURFACEDESC2 surface_desc;
-    DDSURFACEDESC2 *sd;
-
-    if (!gst_structure_get_int (structure, "depth", (gint *) & depth)) {
-      GST_CAT_DEBUG_OBJECT (directdrawsink_debug, ddrawsink,
-          "Can't get depth from buffer_alloc caps");
-      return GST_FLOW_ERROR;
-    }
-    surface_desc.dwSize = sizeof (surface_desc);
-    sd = &surface_desc;
-    hres =
-        IDirectDraw7_GetDisplayMode (ddrawsink->ddraw_object,
-        (DDSURFACEDESC *) sd);
-    if (hres != DD_OK) {
-      GST_CAT_DEBUG_OBJECT (directdrawsink_debug, ddrawsink,
-          "Can't get current display mode (error=%ld)", (glong) hres);
-      return GST_FLOW_ERROR;
-    }
-
-    if (depth != gst_directdraw_sink_get_depth (&surface_desc.ddpfPixelFormat)) {
-      GstCaps *copy_caps = NULL;
-      GstStructure *copy_structure = NULL;
-      GstCaps *display_caps = NULL;
-      GstStructure *display_structure = NULL;
-
-      /* make a copy of the original caps */
-      copy_caps = gst_caps_copy (caps);
-      copy_structure = gst_caps_get_structure (copy_caps, 0);
-
-      display_caps =
-          gst_directdraw_sink_create_caps_from_surfacedesc (&surface_desc);
-      if (display_caps) {
-        display_structure = gst_caps_get_structure (display_caps, 0);
-        if (display_structure) {
-          gint bpp, endianness, red_mask, green_mask, blue_mask;
-
-          /* get new display mode properties */
-          gst_structure_get_int (display_structure, "depth", (gint *) & depth);
-          gst_structure_get_int (display_structure, "bpp", &bpp);
-          gst_structure_get_int (display_structure, "endianness", &endianness);
-          gst_structure_get_int (display_structure, "red_mask", &red_mask);
-          gst_structure_get_int (display_structure, "green_mask", &green_mask);
-          gst_structure_get_int (display_structure, "blue_mask", &blue_mask);
-
-          /* apply the new display mode changes to the previous caps */
-          gst_structure_set (copy_structure,
-              "bpp", G_TYPE_INT, bpp,
-              "depth", G_TYPE_INT, depth,
-              "endianness", G_TYPE_INT, endianness,
-              "red_mask", G_TYPE_INT, red_mask,
-              "green_mask", G_TYPE_INT, green_mask,
-              "blue_mask", G_TYPE_INT, blue_mask, NULL);
-
-          if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ddrawsink),
-                  copy_caps)) {
-            buffer_caps = copy_caps;
-            buffercaps_unref = TRUE;
-            /* update buffer size needed to store video frames according to new caps */
-            size = width * height * (bpp / 8);
-
-            /* update our member pixel format */
-            gst_ddrawvideosink_get_format_from_caps (ddrawsink, buffer_caps,
-                &ddrawsink->dd_pixel_format);
-            ddrawsink->must_recreate_offscreen = TRUE;
-
-            GST_CAT_DEBUG_OBJECT (directdrawsink_debug, ddrawsink,
-                " desired caps %s \n\n new caps %s", gst_caps_to_string (caps),
-                gst_caps_to_string (buffer_caps));
-          } else {
-            GST_CAT_DEBUG_OBJECT (directdrawsink_debug, ddrawsink,
-                "peer refused caps re-negociation "
-                "and we can't render with the current caps.");
-            ret = GST_FLOW_ERROR;
-          }
-        }
-        gst_caps_unref (display_caps);
-      }
-
-      if (!buffercaps_unref)
-        gst_caps_unref (copy_caps);
-    }
-  }
-
-  /* We haven't found anything, creating a new one */
-  if (!surface) {
-    surface = gst_directdraw_sink_surface_create (ddrawsink, buffer_caps, size);
-  }
-
-  /* Now we should have a surface, set appropriate caps on it */
-  if (surface) {
-    GST_BUFFER_FLAGS (GST_BUFFER (surface)) = 0;
-    gst_buffer_set_caps (GST_BUFFER (surface), buffer_caps);
-  }
-
-  g_mutex_unlock (ddrawsink->pool_lock);
-
-  *buf = GST_BUFFER (surface);
-
-  if (buffercaps_unref)
-    gst_caps_unref (buffer_caps);
-
-  return ret;
-}
-
-static void
-gst_directdraw_sink_draw_borders (GstDirectDrawSink * ddrawsink, RECT dst_rect)
-{
-  RECT win_rect, fill_rect;
-  POINT win_point;
-  HDC hdc;
-
-  g_return_if_fail (GST_IS_DIRECTDRAW_SINK (ddrawsink));
-
-  /* Get the target window rect */
-  win_point.x = 0;
-  win_point.y = 0;
-  ClientToScreen (ddrawsink->video_window, &win_point);
-  GetClientRect (ddrawsink->video_window, &win_rect);
-  OffsetRect (&win_rect, win_point.x, win_point.y);
-
-  /* We acquire a drawing context */
-  if ((hdc = GetDC (ddrawsink->video_window))) {
-    HBRUSH brush = CreateSolidBrush (RGB (0, 0, 0));
-
-    /* arrange for logical coordinates that match screen coordinates */
-    SetWindowOrgEx (hdc, win_point.x, win_point.y, NULL);
-    /* Left border */
-    if (dst_rect.left > win_rect.left) {
-      fill_rect.left = win_rect.left;
-      fill_rect.top = win_rect.top;
-      fill_rect.bottom = win_rect.bottom;
-      fill_rect.right = dst_rect.left;
-      FillRect (hdc, &fill_rect, brush);
-    }
-    /* Right border */
-    if (dst_rect.right < win_rect.right) {
-      fill_rect.top = win_rect.top;
-      fill_rect.left = dst_rect.right;
-      fill_rect.bottom = win_rect.bottom;
-      fill_rect.right = win_rect.right;
-      FillRect (hdc, &fill_rect, brush);
-    }
-    /* Top border */
-    if (dst_rect.top > win_rect.top) {
-      fill_rect.top = win_rect.top;
-      fill_rect.left = win_rect.left;
-      fill_rect.right = win_rect.right;
-      fill_rect.bottom = dst_rect.top;
-      FillRect (hdc, &fill_rect, brush);
-    }
-    /* Bottom border */
-    if (dst_rect.bottom < win_rect.bottom) {
-      fill_rect.top = dst_rect.bottom;
-      fill_rect.left = win_rect.left;
-      fill_rect.right = win_rect.right;
-      fill_rect.bottom = win_rect.bottom;
-      FillRect (hdc, &fill_rect, brush);
-    }
-    DeleteObject (brush);
-    ReleaseDC (ddrawsink->video_window, hdc);
-  }
-}
-
-static GstFlowReturn
-gst_directdraw_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
-{
-  GstDirectDrawSink *ddrawsink = GST_DIRECTDRAW_SINK (bsink);
-  HRESULT hRes;
-  RECT destsurf_rect, src_rect;
-  POINT dest_surf_point;
-
-  if (buf) {
-    /* save a reference to the input buffer */
-    gst_buffer_ref (buf);
-    if (ddrawsink->last_buffer != NULL)
-      gst_buffer_unref (ddrawsink->last_buffer);
-    ddrawsink->last_buffer = buf;
-  } else {
-    /* use last buffer */
-    buf = ddrawsink->last_buffer;
-  }
-
-  if (buf == NULL) {
-    GST_ERROR_OBJECT (ddrawsink, "No buffer to render.");
-    return GST_FLOW_ERROR;
-  } else if (!ddrawsink->video_window) {
-    GST_WARNING_OBJECT (ddrawsink, "No video window to render to.");
-    return GST_FLOW_ERROR;
-  }
-
-  /* get the video window position */
-  GST_OBJECT_LOCK (ddrawsink);
-  if (G_UNLIKELY (!ddrawsink->video_window)) {
-    GST_OBJECT_UNLOCK (ddrawsink);
-    GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-        "gst_directdraw_sink_show_frame our video window disappeared");
-    GST_ELEMENT_ERROR (ddrawsink, RESOURCE, NOT_FOUND,
-        ("Output window was closed"), (NULL));
-    return GST_FLOW_ERROR;
-  }
-  dest_surf_point.x = 0;
-  dest_surf_point.y = 0;
-  ClientToScreen (ddrawsink->video_window, &dest_surf_point);
-  GetClientRect (ddrawsink->video_window, &destsurf_rect);
-  OffsetRect (&destsurf_rect, dest_surf_point.x, dest_surf_point.y);
-
-  /* Check to see if we have an area to draw to.
-   * When the window is minimized, it will trigger the
-   * "IDirectDrawSurface7_Blt (object's offscreen surface)" warning,
-   * with a msg that the rectangle is invalid */
-  if (destsurf_rect.right <= destsurf_rect.left ||
-      destsurf_rect.bottom <= destsurf_rect.top) {
-    GST_OBJECT_UNLOCK (ddrawsink);
-    GST_DEBUG_OBJECT (ddrawsink, "invalid rendering window rectangle "
-        "(%ld, %ld), (%ld, %ld)", destsurf_rect.left, destsurf_rect.top,
-        destsurf_rect.right, destsurf_rect.bottom);
-    goto beach;
-  }
-
-  if (ddrawsink->keep_aspect_ratio) {
-    /* center image to dest image keeping aspect ratio */
-    src_rect.top = 0;
-    src_rect.left = 0;
-    src_rect.bottom = GST_VIDEO_SINK_HEIGHT (ddrawsink);
-    src_rect.right = GST_VIDEO_SINK_WIDTH (ddrawsink);
-    gst_directdraw_sink_center_rect (ddrawsink, src_rect, destsurf_rect,
-        &destsurf_rect);
-    gst_directdraw_sink_draw_borders (ddrawsink, destsurf_rect);
-  }
-  GST_OBJECT_UNLOCK (ddrawsink);
-
-  if (ddrawsink->must_recreate_offscreen && ddrawsink->offscreen_surface) {
-    IDirectDrawSurface7_Release (ddrawsink->offscreen_surface);
-    ddrawsink->offscreen_surface = NULL;
-  }
-
-  /* check for surfaces lost */
-  if (!gst_directdraw_sink_check_primary_surface (ddrawsink) ||
-      !gst_directdraw_sink_check_offscreen_surface (ddrawsink)) {
-    return GST_FLOW_ERROR;
-  }
-
-  if (!GST_IS_DDRAWSURFACE (buf) ||
-      ((GST_IS_DDRAWSURFACE (buf)) && (GST_BUFFER (buf)->malloc_data))) {
-    /* We are receiving a system memory buffer so we will copy 
-       to the memory of our offscreen surface and next blit this surface 
-       on the primary surface */
-    LPBYTE data = NULL;
-    guint src_pitch, line;
-    DDSURFACEDESC2 surf_desc;
-    DDSURFACEDESC2 *sd;
-
-    ZeroMemory (&surf_desc, sizeof (surf_desc));
-    surf_desc.dwSize = sizeof (surf_desc);
-    sd = &surf_desc;
-
-    /* Lock the surface */
-    hRes =
-        IDirectDrawSurface7_Lock (ddrawsink->offscreen_surface, NULL,
-        (DDSURFACEDESC *) sd, DDLOCK_WAIT, NULL);
-    if (hRes != DD_OK) {
-      GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-          "gst_directdraw_sink_show_frame failed locking surface %s",
-          DDErrorString (hRes));
-
-      if (IDirectDrawSurface7_IsLost (ddrawsink->offscreen_surface) == DD_OK)
-        return GST_FLOW_OK;
-      else
-        return GST_FLOW_ERROR;
-    }
-
-    /* Write each line respecting the destination surface pitch */
-    data = surf_desc.lpSurface;
-    if (ddrawsink->video_height) {
-      src_pitch = GST_BUFFER_SIZE (buf) / ddrawsink->video_height;
-      for (line = 0; line < surf_desc.dwHeight; line++) {
-        memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch), src_pitch);
-        data += surf_desc.lPitch;
-      }
-    }
-
-    /* Unlock the surface */
-    hRes = IDirectDrawSurface7_Unlock (ddrawsink->offscreen_surface, NULL);
-    if (hRes != DD_OK) {
-      GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-          "gst_directdraw_sink_show_frame failed unlocking surface %s",
-          DDErrorString (hRes));
-      return GST_FLOW_ERROR;
-    }
-
-    /* blit to primary surface ( Blt will scale the video the dest rect surface
-     * if needed */
-    hRes = IDirectDrawSurface7_Blt (ddrawsink->primary_surface, &destsurf_rect,
-        ddrawsink->offscreen_surface, NULL, DDBLT_WAIT, NULL);
-    if (hRes != DD_OK)          /* FIXME: Is it really safe to continue past here ? */
-      GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-          "IDirectDrawSurface7_Blt (object's offscreen surface) " "returned %s",
-          DDErrorString (hRes));
-
-  } else {
-    /* We are receiving a directdraw surface (previously returned by our buffer
-     * pool so we will simply blit it on the primary surface */
-    GstDDrawSurface *surface = NULL;
-
-    surface = GST_DDRAWSURFACE (buf);
-
-    /* Unlocking surface before blit */
-    IDirectDrawSurface7_Unlock (surface->surface, NULL);
-    surface->locked = FALSE;
-
-    /* blit to our primary surface */
-    hRes = IDirectDrawSurface7_Blt (ddrawsink->primary_surface, &destsurf_rect,
-        surface->surface, NULL, DDBLT_WAIT, NULL);
-    if (hRes != DD_OK)          /* FIXME: Is it really safe to continue past here ? */
-      GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-          "IDirectDrawSurface7_Blt (offscreen surface from buffer_alloc) "
-          "returned %s", DDErrorString (hRes));
-  }
-
-beach:
-  return GST_FLOW_OK;
-}
-
-static void
-gst_directdraw_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
-    GstClockTime * start, GstClockTime * end)
-{
-  GstDirectDrawSink *ddrawsink;
-
-  ddrawsink = GST_DIRECTDRAW_SINK (bsink);
-
-  if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
-    *start = GST_BUFFER_TIMESTAMP (buf);
-    if (GST_BUFFER_DURATION_IS_VALID (buf)) {
-      *end = *start + GST_BUFFER_DURATION (buf);
-    } else {
-      if (ddrawsink->fps_n > 0) {
-        *end = *start + (GST_SECOND * ddrawsink->fps_d) / ddrawsink->fps_n;
-      }
-    }
-  }
-}
-
-/* Utility functions */
-
-/* this function fill a DDPIXELFORMAT using Gstreamer caps */
-static gboolean
-gst_ddrawvideosink_get_format_from_caps (GstDirectDrawSink * ddrawsink,
-    GstCaps * caps, DDPIXELFORMAT * pPixelFormat)
-{
-  GstStructure *structure = NULL;
-  gboolean ret = TRUE;
-
-  /* check params */
-  g_return_val_if_fail (pPixelFormat, FALSE);
-  g_return_val_if_fail (caps, FALSE);
-
-  /* init structure */
-  memset (pPixelFormat, 0, sizeof (DDPIXELFORMAT));
-  pPixelFormat->dwSize = sizeof (DDPIXELFORMAT);
-
-  if (!(structure = gst_caps_get_structure (caps, 0))) {
-    GST_CAT_ERROR_OBJECT (directdrawsink_debug, ddrawsink,
-        "can't get structure pointer from caps");
-    return FALSE;
-  }
-
-  if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
-    gint depth, bitcount, bitmask, endianness;
-
-    pPixelFormat->dwFlags = DDPF_RGB;
-    ret &= gst_structure_get_int (structure, "bpp", &bitcount);
-    pPixelFormat->dwRGBBitCount = bitcount;
-    ret &= gst_structure_get_int (structure, "depth", &depth);
-    ret &= gst_structure_get_int (structure, "red_mask", &bitmask);
-    pPixelFormat->dwRBitMask = bitmask;
-    ret &= gst_structure_get_int (structure, "green_mask", &bitmask);
-    pPixelFormat->dwGBitMask = bitmask;
-    ret &= gst_structure_get_int (structure, "blue_mask", &bitmask);
-    pPixelFormat->dwBBitMask = bitmask;
-
-    gst_structure_get_int (structure, "endianness", &endianness);
-    if (endianness == G_BIG_ENDIAN) {
-      endianness = G_LITTLE_ENDIAN;
-      pPixelFormat->dwRBitMask = GUINT32_TO_BE (pPixelFormat->dwRBitMask);
-      pPixelFormat->dwGBitMask = GUINT32_TO_BE (pPixelFormat->dwGBitMask);
-      pPixelFormat->dwBBitMask = GUINT32_TO_BE (pPixelFormat->dwBBitMask);
-    }
-  } else if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
-    guint32 fourcc;
-
-    pPixelFormat->dwFlags = DDPF_FOURCC;
-    ret &= gst_structure_get_fourcc (structure, "format", &fourcc);
-    pPixelFormat->dwFourCC = fourcc;
-  } else {
-    GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-        "unknown caps name received %" GST_PTR_FORMAT, caps);
-    ret = FALSE;
-  }
-
-  return ret;
-}
-
-/* This function centers the RECT of source surface to
-a dest surface and set the result RECT into result */
-static void
-gst_directdraw_sink_center_rect (GstDirectDrawSink * ddrawsink, RECT src,
-    RECT dst, RECT * result)
-{
-  gdouble src_ratio, dst_ratio;
-  long src_width = src.right;
-  long src_height = src.bottom;
-  long dst_width = dst.right - dst.left;
-  long dst_heigth = dst.bottom - dst.top;
-  long result_width = 0, result_height = 0;
-
-  g_return_if_fail (result != NULL);
-
-  src_ratio = (gdouble) src_width / src_height;
-  dst_ratio = (gdouble) dst_width / dst_heigth;
-
-  if (src_ratio > dst_ratio) {
-    /* new height */
-    result_height = (long) (dst_width / src_ratio);
-
-    result->left = dst.left;
-    result->right = dst.right;
-    result->top = dst.top + (dst_heigth - result_height) / 2;
-    result->bottom = result->top + result_height;
-
-  } else if (src_ratio < dst_ratio) {
-    /* new width */
-    result_width = (long) (dst_heigth * src_ratio);
-
-    result->top = dst.top;
-    result->bottom = dst.bottom;
-    result->left = dst.left + (dst_width - result_width) / 2;
-    result->right = result->left + result_width;
-
-  } else {
-    /* same ratio */
-    memcpy (result, &dst, sizeof (RECT));
-  }
-
-  GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-      "source is %ldx%ld dest is %ldx%ld, result is %ldx%ld with x,y %ldx%ld",
-      src_width, src_height, dst_width, dst_heigth,
-      result->right - result->left, result->bottom - result->top, result->left,
-      result->right);
-}
-
-/**
- * Get DirectDraw error message.
- * @hr: HRESULT code
- * Returns: Text representation of the error.
- */
-static const char *
-DDErrorString (HRESULT hr)
-{
-  switch (hr) {
-    case DDERR_ALREADYINITIALIZED:
-      return "DDERR_ALREADYINITIALIZED";
-    case DDERR_CANNOTATTACHSURFACE:
-      return "DDERR_CANNOTATTACHSURFACE";
-    case DDERR_CANNOTDETACHSURFACE:
-      return "DDERR_CANNOTDETACHSURFACE";
-    case DDERR_CURRENTLYNOTAVAIL:
-      return "DDERR_CURRENTLYNOTAVAIL";
-    case DDERR_EXCEPTION:
-      return "DDERR_EXCEPTION";
-    case DDERR_GENERIC:
-      return "DDERR_GENERIC";
-    case DDERR_HEIGHTALIGN:
-      return "DDERR_HEIGHTALIGN";
-    case DDERR_INCOMPATIBLEPRIMARY:
-      return "DDERR_INCOMPATIBLEPRIMARY";
-    case DDERR_INVALIDCAPS:
-      return "DDERR_INVALIDCAPS";
-    case DDERR_INVALIDCLIPLIST:
-      return "DDERR_INVALIDCLIPLIST";
-    case DDERR_INVALIDMODE:
-      return "DDERR_INVALIDMODE";
-    case DDERR_INVALIDOBJECT:
-      return "DDERR_INVALIDOBJECT";
-    case DDERR_INVALIDPARAMS:
-      return "DDERR_INVALIDPARAMS";
-    case DDERR_INVALIDPIXELFORMAT:
-      return "DDERR_INVALIDPIXELFORMAT";
-    case DDERR_INVALIDRECT:
-      return "DDERR_INVALIDRECT";
-    case DDERR_LOCKEDSURFACES:
-      return "DDERR_LOCKEDSURFACES";
-    case DDERR_NO3D:
-      return "DDERR_NO3D";
-    case DDERR_NOALPHAHW:
-      return "DDERR_NOALPHAHW";
-    case DDERR_NOCLIPLIST:
-      return "DDERR_NOCLIPLIST";
-    case DDERR_NOCOLORCONVHW:
-      return "DDERR_NOCOLORCONVHW";
-    case DDERR_NOCOOPERATIVELEVELSET:
-      return "DDERR_NOCOOPERATIVELEVELSET";
-    case DDERR_NOCOLORKEY:
-      return "DDERR_NOCOLORKEY";
-    case DDERR_NOCOLORKEYHW:
-      return "DDERR_NOCOLORKEYHW";
-    case DDERR_NODIRECTDRAWSUPPORT:
-      return "DDERR_NODIRECTDRAWSUPPORT";
-    case DDERR_NOEXCLUSIVEMODE:
-      return "DDERR_NOEXCLUSIVEMODE";
-    case DDERR_NOFLIPHW:
-      return "DDERR_NOFLIPHW";
-    case DDERR_NOGDI:
-      return "DDERR_NOGDI";
-    case DDERR_NOMIRRORHW:
-      return "DDERR_NOMIRRORHW";
-    case DDERR_NOTFOUND:
-      return "DDERR_NOTFOUND";
-    case DDERR_NOOVERLAYHW:
-      return "DDERR_NOOVERLAYHW";
-    case DDERR_NORASTEROPHW:
-      return "DDERR_NORASTEROPHW";
-    case DDERR_NOROTATIONHW:
-      return "DDERR_NOROTATIONHW";
-    case DDERR_NOSTRETCHHW:
-      return "DDERR_NOSTRETCHHW";
-    case DDERR_NOT4BITCOLOR:
-      return "DDERR_NOT4BITCOLOR";
-    case DDERR_NOT4BITCOLORINDEX:
-      return "DDERR_NOT4BITCOLORINDEX";
-    case DDERR_NOT8BITCOLOR:
-      return "DDERR_NOT8BITCOLOR";
-    case DDERR_NOTEXTUREHW:
-      return "DDERR_NOTEXTUREHW";
-    case DDERR_NOVSYNCHW:
-      return "DDERR_NOVSYNCHW";
-    case DDERR_NOZBUFFERHW:
-      return "DDERR_NOZBUFFERHW";
-    case DDERR_NOZOVERLAYHW:
-      return "DDERR_NOZOVERLAYHW";
-    case DDERR_OUTOFCAPS:
-      return "DDERR_OUTOFCAPS";
-    case DDERR_OUTOFMEMORY:
-      return "DDERR_OUTOFMEMORY";
-    case DDERR_OUTOFVIDEOMEMORY:
-      return "DDERR_OUTOFVIDEOMEMORY";
-    case DDERR_OVERLAYCANTCLIP:
-      return "DDERR_OVERLAYCANTCLIP";
-    case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:
-      return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE";
-    case DDERR_PALETTEBUSY:
-      return "DDERR_PALETTEBUSY";
-    case DDERR_COLORKEYNOTSET:
-      return "DDERR_COLORKEYNOTSET";
-    case DDERR_SURFACEALREADYATTACHED:
-      return "DDERR_SURFACEALREADYATTACHED";
-    case DDERR_SURFACEALREADYDEPENDENT:
-      return "DDERR_SURFACEALREADYDEPENDENT";
-    case DDERR_SURFACEBUSY:
-      return "DDERR_SURFACEBUSY";
-    case DDERR_CANTLOCKSURFACE:
-      return "DDERR_CANTLOCKSURFACE";
-    case DDERR_SURFACEISOBSCURED:
-      return "DDERR_SURFACEISOBSCURED";
-    case DDERR_SURFACELOST:
-      return "DDERR_SURFACELOST";
-    case DDERR_SURFACENOTATTACHED:
-      return "DDERR_SURFACENOTATTACHED";
-    case DDERR_TOOBIGHEIGHT:
-      return "DDERR_TOOBIGHEIGHT";
-    case DDERR_TOOBIGSIZE:
-      return "DDERR_TOOBIGSIZE";
-    case DDERR_TOOBIGWIDTH:
-      return "DDERR_TOOBIGWIDTH";
-    case DDERR_UNSUPPORTED:
-      return "DDERR_UNSUPPORTED";
-    case DDERR_UNSUPPORTEDFORMAT:
-      return "DDERR_UNSUPPORTEDFORMAT";
-    case DDERR_UNSUPPORTEDMASK:
-      return "DDERR_UNSUPPORTEDMASK";
-    case DDERR_VERTICALBLANKINPROGRESS:
-      return "DDERR_VERTICALBLANKINPROGRESS";
-    case DDERR_WASSTILLDRAWING:
-      return "DDERR_WASSTILLDRAWING";
-    case DDERR_XALIGN:
-      return "DDERR_XALIGN";
-    case DDERR_INVALIDDIRECTDRAWGUID:
-      return "DDERR_INVALIDDIRECTDRAWGUID";
-    case DDERR_DIRECTDRAWALREADYCREATED:
-      return "DDERR_DIRECTDRAWALREADYCREATED";
-    case DDERR_NODIRECTDRAWHW:
-      return "DDERR_NODIRECTDRAWHW";
-    case DDERR_PRIMARYSURFACEALREADYEXISTS:
-      return "DDERR_PRIMARYSURFACEALREADYEXISTS";
-    case DDERR_NOEMULATION:
-      return "DDERR_NOEMULATION";
-    case DDERR_REGIONTOOSMALL:
-      return "DDERR_REGIONTOOSMALL";
-    case DDERR_CLIPPERISUSINGHWND:
-      return "DDERR_CLIPPERISUSINGHWND";
-    case DDERR_NOCLIPPERATTACHED:
-      return "DDERR_NOCLIPPERATTACHED";
-    case DDERR_NOHWND:
-      return "DDERR_NOHWND";
-    case DDERR_HWNDSUBCLASSED:
-      return "DDERR_HWNDSUBCLASSED";
-    case DDERR_HWNDALREADYSET:
-      return "DDERR_HWNDALREADYSET";
-    case DDERR_NOPALETTEATTACHED:
-      return "DDERR_NOPALETTEATTACHED";
-    case DDERR_NOPALETTEHW:
-      return "DDERR_NOPALETTEHW";
-    case DDERR_BLTFASTCANTCLIP:
-      return "DDERR_BLTFASTCANTCLIP";
-    case DDERR_NOBLTHW:
-      return "DDERR_NOBLTHW";
-    case DDERR_NODDROPSHW:
-      return "DDERR_NODDROPSHW";
-    case DDERR_OVERLAYNOTVISIBLE:
-      return "DDERR_OVERLAYNOTVISIBLE";
-    case DDERR_NOOVERLAYDEST:
-      return "DDERR_NOOVERLAYDEST";
-    case DDERR_INVALIDPOSITION:
-      return "DDERR_INVALIDPOSITION";
-    case DDERR_NOTAOVERLAYSURFACE:
-      return "DDERR_NOTAOVERLAYSURFACE";
-    case DDERR_EXCLUSIVEMODEALREADYSET:
-      return "DDERR_EXCLUSIVEMODEALREADYSET";
-    case DDERR_NOTFLIPPABLE:
-      return "DDERR_NOTFLIPPABLE";
-    case DDERR_CANTDUPLICATE:
-      return "DDERR_CANTDUPLICATE";
-    case DDERR_NOTLOCKED:
-      return "DDERR_NOTLOCKED";
-    case DDERR_CANTCREATEDC:
-      return "DDERR_CANTCREATEDC";
-    case DDERR_NODC:
-      return "DDERR_NODC";
-    case DDERR_WRONGMODE:
-      return "DDERR_WRONGMODE";
-    case DDERR_IMPLICITLYCREATED:
-      return "DDERR_IMPLICITLYCREATED";
-    case DDERR_NOTPALETTIZED:
-      return "DDERR_NOTPALETTIZED";
-    case DDERR_UNSUPPORTEDMODE:
-      return "DDERR_UNSUPPORTEDMODE";
-    case DDERR_NOMIPMAPHW:
-      return "DDERR_NOMIPMAPHW";
-    case DDERR_INVALIDSURFACETYPE:
-      return "DDERR_INVALIDSURFACETYPE";
-    case DDERR_DCALREADYCREATED:
-      return "DDERR_DCALREADYCREATED";
-    case DDERR_CANTPAGELOCK:
-      return "DDERR_CANTPAGELOCK";
-    case DDERR_CANTPAGEUNLOCK:
-      return "DDERR_CANTPAGEUNLOCK";
-    case DDERR_NOTPAGELOCKED:
-      return "DDERR_NOTPAGELOCKED";
-    case DDERR_NOTINITIALIZED:
-      return "DDERR_NOTINITIALIZED";
-  }
-  return "Unknown Error";
-}
-
-static gboolean
-gst_directdraw_sink_setup_ddraw (GstDirectDrawSink * ddrawsink)
-{
-  gboolean bRet = TRUE;
-  HRESULT hRes;
-  /* create an instance of the ddraw object use DDCREATE_EMULATIONONLY as first
-   * parameter to force Directdraw to use the hardware emulation layer */
-  hRes = DirectDrawCreateEx ( /*DDCREATE_EMULATIONONLY */ 0,
-      (void **) &ddrawsink->ddraw_object, &IID_IDirectDraw7, NULL);
-  if (hRes != DD_OK || ddrawsink->ddraw_object == NULL) {
-    GST_ELEMENT_ERROR (ddrawsink, RESOURCE, WRITE,
-        ("Failed to create the DirectDraw object error=%s",
-            DDErrorString (hRes)), (NULL));
-    return FALSE;
-  }
-
-  /* set cooperative level */
-  hRes = IDirectDraw7_SetCooperativeLevel (ddrawsink->ddraw_object,
-      NULL, DDSCL_NORMAL);
-  if (hRes != DD_OK) {
-    GST_ELEMENT_ERROR (ddrawsink, RESOURCE, WRITE,
-        ("Failed to set the set the cooperative level error=%s",
-            DDErrorString (hRes)), (NULL));
-    return FALSE;
-  }
-
-  /* setup the clipper object */
-  hRes = IDirectDraw7_CreateClipper (ddrawsink->ddraw_object, 0,
-      &ddrawsink->clipper, NULL);
-
-  if (hRes == DD_OK && ddrawsink->video_window)
-    IDirectDrawClipper_SetHWnd (ddrawsink->clipper, 0, ddrawsink->video_window);
-
-  /* create our primary surface */
-  if (!gst_directdraw_sink_check_primary_surface (ddrawsink))
-    return FALSE;
-
-  /* directdraw objects are setup */
-  ddrawsink->setup = TRUE;
-
-  return bRet;
-}
-
-static LRESULT FAR PASCAL
-WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
-  GstDirectDrawSink *ddrawsink;
-  LRESULT ret;
-
-  ddrawsink = (GstDirectDrawSink *) GetWindowLongPtr (hWnd, GWLP_USERDATA);
-
-  switch (message) {
-    case WM_CREATE:{
-      LPCREATESTRUCT crs = (LPCREATESTRUCT) lParam;
-      /* Nail pointer to the video sink down to this window */
-      SetWindowLongPtr (hWnd, GWLP_USERDATA, (LONG_PTR) crs->lpCreateParams);
-      break;
-    }
-    case WM_SIZE:
-    case WM_CHAR:
-    case WM_KEYDOWN:
-    case WM_KEYUP:
-    case WM_LBUTTONDOWN:
-    case WM_RBUTTONDOWN:
-    case WM_MBUTTONDOWN:
-    case WM_LBUTTONUP:
-    case WM_RBUTTONUP:
-    case WM_MBUTTONUP:
-    case WM_MOUSEMOVE:{
-      GstDirectDrawSink *ddrawsink;
-      ddrawsink = (GstDirectDrawSink *) GetWindowLongPtr (hWnd, GWLP_USERDATA);
-
-      if (G_UNLIKELY (!ddrawsink))
-        break;
-
-      switch (message) {
-        case WM_SIZE:{
-          GST_OBJECT_LOCK (ddrawsink);
-          ddrawsink->out_width = LOWORD (lParam);
-          ddrawsink->out_height = HIWORD (lParam);
-          GST_OBJECT_UNLOCK (ddrawsink);
-          GST_DEBUG_OBJECT (ddrawsink, "Window size is %dx%d", LOWORD (wParam),
-              HIWORD (wParam));
-          break;
-        }
-        case WM_CHAR:
-        case WM_KEYDOWN:
-        case WM_KEYUP:{
-          gunichar2 wcrep[128];
-          if (GetKeyNameTextW (lParam, wcrep, 128)) {
-            gchar *utfrep = g_utf16_to_utf8 (wcrep, 128, NULL, NULL, NULL);
-            if (utfrep) {
-              if (message == WM_CHAR || message == WM_KEYDOWN)
-                gst_navigation_send_key_event (GST_NAVIGATION (ddrawsink),
-                    "key-press", utfrep);
-              if (message == WM_CHAR || message == WM_KEYUP)
-                gst_navigation_send_key_event (GST_NAVIGATION (ddrawsink),
-                    "key-release", utfrep);
-              g_free (utfrep);
-            }
-          }
-          break;
-        }
-        case WM_LBUTTONDOWN:
-        case WM_LBUTTONUP:
-        case WM_RBUTTONDOWN:
-        case WM_RBUTTONUP:
-        case WM_MBUTTONDOWN:
-        case WM_MBUTTONUP:
-        case WM_MOUSEMOVE:{
-          gint x, y, button;
-          const gchar *action;
-
-          switch (message) {
-            case WM_MOUSEMOVE:
-              button = 0;
-              action = "mouse-move";
-              break;
-            case WM_LBUTTONDOWN:
-              button = 1;
-              action = "mouse-button-press";
-              break;
-            case WM_LBUTTONUP:
-              button = 1;
-              action = "mouse-button-release";
-              break;
-            case WM_RBUTTONDOWN:
-              button = 2;
-              action = "mouse-button-press";
-              break;
-            case WM_RBUTTONUP:
-              button = 2;
-              action = "mouse-button-release";
-              break;
-            case WM_MBUTTONDOWN:
-              button = 3;
-              action = "mouse-button-press";
-              break;
-            case WM_MBUTTONUP:
-              button = 3;
-              action = "mouse-button-release";
-              break;
-            default:
-              button = 4;
-              action = NULL;
-          }
-
-          x = LOWORD (lParam);
-          y = HIWORD (lParam);
-
-          if (button == 0) {
-            GST_DEBUG_OBJECT (ddrawsink, "Mouse moved to %dx%d", x, y);
-          } else
-            GST_DEBUG_OBJECT (ddrawsink, "Mouse button %d pressed at %dx%d",
-                button, x, y);
-
-          if (button < 4)
-            gst_navigation_send_mouse_event (GST_NAVIGATION (ddrawsink),
-                action, button, x, y);
-
-          break;
-        }
-      }
-      break;
-    }
-    case WM_ERASEBKGND:
-      return TRUE;
-    case WM_CLOSE:
-      DestroyWindow (hWnd);
-    case WM_DESTROY:
-      PostQuitMessage (0);
-      return 0;
-  }
-  if (ddrawsink && ddrawsink->previous_wndproc) {
-    /* If there was a previous custom WndProc, call it */
-
-    /* Temporarily restore the previous user_data */
-    if (ddrawsink->previous_user_data)
-      SetWindowLongPtr (hWnd, GWLP_USERDATA, ddrawsink->previous_user_data);
-
-    /* Call previous WndProc */
-    ret =
-        CallWindowProc (ddrawsink->previous_wndproc, hWnd, message, wParam,
-        lParam);
-
-    /* Point the user_data back to our ddraw_sink */
-    SetWindowLongPtr (hWnd, GWLP_USERDATA, (LONG_PTR) ddrawsink);
-  } else {
-    /* if there was no previous custom WndProc, call Window's default one */
-    ret = DefWindowProc (hWnd, message, wParam, lParam);
-  }
-
-  return ret;
-}
-
-static gpointer
-gst_directdraw_sink_window_thread (GstDirectDrawSink * ddrawsink)
-{
-  WNDCLASS WndClass;
-  MSG msg;
-
-  memset (&WndClass, 0, sizeof (WNDCLASS));
-  WndClass.style = CS_HREDRAW | CS_VREDRAW;
-  WndClass.hInstance = GetModuleHandle (NULL);
-  WndClass.lpszClassName = "GStreamer-DirectDraw";
-  WndClass.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
-  WndClass.cbClsExtra = 0;
-  WndClass.cbWndExtra = 0;
-  WndClass.lpfnWndProc = WndProc;
-  WndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
-  RegisterClass (&WndClass);
-
-  ddrawsink->video_window = CreateWindowEx (0, "GStreamer-DirectDraw",
-      "GStreamer-DirectDraw sink default window",
-      WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0, 0, 640, 480, NULL, NULL,
-      WndClass.hInstance, (LPVOID) ddrawsink);
-  if (ddrawsink->video_window == NULL)
-    return NULL;
-
-  /* Set the clipper on that window */
-  IDirectDrawClipper_SetHWnd (ddrawsink->clipper, 0, ddrawsink->video_window);
-
-  /* signal application we created a window */
-  gst_x_overlay_got_window_handle (GST_X_OVERLAY (ddrawsink),
-      (guintptr) ddrawsink->video_window);
-
-  ReleaseSemaphore (ddrawsink->window_created_signal, 1, NULL);
-
-  /* start message loop processing our default window messages */
-  while (GetMessage (&msg, NULL, 0, 0) != FALSE) {
-    TranslateMessage (&msg);
-    DispatchMessage (&msg);
-  }
-
-  GST_CAT_LOG_OBJECT (directdrawsink_debug, ddrawsink,
-      "our window received WM_QUIT or error.");
-  /* The window could have changed, if it is not ours anymore we don't
-   * overwrite the current video window with NULL */
-  if (ddrawsink->our_video_window) {
-    GST_OBJECT_LOCK (ddrawsink);
-    ddrawsink->video_window = NULL;
-    GST_OBJECT_UNLOCK (ddrawsink);
-  }
-
-  return NULL;
-}
-
-static gboolean
-gst_directdraw_sink_create_default_window (GstDirectDrawSink * ddrawsink)
-{
-  ddrawsink->window_created_signal = CreateSemaphore (NULL, 0, 1, NULL);
-  if (ddrawsink->window_created_signal == NULL)
-    return FALSE;
-
-  ddrawsink->window_thread = g_thread_create (
-      (GThreadFunc) gst_directdraw_sink_window_thread, ddrawsink, TRUE, NULL);
-
-  if (ddrawsink->window_thread == NULL)
-    goto failed;
-
-  /* wait maximum 10 seconds for windows creating */
-  if (WaitForSingleObject (ddrawsink->window_created_signal,
-          10000) != WAIT_OBJECT_0)
-    goto failed;
-
-  CloseHandle (ddrawsink->window_created_signal);
-  return TRUE;
-
-failed:
-  CloseHandle (ddrawsink->window_created_signal);
-  GST_ELEMENT_ERROR (ddrawsink, RESOURCE, WRITE,
-      ("Error creating our default window"), (NULL));
-
-  return FALSE;
-}
-
-static gboolean
-gst_directdraw_sink_check_primary_surface (GstDirectDrawSink * ddrawsink)
-{
-  HRESULT hres;
-  DDSURFACEDESC2 dd_surface_desc;
-  DDSURFACEDESC2 *sd;
-
-  /* if our primary surface already exist, check if it's not lost */
-  if (ddrawsink->primary_surface) {
-    if (IDirectDrawSurface7_IsLost (ddrawsink->primary_surface) == DD_OK) {
-      /* no problem with our primary surface */
-      return TRUE;
-    } else {
-      /* our primary surface was lost, try to restore it */
-      if (IDirectDrawSurface7_Restore (ddrawsink->primary_surface) == DD_OK) {
-        /* restore is done */
-        GST_CAT_LOG_OBJECT (directdrawsink_debug, ddrawsink,
-            "Our primary surface" " was restored after lost");
-        return TRUE;
-      } else {
-        /* failed to restore our primary surface, 
-         * probably because the display mode was changed. 
-         * Release this surface and recreate a new one.
-         */
-        GST_CAT_LOG_OBJECT (directdrawsink_debug, ddrawsink,
-            "Our primary surface"
-            " was lost and display mode has changed. Destroy and recreate our surface.");
-        IDirectDrawSurface7_Release (ddrawsink->primary_surface);
-        ddrawsink->primary_surface = NULL;
-
-        /* also release offscreen surface */
-        IDirectDrawSurface7_Release (ddrawsink->offscreen_surface);
-        ddrawsink->offscreen_surface = NULL;
-      }
-    }
-  }
-
-  /* create our primary surface */
-  memset (&dd_surface_desc, 0, sizeof (dd_surface_desc));
-  dd_surface_desc.dwSize = sizeof (dd_surface_desc);
-  dd_surface_desc.dwFlags = DDSD_CAPS;
-  dd_surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-  sd = &dd_surface_desc;
-  hres =
-      IDirectDraw7_CreateSurface (ddrawsink->ddraw_object, (DDSURFACEDESC *) sd,
-      &ddrawsink->primary_surface, NULL);
-  if (hres != DD_OK) {
-    GST_ELEMENT_ERROR (ddrawsink, RESOURCE, WRITE,
-        ("Failed to create our primary surface error=%s", DDErrorString (hres)),
-        (NULL));
-    return FALSE;
-  }
-
-  /* attach our clipper object to the new primary surface */
-  if (ddrawsink->clipper) {
-    hres = IDirectDrawSurface7_SetClipper (ddrawsink->primary_surface,
-        ddrawsink->clipper);
-  }
-
-  return TRUE;
-}
-
-static gboolean
-gst_directdraw_sink_check_offscreen_surface (GstDirectDrawSink * ddrawsink)
-{
-  DDSURFACEDESC2 dd_surface_desc;
-  DDSURFACEDESC2 *sd;
-  HRESULT hres;
-
-  /* if our offscreen surface already exist, check if it's not lost */
-  if (ddrawsink->offscreen_surface) {
-    if (IDirectDrawSurface7_IsLost (ddrawsink->offscreen_surface) == DD_OK) {
-      /* no problem with our offscreen surface */
-      return TRUE;
-    } else {
-      /* our offscreen surface was lost, try to restore it */
-      if (IDirectDrawSurface7_Restore (ddrawsink->offscreen_surface) == DD_OK) {
-        /* restore is done */
-        GST_CAT_LOG_OBJECT (directdrawsink_debug, ddrawsink,
-            "Our offscreen surface" " was restored after lost");
-        return TRUE;
-      } else {
-        /* failed to restore our offscreen surface, 
-         * probably because the display mode was changed. 
-         * Release this surface and recreate a new one.
-         */
-        GST_CAT_LOG_OBJECT (directdrawsink_debug, ddrawsink,
-            "Our offscreen surface"
-            " was lost and display mode has changed. Destroy and recreate our surface.");
-        IDirectDrawSurface7_Release (ddrawsink->offscreen_surface);
-        ddrawsink->offscreen_surface = NULL;
-      }
-    }
-  }
-
-  memset (&dd_surface_desc, 0, sizeof (dd_surface_desc));
-  dd_surface_desc.dwSize = sizeof (dd_surface_desc);
-  dd_surface_desc.dwFlags =
-      DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
-  dd_surface_desc.dwHeight = ddrawsink->video_height;
-  dd_surface_desc.dwWidth = ddrawsink->video_width;
-  memcpy (&(dd_surface_desc.ddpfPixelFormat), &ddrawsink->dd_pixel_format,
-      sizeof (DDPIXELFORMAT));
-
-  dd_surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
-  sd = &dd_surface_desc;
-  hres =
-      IDirectDraw7_CreateSurface (ddrawsink->ddraw_object, (DDSURFACEDESC *) sd,
-      &ddrawsink->offscreen_surface, NULL);
-  if (hres != DD_OK) {
-    GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-        "create_ddraw_surface:CreateSurface (offscreen surface for buffer_pool) failed %s",
-        DDErrorString (hres));
-    return FALSE;
-  }
-
-  ddrawsink->must_recreate_offscreen = FALSE;
-
-  return TRUE;
-}
-
-static int
-gst_directdraw_sink_get_depth (LPDDPIXELFORMAT lpddpfPixelFormat)
-{
-  gint order = 0, binary;
-
-  binary =
-      lpddpfPixelFormat->
-      dwRBitMask | lpddpfPixelFormat->dwGBitMask | lpddpfPixelFormat->
-      dwBBitMask | lpddpfPixelFormat->dwRGBAlphaBitMask;
-  while (binary != 0) {
-    if ((binary % 2) == 1)
-      order++;
-    binary = binary >> 1;
-  }
-  return order;
-}
-
-static HRESULT WINAPI
-EnumModesCallback2 (LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext)
-{
-  GstDirectDrawSink *ddrawsink = (GstDirectDrawSink *) lpContext;
-  GstCaps *format_caps = NULL;
-  LPDDSURFACEDESC2 sd;
-
-  if (!ddrawsink || !lpDDSurfaceDesc)
-    return DDENUMRET_CANCEL;
-
-  sd = (LPDDSURFACEDESC2) lpDDSurfaceDesc;
-  if ((sd->dwFlags & DDSD_PIXELFORMAT) != DDSD_PIXELFORMAT) {
-    GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-        "Display mode found with DDSD_PIXELFORMAT not set");
-    return DDENUMRET_OK;
-  }
-
-  if ((sd->ddpfPixelFormat.dwFlags & DDPF_RGB) != DDPF_RGB)
-    return DDENUMRET_OK;
-
-  format_caps = gst_directdraw_sink_create_caps_from_surfacedesc (sd);
-
-  if (format_caps) {
-    gst_caps_append (ddrawsink->caps, format_caps);
-  }
-
-  return DDENUMRET_OK;
-}
-
-static GstCaps *
-gst_directdraw_sink_create_caps_from_surfacedesc (LPDDSURFACEDESC2 desc)
-{
-  GstCaps *caps = NULL;
-  gint endianness = G_LITTLE_ENDIAN;
-  gint depth;
-
-  if ((desc->ddpfPixelFormat.dwFlags & DDPF_RGB) != DDPF_RGB)
-    return NULL;
-
-  depth = gst_directdraw_sink_get_depth (&desc->ddpfPixelFormat);
-
-  if (desc->ddpfPixelFormat.dwRGBBitCount == 24 ||
-      desc->ddpfPixelFormat.dwRGBBitCount == 32) {
-    /* ffmpegcolorspace handles 24/32 bpp RGB as big-endian. */
-    endianness = G_BIG_ENDIAN;
-    desc->ddpfPixelFormat.dwRBitMask =
-        GUINT32_TO_BE (desc->ddpfPixelFormat.dwRBitMask);
-    desc->ddpfPixelFormat.dwGBitMask =
-        GUINT32_TO_BE (desc->ddpfPixelFormat.dwGBitMask);
-    desc->ddpfPixelFormat.dwBBitMask =
-        GUINT32_TO_BE (desc->ddpfPixelFormat.dwBBitMask);
-    if (desc->ddpfPixelFormat.dwRGBBitCount == 24) {
-      desc->ddpfPixelFormat.dwRBitMask >>= 8;
-      desc->ddpfPixelFormat.dwGBitMask >>= 8;
-      desc->ddpfPixelFormat.dwBBitMask >>= 8;
-    }
-  }
-
-  caps = gst_caps_new_simple ("video/x-raw-rgb",
-      "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,
-      "bpp", G_TYPE_INT, desc->ddpfPixelFormat.dwRGBBitCount,
-      "depth", G_TYPE_INT, depth,
-      "endianness", G_TYPE_INT, endianness,
-      "red_mask", G_TYPE_INT, desc->ddpfPixelFormat.dwRBitMask,
-      "green_mask", G_TYPE_INT, desc->ddpfPixelFormat.dwGBitMask,
-      "blue_mask", G_TYPE_INT, desc->ddpfPixelFormat.dwBBitMask, NULL);
-
-  return caps;
-}
-
-static GstCaps *
-gst_directdraw_sink_get_ddrawcaps (GstDirectDrawSink * ddrawsink)
-{
-  HRESULT hRes = S_OK;
-  DDCAPS ddcaps_hardware;
-  DDCAPS ddcaps_emulation;
-  GstCaps *format_caps = NULL;
-
-  ddrawsink->caps = gst_caps_new_empty ();
-  if (!ddrawsink->caps)
-    return FALSE;
-
-  /* get hardware caps */
-  ddcaps_hardware.dwSize = sizeof (DDCAPS);
-  ddcaps_emulation.dwSize = sizeof (DDCAPS);
-  IDirectDraw7_GetCaps (ddrawsink->ddraw_object, &ddcaps_hardware,
-      &ddcaps_emulation);
-
-  /* we don't test for DDCAPS_BLTSTRETCH on the hardware as the directdraw 
-   * emulation layer can do it */
-  if (!(ddcaps_hardware.dwCaps & DDCAPS_BLTFOURCC)) {
-    DDSURFACEDESC2 surface_desc;
-    DDSURFACEDESC2 *sd;
-
-    GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-        "hardware doesn't support blit from one colorspace to another one. "
-        "so we will create a caps with only the current display mode");
-
-    /* save blit caps */
-    ddrawsink->can_blit_between_colorspace = FALSE;
-
-    surface_desc.dwSize = sizeof (surface_desc);
-    sd = &surface_desc;
-    hRes =
-        IDirectDraw7_GetDisplayMode (ddrawsink->ddraw_object,
-        (DDSURFACEDESC *) sd);
-    if (hRes != DD_OK) {
-      GST_ELEMENT_ERROR (ddrawsink, CORE, NEGOTIATION,
-          ("Error getting the current display mode error=%s",
-              DDErrorString (hRes)), (NULL));
-      return NULL;
-    }
-
-    format_caps =
-        gst_directdraw_sink_create_caps_from_surfacedesc (&surface_desc);
-    if (format_caps) {
-      gst_caps_append (ddrawsink->caps, format_caps);
-    }
-
-    GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink, "returning caps %s",
-        gst_caps_to_string (ddrawsink->caps));
-    return ddrawsink->caps;
-  }
-
-  GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-      "the hardware can blit from one colorspace to another, "
-      "then enumerate the colorspace supported by the hardware");
-
-  /* save blit caps */
-  ddrawsink->can_blit_between_colorspace = TRUE;
-
-  /* enumerate display modes exposed by directdraw object 
-     to know supported RGB modes */
-  hRes =
-      IDirectDraw7_EnumDisplayModes (ddrawsink->ddraw_object,
-      DDEDM_REFRESHRATES, NULL, ddrawsink, EnumModesCallback2);
-  if (hRes != DD_OK) {
-    GST_ELEMENT_ERROR (ddrawsink, CORE, NEGOTIATION,
-        ("Error enumerating display modes error=%s", DDErrorString (hRes)),
-        (NULL));
-
-    return NULL;
-  }
-
-  if (gst_caps_is_empty (ddrawsink->caps)) {
-    gst_caps_unref (ddrawsink->caps);
-    ddrawsink->caps = NULL;
-    GST_ELEMENT_ERROR (ddrawsink, CORE, NEGOTIATION,
-        ("No supported caps found."), (NULL));
-    return NULL;
-  }
-
-  /*GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink, "returning caps %s",
-   * gst_caps_to_string (ddrawsink->caps)); */
-
-  return ddrawsink->caps;
-}
-
-/* Creates miniobject and our internal surface */
-static GstDDrawSurface *
-gst_directdraw_sink_surface_create (GstDirectDrawSink * ddrawsink,
-    GstCaps * caps, size_t size)
-{
-  GstDDrawSurface *surface = NULL;
-  GstStructure *structure = NULL;
-  gint pitch;
-
-#if 0
-  HRESULT hRes;
-#endif
-  DDSURFACEDESC2 surf_desc, surf_lock_desc;
-
-  g_return_val_if_fail (GST_IS_DIRECTDRAW_SINK (ddrawsink), NULL);
-
-  /*init structures */
-  memset (&surf_desc, 0, sizeof (surf_desc));
-  memset (&surf_lock_desc, 0, sizeof (surf_desc));
-  surf_desc.dwSize = sizeof (surf_desc);
-  surf_lock_desc.dwSize = sizeof (surf_lock_desc);
-
-  /*create miniobject and initialize it */
-  surface = (GstDDrawSurface *) gst_mini_object_new (GST_TYPE_DDRAWSURFACE);
-  surface->locked = FALSE;
-
-  structure = gst_caps_get_structure (caps, 0);
-  if (!gst_structure_get_int (structure, "width", &surface->width) ||
-      !gst_structure_get_int (structure, "height", &surface->height)) {
-    GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-        "failed getting geometry from caps %" GST_PTR_FORMAT, caps);
-  }
-
-  pitch = GST_ROUND_UP_8 (size / surface->height);
-  if (!gst_ddrawvideosink_get_format_from_caps (ddrawsink, caps,
-          &surface->dd_pixel_format)) {
-    GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
-        "failed getting pixel format from caps %" GST_PTR_FORMAT, caps);
-  }
-
-  /* disable return of directdraw surface to buffer alloc because actually I
-   * have no solution to handle display mode changes. The problem is that when
-   * the display mode is changed surface's memory is freed then the upstream
-   * filter would crash trying to write to this memory. Directdraw has a system
-   * lock (DDLOCK_NOSYSLOCK to disable it) to prevent display mode changes 
-   * when a surface memory is locked but we need to disable this lock to return
-   * multiple buffers (surfaces) and do not lock directdraw API calls.
-   */
-#if 0
-/*  if (ddrawsink->ddraw_object) {*/
-  /* Creating an internal surface which will be used as GstBuffer, we used
-     the detected pixel format and video dimensions */
-
-  surf_desc.ddsCaps.dwCaps =
-      DDSCAPS_OFFSCREENPLAIN /* | DDSCAPS_SYSTEMMEMORY */ ;
-  surf_desc.dwFlags =
-      DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_PITCH;
-  surf_desc.dwHeight = surface->height;
-  surf_desc.dwWidth = surface->width;
-  memcpy (&(surf_desc.ddpfPixelFormat), &surface->dd_pixel_format,
-      sizeof (DDPIXELFORMAT));
-
-  hRes = IDirectDraw7_CreateSurface (ddrawsink->ddraw_object, &surf_desc,
-      &surface->surface, NULL);
-  if (hRes != DD_OK) {
-    goto surface_pitch_bad;
-  }
-
-  /* Locking the surface to acquire the memory pointer.
-     Use DDLOCK_NOSYSLOCK to disable syslock which can cause a deadlock 
-     if directdraw api is used while a buffer is lock */
-lock:
-  hRes = IDirectDrawSurface7_Lock (surface->surface, NULL, &surf_lock_desc,
-      DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL);
-  if (hRes == DDERR_SURFACELOST) {
-    IDirectDrawSurface7_Restore (surface->surface);
-    goto lock;
-  }
-  surface->locked = TRUE;
-
-  if (surf_lock_desc.lPitch != pitch) {
-    GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-        "DDraw stride/pitch %ld isn't as expected value %d, let's continue allocating a system memory buffer.",
-        surf_lock_desc.lPitch, pitch);
-
-    /*Unlock the surface as we will change it to use system memory with a GStreamer compatible pitch */
-    hRes = IDirectDrawSurface_Unlock (surface->surface, NULL);
-    goto surface_pitch_bad;
-  }
-  GST_BUFFER_DATA (surface) = surf_lock_desc.lpSurface;
-  GST_BUFFER_SIZE (surface) = surf_lock_desc.lPitch * surface->height;
-  GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-      "allocating a surface of %d bytes (stride=%ld)\n", size,
-      surf_lock_desc.lPitch);
-
-surface_pitch_bad:
-#else
-  GST_BUFFER (surface)->malloc_data = g_malloc (size);
-  GST_BUFFER_DATA (surface) = GST_BUFFER (surface)->malloc_data;
-  GST_BUFFER_SIZE (surface) = size;
-  surface->surface = NULL;
-  GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
-      "allocating a system memory buffer of %" G_GSIZE_FORMAT " bytes", size);
-
-#endif
-
-  /* Keep a ref to our sink */
-  surface->ddrawsink = gst_object_ref (ddrawsink);
-
-  return surface;
-}
-
-/* We are called from the finalize method of miniobject, the object will be
- * destroyed so we just have to clean our internal stuff */
-static void
-gst_directdraw_sink_surface_destroy (GstDirectDrawSink * ddrawsink,
-    GstDDrawSurface * surface)
-{
-  g_return_if_fail (GST_IS_DIRECTDRAW_SINK (ddrawsink));
-
-  /* Release our internal surface */
-  if (surface->surface) {
-    if (surface->locked) {
-      IDirectDrawSurface7_Unlock (surface->surface, NULL);
-      surface->locked = FALSE;
-    }
-    IDirectDrawSurface7_Release (surface->surface);
-    surface->surface = NULL;
-  }
-
-  if (GST_BUFFER (surface)->malloc_data) {
-    g_free (GST_BUFFER (surface)->malloc_data);
-    GST_BUFFER (surface)->malloc_data = NULL;
-  }
-
-  if (!surface->ddrawsink) {
-    goto no_sink;
-  }
-
-  /* Release the ref to our sink */
-  surface->ddrawsink = NULL;
-  gst_object_unref (ddrawsink);
-
-  return;
-
-no_sink:
-  GST_WARNING ("no sink found in surface");
-  return;
-}
-
-static gboolean
-gst_directdraw_sink_surface_check (GstDirectDrawSink * ddrawsink,
-    GstDDrawSurface * surface)
-{
-  if (!surface->surface)
-    return TRUE;                /* system memory buffer */
-
-  if (IDirectDrawSurface7_IsLost (surface->surface) == DD_OK) {
-    /* no problem with this surface */
-    return TRUE;
-  } else {
-    /* this surface was lost, try to restore it */
-    if (IDirectDrawSurface7_Restore (ddrawsink->offscreen_surface) == DD_OK) {
-      /* restore is done */
-      GST_CAT_LOG_OBJECT (directdrawsink_debug, ddrawsink, "A surface from our"
-          " bufferpool was restored after lost");
-      return TRUE;
-    }
-  }
-
-  return FALSE;
-}
-
-static void
-gst_directdraw_sink_bufferpool_clear (GstDirectDrawSink * ddrawsink)
-{
-  g_mutex_lock (ddrawsink->pool_lock);
-  while (ddrawsink->buffer_pool) {
-    GstDDrawSurface *surface = ddrawsink->buffer_pool->data;
-
-    ddrawsink->buffer_pool = g_slist_delete_link (ddrawsink->buffer_pool,
-        ddrawsink->buffer_pool);
-    gst_directdraw_sink_surface_destroy (ddrawsink, surface);
-    gst_buffer_unref (GST_BUFFER_CAST (surface));
-  }
-  g_mutex_unlock (ddrawsink->pool_lock);
-}
-
-static void
-gst_directdraw_sink_cleanup (GstDirectDrawSink * ddrawsink)
-{
-  /* Post quit message and wait for our event window thread */
-  if (ddrawsink->video_window && ddrawsink->our_video_window)
-    PostMessage (ddrawsink->video_window, WM_QUIT, 0, 0);
-
-  if (ddrawsink->window_thread) {
-    g_thread_join (ddrawsink->window_thread);
-    ddrawsink->window_thread = NULL;
-  }
-
-  if (ddrawsink->buffer_pool) {
-    gst_directdraw_sink_bufferpool_clear (ddrawsink);
-    ddrawsink->buffer_pool = NULL;
-  }
-
-  if (ddrawsink->offscreen_surface) {
-    IDirectDrawSurface7_Release (ddrawsink->offscreen_surface);
-    ddrawsink->offscreen_surface = NULL;
-  }
-
-  if (ddrawsink->clipper) {
-    IDirectDrawClipper_Release (ddrawsink->clipper);
-    ddrawsink->clipper = NULL;
-  }
-
-  if (ddrawsink->primary_surface) {
-    IDirectDrawSurface7_Release (ddrawsink->primary_surface);
-    ddrawsink->primary_surface = NULL;
-  }
-
-  if (ddrawsink->ddraw_object) {
-    IDirectDraw7_Release (ddrawsink->ddraw_object);
-    ddrawsink->ddraw_object = NULL;
-  }
-
-  if (ddrawsink->last_buffer) {
-    gst_buffer_unref (ddrawsink->last_buffer);
-    ddrawsink->last_buffer = NULL;
-  }
-
-  ddrawsink->setup = FALSE;
-}
diff --git a/sys/directdraw/gstdirectdrawsink.h b/sys/directdraw/gstdirectdrawsink.h
deleted file mode 100644
index dbd419b..0000000
--- a/sys/directdraw/gstdirectdrawsink.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Sebastien Moutte <sebastien@moutte.net>
- * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * The development of this code was made possible due to the involvement
- * of Pioneers of the Inevitable, the creators of the Songbird Music player
- *
- */
-
-#ifndef __GST_DIRECTDRAWSINK_H__
-#define __GST_DIRECTDRAWSINK_H__
-
-#define DIRECTDRAW_VERSION 0x0700
-
-#include <gst/gst.h>
-#include <gst/video/gstvideosink.h>
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/navigation.h>
-
-#include <windows.h>
-#include <ddraw.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_DIRECTDRAW_SINK            (gst_directdraw_sink_get_type())
-#define GST_DIRECTDRAW_SINK(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRECTDRAW_SINK,GstDirectDrawSink))
-#define GST_DIRECTDRAW_SINK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRECTDRAW_SINK,GstDirectDrawSinkClass))
-#define GST_IS_DIRECTDRAW_SINK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRECTDRAW_SINK))
-#define GST_IS_DIRECTDRAW_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRECTDRAW_SINK))
-typedef struct _GstDirectDrawSink GstDirectDrawSink;
-typedef struct _GstDirectDrawSinkClass GstDirectDrawSinkClass;
-
-#define GST_TYPE_DDRAWSURFACE (gst_ddrawsurface_get_type())
-#define GST_IS_DDRAWSURFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DDRAWSURFACE))
-#define GST_DDRAWSURFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DDRAWSURFACE, GstDDrawSurface))
-
-typedef struct _GstDDrawSurface GstDDrawSurface;
-
-struct _GstDDrawSurface
-{
-  /* Extension of GstBuffer to store directdraw surfaces */
-  GstBuffer buffer;
-
-  /* directdraw surface */
-  LPDIRECTDRAWSURFACE surface;
-
-  /* surface dimensions */
-  gint width;
-  gint height;
-
-  /*TRUE when surface is locked*/
-  gboolean locked;
-
-  /*TRUE when surface is using a system memory buffer 
-  (i'm using system memory when directdraw optimized pitch is not the same as the GStreamer one)*/
-  gboolean system_memory;
-
-  /* pixel format of the encapsulated surface */
-  DDPIXELFORMAT dd_pixel_format;
-
-  /* pointer to parent */
-  GstDirectDrawSink *ddrawsink;
-};
-
-struct _GstDirectDrawSink
-{
-  GstVideoSink videosink;
-
-  /* directdraw offscreen surfaces pool */
-  GSList *buffer_pool;
-  GMutex *pool_lock;
-
-  /* directdraw objects */
-  LPDIRECTDRAW ddraw_object;
-  LPDIRECTDRAWSURFACE primary_surface;
-  LPDIRECTDRAWSURFACE offscreen_surface;
-  LPDIRECTDRAWCLIPPER clipper; 
-
-  /* last buffer displayed (used for XOverlay interface expose method) */
-  GstBuffer * last_buffer;
-
-  /* directdraw caps */
-  GstCaps *caps;
-
-  /* video window management */
-  HWND video_window;
-  gboolean our_video_window;
-  HANDLE window_created_signal;
-  WNDPROC previous_wndproc;
-  LONG_PTR previous_user_data;
-  
-  /* video properties */
-  gint video_width, video_height;
-  gint out_width, out_height;
-  gint fps_n;
-  gint fps_d;
-
-  /* properties */
-  gboolean keep_aspect_ratio;
-
-  /*pixel format */
-  DDPIXELFORMAT dd_pixel_format;
-
-  /* thread processing our default window messages */
-  GThread *window_thread;
-
-  /* TRUE when directdraw object is set up */
-  gboolean setup;
-
-  /* TRUE if the hardware supports blitting from one colorspace to another */
-  gboolean can_blit_between_colorspace;
-
-  /* This flag is used to force re-creation of our offscreen surface.
-   * It's needed when hardware doesn't support fourcc blit and the bit depth
-   * of the current display mode changes.
-   */
-  gboolean must_recreate_offscreen;
-};
-
-struct _GstDirectDrawSinkClass
-{
-  GstVideoSinkClass parent_class;
-};
-
-GType gst_directdraw_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_DIRECTDRAWSINK_H__ */
diff --git a/sys/directsound/Makefile.in b/sys/directsound/Makefile.in
index aa0e823..e2bb5d4 100644
--- a/sys/directsound/Makefile.in
+++ b/sys/directsound/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/dshowdecwrapper/Makefile.in b/sys/dshowdecwrapper/Makefile.in
index 36c9b9a..ec9a7e2 100644
--- a/sys/dshowdecwrapper/Makefile.in
+++ b/sys/dshowdecwrapper/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -250,8 +250,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -290,7 +294,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -298,6 +301,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -347,8 +352,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -427,7 +430,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -436,7 +438,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -449,7 +450,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -474,6 +474,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -547,10 +549,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -576,6 +582,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -612,6 +621,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -652,17 +662,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -679,6 +688,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/dshowdecwrapper/gstdshowaudiodec.cpp b/sys/dshowdecwrapper/gstdshowaudiodec.cpp
index f42b03a..caebec5 100644
--- a/sys/dshowdecwrapper/gstdshowaudiodec.cpp
+++ b/sys/dshowdecwrapper/gstdshowaudiodec.cpp
@@ -51,12 +51,13 @@
 #include <mmreg.h>
 #include <dmoreg.h>
 #include <wmcodecdsp.h>
+#include <gst/audio/audio.h>
 
 GST_DEBUG_CATEGORY_STATIC (dshowaudiodec_debug);
 #define GST_CAT_DEFAULT dshowaudiodec_debug
 
-GST_BOILERPLATE (GstDshowAudioDec, gst_dshowaudiodec, GstElement,
-    GST_TYPE_ELEMENT);
+#define gst_dshowaudiodec_parent_class parent_class
+G_DEFINE_TYPE(GstDshowAudioDec, gst_dshowaudiodec, GST_TYPE_ELEMENT)
 
 static void gst_dshowaudiodec_finalize (GObject * object);
 static GstStateChangeReturn gst_dshowaudiodec_change_state
@@ -64,8 +65,8 @@
 
 /* sink pad overwrites */
 static gboolean gst_dshowaudiodec_sink_setcaps (GstPad * pad, GstCaps * caps);
-static GstFlowReturn gst_dshowaudiodec_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_dshowaudiodec_sink_event (GstPad * pad, GstEvent * event);
+static GstFlowReturn gst_dshowaudiodec_chain (GstPad * pad, GstObject *parent, GstBuffer * buffer);
+static gboolean gst_dshowaudiodec_sink_event (GstPad * pad, GstObject *parent, GstEvent * event);
 
 /* utils */
 static gboolean gst_dshowaudiodec_create_graph_and_filters (GstDshowAudioDec *
@@ -158,7 +159,7 @@
   GstBuffer *out_buf = NULL;
   gboolean in_seg = FALSE;
   GstClockTime buf_start, buf_stop;
-  gint64 clip_start = 0, clip_stop = 0;
+  guint64 clip_start = 0, clip_stop = 0;
   guint start_offset = 0, stop_offset;
   GstClockTime duration;
 
@@ -199,20 +200,21 @@
      * GstBuffer for output, and clip if required */
 
     /* allocate a new buffer for raw audio */
-    mDec->last_ret = gst_pad_alloc_buffer (mDec->srcpad, 
-        GST_BUFFER_OFFSET_NONE,
-        size,
-        GST_PAD_CAPS (mDec->srcpad), &out_buf);
+    out_buf = gst_buffer_new_and_alloc(size);
     if (!out_buf) {
       GST_WARNING_OBJECT (mDec, "cannot allocate a new GstBuffer");
       goto done;
     }
-
+    
     /* set buffer properties */
     GST_BUFFER_TIMESTAMP (out_buf) = buf_start;
     GST_BUFFER_DURATION (out_buf) = duration;
-    memcpy (GST_BUFFER_DATA (out_buf), pBuffer,
-        MIN ((unsigned int)size, GST_BUFFER_SIZE (out_buf)));
+
+    if (gst_buffer_fill(out_buf, 0, pBuffer, size) != size) {
+      gst_buffer_unref (out_buf);
+      GST_WARNING_OBJECT (mDec, "unable to fill output buffer");
+      goto done;
+    }
 
     /* we have to remove some heading samples */
     if ((GstClockTime) clip_start > buf_start) {
@@ -231,11 +233,11 @@
 
     /* truncating */
     if ((start_offset != 0) || (stop_offset != (size_t) size)) {
-      GstBuffer *subbuf = gst_buffer_create_sub (out_buf, start_offset,
-          stop_offset - start_offset);
+      
+      GstBuffer *subbuf = gst_buffer_copy_region (out_buf, GST_BUFFER_COPY_ALL, 
+        start_offset, stop_offset - start_offset);
 
       if (subbuf) {
-        gst_buffer_set_caps (subbuf, GST_PAD_CAPS (mDec->srcpad));
         gst_buffer_unref (out_buf);
         out_buf = subbuf;
       }
@@ -305,6 +307,21 @@
   return S_FALSE;
 }
 
+int AudioFakeSink::GetBufferSize()
+{
+  IMemAllocator *allocator = NULL;
+  if (m_pInputPin) {
+    allocator = m_pInputPin->Allocator();
+    if(allocator) {
+      ALLOCATOR_PROPERTIES props;
+      allocator->GetProperties(&props);
+      return props.cbBuffer;
+    }
+  }
+
+  return 0;
+}
+
 static void
 gst_dshowaudiodec_base_init (gpointer klass)
 {
@@ -312,36 +329,34 @@
   GstPadTemplate *src, *sink;
   GstCaps *srccaps, *sinkcaps;
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-  GstElementDetails details;
   const AudioCodecEntry *tmp;
   gpointer qdata;
+  gchar *longname, *description;
 
   qdata = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), DSHOW_CODEC_QDATA);
 
   /* element details */
   tmp = audiodec_class->entry = (AudioCodecEntry *) qdata;
 
-  details.longname = g_strdup_printf ("DirectShow %s Decoder Wrapper",
+  longname = g_strdup_printf ("DirectShow %s Decoder Wrapper",
       tmp->element_longname);
-  details.klass = g_strdup ("Codec/Decoder/Audio");
-  details.description = g_strdup_printf ("DirectShow %s Decoder Wrapper",
+  description = g_strdup_printf ("DirectShow %s Decoder Wrapper",
       tmp->element_longname);
-  details.author = "Sebastien Moutte <sebastien@moutte.net>";
-  gst_element_class_set_details (element_class, &details);
-  g_free (details.longname);
-  g_free (details.klass);
-  g_free (details.description);
+
+  gst_element_class_set_metadata(element_class, longname, "Codec/Decoder/Audio", description, 
+    "Sebastien Moutte <sebastien@moutte.net>");
+  
+  g_free (longname);
+  g_free (description);
 
   sinkcaps = gst_caps_from_string (tmp->sinkcaps);
 
   srccaps = gst_caps_from_string (
-      "audio/x-raw-int,"
-      "width = (int)[1, 32],"
-      "depth = (int)[1, 32],"
+      "audio/x-raw,"
+      "format = (string)" GST_AUDIO_FORMATS_ALL ","
       "rate = (int)[1, MAX],"
       "channels = (int)[1, MAX],"
-      "signed = (boolean)true,"
-      "endianness = (int)" G_STRINGIFY(G_LITTLE_ENDIAN));
+      "layout = (string)interleaved");
 
   sink = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, sinkcaps);
   src = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
@@ -370,7 +385,7 @@
 {
   HRESULT res;
 
-  g_mutex_lock (adec->com_init_lock);
+  g_mutex_lock (&adec->com_init_lock);
 
   /* Initialize COM with a MTA for this process. This thread will
    * be the first one to enter the apartement and the last one to leave
@@ -387,24 +402,23 @@
   adec->comInitialized = TRUE;
 
   /* Signal other threads waiting on this condition that COM was initialized */
-  g_cond_signal (adec->com_initialized);
+  g_cond_signal (&adec->com_initialized);
 
-  g_mutex_unlock (adec->com_init_lock);
+  g_mutex_unlock (&adec->com_init_lock);
 
   /* Wait until the unitialize condition is met to leave the COM apartement */
-  g_mutex_lock (adec->com_deinit_lock);
-  g_cond_wait (adec->com_uninitialize, adec->com_deinit_lock);
+  g_mutex_lock (&adec->com_deinit_lock);
+  g_cond_wait (&adec->com_uninitialize, &adec->com_deinit_lock);
 
   CoUninitialize ();
   GST_INFO_OBJECT (adec, "COM unintialized succesfully");
   adec->comInitialized = FALSE;
-  g_cond_signal (adec->com_uninitialized);
-  g_mutex_unlock (adec->com_deinit_lock);
+  g_cond_signal (&adec->com_uninitialized);
+  g_mutex_unlock (&adec->com_deinit_lock);
 }
 
 static void
-gst_dshowaudiodec_init (GstDshowAudioDec * adec,
-    GstDshowAudioDecClass * adec_class)
+gst_dshowaudiodec_init (GstDshowAudioDec * adec)
 {
   GstElementClass *element_class = GST_ELEMENT_GET_CLASS (adec);
 
@@ -413,7 +427,6 @@
       gst_pad_new_from_template (gst_element_class_get_pad_template
       (element_class, "sink"), "sink");
 
-  gst_pad_set_setcaps_function (adec->sinkpad, gst_dshowaudiodec_sink_setcaps);
   gst_pad_set_event_function (adec->sinkpad, gst_dshowaudiodec_sink_event);
   gst_pad_set_chain_function (adec->sinkpad, gst_dshowaudiodec_chain);
   gst_element_add_pad (GST_ELEMENT (adec), adec->sinkpad);
@@ -443,21 +456,21 @@
 
   adec->last_ret = GST_FLOW_OK;
 
-  adec->com_init_lock = g_mutex_new();
-  adec->com_deinit_lock = g_mutex_new();
-  adec->com_initialized = g_cond_new();
-  adec->com_uninitialize = g_cond_new();
-  adec->com_uninitialized = g_cond_new();
+  g_mutex_init(&adec->com_init_lock);
+  g_mutex_init(&adec->com_deinit_lock);
+  g_cond_init(&adec->com_initialized);
+  g_cond_init(&adec->com_uninitialize);
+  g_cond_init(&adec->com_uninitialized);
 
-  g_mutex_lock (adec->com_init_lock);
+  g_mutex_lock (&adec->com_init_lock);
 
   /* create the COM initialization thread */
-  g_thread_create ((GThreadFunc)gst_dshowaudiodec_com_thread,
-      adec, FALSE, NULL);
+  g_thread_new ("COM init thread", (GThreadFunc)gst_dshowaudiodec_com_thread, 
+    adec);
 
   /* wait until the COM thread signals that COM has been initialized */
-  g_cond_wait (adec->com_initialized, adec->com_init_lock);
-  g_mutex_unlock (adec->com_init_lock);
+  g_cond_wait (&adec->com_initialized, &adec->com_init_lock);
+  g_mutex_unlock (&adec->com_init_lock);
 }
 
 static void
@@ -477,17 +490,17 @@
 
   /* signal the COM thread that it sould uninitialize COM */
   if (adec->comInitialized) {
-    g_mutex_lock (adec->com_deinit_lock);
-    g_cond_signal (adec->com_uninitialize);
-    g_cond_wait (adec->com_uninitialized, adec->com_deinit_lock);
-    g_mutex_unlock (adec->com_deinit_lock);
+    g_mutex_lock (&adec->com_deinit_lock);
+    g_cond_signal (&adec->com_uninitialize);
+    g_cond_wait (&adec->com_uninitialized, &adec->com_deinit_lock);
+    g_mutex_unlock (&adec->com_deinit_lock);
   }
 
-  g_mutex_free (adec->com_init_lock);
-  g_mutex_free (adec->com_deinit_lock);
-  g_cond_free (adec->com_initialized);
-  g_cond_free (adec->com_uninitialize);
-  g_cond_free (adec->com_uninitialized);
+  g_mutex_clear (&adec->com_init_lock);
+  g_mutex_clear (&adec->com_deinit_lock);
+  g_cond_clear (&adec->com_initialized);
+  g_cond_clear (&adec->com_uninitialize);
+  g_cond_clear (&adec->com_uninitialized);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -529,7 +542,7 @@
       break;
   }
 
-  return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  return GST_ELEMENT_CLASS(parent_class)->change_state (element, transition);
 }
 
 static gboolean
@@ -571,9 +584,10 @@
 }
 
 static GstFlowReturn
-gst_dshowaudiodec_chain (GstPad * pad, GstBuffer * buffer)
+gst_dshowaudiodec_chain (GstPad *pad, GstObject *parent, GstBuffer *buffer)
 {
   GstDshowAudioDec *adec = (GstDshowAudioDec *) gst_pad_get_parent (pad);
+  GstMapInfo map;
   bool discont = FALSE;
 
   if (!adec->setup) {
@@ -583,7 +597,7 @@
     goto beach;
   }
 
-  if (GST_FLOW_IS_FATAL (adec->last_ret)) {
+  if (adec->last_ret != GST_FLOW_OK) {
     GST_DEBUG_OBJECT (adec, "last decoding iteration generated a fatal error "
         "%s", gst_flow_get_name (adec->last_ret));
     goto beach;
@@ -591,7 +605,7 @@
 
   GST_CAT_DEBUG_OBJECT (dshowaudiodec_debug, adec, "chain (size %d)=> pts %"
       GST_TIME_FORMAT " stop %" GST_TIME_FORMAT,
-      GST_BUFFER_SIZE (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
+      gst_buffer_get_size(buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer) +
           GST_BUFFER_DURATION (buffer)));
 
@@ -605,10 +619,12 @@
   }
 
   /* push the buffer to the directshow decoder */
+  gst_buffer_map(buffer, &map, GST_MAP_READ);
   adec->fakesrc->GetOutputPin()->PushBuffer (
-      GST_BUFFER_DATA (buffer), GST_BUFFER_TIMESTAMP (buffer),
+      map.data, GST_BUFFER_TIMESTAMP (buffer),
       GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer),
-      GST_BUFFER_SIZE (buffer), (bool)discont);
+      map.size, (bool)discont);
+  gst_buffer_unmap(buffer, &map);
 
 beach:
   gst_buffer_unref (buffer);
@@ -617,51 +633,45 @@
 }
 
 static gboolean
-gst_dshowaudiodec_sink_event (GstPad * pad, GstEvent * event)
+gst_dshowaudiodec_sink_event (GstPad * pad, GstObject *parent, GstEvent * event)
 {
   gboolean ret = TRUE;
-  GstDshowAudioDec *adec = (GstDshowAudioDec *) gst_pad_get_parent (pad);
+  GstDshowAudioDec *adec = (GstDshowAudioDec *) parent;
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_FLUSH_STOP:{
-      gst_dshowaudiodec_flush (adec);
-      ret = gst_pad_event_default (pad, event);
+    case GST_EVENT_CAPS:{
+      GstCaps *caps;
+      gst_event_parse_caps(event, &caps);
+      ret = gst_dshowaudiodec_sink_setcaps(pad, caps);
       break;
     }
-    case GST_EVENT_NEWSEGMENT:
-    {
-      GstFormat format;
-      gdouble rate;
-      gint64 start, stop, time;
-      gboolean update;
 
-      gst_event_parse_new_segment (event, &update, &rate, &format, &start,
-          &stop, &time);
+    case GST_EVENT_FLUSH_STOP:{
+      gst_dshowaudiodec_flush (adec);
+      ret = gst_pad_event_default (pad, parent, event);
+      break;
+    }
+
+    case GST_EVENT_SEGMENT:{
+      const GstSegment *segment;
+      gst_event_parse_segment (event, &segment);
 
       GST_CAT_DEBUG_OBJECT (dshowaudiodec_debug, adec,
           "received new segment from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
-          GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
-
-      if (update) {
-        GST_CAT_DEBUG_OBJECT (dshowaudiodec_debug, adec,
-            "closing current segment flushing..");
-        gst_dshowaudiodec_flush (adec);
-      }
+          GST_TIME_ARGS (segment->start), GST_TIME_ARGS (segment->stop));
 
       /* save the new segment in our local current segment */
-      gst_segment_set_newsegment (adec->segment, update, rate, format, start,
-          stop, time);
+      gst_segment_copy_into(segment, adec->segment);
 
-      ret = gst_pad_event_default (pad, event);
+      ret = gst_pad_event_default (pad, parent, event);
       break;
     }
+
     default:
-      ret = gst_pad_event_default (pad, event);
+      ret = gst_pad_event_default (pad, parent, event);
       break;
   }
 
-  gst_object_unref (adec);
-
   return ret;
 }
 
@@ -757,7 +767,7 @@
   else 
   {
     size = sizeof (WAVEFORMATEX) +
-        (adec->codec_data ? GST_BUFFER_SIZE (adec->codec_data) : 0);
+        (adec->codec_data ? gst_buffer_get_size(adec->codec_data) : 0);
 
     if (adec->layer == 3) {
       MPEGLAYER3WAVEFORMAT *mp3format;
@@ -783,11 +793,12 @@
     }
     else {
       format = (WAVEFORMATEX *)g_malloc0 (size);
+
       if (adec->codec_data) {     /* Codec data is appended after our header */
-        memcpy (((guchar *) format) + sizeof (WAVEFORMATEX),
-            GST_BUFFER_DATA (adec->codec_data),
-            GST_BUFFER_SIZE (adec->codec_data));
-        format->cbSize = GST_BUFFER_SIZE (adec->codec_data);
+        gsize codec_size = gst_buffer_get_size(adec->codec_data);
+        gst_buffer_extract(adec->codec_data, 0, ((guchar *) format) + sizeof (WAVEFORMATEX), 
+          codec_size);
+        format->cbSize = codec_size;
       }
     }
 
@@ -855,14 +866,15 @@
   GstDshowAudioDecClass *klass =
       (GstDshowAudioDecClass *) G_OBJECT_GET_CLASS (adec);
   HRESULT hres;
-  GstCaps *outcaps;
+  GstCaps *outcaps = NULL;
   AM_MEDIA_TYPE *output_mediatype = NULL;
   AM_MEDIA_TYPE *input_mediatype = NULL;
-  CComPtr<IPin> output_pin;
-  CComPtr<IPin> input_pin;
+  IPinPtr output_pin = NULL;
+  IPinPtr input_pin = NULL;
   const AudioCodecEntry *codec_entry = klass->entry;
-  CComQIPtr<IBaseFilter> srcfilter;
-  CComQIPtr<IBaseFilter> sinkfilter;
+  IBaseFilterPtr srcfilter;
+  IBaseFilterPtr sinkfilter;
+  GstAudioInfo audio_info;
 
   input_mediatype = dshowaudiodec_set_input_format (adec, caps);
 
@@ -901,22 +913,18 @@
 
   adec->fakesink->SetMediaType(output_mediatype);
 
-  outcaps = gst_caps_new_simple ("audio/x-raw-int",
-      "width", G_TYPE_INT, adec->depth,
-      "depth", G_TYPE_INT, adec->depth,
-      "rate", G_TYPE_INT, adec->rate,
-      "channels", G_TYPE_INT, adec->channels, 
-      "signed", G_TYPE_BOOLEAN, TRUE,
-      "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
-      NULL);
+  gst_audio_info_init(&audio_info);
+  gst_audio_info_set_format(&audio_info, 
+    gst_audio_format_build_integer(TRUE, G_BYTE_ORDER, adec->depth, adec->depth),
+    adec->rate, adec->channels, NULL);
+
+  outcaps = gst_audio_info_to_caps(&audio_info);
 
   if (!gst_pad_set_caps (adec->srcpad, outcaps)) {
-    gst_caps_unref (outcaps);
     GST_ELEMENT_ERROR (adec, CORE, NEGOTIATION,
         ("Failed to negotiate output"), (NULL));
     goto end;
   }
-  gst_caps_unref (outcaps);
 
   /* connect the decoder to our fake sink */
   output_pin = gst_dshow_get_pin_from_filter (adec->decfilter, PINDIR_OUTPUT);
@@ -951,6 +959,8 @@
   ret = TRUE;
   adec->setup = TRUE;
 end:
+  if (outcaps)
+    gst_caps_unref(outcaps);
   if (input_mediatype)
     dshowadec_free_mediatype (input_mediatype);
   if (output_mediatype)
@@ -962,8 +972,8 @@
 static gboolean
 gst_dshowaudiodec_get_filter_settings (GstDshowAudioDec * adec)
 {
-  CComPtr<IPin> output_pin;
-  CComPtr<IEnumMediaTypes> enum_mediatypes;
+  IPinPtr output_pin;
+  IEnumMediaTypesPtr enum_mediatypes;
   HRESULT hres;
   ULONG fetched;
   BOOL ret = FALSE;
@@ -1008,13 +1018,13 @@
   HRESULT hres;
   GstDshowAudioDecClass *klass =
       (GstDshowAudioDecClass *) G_OBJECT_GET_CLASS (adec);
-  CComQIPtr<IBaseFilter> srcfilter;
-  CComQIPtr<IBaseFilter> sinkfilter;
+  IBaseFilterPtr srcfilter;
+  IBaseFilterPtr sinkfilter;
   GUID insubtype = GUID_MEDIASUBTYPE_FROM_FOURCC (klass->entry->format);
   GUID outsubtype = GUID_MEDIASUBTYPE_FROM_FOURCC (WAVE_FORMAT_PCM);
 
   /* create the filter graph manager object */
-  hres = adec->filtergraph.CoCreateInstance (
+  hres = adec->filtergraph.CreateInstance (
       CLSID_FilterGraph, NULL, CLSCTX_INPROC);
   if (FAILED (hres)) {
     GST_ELEMENT_ERROR (adec, STREAM, FAILED,
@@ -1102,7 +1112,7 @@
 
   if (adec->fakesrc) {
     if (adec->filtergraph) {
-      CComQIPtr<IBaseFilter> filter = adec->fakesrc;
+      IBaseFilterPtr filter = adec->fakesrc;
       adec->filtergraph->RemoveFilter(filter);
     }
     adec->fakesrc->Release();
@@ -1115,7 +1125,7 @@
   }
   if (adec->fakesink) {
     if (adec->filtergraph) {
-      CComQIPtr<IBaseFilter> filter = adec->fakesink;
+      IBaseFilterPtr filter = adec->fakesink;
       adec->filtergraph->RemoveFilter(filter);
     }
 
@@ -1153,7 +1163,7 @@
   hr = CoInitialize(0);
   for (i = 0; i < sizeof (audio_dec_codecs) / sizeof (AudioCodecEntry); i++) {
     GType type;
-    CComPtr<IBaseFilter> filter;
+    IBaseFilterPtr filter;
     GUID insubtype = GUID_MEDIASUBTYPE_FROM_FOURCC (audio_dec_codecs[i].format);
     GUID outsubtype = GUID_MEDIASUBTYPE_FROM_FOURCC (WAVE_FORMAT_PCM);
 
diff --git a/sys/dshowdecwrapper/gstdshowaudiodec.h b/sys/dshowdecwrapper/gstdshowaudiodec.h
index 7f4e074..7ab2830 100644
--- a/sys/dshowdecwrapper/gstdshowaudiodec.h
+++ b/sys/dshowdecwrapper/gstdshowaudiodec.h
@@ -47,8 +47,6 @@
 #ifndef __GST_DSHOWAUDIODEC_H__
 #define __GST_DSHOWAUDIODEC_H__
 
-#include <atlbase.h>
-
 #include <gst/gst.h>
 #include "gstdshowutil.h"
 #include "gstdshowfakesrc.h"
@@ -88,11 +86,11 @@
   FakeSrc *fakesrc;
   AudioFakeSink *fakesink;
 
-  CComPtr<IBaseFilter> decfilter;
+  IBaseFilterPtr decfilter;
   
   /* graph manager interfaces */  
-  CComPtr<IMediaFilter> mediafilter;
-  CComPtr<IFilterGraph> filtergraph;
+  IMediaFilterPtr mediafilter;
+  IFilterGraphPtr filtergraph;
 
   /* true when dshow graph is setup */
   gboolean setup;
@@ -113,11 +111,11 @@
   GstClockTime timestamp;
 
   gboolean comInitialized;
-  GMutex   *com_init_lock;
-  GMutex   *com_deinit_lock;
-  GCond    *com_initialized;
-  GCond    *com_uninitialize;
-  GCond    *com_uninitialized;
+  GMutex   com_init_lock;
+  GMutex   com_deinit_lock;
+  GCond    com_initialized;
+  GCond    com_uninitialize;
+  GCond    com_uninitialized;
 };
 
 struct _GstDshowAudioDecClass
@@ -149,6 +147,7 @@
     m_MediaType.Set (*pmt);
     return S_OK;
   }
+  int GetBufferSize();
 
 protected:
   HRESULT m_hres;
diff --git a/sys/dshowdecwrapper/gstdshowutil.cpp b/sys/dshowdecwrapper/gstdshowutil.cpp
index b60f803..b2cce8e 100644
--- a/sys/dshowdecwrapper/gstdshowutil.cpp
+++ b/sys/dshowdecwrapper/gstdshowutil.cpp
@@ -19,18 +19,19 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <atlbase.h>
 #include <dmodshow.h>
 #include <dmoreg.h>
 
 #include "gstdshowutil.h"
 #include "gstdshowfakesrc.h"
 
+_COM_SMARTPTR_TYPEDEF(IDMOWrapperFilter, __uuidof(IDMOWrapperFilter));
+
 IPin * 
 gst_dshow_get_pin_from_filter (IBaseFilter *filter, PIN_DIRECTION pindir)
 {
-  CComPtr<IEnumPins> enumpins;
-  CComPtr<IPin> pin;
+  IEnumPinsPtr enumpins;
+  IPinPtr pin;
   HRESULT hres; 
 
   hres = filter->EnumPins (&enumpins);
@@ -59,9 +60,9 @@
   HRESULT hres;
   GUID inTypes[2];
   GUID outTypes[2];
-  CComPtr<IFilterMapper2> mapper;
-  CComPtr<IEnumMoniker> enum_moniker;
-  CComPtr<IMoniker> moniker;
+  IFilterMapper2Ptr mapper;
+  IEnumMonikerPtr enum_moniker;
+  IMonikerPtr moniker;
   ULONG fetched;
   IBaseFilter *filter;
 
@@ -73,7 +74,7 @@
       /* If the filter is a DMO, we need to do this a bit differently */
       if (preferred_filters->dmo_category) 
       {
-        CComPtr<IDMOWrapperFilter> wrapper;
+        IDMOWrapperFilterPtr wrapper;
 
         hres = CoCreateInstance (CLSID_DMOWrapperFilter, NULL, 
           CLSCTX_INPROC,
diff --git a/sys/dshowdecwrapper/gstdshowutil.h b/sys/dshowdecwrapper/gstdshowutil.h
index 8e40d9a..80cce56 100644
--- a/sys/dshowdecwrapper/gstdshowutil.h
+++ b/sys/dshowdecwrapper/gstdshowutil.h
@@ -24,6 +24,8 @@
 #define _GST_DSHOW_UTIL_H_
 
 #include <windows.h>
+#include <tchar.h>
+#include <comdef.h>
 #include <objbase.h>
 #include <dshow.h>
 #include <Rpc.h>
@@ -32,6 +34,16 @@
 
 #include <glib.h>
 
+_COM_SMARTPTR_TYPEDEF(IBaseFilter, __uuidof(IBaseFilter));
+_COM_SMARTPTR_TYPEDEF(IFilterGraph, __uuidof(IFilterGraph));
+_COM_SMARTPTR_TYPEDEF(IFilterMapper2, __uuidof(IFilterMapper2));
+_COM_SMARTPTR_TYPEDEF(IEnumMediaTypes, __uuidof(IEnumMediaTypes));
+_COM_SMARTPTR_TYPEDEF(IEnumMoniker, __uuidof(IEnumMoniker));
+_COM_SMARTPTR_TYPEDEF(IEnumPins, __uuidof(IEnumPins));
+_COM_SMARTPTR_TYPEDEF(IMediaFilter, __uuidof(IMediaFilter));
+_COM_SMARTPTR_TYPEDEF(IMoniker, __uuidof(IMoniker));
+_COM_SMARTPTR_TYPEDEF(IPin, __uuidof(IPin));
+
 typedef struct {
   const GUID *filter_guid;  /* The filter GUID, or DMO GUID */
   const GUID *dmo_category; /* If non-NULL, the filter is a DMO of this
diff --git a/sys/dshowdecwrapper/gstdshowvideodec.cpp b/sys/dshowdecwrapper/gstdshowvideodec.cpp
index 6253971..eac0f72 100644
--- a/sys/dshowdecwrapper/gstdshowvideodec.cpp
+++ b/sys/dshowdecwrapper/gstdshowvideodec.cpp
@@ -47,17 +47,17 @@
 #include "config.h"
 #endif
 
-#include <atlbase.h>
 #include <dmoreg.h>
 #include <wmcodecdsp.h>
 
 #include "gstdshowvideodec.h"
+#include <gst/video/video.h>
 
 GST_DEBUG_CATEGORY_STATIC (dshowvideodec_debug);
 #define GST_CAT_DEFAULT dshowvideodec_debug
 
-GST_BOILERPLATE (GstDshowVideoDec, gst_dshowvideodec, GstElement,
-    GST_TYPE_ELEMENT);
+#define gst_dshowvideodec_parent_class parent_class
+G_DEFINE_TYPE(GstDshowVideoDec, gst_dshowvideodec, GST_TYPE_ELEMENT)
 
 static void gst_dshowvideodec_finalize (GObject * object);
 static GstStateChangeReturn gst_dshowvideodec_change_state
@@ -65,8 +65,8 @@
 
 /* sink pad overwrites */
 static gboolean gst_dshowvideodec_sink_setcaps (GstPad * pad, GstCaps * caps);
-static gboolean gst_dshowvideodec_sink_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_dshowvideodec_chain (GstPad * pad, GstBuffer * buffer);
+static gboolean gst_dshowvideodec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event);
+static GstFlowReturn gst_dshowvideodec_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer);
 
 /* src pad overwrites */
 static GstCaps *gst_dshowvideodec_src_getcaps (GstPad * pad);
@@ -139,7 +139,6 @@
   {&CLSID_MPEG_VIDEO_DECODER}, {0}
 };
 
-
 /* video codecs array */
 static const VideoCodecEntry video_dec_codecs[] = {
   {"dshowvdec_wmv1", "Windows Media Video 7",
@@ -147,7 +146,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WMVV1,
    "video/x-wmv, wmvversion = (int) 1",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_wmv_filters},
 
   {"dshowvdec_wmv2", "Windows Media Video 8",
@@ -155,7 +154,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WMVV2,
    "video/x-wmv, wmvversion = (int) 2",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_wmv_filters},
 
   {"dshowvdec_wmv3", "Windows Media Video 9",
@@ -163,7 +162,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WMVV3,
    "video/x-wmv, wmvversion = (int) 3, " "format = (string) WMV3",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_wmv_filters},
 
   {"dshowvdec_wmvp", "Windows Media Video 9 Image",
@@ -171,7 +170,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WMVP,
    "video/x-wmv, wmvversion = (int) 3, " "format = (string) { WMVP, MSS1 }",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_wmv_filters},
 
   {"dshowvdec_wmva", "Windows Media Video 9 Advanced",
@@ -179,7 +178,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WMVA,
    "video/x-wmv, wmvversion = (int) 3, " "format = (string) WMVA",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_wmv_filters},
 
    {"dshowvdec_wvc1", "Windows Media VC1 video",
@@ -187,7 +186,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_WVC1,
    "video/x-wmv, wmvversion = (int) 3, " "format = (string) WVC1",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_wmv_filters},
 
   {"dshowvdec_cinepak", "Cinepack",
@@ -195,7 +194,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_CVID,
    "video/x-cinepak",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_RGB32,
-   "video/x-raw-rgb, bpp=(int)32, depth=(int)24, "
+   "video/x-raw, format=(string)RGB, bpp=(int)32, depth=(int)24, "
        "endianness=(int)4321, red_mask=(int)65280, "
        "green_mask=(int)16711680, blue_mask=(int)-16777216",
    preferred_cinepack_filters},
@@ -205,7 +204,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_MP4S,
    "video/x-msmpeg, msmpegversion=(int)41",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_mp4s_filters},
 
   {"dshowvdec_msmpeg42", "Microsoft ISO MPEG-4 version 2",
@@ -213,7 +212,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_MP42,
    "video/x-msmpeg, msmpegversion=(int)42",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_mpeg4_filters},
 
   {"dshowvdec_msmpeg43", "Microsoft ISO MPEG-4 version 3",
@@ -221,7 +220,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_MP43,
    "video/x-msmpeg, msmpegversion=(int)43",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_mp43_filters},
 
   {"dshowvdec_msmpeg4", "Microsoft ISO MPEG-4 version 1.1",
@@ -229,7 +228,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_M4S2,
    "video/x-msmpeg, msmpegversion=(int)4",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_mp4s_filters},
 
   {"dshowvdec_mpeg1",
@@ -239,7 +238,7 @@
    "video/mpeg, mpegversion= (int) 1, "
        "parsed= (boolean) true, " "systemstream= (boolean) false",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_mpeg1_filters},
    
   {"dshowvdec_mpeg4", "MPEG-4 Video",
@@ -247,7 +246,7 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_MPG4,
    "video/mpeg, msmpegversion=(int)4",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2",
+   GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_mpeg4_filters},
 
   /* The rest of these have no preferred filter; windows doesn't come
@@ -257,38 +256,39 @@
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_XVID,
    "video/x-xvid",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2"},
+   GST_VIDEO_CAPS_MAKE("YUY2")},
 
   {"dshowvdec_divx5", "DIVX 5.0 Video",
    GST_MAKE_FOURCC ('D', 'X', '5', '0'),
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_DX50,
    "video/x-divx, divxversion=(int)5",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2"},
+   GST_VIDEO_CAPS_MAKE("YUY2")},
 
   {"dshowvdec_divx4", "DIVX 4.0 Video",
    GST_MAKE_FOURCC ('D', 'I', 'V', 'X'),
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_DIVX,
    "video/x-divx, divxversion=(int)4",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2"},
+   GST_VIDEO_CAPS_MAKE("YUY2")},
 
   {"dshowvdec_divx3", "DIVX 3.0 Video",
    GST_MAKE_FOURCC ('D', 'I', 'V', '3'),
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_MP43,
    "video/x-divx, divxversion=(int)3",
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
-   "video/x-raw-yuv, format=(fourcc)YUY2"}
+   GST_VIDEO_CAPS_MAKE("YUY2")}
 };
 
 HRESULT VideoFakeSink::DoRenderSample(IMediaSample *pMediaSample)
 {
   gboolean in_seg = FALSE;
-  gint64 clip_start = 0, clip_stop = 0;
+  guint64 clip_start = 0, clip_stop = 0;
   GstDshowVideoDecClass *klass =
       (GstDshowVideoDecClass *) G_OBJECT_GET_CLASS (mDec);
   GstBuffer *buf = NULL;
   GstClockTime start, stop;
+  GstMapInfo map;
 
   if(pMediaSample)
   {
@@ -315,10 +315,7 @@
 
     /* buffer is in our segment, allocate a new out buffer and clip its
      * timestamps */
-    mDec->last_ret = gst_pad_alloc_buffer (mDec->srcpad, 
-        GST_BUFFER_OFFSET_NONE,
-        size, 
-        GST_PAD_CAPS (mDec->srcpad), &buf);
+    gst_buffer_pool_acquire_buffer(mDec->buffer_pool, &buf, NULL);
     if (!buf) {
       GST_WARNING_OBJECT (mDec,
           "cannot allocate a new GstBuffer");
@@ -329,6 +326,7 @@
     GST_BUFFER_TIMESTAMP (buf) = clip_start;
     GST_BUFFER_DURATION (buf) = clip_stop - clip_start;
 
+    gst_buffer_map(buf, &map, GST_MAP_WRITE);
     if (strstr (klass->entry->srccaps, "rgb")) {
       /* FOR RGB directshow decoder will return bottom-up BITMAP 
        * There is probably a way to get top-bottom video frames from
@@ -338,12 +336,13 @@
       guint stride = mDec->width * 4;
 
       for (; line < mDec->height; line++) {
-        memcpy (GST_BUFFER_DATA (buf) + (line * stride),
+        memcpy (map.data + (line * stride),
             pBuffer + (size - ((line + 1) * (stride))), stride);
       }
     } else {
-      memcpy (GST_BUFFER_DATA (buf), pBuffer, MIN ((unsigned int)size, GST_BUFFER_SIZE (buf)));
+      memcpy (map.data, pBuffer, MIN ((unsigned int)size, map.size));
     }
+    gst_buffer_unmap(buf, &map);
 
     GST_LOG_OBJECT (mDec,
         "push_buffer (size %d)=> pts %" GST_TIME_FORMAT " stop %" GST_TIME_FORMAT
@@ -377,25 +376,25 @@
   GstPadTemplate *src, *sink;
   GstCaps *srccaps, *sinkcaps;
   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-  GstElementDetails details;
   const VideoCodecEntry *tmp;
   gpointer qdata;
+  gchar *longname, *description;
 
   qdata = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), DSHOW_CODEC_QDATA);
 
   /* element details */
   tmp = videodec_class->entry = (VideoCodecEntry *) qdata;
 
-  details.longname = g_strdup_printf ("DirectShow %s Decoder Wrapper",
+  longname = g_strdup_printf ("DirectShow %s Decoder Wrapper",
       tmp->element_longname);
-  details.klass = g_strdup ("Codec/Decoder/Video");
-  details.description = g_strdup_printf ("DirectShow %s Decoder Wrapper",
+  description = g_strdup_printf ("DirectShow %s Decoder Wrapper",
       tmp->element_longname);
-  details.author = "Sebastien Moutte <sebastien@moutte.net>";
-  gst_element_class_set_details (element_class, &details);
-  g_free (details.longname);
-  g_free (details.klass);
-  g_free (details.description);
+
+  gst_element_class_set_metadata(element_class, longname, "Codec/Decoder/Video", description, 
+    "Sebastien Moutte <sebastien@moutte.net>");
+
+  g_free (longname);
+  g_free (description);
 
   sinkcaps = gst_caps_from_string (tmp->sinkcaps);
   gst_caps_set_simple (sinkcaps,
@@ -431,7 +430,7 @@
 {
   HRESULT res;
 
-  g_mutex_lock (vdec->com_init_lock);
+  g_mutex_lock (&vdec->com_init_lock);
 
   /* Initialize COM with a MTA for this process. This thread will
    * be the first one to enter the apartement and the last one to leave
@@ -448,24 +447,23 @@
   vdec->comInitialized = TRUE;
 
   /* Signal other threads waiting on this condition that COM was initialized */
-  g_cond_signal (vdec->com_initialized);
+  g_cond_signal (&vdec->com_initialized);
 
-  g_mutex_unlock (vdec->com_init_lock);
+  g_mutex_unlock (&vdec->com_init_lock);
 
   /* Wait until the unitialize condition is met to leave the COM apartement */
-  g_mutex_lock (vdec->com_deinit_lock);
-  g_cond_wait (vdec->com_uninitialize, vdec->com_deinit_lock);
+  g_mutex_lock (&vdec->com_deinit_lock);
+  g_cond_wait (&vdec->com_uninitialize, &vdec->com_deinit_lock);
 
   CoUninitialize ();
   GST_INFO_OBJECT (vdec, "COM unintialized succesfully");
   vdec->comInitialized = FALSE;
-  g_cond_signal (vdec->com_uninitialized);
-  g_mutex_unlock (vdec->com_deinit_lock);
+  g_cond_signal (&vdec->com_uninitialized);
+  g_mutex_unlock (&vdec->com_deinit_lock);
 }
 
 static void
-gst_dshowvideodec_init (GstDshowVideoDec * vdec,
-    GstDshowVideoDecClass * vdec_class)
+gst_dshowvideodec_init (GstDshowVideoDec * vdec)
 {
   GstElementClass *element_class = GST_ELEMENT_GET_CLASS (vdec);
 
@@ -474,7 +472,6 @@
       gst_pad_new_from_template (gst_element_class_get_pad_template
       (element_class, "sink"), "sink");
 
-  gst_pad_set_setcaps_function (vdec->sinkpad, gst_dshowvideodec_sink_setcaps);
   gst_pad_set_event_function (vdec->sinkpad, gst_dshowvideodec_sink_event);
   gst_pad_set_chain_function (vdec->sinkpad, gst_dshowvideodec_chain);
   gst_element_add_pad (GST_ELEMENT (vdec), vdec->sinkpad);
@@ -499,22 +496,23 @@
   vdec->segment = gst_segment_new ();
 
   vdec->setup = FALSE;
+  vdec->buffer_pool = NULL;
 
-  vdec->com_init_lock = g_mutex_new();
-  vdec->com_deinit_lock = g_mutex_new();
-  vdec->com_initialized = g_cond_new();
-  vdec->com_uninitialize = g_cond_new();
-  vdec->com_uninitialized = g_cond_new();
+  g_mutex_init (&vdec->com_init_lock);
+  g_mutex_init (&vdec->com_deinit_lock);
+  g_cond_init (&vdec->com_initialized);
+  g_cond_init (&vdec->com_uninitialize);
+  g_cond_init (&vdec->com_uninitialized);
 
-  g_mutex_lock (vdec->com_init_lock);
+  g_mutex_lock (&vdec->com_init_lock);
 
   /* create the COM initialization thread */
-  g_thread_create ((GThreadFunc)gst_dshowvideodec_com_thread,
-      vdec, FALSE, NULL);
+  g_thread_new ("COM Init Thread", (GThreadFunc)gst_dshowvideodec_com_thread,
+    vdec);
 
   /* wait until the COM thread signals that COM has been initialized */
-  g_cond_wait (vdec->com_initialized, vdec->com_init_lock);
-  g_mutex_unlock (vdec->com_init_lock);
+  g_cond_wait (&vdec->com_initialized, &vdec->com_init_lock);
+  g_mutex_unlock (&vdec->com_init_lock);
 }
 
 static void
@@ -527,19 +525,24 @@
     vdec->segment = NULL;
   }
 
-  /* signal the COM thread that it sould uninitialize COM */
-  if (vdec->comInitialized) {
-    g_mutex_lock (vdec->com_deinit_lock);
-    g_cond_signal (vdec->com_uninitialize);
-    g_cond_wait (vdec->com_uninitialized, vdec->com_deinit_lock);
-    g_mutex_unlock (vdec->com_deinit_lock);
+  if(vdec->buffer_pool) {
+    gst_object_unref(vdec->buffer_pool);
+    vdec->buffer_pool = NULL;
   }
 
-  g_mutex_free (vdec->com_init_lock);
-  g_mutex_free (vdec->com_deinit_lock);
-  g_cond_free (vdec->com_initialized);
-  g_cond_free (vdec->com_uninitialize);
-  g_cond_free (vdec->com_uninitialized);
+  /* signal the COM thread that it sould uninitialize COM */
+  if (vdec->comInitialized) {
+    g_mutex_lock (&vdec->com_deinit_lock);
+    g_cond_signal (&vdec->com_uninitialize);
+    g_cond_wait (&vdec->com_uninitialized, &vdec->com_deinit_lock);
+    g_mutex_unlock (&vdec->com_deinit_lock);
+  }
+
+  g_mutex_clear (&vdec->com_init_lock);
+  g_mutex_clear (&vdec->com_deinit_lock);
+  g_cond_clear (&vdec->com_initialized);
+  g_cond_clear (&vdec->com_uninitialize);
+  g_cond_clear (&vdec->com_uninitialized);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -583,16 +586,22 @@
   GstDshowVideoDecClass *klass =
       (GstDshowVideoDecClass *) G_OBJECT_GET_CLASS (vdec);
   GstBuffer *extradata = NULL;
+  gsize extra_size;
   const GValue *v = NULL;
   guint size = 0;
-  GstCaps *caps_out;
+  GstCaps *caps_out = NULL;
   AM_MEDIA_TYPE output_mediatype, input_mediatype;
   VIDEOINFOHEADER *input_vheader = NULL, *output_vheader = NULL;
-  CComPtr<IPin> output_pin;
-  CComPtr<IPin> input_pin;
+  IPinPtr output_pin;
+  IPinPtr input_pin;
   IBaseFilter *srcfilter = NULL;
   IBaseFilter *sinkfilter = NULL;
   const GValue *fps, *par;
+  GstQuery *query = NULL;
+  GstBufferPool *pool = NULL;
+  GstStructure *pool_config = NULL;
+  guint pool_size, pool_min, pool_max;
+  GstVideoInfo video_info;
 
   /* read data */
   if (!gst_structure_get_int (s, "width", &vdec->width) ||
@@ -622,8 +631,10 @@
     vdec->par_n = vdec->par_d = 1;
   }
 
-  if ((v = gst_structure_get_value (s, "codec_data")))
+  if ((v = gst_structure_get_value (s, "codec_data"))) {
     extradata = gst_value_get_buffer (v);
+    extra_size = gst_buffer_get_size(extradata);
+  }
 
   /* define the input type format */
   memset (&input_mediatype, 0, sizeof (AM_MEDIA_TYPE));
@@ -634,33 +645,31 @@
 
   if (strstr (klass->entry->sinkcaps, "video/mpeg, mpegversion= (int) 1")) {
     size =
-        sizeof (MPEG1VIDEOINFO) + (extradata ? GST_BUFFER_SIZE (extradata) -
-        1 : 0);
+        sizeof (MPEG1VIDEOINFO) + (extradata ? extra_size - 1 : 0);
     input_vheader = (VIDEOINFOHEADER *)g_malloc0 (size);
 
     input_vheader->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
     if (extradata) {
       MPEG1VIDEOINFO *mpeg_info = (MPEG1VIDEOINFO *) input_vheader;
 
-      memcpy (mpeg_info->bSequenceHeader,
-          GST_BUFFER_DATA (extradata), GST_BUFFER_SIZE (extradata));
-      mpeg_info->cbSequenceHeader = GST_BUFFER_SIZE (extradata);
+      gst_buffer_extract(extradata, 0, mpeg_info->bSequenceHeader, extra_size);
+      mpeg_info->cbSequenceHeader = extra_size;
     }
     input_mediatype.formattype = FORMAT_MPEGVideo;
   } else {
     size =
-        sizeof (VIDEOINFOHEADER) +
-        (extradata ? GST_BUFFER_SIZE (extradata) : 0);
+        sizeof (VIDEOINFOHEADER) + (extradata ? extra_size : 0);
     input_vheader = (VIDEOINFOHEADER *)g_malloc0 (size);
-
     input_vheader->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
+
     if (extradata) {            /* Codec data is appended after our header */
-      memcpy (((guchar *) input_vheader) + sizeof (VIDEOINFOHEADER),
-          GST_BUFFER_DATA (extradata), GST_BUFFER_SIZE (extradata));
-      input_vheader->bmiHeader.biSize += GST_BUFFER_SIZE (extradata);
+      gst_buffer_extract(extradata, 0,
+        ((guchar *) input_vheader) + sizeof (VIDEOINFOHEADER), extra_size);
+      input_vheader->bmiHeader.biSize += extra_size;
     }
     input_mediatype.formattype = FORMAT_VideoInfo;
   }
+
   input_vheader->rcSource.top = input_vheader->rcSource.left = 0;
   input_vheader->rcSource.right = vdec->width;
   input_vheader->rcSource.bottom = vdec->height;
@@ -777,12 +786,52 @@
       "pixel-aspect-ratio", GST_TYPE_FRACTION, vdec->par_n, vdec->par_d, NULL);
 
   if (!gst_pad_set_caps (vdec->srcpad, caps_out)) {
-    gst_caps_unref (caps_out);
     GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION,
         ("Failed to negotiate output"), (NULL));
     goto end;
   }
-  gst_caps_unref (caps_out);
+
+  /* request or create a buffer pool */
+  if (vdec->buffer_pool) {
+    gst_object_unref (vdec->buffer_pool);
+  }
+
+  query = gst_query_new_allocation(caps_out, TRUE);
+  gst_pad_peer_query(vdec->srcpad, query);
+
+  if (gst_query_get_n_allocation_pools (query) > 0) {
+    gst_query_parse_nth_allocation_pool (query, 0, &pool, &pool_size, &pool_min,
+      &pool_max);
+  }
+  else {
+    pool = NULL;
+    pool_size = output_mediatype.lSampleSize;
+    pool_min = 1;
+    pool_max = 0;
+  }
+
+  if (pool == NULL) {
+    pool = gst_video_buffer_pool_new ();
+  }
+
+  if (!pool) {
+    GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION,
+        ("Could not create buffer bool"), (NULL));
+    goto end;
+  }
+
+  pool_config = gst_buffer_pool_get_config (pool);
+  gst_buffer_pool_config_set_params (pool_config, caps_out, pool_size,
+    pool_min, pool_max);
+  gst_buffer_pool_set_config (pool, pool_config);
+
+  if (!gst_buffer_pool_set_active (pool, TRUE)) {
+    GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION,
+      ("Failed set buffer pool active"), (NULL));
+    goto end;
+  }
+
+  vdec->buffer_pool = pool;
 
   hres = vdec->mediafilter->Run (-1);
   if (hres != S_OK) {
@@ -793,6 +842,8 @@
 
   ret = TRUE;
 end:
+  if (caps_out)
+    gst_caps_unref (caps_out);
   gst_object_unref (vdec);
   if (input_vheader)
     g_free (input_vheader);
@@ -800,50 +851,47 @@
     srcfilter->Release();
   if (sinkfilter)
     sinkfilter->Release();
+  if (query)
+    gst_query_unref(query);
   return ret;
 }
 
 static gboolean
-gst_dshowvideodec_sink_event (GstPad * pad, GstEvent * event)
+gst_dshowvideodec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
 {
   gboolean ret = TRUE;
   GstDshowVideoDec *vdec = (GstDshowVideoDec *) gst_pad_get_parent (pad);
 
   switch (GST_EVENT_TYPE (event)) {
+    case GST_EVENT_CAPS:
+      GstCaps *caps;
+      gst_event_parse_caps(event, &caps);
+      ret = gst_dshowvideodec_sink_setcaps(pad, caps);
+      break;
+
     case GST_EVENT_FLUSH_STOP:
       gst_dshowvideodec_flush (vdec);
-      ret = gst_pad_event_default (pad, event);
+      ret = gst_pad_event_default (pad, parent, event);
       break;
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_SEGMENT:
     {
-      GstFormat format;
-      gdouble rate;
-      gint64 start, stop, time;
-      gboolean update;
+      const GstSegment *segment;
 
-      gst_event_parse_new_segment (event, &update, &rate, &format, &start,
-          &stop, &time);
+      gst_event_parse_segment (event, &segment);
 
       /* save the new segment in our local current segment */
-      gst_segment_set_newsegment (vdec->segment, update, rate, format, start,
-          stop, time);
+      gst_segment_copy_into(segment, vdec->segment);
 
       GST_CAT_DEBUG_OBJECT (dshowvideodec_debug, vdec,
           "new segment received => start=%" GST_TIME_FORMAT " stop=%"
           GST_TIME_FORMAT, GST_TIME_ARGS (vdec->segment->start),
           GST_TIME_ARGS (vdec->segment->stop));
 
-      if (update) {
-        GST_CAT_DEBUG_OBJECT (dshowvideodec_debug, vdec,
-            "closing current segment flushing..");
-        gst_dshowvideodec_flush (vdec);
-      }
-
-      ret = gst_pad_event_default (pad, event);
+      ret = gst_pad_event_default (pad, parent, event);
       break;
     }
     default:
-      ret = gst_pad_event_default (pad, event);
+      ret = gst_pad_event_default (pad, parent, event);
       break;
   }
 
@@ -853,11 +901,12 @@
 }
 
 static GstFlowReturn
-gst_dshowvideodec_chain (GstPad * pad, GstBuffer * buffer)
+gst_dshowvideodec_chain (GstPad * pad, GstObject *parent, GstBuffer * buffer)
 {
   GstDshowVideoDec *vdec = (GstDshowVideoDec *) gst_pad_get_parent (pad);
   bool discont = FALSE;
   GstClockTime stop;
+  GstMapInfo map;
 
   if (!vdec->setup) {
     /* we are not setup */
@@ -866,7 +915,7 @@
     goto beach;
   }
 
-  if (GST_FLOW_IS_FATAL (vdec->last_ret)) {
+  if (vdec->last_ret != GST_FLOW_OK) {
     GST_DEBUG_OBJECT (vdec, "last decoding iteration generated a fatal error "
         "%s", gst_flow_get_name (vdec->last_ret));
     goto beach;
@@ -882,7 +931,7 @@
 
   GST_CAT_LOG_OBJECT (dshowvideodec_debug, vdec,
       "chain (size %d)=> pts %" GST_TIME_FORMAT " stop %" GST_TIME_FORMAT,
-      GST_BUFFER_SIZE (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
+      gst_buffer_get_size (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
       GST_TIME_ARGS (stop));
 
   /* if the incoming buffer has discont flag set => flush decoder data */
@@ -894,10 +943,12 @@
     discont = TRUE;
   }
 
+  gst_buffer_map(buffer, &map, GST_MAP_READ);
   /* push the buffer to the directshow decoder */
   vdec->fakesrc->GetOutputPin()->PushBuffer(
-      GST_BUFFER_DATA (buffer), GST_BUFFER_TIMESTAMP (buffer), stop,
-      GST_BUFFER_SIZE (buffer), discont);
+      map.data, GST_BUFFER_TIMESTAMP (buffer), stop,
+      map.size, discont);
+  gst_buffer_unmap(buffer, &map);
 
 beach:
   gst_buffer_unref (buffer);
@@ -916,8 +967,8 @@
     vdec->srccaps = gst_caps_new_empty ();
 
   if (vdec->decfilter) {
-    CComPtr<IPin> output_pin;
-    CComPtr<IEnumMediaTypes> enum_mediatypes;
+    IPinPtr output_pin;
+    IEnumMediaTypesPtr enum_mediatypes;
     HRESULT hres;
     ULONG fetched;
 
@@ -1006,8 +1057,8 @@
 gst_dshowvideodec_get_filter_output_format (GstDshowVideoDec * vdec,
     const GUID subtype, VIDEOINFOHEADER ** format, guint * size)
 {
-  CComPtr<IPin> output_pin;
-  CComPtr<IEnumMediaTypes> enum_mediatypes;
+  IPinPtr output_pin;
+  IEnumMediaTypesPtr enum_mediatypes;
   HRESULT hres;
   ULONG fetched;
   BOOL ret = FALSE;
@@ -1252,7 +1303,7 @@
 
   for (i = 0; i < sizeof (video_dec_codecs) / sizeof (VideoCodecEntry); i++) {
     GType type;
-    CComPtr<IBaseFilter> filter;
+    IBaseFilterPtr filter;
     guint rank = GST_RANK_MARGINAL;
 
     filter = gst_dshow_find_filter (
diff --git a/sys/dshowdecwrapper/gstdshowvideodec.h b/sys/dshowdecwrapper/gstdshowvideodec.h
index e1fb28c..885861f 100644
--- a/sys/dshowdecwrapper/gstdshowvideodec.h
+++ b/sys/dshowdecwrapper/gstdshowvideodec.h
@@ -113,11 +113,13 @@
   gboolean setup;
 
   gboolean comInitialized;
-  GMutex   *com_init_lock;
-  GMutex   *com_deinit_lock;
-  GCond    *com_initialized;
-  GCond    *com_uninitialize;
-  GCond    *com_uninitialized;
+  GMutex   com_init_lock;
+  GMutex   com_deinit_lock;
+  GCond    com_initialized;
+  GCond    com_uninitialize;
+  GCond    com_uninitialized;
+
+  GstBufferPool *buffer_pool;
 };
 
 struct _GstDshowVideoDecClass
diff --git a/sys/dshowsrcwrapper/Makefile.in b/sys/dshowsrcwrapper/Makefile.in
index 15ba97e..2e3c592 100644
--- a/sys/dshowsrcwrapper/Makefile.in
+++ b/sys/dshowsrcwrapper/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -161,8 +161,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -201,7 +205,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -209,6 +212,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -258,8 +263,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -338,7 +341,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -347,7 +349,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -360,7 +361,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -385,6 +385,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -458,10 +460,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -487,6 +493,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -523,6 +532,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -563,17 +573,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -590,6 +599,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/dshowsrcwrapper/gstdshow.cpp b/sys/dshowsrcwrapper/gstdshow.cpp
index 4f59105..29266ba 100644
--- a/sys/dshowsrcwrapper/gstdshow.cpp
+++ b/sys/dshowsrcwrapper/gstdshow.cpp
@@ -19,6 +19,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#include <gst/video/video-format.h>
+
 #include "gstdshow.h"
 #include "gstdshowfakesink.h"
 
@@ -411,6 +413,22 @@
   return GST_VIDEO_FORMAT_UNKNOWN;
 }
 
+gboolean
+gst_dshow_is_pin_connected (IPin * pin)
+{
+  IPin *tmp_pin = NULL;
+  gboolean res;
+  HRESULT hres;
+
+  g_assert (pin);
+  hres = pin->ConnectedTo (&tmp_pin);
+  res = (hres != VFW_E_NOT_CONNECTED);
+  if (tmp_pin)
+    tmp_pin->Release ();
+
+  return res;
+}
+
 GstCaps *
 gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar * name,
     GstCapturePinMediaType * pin_mediatype)
@@ -424,16 +442,16 @@
   /* raw video format */
   switch (video_format) {
     case GST_VIDEO_FORMAT_BGR:
-      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_BGR);
+      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGR"));
       break;
     case GST_VIDEO_FORMAT_I420:
-      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_YUV ("I420"));
+      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("I420"));
 	  break;
     case GST_VIDEO_FORMAT_YUY2:
-      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_YUV ("YUY2"));
+      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("YUY2"));
       break;
     case GST_VIDEO_FORMAT_UYVY:
-      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_YUV ("UYVY"));
+      video_caps = gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("UYVY"));
       break;
     default:
       break;
@@ -444,12 +462,16 @@
     if (g_ascii_strncasecmp (name, "video/x-dv, systemstream=FALSE", 31) == 0) {
       video_caps = gst_caps_new_simple ("video/x-dv",
           "systemstream", G_TYPE_BOOLEAN, FALSE,
-          "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'v', 's', 'd'),
+          "format", G_TYPE_STRING, "dvsd",
           NULL);
     } else if (g_ascii_strncasecmp (name, "video/x-dv, systemstream=TRUE", 31) == 0) {
       video_caps = gst_caps_new_simple ("video/x-dv",
           "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
       return video_caps;
+    } else if (g_ascii_strncasecmp (name, "image/jpeg", 10) == 0) {
+      video_caps = gst_caps_new_simple ("image/jpeg", NULL);
+    } else if (g_ascii_strncasecmp (name, "video/x-h264", 12) == 0) {
+      video_caps = gst_caps_new_simple ("video/x-h264", NULL);
     }
   }
 
diff --git a/sys/dshowsrcwrapper/gstdshow.h b/sys/dshowsrcwrapper/gstdshow.h
index 92220b6..4c75f35 100644
--- a/sys/dshowsrcwrapper/gstdshow.h
+++ b/sys/dshowsrcwrapper/gstdshow.h
@@ -92,6 +92,9 @@
 /* translate GUID format to gsteamer video format */
 GstVideoFormat gst_dshow_guid_to_gst_video_format (AM_MEDIA_TYPE *mediatype);
 
+/* check if IPin is connected */
+gboolean gst_dshow_is_pin_connected (IPin *pin);
+
 /* transform a dshow video caps to a gstreamer video caps */
 GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format,
     const gchar * name, GstCapturePinMediaType * pin_mediatype);
diff --git a/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp b/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp
index 1a816aa..c4d33e5 100644
--- a/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp
+++ b/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp
@@ -31,23 +31,18 @@
 static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-int, "
-        "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 16, "
-        "depth = (int) 16, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]; "
-        "audio/x-raw-int, "
-        "signed = (boolean) { TRUE, FALSE }, "
-        "width = (int) 8, "
-        "depth = (int) 8, "
-        "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string){ "
+	GST_AUDIO_NE (S16) ", "
+	GST_AUDIO_NE (U16) ", "
+	GST_AUDIO_NE (S8)  ", "
+	GST_AUDIO_NE (U8)
+        " }, "
+        "rate = " GST_AUDIO_RATE_RANGE ", "
+        "channels = (int) [ 1, 2 ]")
     );
 
-static void gst_dshowaudiosrc_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstDshowAudioSrc, gst_dshowaudiosrc, GstAudioSrc,
-    GST_TYPE_AUDIO_SRC, gst_dshowaudiosrc_init_interfaces);
+G_DEFINE_TYPE(GstDshowAudioSrc, gst_dshowaudiosrc, GST_TYPE_AUDIO_SRC);
 
 enum
 {
@@ -56,32 +51,23 @@
   PROP_DEVICE_NAME
 };
 
-static void gst_dshowaudiosrc_probe_interface_init (GstPropertyProbeInterface *
-    iface);
-static const GList *gst_dshowaudiosrc_probe_get_properties (GstPropertyProbe *
-    probe);
-static GValueArray *gst_dshowaudiosrc_probe_get_values (GstPropertyProbe *
-    probe, guint prop_id, const GParamSpec * pspec);
-static GValueArray *gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc *
-    src);
-
 
 static void gst_dshowaudiosrc_dispose (GObject * gobject);
 static void gst_dshowaudiosrc_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_dshowaudiosrc_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
-static GstCaps *gst_dshowaudiosrc_get_caps (GstBaseSrc * src);
+static GstCaps *gst_dshowaudiosrc_get_caps (GstBaseSrc * src, GstCaps * filter);
 static GstStateChangeReturn gst_dshowaudiosrc_change_state (GstElement *
     element, GstStateChange transition);
 
 static gboolean gst_dshowaudiosrc_open (GstAudioSrc * asrc);
 static gboolean gst_dshowaudiosrc_prepare (GstAudioSrc * asrc,
-    GstRingBufferSpec * spec);
+    GstAudioRingBufferSpec * spec);
 static gboolean gst_dshowaudiosrc_unprepare (GstAudioSrc * asrc);
 static gboolean gst_dshowaudiosrc_close (GstAudioSrc * asrc);
 static guint gst_dshowaudiosrc_read (GstAudioSrc * asrc, gpointer data,
-    guint length);
+    guint length, GstClockTime *timestamp);
 static guint gst_dshowaudiosrc_delay (GstAudioSrc * asrc);
 static void gst_dshowaudiosrc_reset (GstAudioSrc * asrc);
 
@@ -92,42 +78,6 @@
     gpointer src_object, GstClockTime duration);
 
 static void
-gst_dshowaudiosrc_init_interfaces (GType type)
-{
-  static const GInterfaceInfo dshowaudiosrc_info = {
-    (GInterfaceInitFunc) gst_dshowaudiosrc_probe_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type,
-      GST_TYPE_PROPERTY_PROBE, &dshowaudiosrc_info);
-}
-
-static void
-gst_dshowaudiosrc_probe_interface_init (GstPropertyProbeInterface * iface)
-{
-  iface->get_properties = gst_dshowaudiosrc_probe_get_properties;
-/*  iface->needs_probe    = gst_dshowaudiosrc_probe_needs_probe;
-  iface->probe_property = gst_dshowaudiosrc_probe_probe_property;*/
-  iface->get_values = gst_dshowaudiosrc_probe_get_values;
-}
-
-static void
-gst_dshowaudiosrc_base_init (gpointer klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_template));
-
-  gst_element_class_set_static_metadata (element_class,
-      "Directshow audio capture source", "Source/Audio",
-      "Receive data from a directshow audio capture graph",
-      "Sebastien Moutte <sebastien@moutte.net>");
-}
-
-static void
 gst_dshowaudiosrc_class_init (GstDshowAudioSrcClass * klass)
 {
   GObjectClass *gobject_class;
@@ -146,11 +96,11 @@
   gobject_class->get_property =
       GST_DEBUG_FUNCPTR (gst_dshowaudiosrc_get_property);
 
+  gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_dshowaudiosrc_get_caps);
+
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_dshowaudiosrc_change_state);
 
-  gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_dshowaudiosrc_get_caps);
-
   gstaudiosrc_class->open = GST_DEBUG_FUNCPTR (gst_dshowaudiosrc_open);
   gstaudiosrc_class->prepare = GST_DEBUG_FUNCPTR (gst_dshowaudiosrc_prepare);
   gstaudiosrc_class->unprepare =
@@ -172,12 +122,20 @@
           "Human-readable name of the sound device", NULL,
           static_cast < GParamFlags > (G_PARAM_READWRITE)));
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_template));
+
+  gst_element_class_set_static_metadata (gstelement_class,
+      "Directshow audio capture source", "Source/Audio",
+      "Receive data from a directshow audio capture graph",
+      "Sebastien Moutte <sebastien@moutte.net>");
+
   GST_DEBUG_CATEGORY_INIT (dshowaudiosrc_debug, "dshowaudiosrc", 0,
       "Directshow audio source");
 }
 
 static void
-gst_dshowaudiosrc_init (GstDshowAudioSrc * src, GstDshowAudioSrcClass * klass)
+gst_dshowaudiosrc_init (GstDshowAudioSrc * src)
 {
   src->device = NULL;
   src->device_name = NULL;
@@ -189,7 +147,7 @@
   src->pins_mediatypes = NULL;
 
   src->gbarray = g_byte_array_new ();
-  src->gbarray_lock = g_mutex_new ();
+  g_mutex_init(&src->gbarray_lock);
 
   src->is_running = FALSE;
 
@@ -226,10 +184,7 @@
     src->gbarray = NULL;
   }
 
-  if (src->gbarray_lock) {
-    g_mutex_free (src->gbarray_lock);
-    src->gbarray_lock = NULL;
-  }
+  g_mutex_clear(&src->gbarray_lock);
 
   /* clean dshow */
   if (src->audio_cap_filter)
@@ -237,113 +192,10 @@
 
   CoUninitialize ();
 
-  G_OBJECT_CLASS (parent_class)->dispose (gobject);
+  G_OBJECT_CLASS (gst_dshowaudiosrc_parent_class)->dispose (gobject);
 }
 
 
-static const GList *
-gst_dshowaudiosrc_probe_get_properties (GstPropertyProbe * probe)
-{
-  GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
-  static GList *props = NULL;
-
-  if (!props) {
-    GParamSpec *pspec;
-
-    pspec = g_object_class_find_property (klass, "device-name");
-    props = g_list_append (props, pspec);
-  }
-
-  return props;
-}
-
-static GValueArray *
-gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
-{
-  GValueArray *array = g_value_array_new (0);
-  ICreateDevEnum *devices_enum = NULL;
-  IEnumMoniker *moniker_enum = NULL;
-  IMoniker *moniker = NULL;
-  HRESULT hres = S_FALSE;
-  ULONG fetched;
-
-  hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
-      IID_ICreateDevEnum, (LPVOID *) & devices_enum);
-  if (hres != S_OK) {
-    GST_ERROR
-        ("Can't create an instance of the system device enumerator (error=0x%x)",
-        hres);
-    array = NULL;
-    goto clean;
-  }
-
-  hres = devices_enum->CreateClassEnumerator (CLSID_AudioInputDeviceCategory,
-      &moniker_enum, 0);
-  if (hres != S_OK || !moniker_enum) {
-    GST_ERROR ("Can't get enumeration of audio devices (error=0x%x)", hres);
-    array = NULL;
-    goto clean;
-  }
-
-  moniker_enum->Reset ();
-
-  while (hres = moniker_enum->Next (1, &moniker, &fetched), hres == S_OK) {
-    IPropertyBag *property_bag = NULL;
-
-    hres = moniker->BindToStorage (NULL, NULL, IID_IPropertyBag,
-        (LPVOID *) & property_bag);
-    if (SUCCEEDED (hres) && property_bag) {
-      VARIANT varFriendlyName;
-
-      VariantInit (&varFriendlyName);
-      hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
-      if (hres == S_OK && varFriendlyName.bstrVal) {
-        gchar *friendly_name =
-            g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
-            wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
-
-        GValue value = { 0 };
-        g_value_init (&value, G_TYPE_STRING);
-        g_value_set_string (&value, friendly_name);
-        g_value_array_append (array, &value);
-        g_value_unset (&value);
-        g_free (friendly_name);
-        SysFreeString (varFriendlyName.bstrVal);
-      }
-      property_bag->Release ();
-    }
-    moniker->Release ();
-  }
-
-clean:
-  if (moniker_enum)
-    moniker_enum->Release ();
-
-  if (devices_enum)
-    devices_enum->Release ();
-
-  return array;
-}
-
-static GValueArray *
-gst_dshowaudiosrc_probe_get_values (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec)
-{
-  GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (probe);
-  GValueArray *array = NULL;
-
-  switch (prop_id) {
-    case PROP_DEVICE_NAME:
-      array = gst_dshowaudiosrc_get_device_name_values (src);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-      break;
-  }
-
-  return array;
-}
-
 static void
 gst_dshowaudiosrc_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
@@ -387,7 +239,7 @@
 }
 
 static GstCaps *
-gst_dshowaudiosrc_get_caps (GstBaseSrc * basesrc)
+gst_dshowaudiosrc_get_caps (GstBaseSrc * basesrc, GstCaps * filter)
 {
   HRESULT hres = S_OK;
   IBindCtx *lpbc = NULL;
@@ -474,7 +326,15 @@
   }
 
   if (src->caps) {
-    return gst_caps_ref (src->caps);
+    GstCaps *caps;
+
+    if (filter) {
+      caps = gst_caps_intersect_full (filter, src->caps, GST_CAPS_INTERSECT_FIRST);
+    } else {
+      caps = gst_caps_ref (src->caps);
+    }
+
+    return caps;
   }
 
   return NULL;
@@ -492,14 +352,14 @@
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      if (src->media_filter)
+      if (src->media_filter) {
+        src->is_running = TRUE;
         hres = src->media_filter->Run (0);
+      }
       if (hres != S_OK) {
         GST_ERROR ("Can't RUN the directshow capture graph (error=0x%x)", hres);
         src->is_running = FALSE;
         return GST_STATE_CHANGE_FAILURE;
-      } else {
-        src->is_running = TRUE;
       }
       break;
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
@@ -521,7 +381,7 @@
       break;
   }
 
-  return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  return GST_ELEMENT_CLASS(gst_dshowaudiosrc_parent_class)->change_state(element, transition);
 }
 
 static gboolean
@@ -587,11 +447,32 @@
 }
 
 static gboolean
-gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
+gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
 {
   HRESULT hres;
   IPin *input_pin = NULL;
   GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (asrc);
+  GstCaps *current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (asrc));
+
+  if (current_caps) {
+    if (gst_caps_is_equal (spec->caps, current_caps)) {
+      gst_caps_unref (current_caps);
+      return TRUE;
+    }
+    gst_caps_unref (current_caps);
+  }
+  /* In 1.0, prepare() seems to be called in the PLAYING state. Most
+     of the time you can't do much on a running graph. */
+
+  gboolean was_running = src->is_running;
+  if (was_running) {
+    HRESULT hres = src->media_filter->Stop ();
+    if (hres != S_OK) {
+      GST_ERROR("Can't STOP the directshow capture graph for preparing (error=0x%x)", hres);
+      return FALSE;
+    }
+    src->is_running = FALSE;
+  }
 
   /* search the negociated caps in our caps list to get its index and the corresponding mediatype */
   if (gst_caps_is_subset (spec->caps, src->caps)) {
@@ -626,7 +507,7 @@
           goto error;
         }
 
-        spec->segsize = (gint) (spec->bytes_per_sample * spec->rate * spec->latency_time /
+        spec->segsize = (gint) (spec->info.bpf * spec->info.rate * spec->latency_time /
             GST_MSECOND);
         spec->segtotal = (gint) ((gfloat) spec->buffer_time /
             (gfloat) spec->latency_time + 0.5);
@@ -634,10 +515,22 @@
             spec->segsize))
         {
           GST_WARNING ("Could not change capture latency");
-          spec->segsize = spec->rate * spec->channels;
+          spec->segsize = spec->info.rate * spec->info.channels;
           spec->segtotal = 2;
         };
         GST_INFO ("Configuring with segsize:%d segtotal:%d", spec->segsize, spec->segtotal);
+
+        if (gst_dshow_is_pin_connected (pin_mediatype->capture_pin)) {
+          GST_DEBUG_OBJECT (src,
+              "capture_pin already connected, disconnecting");
+          src->filter_graph->Disconnect (pin_mediatype->capture_pin);
+        }
+
+        if (gst_dshow_is_pin_connected (input_pin)) {
+          GST_DEBUG_OBJECT (src, "input_pin already connected, disconnecting");
+          src->filter_graph->Disconnect (input_pin);
+        }
+
         hres = src->filter_graph->ConnectDirect (pin_mediatype->capture_pin,
             input_pin, NULL);
         input_pin->Release ();
@@ -653,9 +546,20 @@
     }
   }
 
+  if (was_running) {
+    HRESULT hres = src->media_filter->Run (0);
+    if (hres != S_OK) {
+      GST_ERROR("Can't RUN the directshow capture graph after prepare (error=0x%x)", hres);
+      return FALSE;
+    }
+
+    src->is_running = TRUE;
+  }
+
   return TRUE;
 
 error:
+  /* Don't restart the graph, we're out anyway. */
   return FALSE;
 }
 
@@ -711,7 +615,7 @@
 }
 
 static guint
-gst_dshowaudiosrc_read (GstAudioSrc * asrc, gpointer data, guint length)
+gst_dshowaudiosrc_read (GstAudioSrc * asrc, gpointer data, guint length, GstClockTime *timestamp)
 {
   GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (asrc);
   guint ret = 0;
@@ -722,15 +626,15 @@
   if (src->gbarray) {
   test:
     if (src->gbarray->len >= length) {
-      g_mutex_lock (src->gbarray_lock);
+      g_mutex_lock (&src->gbarray_lock);
       memcpy (data, src->gbarray->data + (src->gbarray->len - length), length);
       g_byte_array_remove_range (src->gbarray, src->gbarray->len - length,
           length);
       ret = length;
-      g_mutex_unlock (src->gbarray_lock);
+      g_mutex_unlock (&src->gbarray_lock);
     } else {
       if (src->is_running) {
-        Sleep (GST_BASE_AUDIO_SRC(src)->ringbuffer->spec.latency_time /
+        Sleep (GST_AUDIO_BASE_SRC(src)->ringbuffer->spec.latency_time /
             GST_MSECOND / 10);
         goto test;
       }
@@ -747,11 +651,11 @@
   guint ret = 0;
 
   if (src->gbarray) {
-    g_mutex_lock (src->gbarray_lock);
+    g_mutex_lock (&src->gbarray_lock);
     if (src->gbarray->len) {
       ret = src->gbarray->len / 4;
     }
-    g_mutex_unlock (src->gbarray_lock);
+    g_mutex_unlock (&src->gbarray_lock);
   }
 
   return ret;
@@ -762,11 +666,11 @@
 {
   GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (asrc);
 
-  g_mutex_lock (src->gbarray_lock);
+  g_mutex_lock (&src->gbarray_lock);
   GST_DEBUG ("byte array size= %d", src->gbarray->len);
   if (src->gbarray->len > 0)
     g_byte_array_remove_range (src->gbarray, 0, src->gbarray->len);
-  g_mutex_unlock (src->gbarray_lock);
+  g_mutex_unlock (&src->gbarray_lock);
 }
 
 static GstCaps *
@@ -804,15 +708,29 @@
 
       if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_PCM,
               FORMAT_WaveFormatEx)) {
+	GstAudioFormat format = GST_AUDIO_FORMAT_UNKNOWN;
         WAVEFORMATEX *wavformat =
             (WAVEFORMATEX *) pin_mediatype->mediatype->pbFormat;
-        mediacaps =
-            gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT,
-            wavformat->wBitsPerSample, "depth", G_TYPE_INT,
-            wavformat->wBitsPerSample, "endianness", G_TYPE_INT, G_BYTE_ORDER,
-            "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT,
-            wavformat->nChannels, "rate", G_TYPE_INT, wavformat->nSamplesPerSec,
-            NULL);
+
+	switch (wavformat->wFormatTag) {
+            case WAVE_FORMAT_PCM:
+	      format = gst_audio_format_build_integer (TRUE, G_BYTE_ORDER, wavformat->wBitsPerSample, wavformat->wBitsPerSample);
+	      break;
+            default:
+	      break;
+	}
+
+	if (format != GST_AUDIO_FORMAT_UNKNOWN) {
+	  GstAudioInfo info;
+
+	  gst_audio_info_init(&info);
+	  gst_audio_info_set_format(&info,
+				    format,
+				    wavformat->nSamplesPerSec,
+				    wavformat->nChannels,
+				    NULL);
+	  mediacaps = gst_audio_info_to_caps(&info);
+	}
 
         if (mediacaps) {
           src->pins_mediatypes =
@@ -847,9 +765,9 @@
     return FALSE;
   }
 
-  g_mutex_lock (src->gbarray_lock);
+  g_mutex_lock (&src->gbarray_lock);
   g_byte_array_prepend (src->gbarray, buffer, size);
-  g_mutex_unlock (src->gbarray_lock);
+  g_mutex_unlock (&src->gbarray_lock);
 
   return TRUE;
 }
diff --git a/sys/dshowsrcwrapper/gstdshowaudiosrc.h b/sys/dshowsrcwrapper/gstdshowaudiosrc.h
index 9052663..dcd4342 100644
--- a/sys/dshowsrcwrapper/gstdshowaudiosrc.h
+++ b/sys/dshowsrcwrapper/gstdshowaudiosrc.h
@@ -25,7 +25,6 @@
 
 #include <gst/gst.h>
 #include <gst/audio/gstaudiosrc.h>
-#include <gst/interfaces/propertyprobe.h>
 
 #include "gstdshow.h"
 #include "gstdshowfakesink.h"
@@ -67,7 +66,7 @@
 
   /* bytes array */
   GByteArray *gbarray;
-  GMutex *gbarray_lock;
+  GMutex gbarray_lock;
 
   gboolean is_running;
 };
diff --git a/sys/dshowsrcwrapper/gstdshowfakesink.cpp b/sys/dshowsrcwrapper/gstdshowfakesink.cpp
index 2ef298c..c524c7c 100644
--- a/sys/dshowsrcwrapper/gstdshowfakesink.cpp
+++ b/sys/dshowsrcwrapper/gstdshowfakesink.cpp
@@ -25,7 +25,7 @@
 m_hres (S_OK),
 m_callback (NULL),
 m_data (NULL),
-CBaseRenderer (CLSID_DshowFakeSink, _T("DshowFakeSink"), NULL, &m_hres)
+CBaseRenderer (CLSID_DshowFakeSink, TEXT("DshowFakeSink"), NULL, &m_hres)
 {
 }
 
diff --git a/sys/dshowsrcwrapper/gstdshowvideosrc.cpp b/sys/dshowsrcwrapper/gstdshowvideosrc.cpp
index 52d8f2f..846c050 100644
--- a/sys/dshowsrcwrapper/gstdshowvideosrc.cpp
+++ b/sys/dshowsrcwrapper/gstdshowvideosrc.cpp
@@ -34,22 +34,35 @@
 static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_BGR ";"
-        GST_VIDEO_CAPS_YUV ("{ I420 }") ";"
-        GST_VIDEO_CAPS_YUV ("{ YUY2 }") ";"
-        GST_VIDEO_CAPS_YUV ("{ UYVY }") ";"
-        "video/x-dv,"
-        "systemstream = (boolean) FALSE,"
-        "width = (int) [ 1, MAX ],"
-        "height = (int) [ 1, MAX ],"
-        "framerate = (fraction) [ 0, MAX ],"
-        "format = (fourcc) dvsd;" "video/x-dv," "systemstream = (boolean) TRUE")
+    GST_STATIC_CAPS ("video/x-raw, format=(string) { "
+        GST_VIDEO_NE(BGR)  ", "
+        GST_VIDEO_NE(I420) ", "
+        GST_VIDEO_NE(YUY2) ", "
+        GST_VIDEO_NE(UYVY) " }, "
+        "width = " GST_VIDEO_SIZE_RANGE ", "
+        "height = " GST_VIDEO_SIZE_RANGE ", "
+        "framerate = " GST_VIDEO_FPS_RANGE "; "
+
+        "video/x-dv, "
+        "format= (string) DVSD, "
+        "width = " GST_VIDEO_SIZE_RANGE ", "
+        "height = " GST_VIDEO_SIZE_RANGE ", "
+        "framerate = " GST_VIDEO_FPS_RANGE ", "
+        "systemstream = (boolean) { TRUE, FALSE }; "
+
+        "image/jpeg, "
+        "width = " GST_VIDEO_SIZE_RANGE ", "
+        "height = " GST_VIDEO_SIZE_RANGE ", "
+        "framerate = " GST_VIDEO_FPS_RANGE "; "
+
+        "video/x-h264, "
+        "width = " GST_VIDEO_SIZE_RANGE ", "
+        "height = " GST_VIDEO_SIZE_RANGE ", "
+        "framerate = " GST_VIDEO_FPS_RANGE
+        )
     );
 
-static void gst_dshowvideosrc_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstDshowVideoSrc, gst_dshowvideosrc, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_dshowvideosrc_init_interfaces);
+G_DEFINE_TYPE (GstDshowVideoSrc, gst_dshowvideosrc, GST_TYPE_PUSH_SRC)
 
 enum
 {
@@ -58,26 +71,12 @@
   PROP_DEVICE_NAME
 };
 
-static void gst_dshowvideosrc_probe_interface_init (GstPropertyProbeInterface *
-    iface);
-static const GList *gst_dshowvideosrc_probe_get_properties (GstPropertyProbe *
-    probe);
-static GValueArray *gst_dshowvideosrc_probe_get_values (GstPropertyProbe *
-    probe, guint prop_id, const GParamSpec * pspec);
-static GValueArray *gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc *
-    src);
-static gboolean gst_dshowvideosrc_probe_needs_probe (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec);
-static void gst_dshowvideosrc_probe_probe_property (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec);
-
 
 static void gst_dshowvideosrc_dispose (GObject * gobject);
 static void gst_dshowvideosrc_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_dshowvideosrc_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
-static GstCaps *gst_dshowvideosrc_get_caps (GstBaseSrc * src);
 static GstStateChangeReturn gst_dshowvideosrc_change_state (GstElement *
     element, GstStateChange transition);
 
@@ -87,8 +86,8 @@
 static gboolean gst_dshowvideosrc_unlock (GstBaseSrc * bsrc);
 static gboolean gst_dshowvideosrc_unlock_stop (GstBaseSrc * bsrc);
 static gboolean gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps);
-static GstCaps *gst_dshowvideosrc_get_caps (GstBaseSrc * bsrc);
-static void gst_dshowvideosrc_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
+static GstCaps *gst_dshowvideosrc_get_caps (GstBaseSrc * bsrc, GstCaps * filter);
+static GstCaps *gst_dshowvideosrc_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
 static GstFlowReturn gst_dshowvideosrc_create (GstPushSrc * psrc,
     GstBuffer ** buf);
 
@@ -101,42 +100,6 @@
     gpointer src_object, GstClockTime duration);
 
 static void
-gst_dshowvideosrc_init_interfaces (GType type)
-{
-  static const GInterfaceInfo dshowvideosrc_info = {
-    (GInterfaceInitFunc) gst_dshowvideosrc_probe_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type,
-      GST_TYPE_PROPERTY_PROBE, &dshowvideosrc_info);
-}
-
-static void
-gst_dshowvideosrc_probe_interface_init (GstPropertyProbeInterface * iface)
-{
-  iface->get_properties = gst_dshowvideosrc_probe_get_properties;
-  iface->needs_probe = gst_dshowvideosrc_probe_needs_probe;
-  iface->probe_property = gst_dshowvideosrc_probe_probe_property;
-  iface->get_values = gst_dshowvideosrc_probe_get_values;
-}
-
-static void
-gst_dshowvideosrc_base_init (gpointer klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_template));
-
-  gst_element_class_set_static_metadata (element_class,
-      "DirectShow video capture source", "Source/Video",
-      "Receive data from a directshow video capture graph",
-      "Sebastien Moutte <sebastien@moutte.net>");
-}
-
-static void
 gst_dshowvideosrc_class_init (GstDshowVideoSrcClass * klass)
 {
   GObjectClass *gobject_class;
@@ -158,8 +121,8 @@
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_dshowvideosrc_change_state);
 
-  gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_dshowvideosrc_get_caps);
   gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_dshowvideosrc_set_caps);
+  gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_dshowvideosrc_get_caps);
   gstbasesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_dshowvideosrc_src_fixate);
   gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_dshowvideosrc_start);
   gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_dshowvideosrc_stop);
@@ -181,13 +144,21 @@
           "Human-readable name of the sound device", NULL,
           static_cast < GParamFlags > (G_PARAM_READWRITE)));
 
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&src_template));
+
+  gst_element_class_set_static_metadata (gstelement_class,
+      "DirectShow video capture source", "Source/Video",
+      "Receive data from a directshow video capture graph",
+      "Sebastien Moutte <sebastien@moutte.net>");
+
   GST_DEBUG_CATEGORY_INIT (dshowvideosrc_debug, "dshowvideosrc", 0,
       "Directshow video source");
 
 }
 
 static void
-gst_dshowvideosrc_init (GstDshowVideoSrc * src, GstDshowVideoSrcClass * klass)
+gst_dshowvideosrc_init (GstDshowVideoSrc * src)
 {
   src->device = NULL;
   src->device_name = NULL;
@@ -198,6 +169,7 @@
   src->caps = NULL;
   src->pins_mediatypes = NULL;
   src->is_rgb = FALSE;
+  src->is_running = FALSE;
 
   /*added for analog input*/
   src->graph_builder = NULL;
@@ -205,8 +177,8 @@
   src->pVC = NULL;
   src->pVSC = NULL;
 
-  src->buffer_cond = g_cond_new ();
-  src->buffer_mutex = g_mutex_new ();
+  g_cond_init(&src->buffer_cond);
+  g_mutex_init(&src->buffer_mutex);
   src->buffer = NULL;
   src->stop_requested = FALSE;
 
@@ -215,7 +187,7 @@
   gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
 }
 
-static void
+static GstCaps *
 gst_dshowvideosrc_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
 {
   /* If there is no desired video size, set default video size to device preffered video size */
@@ -247,6 +219,10 @@
           pin_mediatype->defaultFPS, 1);
     }
   }
+
+  caps = GST_BASE_SRC_CLASS (gst_dshowvideosrc_parent_class)->fixate(bsrc, caps);
+
+  return caps;
 }
 
 static void
@@ -280,156 +256,12 @@
     src->video_cap_filter = NULL;
   }
 
-  if (src->buffer_mutex) {
-    g_mutex_free (src->buffer_mutex);
-    src->buffer_mutex = NULL;
-  }
-
-  if (src->buffer_cond) {
-    g_cond_free (src->buffer_cond);
-    src->buffer_cond = NULL;
-  }
-
-  if (src->buffer) {
-    gst_buffer_unref (src->buffer);
-    src->buffer = NULL;
-  }
+  g_cond_clear(&src->buffer_cond);
+  g_mutex_clear(&src->buffer_mutex);
 
   CoUninitialize ();
 
-  G_OBJECT_CLASS (parent_class)->dispose (gobject);
-}
-
-static gboolean
-gst_dshowvideosrc_probe_needs_probe (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec)
-{
-  static gboolean init = FALSE;
-  gboolean ret = FALSE;
-
-  if (!init) {
-    ret = TRUE;
-    init = TRUE;
-  }
-
-  return ret;
-}
-
-static void
-gst_dshowvideosrc_probe_probe_property (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec)
-{
-  GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
-
-  switch (prop_id) {
-    case PROP_DEVICE_NAME:
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-      break;
-  }
-}
-
-static const GList *
-gst_dshowvideosrc_probe_get_properties (GstPropertyProbe * probe)
-{
-  GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
-  static GList *props = NULL;
-
-  if (!props) {
-    GParamSpec *pspec;
-
-    pspec = g_object_class_find_property (klass, "device-name");
-    props = g_list_append (props, pspec);
-  }
-
-  return props;
-}
-
-static GValueArray *
-gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc * src)
-{
-  GValueArray *array = g_value_array_new (0);
-  ICreateDevEnum *devices_enum = NULL;
-  IEnumMoniker *moniker_enum = NULL;
-  IMoniker *moniker = NULL;
-  HRESULT hres = S_FALSE;
-  ULONG fetched;
-
-  hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
-      IID_ICreateDevEnum, (LPVOID *) & devices_enum);
-  if (hres != S_OK) {
-    GST_ERROR ("Can't create system device enumerator (error=0x%x)", hres);
-    array = NULL;
-    goto clean;
-  }
-
-  hres = devices_enum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory,
-      &moniker_enum, 0);
-  if (hres != S_OK || !moniker_enum) {
-    GST_ERROR ("Can't get enumeration of video devices (error=0x%x)", hres);
-    array = NULL;
-    goto clean;
-  }
-
-  moniker_enum->Reset ();
-
-  while (hres = moniker_enum->Next (1, &moniker, &fetched), hres == S_OK) {
-    IPropertyBag *property_bag = NULL;
-
-    hres =
-        moniker->BindToStorage (NULL, NULL, IID_IPropertyBag,
-        (LPVOID *) & property_bag);
-    if (SUCCEEDED (hres) && property_bag) {
-      VARIANT varFriendlyName;
-
-      VariantInit (&varFriendlyName);
-      hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
-      if (hres == S_OK && varFriendlyName.bstrVal) {
-        gchar *friendly_name =
-            g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
-            wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
-
-        GValue value = { 0 };
-        g_value_init (&value, G_TYPE_STRING);
-        g_value_set_string (&value, friendly_name);
-        g_value_array_append (array, &value);
-        g_value_unset (&value);
-        g_free (friendly_name);
-        SysFreeString (varFriendlyName.bstrVal);
-      }
-      property_bag->Release ();
-    }
-    moniker->Release ();
-  }
-
-clean:
-  if (moniker_enum)
-    moniker_enum->Release ();
-
-  if (devices_enum)
-    devices_enum->Release ();
-
-  return array;
-}
-
-static GValueArray *
-gst_dshowvideosrc_probe_get_values (GstPropertyProbe * probe,
-    guint prop_id, const GParamSpec * pspec)
-{
-  GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (probe);
-  GValueArray *array = NULL;
-
-  switch (prop_id) {
-    case PROP_DEVICE_NAME:
-      array = gst_dshowvideosrc_get_device_name_values (src);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-      break;
-  }
-
-  return array;
+  G_OBJECT_CLASS (gst_dshowvideosrc_parent_class)->dispose (gobject);
 }
 
 static void
@@ -475,7 +307,7 @@
 }
 
 static GstCaps *
-gst_dshowvideosrc_get_caps (GstBaseSrc * basesrc)
+gst_dshowvideosrc_get_caps (GstBaseSrc * basesrc, GstCaps * filter)
 {
   HRESULT hres = S_OK;
   IBindCtx *lpbc = NULL;
@@ -569,7 +401,15 @@
   }
 
   if (src->caps) {
-    return gst_caps_ref (src->caps);
+    GstCaps *caps;
+
+    if (filter) {
+      caps = gst_caps_intersect_full (filter, src->caps, GST_CAPS_INTERSECT_FIRST);
+    } else {
+      caps = gst_caps_ref (src->caps);
+    }
+
+    return caps;
   }
 
   return NULL;
@@ -587,10 +427,15 @@
     case GST_STATE_CHANGE_READY_TO_PAUSED:
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-      if (src->media_filter)
+      if (src->media_filter) {
+	/* Setting this to TRUE because set_caps may be invoked before
+	   Run() returns. */
+	src->is_running = TRUE;
         hres = src->media_filter->Run (0);
+      }
       if (hres != S_OK) {
         GST_ERROR ("Can't RUN the directshow capture graph (error=0x%x)", hres);
+	src->is_running = FALSE;
         return GST_STATE_CHANGE_FAILURE;
       }
       break;
@@ -601,6 +446,7 @@
         GST_ERROR ("Can't STOP the directshow capture graph (error=%d)", hres);
         return GST_STATE_CHANGE_FAILURE;
       }
+      src->is_running = FALSE;
       break;
     case GST_STATE_CHANGE_PAUSED_TO_READY:
       break;
@@ -608,7 +454,7 @@
       break;
   }
 
-  return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  return GST_ELEMENT_CLASS(gst_dshowvideosrc_parent_class)->change_state(element, transition);
 }
 
 static gboolean
@@ -690,7 +536,7 @@
 											&MEDIATYPE_Video, src->video_cap_filter,
 											IID_IAMStreamConfig, (LPVOID *)&src->pVSC);
 	  if (hres != S_OK) {
-		  // this means we can't set frame rate (non-DV only)
+                  /* this means we can't set frame rate (non-DV only) */
 		  GST_ERROR ("Error %x: Cannot find VCapture:IAMStreamConfig",	hres);
 			goto error;
 	  }
@@ -741,6 +587,26 @@
   IPin *input_pin = NULL;
   GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (bsrc);
   GstStructure *s = gst_caps_get_structure (caps, 0);
+  GstCaps *current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (bsrc));
+
+  if (current_caps) {
+    if (gst_caps_is_equal (caps, current_caps)) {
+      gst_caps_unref (current_caps);
+      return TRUE;
+    }
+    gst_caps_unref (current_caps);
+  }
+
+  /* Same remark as in gstdshowaudiosrc. */
+  gboolean was_running = src->is_running;
+  if (was_running) {
+    HRESULT hres = src->media_filter->Stop ();
+    if (hres != S_OK) {
+      GST_ERROR ("Can't STOP the directshow capture graph (error=0x%x)", hres);
+      return FALSE;
+    }
+    src->is_running = FALSE;
+  }
 
   /* search the negociated caps in our caps list to get its index and the corresponding mediatype */
   if (gst_caps_is_subset (caps, src->caps)) {
@@ -808,6 +674,16 @@
           goto error;
         }
 
+        if (gst_dshow_is_pin_connected (pin_mediatype->capture_pin)) {
+          GST_DEBUG_OBJECT (src,
+              "capture_pin already connected, disconnecting");
+          src->filter_graph->Disconnect (pin_mediatype->capture_pin);
+        }
+
+        if (gst_dshow_is_pin_connected (input_pin)) {
+          GST_DEBUG_OBJECT (src, "input_pin already connected, disconnecting");
+          src->filter_graph->Disconnect (input_pin);
+        }
 
         hres = src->filter_graph->ConnectDirect (pin_mediatype->capture_pin,
             input_pin, pin_mediatype->mediatype);
@@ -824,20 +700,30 @@
         gst_structure_get_int (s, "width", &src->width);
         gst_structure_get_int (s, "height", &src->height);
 
-        src->is_rgb = FALSE;
-        caps_string = gst_caps_to_string (caps);
-        if (caps_string) {
-          if (strstr (caps_string, "video/x-raw-rgb")) {
-            src->is_rgb = TRUE;
-          } else {
-            src->is_rgb = FALSE;
-          }
-          g_free (caps_string);
-        }
+	GstVideoInfo info;
+	gst_video_info_from_caps(&info, caps);
+	switch (GST_VIDEO_INFO_FORMAT(&info)) {
+          case GST_VIDEO_FORMAT_RGB:
+          case GST_VIDEO_FORMAT_BGR:
+	    src->is_rgb = TRUE;
+	    break;
+	default:
+	  src->is_rgb = FALSE;
+	  break;
+	}
       }
     }
   }
 
+  if (was_running) {
+    HRESULT hres = src->media_filter->Run (0);
+    if (hres != S_OK) {
+      GST_ERROR ("Can't RUN the directshow capture graph (error=0x%x)", hres);
+      return FALSE;
+    }
+    src->is_running = TRUE;
+  }
+
   return TRUE;
 
 error:
@@ -924,10 +810,10 @@
 {
   GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (bsrc);
 
-  g_mutex_lock (src->buffer_mutex);
+  g_mutex_lock (&src->buffer_mutex);
   src->stop_requested = TRUE;
-  g_cond_signal (src->buffer_cond);
-  g_mutex_unlock (src->buffer_mutex);
+  g_cond_signal (&src->buffer_cond);
+  g_mutex_unlock (&src->buffer_mutex);
 
   return TRUE;
 }
@@ -947,12 +833,12 @@
 {
   GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (psrc);
 
-  g_mutex_lock (src->buffer_mutex);
+  g_mutex_lock (&src->buffer_mutex);
   while (src->buffer == NULL && !src->stop_requested)
-    g_cond_wait (src->buffer_cond, src->buffer_mutex);
+    g_cond_wait (&src->buffer_cond, &src->buffer_mutex);
   *buf = src->buffer;
   src->buffer = NULL;
-  g_mutex_unlock (src->buffer_mutex);
+  g_mutex_unlock (&src->buffer_mutex);
 
   if (src->stop_requested) {
     if (*buf != NULL) {
@@ -976,7 +862,6 @@
   HRESULT hres = S_OK;
   int icount = 0;
   int isize = 0;
-  VIDEO_STREAM_CONFIG_CAPS vscc;
   int i = 0;
   IAMStreamConfig *streamcaps = NULL;
 
@@ -988,7 +873,7 @@
 
   streamcaps->GetNumberOfCapabilities (&icount, &isize);
 
-  if (isize != sizeof (vscc)) {
+  if (isize != sizeof (VIDEO_STREAM_CONFIG_CAPS)) {
     streamcaps->Release ();
     return NULL;
   }
@@ -1024,6 +909,18 @@
 
         pin_mediatype->granularityWidth = 0;
         pin_mediatype->granularityHeight = 0;
+
+      } else if (gst_dshow_check_mediatype (pin_mediatype->mediatype,
+              MEDIASUBTYPE_MJPG, FORMAT_VideoInfo)) {
+        mediacaps =
+            gst_dshow_new_video_caps (GST_VIDEO_FORMAT_ENCODED,
+            "image/jpeg", pin_mediatype);
+
+      } else if (gst_dshow_check_mediatype (pin_mediatype->mediatype,
+              MEDIASUBTYPE_H264, FORMAT_VideoInfo)) {
+        mediacaps =
+            gst_dshow_new_video_caps (GST_VIDEO_FORMAT_ENCODED,
+            "video/x-h264", pin_mediatype);
       }
 
       if (mediacaps) {
@@ -1068,10 +965,18 @@
     GstCaps *mediacaps = NULL;
     GstVideoFormat video_format = gst_dshow_guid_to_gst_video_format (pin_mediatype->mediatype);
 
-    if (video_format != GST_VIDEO_FORMAT_UNKNOWN)
-      mediacaps = gst_video_format_new_caps (video_format, 
-          pin_mediatype->defaultWidth, pin_mediatype->defaultHeight,
-          pin_mediatype->defaultFPS, 1, 1, 1);
+	if (video_format != GST_VIDEO_FORMAT_UNKNOWN) {
+		GstVideoInfo info;
+
+		gst_video_info_init(&info);
+		gst_video_info_set_format(&info, video_format, pin_mediatype->defaultWidth, pin_mediatype->defaultHeight);
+		info.fps_n = pin_mediatype->defaultFPS;
+		info.fps_d = 1;
+		info.par_n = 1;
+		info.par_d = 1;
+		info.interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE; /* XXX is this correct ? */
+		mediacaps = gst_video_info_to_caps(&info);
+	}
 
     if (mediacaps) {
       src->pins_mediatypes =
@@ -1102,6 +1007,7 @@
   IPin *pPin = NULL;
   HRESULT hres = S_FALSE;
   AM_MEDIA_TYPE *pMediaType = NULL;
+  GstMapInfo info;
 
   if (!buffer || size == 0 || !src) {
     return FALSE;
@@ -1110,7 +1016,7 @@
   /* create a new buffer assign to it the clock time as timestamp */
   buf = gst_buffer_new_and_alloc (size);
 
-  GST_BUFFER_SIZE (buf) = size;
+  gst_buffer_set_size(buf, size);
 
   GstClock *clock = gst_element_get_clock (GST_ELEMENT (src));
   GST_BUFFER_TIMESTAMP (buf) =
@@ -1119,6 +1025,12 @@
 
   GST_BUFFER_DURATION (buf) = duration;
 
+  if (!gst_buffer_map(buf, &info, GST_MAP_WRITE)) {
+	  gst_buffer_unref(buf);
+	  GST_ERROR("Failed to map buffer");
+	  return FALSE;
+  }
+
   if (src->is_rgb) {
     /* FOR RGB directshow decoder will return bottom-up BITMAP
      * There is probably a way to get top-bottom video frames from
@@ -1128,26 +1040,25 @@
     gint stride = size / src->height;
 
     for (; line < src->height; line++) {
-      memcpy (GST_BUFFER_DATA (buf) + (line * stride),
+      memcpy (info.data + (line * stride),
           buffer + (size - ((line + 1) * (stride))), stride);
     }
   } else {
-    memcpy (GST_BUFFER_DATA (buf), buffer, size);
+    memcpy (info.data, buffer, size);
   }
 
+  gst_buffer_unmap(buf, &info);
+
   GST_DEBUG ("push_buffer => pts %" GST_TIME_FORMAT "duration %"
       GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
       GST_TIME_ARGS (duration));
 
-  /* the negotiate() method already set caps on the source pad */
-  gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
-
-  g_mutex_lock (src->buffer_mutex);
+  g_mutex_lock (&src->buffer_mutex);
   if (src->buffer != NULL)
     gst_buffer_unref (src->buffer);
   src->buffer = buf;
-  g_cond_signal (src->buffer_cond);
-  g_mutex_unlock (src->buffer_mutex);
+  g_cond_signal (&src->buffer_cond);
+  g_mutex_unlock (&src->buffer_mutex);
 
   return TRUE;
 }
diff --git a/sys/dshowsrcwrapper/gstdshowvideosrc.h b/sys/dshowsrcwrapper/gstdshowvideosrc.h
index 9c07528..684ffd6 100644
--- a/sys/dshowsrcwrapper/gstdshowvideosrc.h
+++ b/sys/dshowsrcwrapper/gstdshowvideosrc.h
@@ -25,7 +25,6 @@
 #include <glib.h>
 #include <gst/gst.h>
 #include <gst/base/gstpushsrc.h>
-#include <gst/interfaces/propertyprobe.h>
 
 #include "gstdshow.h"
 #include "gstdshowfakesink.h"
@@ -80,12 +79,13 @@
   IAMStreamConfig *pVSC;      // for video cap
 
   /* the last buffer from DirectShow */
-  GCond *buffer_cond;
-  GMutex *buffer_mutex;
+  GCond buffer_cond;
+  GMutex buffer_mutex;
   GstBuffer *buffer;
   gboolean stop_requested;
 
   gboolean is_rgb;
+  gboolean is_running;
   gint width;
   gint height;
 };
diff --git a/sys/dshowvideosink/Makefile.in b/sys/dshowvideosink/Makefile.in
index b45019c..0957632 100644
--- a/sys/dshowvideosink/Makefile.in
+++ b/sys/dshowvideosink/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -161,8 +161,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -201,7 +205,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -209,6 +212,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -258,8 +263,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -338,7 +341,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -347,7 +349,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -360,7 +361,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -385,6 +385,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -458,10 +460,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -487,6 +493,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -523,6 +532,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -563,17 +573,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -590,6 +599,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/dshowvideosink/dshowvideofakesrc.cpp b/sys/dshowvideosink/dshowvideofakesrc.cpp
index 5e76e64..f622155 100644
--- a/sys/dshowvideosink/dshowvideofakesrc.cpp
+++ b/sys/dshowvideosink/dshowvideofakesrc.cpp
@@ -250,12 +250,16 @@
 GstFlowReturn VideoFakeSrcPin::PushBuffer(GstBuffer *buffer)
 {
   IMediaSample *pSample = NULL;
-  byte *data = GST_BUFFER_DATA (buffer);
+  byte *data;
+  GstMapInfo map;
   int attempts = 0;
   HRESULT hres;
   BYTE *sample_buffer;
   AM_MEDIA_TYPE *mediatype;
 
+  /* FIXME: check return value. */
+  gst_buffer_map (buffer, &map, GST_MAP_READ);
+  data = map.data;
   StartUsingOutputPin();
 
   while (attempts < MAX_ATTEMPTS)
@@ -287,6 +291,7 @@
      */
     CopyToDestinationBuffer (data, sample_buffer);
   }
+  gst_buffer_unmap (buffer, &map);
 
   pSample->SetDiscontinuity(FALSE); /* Decoded frame; unimportant */
   pSample->SetSyncPoint(TRUE); /* Decoded frame; always a valid syncpoint */
diff --git a/sys/dshowvideosink/dshowvideosink.cpp b/sys/dshowvideosink/dshowvideosink.cpp
index bf5641c..ac0536c 100644
--- a/sys/dshowvideosink/dshowvideosink.cpp
+++ b/sys/dshowvideosink/dshowvideosink.cpp
@@ -25,8 +25,9 @@
 #include "dshowvideosink.h"
 #include "dshowvideofakesrc.h"
 
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/navigation.h>
+#include <gst/video/video.h>
+#include <gst/video/videooverlay.h>
+#include <gst/video/navigation.h>
 
 #include "windows.h"
 
@@ -48,17 +49,24 @@
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS (
-        "video/x-raw-yuv,"
+        "video/x-raw,"
         "width = (int) [ 1, MAX ],"
         "height = (int) [ 1, MAX ],"
         "framerate = (fraction) [ 0, MAX ]," 
-        "format = {(fourcc)YUY2, (fourcc)UYVY, (fourcc) YUVY, (fourcc)YV12 }")
+        "format = {(string)YUY2, (string)UYVY, (string)YV12 }")
     );
 
 static void gst_dshowvideosink_init_interfaces (GType type);
 
-GST_BOILERPLATE_FULL (GstDshowVideoSink, gst_dshowvideosink, GstVideoSink,
-    GST_TYPE_VIDEO_SINK, gst_dshowvideosink_init_interfaces);
+static void gst_dshowvideosink_videooverlay_init (GstVideoOverlayInterface *iface);
+static void
+gst_dshowvideosink_navigation_interface_init (GstNavigationInterface * iface);
+
+#define gst_dshowvideosink_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstDshowVideoSink, gst_dshowvideosink,
+                         GST_TYPE_VIDEO_SINK,
+                         G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY, gst_dshowvideosink_videooverlay_init);
+                         G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION, gst_dshowvideosink_navigation_interface_init))
 
 enum
 {
@@ -84,7 +92,7 @@
 static gboolean gst_dshowvideosink_unlock (GstBaseSink * bsink);
 static gboolean gst_dshowvideosink_unlock_stop (GstBaseSink * bsink);
 static gboolean gst_dshowvideosink_set_caps (GstBaseSink * bsink, GstCaps * caps);
-static GstCaps *gst_dshowvideosink_get_caps (GstBaseSink * bsink);
+static GstCaps *gst_dshowvideosink_get_caps (GstBaseSink * bsink, GstCaps * filter);
 static GstFlowReturn gst_dshowvideosink_show_frame (GstVideoSink *sink, GstBuffer *buffer);
 static void gst_dshowvideosink_set_window_for_renderer (GstDshowVideoSink *sink);
 
@@ -95,22 +103,9 @@
  * different stride to GStreamer's implicit values. 
  */
 
-static gboolean
-gst_dshowvideosink_interface_supported (GstImplementsInterface * iface,
-    GType type)
-{
-  g_assert (type == GST_TYPE_X_OVERLAY || type == GST_TYPE_NAVIGATION);
-  return TRUE;
-}
-
 static void
-gst_dshowvideosink_interface_init (GstImplementsInterfaceClass * klass)
-{
-  klass->supported = gst_dshowvideosink_interface_supported;
-}
+gst_dshowvideosink_set_window_handle (GstVideoOverlay * overlay, guintptr window_id)
 
-static void
-gst_dshowvideosink_set_window_handle (GstXOverlay * overlay, guintptr window_id)
 {
   GstDshowVideoSink *sink = GST_DSHOWVIDEOSINK (overlay);
   HWND previous_window = sink->window_id;
@@ -146,7 +141,7 @@
 }
 
 static void
-gst_dshowvideosink_expose (GstXOverlay * overlay)
+gst_dshowvideosink_expose (GstVideoOverlay * overlay)
 {
   GstDshowVideoSink *sink = GST_DSHOWVIDEOSINK (overlay);
 
@@ -156,7 +151,7 @@
 }
 
 static void
-gst_dshowvideosink_xoverlay_interface_init (GstXOverlayClass * iface)
+gst_dshowvideosink_videooverlay_init (GstVideoOverlayInterface * iface)
 {
   iface->set_window_handle = gst_dshowvideosink_set_window_handle;
   iface->expose = gst_dshowvideosink_expose;
@@ -172,6 +167,8 @@
 
   event = gst_event_new_navigation (structure);
 
+  /* FXIME: handle aspect ratio. */
+
   pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sink));
 
   if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
@@ -184,53 +181,14 @@
 static void
 gst_dshowvideosink_navigation_interface_init (GstNavigationInterface * iface)
 {
+  /* FIXME: navigation interface partially implemented.
+   * Need to call gst_navigation_send_mouse_event and
+   * gst_navigation_send_key_event like in directdrawsink.
+   */
   iface->send_event = gst_dshowvideosink_navigation_send_event;
 }
 
 static void
-gst_dshowvideosink_init_interfaces (GType type)
-{
-  static const GInterfaceInfo iface_info = {
-    (GInterfaceInitFunc) gst_dshowvideosink_interface_init,
-    NULL,
-    NULL,
-  };
-
-  static const GInterfaceInfo xoverlay_info = {
-    (GInterfaceInitFunc) gst_dshowvideosink_xoverlay_interface_init,
-    NULL,
-    NULL,
-  };
-
-  static const GInterfaceInfo navigation_info = {
-    (GInterfaceInitFunc) gst_dshowvideosink_navigation_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
-      &iface_info);
-  g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &xoverlay_info);
-  g_type_add_interface_static (type, GST_TYPE_NAVIGATION, &navigation_info);
-
-  GST_DEBUG_CATEGORY_INIT (dshowvideosink_debug, "dshowvideosink", 0, \
-      "DirectShow video sink");
-}
-static void
-gst_dshowvideosink_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_set_static_metadata (element_class, "DirectShow video sink",
-      "Sink/Video", "Display data using a DirectShow video renderer",
-      "Pioneers of the Inevitable <songbird@songbirdnest.com>, " \
-      "FLUENDO S.A. <support@fluendo.com>");
-}
-
-static void
 gst_dshowvideosink_class_init (GstDshowVideoSinkClass * klass)
 {
   GObjectClass *o_class;
@@ -247,6 +205,14 @@
   o_class->set_property = gst_dshowvideosink_set_property;
   o_class->get_property = gst_dshowvideosink_get_property;
 
+  gst_element_class_set_static_metadata (e_class, "DirectShow video sink",
+      "Sink/Video", "Display data using a DirectShow video renderer",
+      "Pioneers of the Inevitable <songbird@songbirdnest.com>, " \
+      "FLUENDO S.A. <support@fluendo.com>");
+
+  gst_element_class_add_pad_template (e_class,
+      gst_static_pad_template_get (&sink_template));
+
   e_class->change_state = GST_DEBUG_FUNCPTR (gst_dshowvideosink_change_state);
 
   bs_class->get_caps = GST_DEBUG_FUNCPTR (gst_dshowvideosink_get_caps);
@@ -297,26 +263,25 @@
 }
 
 static void
-gst_dshowvideosink_init (GstDshowVideoSink * sink, GstDshowVideoSinkClass * klass)
+gst_dshowvideosink_init (GstDshowVideoSink * sink)
 {
   gst_dshowvideosink_clear (sink);
 
-  sink->graph_lock = g_mutex_new();
-  sink->com_init_lock = g_mutex_new();
-  sink->com_deinit_lock = g_mutex_new();
-  sink->com_initialized = g_cond_new();
-  sink->com_uninitialize = g_cond_new();
-  sink->com_uninitialized = g_cond_new();
+  g_mutex_init (&sink->graph_lock);
+  g_mutex_init (&sink->com_init_lock);
+  g_mutex_init (&sink->com_deinit_lock);
+  g_cond_init (&sink->com_initialized);
+  g_cond_init (&sink->com_uninitialize);
+  g_cond_init (&sink->com_uninitialized);
 
-  g_mutex_lock (sink->com_init_lock);
+  g_mutex_lock (&sink->com_init_lock);
 
   /* create the COM initialization thread */
-  g_thread_create ((GThreadFunc)gst_dshowvideosink_com_thread,
-      sink, FALSE, NULL);
+  g_thread_new ("gstdshowvideosinkcomthread", (GThreadFunc)gst_dshowvideosink_com_thread, sink);
 
   /* wait until the COM thread signals that COM has been initialized */
-  g_cond_wait (sink->com_initialized, sink->com_init_lock);
-  g_mutex_unlock (sink->com_init_lock);
+  g_cond_wait (&sink->com_initialized, &sink->com_init_lock);
+  g_mutex_unlock (&sink->com_init_lock);
 }
 
 static void
@@ -329,19 +294,19 @@
 
   /* signal the COM thread that it sould uninitialize COM */
   if (sink->comInitialized) {
-    g_mutex_lock (sink->com_deinit_lock);
-    g_cond_signal (sink->com_uninitialize);
-    g_cond_wait (sink->com_uninitialized, sink->com_deinit_lock);
-    g_mutex_unlock (sink->com_deinit_lock);
+    g_mutex_lock (&sink->com_deinit_lock);
+    g_cond_signal (&sink->com_uninitialize);
+    g_cond_wait (&sink->com_uninitialized, &sink->com_deinit_lock);
+    g_mutex_unlock (&sink->com_deinit_lock);
   }
 
-  g_mutex_free (sink->com_init_lock);
-  g_mutex_free (sink->com_deinit_lock);
-  g_cond_free (sink->com_initialized);
-  g_cond_free (sink->com_uninitialize);
-  g_cond_free (sink->com_uninitialized);
+  g_mutex_clear (&sink->com_init_lock);
+  g_mutex_clear (&sink->com_deinit_lock);
+  g_cond_clear (&sink->com_initialized);
+  g_cond_clear (&sink->com_uninitialize);
+  g_cond_clear (&sink->com_uninitialized);
 
-  g_mutex_free (sink->graph_lock);
+  g_mutex_clear (&sink->graph_lock);
 
   G_OBJECT_CLASS (parent_class)->finalize (gobject);
 }
@@ -400,7 +365,7 @@
 {
   HRESULT res;
 
-  g_mutex_lock (sink->com_init_lock);
+  g_mutex_lock (&sink->com_init_lock);
 
   /* Initialize COM with a MTA for this process. This thread will
    * be the first one to enter the apartement and the last one to leave
@@ -417,27 +382,28 @@
   sink->comInitialized = TRUE;
 
   /* Signal other threads waiting on this condition that COM was initialized */
-  g_cond_signal (sink->com_initialized);
+  g_cond_signal (&sink->com_initialized);
 
-  g_mutex_unlock (sink->com_init_lock);
+  g_mutex_unlock (&sink->com_init_lock);
 
   /* Wait until the unitialize condition is met to leave the COM apartement */
-  g_mutex_lock (sink->com_deinit_lock);
-  g_cond_wait (sink->com_uninitialize, sink->com_deinit_lock);
+  g_mutex_lock (&sink->com_deinit_lock);
+  g_cond_wait (&sink->com_uninitialize, &sink->com_deinit_lock);
 
   CoUninitialize ();
   GST_INFO_OBJECT (sink, "COM unintialized succesfully");
   sink->comInitialized = FALSE;
-  g_cond_signal (sink->com_uninitialized);
-  g_mutex_unlock (sink->com_deinit_lock);
+  g_cond_signal (&sink->com_uninitialized);
+  g_mutex_unlock (&sink->com_deinit_lock);
 }
 
 static GstCaps *
-gst_dshowvideosink_get_caps (GstBaseSink * basesink)
+gst_dshowvideosink_get_caps (GstBaseSink * basesink, GstCaps * filter)
 {
   GstDshowVideoSink *sink = GST_DSHOWVIDEOSINK (basesink);
+  GstCaps *ret = NULL;
 
-  return NULL;
+  return ret;
 }
 
 static void dump_available_media_types (IPin *pin)
@@ -717,7 +683,7 @@
   sink->window_id = video_window;
 
   /* signal application we created a window */
-  gst_x_overlay_got_window_handle (GST_X_OVERLAY (sink),
+  gst_video_overlay_got_window_handle (GST_VIDEO_OVERLAY (sink),
       (gulong)video_window);
 
   /* Set the renderer's clipping window */
@@ -759,8 +725,9 @@
   if (sink->window_created_signal == NULL)
     goto failed;
 
-  sink->window_thread = g_thread_create (
-      (GThreadFunc) gst_dshowvideosink_window_thread, sink, TRUE, NULL);
+  sink -> window_thread = g_thread_new ("windowthread",
+                                        (GThreadFunc) gst_dshowvideosink_window_thread,
+                                        sink);
 
   /* wait maximum 10 seconds for window to be created */
   if (WaitForSingleObject (sink->window_created_signal,
@@ -813,7 +780,7 @@
 
   /* Give the app a last chance to supply a window id */
   if (!sink->window_id) {
-    gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (sink));
+    gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (sink));
   }
 
   /* If the app supplied one, use it. Otherwise, go ahead
@@ -1732,17 +1699,14 @@
 
   /* TODO: Add  RGB types. */
   if (IsEqualGUID (mediatype->subtype, MEDIASUBTYPE_YUY2))
-    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", GST_TYPE_VIDEO_FORMAT, GST_VIDEO_FORMAT_YUY2, NULL);
   else if (IsEqualGUID (mediatype->subtype, MEDIASUBTYPE_UYVY))
-    caps = gst_caps_new_simple ("video/x-raw-yuv", 
-            "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), NULL);
-  else if (IsEqualGUID (mediatype->subtype, MEDIASUBTYPE_YUYV))
-    caps = gst_caps_new_simple ("video/x-raw-yuv", 
-            "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'), NULL);
+    caps = gst_caps_new_simple ("video/x-raw",
+            "format", GST_TYPE_VIDEO_FORMAT, GST_VIDEO_FORMAT_UYVY, NULL);
   else if (IsEqualGUID (mediatype->subtype, MEDIASUBTYPE_YV12))
-    caps = gst_caps_new_simple ("video/x-raw-yuv", 
-            "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'V', '1', '2'), NULL);
+    caps = gst_caps_new_simple ("video/x-raw",
+            "format", GST_TYPE_VIDEO_FORMAT, GST_VIDEO_FORMAT_YV12, NULL);
 
   if (!caps) {
     GST_DEBUG ("No subtype known; cannot continue");
@@ -1811,55 +1775,47 @@
 gst_caps_to_directshow_media_type (GstDshowVideoSink * sink, GstCaps *caps,
     AM_MEDIA_TYPE *mediatype)
 {
-  GstStructure *s = gst_caps_get_structure (caps, 0);
-  const gchar *name = gst_structure_get_name (s);
+  GstVideoInfo info;
+  int width, height;
+  int bpp;
 
-  gchar *capsstring = gst_caps_to_string (caps);
-  GST_DEBUG_OBJECT (sink, "Converting caps \"%s\" to AM_MEDIA_TYPE", capsstring);
-  g_free (capsstring);
-
+  gst_video_info_init (&info);
+  if (!gst_video_info_from_caps (&info, caps))
+  {
+    GST_WARNING_OBJECT (sink, "Couldn't parse caps");
+      return FALSE;
+  }
   memset (mediatype, 0, sizeof (AM_MEDIA_TYPE));
 
-  if (!strcmp (name, "video/x-raw-yuv")) {
+  if (GST_VIDEO_FORMAT_INFO_IS_YUV (info.finfo))
+  {
     guint32 fourcc;
-    int width, height;
-    int bpp;
-
-    if (!gst_structure_get_fourcc (s, "format", &fourcc)) {
-      GST_WARNING_OBJECT (sink, "Failed to convert caps, no fourcc");
-      return FALSE;
-    }
-
-    if (!gst_structure_get_int (s, "width", &width)) {
-      GST_WARNING_OBJECT (sink, "Failed to convert caps, no width");
-      return FALSE;
-    }
-    if (!gst_structure_get_int (s, "height", &height)) {
-      GST_WARNING_OBJECT (sink, "Failed to convert caps, no height");
-      return FALSE;
-    }
-
+    GST_VIDEO_SINK_WIDTH (sink) = info.width;
+    GST_VIDEO_SINK_HEIGHT (sink) = info.height;
+    width = info.width;
+    height = info.height;
     mediatype->majortype = MEDIATYPE_Video;
-    switch (fourcc) {
-      case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
-        mediatype->subtype = MEDIASUBTYPE_YUY2;
-        bpp = 16;
-        break;
-      case GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'):
-        mediatype->subtype = MEDIASUBTYPE_YUYV;
-        bpp = 16;
-        break;
-      case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
-        mediatype->subtype = MEDIASUBTYPE_UYVY;
-        bpp = 16;
-        break;
-      case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
-        mediatype->subtype = MEDIASUBTYPE_YV12;
-        bpp = 12;
-        break;
-      default:
-        GST_WARNING_OBJECT (sink, "Failed to convert caps, not a known fourcc");
-        return FALSE;
+
+    switch (GST_VIDEO_INFO_FORMAT (&info))
+    {
+        case GST_VIDEO_FORMAT_YUY2:
+          mediatype->subtype = MEDIASUBTYPE_YUY2;
+          fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
+          bpp = 16;
+          break;
+        case GST_VIDEO_FORMAT_UYVY:
+          mediatype->subtype = MEDIASUBTYPE_UYVY;
+          fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
+          bpp = 16;
+          break;
+        case GST_VIDEO_FORMAT_YV12:
+          mediatype->subtype = MEDIASUBTYPE_YV12;
+          fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
+          bpp = 12;
+          break;
+        default:
+          GST_WARNING_OBJECT (sink, "Couldn't parse caps");
+          return FALSE;
     }
 
     mediatype->bFixedSizeSamples = TRUE; /* Always true for raw video */
@@ -1886,8 +1842,9 @@
 
       vi->rcTarget.top = 0;
       vi->rcTarget.left = 0;
-      if (sink->keep_aspect_ratio &&
-          gst_structure_get_fraction (s, "pixel-aspect-ratio", &par_n, &par_d)) {
+      if (sink->keep_aspect_ratio) {
+        par_n = GST_VIDEO_INFO_PAR_N (&info);
+        par_d = GST_VIDEO_INFO_PAR_D (&info);
         /* To handle non-square pixels, we set the target rectangle to a 
          * different size than the source rectangle.
          * There might be a better way, but this seems to work. */
diff --git a/sys/dshowvideosink/dshowvideosink.h b/sys/dshowvideosink/dshowvideosink.h
index 325e1b2..9a7bda0 100644
--- a/sys/dshowvideosink/dshowvideosink.h
+++ b/sys/dshowvideosink/dshowvideosink.h
@@ -21,6 +21,7 @@
 #define __DSHOWVIDEOSINK_H__
 
 #include <gst/gst.h>
+#include <gst/video/video.h>
 #include <gst/video/gstvideosink.h>
 
 #include "dshowvideofakesrc.h"
@@ -43,8 +44,8 @@
 typedef struct _GstDshowVideoSink GstDshowVideoSink;
 typedef struct _GstDshowVideoSinkClass GstDshowVideoSinkClass;
 
-#define GST_DSHOWVIDEOSINK_GRAPH_LOCK(sink)	g_mutex_lock (GST_DSHOWVIDEOSINK (sink)->graph_lock)
-#define GST_DSHOWVIDEOSINK_GRAPH_UNLOCK(clock) g_mutex_unlock (GST_DSHOWVIDEOSINK (sink)->graph_lock)
+#define GST_DSHOWVIDEOSINK_GRAPH_LOCK(sink)	g_mutex_lock (&GST_DSHOWVIDEOSINK (sink)->graph_lock)
+#define GST_DSHOWVIDEOSINK_GRAPH_UNLOCK(clock) g_mutex_unlock (&GST_DSHOWVIDEOSINK (sink)->graph_lock)
 
 /* Renderer-specific support classes */
 class RendererSupport
@@ -106,14 +107,14 @@
   WNDPROC prevWndProc;
 
   /* Lock for transitions */
-  GMutex *graph_lock;
+  GMutex graph_lock;
 
   gboolean comInitialized;
-  GMutex   *com_init_lock;
-  GMutex   *com_deinit_lock;
-  GCond    *com_initialized;
-  GCond    *com_uninitialize;
-  GCond    *com_uninitialized;
+  GMutex   com_init_lock;
+  GMutex   com_deinit_lock;
+  GCond    com_initialized;
+  GCond    com_uninitialize;
+  GCond    com_uninitialized;
 };
 
 struct _GstDshowVideoSinkClass
diff --git a/sys/dvb/Makefile.in b/sys/dvb/Makefile.in
index 48ee30c..49ebda2 100644
--- a/sys/dvb/Makefile.in
+++ b/sys/dvb/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -253,8 +253,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -293,7 +297,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -301,6 +304,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -350,8 +355,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -430,7 +433,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -439,7 +441,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -452,7 +453,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -477,6 +477,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -550,10 +552,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -579,6 +585,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -615,6 +624,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -655,17 +665,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -682,6 +691,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/dvb/camapplication.c b/sys/dvb/camapplication.c
index 3fe0b91..c4e6d43 100644
--- a/sys/dvb/camapplication.c
+++ b/sys/dvb/camapplication.c
@@ -47,7 +47,7 @@
   const gchar *description;
 } CamTagMessage;
 
-static CamTagMessage debugmessage[] = {
+static const CamTagMessage debugmessage[] = {
   {TAG_PROFILE_ENQUIRY, "PROFILE_ENQUIRY"},
   {TAG_PROFILE_REPLY, "PROFILE_REPLY"},
   {TAG_PROFILE_CHANGE, "PROFILE_CHANGE"},
diff --git a/sys/dvb/camtransport.c b/sys/dvb/camtransport.c
index 9bde7dd..c166b3d 100644
--- a/sys/dvb/camtransport.c
+++ b/sys/dvb/camtransport.c
@@ -63,7 +63,7 @@
   const gchar *description;
 } CamTagMessage;
 
-static CamTagMessage debugmessage[] = {
+static const CamTagMessage debugmessage[] = {
   {TAG_SB, "SB"},
   {TAG_RCV, "RCV"},
   {TAG_CREATE_T_C, "CREATE_T_C"},
diff --git a/sys/dvb/dvbbasebin.c b/sys/dvb/dvbbasebin.c
index 9deb9e9..2e6dcfd 100644
--- a/sys/dvb/dvbbasebin.c
+++ b/sys/dvb/dvbbasebin.c
@@ -1,9 +1,11 @@
 /*
  * dvbbasebin.c - 
  * Copyright (C) 2007 Alessandro Decina
+ * Copyright (C) 2014 Samsung Electronics. All rights reserved.
  * 
  * Authors:
  *   Alessandro Decina <alessandro@nnva.org>
+ *   Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -52,6 +54,7 @@
   SIGNAL_TUNING_START,
   SIGNAL_TUNING_DONE,
   SIGNAL_TUNING_FAIL,
+  SIGNAL_TUNE,
   LAST_SIGNAL
 };
 
@@ -79,8 +82,29 @@
   PROP_PILOT,
   PROP_ROLLOFF,
   PROP_STREAM_ID,
-  PROP_BANDWIDTH_HZ
-      /* FILL ME */
+  PROP_BANDWIDTH_HZ,
+  PROP_ISDBT_LAYER_ENABLED,
+  PROP_ISDBT_PARTIAL_RECEPTION,
+  PROP_ISDBT_SOUND_BROADCASTING,
+  PROP_ISDBT_SB_SUBCHANNEL_ID,
+  PROP_ISDBT_SB_SEGMENT_IDX,
+  PROP_ISDBT_SB_SEGMENT_COUNT,
+  PROP_ISDBT_LAYERA_FEC,
+  PROP_ISDBT_LAYERA_MODULATION,
+  PROP_ISDBT_LAYERA_SEGMENT_COUNT,
+  PROP_ISDBT_LAYERA_TIME_INTERLEAVING,
+  PROP_ISDBT_LAYERB_FEC,
+  PROP_ISDBT_LAYERB_MODULATION,
+  PROP_ISDBT_LAYERB_SEGMENT_COUNT,
+  PROP_ISDBT_LAYERB_TIME_INTERLEAVING,
+  PROP_ISDBT_LAYERC_FEC,
+  PROP_ISDBT_LAYERC_MODULATION,
+  PROP_ISDBT_LAYERC_SEGMENT_COUNT,
+  PROP_ISDBT_LAYERC_TIME_INTERLEAVING,
+  PROP_LNB_SLOF,
+  PROP_LNB_LOF1,
+  PROP_LNB_LOF2,
+  PROP_INTERLEAVING
 };
 
 typedef struct
@@ -138,6 +162,8 @@
 static void tuning_done_signal_cb (GObject * object, DvbBaseBin * dvbbasebin);
 static void tuning_fail_signal_cb (GObject * object, DvbBaseBin * dvbbasebin);
 
+static void dvb_base_bin_do_tune (DvbBaseBin * dvbbasebin);
+
 #define dvb_base_bin_parent_class parent_class
 G_DEFINE_TYPE_EXTENDED (DvbBaseBin, dvb_base_bin, GST_TYPE_BIN,
     0,
@@ -230,6 +256,11 @@
   g_signal_emit (dvbbasebin, dvb_base_bin_signals[SIGNAL_TUNING_FAIL], 0);
 }
 
+static void
+dvb_base_bin_do_tune (DvbBaseBin * dvbbasebin)
+{
+  g_signal_emit_by_name (dvbbasebin->dvbsrc, "tune", NULL);
+}
 
 static void
 dvb_base_bin_class_init (DvbBaseBinClass * klass)
@@ -237,6 +268,7 @@
   GObjectClass *gobject_class;
   GstElementClass *element_class;
   GstBinClass *bin_class;
+  DvbBaseBinClass *dvbbasebin_class;
   GstElementFactory *dvbsrc_factory;
   GObjectClass *dvbsrc_class;
   typedef struct
@@ -252,7 +284,9 @@
     {PROP_FREQUENCY, "frequency"},
     {PROP_POLARITY, "polarity"},
     {PROP_SYMBOL_RATE, "symbol-rate"},
+#ifndef GST_REMOVE_DEPRECATED
     {PROP_BANDWIDTH, "bandwidth"},
+#endif
     {PROP_CODE_RATE_HP, "code-rate-hp"},
     {PROP_CODE_RATE_LP, "code-rate-lp"},
     {PROP_GUARD, "guard"},
@@ -267,6 +301,28 @@
     {PROP_ROLLOFF, "rolloff"},
     {PROP_STREAM_ID, "stream-id"},
     {PROP_BANDWIDTH_HZ, "bandwidth-hz"},
+    {PROP_ISDBT_LAYER_ENABLED, "isdbt-layer-enabled"},
+    {PROP_ISDBT_PARTIAL_RECEPTION, "isdbt-partial-reception"},
+    {PROP_ISDBT_SOUND_BROADCASTING, "isdbt-sound-broadcasting"},
+    {PROP_ISDBT_SB_SUBCHANNEL_ID, "isdbt-sb-subchannel-id"},
+    {PROP_ISDBT_SB_SEGMENT_IDX, "isdbt-sb-segment-idx"},
+    {PROP_ISDBT_SB_SEGMENT_COUNT, "isdbt-sb-segment-count"},
+    {PROP_ISDBT_LAYERA_FEC, "isdbt-layera-fec"},
+    {PROP_ISDBT_LAYERA_MODULATION, "isdbt-layera-modulation"},
+    {PROP_ISDBT_LAYERA_SEGMENT_COUNT, "isdbt-layera-segment-count"},
+    {PROP_ISDBT_LAYERA_TIME_INTERLEAVING, "isdbt-layera-time-interleaving"},
+    {PROP_ISDBT_LAYERB_FEC, "isdbt-layerb-fec"},
+    {PROP_ISDBT_LAYERB_MODULATION, "isdbt-layerb-modulation"},
+    {PROP_ISDBT_LAYERB_SEGMENT_COUNT, "isdbt-layerb-segment-count"},
+    {PROP_ISDBT_LAYERB_TIME_INTERLEAVING, "isdbt-layerb-time-interleaving"},
+    {PROP_ISDBT_LAYERC_FEC, "isdbt-layerc-fec"},
+    {PROP_ISDBT_LAYERC_MODULATION, "isdbt-layerc-modulation"},
+    {PROP_ISDBT_LAYERC_SEGMENT_COUNT, "isdbt-layerc-segment-count"},
+    {PROP_ISDBT_LAYERC_TIME_INTERLEAVING, "isdbt-layerc-time-interleaving"},
+    {PROP_LNB_SLOF, "lnb-slof"},
+    {PROP_LNB_LOF1, "lnb-lof1"},
+    {PROP_LNB_LOF2, "lnb-lof2"},
+    {PROP_INTERLEAVING, "interleaving"},
     {0, NULL}
   };
 
@@ -287,7 +343,8 @@
   gst_element_class_set_static_metadata (element_class, "DVB bin",
       "Source/Bin/Video",
       "Access descramble and split DVB streams",
-      "Alessandro Decina <alessandro@nnva.org>");
+      "Alessandro Decina <alessandro@nnva.org>\n"
+      "Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>");
 
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->set_property = dvb_base_bin_set_property;
@@ -295,6 +352,9 @@
   gobject_class->dispose = dvb_base_bin_dispose;
   gobject_class->finalize = dvb_base_bin_finalize;
 
+  dvbbasebin_class = (DvbBaseBinClass *) klass;
+  dvbbasebin_class->do_tune = dvb_base_bin_do_tune;
+
   /* install dvbsrc properties */
   dvbsrc_factory = gst_element_factory_find ("dvbsrc");
   dvbsrc_class =
@@ -390,6 +450,18 @@
       g_signal_new ("tuning-fail", G_TYPE_FROM_CLASS (klass),
       G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
 
+  /**
+   * DvbBaseBin::tune:
+   * @dvbbasesink: the element on which the signal is emitted
+   *
+   * Signal emited from the application to the element, instructing it
+   * to tune.
+   */
+  dvb_base_bin_signals[SIGNAL_TUNE] =
+      g_signal_new ("tune", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+      G_STRUCT_OFFSET (DvbBaseBinClass, do_tune),
+      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
 }
 
 static void
@@ -403,7 +475,7 @@
   dvbbasebin->trycam = TRUE;
 }
 
-static gint16 initial_pids[] = { 0, 1, 0x10, 0x11, 0x12, 0x14, -1 };
+static const gint16 initial_pids[] = { 0, 1, 0x10, 0x11, 0x12, 0x14, -1 };
 
 static void
 dvb_base_bin_init (DvbBaseBin * dvbbasebin)
@@ -561,6 +633,28 @@
     case PROP_ROLLOFF:
     case PROP_STREAM_ID:
     case PROP_BANDWIDTH_HZ:
+    case PROP_ISDBT_LAYER_ENABLED:
+    case PROP_ISDBT_PARTIAL_RECEPTION:
+    case PROP_ISDBT_SOUND_BROADCASTING:
+    case PROP_ISDBT_SB_SUBCHANNEL_ID:
+    case PROP_ISDBT_SB_SEGMENT_IDX:
+    case PROP_ISDBT_SB_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERA_FEC:
+    case PROP_ISDBT_LAYERA_MODULATION:
+    case PROP_ISDBT_LAYERA_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERA_TIME_INTERLEAVING:
+    case PROP_ISDBT_LAYERB_FEC:
+    case PROP_ISDBT_LAYERB_MODULATION:
+    case PROP_ISDBT_LAYERB_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERB_TIME_INTERLEAVING:
+    case PROP_ISDBT_LAYERC_FEC:
+    case PROP_ISDBT_LAYERC_MODULATION:
+    case PROP_ISDBT_LAYERC_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERC_TIME_INTERLEAVING:
+    case PROP_LNB_SLOF:
+    case PROP_LNB_LOF1:
+    case PROP_LNB_LOF2:
+    case PROP_INTERLEAVING:
       /* FIXME: check if we can tune (state < PLAYING || program-numbers == "") */
       g_object_set_property (G_OBJECT (dvbbasebin->dvbsrc), pspec->name, value);
       break;
@@ -600,6 +694,28 @@
     case PROP_ROLLOFF:
     case PROP_STREAM_ID:
     case PROP_BANDWIDTH_HZ:
+    case PROP_ISDBT_LAYER_ENABLED:
+    case PROP_ISDBT_PARTIAL_RECEPTION:
+    case PROP_ISDBT_SOUND_BROADCASTING:
+    case PROP_ISDBT_SB_SUBCHANNEL_ID:
+    case PROP_ISDBT_SB_SEGMENT_IDX:
+    case PROP_ISDBT_SB_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERA_FEC:
+    case PROP_ISDBT_LAYERA_MODULATION:
+    case PROP_ISDBT_LAYERA_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERA_TIME_INTERLEAVING:
+    case PROP_ISDBT_LAYERB_FEC:
+    case PROP_ISDBT_LAYERB_MODULATION:
+    case PROP_ISDBT_LAYERB_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERB_TIME_INTERLEAVING:
+    case PROP_ISDBT_LAYERC_FEC:
+    case PROP_ISDBT_LAYERC_MODULATION:
+    case PROP_ISDBT_LAYERC_SEGMENT_COUNT:
+    case PROP_ISDBT_LAYERC_TIME_INTERLEAVING:
+    case PROP_LNB_SLOF:
+    case PROP_LNB_LOF1:
+    case PROP_LNB_LOF2:
+    case PROP_INTERLEAVING:
       g_object_get_property (G_OBJECT (dvbbasebin->dvbsrc), pspec->name, value);
       break;
     case PROP_PROGRAM_NUMBERS:
diff --git a/sys/dvb/dvbbasebin.h b/sys/dvb/dvbbasebin.h
index 27a91b5..8454c92 100644
--- a/sys/dvb/dvbbasebin.h
+++ b/sys/dvb/dvbbasebin.h
@@ -71,6 +71,7 @@
   GstBinClass parent_class;
 
   /* signals */
+  void (*do_tune) (DvbBaseBin * dvbbasebin);
 };
 
 GType dvb_base_bin_get_type(void);
diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c
index 721517b..adbc973 100644
--- a/sys/dvb/gstdvbsrc.c
+++ b/sys/dvb/gstdvbsrc.c
@@ -22,30 +22,34 @@
 /**
  * SECTION:element-dvbsrc
  *
- * dvbsrc can be used to capture video from DVB cards, DVB-T, DVB-S or DVB-T.
- * 
+ * dvbsrc can be used to capture media from DVB cards. Supported DTV
+ * broadcasting standards include DVB-T/C/S, ATSC ,ISDB-T and DTMB.
+ *
  * <refsect2>
  * <title>Example launch line</title>
  * |[
  * gst-launch dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 frequency=514000000 code-rate-lp=AUTO code-rate-hp=2/3 guard=4  hierarchy=0 ! mpegtsdemux name=demux ! queue max-size-buffers=0 max-size-time=0 ! mpeg2dec ! xvimagesink demux. ! queue max-size-buffers=0 max-size-time=0 ! mad ! alsasink
- * ]| Captures a full transport stream from dvb card 0 that is a DVB-T card at tuned frequency 514000000 with other parameters as seen in the pipeline and renders the first tv program on the transport stream.
+ * ]| Captures a full transport stream from DVB card 0 that is a DVB-T card at tuned frequency 514000000 Hz with other parameters as seen in the pipeline and renders the first TV program on the transport stream.
  * |[
  * gst-launch dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 frequency=514000000 code-rate-lp=AUTO code-rate-hp=2/3 guard=4  hierarchy=0 pids=100:256:257 ! mpegtsdemux name=demux ! queue max-size-buffers=0 max-size-time=0 ! mpeg2dec ! xvimagesink demux. ! queue max-size-buffers=0 max-size-time=0 ! mad ! alsasink
- * ]| Captures and renders a transport stream from dvb card 0 that is a DVB-T card for a program at tuned frequency 514000000 with PMT pid 100 and elementary stream pids of 256, 257 with other parameters as seen in the pipeline.
+ * ]| Captures and renders a transport stream from DVB card 0 that is a DVB-T card for a program at tuned frequency 514000000 Hz with PMT PID 100 and elementary stream PIDs of 256, 257 with other parameters as seen in the pipeline.
  * |[
  * gst-launch dvbsrc polarity="h" frequency=11302000 symbol-rate=27500 diseqc-source=0 pids=50:102:103 ! mpegtsdemux name=demux ! queue max-size-buffers=0 max-size-time=0 ! mpeg2dec ! xvimagesink demux. ! queue max-size-buffers=0 max-size-time=0 ! mad ! alsasink
- * ]| Captures and renders a transport stream from dvb card 0 that is a DVB-S card for a program at tuned frequency 11302000 Hz, symbol rate of 27500 kHz with PMT pid of 50 and elementary stream pids of 102 and 103.
+ * ]| Captures and renders a transport stream from DVB card 0 that is a DVB-S card for a program at tuned frequency 11302000 kHz, symbol rate of 27500 kBd (kilo bauds) with PMT PID of 50 and elementary stream PIDs of 102 and 103.
+ * |[
+ gst-launch dvbsrc frequency=515142857 guard=16 trans-mode="8k" isdbt-layer-enabled=7 isdbt-partial-reception=1 isdbt-layera-fec="2/3" isdbt-layera-modulation="QPSK" isdbt-layera-segment-count=1 isdbt-layera-time-interleaving=4 isdbt-layerb-fec="3/4" isdbt-layerb-modulation="qam-64" isdbt-layerb-segment-count=12 isdbt-layerb-time-interleaving=2 isdbt-layerc-fec="1/2" isdbt-layerc-modulation="qam-64" isdbt-layerc-segment-count=0 isdbt-layerc-time-interleaving=0 delsys="isdb-t" ! tsdemux ! "video/x-h264" ! h264parse ! queue ! avdec_h264 ! videoconvert ! queue ! autovideosink
+ * ]| Captures and renders the video track of TV Paraíba HD (Globo affiliate) in Campina Grande, Brazil. This is an ISDB-T (Brazilian ISDB-Tb variant) broadcast.
  * </refsect2>
  */
 
-/* 
+/*
  * History of DVB_API_VERSION 5 minor changes
  *
  * API Addition/changes in reverse order (most recent first)
  *
  * Minor 10 (statistics properties)
  *   DTV_STAT_*
- *   FE_SCALE_* 
+ *   FE_SCALE_*
  *
  * Minor 9
  *   DTV_LNA
@@ -72,32 +76,12 @@
  *
  * Somewhere in between 5 and 6:
  *   SYS_DVBC_ANNEX_A / _C (Safety #define for _AC => A)
- * 
+ *
  * Minor 5 (Note : minimum version we support according to configure.ac)
  *   DTV_ENUM_DELSYS
- *
- * Minor 4
- *   SYS_TURBO
- *
- * Minor 3 (DVB-T2)
- *   TRANSMISSION_MODE_1K / _16K / _32K
- *   BANDWIDTH_5_MHZ / _10_MHZ / _1_712_MHZ
- *   GUARD_INTERVAL_1_128 / _19_128 / _19_256
- *   DTV_DVBT2_PLP_ID (/!\ renamed in minor 8 !)
- *   SYS_DVBT2
- *
- * Minor 2
- *   FE_CAN_TURBO_FEC
- *   DTV_ISDBS_TS_ID (/!\ renamed in minor 8 !)
- *
- * Minor 1 (ISDB-T and ISDB-Tsb)
- *   TRANSMISSION_MODE_4K
- *   DTV_ISDBT_* (for those not defined in later version)
- *
- * Minor 0 : initial version
  */
 
-/* We know we have at least DVB_API_VERSION >= 5 */
+/* We know we have at least DVB_API_VERSION >= 5 (minor 5) */
 #define HAVE_V5_MINOR(minor) ((DVB_API_VERSION > 5) || \
 			      (DVB_API_VERSION_MINOR >= (minor)))
 
@@ -143,11 +127,13 @@
 GST_DEBUG_CATEGORY_STATIC (gstdvbsrc_debug);
 #define GST_CAT_DEFAULT (gstdvbsrc_debug)
 
-#define SLOF (11700*1000UL)
-#define LOF1 (9750*1000UL)
-#define LOF2 (10600*1000UL)
-
-#define NUM_DTV_PROPS 16
+/**
+ * Can't be greater than DTV_IOCTL_MAX_MSGS but we are
+ * not using more than 25 for the largest use case (ISDB-T).
+ *
+ * Bump as needed.
+ */
+#define NUM_DTV_PROPS 25
 
 /* Signals */
 enum
@@ -155,6 +141,7 @@
   SIGNAL_TUNING_START,
   SIGNAL_TUNING_DONE,
   SIGNAL_TUNING_FAIL,
+  SIGNAL_TUNE,
   LAST_SIGNAL
 };
 
@@ -186,7 +173,29 @@
   ARG_DVBSRC_PILOT,
   ARG_DVBSRC_ROLLOFF,
   ARG_DVBSRC_STREAM_ID,
-  ARG_DVBSRC_BANDWIDTH_HZ
+  ARG_DVBSRC_BANDWIDTH_HZ,
+  ARG_DVBSRC_ISDBT_LAYER_ENABLED,
+  ARG_DVBSRC_ISDBT_PARTIAL_RECEPTION,
+  ARG_DVBSRC_ISDBT_SOUND_BROADCASTING,
+  ARG_DVBSRC_ISDBT_SB_SUBCHANNEL_ID,
+  ARG_DVBSRC_ISDBT_SB_SEGMENT_IDX,
+  ARG_DVBSRC_ISDBT_SB_SEGMENT_COUNT,
+  ARG_DVBSRC_ISDBT_LAYERA_FEC,
+  ARG_DVBSRC_ISDBT_LAYERA_MODULATION,
+  ARG_DVBSRC_ISDBT_LAYERA_SEGMENT_COUNT,
+  ARG_DVBSRC_ISDBT_LAYERA_TIME_INTERLEAVING,
+  ARG_DVBSRC_ISDBT_LAYERB_FEC,
+  ARG_DVBSRC_ISDBT_LAYERB_MODULATION,
+  ARG_DVBSRC_ISDBT_LAYERB_SEGMENT_COUNT,
+  ARG_DVBSRC_ISDBT_LAYERB_TIME_INTERLEAVING,
+  ARG_DVBSRC_ISDBT_LAYERC_FEC,
+  ARG_DVBSRC_ISDBT_LAYERC_MODULATION,
+  ARG_DVBSRC_ISDBT_LAYERC_SEGMENT_COUNT,
+  ARG_DVBSRC_ISDBT_LAYERC_TIME_INTERLEAVING,
+  ARG_DVBSRC_LNB_SLOF,
+  ARG_DVBSRC_LNB_LOF1,
+  ARG_DVBSRC_LNB_LOF2,
+  ARG_DVBSRC_INTERLEAVING
 };
 
 #define DEFAULT_ADAPTER 0
@@ -214,6 +223,32 @@
 #define DEFAULT_PILOT PILOT_AUTO
 #define DEFAULT_ROLLOFF ROLLOFF_AUTO
 #define DEFAULT_STREAM_ID NO_STREAM_ID_FILTER
+#define DEFAULT_ISDBT_LAYER_ENABLED 7
+#define DEFAULT_ISDBT_PARTIAL_RECEPTION 1
+#define DEFAULT_ISDBT_SOUND_BROADCASTING 0
+#define DEFAULT_ISDBT_SB_SUBCHANNEL_ID -1
+#define DEFAULT_ISDBT_SB_SEGMENT_IDX 0
+#define DEFAULT_ISDBT_SB_SEGMENT_COUNT 1
+#define DEFAULT_ISDBT_LAYERA_FEC FEC_AUTO
+#define DEFAULT_ISDBT_LAYERA_MODULATION QAM_AUTO
+#define DEFAULT_ISDBT_LAYERA_SEGMENT_COUNT -1
+#define DEFAULT_ISDBT_LAYERA_TIME_INTERLEAVING -1
+#define DEFAULT_ISDBT_LAYERB_FEC FEC_AUTO
+#define DEFAULT_ISDBT_LAYERB_MODULATION QAM_AUTO
+#define DEFAULT_ISDBT_LAYERB_SEGMENT_COUNT -1
+#define DEFAULT_ISDBT_LAYERB_TIME_INTERLEAVING -1
+#define DEFAULT_ISDBT_LAYERC_FEC FEC_AUTO
+#define DEFAULT_ISDBT_LAYERC_MODULATION QAM_AUTO
+#define DEFAULT_ISDBT_LAYERC_SEGMENT_COUNT -1
+#define DEFAULT_ISDBT_LAYERC_TIME_INTERLEAVING -1
+#define DEFAULT_LNB_SLOF (11700*1000UL)
+#define DEFAULT_LNB_LOF1 (9750*1000UL)
+#define DEFAULT_LNB_LOF2 (10600*1000UL)
+#if HAVE_V5_MINOR(7)
+#define DEFAULT_INTERLEAVING INTERLEAVING_AUTO
+#else
+#define DEFAULT_INTERLEAVING 0
+#endif
 
 static void gst_dvbsrc_output_frontend_stats (GstDvbSrc * src);
 
@@ -222,7 +257,7 @@
 gst_dvbsrc_code_rate_get_type (void)
 {
   static GType dvbsrc_code_rate_type = 0;
-  static GEnumValue code_rate_types[] = {
+  static const GEnumValue code_rate_types[] = {
     {FEC_NONE, "NONE", "none"},
     {FEC_1_2, "1/2", "1/2"},
     {FEC_2_3, "2/3", "2/3"},
@@ -233,6 +268,9 @@
     {FEC_7_8, "7/8", "7/8"},
     {FEC_8_9, "8/9", "8/9"},
     {FEC_AUTO, "AUTO", "auto"},
+    {FEC_3_5, "3/5", "3/5"},
+    {FEC_9_10, "9/10", "9/10"},
+    {FEC_2_5, "2/5", "2/5"},
     {0, NULL, NULL},
   };
 
@@ -248,7 +286,7 @@
 gst_dvbsrc_modulation_get_type (void)
 {
   static GType dvbsrc_modulation_type = 0;
-  static GEnumValue modulation_types[] = {
+  static const GEnumValue modulation_types[] = {
     {QPSK, "QPSK", "qpsk"},
     {QAM_16, "QAM 16", "qam-16"},
     {QAM_32, "QAM 32", "qam-32"},
@@ -259,6 +297,10 @@
     {VSB_8, "8VSB", "8vsb"},
     {VSB_16, "16VSB", "16vsb"},
     {PSK_8, "8PSK", "8psk"},
+    {APSK_16, "16APSK", "16apsk"},
+    {APSK_32, "32APSK", "32apsk"},
+    {DQPSK, "DQPSK", "dqpsk"},
+    {QAM_4_NR, "QAM 4 NR", "qam-4-nr"},
     {0, NULL, NULL},
   };
 
@@ -274,10 +316,18 @@
 gst_dvbsrc_transmission_mode_get_type (void)
 {
   static GType dvbsrc_transmission_mode_type = 0;
-  static GEnumValue transmission_mode_types[] = {
+  static const GEnumValue transmission_mode_types[] = {
     {TRANSMISSION_MODE_2K, "2K", "2k"},
     {TRANSMISSION_MODE_8K, "8K", "8k"},
     {TRANSMISSION_MODE_AUTO, "AUTO", "auto"},
+    {TRANSMISSION_MODE_4K, "4K", "4k"},
+    {TRANSMISSION_MODE_1K, "1K", "1k"},
+    {TRANSMISSION_MODE_16K, "16K", "16k"},
+    {TRANSMISSION_MODE_32K, "32K", "32k"},
+#if HAVE_V5_MINOR(7)
+    {TRANSMISSION_MODE_C1, "C1", "c1"},
+    {TRANSMISSION_MODE_C3780, "C3780", "c3780"},
+#endif
     {0, NULL, NULL},
   };
 
@@ -294,11 +344,14 @@
 gst_dvbsrc_bandwidth_get_type (void)
 {
   static GType dvbsrc_bandwidth_type = 0;
-  static GEnumValue bandwidth_types[] = {
+  static const GEnumValue bandwidth_types[] = {
     {BANDWIDTH_8_MHZ, "8", "8"},
     {BANDWIDTH_7_MHZ, "7", "7"},
     {BANDWIDTH_6_MHZ, "6", "6"},
     {BANDWIDTH_AUTO, "AUTO", "AUTO"},
+    {BANDWIDTH_5_MHZ, "5", "5"},
+    {BANDWIDTH_10_MHZ, "10", "10"},
+    {BANDWIDTH_1_712_MHZ, "1.712", "1.712"},
     {0, NULL, NULL},
   };
 
@@ -314,12 +367,20 @@
 gst_dvbsrc_guard_get_type (void)
 {
   static GType dvbsrc_guard_type = 0;
-  static GEnumValue guard_types[] = {
+  static const GEnumValue guard_types[] = {
     {GUARD_INTERVAL_1_32, "32", "32"},
     {GUARD_INTERVAL_1_16, "16", "16"},
     {GUARD_INTERVAL_1_8, "8", "8"},
     {GUARD_INTERVAL_1_4, "4", "4"},
     {GUARD_INTERVAL_AUTO, "AUTO", "auto"},
+    {GUARD_INTERVAL_1_128, "128", "128"},
+    {GUARD_INTERVAL_19_128, "19/128", "19/128"},
+    {GUARD_INTERVAL_19_256, "19/256", "19/256"},
+#if HAVE_V5_MINOR(7)
+    {GUARD_INTERVAL_PN420, "PN420", "pn420"},
+    {GUARD_INTERVAL_PN595, "PN595", "pn595"},
+    {GUARD_INTERVAL_PN945, "PN945", "pn945"},
+#endif
     {0, NULL, NULL},
   };
 
@@ -334,7 +395,7 @@
 gst_dvbsrc_hierarchy_get_type (void)
 {
   static GType dvbsrc_hierarchy_type = 0;
-  static GEnumValue hierarchy_types[] = {
+  static const GEnumValue hierarchy_types[] = {
     {HIERARCHY_NONE, "NONE", "none"},
     {HIERARCHY_1, "1", "1"},
     {HIERARCHY_2, "2", "2"},
@@ -355,7 +416,7 @@
 gst_dvbsrc_inversion_get_type (void)
 {
   static GType dvbsrc_inversion_type = 0;
-  static GEnumValue inversion_types[] = {
+  static const GEnumValue inversion_types[] = {
     {INVERSION_OFF, "OFF", "off"},
     {INVERSION_ON, "ON", "on"},
     {INVERSION_AUTO, "AUTO", "auto"},
@@ -374,7 +435,7 @@
 gst_dvbsrc_delsys_get_type (void)
 {
   static GType dvbsrc_delsys_type = 0;
-  static GEnumValue delsys_types[] = {
+  static const GEnumValue delsys_types[] = {
     {SYS_UNDEFINED, "UNDEFINED", "undefined"},
     {SYS_DVBC_ANNEX_A, "DVB-C-A", "dvb-c-a"},
     {SYS_DVBC_ANNEX_B, "DVB-C-B", "dvb-c-b"},
@@ -413,7 +474,7 @@
 gst_dvbsrc_pilot_get_type (void)
 {
   static GType dvbsrc_pilot_type = 0;
-  static GEnumValue pilot_types[] = {
+  static const GEnumValue pilot_types[] = {
     {PILOT_ON, "ON", "on"},
     {PILOT_OFF, "OFF", "off"},
     {PILOT_AUTO, "AUTO", "auto"},
@@ -431,7 +492,7 @@
 gst_dvbsrc_rolloff_get_type (void)
 {
   static GType dvbsrc_rolloff_type = 0;
-  static GEnumValue rolloff_types[] = {
+  static const GEnumValue rolloff_types[] = {
     {ROLLOFF_35, "35", "35"},
     {ROLLOFF_20, "20", "20"},
     {ROLLOFF_25, "25", "25"},
@@ -446,6 +507,28 @@
   return dvbsrc_rolloff_type;
 }
 
+#define GST_TYPE_INTERLEAVING (gst_dvbsrc_interleaving_get_type ())
+static GType
+gst_dvbsrc_interleaving_get_type (void)
+{
+  static GType dvbsrc_interleaving_type = 0;
+  static const GEnumValue interleaving_types[] = {
+#if HAVE_V5_MINOR(7)
+    {INTERLEAVING_NONE, "NONE", "none"},
+    {INTERLEAVING_AUTO, "AUTO", "auto"},
+    {INTERLEAVING_240, "240", "240"},
+    {INTERLEAVING_720, "720", "720"},
+#endif
+    {0, NULL, NULL},
+  };
+
+  if (!dvbsrc_interleaving_type) {
+    dvbsrc_interleaving_type =
+        g_enum_register_static ("GstDvbSrcInterleaving", interleaving_types);
+  }
+  return dvbsrc_interleaving_type;
+}
+
 static void gst_dvbsrc_finalize (GObject * object);
 static void gst_dvbsrc_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
@@ -465,6 +548,7 @@
 static gboolean gst_dvbsrc_is_seekable (GstBaseSrc * bsrc);
 static gboolean gst_dvbsrc_get_size (GstBaseSrc * src, guint64 * size);
 
+static void gst_dvbsrc_do_tune (GstDvbSrc * src);
 static gboolean gst_dvbsrc_tune (GstDvbSrc * object);
 static gboolean gst_dvbsrc_set_fe_params (GstDvbSrc * object,
     struct dtv_properties *props);
@@ -472,8 +556,21 @@
 
 static void gst_dvbsrc_set_pes_filters (GstDvbSrc * object);
 static void gst_dvbsrc_unset_pes_filters (GstDvbSrc * object);
-static inline int gst_dvbsrc_retry_ioctl (int fd, unsigned long req,
-    void *data);
+static gboolean gst_dvbsrc_is_valid_modulation (guint delsys, guint mod);
+
+/**
+ * This loop should be safe enough considering:
+ *
+ * 1.- EINTR suggest the next ioctl might succeed
+ * 2.- It's highly unlikely you will end up spining
+ *     before your entire system goes nuts due to
+ *     the massive number of interrupts.
+ *
+ * We don't check for EAGAIN here cause we are opening
+ * the frontend in blocking mode.
+ */
+#define LOOP_WHILE_EINTR(v,func) do { (v) = (func); } \
+		while ((v) == -1 && errno == EINTR);
 
 static GstStaticPadTemplate ts_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
@@ -504,11 +601,13 @@
   GstElementClass *gstelement_class;
   GstBaseSrcClass *gstbasesrc_class;
   GstPushSrcClass *gstpushsrc_class;
+  GstDvbSrcClass *gstdvbsrc_class;
 
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
   gstbasesrc_class = (GstBaseSrcClass *) klass;
   gstpushsrc_class = (GstPushSrcClass *) klass;
+  gstdvbsrc_class = (GstDvbSrcClass *) klass;
 
   gobject_class->set_property = gst_dvbsrc_set_property;
   gobject_class->get_property = gst_dvbsrc_get_property;
@@ -522,8 +621,9 @@
   gst_element_class_set_static_metadata (gstelement_class, "DVB Source",
       "Source/Video",
       "Digital Video Broadcast Source",
-      "P2P-VCR, C-Lab, University of Paderborn,"
-      "Zaheer Abbas Merali <zaheerabbas at merali dot org>");
+      "P2P-VCR, C-Lab, University of Paderborn, "
+      "Zaheer Abbas Merali <zaheerabbas at merali dot org>\n"
+      "Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>");
 
   gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_dvbsrc_start);
   gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_dvbsrc_stop);
@@ -534,6 +634,8 @@
 
   gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_dvbsrc_create);
 
+  gstdvbsrc_class->do_tune = GST_DEBUG_FUNCPTR (gst_dvbsrc_do_tune);
+
   g_object_class_install_property (gobject_class, ARG_DVBSRC_ADAPTER,
       g_param_spec_int ("adapter", "The adapter device number",
           "The DVB adapter device number (eg. 0 for adapter0)",
@@ -545,24 +647,29 @@
           0, 16, DEFAULT_FRONTEND, G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_FREQUENCY,
-      g_param_spec_uint ("frequency", "frequency", "Frequency",
-          0, G_MAXUINT, DEFAULT_FREQUENCY, G_PARAM_READWRITE));
+      g_param_spec_uint ("frequency", "Center frequency",
+          "Center frequency to tune into. Measured in kHz for the satellite "
+          "distribution standars and Hz for all the rest",
+          0, G_MAXUINT, DEFAULT_FREQUENCY,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_POLARITY,
       g_param_spec_string ("polarity", "polarity",
           "(DVB-S/S2) Polarity [vhHV] (eg. V for Vertical)",
-          DEFAULT_POLARITY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+          DEFAULT_POLARITY,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_PIDS,
       g_param_spec_string ("pids", "pids",
           "Colon seperated list of pids (eg. 110:120)",
-          DEFAULT_PIDS, G_PARAM_WRITABLE));
+          DEFAULT_PIDS, GST_PARAM_MUTABLE_PLAYING | G_PARAM_WRITABLE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_SYM_RATE,
       g_param_spec_uint ("symbol-rate",
           "symbol rate",
-          "(DVB-S/S2, DVB-C) Symbol rate in bauds",
-          0, G_MAXUINT, DEFAULT_SYMBOL_RATE, G_PARAM_READWRITE));
+          "(DVB-S/S2, DVB-C) Symbol rate in kBd (kilo bauds)",
+          0, G_MAXUINT, DEFAULT_SYMBOL_RATE,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_TUNE,
       g_param_spec_pointer ("tune",
@@ -573,44 +680,51 @@
           "diseqc source",
           "(DVB-S/S2) Selected DiSEqC source. Only needed if you have a "
           "DiSEqC switch. Otherwise leave at -1 (disabled)", -1, 7,
-          DEFAULT_DISEQC_SRC, G_PARAM_READWRITE));
+          DEFAULT_DISEQC_SRC, GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   /* DVB-T, additional properties */
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_BANDWIDTH_HZ,
       g_param_spec_uint ("bandwidth-hz", "bandwidth-hz",
           "(DVB-T) Bandwidth in Hz", 0, G_MAXUINT, DEFAULT_BANDWIDTH_HZ,
-          G_PARAM_READWRITE));
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
+#ifndef GST_REMOVE_DEPRECATED
   g_object_class_install_property (gobject_class, ARG_DVBSRC_BANDWIDTH,
       g_param_spec_enum ("bandwidth", "bandwidth",
           "(DVB-T) Bandwidth. Deprecated", GST_TYPE_DVBSRC_BANDWIDTH,
-          DEFAULT_BANDWIDTH, G_PARAM_READWRITE));
+          DEFAULT_BANDWIDTH,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | G_PARAM_DEPRECATED));
+#endif
 
   /* FIXME: DVB-C, DVB-S, DVB-S2 named it as innerFEC */
   g_object_class_install_property (gobject_class, ARG_DVBSRC_CODE_RATE_HP,
       g_param_spec_enum ("code-rate-hp",
           "code-rate-hp",
           "(DVB-T, DVB-S/S2 and DVB-C) High priority code rate",
-          GST_TYPE_DVBSRC_CODE_RATE, DEFAULT_CODE_RATE_HP, G_PARAM_READWRITE));
+          GST_TYPE_DVBSRC_CODE_RATE, DEFAULT_CODE_RATE_HP,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_CODE_RATE_LP,
       g_param_spec_enum ("code-rate-lp",
           "code-rate-lp",
           "(DVB-T) Low priority code rate",
-          GST_TYPE_DVBSRC_CODE_RATE, DEFAULT_CODE_RATE_LP, G_PARAM_READWRITE));
+          GST_TYPE_DVBSRC_CODE_RATE, DEFAULT_CODE_RATE_LP,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   /* FIXME: should the property be called 'guard-interval' then? */
   g_object_class_install_property (gobject_class, ARG_DVBSRC_GUARD,
       g_param_spec_enum ("guard",
           "guard",
           "(DVB-T) Guard Interval",
-          GST_TYPE_DVBSRC_GUARD, DEFAULT_GUARD, G_PARAM_READWRITE));
+          GST_TYPE_DVBSRC_GUARD, DEFAULT_GUARD,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_MODULATION,
       g_param_spec_enum ("modulation", "modulation",
-          "(DVB-T and DVB-C) Modulation type",
-          GST_TYPE_DVBSRC_MODULATION, DEFAULT_MODULATION, G_PARAM_READWRITE));
+          "(DVB-T/T2/C/S2, TURBO and ATSC) Modulation type",
+          GST_TYPE_DVBSRC_MODULATION, DEFAULT_MODULATION,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   /* FIXME: property should be named 'transmission-mode' */
   g_object_class_install_property (gobject_class,
@@ -618,24 +732,27 @@
       g_param_spec_enum ("trans-mode", "trans-mode",
           "(DVB-T) Transmission mode",
           GST_TYPE_DVBSRC_TRANSMISSION_MODE, DEFAULT_TRANSMISSION_MODE,
-          G_PARAM_READWRITE));
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_HIERARCHY_INF,
       g_param_spec_enum ("hierarchy", "hierarchy",
           "(DVB-T) Hierarchy information",
-          GST_TYPE_DVBSRC_HIERARCHY, DEFAULT_HIERARCHY, G_PARAM_READWRITE));
+          GST_TYPE_DVBSRC_HIERARCHY, DEFAULT_HIERARCHY,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_INVERSION,
       g_param_spec_enum ("inversion", "inversion",
           "(DVB-T and DVB-C) Inversion information",
-          GST_TYPE_DVBSRC_INVERSION, DEFAULT_INVERSION, G_PARAM_READWRITE));
+          GST_TYPE_DVBSRC_INVERSION, DEFAULT_INVERSION,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
       ARG_DVBSRC_STATS_REPORTING_INTERVAL,
       g_param_spec_uint ("stats-reporting-interval",
           "stats-reporting-interval",
           "The number of reads before reporting frontend stats",
-          0, G_MAXUINT, DEFAULT_STATS_REPORTING_INTERVAL, G_PARAM_READWRITE));
+          0, G_MAXUINT, DEFAULT_STATS_REPORTING_INTERVAL,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_TIMEOUT,
       g_param_spec_uint64 ("timeout", "Timeout",
@@ -645,7 +762,8 @@
   g_object_class_install_property (gobject_class, ARG_DVBSRC_TUNING_TIMEOUT,
       g_param_spec_uint64 ("tuning-timeout", "Tuning Timeout",
           "Milliseconds to wait before giving up tuning/locking on a signal",
-          0, G_MAXUINT64, DEFAULT_TUNING_TIMEOUT, G_PARAM_READWRITE));
+          0, G_MAXUINT64, DEFAULT_TUNING_TIMEOUT,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
       ARG_DVBSRC_DVB_BUFFER_SIZE,
@@ -660,16 +778,186 @@
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_PILOT,
       g_param_spec_enum ("pilot", "pilot", "Pilot (DVB-S2)",
-          GST_TYPE_DVBSRC_PILOT, DEFAULT_PILOT, G_PARAM_READWRITE));
+          GST_TYPE_DVBSRC_PILOT, DEFAULT_PILOT,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_ROLLOFF,
       g_param_spec_enum ("rolloff", "rolloff", "Rolloff (DVB-S2)",
-          GST_TYPE_DVBSRC_ROLLOFF, DEFAULT_ROLLOFF, G_PARAM_READWRITE));
+          GST_TYPE_DVBSRC_ROLLOFF, DEFAULT_ROLLOFF,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class, ARG_DVBSRC_STREAM_ID,
       g_param_spec_int ("stream-id", "stream-id",
           "(DVB-T2 and DVB-S2 max 255, ISDB max 65535) Stream ID "
-          "(-1 = disabled)", -1, 65535, DEFAULT_STREAM_ID, G_PARAM_READWRITE));
+          "(-1 = disabled)", -1, 65535, DEFAULT_STREAM_ID,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  /* Additional ISDB-T properties */
+
+  /* Valid values are 0x1 0x2 0x4 |-ables */
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYER_ENABLED,
+      g_param_spec_uint ("isdbt-layer-enabled",
+          "ISB-T layer enabled",
+          "(ISDB-T) Layer Enabled (7 = All layers)", 1, 7,
+          DEFAULT_ISDBT_LAYER_ENABLED,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_PARTIAL_RECEPTION,
+      g_param_spec_int ("isdbt-partial-reception",
+          "ISB-T partial reception",
+          "(ISDB-T) Partial Reception (-1 = AUTO)", -1, 1,
+          DEFAULT_ISDBT_PARTIAL_RECEPTION,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_SOUND_BROADCASTING,
+      g_param_spec_int ("isdbt-sound-broadcasting",
+          "ISB-T sound broadcasting",
+          "(ISDB-T) Sound Broadcasting", 0, 1,
+          DEFAULT_ISDBT_SOUND_BROADCASTING,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_SB_SUBCHANNEL_ID,
+      g_param_spec_int ("isdbt-sb-subchannel-id",
+          "ISB-T SB subchannel ID",
+          "(ISDB-T) SB Subchannel ID (-1 = AUTO)", -1, 41,
+          DEFAULT_ISDBT_SB_SEGMENT_IDX,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_SB_SEGMENT_IDX,
+      g_param_spec_int ("isdbt-sb-segment-idx",
+          "ISB-T SB segment IDX",
+          "(ISDB-T) SB segment IDX", 0, 12,
+          DEFAULT_ISDBT_SB_SEGMENT_IDX,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_SB_SEGMENT_COUNT,
+      g_param_spec_uint ("isdbt-sb-segment-count",
+          "ISB-T SB segment count",
+          "(ISDB-T) SB segment count", 1, 13,
+          DEFAULT_ISDBT_SB_SEGMENT_COUNT,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, ARG_DVBSRC_ISDBT_LAYERA_FEC,
+      g_param_spec_enum ("isdbt-layera-fec",
+          "ISDB-T layer A FEC", "(ISDB-T) layer A Forward Error Correction",
+          GST_TYPE_DVBSRC_CODE_RATE, DEFAULT_ISDBT_LAYERA_FEC,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, ARG_DVBSRC_ISDBT_LAYERB_FEC,
+      g_param_spec_enum ("isdbt-layerb-fec",
+          "ISDB-T layer B FEC", "(ISDB-T) layer B Forward Error Correction",
+          GST_TYPE_DVBSRC_CODE_RATE, DEFAULT_ISDBT_LAYERB_FEC,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, ARG_DVBSRC_ISDBT_LAYERC_FEC,
+      g_param_spec_enum ("isdbt-layerc-fec",
+          "ISDB-T layer A FEC", "(ISDB-T) layer C Forward Error Correction",
+          GST_TYPE_DVBSRC_CODE_RATE, DEFAULT_ISDBT_LAYERC_FEC,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERA_MODULATION,
+      g_param_spec_enum ("isdbt-layera-modulation", "ISDBT layer A modulation",
+          "(ISDB-T) Layer A modulation type",
+          GST_TYPE_DVBSRC_MODULATION, DEFAULT_ISDBT_LAYERA_MODULATION,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERB_MODULATION,
+      g_param_spec_enum ("isdbt-layerb-modulation", "ISDBT layer B modulation",
+          "(ISDB-T) Layer B modulation type",
+          GST_TYPE_DVBSRC_MODULATION, DEFAULT_ISDBT_LAYERB_MODULATION,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERC_MODULATION,
+      g_param_spec_enum ("isdbt-layerc-modulation", "ISDBT layer C modulation",
+          "(ISDB-T) Layer C modulation type",
+          GST_TYPE_DVBSRC_MODULATION, DEFAULT_ISDBT_LAYERC_MODULATION,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERA_SEGMENT_COUNT,
+      g_param_spec_int ("isdbt-layera-segment-count",
+          "ISB-T layer A segment count",
+          "(ISDB-T) Layer A segment count (-1 = AUTO)", -1, 13,
+          DEFAULT_ISDBT_LAYERA_SEGMENT_COUNT,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERB_SEGMENT_COUNT,
+      g_param_spec_int ("isdbt-layerb-segment-count",
+          "ISB-T layer B segment count",
+          "(ISDB-T) Layer B segment count (-1 = AUTO)", -1, 13,
+          DEFAULT_ISDBT_LAYERB_SEGMENT_COUNT,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERC_SEGMENT_COUNT,
+      g_param_spec_int ("isdbt-layerc-segment-count",
+          "ISB-T layer C segment count",
+          "(ISDB-T) Layer C segment count (-1 = AUTO)", -1, 13,
+          DEFAULT_ISDBT_LAYERC_SEGMENT_COUNT,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERA_TIME_INTERLEAVING,
+      g_param_spec_int ("isdbt-layera-time-interleaving",
+          "ISB-T layer A time interleaving ",
+          "(ISDB-T) Layer A time interleaving (-1 = AUTO)", -1, 8,
+          DEFAULT_ISDBT_LAYERA_TIME_INTERLEAVING,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERB_TIME_INTERLEAVING,
+      g_param_spec_int ("isdbt-layerb-time-interleaving",
+          "ISB-T layer B time interleaving ",
+          "(ISDB-T) Layer B time interleaving (-1 = AUTO)", -1, 8,
+          DEFAULT_ISDBT_LAYERB_TIME_INTERLEAVING,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_ISDBT_LAYERC_TIME_INTERLEAVING,
+      g_param_spec_int ("isdbt-layerc-time-interleaving",
+          "ISB-T layer C time interleaving ",
+          "(ISDB-T) Layer C time interleaving (-1 = AUTO)", -1, 8,
+          DEFAULT_ISDBT_LAYERC_TIME_INTERLEAVING,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  /* LNB properties (Satellite distribution standards) */
+
+  g_object_class_install_property (gobject_class, ARG_DVBSRC_LNB_SLOF,
+      g_param_spec_uint ("lnb-slof", "Tuning Timeout",
+          "LNB's Upper bound for low band reception (kHz)",
+          0, G_MAXUINT, DEFAULT_LNB_SLOF,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, ARG_DVBSRC_LNB_LOF1,
+      g_param_spec_uint ("lnb-lof1", "Low band local oscillator frequency",
+          "LNB's Local oscillator frequency used for low band reception (kHz)",
+          0, G_MAXUINT, DEFAULT_LNB_LOF1,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, ARG_DVBSRC_LNB_LOF2,
+      g_param_spec_uint ("lnb-lof2", "High band local oscillator frequency",
+          "LNB's Local oscillator frequency used for high band reception (kHz)",
+          0, G_MAXUINT, DEFAULT_LNB_LOF2,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
+
+  /* Additional DTMB properties */
+
+  g_object_class_install_property (gobject_class,
+      ARG_DVBSRC_INTERLEAVING,
+      g_param_spec_enum ("interleaving", "DTMB Interleaving",
+          "(DTMB) Interleaving type",
+          GST_TYPE_INTERLEAVING, DEFAULT_INTERLEAVING,
+          GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE));
 
   /**
    * GstDvbSrc::tuning-start:
@@ -701,6 +989,19 @@
       g_signal_new ("tuning-fail", G_TYPE_FROM_CLASS (klass),
       G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
 
+  /**
+   * GstDvbSrc::tune:
+   * @gstdvbsrc: the element on which the signal is emitted
+   *
+   * Signal emited from the application to the element, instructing it
+   * to tune.
+   */
+  gst_dvbsrc_signals[SIGNAL_TUNING_FAIL] =
+      g_signal_new ("tune", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+      G_STRUCT_OFFSET (GstDvbSrcClass, do_tune),
+      NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
 }
 
 /* initialize the new element
@@ -754,34 +1055,39 @@
   object->rolloff = DEFAULT_ROLLOFF;
   object->stream_id = DEFAULT_STREAM_ID;
 
+  object->isdbt_layer_enabled = DEFAULT_ISDBT_LAYER_ENABLED;
+  object->isdbt_partial_reception = DEFAULT_ISDBT_PARTIAL_RECEPTION;
+  object->isdbt_sound_broadcasting = DEFAULT_ISDBT_SOUND_BROADCASTING;
+  object->isdbt_sb_subchannel_id = DEFAULT_ISDBT_SB_SUBCHANNEL_ID;
+  object->isdbt_sb_segment_idx = DEFAULT_ISDBT_SB_SEGMENT_IDX;
+  object->isdbt_sb_segment_count = DEFAULT_ISDBT_SB_SEGMENT_COUNT;
+  object->isdbt_layera_fec = DEFAULT_ISDBT_LAYERA_FEC;
+  object->isdbt_layera_modulation = DEFAULT_ISDBT_LAYERA_MODULATION;
+  object->isdbt_layera_segment_count = DEFAULT_ISDBT_LAYERA_SEGMENT_COUNT;
+  object->isdbt_layera_time_interleaving =
+      DEFAULT_ISDBT_LAYERA_TIME_INTERLEAVING;
+  object->isdbt_layerb_fec = DEFAULT_ISDBT_LAYERB_FEC;
+  object->isdbt_layerb_modulation = DEFAULT_ISDBT_LAYERB_MODULATION;
+  object->isdbt_layerb_segment_count = DEFAULT_ISDBT_LAYERB_SEGMENT_COUNT;
+  object->isdbt_layerb_time_interleaving =
+      DEFAULT_ISDBT_LAYERB_TIME_INTERLEAVING;
+  object->isdbt_layerc_fec = DEFAULT_ISDBT_LAYERC_FEC;
+  object->isdbt_layerc_modulation = DEFAULT_ISDBT_LAYERC_MODULATION;
+  object->isdbt_layerc_segment_count = DEFAULT_ISDBT_LAYERC_SEGMENT_COUNT;
+  object->isdbt_layerc_time_interleaving =
+      DEFAULT_ISDBT_LAYERC_TIME_INTERLEAVING;
+
+  object->lnb_slof = DEFAULT_LNB_SLOF;
+  object->lnb_lof1 = DEFAULT_LNB_LOF1;
+  object->lnb_lof2 = DEFAULT_LNB_LOF2;
+
+  object->interleaving = DEFAULT_INTERLEAVING;
+
   g_mutex_init (&object->tune_mutex);
   object->timeout = DEFAULT_TIMEOUT;
   object->tuning_timeout = DEFAULT_TUNING_TIMEOUT;
 }
 
-/**
- * This loop should be safe enough considering:
- *
- * 1.- EINTR suggest the next ioctl might succeed
- * 2.- It's highly unlikely you will end up spining
- *     before your entire system goes nuts due to
- *     the massive number of interrupts.
- *
- * We don't check for EAGAIN here cause we are opening
- * the frontend in blocking mode.
- */
-static inline int
-gst_dvbsrc_retry_ioctl (int fd, unsigned long req, void *data)
-{
-  int ret;
-
-  do
-    ret = ioctl (fd, req, data);
-  while (ret == -1 && errno == EINTR);
-
-  return ret;
-}
-
 static void
 gst_dvbsrc_set_pids (GstDvbSrc * dvbsrc, const gchar * pid_string)
 {
@@ -900,8 +1206,17 @@
         case BANDWIDTH_6_MHZ:
           object->bandwidth = 6000000;
           break;
+        case BANDWIDTH_5_MHZ:
+          object->bandwidth = 5000000;
+          break;
+        case BANDWIDTH_10_MHZ:
+          object->bandwidth = 10000000;
+          break;
+        case BANDWIDTH_1_712_MHZ:
+          object->bandwidth = 1712000;
+          break;
         default:
-          /* we don't know which bandwidth are set */
+          /* we don't know which bandwidth is set */
           object->bandwidth = 0;
           break;
       }
@@ -927,18 +1242,10 @@
     case ARG_DVBSRC_INVERSION:
       object->inversion = g_value_get_enum (value);
       break;
-    case ARG_DVBSRC_TUNE:{
+    case ARG_DVBSRC_TUNE:
       GST_INFO_OBJECT (object, "Set Property: ARG_DVBSRC_TUNE");
-
-      /* if we are in paused/playing state tune now, otherwise in ready
-       * to paused state change */
-      if (GST_STATE (object) > GST_STATE_READY) {
-        g_mutex_lock (&object->tune_mutex);
-        gst_dvbsrc_tune (object);
-        g_mutex_unlock (&object->tune_mutex);
-      }
+      gst_dvbsrc_do_tune (object);
       break;
-    }
     case ARG_DVBSRC_STATS_REPORTING_INTERVAL:
       object->stats_interval = g_value_get_uint (value);
       object->stats_counter = 0;
@@ -964,6 +1271,72 @@
     case ARG_DVBSRC_STREAM_ID:
       object->stream_id = g_value_get_int (value);
       break;
+    case ARG_DVBSRC_ISDBT_LAYER_ENABLED:
+      object->isdbt_layer_enabled = g_value_get_uint (value);
+      break;
+    case ARG_DVBSRC_ISDBT_PARTIAL_RECEPTION:
+      object->isdbt_partial_reception = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_SOUND_BROADCASTING:
+      object->isdbt_sound_broadcasting = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_SB_SUBCHANNEL_ID:
+      object->isdbt_sb_subchannel_id = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_SB_SEGMENT_IDX:
+      object->isdbt_sb_segment_idx = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_SB_SEGMENT_COUNT:
+      object->isdbt_sb_segment_count = g_value_get_uint (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_FEC:
+      object->isdbt_layera_fec = g_value_get_enum (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_MODULATION:
+      object->isdbt_layera_modulation = g_value_get_enum (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_SEGMENT_COUNT:
+      object->isdbt_layera_segment_count = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_TIME_INTERLEAVING:
+      object->isdbt_layera_time_interleaving = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_FEC:
+      object->isdbt_layerb_fec = g_value_get_enum (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_MODULATION:
+      object->isdbt_layerb_modulation = g_value_get_enum (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_SEGMENT_COUNT:
+      object->isdbt_layerb_segment_count = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_TIME_INTERLEAVING:
+      object->isdbt_layerb_time_interleaving = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_FEC:
+      object->isdbt_layerc_fec = g_value_get_enum (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_MODULATION:
+      object->isdbt_layerc_modulation = g_value_get_enum (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_SEGMENT_COUNT:
+      object->isdbt_layerc_segment_count = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_TIME_INTERLEAVING:
+      object->isdbt_layerc_time_interleaving = g_value_get_int (value);
+      break;
+    case ARG_DVBSRC_LNB_SLOF:
+      object->lnb_slof = g_value_get_uint (value);
+      break;
+    case ARG_DVBSRC_LNB_LOF1:
+      object->lnb_lof1 = g_value_get_uint (value);
+      break;
+    case ARG_DVBSRC_LNB_LOF2:
+      object->lnb_lof2 = g_value_get_uint (value);
+      break;
+    case ARG_DVBSRC_INTERLEAVING:
+      object->interleaving = g_value_get_enum (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   }
@@ -1005,14 +1378,20 @@
       break;
     case ARG_DVBSRC_BANDWIDTH:{
       int tmp;
-      if (object->bandwidth == 0)
+      if (!object->bandwidth)
         tmp = BANDWIDTH_AUTO;
+      else if (object->bandwidth <= 1712000)
+        tmp = BANDWIDTH_1_712_MHZ;
+      else if (object->bandwidth <= 5000000)
+        tmp = BANDWIDTH_5_MHZ;
       else if (object->bandwidth <= 6000000)
         tmp = BANDWIDTH_6_MHZ;
       else if (object->bandwidth <= 7000000)
         tmp = BANDWIDTH_7_MHZ;
       else if (object->bandwidth <= 8000000)
         tmp = BANDWIDTH_8_MHZ;
+      else if (object->bandwidth <= 10000000)
+        tmp = BANDWIDTH_10_MHZ;
       else
         tmp = BANDWIDTH_AUTO;
 
@@ -1064,6 +1443,72 @@
     case ARG_DVBSRC_STREAM_ID:
       g_value_set_int (value, object->stream_id);
       break;
+    case ARG_DVBSRC_ISDBT_LAYER_ENABLED:
+      g_value_set_uint (value, object->isdbt_layer_enabled);
+      break;
+    case ARG_DVBSRC_ISDBT_PARTIAL_RECEPTION:
+      g_value_set_int (value, object->isdbt_partial_reception);
+      break;
+    case ARG_DVBSRC_ISDBT_SOUND_BROADCASTING:
+      g_value_set_int (value, object->isdbt_sound_broadcasting);
+      break;
+    case ARG_DVBSRC_ISDBT_SB_SUBCHANNEL_ID:
+      g_value_set_int (value, object->isdbt_sb_subchannel_id);
+      break;
+    case ARG_DVBSRC_ISDBT_SB_SEGMENT_IDX:
+      g_value_set_int (value, object->isdbt_sb_segment_idx);
+      break;
+    case ARG_DVBSRC_ISDBT_SB_SEGMENT_COUNT:
+      g_value_set_uint (value, object->isdbt_sb_segment_count);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_FEC:
+      g_value_set_enum (value, object->isdbt_layera_fec);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_MODULATION:
+      g_value_set_enum (value, object->isdbt_layera_modulation);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_SEGMENT_COUNT:
+      g_value_set_int (value, object->isdbt_layera_segment_count);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERA_TIME_INTERLEAVING:
+      g_value_set_int (value, object->isdbt_layera_time_interleaving);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_FEC:
+      g_value_set_enum (value, object->isdbt_layerb_fec);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_MODULATION:
+      g_value_set_enum (value, object->isdbt_layerb_modulation);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_SEGMENT_COUNT:
+      g_value_set_int (value, object->isdbt_layerb_segment_count);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERB_TIME_INTERLEAVING:
+      g_value_set_int (value, object->isdbt_layerb_time_interleaving);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_FEC:
+      g_value_set_enum (value, object->isdbt_layerc_fec);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_MODULATION:
+      g_value_set_enum (value, object->isdbt_layerc_modulation);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_SEGMENT_COUNT:
+      g_value_set_int (value, object->isdbt_layerc_segment_count);
+      break;
+    case ARG_DVBSRC_ISDBT_LAYERC_TIME_INTERLEAVING:
+      g_value_set_int (value, object->isdbt_layerc_time_interleaving);
+      break;
+    case ARG_DVBSRC_LNB_SLOF:
+      g_value_set_uint (value, object->lnb_slof);
+      break;
+    case ARG_DVBSRC_LNB_LOF1:
+      g_value_set_uint (value, object->lnb_lof1);
+      break;
+    case ARG_DVBSRC_LNB_LOF2:
+      g_value_set_uint (value, object->lnb_lof2);
+      break;
+    case ARG_DVBSRC_INTERLEAVING:
+      g_value_set_enum (value, object->interleaving);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   }
@@ -1091,7 +1536,7 @@
     if (prop->u.buffer.data[i] == delsys)
       return TRUE;
   }
-  GST_LOG ("Adapter does not suport delsys: %d", delsys);
+  GST_LOG ("Adapter does not support delsys: %d", delsys);
   return FALSE;
 }
 
@@ -1104,14 +1549,16 @@
   gchar *frontend_dev;
   GstStructure *adapter_structure;
   char *adapter_name = NULL;
+  gint err;
 
   frontend_dev = g_strdup_printf ("/dev/dvb/adapter%d/frontend%d",
       object->adapter_number, object->frontend_number);
   GST_INFO_OBJECT (object, "Using frontend device: %s", frontend_dev);
 
   /* open frontend */
-  if ((object->fd_frontend =
-          open (frontend_dev, writable ? O_RDWR : O_RDONLY)) < 0) {
+  LOOP_WHILE_EINTR (object->fd_frontend,
+      open (frontend_dev, writable ? O_RDWR : O_RDONLY));
+  if (object->fd_frontend < 0) {
     switch (errno) {
       case ENOENT:
         GST_ELEMENT_ERROR (object, RESOURCE, NOT_FOUND,
@@ -1130,7 +1577,8 @@
 
   GST_DEBUG_OBJECT (object, "Device opened, querying information");
 
-  if (ioctl (object->fd_frontend, FE_GET_INFO, &fe_info) < 0) {
+  LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_GET_INFO, &fe_info));
+  if (err) {
     GST_ELEMENT_ERROR (object, RESOURCE, SETTINGS,
         (_("Could not get settings from frontend device \"%s\"."),
             frontend_dev), GST_ERROR_SYSTEM);
@@ -1146,7 +1594,8 @@
   props.num = 1;
   props.props = dvb_prop;
 
-  if (ioctl (object->fd_frontend, FE_GET_PROPERTY, &props) < 0) {
+  LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_GET_PROPERTY, &props));
+  if (err) {
     GST_ELEMENT_ERROR (object, RESOURCE, SETTINGS,
         (_("Cannot enumerate delivery systems from frontend device \"%s\"."),
             frontend_dev), GST_ERROR_SYSTEM);
@@ -1291,6 +1740,7 @@
 gst_dvbsrc_open_dvr (GstDvbSrc * object)
 {
   gchar *dvr_dev;
+  gint err;
 
   dvr_dev = g_strdup_printf ("/dev/dvb/adapter%d/dvr%d",
       object->adapter_number, object->frontend_number);
@@ -1316,7 +1766,9 @@
 
   GST_INFO_OBJECT (object, "Setting DVB kernel buffer size to %d ",
       object->dvb_buffer_size);
-  if (ioctl (object->fd_dvr, DMX_SET_BUFFER_SIZE, object->dvb_buffer_size) < 0) {
+  LOOP_WHILE_EINTR (err, ioctl (object->fd_dvr, DMX_SET_BUFFER_SIZE,
+          object->dvb_buffer_size));
+  if (err) {
     GST_INFO_OBJECT (object, "ioctl DMX_SET_BUFFER_SIZE failed (%d)", errno);
     return FALSE;
   }
@@ -1390,7 +1842,7 @@
         continue;
       else
         goto select_error;
-    } else if (G_UNLIKELY (ret_val == 0)) {
+    } else if (G_UNLIKELY (!ret_val)) {
       /* timeout, post element message */
       gst_element_post_message (GST_ELEMENT_CAST (object),
           gst_message_new_element (GST_OBJECT (object),
@@ -1455,7 +1907,7 @@
     GST_DEBUG_OBJECT (object, "Reading from DVR device");
     retval = gst_dvbsrc_read_device (object, buffer_size, buf);
 
-    if (object->stats_interval != 0 &&
+    if (object->stats_interval &&
         ++object->stats_counter == object->stats_interval) {
       gst_dvbsrc_output_frontend_stats (object);
       object->stats_counter = 0;
@@ -1568,36 +2020,80 @@
 }
 
 static gboolean
+gst_dvbsrc_is_valid_modulation (guint delsys, guint mod)
+{
+  /* FIXME: check valid modulations for other broadcast standards */
+  switch (delsys) {
+    case SYS_ISDBT:
+      if (mod == QAM_AUTO || mod == QPSK || mod == QAM_16 ||
+          mod == QAM_64 || mod == DQPSK)
+        return TRUE;
+      break;
+    default:
+      GST_FIXME ("No delsys/modulation sanity checks implemented for this "
+          "delivery system");
+      return TRUE;
+  }
+  return FALSE;
+}
+
+static gboolean
 gst_dvbsrc_get_size (GstBaseSrc * src, guint64 * size)
 {
   return FALSE;
 }
 
 static void
+gst_dvbsrc_do_tune (GstDvbSrc * src)
+{
+  /* if we are in paused/playing state tune now, otherwise in ready
+   * to paused state change */
+  if (GST_STATE (src) > GST_STATE_READY)
+    gst_dvbsrc_tune (src);
+}
+
+static void
 gst_dvbsrc_output_frontend_stats (GstDvbSrc * src)
 {
   fe_status_t status;
   uint16_t snr, _signal;
-  uint32_t ber, uncorrected_blocks;
+  uint32_t ber, bad_blks;
   GstMessage *message;
   GstStructure *structure;
   int fe_fd = src->fd_frontend;
+  gint err;
 
-  if (ioctl (fe_fd, FE_READ_STATUS, &status) ||
-      ioctl (fe_fd, FE_READ_SIGNAL_STRENGTH, &_signal) ||
-      ioctl (fe_fd, FE_READ_SNR, &snr) ||
-      ioctl (fe_fd, FE_READ_BER, &ber) ||
-      ioctl (fe_fd, FE_READ_UNCORRECTED_BLOCKS, &uncorrected_blocks)) {
-    GST_WARNING_OBJECT (src, "Failed to get statistics from the device");
-    return;
-  }
+  LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_STATUS, &status));
+  if (err)
+    goto error_out;
+
+  LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_SIGNAL_STRENGTH, &_signal));
+  if (err)
+    goto error_out;
+
+  LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_SNR, &snr));
+  if (err)
+    goto error_out;
+
+  LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_BER, &ber));
+  if (err)
+    goto error_out;
+
+  LOOP_WHILE_EINTR (err, ioctl (fe_fd, FE_READ_UNCORRECTED_BLOCKS, &bad_blks));
+  if (err)
+    goto error_out;
 
   structure = gst_structure_new ("dvb-frontend-stats", "status", G_TYPE_INT,
       status, "signal", G_TYPE_INT, _signal, "snr", G_TYPE_INT, snr,
-      "ber", G_TYPE_INT, ber, "unc", G_TYPE_INT, uncorrected_blocks,
+      "ber", G_TYPE_INT, ber, "unc", G_TYPE_INT, bad_blks,
       "lock", G_TYPE_BOOLEAN, status & FE_HAS_LOCK, NULL);
   message = gst_message_new_element (GST_OBJECT (src), structure);
   gst_element_post_message (GST_ELEMENT (src), message);
+  return;
+
+error_out:
+  GST_WARNING_OBJECT (src, "Failed to get statistics from the device: %s",
+      g_strerror (errno));
 }
 
 struct diseqc_cmd
@@ -1610,12 +2106,16 @@
 diseqc_send_msg (int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd,
     fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b)
 {
-  if (ioctl (fd, FE_SET_TONE, SEC_TONE_OFF) == -1) {
+  gint err;
+
+  LOOP_WHILE_EINTR (err, ioctl (fd, FE_SET_TONE, SEC_TONE_OFF));
+  if (err) {
     GST_ERROR ("Setting tone to off failed");
     return;
   }
 
-  if (ioctl (fd, FE_SET_VOLTAGE, v) == -1) {
+  LOOP_WHILE_EINTR (err, ioctl (fd, FE_SET_VOLTAGE, v));
+  if (err) {
     GST_ERROR ("Setting voltage failed");
     return;
   }
@@ -1624,7 +2124,9 @@
   GST_LOG ("diseqc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", cmd->cmd.msg[0],
       cmd->cmd.msg[1], cmd->cmd.msg[2], cmd->cmd.msg[3], cmd->cmd.msg[4],
       cmd->cmd.msg[5]);
-  if (ioctl (fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd) == -1) {
+
+  LOOP_WHILE_EINTR (err, ioctl (fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd));
+  if (err) {
     GST_ERROR ("Sending DiSEqC command failed");
     return;
   }
@@ -1632,14 +2134,16 @@
   g_usleep (cmd->wait * 1000);
   g_usleep (15 * 1000);
 
-  if (ioctl (fd, FE_DISEQC_SEND_BURST, b) == -1) {
+  LOOP_WHILE_EINTR (err, ioctl (fd, FE_DISEQC_SEND_BURST, b));
+  if (err) {
     GST_ERROR ("Sending burst failed");
     return;
   }
 
   g_usleep (15 * 1000);
 
-  if (ioctl (fd, FE_SET_TONE, t) == -1) {
+  LOOP_WHILE_EINTR (err, ioctl (fd, FE_SET_TONE, t));
+  if (err) {
     GST_ERROR ("Setting tone failed");
     return;
   }
@@ -1690,6 +2194,7 @@
   struct dtv_property dvb_prop[NUM_DTV_PROPS];
   GstClockTimeDiff elapsed_time, timeout_step = 500 * GST_MSECOND;
   GstClockTime start;
+  gint err;
 
   GST_DEBUG_OBJECT (object, "Starting the frontend tuning process");
 
@@ -1704,7 +2209,8 @@
   props.num = 1;
   props.props = dvb_prop;
 
-  if (gst_dvbsrc_retry_ioctl (object->fd_frontend, FE_GET_PROPERTY, &props)) {
+  LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_GET_PROPERTY, &props));
+  if (err) {
     GST_WARNING_OBJECT (object, "Error enumerating delsys: %s",
         g_strerror (errno));
 
@@ -1722,6 +2228,8 @@
 
   gst_dvbsrc_unset_pes_filters (object);
 
+  g_mutex_lock (&object->tune_mutex);
+
   gst_poll_fd_init (&fe_fd);
   fe_fd.fd = object->fd_frontend;
   poll_set = gst_poll_new (TRUE);
@@ -1736,7 +2244,8 @@
   memset (dvb_prop, 0, sizeof (dvb_prop));
   dvb_prop[0].cmd = DTV_CLEAR;
 
-  if (gst_dvbsrc_retry_ioctl (object->fd_frontend, FE_SET_PROPERTY, &props)) {
+  LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_SET_PROPERTY, &props));
+  if (err) {
     GST_WARNING_OBJECT (object, "Error resetting tuner: %s",
         g_strerror (errno));
   }
@@ -1748,7 +2257,9 @@
   }
 
   GST_DEBUG_OBJECT (object, "Setting %d properties", props.num);
-  if (gst_dvbsrc_retry_ioctl (object->fd_frontend, FE_SET_PROPERTY, &props)) {
+
+  LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_SET_PROPERTY, &props));
+  if (err) {
     GST_WARNING_OBJECT (object, "Error tuning channel: %s (%d)",
         g_strerror (errno), errno);
     goto fail;
@@ -1756,7 +2267,8 @@
 
   g_signal_emit (object, gst_dvbsrc_signals[SIGNAL_TUNING_START], 0);
 
-  if (gst_dvbsrc_retry_ioctl (object->fd_frontend, FE_READ_STATUS, &status)) {
+  LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_READ_STATUS, &status));
+  if (err) {
     GST_WARNING_OBJECT (object, "Failed querying frontend for tuning status:"
         " %s (%d)", g_strerror (errno), errno);
     goto fail_with_signal;
@@ -1769,7 +2281,9 @@
   while (!(status & FE_HAS_LOCK) && elapsed_time <= object->tuning_timeout) {
     if (gst_poll_wait (poll_set, timeout_step) == -1)
       goto fail_with_signal;
-    if (gst_dvbsrc_retry_ioctl (object->fd_frontend, FE_READ_STATUS, &status)) {
+    LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_READ_STATUS,
+            &status));
+    if (err) {
       GST_WARNING_OBJECT (object, "Failed querying frontend for tuning status"
           " %s (%d)", g_strerror (errno), errno);
       goto fail_with_signal;
@@ -1795,6 +2309,7 @@
   GST_DEBUG_OBJECT (object, "Successfully set frontend tuning params");
 
   gst_poll_free (poll_set);
+  g_mutex_unlock (&object->tune_mutex);
   return TRUE;
 
 fail_with_signal:
@@ -1802,6 +2317,7 @@
 fail:
   GST_WARNING_OBJECT (object, "Could not tune to desired frequency");
   gst_poll_free (poll_set);
+  g_mutex_unlock (&object->tune_mutex);
   return FALSE;
 }
 
@@ -1813,25 +2329,28 @@
   unsigned int sym_rate = object->sym_rate * 1000;
   int inversion = object->inversion;
   int n;
+  gint err;
 
   /* first 3 entries are reserved */
   n = 3;
 
+  /**
+   * We are not dropping out but issuing a warning in case of wrong
+   * parameter combinations as failover behavior should be mandated
+   * by the driver. Worst case scenario it will just fail at tuning.
+   */
+
   switch (object->delsys) {
     case SYS_DVBS:
     case SYS_DVBS2:
     case SYS_TURBO:
       if (freq > 2200000) {
-        /* FIXME: Make SLOF/LOF1/LOF2 seteable props with a sane default.
-         * These values shouldn't be fixed because not all universal LNBs
-         * share the same parameters.
-         *
-         * this must be an absolute frequency */
-        if (freq < SLOF) {
-          freq -= LOF1;
+        /* this must be an absolute frequency */
+        if (freq < object->lnb_slof) {
+          freq -= object->lnb_lof1;
           object->tone = SEC_TONE_OFF;
         } else {
-          freq -= LOF2;
+          freq -= object->lnb_lof2;
           object->tone = SEC_TONE_ON;
         }
       }
@@ -1855,12 +2374,14 @@
 
         /* DTV_TONE not yet implemented
          * set_prop (fe_props_array, &n, DTV_TONE, object->tone) */
-        if (ioctl (object->fd_frontend, FE_SET_TONE, object->tone) < 0) {
+        LOOP_WHILE_EINTR (err, ioctl (object->fd_frontend, FE_SET_TONE,
+                object->tone));
+        if (err) {
           GST_WARNING_OBJECT (object, "Couldn't set tone: %s",
               g_strerror (errno));
         }
       } else {
-        GST_DEBUG_OBJECT (object, "Sending DISEqC");
+        GST_DEBUG_OBJECT (object, "Sending DiSEqC");
         diseqc (object->fd_frontend, object->diseqc_src, voltage, object->tone);
         /* Once DiSEqC source is set, do not set it again until
          * app decides to change it
@@ -1878,6 +2399,31 @@
       break;
     case SYS_DVBT:
     case SYS_DVBT2:
+      if (object->delsys == SYS_DVBT) {
+        if (object->transmission_mode != TRANSMISSION_MODE_AUTO &&
+            object->transmission_mode != TRANSMISSION_MODE_2K &&
+            object->transmission_mode != TRANSMISSION_MODE_8K) {
+          GST_WARNING_OBJECT (object, "Wrong DVB-T parameter combination: "
+              "transmission mode should be either AUTO, 2K or 8K");
+        }
+        if (object->bandwidth != 6000000 && object->bandwidth != 7000000 &&
+            object->bandwidth != 8000000) {
+          GST_WARNING_OBJECT (object, "Wrong DVB-T parameter value: bandwidth "
+              "is %d but only 6, 7 and 8 MHz are allowed", object->bandwidth);
+        }
+      } else if (object->delsys == SYS_DVBT2) {
+        if (object->transmission_mode != TRANSMISSION_MODE_AUTO &&
+            object->transmission_mode != TRANSMISSION_MODE_1K &&
+            object->transmission_mode != TRANSMISSION_MODE_2K &&
+            object->transmission_mode != TRANSMISSION_MODE_4K &&
+            object->transmission_mode != TRANSMISSION_MODE_8K &&
+            object->transmission_mode != TRANSMISSION_MODE_16K &&
+            object->transmission_mode != TRANSMISSION_MODE_32K) {
+          GST_WARNING_OBJECT (object, "Wrong DVB-T2 parameter combination: "
+              "transmission mode should be either AUTO, 1K, 2K, 4K, 8K, 16K "
+              "or 32K");
+        }
+      }
       set_prop (props->props, &n, DTV_BANDWIDTH_HZ, object->bandwidth);
       set_prop (props->props, &n, DTV_CODE_RATE_HP, object->code_rate_hp);
       set_prop (props->props, &n, DTV_CODE_RATE_LP, object->code_rate_lp);
@@ -1911,11 +2457,102 @@
 
       set_prop (props->props, &n, DTV_MODULATION, object->modulation);
       break;
+    case SYS_ISDBT:
+
+      if (object->isdbt_partial_reception == 1 &&
+          object->isdbt_layera_segment_count != 1) {
+        GST_WARNING_OBJECT (object, "Wrong ISDB-T parameter combination: "
+            "partial reception is set but layer A segment count is not 1");
+      }
+
+      if (!object->isdbt_sound_broadcasting) {
+        GST_INFO_OBJECT (object, "ISDB-T sound broadcasting is not set. "
+            "Driver will likely ignore values set for isdbt-sb-subchannel-id, "
+            "isdbt-sb-segment-idx and isdbt-sb-segment-count");
+      }
+
+      if (object->isdbt_layerc_modulation == DQPSK &&
+          object->isdbt_layerb_modulation != DQPSK) {
+        GST_WARNING_OBJECT (object, "Wrong ISDB-T parameter combination: "
+            "layer C modulation is DQPSK but layer B modulation is different");
+      }
+
+      if (object->bandwidth != 6000000) {
+        GST_WARNING_OBJECT (object, "Wrong ISDB-T parameter value: bandwidth "
+            "is %d but only 6 MHz is allowed", object->bandwidth);
+      }
+
+      GST_INFO_OBJECT (object, "Tuning ISDB-T to %d", freq);
+      set_prop (props->props, &n, DTV_BANDWIDTH_HZ, object->bandwidth);
+      set_prop (props->props, &n, DTV_GUARD_INTERVAL, object->guard_interval);
+      set_prop (props->props, &n, DTV_TRANSMISSION_MODE,
+          object->transmission_mode);
+      set_prop (props->props, &n, DTV_ISDBT_LAYER_ENABLED,
+          object->isdbt_layer_enabled);
+      set_prop (props->props, &n, DTV_ISDBT_PARTIAL_RECEPTION,
+          object->isdbt_partial_reception);
+      set_prop (props->props, &n, DTV_ISDBT_SOUND_BROADCASTING,
+          object->isdbt_sound_broadcasting);
+      set_prop (props->props, &n, DTV_ISDBT_SB_SUBCHANNEL_ID,
+          object->isdbt_sb_subchannel_id);
+      set_prop (props->props, &n, DTV_ISDBT_SB_SEGMENT_IDX,
+          object->isdbt_sb_segment_idx);
+      set_prop (props->props, &n, DTV_ISDBT_SB_SEGMENT_COUNT,
+          object->isdbt_sb_segment_count);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERA_FEC,
+          object->isdbt_layera_fec);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERA_MODULATION,
+          object->isdbt_layera_modulation);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERA_SEGMENT_COUNT,
+          object->isdbt_layera_segment_count);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERA_TIME_INTERLEAVING,
+          object->isdbt_layera_time_interleaving);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERB_FEC,
+          object->isdbt_layerb_fec);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERB_MODULATION,
+          object->isdbt_layerb_modulation);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERB_SEGMENT_COUNT,
+          object->isdbt_layerb_segment_count);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERB_TIME_INTERLEAVING,
+          object->isdbt_layerb_time_interleaving);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERC_FEC,
+          object->isdbt_layerc_fec);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERC_MODULATION,
+          object->isdbt_layerc_modulation);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERC_SEGMENT_COUNT,
+          object->isdbt_layerc_segment_count);
+      set_prop (props->props, &n, DTV_ISDBT_LAYERC_TIME_INTERLEAVING,
+          object->isdbt_layerc_time_interleaving);
+      break;
+#if HAVE_V5_MINOR(7)
+    case SYS_DTMB:
+      set_prop (props->props, &n, DTV_BANDWIDTH_HZ, object->bandwidth);
+      set_prop (props->props, &n, DTV_MODULATION, object->modulation);
+      set_prop (props->props, &n, DTV_INVERSION, object->inversion);
+      set_prop (props->props, &n, DTV_INNER_FEC, object->code_rate_hp);
+      set_prop (props->props, &n, DTV_TRANSMISSION_MODE,
+          object->transmission_mode);
+      set_prop (props->props, &n, DTV_GUARD_INTERVAL, object->guard_interval);
+      set_prop (props->props, &n, DTV_INTERLEAVING, object->interleaving);
+      /* FIXME: Make the LNA on/off switch a property and proxy on dvbbasebin */
+      /* FIXME: According to v4l advice (see libdvbv5 implementation) this
+       * property should be set separately as not all drivers will ignore it
+       * if unsupported. An alternative would be to get the dvb API contract
+       * revised on this regard */
+      set_prop (props->props, &n, DTV_LNA, LNA_AUTO);
+      GST_INFO_OBJECT (object, "Tuning DTMB to %d Hz", freq);
+      break;
+#endif
     default:
       GST_ERROR_OBJECT (object, "Unknown frontend type %u", object->delsys);
       return FALSE;
   }
 
+  if (!gst_dvbsrc_is_valid_modulation (object->delsys, object->modulation)) {
+    GST_WARNING_OBJECT (object,
+        "Attempting an invalid modulation/delsys combination");
+  }
+
   set_prop (props->props, &n, DTV_TUNE, 0);
   props->num = n;
   /* set first three entries */
@@ -1969,6 +2606,7 @@
   int *fd;
   int pid, i;
   struct dmx_pes_filter_params pes_filter;
+  gint err;
   gchar *demux_dev = g_strdup_printf ("/dev/dvb/adapter%d/demux%d",
       object->adapter_number, object->frontend_number);
 
@@ -1999,7 +2637,8 @@
     GST_INFO_OBJECT (object, "Setting pes-filter, pid = %d, type = %d",
         pes_filter.pid, pes_filter.pes_type);
 
-    if (ioctl (*fd, DMX_SET_PES_FILTER, &pes_filter) < 0)
+    LOOP_WHILE_EINTR (err, ioctl (*fd, DMX_SET_PES_FILTER, &pes_filter));
+    if (err)
       GST_WARNING_OBJECT (object, "Error setting PES filter on %s: %s",
           demux_dev, g_strerror (errno));
   }
diff --git a/sys/dvb/gstdvbsrc.h b/sys/dvb/gstdvbsrc.h
index b9d07d7..27a27b7 100644
--- a/sys/dvb/gstdvbsrc.h
+++ b/sys/dvb/gstdvbsrc.h
@@ -60,7 +60,6 @@
 struct _GstDvbSrc
 {
   GstPushSrc element;
-  GstPad *srcpad;
 
   GMutex tune_mutex;
   gboolean need_tune;
@@ -104,6 +103,33 @@
   gboolean need_unlock;
 
   guint dvb_buffer_size;
+
+  unsigned int isdbt_layer_enabled;
+  int isdbt_partial_reception;
+  int isdbt_sound_broadcasting;
+  int isdbt_sb_subchannel_id;
+  int isdbt_sb_segment_idx;
+  unsigned int isdbt_sb_segment_count;
+  int isdbt_layera_fec;
+  int isdbt_layera_modulation;
+  int isdbt_layera_segment_count;
+  int isdbt_layera_time_interleaving;
+  int isdbt_layerb_fec;
+  int isdbt_layerb_modulation;
+  int isdbt_layerb_segment_count;
+  int isdbt_layerb_time_interleaving;
+  int isdbt_layerc_fec;
+  int isdbt_layerc_modulation;
+  int isdbt_layerc_segment_count;
+  int isdbt_layerc_time_interleaving;
+
+  /* LNB properties */
+  unsigned int lnb_slof;
+  unsigned int lnb_lof1;
+  unsigned int lnb_lof2;
+
+  /* Only used for DTMB if available */
+  int interleaving;
 };
 
 struct _GstDvbSrcClass
@@ -112,6 +138,8 @@
 
   void (*adapter_type) (GstElement * element, gint type);
   void (*signal_quality) (GstElement * element, gint strength, gint snr);
+
+  void (*do_tune) (GstDvbSrc * self);
 };
 
 
diff --git a/sys/dvb/parsechannels.c b/sys/dvb/parsechannels.c
index 0b1d506..9c46ddb 100644
--- a/sys/dvb/parsechannels.c
+++ b/sys/dvb/parsechannels.c
@@ -96,8 +96,17 @@
           g_hash_table_insert (params, g_strdup (satellite[j - 2]),
               g_strdup (fields[j]));
         }
-        g_hash_table_insert (params, g_strdup ("frequency"),
-            g_strdup_printf ("%d", atoi (fields[1]) * 1000));
+        /**
+         * Some ZAP format variations store freqs in MHz
+         * but we internally use kHz for DVB-S/S2.
+         */
+        if (strlen (fields[1]) < 6) {
+          g_hash_table_insert (params, g_strdup ("frequency"),
+              g_strdup_printf ("%d", atoi (fields[1]) * 1000));
+        } else {
+          g_hash_table_insert (params, g_strdup ("frequency"),
+              g_strdup_printf ("%d", atoi (fields[1])));
+        }
         parsed = TRUE;
       } else if (numfields == 13) {
         /* terrestrial */
diff --git a/sys/fbdev/Makefile.in b/sys/fbdev/Makefile.in
index dcb0153..19234f4 100644
--- a/sys/fbdev/Makefile.in
+++ b/sys/fbdev/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/linsys/Makefile.in b/sys/linsys/Makefile.in
index 43f0c15..4e05f5a 100644
--- a/sys/linsys/Makefile.in
+++ b/sys/linsys/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/linsys/gstlinsyssdisink.c b/sys/linsys/gstlinsyssdisink.c
index 93c557a..b093bb5 100644
--- a/sys/linsys/gstlinsyssdisink.c
+++ b/sys/linsys/gstlinsyssdisink.c
@@ -318,7 +318,7 @@
 static int
 get_av (int f, int v, int h)
 {
-  static int table[] = {
+  static const int table[] = {
     0x80, 0x9d, 0xab, 0xb6, 0xc7, 0xda, 0xec, 0xf1
   };
 
diff --git a/sys/opensles/Makefile.in b/sys/opensles/Makefile.in
index 304addd..a294eb8 100644
--- a/sys/opensles/Makefile.in
+++ b/sys/opensles/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -247,8 +247,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -287,7 +291,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -295,6 +298,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -344,8 +349,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -424,7 +427,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -433,7 +435,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -446,7 +447,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -471,6 +471,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -544,10 +546,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -573,6 +579,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -609,6 +618,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -649,17 +659,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -676,6 +685,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/opensles/openslesringbuffer.c b/sys/opensles/openslesringbuffer.c
index 56fdccf..5f993ec 100644
--- a/sys/opensles/openslesringbuffer.c
+++ b/sys/opensles/openslesringbuffer.c
@@ -355,10 +355,16 @@
   SLresult result;
   SLDataFormat_PCM format;
 
-  /* Configure audio source */
+  /* Configure audio source
+   * 4 buffers is the "typical" size as optimized inside Android's
+   * OpenSL ES, see frameworks/wilhelm/src/itfstruct.h BUFFER_HEADER_TYPICAL
+   *
+   * Also only use half of our segment size to make sure that there's always
+   * some more queued up in our ringbuffer and we don't start to read silence.
+   */
   SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {
-    SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE,
-    MIN (32, (spec->segtotal >> 1))
+    SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, MIN (4, MAX (spec->segtotal >> 1,
+            1))
   };
   SLDataSource audioSrc = { &loc_bufq, &format };
 
@@ -518,7 +524,6 @@
 {
   GstOpenSLESRingBuffer *thiz = GST_OPENSLES_RING_BUFFER_CAST (rb);
   SLresult result;
-  gint i;
 
   /* Register callback on the buffer queue */
   if (!thiz->is_queue_callback_registered) {
@@ -532,11 +537,9 @@
     thiz->is_queue_callback_registered = TRUE;
   }
 
-  /* Fill the queue by enqueing buffers */
+  /* Fill the queue by enqueing a buffer */
   if (!g_atomic_int_get (&thiz->is_prerolled)) {
-    for (i = 0; i < thiz->data_segtotal; i++) {
-      _opensles_player_cb (NULL, rb);
-    }
+    _opensles_player_cb (NULL, rb);
     g_atomic_int_set (&thiz->is_prerolled, 1);
   }
 
diff --git a/sys/opensles/openslessink.c b/sys/opensles/openslessink.c
index f511de4..266174a 100644
--- a/sys/opensles/openslessink.c
+++ b/sys/opensles/openslessink.c
@@ -69,8 +69,8 @@
     );
 
 #define _do_init \
-  GST_DEBUG_CATEGORY_INIT (opensles_sink_debug, "opensles_sink", 0, \
-      "OpenSL ES Sink");
+  GST_DEBUG_CATEGORY_INIT (opensles_sink_debug, "openslessink", 0, \
+      "OpenSLES Sink");
 #define parent_class gst_opensles_sink_parent_class
 G_DEFINE_TYPE_WITH_CODE (GstOpenSLESSink, gst_opensles_sink,
     GST_TYPE_AUDIO_BASE_SINK, _do_init);
@@ -276,6 +276,6 @@
   gst_audio_base_sink_set_provide_clock (GST_AUDIO_BASE_SINK (sink), TRUE);
   /* Override some default values to fit on the AudioFlinger behaviour of
    * processing 20ms buffers as minimum buffer size. */
-  GST_AUDIO_BASE_SINK (sink)->buffer_time = 400000;
+  GST_AUDIO_BASE_SINK (sink)->buffer_time = 200000;
   GST_AUDIO_BASE_SINK (sink)->latency_time = 20000;
 }
diff --git a/sys/opensles/openslessrc.c b/sys/opensles/openslessrc.c
index 5247854..3fd9cb2 100644
--- a/sys/opensles/openslessrc.c
+++ b/sys/opensles/openslessrc.c
@@ -47,14 +47,14 @@
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS ("audio/x-raw, "
         "format = (string) " GST_AUDIO_NE (S16) ", "
-        "rate = (int) { 16000 }, "
+        "rate = (int) 16000, "
         "channels = (int) 1")
     );
 /* *INDENT-ON* */
 
 #define _do_init \
-  GST_DEBUG_CATEGORY_INIT (opensles_src_debug, "opensles_src", 0, \
-      "OpenSL ES Src");
+  GST_DEBUG_CATEGORY_INIT (opensles_src_debug, "openslessrc", 0, \
+      "OpenSLES Source");
 #define parent_class gst_opensles_src_parent_class
 G_DEFINE_TYPE_WITH_CODE (GstOpenSLESSrc, gst_opensles_src,
     GST_TYPE_AUDIO_BASE_SRC, _do_init);
@@ -95,6 +95,6 @@
 {
   /* Override some default values to fit on the AudioFlinger behaviour of
    * processing 20ms buffers as minimum buffer size. */
-  GST_AUDIO_BASE_SRC (src)->buffer_time = 400000;
+  GST_AUDIO_BASE_SRC (src)->buffer_time = 200000;
   GST_AUDIO_BASE_SRC (src)->latency_time = 20000;
 }
diff --git a/sys/osxvideo/Makefile.am b/sys/osxvideo/Makefile.am
deleted file mode 100644
index 8080eba..0000000
--- a/sys/osxvideo/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-
-plugin_LTLIBRARIES = libgstosxvideosrc.la
-
-libgstosxvideosrc_la_SOURCES = osxvideoplugin.c osxvideosrc.c
-libgstosxvideosrc_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
-	$(GST_PLUGINS_BASE_CFLAGS) -Wno-deprecated-declarations
-libgstosxvideosrc_la_LIBADD =  \
-	$(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
-	-lgstinterfaces-$(GST_API_VERSION)
-
-libgstosxvideosrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-libgstosxvideosrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \
-	-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,QuickTime
-
-noinst_HEADERS = osxvideosrc.h
diff --git a/sys/osxvideo/osxvideoplugin.c b/sys/osxvideo/osxvideoplugin.c
deleted file mode 100644
index abb2c97..0000000
--- a/sys/osxvideo/osxvideoplugin.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* GStreamer
- * OSX video src
- * Copyright (C) 2004-6 Zaheer Abbas Merali <zaheerabbas at merali dot org>
- * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * The development of this code was made possible due to the involvement of
- * Pioneers of the Inevitable, the creators of the Songbird Music player.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* Object header */
-#include "osxvideosrc.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  if (!gst_element_register (plugin, "osxvideosrc",
-          GST_RANK_PRIMARY, GST_TYPE_OSX_VIDEO_SRC))
-    return FALSE;
-
-  GST_DEBUG_CATEGORY_INIT (gst_debug_osx_video_src, "osxvideosrc", 0,
-      "osxvideosrc element");
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    osxvideosrc,
-    "OSX native video input plugin",
-    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/osxvideo/osxvideosrc.c b/sys/osxvideo/osxvideosrc.c
deleted file mode 100644
index dd1c546..0000000
--- a/sys/osxvideo/osxvideosrc.c
+++ /dev/null
@@ -1,1393 +0,0 @@
-/*
- * GStreamer
- * Copyright 2007 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
- * Copyright 2007 Ali Sabil <ali.sabil@tandberg.com>
- * Copyright 2008 Barracuda Networks <justin@affinix.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-osxvideosrc
- *
- * <refsect2>
- * osxvideosrc can be used to capture video from capture devices on OS X.
- * <title>Example launch line</title>
- * <para>
- * <programlisting>
- * gst-launch osxvideosrc ! osxvideosink
- * </programlisting>
- * This pipeline shows the video captured from the default capture device.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <string.h>
-
-// for usleep
-#include <unistd.h>
-
-#include <gst/interfaces/propertyprobe.h>
-#include "osxvideosrc.h"
-
-/* for now, framerate is hard-coded */
-#define FRAMERATE 30
-
-// TODO: for completeness, write an _unlock function
-
-/*
-QuickTime notes:
-
-EnterMovies
-  initialize QT subsystem
-  there is no deinit
-
-OpenDefaultComponent of type SeqGrabComponentType
-  this gets a handle to a sequence grabber
-
-CloseComponent
-  release the sequence grabber
-
-SGInitialize
-  initialize the SG
-  there is no deinit, simply close the component
-
-SGSetDataRef of seqGrabDontMakeMovie
-  this is to disable file creation.  we only want frames
-
-SGNewChannel of VideoMediaType
-  make a video capture channel
-
-QTNewGWorld
-  specify format (e.g. k32ARGBPixelFormat)
-  specify size
-
-LockPixels
-  this makes it so the base address of the image doesn't "move".
-  you can UnlockPixels also, if you care to.
-
-CocoaSequenceGrabber locks (GetPortPixMap(gWorld)) for the entire session.
-it also locks/unlocks the pixmaphandle
-  [ PixMapHandle pixMapHandle = GetGWorldPixMap(gworld); ]
-during the moment where it extracts the frame from the gworld
-
-SGSetGWorld
-  assign the gworld to the component
-  pass GetMainDevice() as the last arg, which is just a formality?
-
-SGSetChannelBounds
-  use this to set our desired capture size.  the camera might not actually
-    capture at this size, but it will pick something close.
-
-SGSetChannelUsage of seqGrabRecord
-  enable recording
-
-SGSetDataProc
-  set callback handler
-
-SGPrepare
-  prepares for recording.  this initializes the camera (the light should
-  come on) so that when you call SGStartRecord you hit the ground running.
-  maybe we should call SGPrepare when READY->PAUSED happens?
-
-SGRelease
-  unprepare the recording
-
-SGStartRecord
-  kick off the recording
-
-SGStop
-  stop recording
-
-SGGetChannelSampleDescription
-  obtain the size the camera is actually capturing at
-
-DecompressSequenceBegin
-  i'm pretty sure you have to use this to receive the raw frames.
-  you can also use it to scale the image.  to scale, create a matrix
-    from the source and desired sizes and pass the matrix to this function.
-  *** deprecated: use DecompressSequenceBeginS instead
-
-CDSequenceEnd
-  stop a decompress sequence
-
-DecompressSequenceFrameS
-  use this to obtain a raw frame.  the result ends up in the gworld
-  *** deprecated: use DecompressSequenceFrameWhen instead
-
-SGGetChannelDeviceList of sgDeviceListIncludeInputs
-  obtain the list of devices for the video channel
-
-SGSetChannelDevice
-  set the master device (DV, USB, etc) on the channel, by string name
-
-SGSetChannelDeviceInput
-  set the sub device on the channel (iSight), by integer id
-  device ids should be a concatenation of the above two values.
-
-*/
-
-GST_DEBUG_CATEGORY (gst_debug_osx_video_src);
-#define GST_CAT_DEFAULT gst_debug_osx_video_src
-
-/* Filter signals and args */
-enum
-{
-  /* FILL ME */
-  LAST_SIGNAL
-};
-
-enum
-{
-  ARG_0,
-  ARG_DEVICE,
-  ARG_DEVICE_NAME
-};
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-yuv, "
-        "format = (fourcc) UYVY, "
-        "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ], "
-        //"framerate = (fraction) 0/1")
-        "framerate = (fraction) 30/1")
-    );
-
-     static void
-     gst_osx_video_src_init_interfaces (GType type);
-     static void
-     gst_osx_video_src_type_add_device_property_probe_interface (GType type);
-
-GST_BOILERPLATE_FULL (GstOSXVideoSrc, gst_osx_video_src, GstPushSrc,
-    GST_TYPE_PUSH_SRC, gst_osx_video_src_init_interfaces);
-
-     static void gst_osx_video_src_dispose (GObject * object);
-     static void gst_osx_video_src_finalize (GstOSXVideoSrc * osx_video_src);
-     static void gst_osx_video_src_set_property (GObject * object,
-    guint prop_id, const GValue * value, GParamSpec * pspec);
-     static void gst_osx_video_src_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-
-     static GstStateChangeReturn gst_osx_video_src_change_state (GstElement *
-    element, GstStateChange transition);
-
-     static GstCaps *gst_osx_video_src_get_caps (GstBaseSrc * src);
-     static gboolean gst_osx_video_src_set_caps (GstBaseSrc * src,
-    GstCaps * caps);
-     static gboolean gst_osx_video_src_start (GstBaseSrc * src);
-     static gboolean gst_osx_video_src_stop (GstBaseSrc * src);
-     static gboolean gst_osx_video_src_query (GstBaseSrc * bsrc,
-    GstQuery * query);
-     static GstFlowReturn gst_osx_video_src_create (GstPushSrc * src,
-    GstBuffer ** buf);
-     static void gst_osx_video_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
-
-     static gboolean prepare_capture (GstOSXVideoSrc * self);
-
-/* \ = \\, : = \c */
-     static GString *escape_string (const GString * in)
-{
-  GString *out;
-  int n;
-
-  out = g_string_sized_new (64);
-  for (n = 0; n < (int) in->len; ++n) {
-    if (in->str[n] == '\\')
-      g_string_append (out, "\\\\");
-    else if (in->str[n] == ':')
-      g_string_append (out, "\\:");
-    else
-      g_string_append_c (out, in->str[n]);
-  }
-
-  return out;
-}
-
-/* \\ = \, \c = : */
-static GString *
-unescape_string (const GString * in)
-{
-  GString *out;
-  int n;
-
-  out = g_string_sized_new (64);
-  for (n = 0; n < (int) in->len; ++n) {
-    if (in->str[n] == '\\') {
-      if (n + 1 < (int) in->len) {
-        ++n;
-        if (in->str[n] == '\\')
-          g_string_append_c (out, '\\');
-        else if (in->str[n] == 'c')
-          g_string_append_c (out, ':');
-        else {
-          /* unknown code, we will eat the escape sequence */
-        }
-      } else {
-        /* string ends with backslash, we will eat it */
-      }
-    } else
-      g_string_append_c (out, in->str[n]);
-  }
-
-  return out;
-}
-
-static gchar *
-create_device_id (const gchar * sgname, int inputIndex)
-{
-  GString *out;
-  GString *name;
-  GString *nameenc;
-  gchar *ret;
-
-  name = g_string_new (sgname);
-  nameenc = escape_string (name);
-  g_string_free (name, TRUE);
-
-  if (inputIndex >= 0) {
-    out = g_string_new ("");
-    g_string_printf (out, "%s:%d", nameenc->str, inputIndex);
-  } else {
-    /* unspecified index */
-    out = g_string_new (nameenc->str);
-  }
-
-  g_string_free (nameenc, TRUE);
-  ret = g_string_free (out, FALSE);
-  return ret;
-}
-
-static gboolean
-parse_device_id (const gchar * id, gchar ** sgname, int *inputIndex)
-{
-  gchar **parts;
-  int numparts;
-  GString *p1;
-  GString *out1;
-  int out2 = 0;
-
-  parts = g_strsplit (id, ":", -1);
-  numparts = 0;
-  while (parts[numparts])
-    ++numparts;
-
-  /* must be exactly 1 or 2 parts */
-  if (numparts < 1 || numparts > 2) {
-    g_strfreev (parts);
-    return FALSE;
-  }
-
-  p1 = g_string_new (parts[0]);
-  out1 = unescape_string (p1);
-  g_string_free (p1, TRUE);
-
-  if (numparts >= 2) {
-    errno = 0;
-    out2 = strtol (parts[1], NULL, 10);
-    if (out2 == 0 && (errno == ERANGE || errno == EINVAL)) {
-      g_string_free (out1, TRUE);
-      g_strfreev (parts);
-      return FALSE;
-    }
-  }
-
-  g_strfreev (parts);
-
-  *sgname = g_string_free (out1, FALSE);
-  *inputIndex = out2;
-  return TRUE;
-}
-
-typedef struct
-{
-  gchar *id;
-  gchar *name;
-} video_device;
-
-static video_device *
-video_device_alloc (void)
-{
-  video_device *dev;
-  dev = g_malloc (sizeof (video_device));
-  dev->id = NULL;
-  dev->name = NULL;
-  return dev;
-}
-
-static void
-video_device_free (video_device * dev)
-{
-  if (!dev)
-    return;
-
-  if (dev->id)
-    g_free (dev->id);
-  if (dev->name)
-    g_free (dev->name);
-
-  g_free (dev);
-}
-
-static void
-video_device_free_func (gpointer data, gpointer user_data)
-{
-  video_device_free ((video_device *) data);
-}
-
-/* return a list of available devices.  the default device (if any) will be
- * the first in the list.
- */
-static GList *
-device_list (GstOSXVideoSrc * src)
-{
-  SeqGrabComponent component = NULL;
-  SGChannel channel;
-  SGDeviceList deviceList;
-  SGDeviceName *deviceEntry;
-  SGDeviceInputList inputList;
-  SGDeviceInputName *inputEntry;
-  ComponentResult err;
-  int n, i;
-  GList *list;
-  video_device *dev, *default_dev;
-  gchar sgname[256];
-  gchar friendly_name[256];
-
-  list = NULL;
-  default_dev = NULL;
-
-  if (src->video_chan) {
-    /* if we already have a video channel allocated, use that */
-    GST_DEBUG_OBJECT (src, "reusing existing channel for device_list");
-    channel = src->video_chan;
-  } else {
-    /* otherwise, allocate a temporary one */
-    component = OpenDefaultComponent (SeqGrabComponentType, 0);
-    if (!component) {
-      err = paramErr;
-      GST_ERROR_OBJECT (src, "OpenDefaultComponent failed. paramErr=%d",
-          (int) err);
-      goto end;
-    }
-
-    err = SGInitialize (component);
-    if (err != noErr) {
-      GST_ERROR_OBJECT (src, "SGInitialize returned %d", (int) err);
-      goto end;
-    }
-
-    err = SGSetDataRef (component, 0, 0, seqGrabDontMakeMovie);
-    if (err != noErr) {
-      GST_ERROR_OBJECT (src, "SGSetDataRef returned %d", (int) err);
-      goto end;
-    }
-
-    err = SGNewChannel (component, VideoMediaType, &channel);
-    if (err != noErr) {
-      GST_ERROR_OBJECT (src, "SGNewChannel returned %d", (int) err);
-      goto end;
-    }
-  }
-
-  err =
-      SGGetChannelDeviceList (channel, sgDeviceListIncludeInputs, &deviceList);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (src, "SGGetChannelDeviceList returned %d", (int) err);
-    goto end;
-  }
-
-  for (n = 0; n < (*deviceList)->count; ++n) {
-    deviceEntry = &(*deviceList)->entry[n];
-
-    if (deviceEntry->flags & sgDeviceNameFlagDeviceUnavailable)
-      continue;
-
-    p2cstrcpy (sgname, deviceEntry->name);
-    inputList = deviceEntry->inputs;
-
-    if (inputList && (*inputList)->count >= 1) {
-      for (i = 0; i < (*inputList)->count; ++i) {
-        inputEntry = &(*inputList)->entry[i];
-
-        p2cstrcpy (friendly_name, inputEntry->name);
-
-        dev = video_device_alloc ();
-        dev->id = create_device_id (sgname, i);
-        if (!dev->id) {
-          video_device_free (dev);
-          i = -1;
-          break;
-        }
-
-        dev->name = g_strdup (friendly_name);
-        list = g_list_append (list, dev);
-
-        /* if this is the default device, note it */
-        if (n == (*deviceList)->selectedIndex
-            && i == (*inputList)->selectedIndex) {
-          default_dev = dev;
-        }
-      }
-
-      /* error */
-      if (i == -1)
-        break;
-    } else {
-      /* ### can a device have no defined inputs? */
-      dev = video_device_alloc ();
-      dev->id = create_device_id (sgname, -1);
-      if (!dev->id) {
-        video_device_free (dev);
-        break;
-      }
-
-      dev->name = g_strdup (sgname);
-      list = g_list_append (list, dev);
-
-      /* if this is the default device, note it */
-      if (n == (*deviceList)->selectedIndex) {
-        default_dev = dev;
-      }
-    }
-  }
-
-  /* move default device to the front */
-  if (default_dev) {
-    list = g_list_remove (list, default_dev);
-    list = g_list_prepend (list, default_dev);
-  }
-
-end:
-  if (!src->video_chan && component) {
-    err = CloseComponent (component);
-    if (err != noErr)
-      GST_WARNING_OBJECT (src, "CloseComponent returned %d", (int) err);
-  }
-
-  return list;
-}
-
-static gboolean
-device_set_default (GstOSXVideoSrc * src)
-{
-  GList *list;
-  video_device *dev;
-  gboolean ret;
-
-  /* obtain the device list */
-  list = device_list (src);
-  if (!list)
-    return FALSE;
-
-  ret = FALSE;
-
-  /* the first item is the default */
-  if (g_list_length (list) >= 1) {
-    dev = (video_device *) list->data;
-
-    /* take the strings, no need to copy */
-    src->device_id = dev->id;
-    src->device_name = dev->name;
-    dev->id = NULL;
-    dev->name = NULL;
-
-    /* null out the item */
-    video_device_free (dev);
-    list->data = NULL;
-
-    ret = TRUE;
-  }
-
-  /* clean up */
-  g_list_foreach (list, video_device_free_func, NULL);
-  g_list_free (list);
-
-  return ret;
-}
-
-static gboolean
-device_get_name (GstOSXVideoSrc * src)
-{
-  GList *l, *list;
-  video_device *dev;
-  gboolean ret;
-
-  /* if there is no device set, then attempt to set up with the default,
-   * which will also grab the name in the process.
-   */
-  if (!src->device_id)
-    return device_set_default (src);
-
-  /* if we already have a name, free it */
-  if (src->device_name) {
-    g_free (src->device_name);
-    src->device_name = NULL;
-  }
-
-  /* obtain the device list */
-  list = device_list (src);
-  if (!list)
-    return FALSE;
-
-  ret = FALSE;
-
-  /* look up the id */
-  for (l = list; l != NULL; l = l->next) {
-    dev = (video_device *) l->data;
-    if (g_str_equal (dev->id, src->device_id)) {
-      /* take the string, no need to copy */
-      src->device_name = dev->name;
-      dev->name = NULL;
-      ret = TRUE;
-      break;
-    }
-  }
-
-  g_list_foreach (list, video_device_free_func, NULL);
-  g_list_free (list);
-
-  return ret;
-}
-
-static gboolean
-device_select (GstOSXVideoSrc * src)
-{
-  Str63 pstr;
-  ComponentResult err;
-  gchar *sgname;
-  int inputIndex;
-
-  /* if there's no device id set, attempt to select default device */
-  if (!src->device_id && !device_set_default (src))
-    return FALSE;
-
-  if (!parse_device_id (src->device_id, &sgname, &inputIndex)) {
-    GST_ERROR_OBJECT (src, "unable to parse device id: [%s]", src->device_id);
-    return FALSE;
-  }
-
-  c2pstrcpy (pstr, sgname);
-  g_free (sgname);
-
-  err = SGSetChannelDevice (src->video_chan, (StringPtr) & pstr);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (src, "SGSetChannelDevice returned %d", (int) err);
-    return FALSE;
-  }
-
-  err = SGSetChannelDeviceInput (src->video_chan, inputIndex);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (src, "SGSetChannelDeviceInput returned %d", (int) err);
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-static gboolean
-gst_osx_video_src_iface_supported (GstImplementsInterface * iface,
-    GType iface_type)
-{
-  return FALSE;
-}
-
-static void
-gst_osx_video_src_interface_init (GstImplementsInterfaceClass * klass)
-{
-  /* default virtual functions */
-  klass->supported = gst_osx_video_src_iface_supported;
-}
-
-static void
-gst_osx_video_src_init_interfaces (GType type)
-{
-  static const GInterfaceInfo implements_iface_info = {
-    (GInterfaceInitFunc) gst_osx_video_src_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
-      &implements_iface_info);
-
-  gst_osx_video_src_type_add_device_property_probe_interface (type);
-}
-
-static void
-gst_osx_video_src_base_init (gpointer gclass)
-{
-
-  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
-  GST_DEBUG ("%s", G_STRFUNC);
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_template));
-
-  gst_element_class_set_static_metadata (element_class, "Video Source (OSX)",
-      "Source/Video",
-      "Reads raw frames from a capture device on OS X",
-      "Ole Andre Vadla Ravnaas <ole.andre.ravnas@tandberg.com>, "
-      "Ali Sabil <ali.sabil@tandberg.com>");
-}
-
-static void
-gst_osx_video_src_class_init (GstOSXVideoSrcClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstElementClass *element_class;
-  GstBaseSrcClass *basesrc_class;
-  GstPushSrcClass *pushsrc_class;
-  OSErr err;
-
-  GST_DEBUG ("%s", G_STRFUNC);
-
-  gobject_class = G_OBJECT_CLASS (klass);
-  element_class = GST_ELEMENT_CLASS (klass);
-  basesrc_class = GST_BASE_SRC_CLASS (klass);
-  pushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
-  gobject_class->dispose = gst_osx_video_src_dispose;
-  gobject_class->finalize = (GObjectFinalizeFunc) gst_osx_video_src_finalize;
-  gobject_class->set_property =
-      GST_DEBUG_FUNCPTR (gst_osx_video_src_set_property);
-  gobject_class->get_property =
-      GST_DEBUG_FUNCPTR (gst_osx_video_src_get_property);
-
-  element_class->change_state = gst_osx_video_src_change_state;
-
-  basesrc_class->get_caps = gst_osx_video_src_get_caps;
-  basesrc_class->set_caps = gst_osx_video_src_set_caps;
-  basesrc_class->start = gst_osx_video_src_start;
-  basesrc_class->stop = gst_osx_video_src_stop;
-  basesrc_class->query = gst_osx_video_src_query;
-  basesrc_class->fixate = gst_osx_video_src_fixate;
-
-  pushsrc_class->create = gst_osx_video_src_create;
-
-  g_object_class_install_property (gobject_class, ARG_DEVICE,
-      g_param_spec_string ("device", "Device",
-          "Sequence Grabber input device in format 'sgname:input#'",
-          NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  g_object_class_install_property (gobject_class, ARG_DEVICE_NAME,
-      g_param_spec_string ("device-name", "Device name",
-          "Human-readable name of the video device",
-          NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  err = EnterMovies ();
-  if (err == noErr) {
-    klass->movies_enabled = TRUE;
-  } else {
-    klass->movies_enabled = FALSE;
-    GST_ERROR ("EnterMovies returned %d", err);
-  }
-}
-
-static void
-gst_osx_video_src_init (GstOSXVideoSrc * self, GstOSXVideoSrcClass * klass)
-{
-  GST_DEBUG_OBJECT (self, "%s", G_STRFUNC);
-
-  gst_base_src_set_format (GST_BASE_SRC (self), GST_FORMAT_TIME);
-  gst_base_src_set_live (GST_BASE_SRC (self), TRUE);
-}
-
-static void
-gst_osx_video_src_dispose (GObject * object)
-{
-  GstOSXVideoSrc *self = GST_OSX_VIDEO_SRC (object);
-  GST_DEBUG_OBJECT (object, "%s", G_STRFUNC);
-
-  if (self->device_id) {
-    g_free (self->device_id);
-    self->device_id = NULL;
-  }
-
-  if (self->device_name) {
-    g_free (self->device_name);
-    self->device_name = NULL;
-  }
-
-  if (self->buffer != NULL) {
-    gst_buffer_unref (self->buffer);
-    self->buffer = NULL;
-  }
-
-  G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_osx_video_src_finalize (GstOSXVideoSrc * self)
-{
-  GST_DEBUG_OBJECT (self, "%s", G_STRFUNC);
-
-  G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (self));
-}
-
-static void
-gst_osx_video_src_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstOSXVideoSrc *src = GST_OSX_VIDEO_SRC (object);
-
-  switch (prop_id) {
-    case ARG_DEVICE:
-      if (src->device_id) {
-        g_free (src->device_id);
-        src->device_id = NULL;
-      }
-      if (src->device_name) {
-        g_free (src->device_name);
-        src->device_name = NULL;
-      }
-      src->device_id = g_strdup (g_value_get_string (value));
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-gst_osx_video_src_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstOSXVideoSrc *src = GST_OSX_VIDEO_SRC (object);
-
-  switch (prop_id) {
-    case ARG_DEVICE:
-      if (!src->device_id)
-        device_set_default (src);
-      g_value_set_string (value, src->device_id);
-      break;
-    case ARG_DEVICE_NAME:
-      if (!src->device_name)
-        device_get_name (src);
-      g_value_set_string (value, src->device_name);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static GstCaps *
-gst_osx_video_src_get_caps (GstBaseSrc * src)
-{
-  GstElementClass *gstelement_class;
-  GstOSXVideoSrc *self;
-  GstPadTemplate *pad_template;
-  GstCaps *caps;
-  GstStructure *structure;
-  gint width, height;
-
-  gstelement_class = GST_ELEMENT_GET_CLASS (src);
-  self = GST_OSX_VIDEO_SRC (src);
-
-  /* if we don't have the resolution set up, return template caps */
-  if (!self->world)
-    return NULL;
-
-  pad_template = gst_element_class_get_pad_template (gstelement_class, "src");
-  /* i don't think this can actually fail... */
-  if (!pad_template)
-    return NULL;
-
-  width = self->rect.right;
-  height = self->rect.bottom;
-
-  caps = gst_caps_copy (gst_pad_template_get_caps (pad_template));
-
-  structure = gst_caps_get_structure (caps, 0);
-  gst_structure_set (structure, "width", G_TYPE_INT, width, NULL);
-  gst_structure_set (structure, "height", G_TYPE_INT, height, NULL);
-
-  return caps;
-}
-
-static gboolean
-gst_osx_video_src_set_caps (GstBaseSrc * src, GstCaps * caps)
-{
-  GstOSXVideoSrc *self = GST_OSX_VIDEO_SRC (src);
-  GstStructure *structure = gst_caps_get_structure (caps, 0);
-  gint width, height, framerate_num, framerate_denom;
-  float fps;
-  ComponentResult err;
-
-  GST_DEBUG_OBJECT (src, "%s", G_STRFUNC);
-
-  if (!self->seq_grab)
-    return FALSE;
-
-  gst_structure_get_int (structure, "width", &width);
-  gst_structure_get_int (structure, "height", &height);
-  gst_structure_get_fraction (structure, "framerate", &framerate_num,
-      &framerate_denom);
-  fps = (float) framerate_num / framerate_denom;
-
-  GST_DEBUG_OBJECT (src, "changing caps to %dx%d@%f", width, height, fps);
-
-  SetRect (&self->rect, 0, 0, width, height);
-
-  err = QTNewGWorld (&self->world, k422YpCbCr8PixelFormat, &self->rect, 0,
-      NULL, 0);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "QTNewGWorld returned %d", (int) err);
-    goto fail;
-  }
-
-  if (!LockPixels (GetPortPixMap (self->world))) {
-    GST_ERROR_OBJECT (self, "LockPixels failed");
-    goto fail;
-  }
-
-  err = SGSetGWorld (self->seq_grab, self->world, NULL);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGSetGWorld returned %d", (int) err);
-    goto fail;
-  }
-
-  err = SGSetChannelBounds (self->video_chan, &self->rect);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGSetChannelBounds returned %d", (int) err);
-    goto fail;
-  }
-  // ###: if we ever support choosing framerates, do something with this
-  /*err = SGSetFrameRate (self->video_chan, FloatToFixed(fps));
-     if (err != noErr) {
-     GST_ERROR_OBJECT (self, "SGSetFrameRate returned %d", (int) err);
-     goto fail;
-     } */
-
-  return TRUE;
-
-fail:
-  if (self->world) {
-    SGSetGWorld (self->seq_grab, NULL, NULL);
-    DisposeGWorld (self->world);
-    self->world = NULL;
-  }
-
-  return FALSE;
-}
-
-static void
-gst_osx_video_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
-{
-  GstStructure *structure;
-  int i;
-
-  /* this function is for choosing defaults as a last resort */
-  for (i = 0; i < (int) gst_caps_get_size (caps); ++i) {
-    structure = gst_caps_get_structure (caps, i);
-    gst_structure_fixate_field_nearest_int (structure, "width", 640);
-    gst_structure_fixate_field_nearest_int (structure, "height", 480);
-
-    // ###: if we ever support choosing framerates, do something with this
-    //gst_structure_fixate_field_nearest_fraction (structure, "framerate", 15, 2);
-  }
-}
-
-static gboolean
-gst_osx_video_src_start (GstBaseSrc * src)
-{
-  GstOSXVideoSrc *self;
-  GObjectClass *gobject_class;
-  GstOSXVideoSrcClass *klass;
-  ComponentResult err;
-
-  self = GST_OSX_VIDEO_SRC (src);
-  gobject_class = G_OBJECT_GET_CLASS (src);
-  klass = GST_OSX_VIDEO_SRC_CLASS (gobject_class);
-
-  GST_DEBUG_OBJECT (src, "entering");
-
-  if (!klass->movies_enabled)
-    return FALSE;
-
-  self->seq_num = 0;
-
-  self->seq_grab = OpenDefaultComponent (SeqGrabComponentType, 0);
-  if (self->seq_grab == NULL) {
-    err = paramErr;
-    GST_ERROR_OBJECT (self, "OpenDefaultComponent failed. paramErr=%d",
-        (int) err);
-    goto fail;
-  }
-
-  err = SGInitialize (self->seq_grab);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGInitialize returned %d", (int) err);
-    goto fail;
-  }
-
-  err = SGSetDataRef (self->seq_grab, 0, 0, seqGrabDontMakeMovie);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGSetDataRef returned %d", (int) err);
-    goto fail;
-  }
-
-  err = SGNewChannel (self->seq_grab, VideoMediaType, &self->video_chan);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGNewChannel returned %d", (int) err);
-    goto fail;
-  }
-
-  if (!device_select (self))
-    goto fail;
-
-  GST_DEBUG_OBJECT (self, "started");
-  return TRUE;
-
-fail:
-  self->video_chan = NULL;
-
-  if (self->seq_grab) {
-    err = CloseComponent (self->seq_grab);
-    if (err != noErr)
-      GST_WARNING_OBJECT (self, "CloseComponent returned %d", (int) err);
-    self->seq_grab = NULL;
-  }
-
-  return FALSE;
-}
-
-static gboolean
-gst_osx_video_src_stop (GstBaseSrc * src)
-{
-  GstOSXVideoSrc *self;
-  ComponentResult err;
-
-  self = GST_OSX_VIDEO_SRC (src);
-
-  GST_DEBUG_OBJECT (src, "stopping");
-
-  self->video_chan = NULL;
-
-  err = CloseComponent (self->seq_grab);
-  if (err != noErr)
-    GST_WARNING_OBJECT (self, "CloseComponent returned %d", (int) err);
-  self->seq_grab = NULL;
-
-  DisposeGWorld (self->world);
-  self->world = NULL;
-
-  if (self->buffer != NULL) {
-    gst_buffer_unref (self->buffer);
-    self->buffer = NULL;
-  }
-
-  return TRUE;
-}
-
-static gboolean
-gst_osx_video_src_query (GstBaseSrc * bsrc, GstQuery * query)
-{
-  GstOSXVideoSrc *self;
-  gboolean res = FALSE;
-
-  self = GST_OSX_VIDEO_SRC (bsrc);
-
-  switch (GST_QUERY_TYPE (query)) {
-    case GST_QUERY_LATENCY:
-    {
-      GstClockTime min_latency, max_latency;
-      gint fps_n, fps_d;
-
-      fps_n = FRAMERATE;
-      fps_d = 1;
-
-      /* 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 */
-      // FIXME: we don't know what this is, so we'll just say 2 frames
-      max_latency = 2 * 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;
-  }
-
-  return res;
-}
-
-static GstStateChangeReturn
-gst_osx_video_src_change_state (GstElement * element, GstStateChange transition)
-{
-  GstStateChangeReturn result;
-  GstOSXVideoSrc *self;
-  ComponentResult err;
-
-  result = GST_STATE_CHANGE_SUCCESS;
-  self = GST_OSX_VIDEO_SRC (element);
-
-  // ###: prepare_capture in READY->PAUSED?
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
-    {
-      ImageDescriptionHandle imageDesc;
-      Rect sourceRect;
-      MatrixRecord scaleMatrix;
-
-      if (!prepare_capture (self))
-        return GST_STATE_CHANGE_FAILURE;
-
-      // ###: should we start recording /after/ making the decompressionsequence?
-      //   CocoaSequenceGrabber does it beforehand, so we do too, but it feels
-      //   wrong.
-      err = SGStartRecord (self->seq_grab);
-      if (err != noErr) {
-        /* since we prepare here, we should also unprepare */
-        SGRelease (self->seq_grab);
-
-        GST_ERROR_OBJECT (self, "SGStartRecord returned %d", (int) err);
-        return GST_STATE_CHANGE_FAILURE;
-      }
-
-      imageDesc = (ImageDescriptionHandle) NewHandle (0);
-
-      err = SGGetChannelSampleDescription (self->video_chan,
-          (Handle) imageDesc);
-      if (err != noErr) {
-        SGStop (self->seq_grab);
-        SGRelease (self->seq_grab);
-        DisposeHandle ((Handle) imageDesc);
-        GST_ERROR_OBJECT (self, "SGGetChannelSampleDescription returned %d",
-            (int) err);
-        return GST_STATE_CHANGE_FAILURE;
-      }
-
-      GST_DEBUG_OBJECT (self, "actual capture resolution is %dx%d",
-          (int) (**imageDesc).width, (int) (**imageDesc).height);
-
-      SetRect (&sourceRect, 0, 0, (**imageDesc).width, (**imageDesc).height);
-      RectMatrix (&scaleMatrix, &sourceRect, &self->rect);
-
-      err = DecompressSequenceBegin (&self->dec_seq, imageDesc, self->world,
-          NULL, NULL, &scaleMatrix, srcCopy, NULL, 0, codecNormalQuality,
-          bestSpeedCodec);
-      if (err != noErr) {
-        SGStop (self->seq_grab);
-        SGRelease (self->seq_grab);
-        DisposeHandle ((Handle) imageDesc);
-        GST_ERROR_OBJECT (self, "DecompressSequenceBegin returned %d",
-            (int) err);
-        return GST_STATE_CHANGE_FAILURE;
-      }
-
-      DisposeHandle ((Handle) imageDesc);
-      break;
-    }
-    default:
-      break;
-  }
-
-  result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-  if (result == GST_STATE_CHANGE_FAILURE)
-    return result;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_PAUSED_TO_READY:
-      SGStop (self->seq_grab);
-
-      err = CDSequenceEnd (self->dec_seq);
-      if (err != noErr)
-        GST_WARNING_OBJECT (self, "CDSequenceEnd returned %d", (int) err);
-      self->dec_seq = 0;
-
-      SGRelease (self->seq_grab);
-      break;
-    default:
-      break;
-  }
-
-  return result;
-}
-
-static GstFlowReturn
-gst_osx_video_src_create (GstPushSrc * src, GstBuffer ** buf)
-{
-  GstOSXVideoSrc *self = GST_OSX_VIDEO_SRC (src);
-  ComponentResult err;
-  GstCaps *caps;
-  //GstClock * clock;
-
-  // ###: we need to sleep between calls to SGIdle.  originally, the sleeping
-  //   was done using gst_clock_id_wait(), but it turns out that approach
-  //   doesn't work well.  it has two issues:
-  //   1) every so often, gst_clock_id_wait() will block for a much longer
-  //      period of time than requested (upwards of a minute) causing video
-  //      to freeze until it finally returns.  this seems to happen once
-  //      every few minutes, which probably means something like 1 in every
-  //      several hundred calls gst_clock_id_wait() does the wrong thing.
-  //   2) even when the gst_clock approach is working properly, it uses
-  //      quite a bit of cpu in comparison to a simple usleep().  on one
-  //      test machine, using gst_clock_id_wait() caused osxvideosrc to use
-  //      nearly 100% cpu, while using usleep() brough the usage to less
-  //      than 10%.
-  //
-  // so, for now, we comment out the gst_clock stuff and use usleep.
-
-  //clock = gst_system_clock_obtain ();
-  do {
-    err = SGIdle (self->seq_grab);
-    if (err != noErr) {
-      GST_ERROR_OBJECT (self, "SGIdle returned %d", (int) err);
-      gst_object_unref (clock);
-      return GST_FLOW_UNEXPECTED;
-    }
-
-    if (self->buffer == NULL) {
-      /*GstClockID clock_id;
-
-         clock_id = gst_clock_new_single_shot_id (clock,
-         (GstClockTime) (gst_clock_get_time(clock) +
-         (GST_SECOND / ((float)FRAMERATE * 2))));
-         gst_clock_id_wait (clock_id, NULL);
-         gst_clock_id_unref (clock_id); */
-
-      usleep (1000000 / (FRAMERATE * 2));
-    }
-  } while (self->buffer == NULL);
-  //gst_object_unref (clock);
-
-  *buf = self->buffer;
-  self->buffer = NULL;
-
-  caps = gst_pad_get_caps (GST_BASE_SRC_PAD (src));
-  gst_buffer_set_caps (*buf, caps);
-  gst_caps_unref (caps);
-
-  return GST_FLOW_OK;
-}
-
-static OSErr
-data_proc (SGChannel c, Ptr p, long len, long *offset, long chRefCon,
-    TimeValue time, short writeType, long refCon)
-{
-  GstOSXVideoSrc *self;
-  gint fps_n, fps_d;
-  GstClockTime duration, timestamp, latency;
-  CodecFlags flags;
-  ComponentResult err;
-  PixMapHandle hPixMap;
-  Rect portRect;
-  int pix_rowBytes;
-  void *pix_ptr;
-  int pix_height;
-  int pix_size;
-
-  self = GST_OSX_VIDEO_SRC (refCon);
-
-  if (self->buffer != NULL) {
-    gst_buffer_unref (self->buffer);
-    self->buffer = NULL;
-  }
-
-  err = DecompressSequenceFrameS (self->dec_seq, p, len, 0, &flags, NULL);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "DecompressSequenceFrameS returned %d", (int) err);
-    return err;
-  }
-
-  hPixMap = GetGWorldPixMap (self->world);
-  LockPixels (hPixMap);
-  GetPortBounds (self->world, &portRect);
-  pix_rowBytes = (int) GetPixRowBytes (hPixMap);
-  pix_ptr = GetPixBaseAddr (hPixMap);
-  pix_height = (portRect.bottom - portRect.top);
-  pix_size = pix_rowBytes * pix_height;
-
-  GST_DEBUG_OBJECT (self, "num=%5d, height=%d, rowBytes=%d, size=%d",
-      self->seq_num, pix_height, pix_rowBytes, pix_size);
-
-  fps_n = FRAMERATE;
-  fps_d = 1;
-
-  duration = gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
-  latency = duration;
-
-  timestamp = gst_clock_get_time (GST_ELEMENT_CAST (self)->clock);
-  timestamp -= gst_element_get_base_time (GST_ELEMENT_CAST (self));
-  if (timestamp > latency)
-    timestamp -= latency;
-  else
-    timestamp = 0;
-
-  self->buffer = gst_buffer_new_and_alloc (pix_size);
-  GST_BUFFER_OFFSET (self->buffer) = self->seq_num;
-  GST_BUFFER_TIMESTAMP (self->buffer) = timestamp;
-  memcpy (GST_BUFFER_DATA (self->buffer), pix_ptr, pix_size);
-
-  self->seq_num++;
-
-  UnlockPixels (hPixMap);
-
-  return noErr;
-}
-
-static gboolean
-prepare_capture (GstOSXVideoSrc * self)
-{
-  ComponentResult err;
-
-  err = SGSetChannelUsage (self->video_chan, seqGrabRecord);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGSetChannelUsage returned %d", (int) err);
-    return FALSE;
-  }
-
-  err = SGSetDataProc (self->seq_grab, NewSGDataUPP (data_proc), (long) self);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGSetDataProc returned %d", (int) err);
-    return FALSE;
-  }
-
-  err = SGPrepare (self->seq_grab, false, true);
-  if (err != noErr) {
-    GST_ERROR_OBJECT (self, "SGPrepare returnd %d", (int) err);
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-static const GList *
-probe_get_properties (GstPropertyProbe * probe)
-{
-  GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
-  static GList *list = NULL;
-
-  // ###: from gstalsadeviceprobe.c
-  /* 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));
-
-  if (!list) {
-    GParamSpec *pspec;
-
-    pspec = g_object_class_find_property (klass, "device");
-    list = g_list_append (NULL, pspec);
-  }
-
-  GST_CLASS_UNLOCK (GST_OBJECT_CLASS (klass));
-
-  return list;
-}
-
-static void
-probe_probe_property (GstPropertyProbe * probe, guint prop_id,
-    const GParamSpec * pspec)
-{
-  /* we do nothing in here.  the actual "probe" occurs in get_values(),
-   * which is a common practice when not caching responses.
-   */
-
-  if (!g_str_equal (pspec->name, "device")) {
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-  }
-}
-
-static gboolean
-probe_needs_probe (GstPropertyProbe * probe, guint prop_id,
-    const GParamSpec * pspec)
-{
-  /* don't cache probed data */
-  return TRUE;
-}
-
-static GValueArray *
-probe_get_values (GstPropertyProbe * probe, guint prop_id,
-    const GParamSpec * pspec)
-{
-  GstOSXVideoSrc *src;
-  GValueArray *array;
-  GValue value = { 0, };
-  GList *l, *list;
-  video_device *dev;
-
-  if (!g_str_equal (pspec->name, "device")) {
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
-    return NULL;
-  }
-
-  src = GST_OSX_VIDEO_SRC (probe);
-
-  list = device_list (src);
-
-  if (list == NULL) {
-    GST_LOG_OBJECT (probe, "No devices found");
-    return NULL;
-  }
-
-  array = g_value_array_new (g_list_length (list));
-  g_value_init (&value, G_TYPE_STRING);
-  for (l = list; l != NULL; l = l->next) {
-    dev = (video_device *) l->data;
-    GST_LOG_OBJECT (probe, "Found device: %s", dev->id);
-    g_value_take_string (&value, dev->id);
-    dev->id = NULL;
-    video_device_free (dev);
-    l->data = NULL;
-    g_value_array_append (array, &value);
-  }
-  g_value_unset (&value);
-  g_list_free (list);
-
-  return array;
-}
-
-static void
-gst_osx_video_src_property_probe_interface_init (GstPropertyProbeInterface *
-    iface)
-{
-  iface->get_properties = probe_get_properties;
-  iface->probe_property = probe_probe_property;
-  iface->needs_probe = probe_needs_probe;
-  iface->get_values = probe_get_values;
-}
-
-void
-gst_osx_video_src_type_add_device_property_probe_interface (GType type)
-{
-  static const GInterfaceInfo probe_iface_info = {
-    (GInterfaceInitFunc) gst_osx_video_src_property_probe_interface_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE,
-      &probe_iface_info);
-}
diff --git a/sys/osxvideo/osxvideosrc.h b/sys/osxvideo/osxvideosrc.h
deleted file mode 100644
index b10a5a4..0000000
--- a/sys/osxvideo/osxvideosrc.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * GStreamer
- * Copyright 2007 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
- * Copyright 2007 Ali Sabil <ali.sabil@tandberg.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_OSX_VIDEO_SRC_H__
-#define __GST_OSX_VIDEO_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-#include <Quicktime/Quicktime.h>
-
-GST_DEBUG_CATEGORY_EXTERN (gst_debug_osx_video_src);
-
-G_BEGIN_DECLS
-
-/* #defines don't like whitespacey bits */
-#define GST_TYPE_OSX_VIDEO_SRC \
-  (gst_osx_video_src_get_type())
-#define GST_OSX_VIDEO_SRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OSX_VIDEO_SRC,GstOSXVideoSrc))
-#define GST_OSX_VIDEO_SRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OSX_VIDEO_SRC,GstOSXVideoSrcClass))
-#define GST_IS_OSX_VIDEO_SRC(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OSX_VIDEO_SRC))
-#define GST_IS_OSX_VIDEO_SRC_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OSX_VIDEO_SRC))
-
-typedef struct _GstOSXVideoSrc GstOSXVideoSrc;
-typedef struct _GstOSXVideoSrcClass GstOSXVideoSrcClass;
-
-struct _GstOSXVideoSrc
-{
-  GstPushSrc pushsrc;
-
-  gchar * device_id;
-  gchar * device_name;
-  SeqGrabComponent seq_grab;
-  SGChannel video_chan;
-  GWorldPtr world;
-  Rect rect;
-  ImageSequence dec_seq;
-
-  GstBuffer * buffer;
-  guint seq_num;
-};
-
-struct _GstOSXVideoSrcClass
-{
-  GstPushSrcClass parent_class;
-  gboolean movies_enabled;
-};
-
-GType gst_osx_video_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_OSX_VIDEO_SRC_H__ */
diff --git a/sys/pvr2d/Makefile.in b/sys/pvr2d/Makefile.in
index bbb3065..d2833c1 100644
--- a/sys/pvr2d/Makefile.in
+++ b/sys/pvr2d/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/qtwrapper/Makefile.am b/sys/qtwrapper/Makefile.am
deleted file mode 100644
index 29b894f..0000000
--- a/sys/qtwrapper/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-plugin_LTLIBRARIES = libgstqtwrapper.la
-
-# sources used to compile this plug-in
-libgstqtwrapper_la_SOURCES = \
-	qtwrapper.c		\
-	qtutils.c		\
-	codecmapping.c		\
-	audiodecoders.c		\
-	videodecoders.c		\
-	imagedescription.c
-
-# flags used to compile this plugin
-# add other _CFLAGS and _LIBS as needed
-libgstqtwrapper_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
-libgstqtwrapper_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
-libgstqtwrapper_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -Wl,-framework,CoreAudio,-framework,AudioToolbox,-framework,Carbon,-framework,QuickTime,-framework,QuartzCore
-libgstqtwrapper_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-# headers we need but don't want installed
-noinst_HEADERS = 		\
-	codecmapping.h		\
-	qtwrapper.h		\
-	qtutils.h		\
-	imagedescription.h
diff --git a/sys/qtwrapper/audiodecoders.c b/sys/qtwrapper/audiodecoders.c
deleted file mode 100644
index 0a6ddbc..0000000
--- a/sys/qtwrapper/audiodecoders.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- * GStreamer QuickTime audio decoder codecs wrapper
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007, 2008> Pioneers of the Inevitable 
- *                              <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/gst.h>
-#include "qtwrapper.h"
-#include "codecmapping.h"
-#include "qtutils.h"
-
-#ifdef G_OS_WIN32
-#include <QuickTimeComponents.h>
-#else
-#include <QuickTime/QuickTimeComponents.h>
-#endif
-
-#define QTWRAPPER_ADEC_PARAMS_QDATA g_quark_from_static_string("qtwrapper-adec-params")
-
-#define NO_MORE_INPUT_DATA 42
-
-static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-raw-float, "
-        "endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
-        "signed = (boolean) { TRUE }, "
-        "width = (int) 32, "
-        "depth = (int) 32, " "rate = (int) [1, MAX], "
-        "channels = (int) [1, MAX]")
-    );
-
-typedef struct _QTWrapperAudioDecoder QTWrapperAudioDecoder;
-typedef struct _QTWrapperAudioDecoderClass QTWrapperAudioDecoderClass;
-
-struct _QTWrapperAudioDecoder
-{
-  GstElement parent;
-
-  GstPad *sinkpad;
-  GstPad *srcpad;
-
-  /* FIXME : all following should be protected by a mutex */
-  ComponentInstance adec;       /* The Audio Decoder component */
-  AudioStreamBasicDescription indesc, outdesc;
-
-  guint samplerate;
-  guint channels;
-
-  AudioBufferList *bufferlist;
-  AudioStreamPacketDescription aspd[1];
-
-  /* first time received after NEWSEGMENT */
-  GstClockTime initial_time;
-  /* offset in samples from the initial time */
-  guint64 cur_offset;
-  /* TRUE just after receiving a NEWSEGMENT */
-  gboolean gotnewsegment;
-
-  /* Data for StdAudio callbacks */
-  GstBuffer *input_buffer;
-};
-
-struct _QTWrapperAudioDecoderClass
-{
-  GstElementClass parent_class;
-
-  /* fourcc of the format */
-  guint32 componentSubType;
-
-  GstPadTemplate *sinktempl;
-};
-
-typedef struct _QTWrapperAudioDecoderParams QTWrapperAudioDecoderParams;
-
-struct _QTWrapperAudioDecoderParams
-{
-  Component component;
-  GstCaps *sinkcaps;
-};
-
-static gboolean qtwrapper_audio_decoder_sink_setcaps (GstPad * pad,
-    GstCaps * caps);
-static GstFlowReturn qtwrapper_audio_decoder_chain (GstPad * pad,
-    GstBuffer * buf);
-static gboolean qtwrapper_audio_decoder_sink_event (GstPad * pad,
-    GstEvent * event);
-
-static void
-qtwrapper_audio_decoder_init (QTWrapperAudioDecoder * qtwrapper)
-{
-  QTWrapperAudioDecoderClass *oclass;
-
-  oclass = (QTWrapperAudioDecoderClass *) (G_OBJECT_GET_CLASS (qtwrapper));
-
-  /* Sink pad */
-  qtwrapper->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
-  gst_pad_set_setcaps_function (qtwrapper->sinkpad,
-      GST_DEBUG_FUNCPTR (qtwrapper_audio_decoder_sink_setcaps));
-  gst_pad_set_chain_function (qtwrapper->sinkpad,
-      GST_DEBUG_FUNCPTR (qtwrapper_audio_decoder_chain));
-  gst_pad_set_event_function (qtwrapper->sinkpad,
-      GST_DEBUG_FUNCPTR (qtwrapper_audio_decoder_sink_event));
-  gst_element_add_pad (GST_ELEMENT (qtwrapper), qtwrapper->sinkpad);
-
-  /* Source pad */
-  qtwrapper->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
-  gst_element_add_pad (GST_ELEMENT (qtwrapper), qtwrapper->srcpad);
-}
-
-static void
-clear_AudioStreamBasicDescription (AudioStreamBasicDescription * desc)
-{
-  desc->mSampleRate = 0;
-  desc->mFormatID = 0;
-  desc->mFormatFlags = 0;
-  desc->mBytesPerPacket = 0;
-  desc->mFramesPerPacket = 0;
-  desc->mBytesPerFrame = 0;
-  desc->mChannelsPerFrame = 0;
-  desc->mBitsPerChannel = 0;
-  desc->mReserved = 0;
-}
-
-static void
-fill_indesc_mp3 (QTWrapperAudioDecoder * qtwrapper, guint32 fourcc, gint rate,
-    gint channels)
-{
-  GST_INFO_OBJECT (qtwrapper, "Filling input description for MP3 data");
-  clear_AudioStreamBasicDescription (&qtwrapper->indesc);
-  /* only the samplerate is needed apparently */
-  qtwrapper->indesc.mSampleRate = (double) rate;
-  qtwrapper->indesc.mFormatID = kAudioFormatMPEGLayer3;
-  qtwrapper->indesc.mChannelsPerFrame = channels;
-}
-
-static void
-fill_indesc_aac (QTWrapperAudioDecoder * qtwrapper, guint32 fourcc, gint rate,
-    gint channels)
-{
-  clear_AudioStreamBasicDescription (&qtwrapper->indesc);
-  qtwrapper->indesc.mSampleRate = (double) rate;
-  qtwrapper->indesc.mFormatID = kAudioFormatMPEG4AAC;
-  /* aac always has 1024 frames per packet */
-  qtwrapper->indesc.mFramesPerPacket = 1024;
-  qtwrapper->indesc.mChannelsPerFrame = channels;
-}
-
-static void
-fill_indesc_samr (QTWrapperAudioDecoder * qtwrapper, guint32 fourcc,
-    gint channels)
-{
-  clear_AudioStreamBasicDescription (&qtwrapper->indesc);
-  qtwrapper->indesc.mSampleRate = 8000;
-  qtwrapper->indesc.mFormatID = fourcc;
-  qtwrapper->indesc.mChannelsPerFrame = 1;
-  qtwrapper->indesc.mFramesPerPacket = 160;
-}
-
-static void
-fill_indesc_generic (QTWrapperAudioDecoder * qtwrapper, guint32 fourcc,
-    gint rate, gint channels)
-{
-  clear_AudioStreamBasicDescription (&qtwrapper->indesc);
-  qtwrapper->indesc.mSampleRate = rate;
-  qtwrapper->indesc.mFormatID = fourcc;
-  qtwrapper->indesc.mChannelsPerFrame = channels;
-}
-
-static void
-fill_indesc_alac (QTWrapperAudioDecoder * qtwrapper, guint32 fourcc,
-    gint rate, gint channels)
-{
-  clear_AudioStreamBasicDescription (&qtwrapper->indesc);
-  qtwrapper->indesc.mSampleRate = rate;
-  qtwrapper->indesc.mFormatID = fourcc;
-  qtwrapper->indesc.mChannelsPerFrame = channels;
-
-  // This has to be set, but the particular value doesn't seem to matter much
-  qtwrapper->indesc.mFramesPerPacket = 4096;
-}
-
-static gpointer
-make_alac_magic_cookie (GstBuffer * codec_data, gsize * len)
-{
-  guint8 *res;
-
-  if (GST_BUFFER_SIZE (codec_data) < 4)
-    return NULL;
-
-  *len = 20 + GST_BUFFER_SIZE (codec_data);
-  res = g_malloc0 (*len);
-
-  /* 12 first bytes are 'frma' (format) atom with 'alac' value */
-  GST_WRITE_UINT32_BE (res, 0xc);       /* Atom length: 12 bytes */
-  GST_WRITE_UINT32_LE (res + 4, QT_MAKE_FOURCC_BE ('f', 'r', 'm', 'a'));
-  GST_WRITE_UINT32_LE (res + 8, QT_MAKE_FOURCC_BE ('a', 'l', 'a', 'c'));
-
-  /* Write the codec_data, but with the first four bytes reversed (different
-     endianness). This is the 'alac' atom. */
-  GST_WRITE_UINT32_BE (res + 12,
-      GST_READ_UINT32_LE (GST_BUFFER_DATA (codec_data)));
-  memcpy (res + 16, GST_BUFFER_DATA (codec_data) + 4,
-      GST_BUFFER_SIZE (codec_data) - 4);
-
-  /* Terminator atom */
-  GST_WRITE_UINT32_BE (res + 12 + GST_BUFFER_SIZE (codec_data), 8);
-  GST_WRITE_UINT32_BE (res + 12 + GST_BUFFER_SIZE (codec_data) + 4, 0);
-
-  return res;
-}
-
-static gpointer
-make_samr_magic_cookie (GstBuffer * codec_data, gsize * len)
-{
-  guint8 *res;
-
-  *len = 48;
-  res = g_malloc0 (0x30);
-
-  /* 12 first bytes are 'frma' (format) atom with 'samr' value */
-  GST_WRITE_UINT32_BE (res, 0xc);
-  GST_WRITE_UINT32_LE (res + 4, QT_MAKE_FOURCC_BE ('f', 'r', 'm', 'a'));
-  GST_WRITE_UINT32_LE (res + 8, QT_MAKE_FOURCC_BE ('s', 'a', 'm', 'r'));
-
-  /* 10 bytes for 'enda' atom with 0 */
-  GST_WRITE_UINT32_BE (res + 12, 10);
-  GST_WRITE_UINT32_LE (res + 16, QT_MAKE_FOURCC_BE ('e', 'n', 'd', 'a'));
-
-  /* 17(+1) bytes for the codec_data contents */
-  GST_WRITE_UINT32_BE (res + 22, 18);
-  memcpy (res + 26, GST_BUFFER_DATA (codec_data) + 4, 17);
-
-  /* yes... we need to replace 'damr' by 'samr'. Blame Apple ! */
-  GST_WRITE_UINT8 (res + 26, 's');
-
-  /* Terminator atom */
-  GST_WRITE_UINT32_BE (res + 40, 8);
-
-#if DEBUG_DUMP
-  gst_util_dump_mem (res, 48);
-#endif
-
-  return res;
-}
-
-static int
-write_len (guint8 * buf, int val)
-{
-  /* This is some sort of variable-length coding, but the quicktime
-   * file(s) I have here all just use a 4-byte version, so we'll do that.
-   * Return the number of bytes written;
-   */
-  buf[0] = ((val >> 21) & 0x7f) | 0x80;
-  buf[1] = ((val >> 14) & 0x7f) | 0x80;
-  buf[2] = ((val >> 7) & 0x7f) | 0x80;
-  buf[3] = ((val >> 0) & 0x7f);
-
-  return 4;
-}
-
-static void
-aac_parse_codec_data (GstBuffer * codec_data, gint * channels)
-{
-  guint8 *data = GST_BUFFER_DATA (codec_data);
-  guint codec_channels;
-
-  if (GST_BUFFER_SIZE (codec_data) < 2) {
-    GST_WARNING ("Cannot parse codec_data for channel count");
-    return;
-  }
-
-  codec_channels = (data[1] & 0x7f) >> 3;
-
-  if (*channels != codec_channels) {
-    GST_INFO ("Overwriting channels %d with %d", *channels, codec_channels);
-    *channels = (gint) codec_channels;
-  } else {
-    GST_INFO ("Retaining channel count %d", codec_channels);
-  }
-}
-
-/* The AAC decoder requires the entire mpeg4 audio elementary stream 
- * descriptor, which is the body (except the 4-byte version field) of
- * the quicktime 'esds' atom. However, qtdemux only passes through the 
- * (two byte, normally) payload, so we need to reconstruct the ESD */
-
-/* TODO: Get the AAC spec, and verify this implementation */
-static gpointer
-make_aac_magic_cookie (GstBuffer * codec_data, gsize * len)
-{
-  guint8 *cookie;
-  int offset = 0;
-  int decoder_specific_len = GST_BUFFER_SIZE (codec_data);
-  int config_len = 13 + 5 + decoder_specific_len;
-  int es_len = 3 + 5 + config_len + 5 + 1;
-  int total_len = es_len + 5;
-
-  cookie = g_malloc0 (total_len);
-  *len = total_len;
-
-  /* Structured something like this:
-   * [ES Descriptor
-   *  [Config Descriptor
-   *   [Specific Descriptor]]
-   *  [Unknown]]
-   */
-
-  QT_WRITE_UINT8 (cookie + offset, 0x03);
-  offset += 1;                  /* ES Descriptor tag */
-  offset += write_len (cookie + offset, es_len);
-  QT_WRITE_UINT16 (cookie + offset, 0);
-  offset += 2;                  /* Track ID */
-  QT_WRITE_UINT8 (cookie + offset, 0);
-  offset += 1;                  /* Flags */
-
-  QT_WRITE_UINT8 (cookie + offset, 0x04);
-  offset += 1;                  /* Config Descriptor tag */
-  offset += write_len (cookie + offset, config_len);
-
-  /* TODO: Fix these up */
-  QT_WRITE_UINT8 (cookie + offset, 0x40);
-  offset += 1;                  /* object_type_id */
-  QT_WRITE_UINT8 (cookie + offset, 0x15);
-  offset += 1;                  /* stream_type */
-  QT_WRITE_UINT24 (cookie + offset, 0x1800);
-  offset += 3;                  /* buffer_size_db */
-  QT_WRITE_UINT32 (cookie + offset, 128000);
-  offset += 4;                  /* max_bitrate */
-  QT_WRITE_UINT32 (cookie + offset, 128000);
-  offset += 4;                  /* avg_bitrate */
-
-  QT_WRITE_UINT8 (cookie + offset, 0x05);
-  offset += 1;                  /* Specific Descriptor tag */
-  offset += write_len (cookie + offset, decoder_specific_len);
-  memcpy (cookie + offset, GST_BUFFER_DATA (codec_data), decoder_specific_len);
-  offset += decoder_specific_len;
-
-  /* TODO: What is this? 'SL descriptor' apparently, but what does that mean? */
-  QT_WRITE_UINT8 (cookie + offset, 0x06);
-  offset += 1;                  /* SL Descriptor tag */
-  offset += write_len (cookie + offset, 1);
-  QT_WRITE_UINT8 (cookie + offset, 2);
-  offset += 1;
-
-  return cookie;
-}
-
-static void
-close_decoder (QTWrapperAudioDecoder * qtwrapper)
-{
-  if (qtwrapper->adec) {
-    CloseComponent (qtwrapper->adec);
-    qtwrapper->adec = NULL;
-  }
-
-  if (qtwrapper->bufferlist) {
-    DestroyAudioBufferList (qtwrapper->bufferlist);
-    qtwrapper->bufferlist = NULL;
-  }
-}
-
-static gboolean
-open_decoder (QTWrapperAudioDecoder * qtwrapper, GstCaps * caps,
-    GstCaps ** othercaps)
-{
-  gboolean ret = FALSE;
-  QTWrapperAudioDecoderClass *oclass;
-
-  /* TODO: these will be used as the output rate/channels for formats that
-   * don't supply these in the caps. This isn't very nice!
-   */
-  gint channels = 2;
-  gint rate = 44100;
-
-  OSStatus status;
-  GstStructure *s;
-  gchar *tmp;
-  const GValue *value;
-  GstBuffer *codec_data = NULL;
-  gboolean have_esds = FALSE;
-
-  /* Clean up any existing decoder */
-  close_decoder (qtwrapper);
-
-  tmp = gst_caps_to_string (caps);
-  GST_LOG_OBJECT (qtwrapper, "caps: %s", tmp);
-  g_free (tmp);
-
-  /* extract rate/channels information from the caps */
-  s = gst_caps_get_structure (caps, 0);
-  gst_structure_get_int (s, "rate", &rate);
-  gst_structure_get_int (s, "channels", &channels);
-
-  /* get codec_data */
-  if ((value = gst_structure_get_value (s, "codec_data"))) {
-    codec_data = GST_BUFFER_CAST (gst_value_get_mini_object (value));
-  }
-
-  oclass = (QTWrapperAudioDecoderClass *) (G_OBJECT_GET_CLASS (qtwrapper));
-
-  if (codec_data
-      && oclass->componentSubType == QT_MAKE_FOURCC_LE ('m', 'p', '4', 'a')) {
-    /* QuickTime/iTunes creates AAC files with the wrong channel count in the header,
-       so parse that out of the codec data if we can.
-     */
-    aac_parse_codec_data (codec_data, &channels);
-  }
-
-  /* If the quicktime demuxer gives us a full esds atom, use that instead of 
-   * the codec_data */
-  if ((value = gst_structure_get_value (s, "quicktime_esds"))) {
-    have_esds = TRUE;
-    codec_data = GST_BUFFER_CAST (gst_value_get_mini_object (value));
-  }
-#if DEBUG_DUMP
-  if (codec_data)
-    gst_util_dump_mem (GST_BUFFER_DATA (codec_data),
-        GST_BUFFER_SIZE (codec_data));
-#endif
-
-
-  GST_INFO_OBJECT (qtwrapper, "rate:%d, channels:%d", rate, channels);
-
-  GST_INFO_OBJECT (qtwrapper, "componentSubType is %" GST_FOURCC_FORMAT,
-      QT_FOURCC_ARGS (oclass->componentSubType));
-
-  /* Setup the input format description, some format require special handling */
-  switch (oclass->componentSubType) {
-    case QT_MAKE_FOURCC_LE ('.', 'm', 'p', '3'):
-      fill_indesc_mp3 (qtwrapper, oclass->componentSubType, rate, channels);
-      break;
-    case QT_MAKE_FOURCC_LE ('m', 'p', '4', 'a'):
-      fill_indesc_aac (qtwrapper, oclass->componentSubType, rate, channels);
-      break;
-    case QT_MAKE_FOURCC_LE ('s', 'a', 'm', 'r'):
-      fill_indesc_samr (qtwrapper, oclass->componentSubType, channels);
-      rate = 8000;
-      break;
-    case QT_MAKE_FOURCC_LE ('a', 'l', 'a', 'c'):
-      fill_indesc_alac (qtwrapper, oclass->componentSubType, rate, channels);
-      break;
-    default:
-      fill_indesc_generic (qtwrapper, oclass->componentSubType, rate, channels);
-      break;
-  }
-
-#if DEBUG_DUMP
-  gst_util_dump_mem ((gpointer) & qtwrapper->indesc,
-      sizeof (AudioStreamBasicDescription));
-#endif
-
-  qtwrapper->samplerate = rate;
-  qtwrapper->channels = channels;
-
-  /* Create an instance of SCAudio */
-  status = OpenADefaultComponent (StandardCompressionType,
-      StandardCompressionSubTypeAudio, &qtwrapper->adec);
-  if (status) {
-    GST_WARNING_OBJECT (qtwrapper,
-        "Error instantiating SCAudio component: %ld", status);
-    qtwrapper->adec = NULL;
-    goto beach;
-  }
-
-  /* This is necessary to make setting the InputBasicDescription succeed;
-     without it SCAudio only accepts PCM as input. Presumably a bug in
-     QuickTime. Thanks to Arek for figuring this one out!
-   */
-  {
-    QTAtomContainer audiosettings = NULL;
-
-    SCGetSettingsAsAtomContainer (qtwrapper->adec, &audiosettings);
-    SCSetSettingsFromAtomContainer (qtwrapper->adec, audiosettings);
-
-    /* TODO: Figure out if disposing of the QTAtomContainer is needed here */
-  }
-
-  /* Set the input description info on the SCAudio instance */
-  status = QTSetComponentProperty (qtwrapper->adec, kQTPropertyClass_SCAudio,
-      kQTSCAudioPropertyID_InputBasicDescription,
-      sizeof (qtwrapper->indesc), &qtwrapper->indesc);
-  if (status) {
-    GST_WARNING_OBJECT (qtwrapper,
-        "Error setting input description on SCAudio: %ld", status);
-
-    GST_ELEMENT_ERROR (qtwrapper, STREAM, NOT_IMPLEMENTED,
-        ("A QuickTime error occurred trying to decode this stream"),
-        ("QuickTime returned error status %lx", status));
-    goto beach;
-  }
-
-  /* TODO: we can select a channel layout here, figure out if we want to */
-
-  /* if we have codec_data, give it to the converter ! */
-  if (codec_data) {
-    gsize len = 0;
-    gpointer magiccookie;
-
-    switch (oclass->componentSubType) {
-        /* Some decoders want the 'magic cookie' in a different format from how
-         * gstreamer represents it. So, convert...
-         */
-      case QT_MAKE_FOURCC_LE ('s', 'a', 'm', 'r'):
-        magiccookie = make_samr_magic_cookie (codec_data, &len);
-        break;
-      case QT_MAKE_FOURCC_LE ('a', 'l', 'a', 'c'):
-        magiccookie = make_alac_magic_cookie (codec_data, &len);
-        break;
-      case QT_MAKE_FOURCC_LE ('m', 'p', '4', 'a'):
-        if (!have_esds) {
-          magiccookie = make_aac_magic_cookie (codec_data, &len);
-          break;
-        }
-        /* Else: fallthrough */
-      default:
-        len = GST_BUFFER_SIZE (codec_data);
-        magiccookie = GST_BUFFER_DATA (codec_data);
-        break;
-    }
-
-    if (magiccookie) {
-      GST_LOG_OBJECT (qtwrapper, "Setting magic cookie %p of size %"
-          G_GSIZE_FORMAT, magiccookie, len);
-
-#if DEBUG_DUMP
-      gst_util_dump_mem (magiccookie, len);
-#endif
-
-      status =
-          QTSetComponentProperty (qtwrapper->adec, kQTPropertyClass_SCAudio,
-          kQTSCAudioPropertyID_InputMagicCookie, len, magiccookie);
-      if (status) {
-        GST_WARNING_OBJECT (qtwrapper, "Error setting extra codec data: %ld",
-            status);
-        goto beach;
-      }
-
-      g_free (magiccookie);
-    }
-  }
-
-  /* Set output to be interleaved raw PCM */
-  {
-    OSType outputFormat = kAudioFormatLinearPCM;
-    SCAudioFormatFlagsRestrictions restrictions = { 0 };
-
-    /* Set the mask in order to set this flag to zero */
-    restrictions.formatFlagsMask =
-        kAudioFormatFlagIsFloat | kAudioFormatFlagIsBigEndian;
-    restrictions.formatFlagsValues = kAudioFormatFlagIsFloat;
-
-    status = QTSetComponentProperty (qtwrapper->adec, kQTPropertyClass_SCAudio,
-        kQTSCAudioPropertyID_ClientRestrictedLPCMFlags,
-        sizeof (restrictions), &restrictions);
-    if (status) {
-      GST_WARNING_OBJECT (qtwrapper, "Error setting PCM to interleaved: %ld",
-          status);
-      goto beach;
-    }
-
-    status = QTSetComponentProperty (qtwrapper->adec, kQTPropertyClass_SCAudio,
-        kQTSCAudioPropertyID_ClientRestrictedCompressionFormatList,
-        sizeof (outputFormat), &outputFormat);
-    if (status) {
-      GST_WARNING_OBJECT (qtwrapper, "Error setting output to PCM: %ld",
-          status);
-      goto beach;
-    }
-  }
-
-  qtwrapper->outdesc.mSampleRate = 0;   /* Use recommended; we read this out later */
-  qtwrapper->outdesc.mFormatID = kAudioFormatLinearPCM;
-  qtwrapper->outdesc.mFormatFlags = kAudioFormatFlagIsFloat;
-  qtwrapper->outdesc.mBytesPerPacket = 0;
-  qtwrapper->outdesc.mFramesPerPacket = 0;
-  qtwrapper->outdesc.mBytesPerFrame = 4 * channels;
-  qtwrapper->outdesc.mChannelsPerFrame = channels;
-  qtwrapper->outdesc.mBitsPerChannel = 32;
-  qtwrapper->outdesc.mReserved = 0;
-
-  status = QTSetComponentProperty (qtwrapper->adec, kQTPropertyClass_SCAudio,
-      kQTSCAudioPropertyID_BasicDescription,
-      sizeof (qtwrapper->outdesc), &qtwrapper->outdesc);
-  if (status) {
-    GST_WARNING_OBJECT (qtwrapper, "Error setting output description: %ld",
-        status);
-    goto beach;
-  }
-
-  status = QTGetComponentProperty (qtwrapper->adec, kQTPropertyClass_SCAudio,
-      kQTSCAudioPropertyID_BasicDescription,
-      sizeof (qtwrapper->outdesc), &qtwrapper->outdesc, NULL);
-
-  if (status) {
-    GST_WARNING_OBJECT (qtwrapper,
-        "Failed to get output audio description: %ld", status);
-    ret = FALSE;
-    goto beach;
-  }
-
-  if (qtwrapper->outdesc.mFormatID != kAudioFormatLinearPCM     /*||
-                                                                   (qtwrapper->outdesc.mFormatFlags & kAudioFormatFlagIsFloat) !=
-                                                                   kAudioFormatFlagIsFloat */ ) {
-    GST_WARNING_OBJECT (qtwrapper, "Output is not floating point PCM");
-    ret = FALSE;
-    goto beach;
-  }
-
-  qtwrapper->samplerate = (int) qtwrapper->outdesc.mSampleRate;
-  qtwrapper->channels = qtwrapper->outdesc.mChannelsPerFrame;
-  GST_DEBUG_OBJECT (qtwrapper, "Output is %d Hz, %d channels",
-      qtwrapper->samplerate, qtwrapper->channels);
-
-  /* Create output bufferlist, big enough for 200ms of audio */
-  GST_DEBUG_OBJECT (qtwrapper, "Allocating bufferlist for %d channels",
-      channels);
-  qtwrapper->bufferlist =
-      AllocateAudioBufferList (channels,
-      qtwrapper->samplerate / 5 * qtwrapper->channels * 4);
-
-  /* Create output caps matching the format the component is giving us */
-  *othercaps = gst_caps_new_simple ("audio/x-raw-float",
-      "endianness", G_TYPE_INT, G_BYTE_ORDER,
-      "signed", G_TYPE_BOOLEAN, TRUE,
-      "width", G_TYPE_INT, 32,
-      "depth", G_TYPE_INT, 32,
-      "rate", G_TYPE_INT, qtwrapper->samplerate, "channels", G_TYPE_INT,
-      qtwrapper->channels, NULL);
-
-  ret = TRUE;
-
-beach:
-  return ret;
-}
-
-static gboolean
-qtwrapper_audio_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
-  QTWrapperAudioDecoder *qtwrapper;
-  gboolean ret = FALSE;
-  GstCaps *othercaps = NULL;
-
-  qtwrapper = (QTWrapperAudioDecoder *) gst_pad_get_parent (pad);
-
-  GST_LOG_OBJECT (qtwrapper, "caps:%" GST_PTR_FORMAT, caps);
-
-  /* 1. open decoder */
-  if (!(open_decoder (qtwrapper, caps, &othercaps)))
-    goto beach;
-
-  /* 2. set caps downstream */
-  ret = gst_pad_set_caps (qtwrapper->srcpad, othercaps);
-
-beach:
-  if (othercaps)
-    gst_caps_unref (othercaps);
-  gst_object_unref (qtwrapper);
-  return ret;
-}
-
-static OSStatus
-process_buffer_cb (ComponentInstance inAudioConverter,
-    UInt32 * ioNumberDataPackets,
-    AudioBufferList * ioData,
-    AudioStreamPacketDescription ** outDataPacketDescription,
-    QTWrapperAudioDecoder * qtwrapper)
-{
-  GST_LOG_OBJECT (qtwrapper,
-      "ioNumberDataPackets:%lu, iodata:%p, outDataPacketDescription:%p",
-      *ioNumberDataPackets, ioData, outDataPacketDescription);
-  if (outDataPacketDescription)
-    GST_LOG ("*outDataPacketDescription:%p", *outDataPacketDescription);
-
-  GST_LOG ("mNumberBuffers : %u", (guint32) ioData->mNumberBuffers);
-  GST_LOG ("mData:%p , mDataByteSize:%u",
-      ioData->mBuffers[0].mData, (guint32) ioData->mBuffers[0].mDataByteSize);
-
-  ioData->mBuffers[0].mData = NULL;
-  ioData->mBuffers[0].mDataByteSize = 0;
-
-  *ioNumberDataPackets = 1;
-
-  if (qtwrapper->input_buffer && GST_BUFFER_SIZE (qtwrapper->input_buffer)) {
-    ioData->mBuffers[0].mData = GST_BUFFER_DATA (qtwrapper->input_buffer);
-    ioData->mBuffers[0].mDataByteSize =
-        GST_BUFFER_SIZE (qtwrapper->input_buffer);
-
-    /* if we have a valid outDataPacketDescription, we need to fill it */
-    if (outDataPacketDescription) {
-      qtwrapper->aspd[0].mStartOffset = 0;
-      qtwrapper->aspd[0].mVariableFramesInPacket = 0;
-      qtwrapper->aspd[0].mDataByteSize =
-          GST_BUFFER_SIZE (qtwrapper->input_buffer);
-      *outDataPacketDescription = qtwrapper->aspd;
-    }
-
-    GST_LOG_OBJECT (qtwrapper, "returning %d bytes at %p",
-        GST_BUFFER_SIZE (qtwrapper->input_buffer), ioData->mBuffers[0].mData);
-
-    qtwrapper->input_buffer = 0;
-    return noErr;
-  }
-
-  GST_LOG_OBJECT (qtwrapper,
-      "No remaining input data, returning NO_MORE_INPUT_DATA");
-
-  return NO_MORE_INPUT_DATA;
-}
-
-static GstFlowReturn
-qtwrapper_audio_decoder_chain (GstPad * pad, GstBuffer * buf)
-{
-  GstFlowReturn ret = GST_FLOW_OK;
-  QTWrapperAudioDecoder *qtwrapper;
-  GstBuffer *outbuf;
-  OSStatus status;
-  guint32 outsamples;
-  guint32 savedbytes;
-  guint32 realbytes;
-
-  qtwrapper = (QTWrapperAudioDecoder *) gst_pad_get_parent (pad);
-
-  if (!qtwrapper->adec) {
-    GST_WARNING_OBJECT (qtwrapper, "QTWrapper not initialised");
-    goto beach;
-  }
-
-  GST_LOG_OBJECT (qtwrapper,
-      "buffer:%p , timestamp:%" GST_TIME_FORMAT " ,size:%d", buf,
-      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_BUFFER_SIZE (buf));
-
-#if DEBUG_DUMP
-  gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-#endif
-
-  if (qtwrapper->gotnewsegment) {
-
-    GST_DEBUG_OBJECT (qtwrapper, "SCAudioReset()");
-
-    SCAudioReset (qtwrapper->adec);
-
-    /* some formats can give us a better initial time using the buffer
-     * timestamp. */
-    if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
-      qtwrapper->initial_time = GST_BUFFER_TIMESTAMP (buf);
-
-    qtwrapper->gotnewsegment = FALSE;
-  }
-
-  outsamples = qtwrapper->bufferlist->mBuffers[0].mDataByteSize / 8;
-  savedbytes = qtwrapper->bufferlist->mBuffers[0].mDataByteSize;
-
-  qtwrapper->input_buffer = buf;
-
-  do {
-    GST_LOG_OBJECT (qtwrapper,
-        "Calling SCAudioFillBuffer(outsamples:%d , outdata:%p)", outsamples,
-        qtwrapper->bufferlist->mBuffers[0].mData);
-
-    /* Ask SCAudio to give us data ! */
-    status = SCAudioFillBuffer (qtwrapper->adec,
-        (SCAudioInputDataProc) process_buffer_cb,
-        qtwrapper, (UInt32 *) & outsamples, qtwrapper->bufferlist, NULL);
-
-    if ((status != noErr) && (status != NO_MORE_INPUT_DATA)) {
-      if (status < 0)
-        GST_WARNING_OBJECT (qtwrapper,
-            "Error in SCAudioFillBuffer() : %d", (gint32) status);
-      else
-        GST_WARNING_OBJECT (qtwrapper,
-            "Error in SCAudioFillBuffer() : %" GST_FOURCC_FORMAT,
-            QT_FOURCC_ARGS (status));
-      ret = GST_FLOW_ERROR;
-      goto beach;
-    }
-
-    realbytes = qtwrapper->bufferlist->mBuffers[0].mDataByteSize;
-
-    GST_LOG_OBJECT (qtwrapper, "We now have %d samples [%d bytes]",
-        outsamples, realbytes);
-
-    qtwrapper->bufferlist->mBuffers[0].mDataByteSize = savedbytes;
-
-    if (!outsamples)
-      goto beach;
-
-    /* 4. Create buffer and copy data in it */
-    ret = gst_pad_alloc_buffer (qtwrapper->srcpad, qtwrapper->cur_offset,
-        realbytes, GST_PAD_CAPS (qtwrapper->srcpad), &outbuf);
-    if (ret != GST_FLOW_OK)
-      goto beach;
-
-    /* copy data from bufferlist to output buffer */
-    memmove (GST_BUFFER_DATA (outbuf),
-        qtwrapper->bufferlist->mBuffers[0].mData, realbytes);
-
-    /* 5. calculate timestamp and duration */
-    GST_BUFFER_TIMESTAMP (outbuf) =
-        qtwrapper->initial_time + gst_util_uint64_scale_int (GST_SECOND,
-        (gint) qtwrapper->cur_offset, qtwrapper->samplerate);
-    GST_BUFFER_SIZE (outbuf) = realbytes;
-    GST_BUFFER_DURATION (outbuf) =
-        gst_util_uint64_scale_int (GST_SECOND,
-        realbytes / (qtwrapper->channels * 4), qtwrapper->samplerate);
-
-    GST_LOG_OBJECT (qtwrapper,
-        "timestamp:%" GST_TIME_FORMAT ", duration:%" GST_TIME_FORMAT
-        "offset:%lld, offset_end:%lld",
-        GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
-        GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)),
-        GST_BUFFER_OFFSET (outbuf), GST_BUFFER_OFFSET_END (outbuf));
-
-    qtwrapper->cur_offset += outsamples;
-
-    /* 6. push buffer downstream */
-
-    ret = gst_pad_push (qtwrapper->srcpad, outbuf);
-    if (ret != GST_FLOW_OK)
-      goto beach;
-
-    GST_DEBUG_OBJECT (qtwrapper,
-        "Read %d bytes, could have read up to %d bytes", realbytes, savedbytes);
-  } while (status != NO_MORE_INPUT_DATA);
-
-beach:
-  gst_buffer_unref (buf);
-  gst_object_unref (qtwrapper);
-  return ret;
-}
-
-static gboolean
-qtwrapper_audio_decoder_sink_event (GstPad * pad, GstEvent * event)
-{
-  QTWrapperAudioDecoder *qtwrapper;
-  gboolean ret = FALSE;
-
-  qtwrapper = (QTWrapperAudioDecoder *) gst_pad_get_parent (pad);
-
-  GST_LOG_OBJECT (qtwrapper, "event:%s", GST_EVENT_TYPE_NAME (event));
-
-  switch (GST_EVENT_TYPE (event)) {
-      /* TODO: Flush events should reset the decoder component */
-    case GST_EVENT_NEWSEGMENT:{
-      gint64 start, stop, position;
-      gboolean update;
-      gdouble rate;
-      GstFormat format;
-
-      GST_LOG ("We've got a newsegment");
-      gst_event_parse_new_segment (event, &update, &rate, &format, &start,
-          &stop, &position);
-
-      /* if the format isn't time, we need to create a new time newsegment */
-      /* FIXME : This is really bad, we should convert the values properly to time */
-      if (format != GST_FORMAT_TIME) {
-        GstEvent *newevent;
-
-        GST_WARNING_OBJECT (qtwrapper,
-            "Original event wasn't in GST_FORMAT_TIME, creating new fake one.");
-
-        start = 0;
-
-        newevent =
-            gst_event_new_new_segment (update, rate, GST_FORMAT_TIME, start,
-            GST_CLOCK_TIME_NONE, start);
-        gst_event_unref (event);
-        event = newevent;
-      }
-
-      qtwrapper->initial_time = start;
-      qtwrapper->cur_offset = 0;
-
-      GST_LOG ("initial_time is now %" GST_TIME_FORMAT, GST_TIME_ARGS (start));
-
-      if (qtwrapper->adec)
-        qtwrapper->gotnewsegment = TRUE;
-
-      break;
-    }
-    default:
-      break;
-  }
-
-  ret = gst_pad_push_event (qtwrapper->srcpad, event);
-
-  gst_object_unref (qtwrapper);
-  return TRUE;
-}
-
-static void
-qtwrapper_audio_decoder_base_init (QTWrapperAudioDecoderClass * klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-  gchar *name = NULL;
-  gchar *info = NULL;
-  char *longname, *description;
-  ComponentDescription desc;
-  QTWrapperAudioDecoderParams *params;
-
-  params = (QTWrapperAudioDecoderParams *)
-      g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
-      QTWRAPPER_ADEC_PARAMS_QDATA);
-  g_assert (params);
-
-  get_name_info_from_component (params->component, &desc, &name, &info);
-
-  /* Fill in details */
-  longname =
-      g_strdup_printf ("QTWrapper SCAudio Audio Decoder : %s",
-      GST_STR_NULL (name));
-  description =
-      g_strdup_printf ("QTWrapper SCAudio wrapper for decoder: %s",
-      GST_STR_NULL (info));
-  gst_element_class_set_metadata (element_class,
-      longname, "Codec/Decoder/Audio", description,
-      "Fluendo <gstreamer@fluendo.com>, "
-      "Pioneers of the Inevitable <songbird@songbirdnest.com>");
-
-  g_free (longname);
-  g_free (description);
-  g_free (name);
-  g_free (info);
-
-  /* Add pad templates */
-  klass->sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
-      GST_PAD_ALWAYS, params->sinkcaps);
-  gst_element_class_add_pad_template (element_class, klass->sinktempl);
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-
-  /* Store class-global values */
-  klass->componentSubType = desc.componentSubType;
-}
-
-static void
-qtwrapper_audio_decoder_dispose (GObject * object)
-{
-  QTWrapperAudioDecoder *qtwrapper = (QTWrapperAudioDecoder *) object;
-  QTWrapperAudioDecoderClass *oclass =
-      (QTWrapperAudioDecoderClass *) (G_OBJECT_GET_CLASS (qtwrapper));
-  GObjectClass *parent_class = g_type_class_peek_parent (oclass);
-
-  close_decoder (qtwrapper);
-
-  G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-qtwrapper_audio_decoder_class_init (QTWrapperAudioDecoderClass * klass)
-{
-  GObjectClass *object_class;
-
-  object_class = (GObjectClass *) klass;
-
-  object_class->dispose = qtwrapper_audio_decoder_dispose;
-}
-
-gboolean
-qtwrapper_audio_decoders_register (GstPlugin * plugin)
-{
-  gboolean res = TRUE;
-  Component componentID = NULL;
-
-  ComponentDescription desc = {
-    kSoundDecompressor, 0, 0, 0, 0
-  };
-
-  GTypeInfo typeinfo = {
-    sizeof (QTWrapperAudioDecoderClass),
-    (GBaseInitFunc) qtwrapper_audio_decoder_base_init,
-    NULL,
-    (GClassInitFunc) qtwrapper_audio_decoder_class_init,
-    NULL,
-    NULL,
-    sizeof (QTWrapperAudioDecoder),
-    0,
-    (GInstanceInitFunc) qtwrapper_audio_decoder_init,
-  };
-
-  /* Find all SoundDecompressors ! */
-  GST_DEBUG ("There are %ld decompressors available", CountComponents (&desc));
-
-  /* loop over SoundDecompressors */
-  do {
-    componentID = FindNextComponent (componentID, &desc);
-
-    GST_LOG ("componentID : %p", componentID);
-
-    if (componentID) {
-      ComponentDescription thisdesc;
-      gchar *name = NULL, *info = NULL;
-      GstCaps *caps = NULL;
-      gchar *type_name = NULL;
-      GType type;
-      QTWrapperAudioDecoderParams *params = NULL;
-
-      if (!(get_name_info_from_component (componentID, &thisdesc, &name,
-                  &info)))
-        goto next;
-
-      GST_LOG (" name:%s", GST_STR_NULL (name));
-      GST_LOG (" info:%s", GST_STR_NULL (info));
-
-      GST_LOG (" type:%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentType));
-      GST_LOG (" subtype:%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentSubType));
-      GST_LOG (" manufacturer:%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentManufacturer));
-
-      if (!(caps =
-              fourcc_to_caps (QT_READ_UINT32 (&thisdesc.componentSubType))))
-        goto next;
-
-      type_name = g_strdup_printf ("qtwrapperaudiodec_%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentSubType));
-      g_strdelimit (type_name, " .", '_');
-
-      if (g_type_from_name (type_name)) {
-        GST_WARNING ("We already have a registered plugin for %s", type_name);
-        goto next;
-      }
-
-      params = g_new0 (QTWrapperAudioDecoderParams, 1);
-      params->component = componentID;
-      params->sinkcaps = gst_caps_ref (caps);
-
-      type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
-      /* Store params in type qdata */
-      g_type_set_qdata (type, QTWRAPPER_ADEC_PARAMS_QDATA, (gpointer) params);
-
-      /* register type */
-      if (!gst_element_register (plugin, type_name, GST_RANK_MARGINAL, type)) {
-        g_warning ("Failed to register %s", type_name);;
-        g_type_set_qdata (type, QTWRAPPER_ADEC_PARAMS_QDATA, NULL);
-        g_free (params);
-        res = FALSE;
-        goto next;
-      }
-
-    next:
-      if (name)
-        g_free (name);
-      if (info)
-        g_free (info);
-      if (type_name)
-        g_free (type_name);
-      if (caps)
-        gst_caps_unref (caps);
-    }
-
-  } while (componentID && res);
-
-  return res;
-}
diff --git a/sys/qtwrapper/codecmapping.c b/sys/qtwrapper/codecmapping.c
deleted file mode 100644
index a0a0796..0000000
--- a/sys/qtwrapper/codecmapping.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * GStreamer QuickTime codec mapping
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "qtwrapper.h"
-#include "codecmapping.h"
-#include "qtutils.h"
-
-static GstCaps *
-audio_caps_from_string (const gchar * str)
-{
-  GstCaps *res;
-
-  res = gst_caps_from_string (str);
-  gst_caps_set_simple (res,
-      "rate", GST_TYPE_INT_RANGE, 8000, 96000,
-      "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
-
-  return res;
-}
-
-GstCaps *
-fourcc_to_caps (guint32 fourcc)
-{
-  GstCaps *caps = NULL;
-
-  GST_DEBUG ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
-
-  switch (fourcc) {
-      /* VIDEO */
-    case QT_MAKE_FOURCC_LE ('S', 'V', 'Q', '1'):
-      caps = gst_caps_new_simple ("video/x-svq",
-          "svqversion", G_TYPE_INT, 1, NULL);
-      break;
-    case QT_MAKE_FOURCC_LE ('S', 'V', 'Q', '3'):
-      caps = gst_caps_new_simple ("video/x-svq",
-          "svqversion", G_TYPE_INT, 3, NULL);
-      break;
-    case QT_MAKE_FOURCC_LE ('a', 'v', 'c', '1'):
-      caps = gst_caps_from_string ("video/x-h264");
-      break;
-    case QT_MAKE_FOURCC_LE ('m', 'p', '4', 'v'):
-      caps =
-          gst_caps_from_string
-          ("video/mpeg,mpegversion=4,systemstream=(boolean)false");
-      break;
-    case QT_MAKE_FOURCC_LE ('m', 'p', 'e', 'g'):
-      caps = gst_caps_from_string ("video/mpeg, "
-          "systemstream = (boolean) false, " "mpegversion = (int) 1");
-      break;
-    case QT_MAKE_FOURCC_LE ('h', '2', '6', '3'):
-    case QT_MAKE_FOURCC_LE ('H', '2', '6', '3'):
-    case QT_MAKE_FOURCC_LE ('s', '2', '6', '3'):
-    case QT_MAKE_FOURCC_LE ('U', '2', '6', '3'):
-      caps = gst_caps_from_string ("video/x-h263");
-      break;
-    case QT_MAKE_FOURCC_LE ('c', 'v', 'i', 'd'):
-      caps = gst_caps_from_string ("video/x-cinepak");
-      break;
-    case QT_MAKE_FOURCC_LE ('d', 'v', 'c', 'p'):
-    case QT_MAKE_FOURCC_LE ('d', 'v', 'c', ' '):
-    case QT_MAKE_FOURCC_LE ('d', 'v', 's', 'd'):
-    case QT_MAKE_FOURCC_LE ('D', 'V', 'S', 'D'):
-    case QT_MAKE_FOURCC_LE ('d', 'v', 'c', 's'):
-    case QT_MAKE_FOURCC_LE ('D', 'V', 'C', 'S'):
-    case QT_MAKE_FOURCC_LE ('d', 'v', '2', '5'):
-    case QT_MAKE_FOURCC_LE ('d', 'v', 'p', 'p'):
-      caps = gst_caps_from_string ("video/x-dv, systemstream=(boolean)false");
-      break;
-
-      /* AUDIO */
-    case QT_MAKE_FOURCC_LE ('.', 'm', 'p', '3'):
-      caps =
-          audio_caps_from_string
-          ("audio/mpeg,mpegversion=1,layer=3,parsed=(boolean)true");
-      break;
-    case QT_MAKE_FOURCC_LE ('Q', 'D', 'M', '2'):
-      caps = audio_caps_from_string ("audio/x-qdm2");
-      break;
-    case QT_MAKE_FOURCC_LE ('a', 'g', 's', 'm'):
-      caps = audio_caps_from_string ("audio/x-gsm");
-      break;
-    case QT_MAKE_FOURCC_LE ('a', 'l', 'a', 'c'):
-      caps = audio_caps_from_string ("audio/x-alac");
-      break;
-    case QT_MAKE_FOURCC_LE ('a', 'l', 'a', 'w'):
-      caps = audio_caps_from_string ("audio/x-alaw");
-      break;
-    case QT_MAKE_FOURCC_LE ('m', 'p', '4', 'a'):
-    case QT_MAKE_FOURCC_LE ('a', 'a', 'c', ' '):
-      caps = audio_caps_from_string ("audio/mpeg,mpegversion=4");
-      break;
-    case QT_MAKE_FOURCC_LE ('s', 'a', 'm', 'r'):
-      caps = audio_caps_from_string ("audio/AMR");
-      break;
-    case QT_MAKE_FOURCC_LE ('u', 'l', 'a', 'w'):
-      caps = audio_caps_from_string ("audio/x-mulaw");
-      break;
-    case QT_MAKE_FOURCC_LE ('A', 'V', 'd', 'n'):
-      caps = audio_caps_from_string ("video/x-dnxhd");
-      break;
-    case QT_MAKE_FOURCC_LE ('i', 'c', 'o', 'd'):
-      caps = audio_caps_from_string ("video/x-apple-intermediate-codec");
-      break;
-      /* TO FILL !! */
-    case QT_MAKE_FOURCC_LE ('M', 'A', 'C', '3'):
-    case QT_MAKE_FOURCC_LE ('M', 'A', 'C', '6'):
-    case QT_MAKE_FOURCC_LE ('Q', 'D', 'M', 'C'):
-    case QT_MAKE_FOURCC_LE ('Q', 'c', 'l', 'p'):
-    case QT_MAKE_FOURCC_LE ('Q', 'c', 'l', 'q'):
-    case QT_MAKE_FOURCC_LE ('d', 'v', 'c', 'a'):
-    default:
-      break;
-  }
-
-  return caps;
-}
diff --git a/sys/qtwrapper/codecmapping.h b/sys/qtwrapper/codecmapping.h
deleted file mode 100644
index 106ffe7..0000000
--- a/sys/qtwrapper/codecmapping.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * GStreamer QuickTime codec mapping
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gst/gst.h>
-#include "qtwrapper.h"
-
-#ifdef G_OS_WIN32
-#include <ImageCodec.h>
-#else
-#include <QuickTime/ImageCodec.h>
-#endif
-
-
-/*
- * fourcc_to_caps:
- *
- * Return the caps for a given fourcc.
- */
-
-GstCaps *fourcc_to_caps (guint32 fourcc);
diff --git a/sys/qtwrapper/imagedescription.c b/sys/qtwrapper/imagedescription.c
deleted file mode 100644
index e14d60b..0000000
--- a/sys/qtwrapper/imagedescription.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * GStreamer QuickTime video decoder codecs wrapper
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <string.h>
-
-#include "imagedescription.h"
-
-static ImageDescription *
-image_description_for_avc1 (GstBuffer * buf)
-{
-  ImageDescription *desc = NULL;
-  guint8 *pos;
-
-  desc = g_malloc0 (sizeof (ImageDescription) + GST_BUFFER_SIZE (buf) + 8);
-  pos = (guint8 *) desc + sizeof (ImageDescription);
-
-  desc->idSize = sizeof (ImageDescription) + GST_BUFFER_SIZE (buf) + 8;
-  /* write size in Big-Endian */
-  GST_WRITE_UINT32_BE (pos, GST_BUFFER_SIZE (buf) + 8);
-  GST_WRITE_UINT32_LE (pos + 4, QT_MAKE_FOURCC_BE ('a', 'v', 'c', 'C'));
-  memmove (pos + 8, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-
-  return desc;
-}
-
-/* image_description_for_mp4v
- *
- * mpeg4 video has an 'esds' atom as extension for the ImageDescription.
- * It is meant to contain the ES Description.
- * We here create a fake one.
- */
-
-static ImageDescription *
-image_description_for_mp4v (GstBuffer * buf)
-{
-  ImageDescription *desc = NULL;
-  guint32 offset = sizeof (ImageDescription);
-  guint8 *location;
-
-  GST_LOG ("buf %p , size:%d", buf, GST_BUFFER_SIZE (buf));
-
-  /* this image description contains:
-   *  ImageDescription  sizeof(ImageDescription)
-   *  esds atom         34 bytes
-   *  buffer            GST_BUFFER_SIZE (buf)
-   *  ending            3 bytes
-   */
-
-  desc = g_malloc0 (offset + 37 + GST_BUFFER_SIZE (buf));
-  desc->idSize = offset + 37 + GST_BUFFER_SIZE (buf);
-
-  location = (guint8 *) desc + offset;
-
-  /* Fill in ESDS */
-  /*  size */
-  GST_WRITE_UINT32_BE (location, 37 + GST_BUFFER_SIZE (buf));
-  /*  atom */
-  GST_WRITE_UINT32_LE (location + 4, GST_MAKE_FOURCC ('e', 's', 'd', 's'));
-  /*  version + flags */
-  QT_WRITE_UINT32 (location + 8, 0);
-  /*  tag */
-  QT_WRITE_UINT8 (location + 12, 0x3);
-  /*  size (buffsize + 23) */
-  QT_WRITE_UINT8 (location + 13, GST_BUFFER_SIZE (buf) + 23);
-  /*  ESID */
-  QT_WRITE_UINT16 (location + 14, 0);
-  /*  priority */
-  QT_WRITE_UINT8 (location + 16, 0);
-  /*  tag */
-  QT_WRITE_UINT8 (location + 17, 0x4);
-  /*  size (buffsize + 8) */
-  QT_WRITE_UINT8 (location + 18, GST_BUFFER_SIZE (buf) + 15);
-  /*  object type */
-  QT_WRITE_UINT8 (location + 19, 0x20);
-  /*  stream type */
-  QT_WRITE_UINT8 (location + 20, 0x11);
-  /*  buffersize db */
-  QT_WRITE_UINT24 (location + 21, 13640);
-  /*  max bitrate */
-  QT_WRITE_UINT32 (location + 24, 1849648);
-  /*  avg bitrate */
-  QT_WRITE_UINT32 (location + 28, 918191);
-  /*  tag */
-  QT_WRITE_UINT8 (location + 32, 0x05);
-  /*  size */
-  QT_WRITE_UINT8 (location + 33, GST_BUFFER_SIZE (buf));
-  /*  codec data */
-  memmove (location + 34, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-  /*  end */
-  QT_WRITE_UINT8 (location + 34 + GST_BUFFER_SIZE (buf), 0x06);
-  QT_WRITE_UINT8 (location + 34 + GST_BUFFER_SIZE (buf) + 1, 0x01);
-  QT_WRITE_UINT8 (location + 34 + GST_BUFFER_SIZE (buf) + 2, 0x02);
-
-  return desc;
-}
-
-static ImageDescription *
-image_description_from_stsd_buffer (GstBuffer * buf)
-{
-  ImageDescription *desc = NULL;
-  guint8 *content;
-  guint size;
-  gint imds;
-
-  GST_LOG ("buffer %p, size:%u", buf, GST_BUFFER_SIZE (buf));
-
-  /* The buffer contains a full atom, we only need the contents */
-  /* This buffer has data in big-endian, we need to read it as such.
-   * except for the fourcc which are ALWAYS big-endian. */
-  content = GST_BUFFER_DATA (buf) + 16;
-  size = GST_BUFFER_SIZE (buf) - 16;
-
-#if DEBUG_DUMP
-  GST_LOG ("incoming data in big-endian");
-  gst_util_dump_mem (content, size);
-#endif
-
-  desc = g_malloc0 (size);
-  desc->idSize = size;
-  desc->cType = GST_READ_UINT32_BE (content + 4);
-  desc->version = QT_UINT16 (content + 16);
-  desc->revisionLevel = QT_UINT16 (content + 18);
-  desc->vendor = GST_READ_UINT32_BE (content + 20);
-  desc->temporalQuality = QT_UINT32 (content + 24);
-  desc->spatialQuality = QT_UINT32 (content + 24);
-  desc->dataSize = QT_UINT32 (content + 44);
-  desc->frameCount = QT_UINT16 (content + 48);
-  desc->depth = QT_UINT16 (content + 82);
-  desc->clutID = QT_UINT16 (content + 84);
-
-  imds = 86;                    /* sizeof (ImageDescription); */
-
-  if (desc->idSize > imds) {
-    GST_LOG ("Copying %d bytes from %p to %p",
-        size - imds, content + imds, desc + imds);
-    memcpy ((guint8 *) desc + imds, (guint8 *) content + imds, size - imds);
-  }
-#if DEBUG_DUMP
-  GST_LOG ("outgoing data in machine-endian");
-  dump_image_description (desc);
-#endif
-
-  return desc;
-}
-
-ImageDescription *
-image_description_from_codec_data (GstBuffer * buf, guint32 codectype)
-{
-  ImageDescription *desc = NULL;
-
-  GST_LOG ("codectype:%" GST_FOURCC_FORMAT " buf:%p",
-      GST_FOURCC_ARGS (codectype), buf);
-
-  if ((GST_BUFFER_SIZE (buf) == GST_READ_UINT32_BE (GST_BUFFER_DATA (buf))) &&
-      (QT_MAKE_FOURCC_LE ('s', 't', 's',
-              'd') == GST_READ_UINT32_BE (GST_BUFFER_DATA (buf) + 4))) {
-    /* We have the full stsd (ImageDescription) in our codec_data */
-    desc = image_description_from_stsd_buffer (buf);
-  } else {
-    switch (codectype) {
-      case QT_MAKE_FOURCC_LE ('m', 'p', '4', 'v'):
-        desc = image_description_for_mp4v (buf);
-        break;
-      case QT_MAKE_FOURCC_LE ('a', 'v', 'c', '1'):
-        desc = image_description_for_avc1 (buf);
-        break;
-      default:
-        GST_WARNING ("Format not handled !");
-    }
-  }
-  return desc;
-}
diff --git a/sys/qtwrapper/imagedescription.h b/sys/qtwrapper/imagedescription.h
deleted file mode 100644
index cd5481a..0000000
--- a/sys/qtwrapper/imagedescription.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * GStreamer QuickTime video decoder codecs wrapper
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "qtwrapper.h"
-#include "qtutils.h"
-
-ImageDescription *image_description_from_codec_data (GstBuffer * buf,
-    guint32 codec);
diff --git a/sys/qtwrapper/qtutils.c b/sys/qtwrapper/qtutils.c
deleted file mode 100644
index 506d761..0000000
--- a/sys/qtwrapper/qtutils.c
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * GStreamer QuickTime codec mapping
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <glib.h>
-
-#include "qtutils.h"
-
-gboolean
-get_name_info_from_component (Component componentID,
-    ComponentDescription * desc, gchar ** name, gchar ** info)
-{
-  Handle nameHandle = NewHandle (200);
-  Handle infoHandle = NewHandle (200);
-  gchar *tmpname;
-  gchar *tmpinfo;
-  OSErr result;
-  gboolean ret = TRUE;
-
-  result = GetComponentInfo (componentID, desc, nameHandle, infoHandle, NULL);
-  if (result != noErr) {
-    ret = FALSE;
-    goto done;
-  }
-#if DEBUG_DUMP
-  GST_LOG ("ComponentDescription dump");
-  gst_util_dump_mem ((const guchar *) desc, sizeof (ComponentDescription));
-  gst_util_dump_mem ((gpointer) * nameHandle, 200);
-  gst_util_dump_mem ((gpointer) * infoHandle, 200);
-  GST_LOG ("0x%x 0x%x", **((guint8 **) nameHandle), **((guint8 **) infoHandle));
-#endif
-
-  if (*nameHandle && name) {
-    gsize read, written;
-
-    tmpname = g_strndup ((*(char **) nameHandle) + 1,
-        **((guint8 **) nameHandle));
-    *name = g_convert_with_fallback (tmpname, -1, "ASCII", "MAC",
-        (gchar *) " ", &read, &written, NULL);
-    if (!*name)
-      GST_WARNING ("read:%" G_GSIZE_FORMAT ", written:%" G_GSIZE_FORMAT, read,
-          written);
-    g_free (tmpname);
-  }
-
-  if (*infoHandle && info) {
-    tmpinfo =
-        g_strndup ((*(char **) infoHandle) + 1, **((guint8 **) infoHandle));
-    *info =
-        g_convert_with_fallback (tmpinfo, -1, "ASCII", "MAC", (gchar *) " ",
-        NULL, NULL, NULL);
-    g_free (tmpinfo);
-  }
-
-done:
-  DisposeHandle (nameHandle);
-  DisposeHandle (infoHandle);
-
-  return ret;
-}
-
-/*
-struct CodecDecompressParams {
-   ImageSequence              sequenceID;
-   ImageDescriptionHandle     imageDescription;
-   Ptr                        data;
-   long                       bufferSize;
-   long                       frameNumber;
-   long                       startLine;
-   long                       stopLine;
-   long                       conditionFlags;
-   CodecFlags                 callerFlags;
-   CodecCapabilities *        capabilities;
-   ICMProgressProcRecord      progressProcRecord;
-   ICMCompletionProcRecord    completionProcRecord;
-   ICMDataProcRecord          dataProcRecord;
-   CGrafPtr                   port;
-   PixMap                     dstPixMap;
-   BitMapPtr                  maskBits;
-   PixMapPtr                  mattePixMap;
-   Rect                       srcRect;
-   MatrixRecord *             matrix;
-   CodecQ                     accuracy;
-   short                      transferMode;
-   ICMFrameTimePtr            frameTime;
-   long                       reserved[1];
-   SInt8                      matrixFlags;
-   SInt8                      matrixType;
-   Rect                       dstRect;
-   UInt16                     majorSourceChangeSeed;
-   UInt16                     minorSourceChangeSeed;
-   CDSequenceDataSourcePtr    sourceData;
-   RgnHandle                  maskRegion;
-   OSType **                  wantedDestinationPixelTypes;
-   long                       screenFloodMethod;
-   long                       screenFloodValue;
-   short                      preferredOffscreenPixelSize;
-   ICMFrameTimeInfoPtr        syncFrameTime;
-   Boolean                    needUpdateOnTimeChange;
-   Boolean                    enableBlackLining;
-   Boolean                    needUpdateOnSourceChange;
-   Boolean                    pad;
-   long                       unused;
-   CGrafPtr                   finalDestinationPort;
-   long                       requestedBufferWidth;
-   long                       requestedBufferHeight;
-   Rect                       displayableAreaOfRequestedBuffer;
-   Boolean                    requestedSingleField;
-   Boolean                    needUpdateOnNextIdle;
-   Boolean                    pad2[2];
-   fixed                      bufferGammaLevel;
-   UInt32                     taskWeight;
-   OSType                     taskName;
-};
- */
-
-/* struct ImageDescription {  */
-/*     long idSize;            /\* total size of this structure *\/  */
-/*  4  CodecType cType;        /\* compressor creator type *\/  */
-/*  8  long resvd1;            /\* reserved--must be set to 0 *\/  */
-/* 12  short resvd2;           /\* reserved--must be set to 0 *\/  */
-/* 14  short dataRefIndex;     /\* reserved--must be set to 0 *\/  */
-/* 16  short version;          /\* version of compressed data *\/  */
-/* 18  short revisionLevel;    /\* compressor that created data *\/  */
-/* 20  long vendor;            /\* compressor developer that created data *\/  */
-/* 24  CodecQ temporalQuality;       */
-/*                             /\* degree of temporal compression *\/  */
-/* 28  CodecQ spatialQuality;        */
-/*                             /\* degree of spatial compression *\/  */
-/* 32  short width;            /\* width of source image in pixels *\/  */
-/* 34  short height;           /\* height of source image in pixels *\/  */
-/* 36  Fixed hRes;             /\* horizontal resolution of source image *\/  */
-/* 40  Fixed vRes;             /\* vertical resolution of source image *\/  */
-/* 44  long dataSize;          /\* size in bytes of compressed data *\/  */
-/* 48  short frameCount;       /\* number of frames in image data *\/  */
-/* 50  Str31 name;             /\* name of compression algorithm *\/  */
-/* 82  short depth;            /\* pixel depth of source image *\/  */
-/* 84  short clutID;           /\* ID number of the color table for image *\/  */
-/* }; */
-
-
-gboolean
-get_output_info_from_component (Component componentID)
-{
-  gboolean ret = FALSE;
-  ComponentInstance instance;
-  ImageSubCodecDecompressCapabilities caps;
-  CodecInfo info;
-
-  GST_LOG ("Creating an instance");
-
-  /* 1. Create an instance */
-  if (!(instance = OpenComponent (componentID))) {
-    GST_WARNING ("Couldn't open component");
-    return FALSE;
-  }
-
-  /* 2. initialize */
-  memset (&caps, 0, sizeof (ImageSubCodecDecompressCapabilities));
-  if (ImageCodecInitialize (instance, &caps) != noErr) {
-    GST_WARNING ("ImageCodecInitialize() failed");
-    goto beach;
-  }
-#if DEBUG_DUMP
-  GST_LOG ("ImageSubCodecDecompressCapabilities");
-  gst_util_dump_mem ((const guchar *) &caps,
-      sizeof (ImageSubCodecDecompressCapabilities));
-#endif
-
-  GST_LOG ("recordSize:%ld", caps.recordSize);
-  GST_LOG ("decompressRecordSize:%ld", caps.decompressRecordSize);
-  GST_LOG ("canAsync:%d", caps.canAsync);
-
-  /* 3. Get codec info */
-  memset (&info, 0, sizeof (CodecInfo));
-  if (ImageCodecGetCodecInfo (instance, &info) != noErr) {
-    GST_WARNING ("ImageCodecInfo() failed");
-    goto beach;
-  };
-
-#if DEBUG_DUMP
-  GST_LOG ("CodecInfo");
-  gst_util_dump_mem ((const guchar *) &info, sizeof (CodecInfo));
-#endif
-
-  GST_LOG ("version:%d", info.version);
-  GST_LOG ("revisionLevel:%d", info.revisionLevel);
-  GST_LOG ("vendor:%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (info.vendor));
-
-  /* Compression flags */
-  /* Contains flags (see below) that specify the decompression capabilities of
-   * the component. Typically, these flags are of interest only to developers of
-   * image decompressors. */
-  GST_LOG ("decompressFlags:%lx", info.decompressFlags);
-  if (info.decompressFlags & codecInfoDoes1)
-    GST_LOG ("Depth 1 OK");
-  if (info.decompressFlags & codecInfoDoes2)
-    GST_LOG ("Depth 2 OK");
-  if (info.decompressFlags & codecInfoDoes4)
-    GST_LOG ("Depth 4 OK");
-  if (info.decompressFlags & codecInfoDoes8)
-    GST_LOG ("Depth 8 OK");
-  if (info.decompressFlags & codecInfoDoes16)
-    GST_LOG ("Depth 16 OK");
-  if (info.decompressFlags & codecInfoDoes32)
-    GST_LOG ("Depth 32 OK");
-  GST_LOG ("compressFlags:%lx", info.compressFlags);
-
-  /* Format FLAGS */
-  /* Contains flags (see below) that describe the possible format for compressed
-   * data produced by this component and the format of compressed files that the
-   * component can handle during decompression. Typically, these flags are of
-   * interest only to developers of compressor components.
-   */
-  GST_LOG ("formatFlags:%lx", info.formatFlags);
-  if (info.formatFlags & codecInfoDepth1)
-    GST_LOG ("Depth 1 OK");
-  if (info.formatFlags & codecInfoDepth2)
-    GST_LOG ("Depth 2 OK");
-  if (info.formatFlags & codecInfoDepth4)
-    GST_LOG ("Depth 4 OK");
-  if (info.formatFlags & codecInfoDepth8)
-    GST_LOG ("Depth 8 OK");
-  if (info.formatFlags & codecInfoDepth16)
-    GST_LOG ("Depth 16 OK");
-  if (info.formatFlags & codecInfoDepth24)
-    GST_LOG ("Depth 24 OK");
-  if (info.formatFlags & codecInfoDepth32)
-    GST_LOG ("Depth 32 OK");
-  if (info.formatFlags & codecInfoDepth33)
-    GST_LOG ("Depth 33 OK");
-  if (info.formatFlags & codecInfoDepth34)
-    GST_LOG ("Depth 34 OK");
-  if (info.formatFlags & codecInfoDepth36)
-    GST_LOG ("Depth 36 OK");
-  if (info.formatFlags & codecInfoDepth40)
-    GST_LOG ("Depth 40 OK");
-  if (info.formatFlags & codecInfoStoresClut)
-    GST_LOG ("StoresClut OK");
-  if (info.formatFlags & codecInfoDoesLossless)
-    GST_LOG ("Lossless OK");
-  if (info.formatFlags & codecInfoSequenceSensitive)
-    GST_LOG ("SequenceSentitive OK");
-
-
-  GST_LOG ("compressionAccuracy:%u", info.compressionAccuracy);
-  GST_LOG ("decompressionAccuracy:%u", info.decompressionAccuracy);
-  GST_LOG ("compressionSpeed:%d", info.compressionSpeed);
-  GST_LOG ("decompressionSpeed:%d", info.decompressionSpeed);
-  GST_LOG ("compressionLevel:%u", info.compressionLevel);
-  GST_LOG ("minimumHeight:%d", info.minimumHeight);
-  GST_LOG ("minimumWidth:%d", info.minimumWidth);
-
-/*   /\* . Call ImageCodecPreDecompress *\/ */
-/*   memset(&params, 0, sizeof(CodecDecompressParams)); */
-/*   GST_LOG ("calling imagecodecpredecompress"); */
-/*   if (ImageCodecPreDecompress (instance, &params) != noErr) { */
-/*     GST_WARNING ("Error in ImageCodecPreDecompress"); */
-/*     goto beach; */
-/*   } */
-
-/*   GST_INFO ("sequenceID : %d", params.sequenceID); */
-
-  ret = TRUE;
-
-beach:
-  /* Free instance */
-  CloseComponent (instance);
-  return TRUE;
-}
-
-void
-dump_avcc_atom (guint8 * atom)
-{
-  /* first 8 bytes : length + atom */
-  GST_LOG ("version:0x%x", QT_UINT8 (atom + 8));
-  GST_LOG ("Profile:%d", QT_UINT8 (atom + 9));
-  GST_LOG ("Compatible profiles : 0x%x", QT_UINT8 (atom + 10));
-  GST_LOG ("Level:%d", QT_UINT8 (atom + 11));
-}
-
-void
-dump_image_description (ImageDescription * desc)
-{
-  GST_LOG ("Description %p , size:%" G_GSIZE_FORMAT, desc, desc->idSize);
-
-#if DEBUG_DUMP
-  gst_util_dump_mem ((const guchar *) desc, desc->idSize);
-#endif
-
-  GST_LOG ("cType : %" GST_FOURCC_FORMAT, QT_FOURCC_ARGS (desc->cType));
-  GST_LOG ("version:%d", desc->version);
-  GST_LOG ("revisionLevel:%d", desc->revisionLevel);
-  GST_LOG ("vendor:%" GST_FOURCC_FORMAT, QT_FOURCC_ARGS (desc->vendor));
-  GST_LOG ("temporalQuality:%lu", desc->temporalQuality);
-  GST_LOG ("spatialQuality:%lu", desc->spatialQuality);
-  GST_LOG ("width:%u", desc->width);
-  GST_LOG ("height:%u", desc->height);
-  GST_LOG ("hres:%f", desc->hRes / 65536.0);
-  GST_LOG ("vres:%f", desc->vRes / 65536.0);
-  GST_LOG ("dataSize:%" G_GSIZE_FORMAT, desc->dataSize);
-  GST_LOG ("frameCount:%d", desc->frameCount);
-  GST_LOG ("name:%.*s", desc->name[0], desc->name + 1);
-  GST_LOG ("depth:%d", desc->depth);
-  GST_LOG ("clutID:%d", desc->clutID);
-
-  if (desc->idSize > sizeof (ImageDescription)) {
-    guint8 *extradata = (guint8 *) desc + sizeof (ImageDescription);
-    guint32 type = QT_READ_UINT32 (extradata + 4);
-
-    GST_LOG ("Extra Data size:%lu",
-        (gulong) desc->idSize - (gulong) sizeof (ImageDescription));
-#if DEBUG_DUMP
-    gst_util_dump_mem ((gpointer) (gulong) desc +
-        (gulong) sizeof (ImageDescription),
-        (gulong) desc->idSize - (gulong) sizeof (ImageDescription));
-#endif
-    GST_LOG ("Extra Data Type : %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (type));
-    if (type == QT_MAKE_FOURCC ('a', 'v', 'c', 'C'))
-      dump_avcc_atom (extradata);
-  }
-}
-
-void
-dump_codec_decompress_params (CodecDecompressParams * params)
-{
-  GST_LOG ("params %p", params);
-
-#if DEBUG_DUMP
-  gst_util_dump_mem ((const guchar *) params, sizeof (CodecDecompressParams));
-#endif
-
-  GST_LOG ("SequenceID:%ld", params->sequenceID);
-  GST_LOG ("imageDescription:%p", params->imageDescription);
-  GST_LOG ("data:%p", params->data);
-  GST_LOG ("bufferSize:%ld", params->bufferSize);
-  GST_LOG ("frameNumber:%ld", params->frameNumber);
-  GST_LOG ("startLine:%ld  , StopLine:%ld", params->startLine,
-      params->stopLine);
-  GST_LOG ("conditionFlags:0x%lx", params->conditionFlags);
-  GST_LOG ("callerFlags:0x%x", params->callerFlags);
-  GST_LOG ("capabilities:%p", params->capabilities);
-  GST_LOG ("port:%p", params->port);
-  GST_LOG ("dstPixMap");
-#if DEBUG_DUMP
-  gst_util_dump_mem ((const guchar *) &params->dstPixMap, sizeof (PixMap));
-#endif
-
-  GST_LOG ("maskBits:%p", params->maskBits);
-  GST_LOG ("mattePixMap:%p", params->mattePixMap);
-  GST_LOG ("srcRect %d/%d/%d/%d",
-      params->srcRect.top, params->srcRect.bottom,
-      params->srcRect.left, params->srcRect.right);
-
-  GST_LOG ("matrix:%p", params->matrix);
-  GST_LOG ("accuracy:%ld", params->accuracy);
-  GST_LOG ("transferMode:%d", params->transferMode);
-  GST_LOG ("frameTime:%p", params->frameTime);
-  GST_LOG ("matrixFlags:%x", params->matrixFlags);
-
-  GST_LOG ("dstRect %d/%d/%d/%d",
-      params->dstRect.top, params->dstRect.bottom,
-      params->dstRect.left, params->dstRect.right);
-
-  GST_LOG ("sourceData:%p", params->sourceData);
-
-  if (params->wantedDestinationPixelTypes) {
-    OSType *tmp;
-
-    for (tmp = *params->wantedDestinationPixelTypes; *tmp; tmp++)
-      GST_LOG ("Destination pixel %" GST_FOURCC_FORMAT, QT_FOURCC_ARGS (*tmp));
-  }
-}
-
-void
-addSInt32ToDictionary (CFMutableDictionaryRef dictionary, CFStringRef key,
-    SInt32 numberSInt32)
-{
-  CFNumberRef number =
-      CFNumberCreate (NULL, kCFNumberSInt32Type, &numberSInt32);
-  if (!number)
-    return;
-  CFDictionaryAddValue (dictionary, key, number);
-  CFRelease (number);
-}
-
-void
-dump_cvpixel_buffer (CVPixelBufferRef pixbuf)
-{
-  gsize left, right, top, bottom;
-
-  GST_LOG ("buffer %p", pixbuf);
-  if (CVPixelBufferLockBaseAddress (pixbuf, 0)) {
-    GST_WARNING ("Couldn't lock base adress on pixel buffer !");
-    return;
-  }
-  GST_LOG ("Width:%" G_GSIZE_FORMAT " , Height:%" G_GSIZE_FORMAT,
-      CVPixelBufferGetWidth (pixbuf), CVPixelBufferGetHeight (pixbuf));
-  GST_LOG ("Format:%" GST_FOURCC_FORMAT,
-      GST_FOURCC_ARGS (CVPixelBufferGetPixelFormatType (pixbuf)));
-  GST_LOG ("base address:%p", CVPixelBufferGetBaseAddress (pixbuf));
-  GST_LOG ("Bytes per row:%" G_GSIZE_FORMAT,
-      CVPixelBufferGetBytesPerRow (pixbuf));
-  GST_LOG ("Data Size:%" G_GSIZE_FORMAT, CVPixelBufferGetDataSize (pixbuf));
-  GST_LOG ("Plane count:%" G_GSIZE_FORMAT, CVPixelBufferGetPlaneCount (pixbuf));
-  CVPixelBufferGetExtendedPixels (pixbuf, &left, &right, &top, &bottom);
-  GST_LOG ("Extended pixels. left/right/top/bottom : %" G_GSIZE_FORMAT
-      "/%" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT,
-      left, right, top, bottom);
-  CVPixelBufferUnlockBaseAddress (pixbuf, 0);
-}
-
-
-// Convenience function to dispose of our audio buffers
-void
-DestroyAudioBufferList (AudioBufferList * list)
-{
-  UInt32 i;
-
-  if (list) {
-    for (i = 0; i < list->mNumberBuffers; i++) {
-      if (list->mBuffers[i].mData)
-        free (list->mBuffers[i].mData);
-    }
-    free (list);
-  }
-}
-
-// Convenience function to allocate our audio buffers
-AudioBufferList *
-AllocateAudioBufferList (UInt32 numChannels, UInt32 size)
-{
-  AudioBufferList *list;
-
-  list = (AudioBufferList *) calloc (1, sizeof (AudioBufferList));
-  if (list == NULL)
-    return NULL;
-
-  list->mNumberBuffers = 1;
-  list->mBuffers[0].mNumberChannels = numChannels;
-  list->mBuffers[0].mDataByteSize = size;
-  list->mBuffers[0].mData = malloc (size);
-  if (list->mBuffers[0].mData == NULL) {
-    DestroyAudioBufferList (list);
-    return NULL;
-  }
-  return list;
-}
diff --git a/sys/qtwrapper/qtutils.h b/sys/qtwrapper/qtutils.h
deleted file mode 100644
index 287c31f..0000000
--- a/sys/qtwrapper/qtutils.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * GStreamer QuickTime codec mapping
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef G_OS_WIN32
-#include <ImageCodec.h>
-#else
-#include <QuickTime/ImageCodec.h>
-#endif
-#include <gst/gst.h>
-#include "qtwrapper.h"
-
-#ifndef __QTUTILS_H__
-#define __QTUTILS_H__
-
-#define QT_UINT32(a)  (GST_READ_UINT32_BE(a))
-#define QT_UINT24(a)  (GST_READ_UINT32_BE(a) >> 8)
-#define QT_UINT16(a)  (GST_READ_UINT16_BE(a))
-#define QT_UINT8(a)   (GST_READ_UINT8(a))
-#define QT_FP32(a)    ((GST_READ_UINT32_BE(a))/65536.0)
-#define QT_FP16(a)    ((GST_READ_UINT16_BE(a))/256.0)
-#define QT_FOURCC(a)  (GST_READ_UINT32_LE(a))
-#define QT_UINT64(a)  ((((guint64)QT_UINT32(a))<<32)|QT_UINT32(((guint8 *)a)+4))
-#define QT_FOURCC_ARGS(fourcc)			\
-  ((gchar) (((fourcc)>>24)&0xff)),		\
-    ((gchar) (((fourcc)>>16)&0xff)),		\
-    ((gchar) (((fourcc)>>8 )&0xff)),		\
-    ((gchar) ((fourcc)     &0xff))
-
-#define QT_WRITE_UINT8(data, num)      GST_WRITE_UINT8(data, num)
-
-#define QT_MAKE_FOURCC_BE(a,b,c,d)      (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
-#define QT_MAKE_FOURCC_LE(a,b,c,d)	QT_MAKE_FOURCC_BE(d,c,b,a)
-
-#define _QT_PUT(__data, __idx, __size, __shift, __num) \
-    (((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
-
-/* endianness-dependent macros */
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define QT_MAKE_FOURCC(a,b,c,d)		QT_MAKE_FOURCC_LE(a,b,c,d)
-#define QT_WRITE_UINT16(data, num)	GST_WRITE_UINT16_LE(data, num)
-#define QT_WRITE_UINT24(data, num)	do {				\
-					  _QT_PUT (data, 0, 32,  0, num); \
-					  _QT_PUT (data, 1, 32,  8, num); \
-					  _QT_PUT (data, 2, 32, 16, num); \
-					} while (0)
-#define QT_WRITE_UINT32(data, num)	GST_WRITE_UINT32_LE(data, num)
-#define QT_READ_UINT16(data)		GST_READ_UINT16_LE(data)
-#define QT_READ_UINT32(data)		GST_READ_UINT32_LE(data)
-#else
-#define QT_MAKE_FOURCC(a,b,c,d)         QT_MAKE_FOURCC_BE(a,b,c,d)
-#define QT_WRITE_UINT16(data, num)     GST_WRITE_UINT16_BE(data, num)
-#define QT_WRITE_UINT24(data, num)	do {				\
-					  _QT_PUT (data, 0, 32, 16, num); \
-					  _QT_PUT (data, 1, 32,  8, num); \
-					  _QT_PUT (data, 2, 32,  0, num); \
-					} while (0)
-#define QT_WRITE_UINT32(data, num)     GST_WRITE_UINT32_BE(data, num)
-#define QT_READ_UINT16(data)		GST_READ_UINT16_BE(data)
-#define QT_READ_UINT32(data)		GST_READ_UINT32_BE(data)
-#endif
-
-
-/*
- * get_name_info_from_component:
- *
- * Fills name and info with the name and description from a Component
- */
-
-gboolean
-get_name_info_from_component (Component component, ComponentDescription * desc,
-    gchar ** name, gchar ** info);
-
-
-
-gboolean get_output_info_from_component (Component component);
-
-
-
-void dump_image_description (ImageDescription * desc);
-void dump_codec_decompress_params (CodecDecompressParams * params);
-
-guint32 destination_pixel_types_to_fourcc (OSType ** types);
-void
-addSInt32ToDictionary (CFMutableDictionaryRef dictionary, CFStringRef key,
-    SInt32 numberSInt32);
-
-void dump_cvpixel_buffer (CVPixelBufferRef pixbuf);
-
-void dump_avcc_atom (guint8 * atom);
-
-AudioBufferList *AllocateAudioBufferList(UInt32 numChannels, UInt32 size);
-
-void DestroyAudioBufferList(AudioBufferList* list);
-
-#endif /* __QTUTILS_H__ */
diff --git a/sys/qtwrapper/qtwrapper.c b/sys/qtwrapper/qtwrapper.c
deleted file mode 100644
index b87573f..0000000
--- a/sys/qtwrapper/qtwrapper.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * GStreamer QuickTime codecs wrapper
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include "qtwrapper.h"
-#include <stdio.h>
-
-GST_DEBUG_CATEGORY (qtwrapper_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  gboolean res;
-  OSErr status;
-
-  GST_DEBUG_CATEGORY_INIT (qtwrapper_debug, "qtwrapper",
-      0, "QuickTime codecs wrappers");
-
-  /* Initialize quicktime environment */
-#ifdef G_OS_WIN32
-  /* Only required on win32 */
-  InitializeQTML (0);
-#endif
-
-  status = EnterMovies ();
-  if (status) {
-    GST_ERROR ("Error initializing QuickTime environment: %d", status);
-    return FALSE;
-  }
-
-  GST_INFO ("Registering video decoders");
-  res = qtwrapper_video_decoders_register (plugin);
-  GST_INFO ("Registering audio decoders");
-  res &= qtwrapper_audio_decoders_register (plugin);
-
-  return res;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    qtwrapper,
-    "QuickTime codecs wrapper",
-    plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
diff --git a/sys/qtwrapper/qtwrapper.h b/sys/qtwrapper/qtwrapper.h
deleted file mode 100644
index 9e7d411..0000000
--- a/sys/qtwrapper/qtwrapper.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * GStreamer QuickTime codecs wrapper
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_QTWRAPPER_H__
-#define __GST_QTWRAPPER_H__
-
-#include <gst/gst.h>
-#ifdef G_OS_WIN32
-#include <Movies.h>
-#include <QTML.h>
-#else
-#include <QuickTime/Movies.h>
-#endif
-
-/* Set following to 1 if you want to have extra debug in form of
- * memory dumps */
-#define DEBUG_DUMP 0
-
-GST_DEBUG_CATEGORY_EXTERN (qtwrapper_debug);
-#define GST_CAT_DEFAULT qtwrapper_debug
-
-G_BEGIN_DECLS
-
-extern gboolean qtwrapper_video_decoders_register (GstPlugin *);
-extern gboolean qtwrapper_audio_decoders_register (GstPlugin *);
-
-G_END_DECLS
-#endif /* __GST_QTWRAPPER_H__ */
diff --git a/sys/qtwrapper/videodecoders.c b/sys/qtwrapper/videodecoders.c
deleted file mode 100644
index 8c507e7..0000000
--- a/sys/qtwrapper/videodecoders.c
+++ /dev/null
@@ -1,872 +0,0 @@
-/*
- * GStreamer QuickTime video decoder codecs wrapper
- * Copyright <2006, 2007> Fluendo <gstreamer@fluendo.com>
- * Copyright <2006, 2007> Pioneers of the Inevitable <songbird@songbirdnest.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "qtwrapper.h"
-#include "codecmapping.h"
-#include "qtutils.h"
-#include "imagedescription.h"
-
-#define QTWRAPPER_VDEC_PARAMS_QDATA g_quark_from_static_string("qtwrapper-vdec-params")
-
-static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-raw-yuv"));
-
-typedef struct _QTWrapperVideoDecoder QTWrapperVideoDecoder;
-typedef struct _QTWrapperVideoDecoderClass QTWrapperVideoDecoderClass;
-
-#define MAC_LOCK(qtwrapper) g_mutex_lock (qtwrapper->lock)
-#define MAC_UNLOCK(qtwrapper) g_mutex_unlock (qtwrapper->lock)
-
-struct _QTWrapperVideoDecoder
-{
-  GstElement parent;
-
-  GstPad *sinkpad;
-  GstPad *srcpad;
-
-  GMutex *lock;
-  ComponentInstance instance;
-  CodecInfo codecinfo;
-  ImageDescriptionHandle idesc;
-  CodecDecompressParams *dparams;
-  CodecCapabilities codeccaps;
-  guint64 frameNumber;
-  ICMDecompressionSessionRef decsession;
-  GstFlowReturn lastret;
-  guint64 outsize;
-  guint width, height;
-  GstClockTime last_ts;
-  GstClockTime last_duration;
-  GstBuffer *prevbuf;
-  gboolean flushing;
-  gboolean framebuffering;
-
-  /* width/height of output buffer */
-  Rect rect;
-};
-
-struct _QTWrapperVideoDecoderClass
-{
-  GstElementClass parent_class;
-
-  Component component;
-  guint32 componentType;
-  guint32 componentSubType;
-
-  GstPadTemplate *sinktempl;
-};
-
-typedef struct _QTWrapperVideoDecoderParams QTWrapperVideoDecoderParams;
-
-struct _QTWrapperVideoDecoderParams
-{
-  Component component;
-  GstCaps *sinkcaps;
-};
-
-static GstElementClass *parent_class = NULL;
-
-static gboolean
-qtwrapper_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps);
-static GstFlowReturn qtwrapper_video_decoder_chain (GstPad * pad,
-    GstBuffer * buf);
-static gboolean qtwrapper_video_decoder_sink_event (GstPad * pad,
-    GstEvent * event);
-
-static void qtwrapper_video_decoder_finalize (GObject * object);
-static void decompressCb (void *decompressionTrackingRefCon,
-    OSStatus result,
-    ICMDecompressionTrackingFlags decompressionTrackingFlags,
-    CVPixelBufferRef pixelBuffer,
-    TimeValue64 displayTime,
-    TimeValue64 displayDuration,
-    ICMValidTimeFlags validTimeFlags, void *reserved, void *sourceFrameRefCon);
-
-/*
- * Class setup
- */
-
-static void
-qtwrapper_video_decoder_base_init (QTWrapperVideoDecoderClass * klass)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-  gchar *name = NULL;
-  gchar *info = NULL;
-  char *longname, *description;
-  ComponentDescription desc;
-  QTWrapperVideoDecoderParams *params;
-
-  params = (QTWrapperVideoDecoderParams *)
-      g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
-      QTWRAPPER_VDEC_PARAMS_QDATA);
-  g_assert (params);
-
-  get_name_info_from_component (params->component, &desc, &name, &info);
-
-  /* Fill in details */
-  longname =
-      g_strdup_printf ("QTWrapper Video Decoder : %s", GST_STR_NULL (name));
-  description =
-      g_strdup_printf ("QTWrapper SCAudio wrapper for decoder: %s",
-      GST_STR_NULL (info));
-  gst_element_class_set_metadata (element_class, longname,
-      "Codec/Decoder/Video", description,
-      "Fluendo <gstreamer@fluendo.com>, "
-      "Pioneers of the Inevitable <songbird@songbirdnest.com>");
-  g_free (longname);
-  g_free (description);
-  g_free (name);
-  g_free (info);
-
-  klass->sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
-      GST_PAD_ALWAYS, params->sinkcaps);
-
-  gst_element_class_add_pad_template (element_class, klass->sinktempl);
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_templ));
-
-  /* Store class-global values */
-  klass->component = params->component;
-  klass->componentType = desc.componentType;
-  klass->componentSubType = desc.componentSubType;
-}
-
-static void
-qtwrapper_video_decoder_class_init (QTWrapperVideoDecoderClass * klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  gobject_class->finalize =
-      GST_DEBUG_FUNCPTR (qtwrapper_video_decoder_finalize);
-}
-
-static void
-qtwrapper_video_decoder_init (QTWrapperVideoDecoder * qtwrapper)
-{
-  QTWrapperVideoDecoderClass *oclass;
-  ImageSubCodecDecompressCapabilities capabs;
-
-  GST_LOG ("...");
-  oclass = (QTWrapperVideoDecoderClass *) (G_OBJECT_GET_CLASS (qtwrapper));
-
-  /* 1. Create a ocmponent instance */
-  if (!(qtwrapper->instance = OpenComponent (oclass->component))) {
-    GST_ERROR_OBJECT (qtwrapper, "Couldn't create a component instance !");
-    return;
-  }
-
-  /* 2. Initialize decoder */
-  memset (&capabs, 0, sizeof (ImageSubCodecDecompressCapabilities));
-  if (ImageCodecInitialize (qtwrapper->instance, &capabs) != noErr) {
-    GST_ERROR_OBJECT (qtwrapper, "Couldn't initialize the QT component !");
-    return;
-  }
-
-  /* 3. Get codec info */
-  memset (&qtwrapper->codecinfo, 0, sizeof (CodecInfo));
-  if (ImageCodecGetCodecInfo (qtwrapper->instance,
-          &qtwrapper->codecinfo) != noErr) {
-    GST_ERROR_OBJECT (qtwrapper, "Couldn't get Codec Information !");
-    return;
-  }
-
-  /* sink pad */
-  qtwrapper->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
-  gst_pad_set_setcaps_function (qtwrapper->sinkpad,
-      GST_DEBUG_FUNCPTR (qtwrapper_video_decoder_sink_setcaps));
-  gst_pad_set_chain_function (qtwrapper->sinkpad,
-      GST_DEBUG_FUNCPTR (qtwrapper_video_decoder_chain));
-  gst_pad_set_event_function (qtwrapper->sinkpad,
-      GST_DEBUG_FUNCPTR (qtwrapper_video_decoder_sink_event));
-  gst_element_add_pad (GST_ELEMENT (qtwrapper), qtwrapper->sinkpad);
-
-  /* src pad */
-  qtwrapper->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
-  gst_element_add_pad (GST_ELEMENT (qtwrapper), qtwrapper->srcpad);
-
-  qtwrapper->lock = g_mutex_new ();
-}
-
-static void
-qtwrapper_video_decoder_finalize (GObject * object)
-{
-  QTWrapperVideoDecoder *qtwrapper;
-
-  qtwrapper = (QTWrapperVideoDecoder *) object;
-
-  if (qtwrapper->lock)
-    g_mutex_free (qtwrapper->lock);
-
-  if (G_OBJECT_CLASS (parent_class)->finalize)
-    G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* fill_image_description
- * Fills an ImageDescription with codec-specific values
- *
- * Doesn't fill in the idSize, width and height.
- */
-
-static void
-fill_image_description (QTWrapperVideoDecoder * qtwrapper,
-    ImageDescription * desc)
-{
-  QTWrapperVideoDecoderClass *oclass;
-
-  oclass = (QTWrapperVideoDecoderClass *) (G_OBJECT_GET_CLASS (qtwrapper));
-
-  desc->cType = oclass->componentSubType;
-  desc->version = qtwrapper->codecinfo.version;
-  desc->revisionLevel = qtwrapper->codecinfo.revisionLevel;
-  desc->vendor = qtwrapper->codecinfo.vendor;
-  desc->temporalQuality = codecMaxQuality;
-  desc->spatialQuality = codecNormalQuality;
-  desc->hRes = Long2Fix (72);
-  desc->vRes = Long2Fix (72);
-  desc->frameCount = 1;
-  /* The following is a pure empiric calculation ... so there's are chances it
-   * might not work. To be fixed when we can figure out what the exact value should
-   * be. */
-  desc->depth = 24;
-  /* no color table */
-  desc->clutID = -1;
-}
-
-
-/* new_image_description
- *
- * Create an ImageDescription for the given 'codec_data' buffer.
- */
-
-static ImageDescription *
-new_image_description (QTWrapperVideoDecoder * qtwrapper, GstBuffer * buf,
-    guint width, guint height)
-{
-  QTWrapperVideoDecoderClass *oclass;
-  ImageDescription *desc = NULL;
-
-  oclass = (QTWrapperVideoDecoderClass *) (G_OBJECT_GET_CLASS (qtwrapper));
-
-  if (buf) {
-    GST_LOG ("buf %p , size:%d", buf, GST_BUFFER_SIZE (buf));
-#if DEBUG_DUMP
-    gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-#endif
-  }
-
-  if (!buf) {
-    /* standard case, no codec data */
-    desc = g_new0 (ImageDescription, 1);
-    desc->idSize = sizeof (ImageDescription);
-    fill_image_description (qtwrapper, desc);
-  } else {
-    if ((desc =
-            image_description_from_codec_data (buf, oclass->componentSubType)))
-      fill_image_description (qtwrapper, desc);
-    else
-      goto beach;
-  }
-
-  /* Fix up values */
-  desc->width = width;
-  desc->height = height;
-  desc->hRes = Long2Fix (72);
-  desc->vRes = Long2Fix (72);
-
-  /* if we have h264, we need frame buffering */
-  if ((oclass->componentSubType == QT_MAKE_FOURCC_LE ('a', 'v', 'c', '1')))
-    qtwrapper->framebuffering = TRUE;
-  else
-    qtwrapper->framebuffering = FALSE;
-
-beach:
-  return desc;
-}
-
-/* close_decoder
- *
- * Close and free decoder
- */
-#if 0
-static void
-close_decoder (QTWrapperVideoDecoder * qtwrapper)
-{
-  if (qtwrapper->idesc) {
-    DisposeHandle ((Handle) qtwrapper->idesc);
-    qtwrapper->idesc = NULL;
-  }
-
-  if (qtwrapper->prevbuf) {
-    gst_buffer_unref (qtwrapper->prevbuf);
-    qtwrapper->prevbuf = NULL;
-  }
-
-  if (qtwrapper->dparams) {
-    g_free (qtwrapper->dparams);
-    qtwrapper->dparams = NULL;
-  }
-
-}
-#endif
-/* open_decoder
- *
- * Attempt to initialize the ImageDecompressorComponent with the given
- * caps.
- *
- * Returns TRUE and fills *outcaps if the decoder was properly initialized
- * Returns FALSE if something went wrong.
- */
-
-static gboolean
-open_decoder (QTWrapperVideoDecoder * qtwrapper, GstCaps * caps,
-    GstCaps ** outcaps)
-{
-  ImageDescription *desc;
-  gint width, height;
-  GstStructure *s;
-  const GValue *par = NULL;
-  const GValue *rate = NULL;
-  const GValue *cdata = NULL;
-  OSStatus status;
-  gboolean res = FALSE;
-  guint32 outformat;
-
-  ICMDecompressionSessionOptionsRef sessionoptions = NULL;
-  ICMDecompressionTrackingCallbackRecord cbrecord;
-  CFMutableDictionaryRef pixelBufferAttributes = NULL;
-
-
-  s = gst_caps_get_structure (caps, 0);
-
-  /* 1. Extract information from incoming caps */
-  if ((!gst_structure_get_int (s, "width", &width)) ||
-      (!gst_structure_get_int (s, "height", &height)) ||
-      (!(rate = gst_structure_get_value (s, "framerate"))))
-    goto beach;
-  par = gst_structure_get_value (s, "pixel-aspect-ratio");
-  cdata = gst_structure_get_value (s, "codec_data");
-
-  /* 2. Create ImageDescription */
-  if (cdata) {
-    GstBuffer *cdatabuf;
-
-    cdatabuf = gst_value_get_buffer (cdata);
-    desc = new_image_description (qtwrapper, cdatabuf, width, height);
-  } else {
-    desc = new_image_description (qtwrapper, NULL, width, height);
-  }
-
-#if DEBUG_DUMP
-  dump_image_description (desc);
-#endif
-
-  /* 3.a. Create a handle to receive the ImageDescription */
-  GST_LOG_OBJECT (qtwrapper,
-      "Creating a new ImageDescriptionHandle of %" G_GSIZE_FORMAT " bytes",
-      desc->idSize);
-  qtwrapper->idesc = (ImageDescriptionHandle) NewHandleClear (desc->idSize);
-  if (G_UNLIKELY (qtwrapper->idesc == NULL)) {
-    GST_WARNING_OBJECT (qtwrapper,
-        "Failed to create an ImageDescriptionHandle of size %" G_GSIZE_FORMAT,
-        desc->idSize);
-    g_free (desc);
-    goto beach;
-  }
-
-  /* 3.b. Copy the ImageDescription to the handle */
-  GST_LOG_OBJECT (qtwrapper,
-      "Copying %" G_GSIZE_FORMAT
-      " bytes from desc [%p] to *qtwrapper->video [%p]", desc->idSize, desc,
-      *qtwrapper->idesc);
-  memcpy (*qtwrapper->idesc, desc, desc->idSize);
-  g_free (desc);
-
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-  outformat = kYUVSPixelFormat;
-#else
-  outformat = k2vuyPixelFormat;
-#endif
-
-  /* 4. Put output pixel info in dictionnnary */
-  pixelBufferAttributes =
-      CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
-      &kCFTypeDictionaryValueCallBacks);
-
-  addSInt32ToDictionary (pixelBufferAttributes, kCVPixelBufferWidthKey, width);
-  addSInt32ToDictionary (pixelBufferAttributes, kCVPixelBufferHeightKey,
-      height);
-  addSInt32ToDictionary (pixelBufferAttributes,
-      kCVPixelBufferPixelFormatTypeKey, outformat);
-
-  /* 5. fill in callback structure */
-
-  cbrecord.decompressionTrackingCallback = decompressCb;
-  cbrecord.decompressionTrackingRefCon = qtwrapper;
-
-  /* 6. create decompressionsession */
-  status = ICMDecompressionSessionCreate (NULL,
-      qtwrapper->idesc,
-      sessionoptions, pixelBufferAttributes, &cbrecord, &qtwrapper->decsession);
-
-  qtwrapper->outsize = width * height * 2;
-  qtwrapper->width = width;
-  qtwrapper->height = height;
-
-  if (status) {
-    GST_DEBUG_OBJECT (qtwrapper,
-        "Error when Calling ICMDecompressionSessionCreate : %ld", status);
-    goto beach;
-  }
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-  outformat = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
-#else
-  outformat = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
-#endif
-
-  /* 9. Create output caps */
-  *outcaps = gst_caps_new_simple ("video/x-raw-yuv",
-      "format", GST_TYPE_FOURCC, outformat,
-      "width", G_TYPE_INT, width,
-      "height", G_TYPE_INT, height,
-      "framerate", GST_TYPE_FRACTION,
-      gst_value_get_fraction_numerator (rate),
-      gst_value_get_fraction_denominator (rate), NULL);
-  if (par)
-    gst_structure_set_value (gst_caps_get_structure (*outcaps, 0),
-        "pixel-aspect-ratio", par);
-  res = TRUE;
-
-beach:
-  return res;
-}
-
-static gboolean
-qtwrapper_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
-  QTWrapperVideoDecoder *qtwrapper;
-  gboolean ret = FALSE;
-  GstCaps *othercaps = NULL;
-
-  qtwrapper = (QTWrapperVideoDecoder *) gst_pad_get_parent (pad);
-
-  GST_LOG_OBJECT (qtwrapper, "caps:%" GST_PTR_FORMAT, caps);
-
-  /* Setup the decoder with the given input caps */
-  if (!(open_decoder (qtwrapper, caps, &othercaps))) {
-    goto beach;
-  }
-
-  ret = gst_pad_set_caps (qtwrapper->srcpad, othercaps);
-  if (!ret)
-    goto beach;
-
-beach:
-  if (othercaps)
-    gst_caps_unref (othercaps);
-  gst_object_unref (qtwrapper);
-  return ret;
-}
-
-static void
-decompressCb (void *decompressionTrackingRefCon,
-    OSStatus result,
-    ICMDecompressionTrackingFlags decompressionTrackingFlags,
-    CVPixelBufferRef pixelBuffer,
-    TimeValue64 displayTime,
-    TimeValue64 displayDuration,
-    ICMValidTimeFlags validTimeFlags, void *reserved, void *sourceFrameRefCon)
-{
-  QTWrapperVideoDecoder *qtwrapper;
-  GstBuffer *origbuf = (GstBuffer *) sourceFrameRefCon;
-
-  qtwrapper = (QTWrapperVideoDecoder *) decompressionTrackingRefCon;
-
-  GST_LOG_OBJECT (qtwrapper,
-      "result:%d, flags:0x%x, pixelBuffer:%p, displayTime:%lld, displayDuration:%lld",
-      (guint32) result, (guint32) decompressionTrackingFlags, pixelBuffer,
-      displayTime, displayDuration);
-
-  GST_LOG_OBJECT (qtwrapper,
-      "validTimeFlags:0x%x, reserved:%p, sourceFrameRefCon:%p",
-      (guint32) validTimeFlags, reserved, sourceFrameRefCon);
-
-  if (decompressionTrackingFlags & kICMDecompressionTracking_ReleaseSourceData) {
-    GST_LOG ("removing previous buffer : %p", origbuf);
-    gst_buffer_unref (origbuf);
-  }
-
-  if (decompressionTrackingFlags & kICMDecompressionTracking_EmittingFrame)
-    GST_LOG ("EMITTING FRAME");
-  if (decompressionTrackingFlags & kICMDecompressionTracking_FrameDecoded)
-    GST_LOG ("FRAME DECODED");
-  if (decompressionTrackingFlags & kICMDecompressionTracking_FrameDropped)
-    GST_LOG ("FRAME DROPPED");
-  if (decompressionTrackingFlags &
-      kICMDecompressionTracking_FrameNeedsRequeueing)
-    GST_LOG ("FRAME NEEDS REQUEUING");
-
-  if ((decompressionTrackingFlags & kICMDecompressionTracking_EmittingFrame)
-      && pixelBuffer) {
-    guint8 *addr;
-    GstBuffer *outbuf;
-    size_t size;
-    GstClockTime outtime;
-
-    size = CVPixelBufferGetDataSize (pixelBuffer);
-    outtime = gst_util_uint64_scale (displayTime, GST_SECOND, 600);
-
-    GST_LOG ("Got a buffer ready outtime : %" GST_TIME_FORMAT,
-        GST_TIME_ARGS (outtime));
-
-    if (qtwrapper->flushing) {
-      CVPixelBufferRelease (pixelBuffer);
-      goto beach;
-    }
-
-    dump_cvpixel_buffer (pixelBuffer);
-
-    CVPixelBufferRetain (pixelBuffer);
-    if (CVPixelBufferLockBaseAddress (pixelBuffer, 0))
-      GST_WARNING ("Couldn't lock base adress on pixel buffer !");
-    addr = CVPixelBufferGetBaseAddress (pixelBuffer);
-
-    /* allocate buffer */
-    qtwrapper->lastret =
-        gst_pad_alloc_buffer (qtwrapper->srcpad, GST_BUFFER_OFFSET_NONE,
-        (gint) qtwrapper->outsize, GST_PAD_CAPS (qtwrapper->srcpad), &outbuf);
-    if (G_UNLIKELY (qtwrapper->lastret != GST_FLOW_OK)) {
-      GST_LOG ("gst_pad_alloc_buffer() returned %s",
-          gst_flow_get_name (qtwrapper->lastret));
-      goto beach;
-    }
-
-    /* copy data */
-    GST_LOG ("copying data in buffer from %p to %p",
-        addr, GST_BUFFER_DATA (outbuf));
-    if (G_UNLIKELY ((qtwrapper->width * 2) !=
-            CVPixelBufferGetBytesPerRow (pixelBuffer))) {
-      guint i;
-      gulong realpixels;
-      size_t stride;
-
-      stride = CVPixelBufferGetBytesPerRow (pixelBuffer);
-      realpixels = qtwrapper->width * 2;
-
-      /* special copy for stride handling */
-      for (i = 0; i < qtwrapper->height; i++)
-        memmove (GST_BUFFER_DATA (outbuf) + realpixels * i,
-            addr + stride * i, realpixels);
-
-    } else
-      memmove (GST_BUFFER_DATA (outbuf), addr, (int) qtwrapper->outsize);
-
-    /* Release CVPixelBuffer */
-    CVPixelBufferUnlockBaseAddress (pixelBuffer, 0);
-    CVPixelBufferRelease (pixelBuffer);
-
-    /* Set proper timestamp ! */
-    gst_buffer_set_caps (outbuf, GST_PAD_CAPS (qtwrapper->srcpad));
-    GST_BUFFER_TIMESTAMP (outbuf) = qtwrapper->last_ts;
-    GST_BUFFER_DURATION (outbuf) = qtwrapper->last_duration;
-    GST_BUFFER_SIZE (outbuf) = (int) qtwrapper->outsize;
-
-    /* See if we push buffer downstream */
-    if (G_LIKELY (!qtwrapper->framebuffering)) {
-      GST_LOG ("No buffering needed, pushing buffer downstream");
-      MAC_UNLOCK (qtwrapper);
-      qtwrapper->lastret = gst_pad_push (qtwrapper->srcpad, outbuf);
-      MAC_LOCK (qtwrapper);
-    } else {
-      /* Check if we push the current buffer or the stored buffer */
-      if (!qtwrapper->prevbuf) {
-        GST_LOG ("Storing buffer");
-        qtwrapper->prevbuf = outbuf;
-        qtwrapper->lastret = GST_FLOW_OK;
-      } else if (GST_BUFFER_TIMESTAMP (qtwrapper->prevbuf) >
-          GST_BUFFER_TIMESTAMP (outbuf)) {
-        GST_LOG ("Newly decoded buffer is earliest, pushing that one !");
-        MAC_UNLOCK (qtwrapper);
-        qtwrapper->lastret = gst_pad_push (qtwrapper->srcpad, outbuf);
-        MAC_LOCK (qtwrapper);
-      } else {
-        GstBuffer *tmp;
-
-        tmp = qtwrapper->prevbuf;
-        qtwrapper->prevbuf = outbuf;
-        GST_LOG ("Stored buffer is earliest, pushing that one !");
-        MAC_UNLOCK (qtwrapper);
-        qtwrapper->lastret = gst_pad_push (qtwrapper->srcpad, tmp);
-        MAC_LOCK (qtwrapper);
-      }
-    }
-  } else {
-    qtwrapper->lastret = GST_FLOW_OK;
-  }
-
-beach:
-  return;
-}
-
-/* _chain
- *
- * Here we feed the data to the decoder and ask to decode frames.
- *
- * Known issues/questions are:
- *  * How can we be guaranteed that one frame in automatically gives one output
- *    frame ?
- *  * PTS/DTS timestamp issues. With mpeg-derivate formats, the incoming order is
- *    different from the output order.
- */
-
-static GstFlowReturn
-qtwrapper_video_decoder_chain (GstPad * pad, GstBuffer * buf)
-{
-  QTWrapperVideoDecoder *qtwrapper;
-  GstFlowReturn ret = GST_FLOW_OK;
-  ICMFrameTimeRecord frameTime = { {0} };
-  OSStatus status;
-  guint64 intime;
-
-  qtwrapper = (QTWrapperVideoDecoder *) gst_pad_get_parent (pad);
-
-  intime = gst_util_uint64_scale (GST_BUFFER_TIMESTAMP (buf), 600, GST_SECOND);
-
-  GST_DEBUG_OBJECT (qtwrapper,
-      "buffer:%p timestamp:%" GST_TIME_FORMAT " intime:%llu Size:%d", buf,
-      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), intime,
-      GST_BUFFER_SIZE (buf));
-
-  frameTime.recordSize = sizeof (ICMFrameTimeRecord);
-/*   *(TimeValue64 *)&frameTime.value = intime; */
-  frameTime.value.lo = (guint32) (intime & 0xffffffff);
-  frameTime.value.hi = (guint32) (intime >> 32);
-  frameTime.base = 0;
-  frameTime.scale = 600;
-  frameTime.rate = fixed1;
-  frameTime.duration = 1;
-  frameTime.flags = icmFrameTimeDecodeImmediately;
-/*   frameTime.flags = icmFrameTimeIsNonScheduledDisplayTime; */
-  frameTime.frameNumber = (long) (++qtwrapper->frameNumber);
-
-  MAC_LOCK (qtwrapper);
-
-  qtwrapper->last_ts = GST_BUFFER_TIMESTAMP (buf);
-  qtwrapper->last_duration = GST_BUFFER_DURATION (buf);
-
-  status = ICMDecompressionSessionDecodeFrame (qtwrapper->decsession,
-      GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), NULL, &frameTime, buf);
-  MAC_UNLOCK (qtwrapper);
-
-  if (status) {
-    GST_WARNING_OBJECT (qtwrapper, "Error when Calling DecodeFrame() : %ld",
-        status);
-    ret = GST_FLOW_ERROR;
-    goto beach;
-  }
-
-beach:
-  gst_object_unref (qtwrapper);
-  return qtwrapper->lastret;
-}
-
-static gboolean
-qtwrapper_video_decoder_sink_event (GstPad * pad, GstEvent * event)
-{
-  gboolean res;
-  QTWrapperVideoDecoder *qtwrapper;
-
-  qtwrapper = (QTWrapperVideoDecoder *) gst_pad_get_parent (pad);
-
-  GST_LOG_OBJECT (pad, "event : %s", GST_EVENT_TYPE_NAME (event));
-
-  switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_FLUSH_START:
-      MAC_LOCK (qtwrapper);
-      qtwrapper->flushing = TRUE;
-      if (qtwrapper->prevbuf) {
-        GST_LOG ("About to unref buffer %p", qtwrapper->prevbuf);
-        gst_buffer_unref (qtwrapper->prevbuf);
-        qtwrapper->prevbuf = NULL;
-      }
-      ICMDecompressionSessionFlush (qtwrapper->decsession);
-      MAC_UNLOCK (qtwrapper);
-      break;
-    case GST_EVENT_FLUSH_STOP:
-      MAC_LOCK (qtwrapper);
-      qtwrapper->flushing = FALSE;
-      qtwrapper->prevbuf = NULL;
-      MAC_UNLOCK (qtwrapper);
-      break;
-    default:
-      break;
-  }
-
-  res = gst_pad_push_event (qtwrapper->srcpad, event);
-
-  gst_object_unref (qtwrapper);
-  return res;
-}
-
-/* _register
- *
- * Scan through all available Image Decompressor components to find the ones we
- * can handle and wrap in this plugin.
- */
-
-gboolean
-qtwrapper_video_decoders_register (GstPlugin * plugin)
-{
-  gboolean res = TRUE;
-  Component componentID = NULL;
-  ComponentDescription desc = {
-    'imdc', 0, 0, 0, 0
-  };
-  GTypeInfo typeinfo = {
-    sizeof (QTWrapperVideoDecoderClass),
-    (GBaseInitFunc) qtwrapper_video_decoder_base_init,
-    NULL,
-    (GClassInitFunc) qtwrapper_video_decoder_class_init,
-    NULL,
-    NULL,
-    sizeof (QTWrapperVideoDecoder),
-    0,
-    (GInstanceInitFunc) qtwrapper_video_decoder_init,
-  };
-
-  /* Find all ImageDecoders ! */
-  GST_DEBUG ("There are %ld decompressors available", CountComponents (&desc));
-
-  /* loop over ImageDecoders */
-  do {
-    componentID = FindNextComponent (componentID, &desc);
-
-    GST_LOG ("componentID : %p", componentID);
-
-    if (componentID) {
-      ComponentDescription thisdesc;
-      gchar *name = NULL, *info = NULL;
-      GstCaps *caps = NULL;
-      gchar *type_name = NULL;
-      GType type;
-      QTWrapperVideoDecoderParams *params = NULL;
-
-      if (!(get_name_info_from_component (componentID, &thisdesc, &name,
-                  &info)))
-        goto next;
-
-      if (!get_output_info_from_component (componentID)) {
-        GST_WARNING ("Couldn't get output info from component");
-        goto next;
-      }
-
-      GST_LOG (" name:%s", GST_STR_NULL (name));
-      GST_LOG (" info:%s", GST_STR_NULL (info));
-
-      GST_LOG (" type:%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentType));
-      GST_LOG (" subtype:%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentSubType));
-      GST_LOG (" manufacturer:%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentManufacturer));
-
-      if (!(caps = fourcc_to_caps (thisdesc.componentSubType))) {
-        GST_LOG
-            ("We can't find caps for this component, switching to the next one !");
-        goto next;
-      }
-
-      type_name = g_strdup_printf ("qtwrappervideodec_%" GST_FOURCC_FORMAT,
-          QT_FOURCC_ARGS (thisdesc.componentSubType));
-      g_strdelimit (type_name, " ", '_');
-
-      if (g_type_from_name (type_name)) {
-        GST_WARNING ("We already have a registered plugin for %s", type_name);
-        goto next;
-      }
-
-      params = g_new0 (QTWrapperVideoDecoderParams, 1);
-      params->component = componentID;
-      params->sinkcaps = gst_caps_ref (caps);
-
-      GST_INFO ("Registering g_type for type_name: %s", type_name);
-      type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
-      /* Store params in type qdata */
-      g_type_set_qdata (type, QTWRAPPER_VDEC_PARAMS_QDATA, (gpointer) params);
-
-      /* register type */
-      if (!gst_element_register (plugin, type_name, GST_RANK_MARGINAL, type)) {
-        g_warning ("Failed to register %s", type_name);;
-        g_type_set_qdata (type, QTWRAPPER_VDEC_PARAMS_QDATA, NULL);
-        g_free (params);
-        res = FALSE;
-        goto next;
-      } else {
-        GST_LOG ("Reigstered video plugin %s", type_name);
-      }
-
-    next:
-      if (name)
-        g_free (name);
-      if (info)
-        g_free (info);
-      if (type_name)
-        g_free (type_name);
-      if (caps)
-        gst_caps_unref (caps);
-    }
-
-  } while (componentID && res);
-
-  return res;
-}
diff --git a/sys/shm/Makefile.in b/sys/shm/Makefile.in
index e7627e9..c95618b 100644
--- a/sys/shm/Makefile.in
+++ b/sys/shm/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -246,8 +246,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -286,7 +290,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -294,6 +297,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -343,8 +348,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -423,7 +426,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -432,7 +434,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -445,7 +446,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -470,6 +470,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -543,10 +545,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -572,6 +578,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -608,6 +617,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -648,17 +658,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -675,6 +684,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/uvch264/Makefile.in b/sys/uvch264/Makefile.in
index 32190bc..ff3b81e 100644
--- a/sys/uvch264/Makefile.in
+++ b/sys/uvch264/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -250,8 +250,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -290,7 +294,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -298,6 +301,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -347,8 +352,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -427,7 +430,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -436,7 +438,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -449,7 +450,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -474,6 +474,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -547,10 +549,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -576,6 +582,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -612,6 +621,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -652,17 +662,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -679,6 +688,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/uvch264/gstuvch264_src.c b/sys/uvch264/gstuvch264_src.c
index af9da69..9e0cbb9 100644
--- a/sys/uvch264/gstuvch264_src.c
+++ b/sys/uvch264/gstuvch264_src.c
@@ -170,7 +170,7 @@
   "height = " GST_VIDEO_SIZE_RANGE ", "                                 \
   "framerate = " GST_VIDEO_FPS_RANGE ", "                               \
   "stream-format = (string) { byte-stream, avc }, "                     \
-  "alignment = (string) { au }, "                                       \
+  "alignment = (string) au, "                                           \
   "profile = (string) { high, main, baseline, constrained-baseline }"
 
 static GstStaticPadTemplate vfsrc_template =
diff --git a/sys/uvch264/gstuvch264_src.h b/sys/uvch264/gstuvch264_src.h
index f972d6d..f220ed0 100644
--- a/sys/uvch264/gstuvch264_src.h
+++ b/sys/uvch264/gstuvch264_src.h
@@ -35,6 +35,7 @@
 #include "uvc_h264.h"
 
 G_BEGIN_DECLS
+
 #define GST_TYPE_UVC_H264_SRC                   \
   (gst_uvc_h264_src_get_type())
 #define GST_UVC_H264_SRC(obj)                                           \
@@ -158,5 +159,6 @@
   GstBaseCameraSrcClass parent;
 };
 
+G_END_DECLS
 
 #endif /* __GST_UVC_H264_SRC_H__ */
diff --git a/sys/vcd/Makefile.in b/sys/vcd/Makefile.in
index 7746963..93c42c7 100644
--- a/sys/vcd/Makefile.in
+++ b/sys/vcd/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/vcd/vcdsrc.c b/sys/vcd/vcdsrc.c
index 4f5fe46..7372ac5 100644
--- a/sys/vcd/vcdsrc.c
+++ b/sys/vcd/vcdsrc.c
@@ -62,22 +62,9 @@
 #define GST_CAT_DEFAULT gst_vcdsrc_debug
 
 static void gst_vcdsrc_uri_handler_init (gpointer g_iface, gpointer iface_data);
-
-static void
-gst_vcdsrc_setup_interfaces (GType type)
-{
-  static const GInterfaceInfo urihandler_info = {
-    gst_vcdsrc_uri_handler_init,
-    NULL,
-    NULL,
-  };
-
-  g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
-}
-
-
-GST_BOILERPLATE_FULL (GstVCDSrc, gst_vcdsrc, GstPushSrc, GST_TYPE_PUSH_SRC,
-    gst_vcdsrc_setup_interfaces);
+#define gst_vcdsrc_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstVCDSrc, gst_vcdsrc, GST_TYPE_PUSH_SRC,
+    G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_vcdsrc_uri_handler_init));
 
 static void gst_vcdsrc_finalize (GObject * object);
 
@@ -90,29 +77,19 @@
 static gboolean gst_vcdsrc_stop (GstBaseSrc * src);
 static GstFlowReturn gst_vcdsrc_create (GstPushSrc * src, GstBuffer ** out);
 
-static void
-gst_vcdsrc_base_init (gpointer g_class)
-{
-  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
-  gst_element_class_set_static_metadata (element_class, "VCD Source",
-      "Source/File",
-      "Asynchronous read from VCD disk", "Erik Walthinsen <omega@cse.ogi.edu>");
-
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&srctemplate));
-}
 
 static void
 gst_vcdsrc_class_init (GstVCDSrcClass * klass)
 {
   GObjectClass *gobject_class;
+  GstElementClass *element_class;
   GstBaseSrcClass *basesrc_class;
   GstPushSrcClass *pushsrc_class;
 
   gobject_class = (GObjectClass *) klass;
   basesrc_class = (GstBaseSrcClass *) klass;
   pushsrc_class = (GstPushSrcClass *) klass;
+  element_class = (GstElementClass *) klass;
 
   gobject_class->set_property = gst_vcdsrc_set_property;
   gobject_class->get_property = gst_vcdsrc_get_property;
@@ -136,10 +113,17 @@
 
   GST_DEBUG_CATEGORY_INIT (gst_vcdsrc_debug, "vcdsrc", 0,
       "VideoCD Source element");
+
+  gst_element_class_set_static_metadata (element_class, "VCD Source",
+      "Source/File",
+      "Asynchronous read from VCD disk", "Erik Walthinsen <omega@cse.ogi.edu>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&srctemplate));
 }
 
 static void
-gst_vcdsrc_init (GstVCDSrc * vcdsrc, GstVCDSrcClass * klass)
+gst_vcdsrc_init (GstVCDSrc * vcdsrc)
 {
   vcdsrc->device = g_strdup (DEFAULT_DEVICE);
   vcdsrc->track = 1;
@@ -317,6 +301,7 @@
 {
   GstVCDSrc *vcdsrc;
   GstBuffer *outbuf;
+  GstMapInfo map_info;
   gulong offset;
   struct cdrom_msf *msf;
   gint error_count = 0;
@@ -328,8 +313,15 @@
     goto eos;
 
   /* create the buffer */
-  outbuf = gst_buffer_new_and_alloc (vcdsrc->bytes_per_read);
-  msf = (struct cdrom_msf *) GST_BUFFER_DATA (outbuf);
+  outbuf = gst_buffer_new_allocate (NULL, vcdsrc->bytes_per_read, NULL);
+  if (!outbuf)
+    goto error_unmapped;
+
+  if (!gst_buffer_map (outbuf, &map_info, GST_MAP_READWRITE))
+    goto error_unmapped;
+
+  msf = (struct cdrom_msf *) map_info.data;
+
 
 read:
   /* read it in from the device */
@@ -351,21 +343,26 @@
         ("Read from cdrom at %d:%d:%d failed: %s",
             msf->cdmsf_min0, msf->cdmsf_sec0, msf->cdmsf_frame0,
             strerror (errno)));
-    return GST_FLOW_ERROR;
+    goto error_mapped;
   }
 
-  GST_BUFFER_SIZE (outbuf) = vcdsrc->bytes_per_read;
+  gst_buffer_unmap (outbuf, &map_info);
   vcdsrc->curoffset += 1;
 
   *buf = outbuf;
-
   return GST_FLOW_OK;
 
   /* ERRORS */
+error_mapped:
+  gst_buffer_unmap (outbuf, &map_info);
+error_unmapped:
+  if (outbuf)
+    gst_buffer_unref (outbuf);
+  return GST_FLOW_ERROR;
 eos:
   {
     GST_DEBUG_OBJECT (vcdsrc, "got eos");
-    return GST_FLOW_UNEXPECTED;
+    return GST_FLOW_EOS;
   }
 }
 
@@ -463,21 +460,21 @@
  * URI interface.
  */
 
-static guint
-gst_vcdsrc_uri_get_type (void)
+static GstURIType
+gst_vcdsrc_uri_get_type (GType type)
 {
   return GST_URI_SRC;
 }
 
-static gchar **
-gst_vcdsrc_uri_get_protocols (void)
+static const gchar *const *
+gst_vcdsrc_uri_get_protocols (GType type)
 {
-  static gchar *protocols[] = { (char *) "vcd", NULL };
+  static const gchar *protocols[] = { "vcd", NULL };
 
   return protocols;
 }
 
-static const gchar *
+static gchar *
 gst_vcdsrc_uri_get_uri (GstURIHandler * handler)
 {
   GstVCDSrc *src = GST_VCDSRC (handler);
@@ -491,7 +488,8 @@
 }
 
 static gboolean
-gst_vcdsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_vcdsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+    GError ** error)
 {
   GstVCDSrc *src = GST_VCDSRC (handler);
   gchar *location = NULL;
@@ -548,17 +546,23 @@
   /* ERRORS */
 wrong_protocol:
   {
-    GST_ERROR_OBJECT (src, "wrong protocol, uri = %s", uri);
+    GST_ERROR_OBJECT (src, "Wrong protocol, uri = %s", uri);
+    g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
+        "Wrong protocol, uri = %s", uri);
     return FALSE;
   }
 no_location:
   {
-    GST_ERROR_OBJECT (src, "no location specified");
+    GST_ERROR_OBJECT (src, "No location specified");
+    g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
+        "No location specified");
     return FALSE;
   }
 invalid_location:
   {
-    GST_ERROR_OBJECT (src, "Invalid location %s in URI '%s'", location, uri);
+    GST_ERROR_OBJECT (src, "Invalid location '%s' in URI '%s'", location, uri);
+    g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
+        "Invalid location '%s' in URI '%s'", location, uri);
     g_free (location);
     return FALSE;
   }
diff --git a/sys/vdpau/Makefile.in b/sys/vdpau/Makefile.in
index 62cd2f9..a9242db 100644
--- a/sys/vdpau/Makefile.in
+++ b/sys/vdpau/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -252,8 +252,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -292,7 +296,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -300,6 +303,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -349,8 +354,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -429,7 +432,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -438,7 +440,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -451,7 +452,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -476,6 +476,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -549,10 +551,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -578,6 +584,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -614,6 +623,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -654,17 +664,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -681,6 +690,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/vdpau/gstvdpvideobufferpool.c b/sys/vdpau/gstvdpvideobufferpool.c
index afdce16..c89ca36 100644
--- a/sys/vdpau/gstvdpvideobufferpool.c
+++ b/sys/vdpau/gstvdpvideobufferpool.c
@@ -111,7 +111,7 @@
         ("Failed to create output image buffer of %dx%d pixels",
             info.width, info.height),
         ("Invalid input caps %" GST_PTR_FORMAT, caps));
-    return FALSE;;
+    return FALSE;
   }
 }
 
diff --git a/sys/wasapi/Makefile.in b/sys/wasapi/Makefile.in
index e57776e..9242a43 100644
--- a/sys/wasapi/Makefile.in
+++ b/sys/wasapi/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/wininet/Makefile.in b/sys/wininet/Makefile.in
index 0ce66ba..c4f9dd4 100644
--- a/sys/wininet/Makefile.in
+++ b/sys/wininet/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -244,8 +244,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +288,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +295,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +346,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +424,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +432,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +444,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +468,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +543,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +576,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +615,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +656,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +682,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/winks/Makefile.in b/sys/winks/Makefile.in
index f684593..4524e32 100644
--- a/sys/winks/Makefile.in
+++ b/sys/winks/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/sys/winks/gstksvideodevice.c b/sys/winks/gstksvideodevice.c
index 994f2f4..95dec48 100644
--- a/sys/winks/gstksvideodevice.c
+++ b/sys/winks/gstksvideodevice.c
@@ -627,8 +627,7 @@
     if (ks_object_get_property (pin_handle, KSPROPSETID_Stream,
             KSPROPERTY_STREAM_MASTERCLOCK, (gpointer *) & cur_clock_handle,
             &cur_clock_handle_size, NULL)) {
-      GST_DEBUG ("current master clock handle: 0x%08x",
-          (guint) * cur_clock_handle);
+      GST_DEBUG ("current master clock handle: %p", *cur_clock_handle);
       CloseHandle (*cur_clock_handle);
       g_free (cur_clock_handle);
     } else {
@@ -912,10 +911,12 @@
   gboolean buffer_found = FALSE;
   guint i;
 
-  buffer_found = gst_buffer_is_writable (req->buf);
+  buffer_found = gst_buffer_is_writable (req->buf)
+      && gst_buffer_is_all_memory_writable (req->buf);
 
   for (i = 0; !buffer_found && i < G_N_ELEMENTS (priv->spare_buffers); i++) {
-    if (gst_buffer_is_writable (priv->spare_buffers[i])) {
+    if (gst_buffer_is_writable (priv->spare_buffers[i])
+        && gst_buffer_is_all_memory_writable (priv->spare_buffers[i])) {
       GstBuffer *hold;
 
       hold = req->buf;
@@ -963,7 +964,9 @@
   params = &req->params;
   memset (params, 0, sizeof (KSSTREAM_READ_PARAMS));
 
-  gst_buffer_map (req->buf, &info, GST_MAP_READ);
+  if (!gst_buffer_map (req->buf, &info, GST_MAP_WRITE))
+    goto map_failed;
+
   params->header.Size = sizeof (KSSTREAM_HEADER) + sizeof (KS_FRAME_INFO);
   params->header.PresentationTime.Numerator = 1;
   params->header.PresentationTime.Denominator = 1;
@@ -994,6 +997,10 @@
         error_code, error_str);
     return FALSE;
   }
+map_failed:
+  {
+    return FALSE;
+  }
 }
 
 GstFlowReturn
@@ -1161,20 +1168,23 @@
   }
 }
 
-void
-gst_ks_video_device_postprocess_frame (GstKsVideoDevice * self,
-    guint8 * buf, guint buf_size)
+gboolean
+gst_ks_video_device_postprocess_frame (GstKsVideoDevice * self, GstBuffer * buf)
 {
   GstKsVideoDevicePrivate *priv = GST_KS_VIDEO_DEVICE_GET_PRIVATE (self);
 
   /* If it's RGB we need to flip the image */
   if (priv->rgb_swap_buf != NULL) {
+    GstMapInfo info;
     gint stride, line;
     guint8 *dst, *src;
 
-    stride = buf_size / priv->height;
-    dst = buf;
-    src = buf + buf_size - stride;
+    if (!gst_buffer_map (buf, &info, GST_MAP_READWRITE))
+      return FALSE;
+
+    stride = info.size / priv->height;
+    dst = info.data;
+    src = info.data + info.size - stride;
 
     for (line = 0; line < priv->height / 2; line++) {
       memcpy (priv->rgb_swap_buf, dst, stride);
@@ -1185,7 +1195,11 @@
       dst += stride;
       src -= stride;
     }
+
+    gst_buffer_unmap (buf, &info);
   }
+
+  return TRUE;
 }
 
 void
diff --git a/sys/winks/gstksvideodevice.h b/sys/winks/gstksvideodevice.h
index d148f92..105b79d 100644
--- a/sys/winks/gstksvideodevice.h
+++ b/sys/winks/gstksvideodevice.h
@@ -77,7 +77,7 @@
 gboolean gst_ks_video_device_get_latency (GstKsVideoDevice * self, GstClockTime * min_latency, GstClockTime * max_latency);
 
 GstFlowReturn gst_ks_video_device_read_frame (GstKsVideoDevice * self, GstBuffer ** buf, GstClockTime * presentation_time, gulong * error_code, gchar ** error_str);
-void gst_ks_video_device_postprocess_frame (GstKsVideoDevice * self, guint8 * buf, guint buf_size);
+gboolean gst_ks_video_device_postprocess_frame (GstKsVideoDevice * self, GstBuffer *buf);
 void gst_ks_video_device_cancel (GstKsVideoDevice * self);
 void gst_ks_video_device_cancel_stop (GstKsVideoDevice * self);
 
diff --git a/sys/winks/gstksvideosrc.c b/sys/winks/gstksvideosrc.c
index 2694ac7..cd61a99 100644
--- a/sys/winks/gstksvideosrc.c
+++ b/sys/winks/gstksvideosrc.c
@@ -950,7 +950,6 @@
   GstClockTime presentation_time;
   gulong error_code;
   gchar *error_str;
-  GstMapInfo info;
 
   g_assert (priv->device != NULL);
 
@@ -987,9 +986,11 @@
   if (G_UNLIKELY (priv->do_stats))
     gst_ks_video_src_update_statistics (self);
 
-  gst_buffer_map (*buf, &info, GST_MAP_WRITE);
-  gst_ks_video_device_postprocess_frame (priv->device, info.data, info.size);
-  gst_buffer_unmap (*buf, &info);
+  if (!gst_ks_video_device_postprocess_frame (priv->device, *buf)) {
+    GST_ELEMENT_ERROR (self, RESOURCE, FAILED, ("Postprocessing failed"),
+        ("Postprocessing failed"));
+    return GST_FLOW_ERROR;
+  }
 
   return GST_FLOW_OK;
 
diff --git a/sys/winks/kshelpers.c b/sys/winks/kshelpers.c
index 57b30b7..b6621de 100644
--- a/sys/winks/kshelpers.c
+++ b/sys/winks/kshelpers.c
@@ -28,7 +28,7 @@
 
 #ifndef STATIC_KSPROPSETID_Wave_Queued
 #define STATIC_KSPROPSETID_Wave_Queued \
-    0x16a15b10L,0x16f0,0x11d0,0xa1,0x95,0x00,0x20,0xaf,0xd1,0x56,0xe4
+    0x16a15b10L, 0x16f0, 0x11d0, { 0xa1, 0x95, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4 }
 DEFINE_GUIDSTRUCT ("16a15b10-16f0-11d0-a195-0020afd156e4",
     KSPROPSETID_Wave_Queued);
 #endif
@@ -403,28 +403,28 @@
 
 #ifndef STATIC_KSPROPSETID_GM
 #define STATIC_KSPROPSETID_GM \
-    0xAF627536, 0xE719, 0x11D2, 0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D
+    0xAF627536, 0xE719, 0x11D2, { 0x8A, 0x1D, 0x00, 0x60, 0x97, 0xD2, 0xDF, 0x5D }
 #endif
 #ifndef STATIC_KSPROPSETID_Jack
 #define STATIC_KSPROPSETID_Jack \
-    0x4509F757, 0x2D46, 0x4637, 0x8E, 0x62, 0xCE, 0x7D, 0xB9, 0x44, 0xF5, 0x7B
+    0x4509F757, 0x2D46, 0x4637, { 0x8E, 0x62, 0xCE, 0x7D, 0xB9, 0x44, 0xF5, 0x7B }
 #endif
 
 #ifndef STATIC_PROPSETID_VIDCAP_SELECTOR
 #define STATIC_PROPSETID_VIDCAP_SELECTOR \
-    0x1ABDAECA, 0x68B6, 0x4F83, 0x93, 0x71, 0xB4, 0x13, 0x90, 0x7C, 0x7B, 0x9F
+    0x1ABDAECA, 0x68B6, 0x4F83, { 0x93, 0x71, 0xB4, 0x13, 0x90, 0x7C, 0x7B, 0x9F }
 #endif
 #ifndef STATIC_PROPSETID_EXT_DEVICE
 #define STATIC_PROPSETID_EXT_DEVICE \
-    0xB5730A90, 0x1A2C, 0x11cf, 0x8c, 0x23, 0x00, 0xAA, 0x00, 0x6B, 0x68, 0x14
+    0xB5730A90, 0x1A2C, 0x11cf, { 0x8c, 0x23, 0x00, 0xAA, 0x00, 0x6B, 0x68, 0x14 }
 #endif
 #ifndef STATIC_PROPSETID_EXT_TRANSPORT
 #define STATIC_PROPSETID_EXT_TRANSPORT \
-    0xA03CD5F0, 0x3045, 0x11cf, 0x8c, 0x44, 0x00, 0xAA, 0x00, 0x6B, 0x68, 0x14
+    0xA03CD5F0, 0x3045, 0x11cf, { 0x8c, 0x44, 0x00, 0xAA, 0x00, 0x6B, 0x68, 0x14 }
 #endif
 #ifndef STATIC_PROPSETID_TIMECODE_READER
 #define STATIC_PROPSETID_TIMECODE_READER \
-    0x9B496CE1, 0x811B, 0x11cf, 0x8C, 0x77, 0x00, 0xAA, 0x00, 0x6B, 0x68, 0x14
+    0x9B496CE1, 0x811B, 0x11cf, { 0x8C, 0x77, 0x00, 0xAA, 0x00, 0x6B, 0x68, 0x14 }
 #endif
 
 static const KsPropertySetMapping known_property_sets[] = {
diff --git a/sys/winks/ksvideohelpers.c b/sys/winks/ksvideohelpers.c
index afa5e41..c4f9620 100644
--- a/sys/winks/ksvideohelpers.c
+++ b/sys/winks/ksvideohelpers.c
@@ -180,11 +180,12 @@
   }
 
   if (!structure) {
-    GST_DEBUG ("Unknown DirectShow Video GUID %08x-%04x-%04x-%04x-%08x%04x",
-        (guint) subtype_guid.Data1, (guint) subtype_guid.Data2,
-        (guint) subtype_guid.Data3,
-        (guint) subtype_guid.Data4, (guint) & subtype_guid.Data4[2],
-        (guint) & subtype_guid.Data4[6]);
+    GST_DEBUG ("Unknown DirectShow Video GUID "
+        "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+        subtype_guid.Data1, subtype_guid.Data2, subtype_guid.Data3,
+        subtype_guid.Data4[0], subtype_guid.Data4[1], subtype_guid.Data4[2],
+        subtype_guid.Data4[3], subtype_guid.Data4[4], subtype_guid.Data4[5],
+        subtype_guid.Data4[6], subtype_guid.Data4[7]);
   }
 
   return structure;
diff --git a/sys/winscreencap/Makefile.in b/sys/winscreencap/Makefile.in
index f5ba03c..886e835 100644
--- a/sys/winscreencap/Makefile.in
+++ b/sys/winscreencap/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -248,8 +248,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -288,7 +292,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -296,6 +299,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -345,8 +350,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -425,7 +428,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -434,7 +436,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -447,7 +448,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -472,6 +472,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -545,10 +547,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -574,6 +580,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -610,6 +619,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -650,17 +660,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -677,6 +686,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/Makefile.in b/tests/Makefile.in
index c3e2b3f..c826dff 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -217,8 +217,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -257,7 +261,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -265,6 +268,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -314,8 +319,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -394,7 +397,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -403,7 +405,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -416,7 +417,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -441,6 +441,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -514,10 +516,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -543,6 +549,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -579,6 +588,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -619,17 +629,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -646,6 +655,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index 90677f7..4cf2dac 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -106,6 +106,12 @@
 check_schro=
 endif
 
+if USE_X265
+check_x265enc=elements/x265enc
+else
+check_x265enc=
+endif
+
 if USE_TIMIDITY
 check_timidity=elements/timidity
 else
@@ -136,6 +142,12 @@
 check_zbar =
 endif
 
+if USE_OPENCV
+check_opencv = elements/templatematch
+else
+check_opencv =
+endif
+
 if USE_OPUS
 check_opus = elements/opus
 else
@@ -148,6 +160,12 @@
 check_curl_sftp =
 endif
 
+if USE_HLS
+check_hlsdemux = elements/hlsdemux_m3u8
+else
+check_hlsdemux =
+endif
+
 if USE_CURL
 check_curl = elements/curlhttpsink \
 	elements/curlfilesink \
@@ -179,7 +197,9 @@
 if USE_GL
 check_gl=libs/gstglcontext \
     libs/gstglmemory \
-    libs/gstglupload
+    libs/gstglupload \
+    libs/gstglcolorconvert \
+    elements/glimagesink
 else
 check_gl=
 endif
@@ -187,8 +207,7 @@
 VALGRIND_TO_FIX = \
 	elements/mpeg2enc \
 	elements/mplex    \
-	elements/zbar     \
-	pipeline/colorspace
+	elements/zbar
 
 # valgrind testing
 VALGRIND_TESTS_DISABLE = \
@@ -196,9 +215,7 @@
 
 # these tests don't even pass
 # neon: too flaky (almost always fails 'the first time')
-# colorspace: bad memory accesses in orc code for odd width buffers - https://bugzilla.gnome.org/show_bug.cgi?id=663248
 noinst_PROGRAMS = \
-	pipelines/colorspace \
 	pipelines/streamheader \
 	$(check_neon)
 
@@ -214,12 +231,14 @@
 	$(check_ofa)        \
 	$(check_timidity)  \
 	$(check_kate)  \
+	$(check_opencv) \
 	$(check_opus)  \
 	$(check_curl) \
 	$(check_shm) \
 	elements/aiffparse \
 	elements/autoconvert \
 	elements/autovideoconvert \
+	elements/audiointerleave \
 	elements/audiomixer \
 	elements/asfmux \
 	elements/baseaudiovisualizer \
@@ -227,7 +246,7 @@
 	elements/dataurisrc \
 	elements/gdppay \
 	elements/gdpdepay \
- 	elements/compositor \
+	elements/compositor \
 	$(check_jifmux) \
 	elements/jpegparse \
 	elements/h263parse \
@@ -238,6 +257,7 @@
 	$(check_mpg123) \
 	elements/mxfdemux \
 	elements/mxfmux \
+	elements/rtponvif \
 	elements/id3mux \
 	pipelines/mxf \
 	$(check_mimic) \
@@ -249,11 +269,13 @@
 	$(check_uvch264) \
 	libs/vc1parser \
 	$(check_schro) \
+	$(check_x265enc) \
 	elements/viewfinderbin \
 	$(check_zbar) \
 	$(check_orc) \
 	libs/insertbin \
 	$(check_gl) \
+	$(check_hlsdemux) \
 	$(EXPERIMENTAL_CHECKS)
 
 noinst_HEADERS = elements/mxfdemux.h
@@ -266,7 +288,10 @@
 LDADD = $(GST_CHECK_LIBS)
 
 elements_audiomixer_LDADD = $(GST_BASE_LIBS) -lgstbase-@GST_API_VERSION@ $(LDADD)
-elements_audiomixer_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
+elements_audiomixer_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
+
+elements_audiointerleave_LDADD = $(GST_BASE_LIBS) -lgstbase-@GST_API_VERSION@ -lgstaudio-@GST_API_VERSION@ $(LDADD)
+elements_audiointerleave_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
 
 # parser unit test convenience lib
 noinst_LTLIBRARIES = libparser.la
@@ -411,11 +436,14 @@
 libs_insertbin_CFLAGS = \
 	$(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
 
+elements_rtponvif_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
+elements_rtponvif_LDADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -lgstrtp-$(GST_API_VERSION) $(LDADD)
 
 EXTRA_DIST = gst-plugins-bad.supp $(uvch264_dist_data)
 
 orc_bayer_CFLAGS = $(ORC_CFLAGS)
 orc_bayer_LDADD = $(ORC_LIBS) -lorc-test-0.4
+nodist_orc_bayer_SOURCES = orc/bayer.c
 
 orc/bayer.c: $(top_srcdir)/gst/bayer/gstbayerorc.orc
 	$(MKDIR_P) orc
@@ -423,6 +451,7 @@
 
 orc_audiomixer_CFLAGS = $(ORC_CFLAGS)
 orc_audiomixer_LDADD = $(ORC_LIBS) -lorc-test-0.4
+nodist_orc_audiomixer_SOURCES = orc/audiomixer.c
 
 orc/audiomixer.c: $(top_srcdir)/gst/audiomixer/gstaudiomixerorc.orc
 	$(MKDIR_P) orc
@@ -457,6 +486,26 @@
 	$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
 	$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
 
+libs_gstglcolorconvert_CFLAGS = \
+	$(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+	-DGST_USE_UNSTABLE_API \
+	$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
+
+libs_gstglcolorconvert_LDADD = \
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
+	$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
+
+elements_glimagesink_CFLAGS = \
+	$(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+	-DGST_USE_UNSTABLE_API \
+	$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
+
+elements_glimagesink_LDADD = \
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
+	$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
+
 libs_aggregator_LDADD = \
 	$(top_builddir)/gst-libs/gst/base/libgstbadbase-@GST_API_VERSION@.la \
 	$(GST_PLUGINS_BASE_LIBS) \
@@ -470,6 +519,10 @@
 elements_compositor_LDADD = $(LDADD)  $(GST_BASE_LIBS)
 elements_compositor_CFLAGS = $(GST_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
 
+elements_hlsdemux_m3u8_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS) -I$(top_srcdir)/ext/hls
+elements_hlsdemux_m3u8_LDADD = $(GST_BASE_LIBS) $(LDADD)
+elements_hlsdemux_m3u8_SOURCES = elements/hlsdemux_m3u8.c
+
 orc_compositor_CFLAGS = $(ORC_CFLAGS)
 orc_compositor_LDADD = $(ORC_LIBS) -lorc-test-0.4
 nodist_orc_compositor_SOURCES = orc/compositor.c
diff --git a/tests/check/Makefile.in b/tests/check/Makefile.in
index 9b01a10..730acfb 100644
--- a/tests/check/Makefile.in
+++ b/tests/check/Makefile.in
@@ -84,32 +84,34 @@
 DIST_COMMON = $(top_srcdir)/common/check.mak $(srcdir)/Makefile.in \
 	$(srcdir)/Makefile.am $(top_srcdir)/depcomp $(noinst_HEADERS) \
 	$(top_srcdir)/test-driver
-noinst_PROGRAMS = pipelines/colorspace$(EXEEXT) \
-	pipelines/streamheader$(EXEEXT) $(am__EXEEXT_23)
+noinst_PROGRAMS = pipelines/streamheader$(EXEEXT) $(am__EXEEXT_26)
 check_PROGRAMS = generic/states$(EXEEXT) $(am__EXEEXT_1) \
 	$(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \
 	$(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
 	$(am__EXEEXT_8) $(am__EXEEXT_9) $(am__EXEEXT_10) \
-	$(am__EXEEXT_11) $(am__EXEEXT_13) $(am__EXEEXT_14) \
-	elements/aiffparse$(EXEEXT) elements/autoconvert$(EXEEXT) \
+	$(am__EXEEXT_11) $(am__EXEEXT_12) $(am__EXEEXT_14) \
+	$(am__EXEEXT_15) elements/aiffparse$(EXEEXT) \
+	elements/autoconvert$(EXEEXT) \
 	elements/autovideoconvert$(EXEEXT) \
-	elements/audiomixer$(EXEEXT) elements/asfmux$(EXEEXT) \
-	elements/baseaudiovisualizer$(EXEEXT) \
+	elements/audiointerleave$(EXEEXT) elements/audiomixer$(EXEEXT) \
+	elements/asfmux$(EXEEXT) elements/baseaudiovisualizer$(EXEEXT) \
 	elements/camerabin$(EXEEXT) elements/dataurisrc$(EXEEXT) \
 	elements/gdppay$(EXEEXT) elements/gdpdepay$(EXEEXT) \
-	elements/compositor$(EXEEXT) $(am__EXEEXT_15) \
+	elements/compositor$(EXEEXT) $(am__EXEEXT_16) \
 	elements/jpegparse$(EXEEXT) elements/h263parse$(EXEEXT) \
 	elements/h264parse$(EXEEXT) elements/mpegtsmux$(EXEEXT) \
 	elements/mpegvideoparse$(EXEEXT) \
-	elements/mpeg4videoparse$(EXEEXT) $(am__EXEEXT_16) \
+	elements/mpeg4videoparse$(EXEEXT) $(am__EXEEXT_17) \
 	elements/mxfdemux$(EXEEXT) elements/mxfmux$(EXEEXT) \
-	elements/id3mux$(EXEEXT) pipelines/mxf$(EXEEXT) \
-	$(am__EXEEXT_17) libs/mpegvideoparser$(EXEEXT) \
-	libs/mpegts$(EXEEXT) libs/h264parser$(EXEEXT) \
-	libs/vp8parser$(EXEEXT) libs/aggregator$(EXEEXT) \
-	$(am__EXEEXT_18) libs/vc1parser$(EXEEXT) $(am__EXEEXT_19) \
-	elements/viewfinderbin$(EXEEXT) $(am__EXEEXT_20) \
-	$(am__EXEEXT_21) libs/insertbin$(EXEEXT) $(am__EXEEXT_22)
+	elements/rtponvif$(EXEEXT) elements/id3mux$(EXEEXT) \
+	pipelines/mxf$(EXEEXT) $(am__EXEEXT_18) \
+	libs/mpegvideoparser$(EXEEXT) libs/mpegts$(EXEEXT) \
+	libs/h264parser$(EXEEXT) libs/vp8parser$(EXEEXT) \
+	libs/aggregator$(EXEEXT) $(am__EXEEXT_19) \
+	libs/vc1parser$(EXEEXT) $(am__EXEEXT_20) $(am__EXEEXT_21) \
+	elements/viewfinderbin$(EXEEXT) $(am__EXEEXT_22) \
+	$(am__EXEEXT_23) libs/insertbin$(EXEEXT) $(am__EXEEXT_24) \
+	$(am__EXEEXT_25)
 subdir = tests/check
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
@@ -118,6 +120,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -131,7 +134,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -174,25 +176,30 @@
 @USE_OFA_TRUE@am__EXEEXT_8 = elements/ofa$(EXEEXT)
 @USE_TIMIDITY_TRUE@am__EXEEXT_9 = elements/timidity$(EXEEXT)
 @USE_KATE_TRUE@am__EXEEXT_10 = elements/kate$(EXEEXT)
-@USE_OPUS_TRUE@am__EXEEXT_11 = elements/opus$(EXEEXT)
-@USE_SSH2_TRUE@am__EXEEXT_12 = elements/curlsftpsink$(EXEEXT)
-@USE_CURL_TRUE@am__EXEEXT_13 = elements/curlhttpsink$(EXEEXT) \
+@USE_OPENCV_TRUE@am__EXEEXT_11 = elements/templatematch$(EXEEXT)
+@USE_OPUS_TRUE@am__EXEEXT_12 = elements/opus$(EXEEXT)
+@USE_SSH2_TRUE@am__EXEEXT_13 = elements/curlsftpsink$(EXEEXT)
+@USE_CURL_TRUE@am__EXEEXT_14 = elements/curlhttpsink$(EXEEXT) \
 @USE_CURL_TRUE@	elements/curlfilesink$(EXEEXT) \
-@USE_CURL_TRUE@	elements/curlftpsink$(EXEEXT) $(am__EXEEXT_12) \
+@USE_CURL_TRUE@	elements/curlftpsink$(EXEEXT) $(am__EXEEXT_13) \
 @USE_CURL_TRUE@	elements/curlsmtpsink$(EXEEXT)
-@USE_SHM_TRUE@am__EXEEXT_14 = elements/shm$(EXEEXT)
-@USE_EXIF_TRUE@am__EXEEXT_15 = elements/jifmux$(EXEEXT)
-@USE_MPG123_TRUE@am__EXEEXT_16 = elements/mpg123audiodec$(EXEEXT)
-@USE_MIMIC_TRUE@am__EXEEXT_17 = pipelines/mimic$(EXEEXT)
-@USE_UVCH264_TRUE@am__EXEEXT_18 = elements/uvch264demux$(EXEEXT)
-@USE_SCHRO_TRUE@am__EXEEXT_19 = elements/schroenc$(EXEEXT)
-@USE_ZBAR_TRUE@am__EXEEXT_20 = elements/zbar$(EXEEXT)
-@HAVE_ORC_TRUE@am__EXEEXT_21 = orc/bayer$(EXEEXT) \
+@USE_SHM_TRUE@am__EXEEXT_15 = elements/shm$(EXEEXT)
+@USE_EXIF_TRUE@am__EXEEXT_16 = elements/jifmux$(EXEEXT)
+@USE_MPG123_TRUE@am__EXEEXT_17 = elements/mpg123audiodec$(EXEEXT)
+@USE_MIMIC_TRUE@am__EXEEXT_18 = pipelines/mimic$(EXEEXT)
+@USE_UVCH264_TRUE@am__EXEEXT_19 = elements/uvch264demux$(EXEEXT)
+@USE_SCHRO_TRUE@am__EXEEXT_20 = elements/schroenc$(EXEEXT)
+@USE_X265_TRUE@am__EXEEXT_21 = elements/x265enc$(EXEEXT)
+@USE_ZBAR_TRUE@am__EXEEXT_22 = elements/zbar$(EXEEXT)
+@HAVE_ORC_TRUE@am__EXEEXT_23 = orc/bayer$(EXEEXT) \
 @HAVE_ORC_TRUE@	orc/audiomixer$(EXEEXT) orc/compositor$(EXEEXT)
-@USE_GL_TRUE@am__EXEEXT_22 = libs/gstglcontext$(EXEEXT) \
+@USE_GL_TRUE@am__EXEEXT_24 = libs/gstglcontext$(EXEEXT) \
 @USE_GL_TRUE@	libs/gstglmemory$(EXEEXT) \
-@USE_GL_TRUE@	libs/gstglupload$(EXEEXT)
-@USE_NEON_TRUE@am__EXEEXT_23 = elements/neonhttpsrc$(EXEEXT)
+@USE_GL_TRUE@	libs/gstglupload$(EXEEXT) \
+@USE_GL_TRUE@	libs/gstglcolorconvert$(EXEEXT) \
+@USE_GL_TRUE@	elements/glimagesink$(EXEEXT)
+@USE_HLS_TRUE@am__EXEEXT_25 = elements/hlsdemux_m3u8$(EXEEXT)
+@USE_NEON_TRUE@am__EXEEXT_26 = elements/neonhttpsrc$(EXEEXT)
 PROGRAMS = $(noinst_PROGRAMS)
 elements_aiffparse_SOURCES = elements/aiffparse.c
 elements_aiffparse_OBJECTS = elements/aiffparse.$(OBJEXT)
@@ -213,6 +220,15 @@
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(elements_assrender_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
+elements_audiointerleave_SOURCES = elements/audiointerleave.c
+elements_audiointerleave_OBJECTS =  \
+	elements/elements_audiointerleave-audiointerleave.$(OBJEXT)
+elements_audiointerleave_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+elements_audiointerleave_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(elements_audiointerleave_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 elements_audiomixer_SOURCES = elements/audiomixer.c
 elements_audiomixer_OBJECTS =  \
 	elements/elements_audiomixer-audiomixer.$(OBJEXT)
@@ -318,12 +334,32 @@
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(elements_gdppay_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
+elements_glimagesink_SOURCES = elements/glimagesink.c
+elements_glimagesink_OBJECTS =  \
+	elements/elements_glimagesink-glimagesink.$(OBJEXT)
+elements_glimagesink_DEPENDENCIES =  \
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+elements_glimagesink_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(elements_glimagesink_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 elements_h263parse_SOURCES = elements/h263parse.c
 elements_h263parse_OBJECTS = elements/h263parse.$(OBJEXT)
 elements_h263parse_DEPENDENCIES = libparser.la $(am__DEPENDENCIES_2)
 elements_h264parse_SOURCES = elements/h264parse.c
 elements_h264parse_OBJECTS = elements/h264parse.$(OBJEXT)
 elements_h264parse_DEPENDENCIES = libparser.la $(am__DEPENDENCIES_2)
+am_elements_hlsdemux_m3u8_OBJECTS =  \
+	elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.$(OBJEXT)
+elements_hlsdemux_m3u8_OBJECTS = $(am_elements_hlsdemux_m3u8_OBJECTS)
+elements_hlsdemux_m3u8_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+elements_hlsdemux_m3u8_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(elements_hlsdemux_m3u8_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 elements_id3mux_SOURCES = elements/id3mux.c
 elements_id3mux_OBJECTS = elements/id3mux.$(OBJEXT)
 elements_id3mux_LDADD = $(LDADD)
@@ -404,6 +440,16 @@
 elements_opus_OBJECTS = elements/opus.$(OBJEXT)
 elements_opus_LDADD = $(LDADD)
 elements_opus_DEPENDENCIES = $(am__DEPENDENCIES_1)
+elements_rtponvif_SOURCES = elements/rtponvif.c
+elements_rtponvif_OBJECTS =  \
+	elements/elements_rtponvif-rtponvif.$(OBJEXT)
+elements_rtponvif_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_2)
+elements_rtponvif_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(elements_rtponvif_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+	-o $@
 elements_schroenc_SOURCES = elements/schroenc.c
 elements_schroenc_OBJECTS = elements/schroenc.$(OBJEXT)
 elements_schroenc_LDADD = $(LDADD)
@@ -412,6 +458,10 @@
 elements_shm_OBJECTS = elements/shm.$(OBJEXT)
 elements_shm_LDADD = $(LDADD)
 elements_shm_DEPENDENCIES = $(am__DEPENDENCIES_1)
+elements_templatematch_SOURCES = elements/templatematch.c
+elements_templatematch_OBJECTS = elements/templatematch.$(OBJEXT)
+elements_templatematch_LDADD = $(LDADD)
+elements_templatematch_DEPENDENCIES = $(am__DEPENDENCIES_1)
 elements_timidity_SOURCES = elements/timidity.c
 elements_timidity_OBJECTS =  \
 	elements/elements_timidity-timidity.$(OBJEXT)
@@ -448,6 +498,10 @@
 elements_voamrwbenc_OBJECTS = elements/voamrwbenc.$(OBJEXT)
 elements_voamrwbenc_LDADD = $(LDADD)
 elements_voamrwbenc_DEPENDENCIES = $(am__DEPENDENCIES_1)
+elements_x265enc_SOURCES = elements/x265enc.c
+elements_x265enc_OBJECTS = elements/x265enc.$(OBJEXT)
+elements_x265enc_LDADD = $(LDADD)
+elements_x265enc_DEPENDENCIES = $(am__DEPENDENCIES_1)
 elements_zbar_SOURCES = elements/zbar.c
 elements_zbar_OBJECTS = elements/zbar.$(OBJEXT)
 elements_zbar_LDADD = $(LDADD)
@@ -465,6 +519,17 @@
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(libs_aggregator_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
+libs_gstglcolorconvert_SOURCES = libs/gstglcolorconvert.c
+libs_gstglcolorconvert_OBJECTS =  \
+	libs/libs_gstglcolorconvert-gstglcolorconvert.$(OBJEXT)
+libs_gstglcolorconvert_DEPENDENCIES =  \
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+libs_gstglcolorconvert_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+	$(libs_gstglcolorconvert_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
 libs_gstglcontext_SOURCES = libs/gstglcontext.c
 libs_gstglcontext_OBJECTS =  \
 	libs/libs_gstglcontext-gstglcontext.$(OBJEXT)
@@ -552,15 +617,16 @@
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(libs_vp8parser_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
 	$@
-orc_audiomixer_SOURCES = orc/audiomixer.c
-orc_audiomixer_OBJECTS = orc/orc_audiomixer-audiomixer.$(OBJEXT)
+nodist_orc_audiomixer_OBJECTS =  \
+	orc/orc_audiomixer-audiomixer.$(OBJEXT)
+orc_audiomixer_OBJECTS = $(nodist_orc_audiomixer_OBJECTS)
 orc_audiomixer_DEPENDENCIES = $(am__DEPENDENCIES_1)
 orc_audiomixer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(orc_audiomixer_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
 	$@
-orc_bayer_SOURCES = orc/bayer.c
-orc_bayer_OBJECTS = orc/orc_bayer-bayer.$(OBJEXT)
+nodist_orc_bayer_OBJECTS = orc/orc_bayer-bayer.$(OBJEXT)
+orc_bayer_OBJECTS = $(nodist_orc_bayer_OBJECTS)
 orc_bayer_DEPENDENCIES = $(am__DEPENDENCIES_1)
 orc_bayer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(orc_bayer_CFLAGS) \
@@ -573,10 +639,6 @@
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
 	$(orc_compositor_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
 	$@
-pipelines_colorspace_SOURCES = pipelines/colorspace.c
-pipelines_colorspace_OBJECTS = pipelines/colorspace.$(OBJEXT)
-pipelines_colorspace_LDADD = $(LDADD)
-pipelines_colorspace_DEPENDENCIES = $(am__DEPENDENCIES_1)
 pipelines_mimic_SOURCES = pipelines/mimic.c
 pipelines_mimic_OBJECTS = pipelines/mimic.$(OBJEXT)
 pipelines_mimic_LDADD = $(LDADD)
@@ -629,7 +691,8 @@
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
 SOURCES = $(libparser_la_SOURCES) elements/aiffparse.c \
-	elements/asfmux.c elements/assrender.c elements/audiomixer.c \
+	elements/asfmux.c elements/assrender.c \
+	elements/audiointerleave.c elements/audiomixer.c \
 	elements/autoconvert.c elements/autovideoconvert.c \
 	$(elements_baseaudiovisualizer_SOURCES) \
 	$(elements_camerabin_SOURCES) elements/compositor.c \
@@ -637,24 +700,29 @@
 	elements/curlhttpsink.c elements/curlsftpsink.c \
 	elements/curlsmtpsink.c elements/dataurisrc.c elements/faac.c \
 	elements/faad.c elements/gdpdepay.c elements/gdppay.c \
-	elements/h263parse.c elements/h264parse.c elements/id3mux.c \
-	$(elements_jifmux_SOURCES) elements/jpegparse.c \
-	elements/kate.c elements/mpeg2enc.c elements/mpeg4videoparse.c \
-	elements/mpegtsmux.c elements/mpegvideoparse.c \
-	elements/mpg123audiodec.c elements/mplex.c elements/mxfdemux.c \
-	elements/mxfmux.c elements/neonhttpsrc.c elements/ofa.c \
-	elements/opus.c elements/schroenc.c elements/shm.c \
-	elements/timidity.c elements/uvch264demux.c \
-	elements/viewfinderbin.c elements/voaacenc.c \
-	elements/voamrwbenc.c elements/zbar.c generic/states.c \
-	libs/aggregator.c libs/gstglcontext.c libs/gstglmemory.c \
-	libs/gstglupload.c libs/h264parser.c libs/insertbin.c \
-	libs/mpegts.c libs/mpegvideoparser.c libs/vc1parser.c \
-	libs/vp8parser.c orc/audiomixer.c orc/bayer.c \
-	$(nodist_orc_compositor_SOURCES) pipelines/colorspace.c \
-	pipelines/mimic.c pipelines/mxf.c pipelines/streamheader.c
+	elements/glimagesink.c elements/h263parse.c \
+	elements/h264parse.c $(elements_hlsdemux_m3u8_SOURCES) \
+	elements/id3mux.c $(elements_jifmux_SOURCES) \
+	elements/jpegparse.c elements/kate.c elements/mpeg2enc.c \
+	elements/mpeg4videoparse.c elements/mpegtsmux.c \
+	elements/mpegvideoparse.c elements/mpg123audiodec.c \
+	elements/mplex.c elements/mxfdemux.c elements/mxfmux.c \
+	elements/neonhttpsrc.c elements/ofa.c elements/opus.c \
+	elements/rtponvif.c elements/schroenc.c elements/shm.c \
+	elements/templatematch.c elements/timidity.c \
+	elements/uvch264demux.c elements/viewfinderbin.c \
+	elements/voaacenc.c elements/voamrwbenc.c elements/x265enc.c \
+	elements/zbar.c generic/states.c libs/aggregator.c \
+	libs/gstglcolorconvert.c libs/gstglcontext.c \
+	libs/gstglmemory.c libs/gstglupload.c libs/h264parser.c \
+	libs/insertbin.c libs/mpegts.c libs/mpegvideoparser.c \
+	libs/vc1parser.c libs/vp8parser.c \
+	$(nodist_orc_audiomixer_SOURCES) $(nodist_orc_bayer_SOURCES) \
+	$(nodist_orc_compositor_SOURCES) pipelines/mimic.c \
+	pipelines/mxf.c pipelines/streamheader.c
 DIST_SOURCES = $(libparser_la_SOURCES) elements/aiffparse.c \
-	elements/asfmux.c elements/assrender.c elements/audiomixer.c \
+	elements/asfmux.c elements/assrender.c \
+	elements/audiointerleave.c elements/audiomixer.c \
 	elements/autoconvert.c elements/autovideoconvert.c \
 	$(elements_baseaudiovisualizer_SOURCES) \
 	$(elements_camerabin_SOURCES) elements/compositor.c \
@@ -662,22 +730,24 @@
 	elements/curlhttpsink.c elements/curlsftpsink.c \
 	elements/curlsmtpsink.c elements/dataurisrc.c elements/faac.c \
 	elements/faad.c elements/gdpdepay.c elements/gdppay.c \
-	elements/h263parse.c elements/h264parse.c elements/id3mux.c \
-	$(elements_jifmux_SOURCES) elements/jpegparse.c \
-	elements/kate.c elements/mpeg2enc.c elements/mpeg4videoparse.c \
-	elements/mpegtsmux.c elements/mpegvideoparse.c \
-	elements/mpg123audiodec.c elements/mplex.c elements/mxfdemux.c \
-	elements/mxfmux.c elements/neonhttpsrc.c elements/ofa.c \
-	elements/opus.c elements/schroenc.c elements/shm.c \
-	elements/timidity.c elements/uvch264demux.c \
-	elements/viewfinderbin.c elements/voaacenc.c \
-	elements/voamrwbenc.c elements/zbar.c generic/states.c \
-	libs/aggregator.c libs/gstglcontext.c libs/gstglmemory.c \
-	libs/gstglupload.c libs/h264parser.c libs/insertbin.c \
-	libs/mpegts.c libs/mpegvideoparser.c libs/vc1parser.c \
-	libs/vp8parser.c orc/audiomixer.c orc/bayer.c \
-	pipelines/colorspace.c pipelines/mimic.c pipelines/mxf.c \
-	pipelines/streamheader.c
+	elements/glimagesink.c elements/h263parse.c \
+	elements/h264parse.c $(elements_hlsdemux_m3u8_SOURCES) \
+	elements/id3mux.c $(elements_jifmux_SOURCES) \
+	elements/jpegparse.c elements/kate.c elements/mpeg2enc.c \
+	elements/mpeg4videoparse.c elements/mpegtsmux.c \
+	elements/mpegvideoparse.c elements/mpg123audiodec.c \
+	elements/mplex.c elements/mxfdemux.c elements/mxfmux.c \
+	elements/neonhttpsrc.c elements/ofa.c elements/opus.c \
+	elements/rtponvif.c elements/schroenc.c elements/shm.c \
+	elements/templatematch.c elements/timidity.c \
+	elements/uvch264demux.c elements/viewfinderbin.c \
+	elements/voaacenc.c elements/voamrwbenc.c elements/x265enc.c \
+	elements/zbar.c generic/states.c libs/aggregator.c \
+	libs/gstglcolorconvert.c libs/gstglcontext.c \
+	libs/gstglmemory.c libs/gstglupload.c libs/h264parser.c \
+	libs/insertbin.c libs/mpegts.c libs/mpegvideoparser.c \
+	libs/vc1parser.c libs/vp8parser.c pipelines/mimic.c \
+	pipelines/mxf.c pipelines/streamheader.c
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -924,8 +994,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -964,7 +1038,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -972,6 +1045,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -1021,8 +1096,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -1101,7 +1174,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -1110,7 +1182,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -1123,7 +1194,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -1148,6 +1218,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -1221,10 +1293,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -1250,6 +1326,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -1286,6 +1365,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -1326,17 +1406,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -1353,6 +1432,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -1454,6 +1534,8 @@
 @USE_OFA_TRUE@check_ofa = elements/ofa
 @USE_SCHRO_FALSE@check_schro = 
 @USE_SCHRO_TRUE@check_schro = elements/schroenc
+@USE_X265_FALSE@check_x265enc = 
+@USE_X265_TRUE@check_x265enc = elements/x265enc
 @USE_TIMIDITY_FALSE@check_timidity = 
 @USE_TIMIDITY_TRUE@check_timidity = elements/timidity
 @USE_KATE_FALSE@check_kate = 
@@ -1464,10 +1546,14 @@
 @HAVE_ORC_TRUE@check_orc = orc/bayer orc/audiomixer orc/compositor
 @USE_ZBAR_FALSE@check_zbar = 
 @USE_ZBAR_TRUE@check_zbar = elements/zbar
+@USE_OPENCV_FALSE@check_opencv = 
+@USE_OPENCV_TRUE@check_opencv = elements/templatematch
 @USE_OPUS_FALSE@check_opus = 
 @USE_OPUS_TRUE@check_opus = elements/opus
 @USE_SSH2_FALSE@check_curl_sftp = 
 @USE_SSH2_TRUE@check_curl_sftp = elements/curlsftpsink
+@USE_HLS_FALSE@check_hlsdemux = 
+@USE_HLS_TRUE@check_hlsdemux = elements/hlsdemux_m3u8
 @USE_CURL_FALSE@check_curl = 
 @USE_CURL_TRUE@check_curl = elements/curlhttpsink \
 @USE_CURL_TRUE@	elements/curlfilesink \
@@ -1489,13 +1575,14 @@
 @USE_GL_FALSE@check_gl = 
 @USE_GL_TRUE@check_gl = libs/gstglcontext \
 @USE_GL_TRUE@    libs/gstglmemory \
-@USE_GL_TRUE@    libs/gstglupload
+@USE_GL_TRUE@    libs/gstglupload \
+@USE_GL_TRUE@    libs/gstglcolorconvert \
+@USE_GL_TRUE@    elements/glimagesink
 
 VALGRIND_TO_FIX = \
 	elements/mpeg2enc \
 	elements/mplex    \
-	elements/zbar     \
-	pipeline/colorspace
+	elements/zbar
 
 
 # valgrind testing
@@ -1510,7 +1597,9 @@
 
 LDADD = $(GST_CHECK_LIBS)
 elements_audiomixer_LDADD = $(GST_BASE_LIBS) -lgstbase-@GST_API_VERSION@ $(LDADD)
-elements_audiomixer_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
+elements_audiomixer_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
+elements_audiointerleave_LDADD = $(GST_BASE_LIBS) -lgstbase-@GST_API_VERSION@ -lgstaudio-@GST_API_VERSION@ $(LDADD)
+elements_audiointerleave_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
 
 # parser unit test convenience lib
 noinst_LTLIBRARIES = libparser.la
@@ -1651,11 +1740,15 @@
 libs_insertbin_CFLAGS = \
 	$(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
 
+elements_rtponvif_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
+elements_rtponvif_LDADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -lgstrtp-$(GST_API_VERSION) $(LDADD)
 EXTRA_DIST = gst-plugins-bad.supp $(uvch264_dist_data)
 orc_bayer_CFLAGS = $(ORC_CFLAGS)
 orc_bayer_LDADD = $(ORC_LIBS) -lorc-test-0.4
+nodist_orc_bayer_SOURCES = orc/bayer.c
 orc_audiomixer_CFLAGS = $(ORC_CFLAGS)
 orc_audiomixer_LDADD = $(ORC_LIBS) -lorc-test-0.4
+nodist_orc_audiomixer_SOURCES = orc/audiomixer.c
 libs_gstglcontext_LDADD = \
 	$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
 	$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
@@ -1685,6 +1778,26 @@
 	$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
 	$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
 
+libs_gstglcolorconvert_CFLAGS = \
+	$(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+	-DGST_USE_UNSTABLE_API \
+	$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
+
+libs_gstglcolorconvert_LDADD = \
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
+	$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
+
+elements_glimagesink_CFLAGS = \
+	$(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
+	-DGST_USE_UNSTABLE_API \
+	$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
+
+elements_glimagesink_LDADD = \
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
+	$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
+	$(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
+
 libs_aggregator_LDADD = \
 	$(top_builddir)/gst-libs/gst/base/libgstbadbase-@GST_API_VERSION@.la \
 	$(GST_PLUGINS_BASE_LIBS) \
@@ -1697,6 +1810,9 @@
 
 elements_compositor_LDADD = $(LDADD)  $(GST_BASE_LIBS)
 elements_compositor_CFLAGS = $(GST_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
+elements_hlsdemux_m3u8_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS) -I$(top_srcdir)/ext/hls
+elements_hlsdemux_m3u8_LDADD = $(GST_BASE_LIBS) $(LDADD)
+elements_hlsdemux_m3u8_SOURCES = elements/hlsdemux_m3u8.c
 orc_compositor_CFLAGS = $(ORC_CFLAGS)
 orc_compositor_LDADD = $(ORC_LIBS) -lorc-test-0.4
 nodist_orc_compositor_SOURCES = orc/compositor.c
@@ -1794,6 +1910,12 @@
 elements/assrender$(EXEEXT): $(elements_assrender_OBJECTS) $(elements_assrender_DEPENDENCIES) $(EXTRA_elements_assrender_DEPENDENCIES) elements/$(am__dirstamp)
 	@rm -f elements/assrender$(EXEEXT)
 	$(AM_V_CCLD)$(elements_assrender_LINK) $(elements_assrender_OBJECTS) $(elements_assrender_LDADD) $(LIBS)
+elements/elements_audiointerleave-audiointerleave.$(OBJEXT):  \
+	elements/$(am__dirstamp) elements/$(DEPDIR)/$(am__dirstamp)
+
+elements/audiointerleave$(EXEEXT): $(elements_audiointerleave_OBJECTS) $(elements_audiointerleave_DEPENDENCIES) $(EXTRA_elements_audiointerleave_DEPENDENCIES) elements/$(am__dirstamp)
+	@rm -f elements/audiointerleave$(EXEEXT)
+	$(AM_V_CCLD)$(elements_audiointerleave_LINK) $(elements_audiointerleave_OBJECTS) $(elements_audiointerleave_LDADD) $(LIBS)
 elements/elements_audiomixer-audiomixer.$(OBJEXT):  \
 	elements/$(am__dirstamp) elements/$(DEPDIR)/$(am__dirstamp)
 
@@ -1890,6 +2012,12 @@
 elements/gdppay$(EXEEXT): $(elements_gdppay_OBJECTS) $(elements_gdppay_DEPENDENCIES) $(EXTRA_elements_gdppay_DEPENDENCIES) elements/$(am__dirstamp)
 	@rm -f elements/gdppay$(EXEEXT)
 	$(AM_V_CCLD)$(elements_gdppay_LINK) $(elements_gdppay_OBJECTS) $(elements_gdppay_LDADD) $(LIBS)
+elements/elements_glimagesink-glimagesink.$(OBJEXT):  \
+	elements/$(am__dirstamp) elements/$(DEPDIR)/$(am__dirstamp)
+
+elements/glimagesink$(EXEEXT): $(elements_glimagesink_OBJECTS) $(elements_glimagesink_DEPENDENCIES) $(EXTRA_elements_glimagesink_DEPENDENCIES) elements/$(am__dirstamp)
+	@rm -f elements/glimagesink$(EXEEXT)
+	$(AM_V_CCLD)$(elements_glimagesink_LINK) $(elements_glimagesink_OBJECTS) $(elements_glimagesink_LDADD) $(LIBS)
 elements/h263parse.$(OBJEXT): elements/$(am__dirstamp) \
 	elements/$(DEPDIR)/$(am__dirstamp)
 
@@ -1902,6 +2030,12 @@
 elements/h264parse$(EXEEXT): $(elements_h264parse_OBJECTS) $(elements_h264parse_DEPENDENCIES) $(EXTRA_elements_h264parse_DEPENDENCIES) elements/$(am__dirstamp)
 	@rm -f elements/h264parse$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(elements_h264parse_OBJECTS) $(elements_h264parse_LDADD) $(LIBS)
+elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.$(OBJEXT):  \
+	elements/$(am__dirstamp) elements/$(DEPDIR)/$(am__dirstamp)
+
+elements/hlsdemux_m3u8$(EXEEXT): $(elements_hlsdemux_m3u8_OBJECTS) $(elements_hlsdemux_m3u8_DEPENDENCIES) $(EXTRA_elements_hlsdemux_m3u8_DEPENDENCIES) elements/$(am__dirstamp)
+	@rm -f elements/hlsdemux_m3u8$(EXEEXT)
+	$(AM_V_CCLD)$(elements_hlsdemux_m3u8_LINK) $(elements_hlsdemux_m3u8_OBJECTS) $(elements_hlsdemux_m3u8_LDADD) $(LIBS)
 elements/id3mux.$(OBJEXT): elements/$(am__dirstamp) \
 	elements/$(DEPDIR)/$(am__dirstamp)
 
@@ -1992,6 +2126,12 @@
 elements/opus$(EXEEXT): $(elements_opus_OBJECTS) $(elements_opus_DEPENDENCIES) $(EXTRA_elements_opus_DEPENDENCIES) elements/$(am__dirstamp)
 	@rm -f elements/opus$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(elements_opus_OBJECTS) $(elements_opus_LDADD) $(LIBS)
+elements/elements_rtponvif-rtponvif.$(OBJEXT):  \
+	elements/$(am__dirstamp) elements/$(DEPDIR)/$(am__dirstamp)
+
+elements/rtponvif$(EXEEXT): $(elements_rtponvif_OBJECTS) $(elements_rtponvif_DEPENDENCIES) $(EXTRA_elements_rtponvif_DEPENDENCIES) elements/$(am__dirstamp)
+	@rm -f elements/rtponvif$(EXEEXT)
+	$(AM_V_CCLD)$(elements_rtponvif_LINK) $(elements_rtponvif_OBJECTS) $(elements_rtponvif_LDADD) $(LIBS)
 elements/schroenc.$(OBJEXT): elements/$(am__dirstamp) \
 	elements/$(DEPDIR)/$(am__dirstamp)
 
@@ -2004,6 +2144,12 @@
 elements/shm$(EXEEXT): $(elements_shm_OBJECTS) $(elements_shm_DEPENDENCIES) $(EXTRA_elements_shm_DEPENDENCIES) elements/$(am__dirstamp)
 	@rm -f elements/shm$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(elements_shm_OBJECTS) $(elements_shm_LDADD) $(LIBS)
+elements/templatematch.$(OBJEXT): elements/$(am__dirstamp) \
+	elements/$(DEPDIR)/$(am__dirstamp)
+
+elements/templatematch$(EXEEXT): $(elements_templatematch_OBJECTS) $(elements_templatematch_DEPENDENCIES) $(EXTRA_elements_templatematch_DEPENDENCIES) elements/$(am__dirstamp)
+	@rm -f elements/templatematch$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(elements_templatematch_OBJECTS) $(elements_templatematch_LDADD) $(LIBS)
 elements/elements_timidity-timidity.$(OBJEXT):  \
 	elements/$(am__dirstamp) elements/$(DEPDIR)/$(am__dirstamp)
 
@@ -2034,6 +2180,12 @@
 elements/voamrwbenc$(EXEEXT): $(elements_voamrwbenc_OBJECTS) $(elements_voamrwbenc_DEPENDENCIES) $(EXTRA_elements_voamrwbenc_DEPENDENCIES) elements/$(am__dirstamp)
 	@rm -f elements/voamrwbenc$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(elements_voamrwbenc_OBJECTS) $(elements_voamrwbenc_LDADD) $(LIBS)
+elements/x265enc.$(OBJEXT): elements/$(am__dirstamp) \
+	elements/$(DEPDIR)/$(am__dirstamp)
+
+elements/x265enc$(EXEEXT): $(elements_x265enc_OBJECTS) $(elements_x265enc_DEPENDENCIES) $(EXTRA_elements_x265enc_DEPENDENCIES) elements/$(am__dirstamp)
+	@rm -f elements/x265enc$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(elements_x265enc_OBJECTS) $(elements_x265enc_LDADD) $(LIBS)
 elements/zbar.$(OBJEXT): elements/$(am__dirstamp) \
 	elements/$(DEPDIR)/$(am__dirstamp)
 
@@ -2064,6 +2216,12 @@
 libs/aggregator$(EXEEXT): $(libs_aggregator_OBJECTS) $(libs_aggregator_DEPENDENCIES) $(EXTRA_libs_aggregator_DEPENDENCIES) libs/$(am__dirstamp)
 	@rm -f libs/aggregator$(EXEEXT)
 	$(AM_V_CCLD)$(libs_aggregator_LINK) $(libs_aggregator_OBJECTS) $(libs_aggregator_LDADD) $(LIBS)
+libs/libs_gstglcolorconvert-gstglcolorconvert.$(OBJEXT):  \
+	libs/$(am__dirstamp) libs/$(DEPDIR)/$(am__dirstamp)
+
+libs/gstglcolorconvert$(EXEEXT): $(libs_gstglcolorconvert_OBJECTS) $(libs_gstglcolorconvert_DEPENDENCIES) $(EXTRA_libs_gstglcolorconvert_DEPENDENCIES) libs/$(am__dirstamp)
+	@rm -f libs/gstglcolorconvert$(EXEEXT)
+	$(AM_V_CCLD)$(libs_gstglcolorconvert_LINK) $(libs_gstglcolorconvert_OBJECTS) $(libs_gstglcolorconvert_LDADD) $(LIBS)
 libs/libs_gstglcontext-gstglcontext.$(OBJEXT): libs/$(am__dirstamp) \
 	libs/$(DEPDIR)/$(am__dirstamp)
 
@@ -2148,12 +2306,6 @@
 pipelines/$(DEPDIR)/$(am__dirstamp):
 	@$(MKDIR_P) pipelines/$(DEPDIR)
 	@: > pipelines/$(DEPDIR)/$(am__dirstamp)
-pipelines/colorspace.$(OBJEXT): pipelines/$(am__dirstamp) \
-	pipelines/$(DEPDIR)/$(am__dirstamp)
-
-pipelines/colorspace$(EXEEXT): $(pipelines_colorspace_OBJECTS) $(pipelines_colorspace_DEPENDENCIES) $(EXTRA_pipelines_colorspace_DEPENDENCIES) pipelines/$(am__dirstamp)
-	@rm -f pipelines/colorspace$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(pipelines_colorspace_OBJECTS) $(pipelines_colorspace_LDADD) $(LIBS)
 pipelines/mimic.$(OBJEXT): pipelines/$(am__dirstamp) \
 	pipelines/$(DEPDIR)/$(am__dirstamp)
 
@@ -2196,6 +2348,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/curlsmtpsink.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/dataurisrc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_assrender-assrender.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_audiointerleave-audiointerleave.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_audiomixer-audiomixer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_baseaudiovisualizer-baseaudiovisualizer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_camerabin-camerabin.Po@am__quote@
@@ -2204,10 +2357,13 @@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_faad-faad.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_gdpdepay-gdpdepay.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_gdppay-gdppay.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_glimagesink-glimagesink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_hlsdemux_m3u8-hlsdemux_m3u8.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_jifmux-jifmux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_kate-kate.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_mpegtsmux-mpegtsmux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_mpg123audiodec-mpg123audiodec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_rtponvif-rtponvif.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_timidity-timidity.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_uvch264demux-uvch264demux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/elements_voaacenc-voaacenc.Po@am__quote@
@@ -2227,11 +2383,14 @@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/opus.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/schroenc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/shm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/templatematch.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/viewfinderbin.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/voamrwbenc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/x265enc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@elements/$(DEPDIR)/zbar.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@generic/$(DEPDIR)/states.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libs/$(DEPDIR)/libs_aggregator-aggregator.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libs/$(DEPDIR)/libs_gstglcolorconvert-gstglcolorconvert.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libs/$(DEPDIR)/libs_gstglcontext-gstglcontext.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libs/$(DEPDIR)/libs_gstglmemory-gstglmemory.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libs/$(DEPDIR)/libs_gstglupload-gstglupload.Po@am__quote@
@@ -2244,7 +2403,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@orc/$(DEPDIR)/orc_audiomixer-audiomixer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@orc/$(DEPDIR)/orc_bayer-bayer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@orc/$(DEPDIR)/orc_compositor-compositor.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@pipelines/$(DEPDIR)/colorspace.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@pipelines/$(DEPDIR)/mimic.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@pipelines/$(DEPDIR)/mxf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@pipelines/$(DEPDIR)/pipelines_streamheader-streamheader.Po@am__quote@
@@ -2294,6 +2452,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_assrender_CFLAGS) $(CFLAGS) -c -o elements/elements_assrender-assrender.obj `if test -f 'elements/assrender.c'; then $(CYGPATH_W) 'elements/assrender.c'; else $(CYGPATH_W) '$(srcdir)/elements/assrender.c'; fi`
 
+elements/elements_audiointerleave-audiointerleave.o: elements/audiointerleave.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_audiointerleave_CFLAGS) $(CFLAGS) -MT elements/elements_audiointerleave-audiointerleave.o -MD -MP -MF elements/$(DEPDIR)/elements_audiointerleave-audiointerleave.Tpo -c -o elements/elements_audiointerleave-audiointerleave.o `test -f 'elements/audiointerleave.c' || echo '$(srcdir)/'`elements/audiointerleave.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_audiointerleave-audiointerleave.Tpo elements/$(DEPDIR)/elements_audiointerleave-audiointerleave.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/audiointerleave.c' object='elements/elements_audiointerleave-audiointerleave.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_audiointerleave_CFLAGS) $(CFLAGS) -c -o elements/elements_audiointerleave-audiointerleave.o `test -f 'elements/audiointerleave.c' || echo '$(srcdir)/'`elements/audiointerleave.c
+
+elements/elements_audiointerleave-audiointerleave.obj: elements/audiointerleave.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_audiointerleave_CFLAGS) $(CFLAGS) -MT elements/elements_audiointerleave-audiointerleave.obj -MD -MP -MF elements/$(DEPDIR)/elements_audiointerleave-audiointerleave.Tpo -c -o elements/elements_audiointerleave-audiointerleave.obj `if test -f 'elements/audiointerleave.c'; then $(CYGPATH_W) 'elements/audiointerleave.c'; else $(CYGPATH_W) '$(srcdir)/elements/audiointerleave.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_audiointerleave-audiointerleave.Tpo elements/$(DEPDIR)/elements_audiointerleave-audiointerleave.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/audiointerleave.c' object='elements/elements_audiointerleave-audiointerleave.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_audiointerleave_CFLAGS) $(CFLAGS) -c -o elements/elements_audiointerleave-audiointerleave.obj `if test -f 'elements/audiointerleave.c'; then $(CYGPATH_W) 'elements/audiointerleave.c'; else $(CYGPATH_W) '$(srcdir)/elements/audiointerleave.c'; fi`
+
 elements/elements_audiomixer-audiomixer.o: elements/audiomixer.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_audiomixer_CFLAGS) $(CFLAGS) -MT elements/elements_audiomixer-audiomixer.o -MD -MP -MF elements/$(DEPDIR)/elements_audiomixer-audiomixer.Tpo -c -o elements/elements_audiomixer-audiomixer.o `test -f 'elements/audiomixer.c' || echo '$(srcdir)/'`elements/audiomixer.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_audiomixer-audiomixer.Tpo elements/$(DEPDIR)/elements_audiomixer-audiomixer.Po
@@ -2406,6 +2578,34 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_gdppay_CFLAGS) $(CFLAGS) -c -o elements/elements_gdppay-gdppay.obj `if test -f 'elements/gdppay.c'; then $(CYGPATH_W) 'elements/gdppay.c'; else $(CYGPATH_W) '$(srcdir)/elements/gdppay.c'; fi`
 
+elements/elements_glimagesink-glimagesink.o: elements/glimagesink.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_glimagesink_CFLAGS) $(CFLAGS) -MT elements/elements_glimagesink-glimagesink.o -MD -MP -MF elements/$(DEPDIR)/elements_glimagesink-glimagesink.Tpo -c -o elements/elements_glimagesink-glimagesink.o `test -f 'elements/glimagesink.c' || echo '$(srcdir)/'`elements/glimagesink.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_glimagesink-glimagesink.Tpo elements/$(DEPDIR)/elements_glimagesink-glimagesink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/glimagesink.c' object='elements/elements_glimagesink-glimagesink.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_glimagesink_CFLAGS) $(CFLAGS) -c -o elements/elements_glimagesink-glimagesink.o `test -f 'elements/glimagesink.c' || echo '$(srcdir)/'`elements/glimagesink.c
+
+elements/elements_glimagesink-glimagesink.obj: elements/glimagesink.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_glimagesink_CFLAGS) $(CFLAGS) -MT elements/elements_glimagesink-glimagesink.obj -MD -MP -MF elements/$(DEPDIR)/elements_glimagesink-glimagesink.Tpo -c -o elements/elements_glimagesink-glimagesink.obj `if test -f 'elements/glimagesink.c'; then $(CYGPATH_W) 'elements/glimagesink.c'; else $(CYGPATH_W) '$(srcdir)/elements/glimagesink.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_glimagesink-glimagesink.Tpo elements/$(DEPDIR)/elements_glimagesink-glimagesink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/glimagesink.c' object='elements/elements_glimagesink-glimagesink.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_glimagesink_CFLAGS) $(CFLAGS) -c -o elements/elements_glimagesink-glimagesink.obj `if test -f 'elements/glimagesink.c'; then $(CYGPATH_W) 'elements/glimagesink.c'; else $(CYGPATH_W) '$(srcdir)/elements/glimagesink.c'; fi`
+
+elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.o: elements/hlsdemux_m3u8.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_hlsdemux_m3u8_CFLAGS) $(CFLAGS) -MT elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.o -MD -MP -MF elements/$(DEPDIR)/elements_hlsdemux_m3u8-hlsdemux_m3u8.Tpo -c -o elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.o `test -f 'elements/hlsdemux_m3u8.c' || echo '$(srcdir)/'`elements/hlsdemux_m3u8.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_hlsdemux_m3u8-hlsdemux_m3u8.Tpo elements/$(DEPDIR)/elements_hlsdemux_m3u8-hlsdemux_m3u8.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/hlsdemux_m3u8.c' object='elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_hlsdemux_m3u8_CFLAGS) $(CFLAGS) -c -o elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.o `test -f 'elements/hlsdemux_m3u8.c' || echo '$(srcdir)/'`elements/hlsdemux_m3u8.c
+
+elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.obj: elements/hlsdemux_m3u8.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_hlsdemux_m3u8_CFLAGS) $(CFLAGS) -MT elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.obj -MD -MP -MF elements/$(DEPDIR)/elements_hlsdemux_m3u8-hlsdemux_m3u8.Tpo -c -o elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.obj `if test -f 'elements/hlsdemux_m3u8.c'; then $(CYGPATH_W) 'elements/hlsdemux_m3u8.c'; else $(CYGPATH_W) '$(srcdir)/elements/hlsdemux_m3u8.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_hlsdemux_m3u8-hlsdemux_m3u8.Tpo elements/$(DEPDIR)/elements_hlsdemux_m3u8-hlsdemux_m3u8.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/hlsdemux_m3u8.c' object='elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_hlsdemux_m3u8_CFLAGS) $(CFLAGS) -c -o elements/elements_hlsdemux_m3u8-hlsdemux_m3u8.obj `if test -f 'elements/hlsdemux_m3u8.c'; then $(CYGPATH_W) 'elements/hlsdemux_m3u8.c'; else $(CYGPATH_W) '$(srcdir)/elements/hlsdemux_m3u8.c'; fi`
+
 elements/elements_jifmux-jifmux.o: elements/jifmux.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_jifmux_CFLAGS) $(CFLAGS) -MT elements/elements_jifmux-jifmux.o -MD -MP -MF elements/$(DEPDIR)/elements_jifmux-jifmux.Tpo -c -o elements/elements_jifmux-jifmux.o `test -f 'elements/jifmux.c' || echo '$(srcdir)/'`elements/jifmux.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_jifmux-jifmux.Tpo elements/$(DEPDIR)/elements_jifmux-jifmux.Po
@@ -2462,6 +2662,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_mpg123audiodec_CFLAGS) $(CFLAGS) -c -o elements/elements_mpg123audiodec-mpg123audiodec.obj `if test -f 'elements/mpg123audiodec.c'; then $(CYGPATH_W) 'elements/mpg123audiodec.c'; else $(CYGPATH_W) '$(srcdir)/elements/mpg123audiodec.c'; fi`
 
+elements/elements_rtponvif-rtponvif.o: elements/rtponvif.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_rtponvif_CFLAGS) $(CFLAGS) -MT elements/elements_rtponvif-rtponvif.o -MD -MP -MF elements/$(DEPDIR)/elements_rtponvif-rtponvif.Tpo -c -o elements/elements_rtponvif-rtponvif.o `test -f 'elements/rtponvif.c' || echo '$(srcdir)/'`elements/rtponvif.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_rtponvif-rtponvif.Tpo elements/$(DEPDIR)/elements_rtponvif-rtponvif.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/rtponvif.c' object='elements/elements_rtponvif-rtponvif.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_rtponvif_CFLAGS) $(CFLAGS) -c -o elements/elements_rtponvif-rtponvif.o `test -f 'elements/rtponvif.c' || echo '$(srcdir)/'`elements/rtponvif.c
+
+elements/elements_rtponvif-rtponvif.obj: elements/rtponvif.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_rtponvif_CFLAGS) $(CFLAGS) -MT elements/elements_rtponvif-rtponvif.obj -MD -MP -MF elements/$(DEPDIR)/elements_rtponvif-rtponvif.Tpo -c -o elements/elements_rtponvif-rtponvif.obj `if test -f 'elements/rtponvif.c'; then $(CYGPATH_W) 'elements/rtponvif.c'; else $(CYGPATH_W) '$(srcdir)/elements/rtponvif.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_rtponvif-rtponvif.Tpo elements/$(DEPDIR)/elements_rtponvif-rtponvif.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='elements/rtponvif.c' object='elements/elements_rtponvif-rtponvif.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_rtponvif_CFLAGS) $(CFLAGS) -c -o elements/elements_rtponvif-rtponvif.obj `if test -f 'elements/rtponvif.c'; then $(CYGPATH_W) 'elements/rtponvif.c'; else $(CYGPATH_W) '$(srcdir)/elements/rtponvif.c'; fi`
+
 elements/elements_timidity-timidity.o: elements/timidity.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(elements_timidity_CFLAGS) $(CFLAGS) -MT elements/elements_timidity-timidity.o -MD -MP -MF elements/$(DEPDIR)/elements_timidity-timidity.Tpo -c -o elements/elements_timidity-timidity.o `test -f 'elements/timidity.c' || echo '$(srcdir)/'`elements/timidity.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) elements/$(DEPDIR)/elements_timidity-timidity.Tpo elements/$(DEPDIR)/elements_timidity-timidity.Po
@@ -2518,6 +2732,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libs_aggregator_CFLAGS) $(CFLAGS) -c -o libs/libs_aggregator-aggregator.obj `if test -f 'libs/aggregator.c'; then $(CYGPATH_W) 'libs/aggregator.c'; else $(CYGPATH_W) '$(srcdir)/libs/aggregator.c'; fi`
 
+libs/libs_gstglcolorconvert-gstglcolorconvert.o: libs/gstglcolorconvert.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libs_gstglcolorconvert_CFLAGS) $(CFLAGS) -MT libs/libs_gstglcolorconvert-gstglcolorconvert.o -MD -MP -MF libs/$(DEPDIR)/libs_gstglcolorconvert-gstglcolorconvert.Tpo -c -o libs/libs_gstglcolorconvert-gstglcolorconvert.o `test -f 'libs/gstglcolorconvert.c' || echo '$(srcdir)/'`libs/gstglcolorconvert.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libs/$(DEPDIR)/libs_gstglcolorconvert-gstglcolorconvert.Tpo libs/$(DEPDIR)/libs_gstglcolorconvert-gstglcolorconvert.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libs/gstglcolorconvert.c' object='libs/libs_gstglcolorconvert-gstglcolorconvert.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libs_gstglcolorconvert_CFLAGS) $(CFLAGS) -c -o libs/libs_gstglcolorconvert-gstglcolorconvert.o `test -f 'libs/gstglcolorconvert.c' || echo '$(srcdir)/'`libs/gstglcolorconvert.c
+
+libs/libs_gstglcolorconvert-gstglcolorconvert.obj: libs/gstglcolorconvert.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libs_gstglcolorconvert_CFLAGS) $(CFLAGS) -MT libs/libs_gstglcolorconvert-gstglcolorconvert.obj -MD -MP -MF libs/$(DEPDIR)/libs_gstglcolorconvert-gstglcolorconvert.Tpo -c -o libs/libs_gstglcolorconvert-gstglcolorconvert.obj `if test -f 'libs/gstglcolorconvert.c'; then $(CYGPATH_W) 'libs/gstglcolorconvert.c'; else $(CYGPATH_W) '$(srcdir)/libs/gstglcolorconvert.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libs/$(DEPDIR)/libs_gstglcolorconvert-gstglcolorconvert.Tpo libs/$(DEPDIR)/libs_gstglcolorconvert-gstglcolorconvert.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libs/gstglcolorconvert.c' object='libs/libs_gstglcolorconvert-gstglcolorconvert.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libs_gstglcolorconvert_CFLAGS) $(CFLAGS) -c -o libs/libs_gstglcolorconvert-gstglcolorconvert.obj `if test -f 'libs/gstglcolorconvert.c'; then $(CYGPATH_W) 'libs/gstglcolorconvert.c'; else $(CYGPATH_W) '$(srcdir)/libs/gstglcolorconvert.c'; fi`
+
 libs/libs_gstglcontext-gstglcontext.o: libs/gstglcontext.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libs_gstglcontext_CFLAGS) $(CFLAGS) -MT libs/libs_gstglcontext-gstglcontext.o -MD -MP -MF libs/$(DEPDIR)/libs_gstglcontext-gstglcontext.Tpo -c -o libs/libs_gstglcontext-gstglcontext.o `test -f 'libs/gstglcontext.c' || echo '$(srcdir)/'`libs/gstglcontext.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libs/$(DEPDIR)/libs_gstglcontext-gstglcontext.Tpo libs/$(DEPDIR)/libs_gstglcontext-gstglcontext.Po
@@ -2981,6 +3209,13 @@
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/templatematch.log: elements/templatematch$(EXEEXT)
+	@p='elements/templatematch$(EXEEXT)'; \
+	b='elements/templatematch'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 elements/opus.log: elements/opus$(EXEEXT)
 	@p='elements/opus$(EXEEXT)'; \
 	b='elements/opus'; \
@@ -3051,6 +3286,13 @@
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/audiointerleave.log: elements/audiointerleave$(EXEEXT)
+	@p='elements/audiointerleave$(EXEEXT)'; \
+	b='elements/audiointerleave'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 elements/audiomixer.log: elements/audiomixer$(EXEEXT)
 	@p='elements/audiomixer$(EXEEXT)'; \
 	b='elements/audiomixer'; \
@@ -3177,6 +3419,13 @@
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/rtponvif.log: elements/rtponvif$(EXEEXT)
+	@p='elements/rtponvif$(EXEEXT)'; \
+	b='elements/rtponvif'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 elements/id3mux.log: elements/id3mux$(EXEEXT)
 	@p='elements/id3mux$(EXEEXT)'; \
 	b='elements/id3mux'; \
@@ -3254,6 +3503,13 @@
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/x265enc.log: elements/x265enc$(EXEEXT)
+	@p='elements/x265enc$(EXEEXT)'; \
+	b='elements/x265enc'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 elements/viewfinderbin.log: elements/viewfinderbin$(EXEEXT)
 	@p='elements/viewfinderbin$(EXEEXT)'; \
 	b='elements/viewfinderbin'; \
@@ -3317,6 +3573,27 @@
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+libs/gstglcolorconvert.log: libs/gstglcolorconvert$(EXEEXT)
+	@p='libs/gstglcolorconvert$(EXEEXT)'; \
+	b='libs/gstglcolorconvert'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/glimagesink.log: elements/glimagesink$(EXEEXT)
+	@p='elements/glimagesink$(EXEEXT)'; \
+	b='elements/glimagesink'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/hlsdemux_m3u8.log: elements/hlsdemux_m3u8$(EXEEXT)
+	@p='elements/hlsdemux_m3u8$(EXEEXT)'; \
+	b='elements/hlsdemux_m3u8'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 .test.log:
 	@p='$<'; \
 	$(am__set_b); \
@@ -3546,7 +3823,8 @@
 
 # valgrind any given test by running make test.valgrind
 %.valgrind: %
-	@$(TESTS_ENVIRONMENT)					\
+	@valgrind_log=$(subst /,-,$*-valgrind.log);		\
+	$(TESTS_ENVIRONMENT)					\
 	CK_DEFAULT_TIMEOUT=360					\
 	G_SLICE=always-malloc					\
 	$(LIBTOOL) --mode=execute				\
@@ -3555,12 +3833,12 @@
 	--tool=memcheck --leak-check=full --trace-children=yes	\
 	--show-possibly-lost=no                                 \
 	--leak-resolution=high --num-callers=20			\
-	./$* 2>&1 | tee valgrind.log
-	@if grep "==" valgrind.log > /dev/null 2>&1; then	\
-	    rm valgrind.log;					\
+	./$* 2>&1 | tee $$valgrind_log ;			\
+	if grep "==" $$valgrind_log > /dev/null 2>&1; then	\
+	    rm $$valgrind_log;					\
 	    exit 1;						\
-	fi
-	@rm valgrind.log
+	fi ;							\
+	rm $$valgrind_log
 
 # valgrind any given test and generate suppressions for it
 %.valgrind.gen-suppressions: %
@@ -3647,19 +3925,13 @@
 # valgrind all tests
 valgrind: $(TESTS)
 	@echo "Valgrinding tests ..."
-	@failed=0;							\
+	@failed=0; valgrind_targets="";					\
 	for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do	\
-		$(MAKE) $$t.valgrind;					\
-		if test "$$?" -ne 0; then                               \
-			echo "Valgrind error for test $$t";		\
-			failed=`expr $$failed + 1`;			\
-			whicht="$$whicht $$t";				\
-		fi;							\
+	  valgrind_targets="$$valgrind_targets $$t.valgrind";		\
 	done;								\
-	if test "$$failed" -ne 0; then					\
-		echo "$$failed tests had leaks or errors under valgrind:";	\
-		echo "$$whicht";					\
-		false;							\
+	if ! $(MAKE) $$valgrind_targets ; then				\
+	  echo "Some tests had leaks or errors under valgrind";		\
+	  false;							\
 	fi
 
 # valgrind all tests until failure
@@ -3709,6 +3981,9 @@
 	  do echo Inspecting $$e;					\
 	     $(GST_INSPECT) $$e > /dev/null 2>&1; done
 
+# build all tests
+build-checks: $(TESTS)
+
 help:
 	@echo
 	@echo "make check                         -- run all checks"
@@ -3731,6 +4006,7 @@
 	@echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
 	@echo "                                               and save to suppressions.log"
 	@echo "make inspect                       -- inspect all plugin features"
+	@echo "make build-checks                  -- build all checks (but don't run them)"
 	@echo
 	@echo
 	@echo "Additionally, you can use the GST_CHECKS environment variable to"
diff --git a/tests/check/elements/audiointerleave.c b/tests/check/elements/audiointerleave.c
new file mode 100644
index 0000000..83aaf0f
--- /dev/null
+++ b/tests/check/elements/audiointerleave.c
@@ -0,0 +1,870 @@
+/* GStreamer unit tests for the audiointerleave element
+ * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2008 Sebastian Dröge <slomo@circular-chaos.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_VALGRIND
+# include <valgrind/valgrind.h>
+#endif
+
+#include <gst/check/gstcheck.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/audio-enumtypes.h>
+
+static void
+gst_check_setup_events_audiointerleave (GstPad * srcpad, GstElement * element,
+    GstCaps * caps, GstFormat format, const gchar * stream_id)
+{
+  GstSegment segment;
+
+  gst_segment_init (&segment, format);
+
+  fail_unless (gst_pad_push_event (srcpad,
+          gst_event_new_stream_start (stream_id)));
+  if (caps)
+    fail_unless (gst_pad_push_event (srcpad, gst_event_new_caps (caps)));
+  fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&segment)));
+}
+
+GST_START_TEST (test_create_and_unref)
+{
+  GstElement *interleave;
+
+  interleave = gst_element_factory_make ("audiointerleave", NULL);
+  fail_unless (interleave != NULL);
+
+  gst_element_set_state (interleave, GST_STATE_NULL);
+  gst_object_unref (interleave);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_request_pads)
+{
+  GstElement *interleave;
+  GstPad *pad1, *pad2;
+
+  interleave = gst_element_factory_make ("audiointerleave", NULL);
+  fail_unless (interleave != NULL);
+
+  pad1 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (pad1 != NULL);
+  fail_unless_equals_string (GST_OBJECT_NAME (pad1), "sink_0");
+
+  pad2 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (pad2 != NULL);
+  fail_unless_equals_string (GST_OBJECT_NAME (pad2), "sink_1");
+
+  gst_element_release_request_pad (interleave, pad2);
+  gst_object_unref (pad2);
+  gst_element_release_request_pad (interleave, pad1);
+  gst_object_unref (pad1);
+
+  gst_element_set_state (interleave, GST_STATE_NULL);
+  gst_object_unref (interleave);
+}
+
+GST_END_TEST;
+
+static GstPad **mysrcpads, *mysinkpad;
+static GstBus *bus;
+static GstElement *interleave;
+static GMutex data_mutex;
+static GCond data_cond;
+static gint have_data;
+static gfloat input[2];
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string) " GST_AUDIO_NE (F32) ", "
+        "channels = (int) 2, layout = (string) {interleaved, non-interleaved}, rate = (int) 48000"));
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("audio/x-raw, "
+        "format = (string) " GST_AUDIO_NE (F32) ", "
+        "channels = (int) 1, layout = (string) interleaved, rate = (int) 48000"));
+
+#define CAPS_48khz \
+        "audio/x-raw, " \
+        "format = (string) " GST_AUDIO_NE (F32) ", " \
+        "channels = (int) 1, layout = (string) non-interleaved," \
+        "rate = (int) 48000"
+
+static GstFlowReturn
+interleave_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+{
+  GstMapInfo map;
+  gfloat *outdata;
+  gint i;
+
+  fail_unless (GST_IS_BUFFER (buffer));
+  fail_unless (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_GAP));
+  gst_buffer_map (buffer, &map, GST_MAP_READ);
+  outdata = (gfloat *) map.data;
+  fail_unless (outdata != NULL);
+
+#ifdef HAVE_VALGRIND
+  if (!(RUNNING_ON_VALGRIND))
+#endif
+    for (i = 0; i < map.size / sizeof (float); i += 2) {
+      fail_unless_equals_float (outdata[i], input[0]);
+      fail_unless_equals_float (outdata[i + 1], input[1]);
+    }
+
+  g_mutex_lock (&data_mutex);
+  have_data += map.size;
+  g_cond_signal (&data_cond);
+  g_mutex_unlock (&data_mutex);
+
+  gst_buffer_unmap (buffer, &map);
+  gst_buffer_unref (buffer);
+
+
+  return GST_FLOW_OK;
+}
+
+GST_START_TEST (test_audiointerleave_2ch)
+{
+  GstElement *queue;
+  GstPad *sink0, *sink1, *src, *tmp;
+  GstCaps *caps;
+  gint i;
+  GstBuffer *inbuf;
+  gfloat *indata;
+  GstMapInfo map;
+
+  mysrcpads = g_new0 (GstPad *, 2);
+
+  have_data = 0;
+
+  interleave = gst_element_factory_make ("audiointerleave", NULL);
+  fail_unless (interleave != NULL);
+
+  g_object_set (interleave, "latency", GST_SECOND / 4, NULL);
+
+  queue = gst_element_factory_make ("queue", "queue");
+  fail_unless (queue != NULL);
+
+  sink0 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sink0 != NULL);
+  fail_unless_equals_string (GST_OBJECT_NAME (sink0), "sink_0");
+
+  sink1 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sink1 != NULL);
+  fail_unless_equals_string (GST_OBJECT_NAME (sink1), "sink_1");
+
+  mysrcpads[0] = gst_pad_new_from_static_template (&srctemplate, "src0");
+  fail_unless (mysrcpads[0] != NULL);
+
+  caps = gst_caps_from_string (CAPS_48khz);
+  gst_pad_set_active (mysrcpads[0], TRUE);
+  gst_check_setup_events_audiointerleave (mysrcpads[0], interleave, caps,
+      GST_FORMAT_TIME, "0");
+  gst_pad_use_fixed_caps (mysrcpads[0]);
+
+  mysrcpads[1] = gst_pad_new_from_static_template (&srctemplate, "src1");
+  fail_unless (mysrcpads[1] != NULL);
+
+  gst_pad_set_active (mysrcpads[1], TRUE);
+  gst_check_setup_events_audiointerleave (mysrcpads[1], interleave, caps,
+      GST_FORMAT_TIME, "1");
+  gst_pad_use_fixed_caps (mysrcpads[1]);
+
+  tmp = gst_element_get_static_pad (queue, "sink");
+  fail_unless (gst_pad_link (mysrcpads[0], tmp) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  tmp = gst_element_get_static_pad (queue, "src");
+  fail_unless (gst_pad_link (tmp, sink0) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  fail_unless (gst_pad_link (mysrcpads[1], sink1) == GST_PAD_LINK_OK);
+
+  mysinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
+  fail_unless (mysinkpad != NULL);
+  gst_pad_set_chain_function (mysinkpad, interleave_chain_func);
+  gst_pad_set_active (mysinkpad, TRUE);
+
+  src = gst_element_get_static_pad (interleave, "src");
+  fail_unless (src != NULL);
+  fail_unless (gst_pad_link (src, mysinkpad) == GST_PAD_LINK_OK);
+  gst_object_unref (src);
+
+  bus = gst_bus_new ();
+  gst_element_set_bus (interleave, bus);
+
+  fail_unless (gst_element_set_state (interleave,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
+  fail_unless (gst_element_set_state (queue,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
+
+  input[0] = -1.0;
+  inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
+  //GST_BUFFER_PTS (inbuf) = 0;
+  gst_buffer_map (inbuf, &map, GST_MAP_WRITE);
+  indata = (gfloat *) map.data;
+  for (i = 0; i < 48000; i++)
+    indata[i] = -1.0;
+  gst_buffer_unmap (inbuf, &map);
+  fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
+
+  input[1] = 1.0;
+  inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
+  //GST_BUFFER_PTS (inbuf) = 0;
+  gst_buffer_map (inbuf, &map, GST_MAP_WRITE);
+  indata = (gfloat *) map.data;
+  for (i = 0; i < 48000; i++)
+    indata[i] = 1.0;
+  gst_buffer_unmap (inbuf, &map);
+  fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
+
+  inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
+  //GST_BUFFER_PTS (inbuf) = GST_SECOND;
+  gst_buffer_map (inbuf, &map, GST_MAP_WRITE);
+  indata = (gfloat *) map.data;
+  for (i = 0; i < 48000; i++)
+    indata[i] = -1.0;
+  gst_buffer_unmap (inbuf, &map);
+  fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
+
+  inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
+  //GST_BUFFER_PTS (inbuf) = GST_SECOND;
+  gst_buffer_map (inbuf, &map, GST_MAP_WRITE);
+  indata = (gfloat *) map.data;
+  for (i = 0; i < 48000; i++)
+    indata[i] = 1.0;
+  gst_buffer_unmap (inbuf, &map);
+  fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
+
+  g_mutex_lock (&data_mutex);
+  while (have_data < 48000 * 2 * 2 * sizeof (float))
+    g_cond_wait (&data_cond, &data_mutex);
+  g_mutex_unlock (&data_mutex);
+
+  gst_element_set_state (interleave, GST_STATE_NULL);
+  gst_element_set_state (queue, GST_STATE_NULL);
+
+  gst_object_unref (mysrcpads[0]);
+  gst_object_unref (mysrcpads[1]);
+  gst_object_unref (mysinkpad);
+
+  gst_element_release_request_pad (interleave, sink0);
+  gst_object_unref (sink0);
+  gst_element_release_request_pad (interleave, sink1);
+  gst_object_unref (sink1);
+
+  gst_object_unref (interleave);
+  gst_object_unref (queue);
+  gst_object_unref (bus);
+  gst_caps_unref (caps);
+
+  g_free (mysrcpads);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_audiointerleave_2ch_1eos)
+{
+  GstElement *queue;
+  GstPad *sink0, *sink1, *src, *tmp;
+  GstCaps *caps;
+  gint i;
+  GstBuffer *inbuf;
+  gfloat *indata;
+  GstMapInfo map;
+
+  mysrcpads = g_new0 (GstPad *, 2);
+
+  have_data = 0;
+
+  interleave = gst_element_factory_make ("audiointerleave", NULL);
+  fail_unless (interleave != NULL);
+
+  g_object_set (interleave, "latency", GST_SECOND / 4, NULL);
+
+  queue = gst_element_factory_make ("queue", "queue");
+  fail_unless (queue != NULL);
+
+  sink0 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sink0 != NULL);
+  fail_unless_equals_string (GST_OBJECT_NAME (sink0), "sink_0");
+
+  sink1 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sink1 != NULL);
+  fail_unless_equals_string (GST_OBJECT_NAME (sink1), "sink_1");
+
+  mysrcpads[0] = gst_pad_new_from_static_template (&srctemplate, "src0");
+  fail_unless (mysrcpads[0] != NULL);
+
+  caps = gst_caps_from_string (CAPS_48khz);
+  gst_pad_set_active (mysrcpads[0], TRUE);
+  gst_check_setup_events_audiointerleave (mysrcpads[0], interleave, caps,
+      GST_FORMAT_TIME, "0");
+  gst_pad_use_fixed_caps (mysrcpads[0]);
+
+  mysrcpads[1] = gst_pad_new_from_static_template (&srctemplate, "src1");
+  fail_unless (mysrcpads[1] != NULL);
+
+  gst_pad_set_active (mysrcpads[1], TRUE);
+  gst_check_setup_events_audiointerleave (mysrcpads[1], interleave, caps,
+      GST_FORMAT_TIME, "1");
+  gst_pad_use_fixed_caps (mysrcpads[1]);
+
+  tmp = gst_element_get_static_pad (queue, "sink");
+  fail_unless (gst_pad_link (mysrcpads[0], tmp) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  tmp = gst_element_get_static_pad (queue, "src");
+  fail_unless (gst_pad_link (tmp, sink0) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  fail_unless (gst_pad_link (mysrcpads[1], sink1) == GST_PAD_LINK_OK);
+
+  mysinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
+  fail_unless (mysinkpad != NULL);
+  gst_pad_set_chain_function (mysinkpad, interleave_chain_func);
+  gst_pad_set_active (mysinkpad, TRUE);
+
+  src = gst_element_get_static_pad (interleave, "src");
+  fail_unless (src != NULL);
+  fail_unless (gst_pad_link (src, mysinkpad) == GST_PAD_LINK_OK);
+  gst_object_unref (src);
+
+  bus = gst_bus_new ();
+  gst_element_set_bus (interleave, bus);
+
+  fail_unless (gst_element_set_state (interleave,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
+  fail_unless (gst_element_set_state (queue,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
+
+  input[0] = -1.0;
+  inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
+  GST_BUFFER_PTS (inbuf) = 0;
+  gst_buffer_map (inbuf, &map, GST_MAP_WRITE);
+  indata = (gfloat *) map.data;
+  for (i = 0; i < 48000; i++)
+    indata[i] = -1.0;
+  gst_buffer_unmap (inbuf, &map);
+  fail_unless (gst_pad_push (mysrcpads[0], inbuf) == GST_FLOW_OK);
+
+  input[1] = 1.0;
+  inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
+  GST_BUFFER_PTS (inbuf) = 0;
+  gst_buffer_map (inbuf, &map, GST_MAP_WRITE);
+  indata = (gfloat *) map.data;
+  for (i = 0; i < 48000; i++)
+    indata[i] = 1.0;
+  gst_buffer_unmap (inbuf, &map);
+  fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
+
+  g_mutex_lock (&data_mutex);
+  /* 48000 samples per buffer * 2 sources * 2 buffers */
+  while (have_data != 48000 * 2 * sizeof (float))
+    g_cond_wait (&data_cond, &data_mutex);
+  g_mutex_unlock (&data_mutex);
+
+  input[0] = 0.0;
+  gst_pad_push_event (mysrcpads[0], gst_event_new_eos ());
+
+  input[1] = 1.0;
+  inbuf = gst_buffer_new_and_alloc (48000 * sizeof (gfloat));
+  GST_BUFFER_PTS (inbuf) = GST_SECOND;
+  gst_buffer_map (inbuf, &map, GST_MAP_WRITE);
+  indata = (gfloat *) map.data;
+  for (i = 0; i < 48000; i++)
+    indata[i] = 1.0;
+  gst_buffer_unmap (inbuf, &map);
+  fail_unless (gst_pad_push (mysrcpads[1], inbuf) == GST_FLOW_OK);
+
+  g_mutex_lock (&data_mutex);
+  /* 48000 samples per buffer * 2 sources * 2 buffers */
+  while (have_data != 48000 * 2 * 2 * sizeof (float))
+    g_cond_wait (&data_cond, &data_mutex);
+  g_mutex_unlock (&data_mutex);
+
+  gst_element_set_state (interleave, GST_STATE_NULL);
+  gst_element_set_state (queue, GST_STATE_NULL);
+
+  gst_object_unref (mysrcpads[0]);
+  gst_object_unref (mysrcpads[1]);
+  gst_object_unref (mysinkpad);
+
+  gst_element_release_request_pad (interleave, sink0);
+  gst_object_unref (sink0);
+  gst_element_release_request_pad (interleave, sink1);
+  gst_object_unref (sink1);
+
+  gst_object_unref (interleave);
+  gst_object_unref (queue);
+  gst_object_unref (bus);
+  gst_caps_unref (caps);
+
+  g_free (mysrcpads);
+}
+
+GST_END_TEST;
+
+static void
+src_handoff_float32 (GstElement * element, GstBuffer * buffer, GstPad * pad,
+    gboolean interleaved, gpointer user_data)
+{
+  gint n = GPOINTER_TO_INT (user_data);
+  gfloat *data;
+  gint i;
+  gsize size;
+  GstCaps *caps;
+  guint64 mask;
+  GstAudioChannelPosition pos;
+
+  fail_unless (gst_buffer_is_writable (buffer));
+
+  switch (n) {
+    case 0:
+    case 1:
+    case 2:
+      pos = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
+      break;
+    case 3:
+      pos = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
+      break;
+    default:
+      pos = GST_AUDIO_CHANNEL_POSITION_INVALID;
+      break;
+  }
+
+  mask = G_GUINT64_CONSTANT (1) << pos;
+
+  caps = gst_caps_new_simple ("audio/x-raw",
+      "format", G_TYPE_STRING, GST_AUDIO_NE (F32),
+      "channels", G_TYPE_INT, 1,
+      "layout", G_TYPE_STRING, interleaved ? "interleaved" : "non-interleaved",
+      "channel-mask", GST_TYPE_BITMASK, mask, "rate", G_TYPE_INT, 48000, NULL);
+
+  gst_pad_set_caps (pad, caps);
+  gst_caps_unref (caps);
+
+  size = 48000 * sizeof (gfloat);
+  data = g_malloc (size);
+  for (i = 0; i < 48000; i++)
+    data[i] = (n % 2 == 0) ? -1.0 : 1.0;
+
+  gst_buffer_append_memory (buffer, gst_memory_new_wrapped (0, data,
+          size, 0, size, data, g_free));
+
+  GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
+  GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
+  GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
+  GST_BUFFER_DURATION (buffer) = GST_SECOND;
+}
+
+static void
+src_handoff_float32_audiointerleaved (GstElement * element, GstBuffer * buffer,
+    GstPad * pad, gpointer user_data)
+{
+  src_handoff_float32 (element, buffer, pad, TRUE, user_data);
+}
+
+static void
+src_handoff_float32_non_audiointerleaved (GstElement * element, GstBuffer * buffer,
+    GstPad * pad, gpointer user_data)
+{
+  src_handoff_float32 (element, buffer, pad, FALSE, user_data);
+}
+
+static void
+sink_handoff_float32 (GstElement * element, GstBuffer * buffer, GstPad * pad,
+    gpointer user_data)
+{
+  gint i;
+  GstMapInfo map;
+  gfloat *data;
+  GstCaps *caps, *ccaps;
+  gint n = GPOINTER_TO_INT (user_data);
+  guint64 mask;
+
+  fail_unless (GST_IS_BUFFER (buffer));
+  gst_buffer_map (buffer, &map, GST_MAP_READ);
+  data = (gfloat *) map.data;
+
+  /* Give a little leeway for rounding errors */
+  fail_unless (gst_util_uint64_scale (map.size, GST_SECOND,
+          48000 * 2 * sizeof (gfloat)) <= GST_BUFFER_DURATION (buffer) + 1 ||
+      gst_util_uint64_scale (map.size, GST_SECOND,
+          48000 * 2 * sizeof (gfloat)) >= GST_BUFFER_DURATION (buffer) - 1);
+
+  if (n == 0) {
+    GstAudioChannelPosition pos[2] =
+        { GST_AUDIO_CHANNEL_POSITION_NONE, GST_AUDIO_CHANNEL_POSITION_NONE };
+    gst_audio_channel_positions_to_mask (pos, 2, FALSE, &mask);
+  } else if (n == 1) {
+    GstAudioChannelPosition pos[2] = { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+      GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
+    };
+    gst_audio_channel_positions_to_mask (pos, 2, FALSE, &mask);
+  } else if (n == 2) {
+    GstAudioChannelPosition pos[2] = { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
+      GST_AUDIO_CHANNEL_POSITION_REAR_CENTER
+    };
+    gst_audio_channel_positions_to_mask (pos, 2, FALSE, &mask);
+  } else {
+    g_assert_not_reached ();
+  }
+
+  caps = gst_caps_new_simple ("audio/x-raw",
+      "format", G_TYPE_STRING, GST_AUDIO_NE (F32),
+      "channels", G_TYPE_INT, 2, "rate", G_TYPE_INT, 48000,
+      "layout", G_TYPE_STRING, "interleaved",
+      "channel-mask", GST_TYPE_BITMASK, mask, NULL);
+
+  ccaps = gst_pad_get_current_caps (pad);
+  fail_unless (gst_caps_is_equal (caps, ccaps));
+  gst_caps_unref (ccaps);
+  gst_caps_unref (caps);
+
+#ifdef HAVE_VALGRIND
+  if (!(RUNNING_ON_VALGRIND))
+#endif
+    for (i = 0; i < map.size / sizeof (float); i += 2) {
+      fail_unless_equals_float (data[i], -1.0);
+      fail_unless_equals_float (data[i + 1], 1.0);
+    }
+  have_data += map.size;
+
+  gst_buffer_unmap (buffer, &map);
+
+}
+
+static void
+test_audiointerleave_2ch_pipeline (gboolean interleaved)
+{
+  GstElement *pipeline, *queue, *src1, *src2, *interleave, *sink;
+  GstPad *sinkpad0, *sinkpad1, *tmp, *tmp2;
+  GstMessage *msg;
+  void *src_handoff_float32 =
+      interleaved ? &src_handoff_float32_audiointerleaved :
+      &src_handoff_float32_non_audiointerleaved;
+
+  have_data = 0;
+
+  pipeline = (GstElement *) gst_pipeline_new ("pipeline");
+  fail_unless (pipeline != NULL);
+
+  src1 = gst_element_factory_make ("fakesrc", "src1");
+  fail_unless (src1 != NULL);
+  g_object_set (src1, "num-buffers", 4, NULL);
+  g_object_set (src1, "signal-handoffs", TRUE, NULL);
+  g_object_set (src1, "format", GST_FORMAT_TIME, NULL);
+  g_signal_connect (src1, "handoff", G_CALLBACK (src_handoff_float32),
+      GINT_TO_POINTER (0));
+  gst_bin_add (GST_BIN (pipeline), src1);
+
+  src2 = gst_element_factory_make ("fakesrc", "src2");
+  fail_unless (src2 != NULL);
+  g_object_set (src2, "num-buffers", 4, NULL);
+  g_object_set (src2, "signal-handoffs", TRUE, NULL);
+  g_object_set (src2, "format", GST_FORMAT_TIME, NULL);
+  g_signal_connect (src2, "handoff", G_CALLBACK (src_handoff_float32),
+      GINT_TO_POINTER (1));
+  gst_bin_add (GST_BIN (pipeline), src2);
+
+  queue = gst_element_factory_make ("queue", "queue");
+  fail_unless (queue != NULL);
+  gst_bin_add (GST_BIN (pipeline), queue);
+
+  interleave = gst_element_factory_make ("audiointerleave", "audiointerleave");
+  fail_unless (interleave != NULL);
+  gst_bin_add (GST_BIN (pipeline), gst_object_ref (interleave));
+
+  sinkpad0 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sinkpad0 != NULL);
+  tmp = gst_element_get_static_pad (src1, "src");
+  fail_unless (gst_pad_link (tmp, sinkpad0) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  sinkpad1 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sinkpad1 != NULL);
+  tmp = gst_element_get_static_pad (src2, "src");
+  tmp2 = gst_element_get_static_pad (queue, "sink");
+  fail_unless (gst_pad_link (tmp, tmp2) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  gst_object_unref (tmp2);
+  tmp = gst_element_get_static_pad (queue, "src");
+  fail_unless (gst_pad_link (tmp, sinkpad1) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  sink = gst_element_factory_make ("fakesink", "sink");
+  fail_unless (sink != NULL);
+  g_object_set (sink, "signal-handoffs", TRUE, NULL);
+  g_signal_connect (sink, "handoff", G_CALLBACK (sink_handoff_float32),
+      GINT_TO_POINTER (0));
+  gst_bin_add (GST_BIN (pipeline), sink);
+  tmp = gst_element_get_static_pad (interleave, "src");
+  tmp2 = gst_element_get_static_pad (sink, "sink");
+  fail_unless (gst_pad_link (tmp, tmp2) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  gst_object_unref (tmp2);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  msg = gst_bus_poll (GST_ELEMENT_BUS (pipeline), GST_MESSAGE_EOS, -1);
+  gst_message_unref (msg);
+
+  /* 48000 samples per buffer * 2 sources * 4 buffers */
+  fail_unless (have_data == 48000 * 2 * 4 * sizeof (gfloat));
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  gst_element_release_request_pad (interleave, sinkpad0);
+  gst_object_unref (sinkpad0);
+  gst_element_release_request_pad (interleave, sinkpad1);
+  gst_object_unref (sinkpad1);
+  gst_object_unref (interleave);
+  gst_object_unref (pipeline);
+}
+
+GST_START_TEST (test_audiointerleave_2ch_pipeline_audiointerleaved)
+{
+  test_audiointerleave_2ch_pipeline (TRUE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_audiointerleave_2ch_pipeline_non_audiointerleaved)
+{
+  test_audiointerleave_2ch_pipeline (FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_audiointerleave_2ch_pipeline_input_chanpos)
+{
+  GstElement *pipeline, *queue, *src1, *src2, *interleave, *sink;
+  GstPad *sinkpad0, *sinkpad1, *tmp, *tmp2;
+  GstMessage *msg;
+
+  have_data = 0;
+
+  pipeline = (GstElement *) gst_pipeline_new ("pipeline");
+  fail_unless (pipeline != NULL);
+
+  src1 = gst_element_factory_make ("fakesrc", "src1");
+  fail_unless (src1 != NULL);
+  g_object_set (src1, "num-buffers", 4, NULL);
+  g_object_set (src1, "signal-handoffs", TRUE, NULL);
+  g_object_set (src1, "format", GST_FORMAT_TIME, NULL);
+  g_signal_connect (src1, "handoff",
+      G_CALLBACK (src_handoff_float32_audiointerleaved), GINT_TO_POINTER (2));
+  gst_bin_add (GST_BIN (pipeline), src1);
+
+  src2 = gst_element_factory_make ("fakesrc", "src2");
+  fail_unless (src2 != NULL);
+  g_object_set (src2, "num-buffers", 4, NULL);
+  g_object_set (src2, "signal-handoffs", TRUE, NULL);
+  g_object_set (src2, "format", GST_FORMAT_TIME, NULL);
+  g_signal_connect (src2, "handoff",
+      G_CALLBACK (src_handoff_float32_audiointerleaved), GINT_TO_POINTER (3));
+  gst_bin_add (GST_BIN (pipeline), src2);
+
+  queue = gst_element_factory_make ("queue", "queue");
+  fail_unless (queue != NULL);
+  gst_bin_add (GST_BIN (pipeline), queue);
+
+  interleave = gst_element_factory_make ("audiointerleave", "audiointerleave");
+  fail_unless (interleave != NULL);
+  g_object_set (interleave, "channel-positions-from-input", TRUE, NULL);
+  gst_bin_add (GST_BIN (pipeline), gst_object_ref (interleave));
+
+  sinkpad0 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sinkpad0 != NULL);
+  tmp = gst_element_get_static_pad (src1, "src");
+  fail_unless (gst_pad_link (tmp, sinkpad0) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  sinkpad1 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sinkpad1 != NULL);
+  tmp = gst_element_get_static_pad (src2, "src");
+  tmp2 = gst_element_get_static_pad (queue, "sink");
+  fail_unless (gst_pad_link (tmp, tmp2) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  gst_object_unref (tmp2);
+  tmp = gst_element_get_static_pad (queue, "src");
+  fail_unless (gst_pad_link (tmp, sinkpad1) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  sink = gst_element_factory_make ("fakesink", "sink");
+  fail_unless (sink != NULL);
+  g_object_set (sink, "signal-handoffs", TRUE, NULL);
+  g_signal_connect (sink, "handoff", G_CALLBACK (sink_handoff_float32),
+      GINT_TO_POINTER (1));
+  gst_bin_add (GST_BIN (pipeline), sink);
+  tmp = gst_element_get_static_pad (interleave, "src");
+  tmp2 = gst_element_get_static_pad (sink, "sink");
+  fail_unless (gst_pad_link (tmp, tmp2) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  gst_object_unref (tmp2);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  msg = gst_bus_poll (GST_ELEMENT_BUS (pipeline), GST_MESSAGE_EOS, -1);
+  gst_message_unref (msg);
+
+  /* 48000 samples per buffer * 2 sources * 4 buffers */
+  fail_unless (have_data == 48000 * 2 * 4 * sizeof (gfloat));
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  gst_element_release_request_pad (interleave, sinkpad0);
+  gst_object_unref (sinkpad0);
+  gst_element_release_request_pad (interleave, sinkpad1);
+  gst_object_unref (sinkpad1);
+  gst_object_unref (interleave);
+  gst_object_unref (pipeline);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_audiointerleave_2ch_pipeline_custom_chanpos)
+{
+  GstElement *pipeline, *queue, *src1, *src2, *interleave, *sink;
+  GstPad *sinkpad0, *sinkpad1, *tmp, *tmp2;
+  GstMessage *msg;
+  GValueArray *arr;
+  GValue val = { 0, };
+
+  have_data = 0;
+
+  pipeline = (GstElement *) gst_pipeline_new ("pipeline");
+  fail_unless (pipeline != NULL);
+
+  src1 = gst_element_factory_make ("fakesrc", "src1");
+  fail_unless (src1 != NULL);
+  g_object_set (src1, "num-buffers", 4, NULL);
+  g_object_set (src1, "signal-handoffs", TRUE, NULL);
+  g_object_set (src1, "format", GST_FORMAT_TIME, NULL);
+  g_signal_connect (src1, "handoff",
+      G_CALLBACK (src_handoff_float32_audiointerleaved), GINT_TO_POINTER (0));
+  gst_bin_add (GST_BIN (pipeline), src1);
+
+  src2 = gst_element_factory_make ("fakesrc", "src2");
+  fail_unless (src2 != NULL);
+  g_object_set (src2, "num-buffers", 4, NULL);
+  g_object_set (src2, "signal-handoffs", TRUE, NULL);
+  g_object_set (src2, "format", GST_FORMAT_TIME, NULL);
+  g_signal_connect (src2, "handoff",
+      G_CALLBACK (src_handoff_float32_audiointerleaved), GINT_TO_POINTER (1));
+  gst_bin_add (GST_BIN (pipeline), src2);
+
+  queue = gst_element_factory_make ("queue", "queue");
+  fail_unless (queue != NULL);
+  gst_bin_add (GST_BIN (pipeline), queue);
+
+  interleave = gst_element_factory_make ("audiointerleave", "audiointerleave");
+  fail_unless (interleave != NULL);
+  g_object_set (interleave, "channel-positions-from-input", FALSE, NULL);
+  arr = g_value_array_new (2);
+
+  g_value_init (&val, GST_TYPE_AUDIO_CHANNEL_POSITION);
+  g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER);
+  g_value_array_append (arr, &val);
+  g_value_reset (&val);
+  g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER);
+  g_value_array_append (arr, &val);
+  g_value_unset (&val);
+
+  g_object_set (interleave, "channel-positions", arr, NULL);
+  g_value_array_free (arr);
+  gst_bin_add (GST_BIN (pipeline), gst_object_ref (interleave));
+
+  sinkpad0 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sinkpad0 != NULL);
+  tmp = gst_element_get_static_pad (src1, "src");
+  fail_unless (gst_pad_link (tmp, sinkpad0) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  sinkpad1 = gst_element_get_request_pad (interleave, "sink_%u");
+  fail_unless (sinkpad1 != NULL);
+  tmp = gst_element_get_static_pad (src2, "src");
+  tmp2 = gst_element_get_static_pad (queue, "sink");
+  fail_unless (gst_pad_link (tmp, tmp2) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  gst_object_unref (tmp2);
+  tmp = gst_element_get_static_pad (queue, "src");
+  fail_unless (gst_pad_link (tmp, sinkpad1) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+
+  sink = gst_element_factory_make ("fakesink", "sink");
+  fail_unless (sink != NULL);
+  g_object_set (sink, "signal-handoffs", TRUE, NULL);
+  g_signal_connect (sink, "handoff", G_CALLBACK (sink_handoff_float32),
+      GINT_TO_POINTER (2));
+  gst_bin_add (GST_BIN (pipeline), sink);
+  tmp = gst_element_get_static_pad (interleave, "src");
+  tmp2 = gst_element_get_static_pad (sink, "sink");
+  fail_unless (gst_pad_link (tmp, tmp2) == GST_PAD_LINK_OK);
+  gst_object_unref (tmp);
+  gst_object_unref (tmp2);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  msg = gst_bus_poll (GST_ELEMENT_BUS (pipeline), GST_MESSAGE_EOS, -1);
+  gst_message_unref (msg);
+
+  /* 48000 samples per buffer * 2 sources * 4 buffers */
+  fail_unless (have_data == 48000 * 2 * 4 * sizeof (gfloat));
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  gst_element_release_request_pad (interleave, sinkpad0);
+  gst_object_unref (sinkpad0);
+  gst_element_release_request_pad (interleave, sinkpad1);
+  gst_object_unref (sinkpad1);
+  gst_object_unref (interleave);
+  gst_object_unref (pipeline);
+}
+
+GST_END_TEST;
+
+static Suite *
+audiointerleave_suite (void)
+{
+  Suite *s = suite_create ("audiointerleave");
+  TCase *tc_chain = tcase_create ("general");
+
+  suite_add_tcase (s, tc_chain);
+  tcase_set_timeout (tc_chain, 180);
+  tcase_add_test (tc_chain, test_create_and_unref);
+  tcase_add_test (tc_chain, test_request_pads);
+  tcase_add_test (tc_chain, test_audiointerleave_2ch);
+  tcase_add_test (tc_chain, test_audiointerleave_2ch_1eos);
+  tcase_add_test (tc_chain, test_audiointerleave_2ch_pipeline_audiointerleaved);
+  tcase_add_test (tc_chain, test_audiointerleave_2ch_pipeline_non_audiointerleaved);
+  tcase_add_test (tc_chain, test_audiointerleave_2ch_pipeline_input_chanpos);
+  tcase_add_test (tc_chain, test_audiointerleave_2ch_pipeline_custom_chanpos);
+
+  return s;
+}
+
+GST_CHECK_MAIN (audiointerleave);
diff --git a/tests/check/elements/audiomixer.c b/tests/check/elements/audiomixer.c
index 1d1b091..d758e75 100644
--- a/tests/check/elements/audiomixer.c
+++ b/tests/check/elements/audiomixer.c
@@ -33,6 +33,7 @@
 
 #include <gst/check/gstcheck.h>
 #include <gst/check/gstconsistencychecker.h>
+#include <gst/audio/audio.h>
 #include <gst/base/gstbasesrc.h>
 
 static GMainLoop *main_loop;
@@ -86,7 +87,7 @@
   GstPad *pad;
 
   filter_caps = gst_caps_new_simple ("audio/x-raw",
-      "format", G_TYPE_STRING, "F32LE",
+      "format", G_TYPE_STRING, GST_AUDIO_NE (F32),
       "layout", G_TYPE_STRING, "interleaved",
       "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 1, NULL);
 
@@ -586,10 +587,12 @@
 /* test failing seeks on live-sources */
 GST_START_TEST (test_live_seeking)
 {
-  GstElement *bin, *src1 = NULL, *src2, *ac1, *ac2, *audiomixer, *sink;
+  GstElement *bin, *src1 = NULL, *cf, *src2, *audiomixer, *sink;
+  GstCaps *caps;
   GstBus *bus;
   gboolean res;
   GstPad *srcpad;
+  GstPad *sinkpad;
   gint i;
   GstStateChangeReturn state_res;
   GstStreamConsistency *consist;
@@ -622,26 +625,44 @@
     g_object_set (src1, "num-buffers", 4, "blocksize", 44100, NULL);
   }
 
-  ac1 = gst_element_factory_make ("audioconvert", "ac1");
-  src2 = gst_element_factory_make ("audiotestsrc", "src2");
-  g_object_set (src2, "wave", 4, NULL); /* silence */
-  ac2 = gst_element_factory_make ("audioconvert", "ac2");
   audiomixer = gst_element_factory_make ("audiomixer", "audiomixer");
+  cf = gst_element_factory_make ("capsfilter", "capsfilter");
   sink = gst_element_factory_make ("fakesink", "sink");
-  gst_bin_add_many (GST_BIN (bin), src1, ac1, src2, ac2, audiomixer, sink,
-      NULL);
 
-  res = gst_element_link (src1, ac1);
+  gst_bin_add_many (GST_BIN (bin), src1, cf, audiomixer, sink, NULL);
+  res = gst_element_link (src1, cf);
   fail_unless (res == TRUE, NULL);
-  res = gst_element_link (ac1, audiomixer);
-  fail_unless (res == TRUE, NULL);
-  res = gst_element_link (src2, ac2);
-  fail_unless (res == TRUE, NULL);
-  res = gst_element_link (ac2, audiomixer);
+  res = gst_element_link (cf, audiomixer);
   fail_unless (res == TRUE, NULL);
   res = gst_element_link (audiomixer, sink);
   fail_unless (res == TRUE, NULL);
 
+  gst_element_set_state (bin, GST_STATE_PLAYING);
+  /* wait for completion */
+  state_res =
+      gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
+      GST_CLOCK_TIME_NONE);
+  ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
+
+  sinkpad = gst_element_get_static_pad (sink, "sink");
+  fail_unless (sinkpad != NULL);
+  caps = gst_pad_get_current_caps (sinkpad);
+  fail_unless (caps != NULL);
+  gst_object_unref (sinkpad);
+
+  gst_element_set_state (bin, GST_STATE_NULL);
+
+  g_object_set (cf, "caps", caps, NULL);
+
+  src2 = gst_element_factory_make ("audiotestsrc", "src2");
+  g_object_set (src2, "wave", 4, NULL); /* silence */
+  gst_bin_add (GST_BIN (bin), src2);
+
+  res = gst_element_link_filtered (src2, audiomixer, caps);
+  fail_unless (res == TRUE, NULL);
+
+  gst_caps_unref (caps);
+
   play_seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
       GST_SEEK_FLAG_FLUSH,
       GST_SEEK_TYPE_SET, (GstClockTime) 0,
@@ -870,11 +891,16 @@
 
 
 static GstBuffer *handoff_buffer = NULL;
+
 static void
 handoff_buffer_cb (GstElement * fakesink, GstBuffer * buffer, GstPad * pad,
     gpointer user_data)
 {
-  GST_DEBUG ("got buffer %p", buffer);
+  GST_DEBUG ("got buffer -- SIZE: %" G_GSIZE_FORMAT
+      " -- %p DURATION is %" GST_TIME_FORMAT,
+      gst_buffer_get_size (buffer), buffer,
+      GST_TIME_ARGS (GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer)));
+
   gst_buffer_replace (&handoff_buffer, buffer);
 }
 
@@ -891,6 +917,7 @@
   GstEvent *event;
   GstBuffer *buffer;
   GstCaps *caps;
+  GstQuery *drain = gst_query_new_drain ();
 
   GST_INFO ("preparing test");
 
@@ -925,11 +952,7 @@
   gst_pad_send_event (sinkpad, gst_event_new_stream_start ("test"));
 
   caps = gst_caps_new_simple ("audio/x-raw",
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-      "format", G_TYPE_STRING, "S16BE",
-#else
-      "format", G_TYPE_STRING, "S16LE",
-#endif
+      "format", G_TYPE_STRING, GST_AUDIO_NE (S16),
       "layout", G_TYPE_STRING, "interleaved",
       "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2, NULL);
 
@@ -948,18 +971,32 @@
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 0;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  GST_DEBUG ("pushing buffer %p", buffer);
+  GST_DEBUG ("pushing buffer %p END is %" GST_TIME_FORMAT,
+      buffer,
+      GST_TIME_ARGS (GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer)));
   ret = gst_pad_chain (sinkpad, buffer);
   ck_assert_int_eq (ret, GST_FLOW_OK);
+
+  /* The aggregation is done in a dedicated thread, so we can't
+   * not know when it is actually going to happen, so we use a DRAIN query
+   * to wait for it to complete.
+   */
+  gst_pad_query (sinkpad, drain);
   fail_unless (handoff_buffer == NULL);
 
   /* should be partially clipped */
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 900 * GST_MSECOND;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  GST_DEBUG ("pushing buffer %p", buffer);
+
+  GST_DEBUG ("pushing buffer %p START %" GST_TIME_FORMAT " -- DURATION is %"
+      GST_TIME_FORMAT, buffer, GST_TIME_ARGS (GST_BUFFER_PTS (buffer)),
+      GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)));
+
   ret = gst_pad_chain (sinkpad, buffer);
   ck_assert_int_eq (ret, GST_FLOW_OK);
+  gst_pad_query (sinkpad, drain);
+
   fail_unless (handoff_buffer != NULL);
   gst_buffer_replace (&handoff_buffer, NULL);
 
@@ -967,19 +1004,28 @@
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  GST_DEBUG ("pushing buffer %p", buffer);
+
+  GST_DEBUG ("pushing buffer %p END is %" GST_TIME_FORMAT,
+      buffer,
+      GST_TIME_ARGS (GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer)));
   ret = gst_pad_chain (sinkpad, buffer);
   ck_assert_int_eq (ret, GST_FLOW_OK);
+  gst_pad_query (sinkpad, drain);
   fail_unless (handoff_buffer != NULL);
   gst_buffer_replace (&handoff_buffer, NULL);
+  fail_unless (handoff_buffer == NULL);
 
   /* should be clipped and ok */
+
   buffer = gst_buffer_new_and_alloc (44100);
   GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND;
   GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
-  GST_DEBUG ("pushing buffer %p", buffer);
+  GST_DEBUG ("pushing buffer %p END is %" GST_TIME_FORMAT,
+      buffer,
+      GST_TIME_ARGS (GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer)));
   ret = gst_pad_chain (sinkpad, buffer);
   ck_assert_int_eq (ret, GST_FLOW_OK);
+  gst_pad_query (sinkpad, drain);
   fail_unless (handoff_buffer == NULL);
 
   gst_element_release_request_pad (audiomixer, sinkpad);
@@ -988,6 +1034,7 @@
   gst_bus_remove_signal_watch (bus);
   gst_object_unref (bus);
   gst_object_unref (bin);
+  gst_query_unref (drain);
 }
 
 GST_END_TEST;
@@ -1207,7 +1254,7 @@
 GST_START_TEST (test_flush_start_flush_stop)
 {
   GstPadTemplate *sink_template;
-  GstPad *tmppad, *sinkpad1, *sinkpad2, *audiomixer_src;
+  GstPad *tmppad, *srcpad1, *sinkpad1, *sinkpad2, *audiomixer_src;
   GstElement *pipeline, *src1, *src2, *audiomixer, *sink;
 
   GST_INFO ("preparing test");
@@ -1227,9 +1274,8 @@
       "sink_%u");
   fail_unless (GST_IS_PAD_TEMPLATE (sink_template));
   sinkpad1 = gst_element_request_pad (audiomixer, sink_template, NULL, NULL);
-  tmppad = gst_element_get_static_pad (src1, "src");
-  gst_pad_link (tmppad, sinkpad1);
-  gst_object_unref (tmppad);
+  srcpad1 = gst_element_get_static_pad (src1, "src");
+  gst_pad_link (srcpad1, sinkpad1);
 
   sinkpad2 = gst_element_request_pad (audiomixer, sink_template, NULL, NULL);
   tmppad = gst_element_get_static_pad (src2, "src");
@@ -1245,15 +1291,22 @@
   audiomixer_src = gst_element_get_static_pad (audiomixer, "src");
   fail_if (GST_PAD_IS_FLUSHING (audiomixer_src));
   gst_pad_send_event (sinkpad1, gst_event_new_flush_start ());
-  fail_unless (GST_PAD_IS_FLUSHING (audiomixer_src));
-  gst_pad_send_event (sinkpad1, gst_event_new_flush_stop (TRUE));
   fail_if (GST_PAD_IS_FLUSHING (audiomixer_src));
+  fail_unless (GST_PAD_IS_FLUSHING (sinkpad1));
+  /* Hold the streamlock to make sure the flush stop is not between
+     the attempted push of a segment event and of the following buffer. */
+  GST_PAD_STREAM_LOCK (srcpad1);
+  gst_pad_send_event (sinkpad1, gst_event_new_flush_stop (TRUE));
+  GST_PAD_STREAM_UNLOCK (srcpad1);
+  fail_if (GST_PAD_IS_FLUSHING (audiomixer_src));
+  fail_if (GST_PAD_IS_FLUSHING (sinkpad1));
   gst_object_unref (audiomixer_src);
 
   gst_element_release_request_pad (audiomixer, sinkpad1);
   gst_object_unref (sinkpad1);
   gst_element_release_request_pad (audiomixer, sinkpad2);
   gst_object_unref (sinkpad2);
+  gst_object_unref (srcpad1);
 
   /* cleanup */
   gst_element_set_state (pipeline, GST_STATE_NULL);
@@ -1309,7 +1362,7 @@
   queue1 = gst_element_factory_make ("queue", "queue1");
   queue2 = gst_element_factory_make ("queue", "queue2");
   audiomixer = gst_element_factory_make ("audiomixer", "audiomixer");
-  g_object_set (audiomixer, "blocksize", 500, NULL);
+  g_object_set (audiomixer, "output-buffer-duration", 500 * GST_MSECOND, NULL);
   sink = gst_element_factory_make ("fakesink", "sink");
   g_object_set (sink, "signal-handoffs", TRUE, NULL);
   g_signal_connect (sink, "handoff", (GCallback) handoff_buffer_collect_cb,
@@ -1345,11 +1398,7 @@
   gst_pad_send_event (queue2_sinkpad, gst_event_new_stream_start ("test"));
 
   caps = gst_caps_new_simple ("audio/x-raw",
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-      "format", G_TYPE_STRING, "S16BE",
-#else
-      "format", G_TYPE_STRING, "S16LE",
-#endif
+      "format", G_TYPE_STRING, GST_AUDIO_NE (S16),
       "layout", G_TYPE_STRING, "interleaved",
       "rate", G_TYPE_INT, 1000, "channels", G_TYPE_INT, 1, NULL);
 
@@ -1725,6 +1774,66 @@
 
 GST_END_TEST;
 
+GST_START_TEST (test_segment_base_handling)
+{
+  GstElement *pipeline, *sink, *mix, *src1, *src2;
+  GstPad *srcpad, *sinkpad;
+  GstClockTime end_time;
+  GstSample *last_sample = NULL;
+  GstSample *sample;
+  GstBuffer *buf;
+  GstCaps *caps;
+
+  caps = gst_caps_new_simple ("audio/x-raw", "rate", G_TYPE_INT, 44100,
+      "channels", G_TYPE_INT, 2, NULL);
+
+  pipeline = gst_pipeline_new ("pipeline");
+  mix = gst_element_factory_make ("audiomixer", "audiomixer");
+  sink = gst_element_factory_make ("appsink", "sink");
+  g_object_set (sink, "caps", caps, "sync", FALSE, NULL);
+  gst_caps_unref (caps);
+  src1 = gst_element_factory_make ("audiotestsrc", "src1");
+  g_object_set (src1, "samplesperbuffer", 4410, "num-buffers", 50, NULL);
+  src2 = gst_element_factory_make ("audiotestsrc", "src2");
+  g_object_set (src2, "samplesperbuffer", 4410, "num-buffers", 50, NULL);
+  gst_bin_add_many (GST_BIN (pipeline), src1, src2, mix, sink, NULL);
+  fail_unless (gst_element_link (mix, sink));
+
+  srcpad = gst_element_get_static_pad (src1, "src");
+  sinkpad = gst_element_get_request_pad (mix, "sink_1");
+  fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK);
+  gst_object_unref (sinkpad);
+  gst_object_unref (srcpad);
+
+  srcpad = gst_element_get_static_pad (src2, "src");
+  sinkpad = gst_element_get_request_pad (mix, "sink_2");
+  fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK);
+  gst_pad_set_offset (sinkpad, 5 * GST_SECOND);
+  gst_object_unref (sinkpad);
+  gst_object_unref (srcpad);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  do {
+    g_signal_emit_by_name (sink, "pull-sample", &sample);
+    if (sample == NULL)
+      break;
+    if (last_sample)
+      gst_sample_unref (last_sample);
+    last_sample = sample;
+  } while (TRUE);
+
+  buf = gst_sample_get_buffer (last_sample);
+  end_time = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
+  fail_unless_equals_int64 (end_time, 10 * GST_SECOND);
+  gst_sample_unref (last_sample);
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  gst_object_unref (pipeline);
+}
+
+GST_END_TEST;
+
 static Suite *
 audiomixer_suite (void)
 {
@@ -1748,6 +1857,7 @@
   tcase_add_test (tc_chain, test_sync);
   tcase_add_test (tc_chain, test_sync_discont);
   tcase_add_test (tc_chain, test_sync_unaligned);
+  tcase_add_test (tc_chain, test_segment_base_handling);
 
   /* Use a longer timeout */
 #ifdef HAVE_VALGRIND
diff --git a/tests/check/elements/compositor.c b/tests/check/elements/compositor.c
index 9ef52ba..dab259b 100644
--- a/tests/check/elements/compositor.c
+++ b/tests/check/elements/compositor.c
@@ -1035,6 +1035,66 @@
 
 GST_END_TEST;
 
+GST_START_TEST (test_segment_base_handling)
+{
+  GstElement *pipeline, *sink, *mix, *src1, *src2;
+  GstPad *srcpad, *sinkpad;
+  GstClockTime end_time;
+  GstSample *last_sample = NULL;
+  GstSample *sample;
+  GstBuffer *buf;
+  GstCaps *caps;
+
+  caps = gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 16,
+      "height", G_TYPE_INT, 16, "framerate", GST_TYPE_FRACTION, 30, 1, NULL);
+
+  /* each source generates 5 seconds of data, src2 shifted by 5 seconds */
+  pipeline = gst_pipeline_new ("pipeline");
+  mix = gst_element_factory_make ("compositor", "compositor");
+  sink = gst_element_factory_make ("appsink", "sink");
+  g_object_set (sink, "caps", caps, "sync", FALSE, NULL);
+  gst_caps_unref (caps);
+  src1 = gst_element_factory_make ("videotestsrc", "src1");
+  g_object_set (src1, "num-buffers", 30 * 5, "pattern", 2, NULL);
+  src2 = gst_element_factory_make ("videotestsrc", "src2");
+  g_object_set (src2, "num-buffers", 30 * 5, "pattern", 2, NULL);
+  gst_bin_add_many (GST_BIN (pipeline), src1, src2, mix, sink, NULL);
+  fail_unless (gst_element_link (mix, sink));
+
+  srcpad = gst_element_get_static_pad (src1, "src");
+  sinkpad = gst_element_get_request_pad (mix, "sink_1");
+  fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK);
+  gst_object_unref (sinkpad);
+  gst_object_unref (srcpad);
+
+  srcpad = gst_element_get_static_pad (src2, "src");
+  sinkpad = gst_element_get_request_pad (mix, "sink_2");
+  fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK);
+  gst_pad_set_offset (sinkpad, 5 * GST_SECOND);
+  gst_object_unref (sinkpad);
+  gst_object_unref (srcpad);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  do {
+    g_signal_emit_by_name (sink, "pull-sample", &sample);
+    if (sample == NULL)
+      break;
+    if (last_sample)
+      gst_sample_unref (last_sample);
+    last_sample = sample;
+  } while (TRUE);
+
+  buf = gst_sample_get_buffer (last_sample);
+  end_time = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
+  fail_unless_equals_int64 (end_time, 10 * GST_SECOND);
+  gst_sample_unref (last_sample);
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  gst_object_unref (pipeline);
+}
+
+GST_END_TEST;
 
 static Suite *
 compositor_suite (void)
@@ -1054,6 +1114,7 @@
   tcase_add_test (tc_chain, test_duration_unknown_overrides);
   tcase_add_test (tc_chain, test_loop);
   tcase_add_test (tc_chain, test_flush_start_flush_stop);
+  tcase_add_test (tc_chain, test_segment_base_handling);
 
   /* Use a longer timeout */
 #ifdef HAVE_VALGRIND
diff --git a/tests/check/elements/gdpdepay.c b/tests/check/elements/gdpdepay.c
index 931ef62..0f7877f 100644
--- a/tests/check/elements/gdpdepay.c
+++ b/tests/check/elements/gdpdepay.c
@@ -90,18 +90,26 @@
 }
 
 static void
-gdpdepay_push_per_byte (const gchar * reason, const guint8 * bytes,
-    guint length)
+gdpdepay_push_mem_per_byte (const gchar * reason, GstBuffer * buf, guint nth)
 {
   int i;
   GstBuffer *inbuffer;
+  GstMapInfo map;
+  GstMemory *mem;
 
-  for (i = 0; i < length; ++i) {
+  mem = gst_buffer_peek_memory (buf, nth);
+  fail_unless (mem != NULL);
+
+  gst_memory_map (mem, &map, GST_MAP_READ);
+
+  for (i = 0; i < map.size; ++i) {
     inbuffer = gst_buffer_new_and_alloc (1);
-    gst_buffer_fill (inbuffer, 0, &bytes[i], 1);
+    gst_buffer_fill (inbuffer, 0, map.data + i, 1);
     fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK,
         "%s: failed pushing byte buffer", reason);
   }
+
+  gst_memory_unmap (mem, &map);
 }
 
 GST_START_TEST (test_audio_per_byte)
@@ -110,14 +118,9 @@
   GstPad *srcpad;
   GstElement *gdpdepay;
   GstBuffer *buffer, *outbuffer;
-  guint8 *header, *payload;
-  guint len;
-  GstDPPacketizer *pk;
   GstEvent *event;
   GstSegment segment;
 
-  pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
-
   gdpdepay = setup_gdpdepay ();
   srcpad = gst_element_get_static_pad (gdpdepay, "src");
 
@@ -136,58 +139,52 @@
 
   /* send stream-start event */
   event = gst_event_new_stream_start ("s-s-id-1234");
-  fail_unless (pk->packet_from_event (event, 0, &len, &header, &payload));
+  buffer = gst_dp_payload_event (event, 0);
   gst_event_unref (event);
-  gdpdepay_push_per_byte ("caps header", header, len);
+  fail_unless (buffer != NULL);
+  gdpdepay_push_mem_per_byte ("stream-start header", buffer, 0);
   fail_unless_equals_int (g_list_length (buffers), 0);
-  gdpdepay_push_per_byte ("caps payload", payload,
-      gst_dp_header_payload_length (header));
+  gdpdepay_push_mem_per_byte ("stream-start payload", buffer, 1);
   fail_unless_equals_int (g_list_length (buffers), 0);
-
-  g_free (header);
-  g_free (payload);
+  gst_buffer_unref (buffer);
 
   /* create caps and buffer packets and push them */
   caps = gst_caps_from_string (AUDIO_CAPS_STRING);
-  fail_unless (pk->packet_from_caps (caps, 0, &len, &header, &payload));
+  buffer = gst_dp_payload_caps (caps, 0);
   gst_caps_unref (caps);
-  gdpdepay_push_per_byte ("caps header", header, len);
+  fail_unless (buffer != NULL);
+  gdpdepay_push_mem_per_byte ("caps header", buffer, 0);
   fail_unless_equals_int (g_list_length (buffers), 0);
-  gdpdepay_push_per_byte ("caps payload", payload,
-      gst_dp_header_payload_length (header));
+  gdpdepay_push_mem_per_byte ("caps payload", buffer, 1);
   fail_unless_equals_int (g_list_length (buffers), 0);
   caps = gst_pad_query_caps (srcpad, NULL);
   fail_if (gst_caps_is_any (caps));
   gst_caps_unref (caps);
-
-  g_free (header);
-  g_free (payload);
+  gst_buffer_unref (buffer);
 
   /* send segment */
   gst_segment_init (&segment, GST_FORMAT_TIME);
   event = gst_event_new_segment (&segment);
-  fail_unless (pk->packet_from_event (event, 0, &len, &header, &payload));
+  buffer = gst_dp_payload_event (event, 0);
   gst_event_unref (event);
-  gdpdepay_push_per_byte ("caps header", header, len);
+  fail_unless (buffer != NULL);
+  gdpdepay_push_mem_per_byte ("segment header", buffer, 0);
   fail_unless_equals_int (g_list_length (buffers), 0);
-  gdpdepay_push_per_byte ("caps payload", payload,
-      gst_dp_header_payload_length (header));
+  gdpdepay_push_mem_per_byte ("segment payload", buffer, 1);
   fail_unless_equals_int (g_list_length (buffers), 0);
-
-  g_free (header);
-  g_free (payload);
+  gst_buffer_unref (buffer);
 
   buffer = gst_buffer_new_and_alloc (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", (const guint8 *) "f00d",
-      gst_dp_header_payload_length (header));
-  g_free (header);
+  outbuffer = gst_dp_payload_buffer (buffer, 0);
   gst_buffer_unref (buffer);
+  fail_unless (outbuffer != NULL);
+  gdpdepay_push_mem_per_byte ("buffer header", outbuffer, 0);
+  fail_unless_equals_int (g_list_length (buffers), 0);
+  gdpdepay_push_mem_per_byte ("buffer payload", outbuffer, 1);
+  gst_buffer_unref (outbuffer);
 
   fail_unless_equals_int (g_list_length (buffers), 1);
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
@@ -206,8 +203,6 @@
   buffers = NULL;
   gst_object_unref (srcpad);
   cleanup_gdpdepay (gdpdepay);
-
-  gst_dp_packetizer_free (pk);
 }
 
 GST_END_TEST;
@@ -218,17 +213,10 @@
   GstPad *srcpad;
   GstElement *gdpdepay;
   GstBuffer *buffer, *inbuffer;
-  guint8 *caps_header, *caps_payload, *buf_header;
-  guint8 *streamstart_header, *streamstart_payload;
-  guint8 *segment_header, *segment_payload;
-  guint header_len, payload_len, streamstart_len, segment_len;
-  guint i;
-  GstDPPacketizer *pk;
+  GstBuffer *caps_buf, *streamstart_buf, *segment_buf, *data_buf;
   GstEvent *event;
   GstSegment segment;
 
-  pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
-
   gdpdepay = setup_gdpdepay ();
   srcpad = gst_element_get_static_pad (gdpdepay, "src");
 
@@ -248,67 +236,28 @@
 
   /* create stream-start event */
   event = gst_event_new_stream_start ("s-s-id-1234");
-  fail_unless (pk->packet_from_event (event, 0, &streamstart_len,
-          &streamstart_header, &streamstart_payload));
+  streamstart_buf = gst_dp_payload_event (event, 0);
   gst_event_unref (event);
 
   /* create caps and buffer packets and push them as one buffer */
   caps = gst_caps_from_string (AUDIO_CAPS_STRING);
-  fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
-          &caps_payload));
+  caps_buf = gst_dp_payload_caps (caps, 0);
+  gst_caps_unref (caps);
 
   /* create segment */
   gst_segment_init (&segment, GST_FORMAT_TIME);
   event = gst_event_new_segment (&segment);
-  fail_unless (pk->packet_from_event (event, 0, &segment_len, &segment_header,
-          &segment_payload));
+  segment_buf = gst_dp_payload_event (event, 0);
   gst_event_unref (event);
 
   buffer = gst_buffer_new_and_alloc (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) +
-      gst_dp_header_payload_length (streamstart_header) +
-      gst_dp_header_payload_length (segment_header);
-
-  inbuffer = gst_buffer_new_and_alloc (4 * GST_DP_HEADER_LENGTH +
-      payload_len + gst_buffer_get_size (buffer));
-  i = 0;
-
-  gst_buffer_fill (inbuffer, i, streamstart_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, streamstart_payload,
-      gst_dp_header_payload_length (streamstart_header));
-  i += gst_dp_header_payload_length (streamstart_header);
-
-  gst_buffer_fill (inbuffer, i, caps_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, caps_payload,
-      gst_dp_header_payload_length (caps_header));
-  i += gst_dp_header_payload_length (caps_header);
-
-  gst_buffer_fill (inbuffer, i, segment_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, segment_payload,
-      gst_dp_header_payload_length (segment_header));
-  i += gst_dp_header_payload_length (segment_header);
-
-  gst_buffer_fill (inbuffer, i, buf_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, "f00d", 4);
-
-  gst_caps_unref (caps);
+  data_buf = gst_dp_payload_buffer (buffer, 0);
   gst_buffer_unref (buffer);
 
-  g_free (streamstart_header);
-  g_free (streamstart_payload);
-  g_free (caps_header);
-  g_free (caps_payload);
-  g_free (segment_header);
-  g_free (segment_payload);
-  g_free (buf_header);
+  inbuffer = gst_buffer_append (streamstart_buf, caps_buf);
+  inbuffer = gst_buffer_append (inbuffer, segment_buf);
+  inbuffer = gst_buffer_append (inbuffer, data_buf);
 
   /* now push it */
   gst_pad_push (mysrcpad, inbuffer);
@@ -325,8 +274,6 @@
   buffers = NULL;
   ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
   cleanup_gdpdepay (gdpdepay);
-
-  gst_dp_packetizer_free (pk);
 }
 
 GST_END_TEST;
@@ -360,21 +307,12 @@
   GstPad *srcpad;
   GstElement *gdpdepay;
   GstBuffer *buffer, *inbuffer, *outbuffer, *shbuffer;
-  guint8 *caps_header, *caps_payload, *buf_header;
-  guint8 *streamstart_header, *streamstart_payload;
-  guint8 *segment_header, *segment_payload;
-  guint streamstart_len, segment_len;
+  GstBuffer *caps_buf, *ss_buf, *segment_buf, *data_buf;
   GstEvent *event;
   GstSegment segment;
-  GstMapInfo map;
-  guint header_len, payload_len;
-  guint i;
   GstStructure *structure;
   GValue array = { 0 };
   GValue value = { 0 };
-  GstDPPacketizer *pk;
-
-  pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
 
   gdpdepay = setup_gdpdepay_streamheader ();
   srcpad = gst_element_get_static_pad (gdpdepay, "src");
@@ -414,68 +352,26 @@
   /* basic events */
   /* create stream-start event */
   event = gst_event_new_stream_start ("s-s-id-1234");
-  fail_unless (pk->packet_from_event (event, 0, &streamstart_len,
-          &streamstart_header, &streamstart_payload));
+  ss_buf = gst_dp_payload_event (event, 0);
   gst_event_unref (event);
 
   /* create segment */
   gst_segment_init (&segment, GST_FORMAT_TIME);
   event = gst_event_new_segment (&segment);
-  fail_unless (pk->packet_from_event (event, 0, &segment_len, &segment_header,
-          &segment_payload));
+  segment_buf = gst_dp_payload_event (event, 0);
   gst_event_unref (event);
 
   /* create GDP packets for the caps and the buffer, and put them in one
    * GDP buffer */
-  fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
-          &caps_payload));
-
-  fail_unless (pk->header_from_buffer (buffer, 0, &header_len, &buf_header));
-
-  payload_len =
-      gst_dp_header_payload_length (caps_header) +
-      gst_dp_header_payload_length (streamstart_header) +
-      gst_dp_header_payload_length (segment_header);
-
-  gst_buffer_map (buffer, &map, GST_MAP_READ);
-  inbuffer = gst_buffer_new_and_alloc (4 * GST_DP_HEADER_LENGTH +
-      payload_len + map.size);
-  i = 0;
-
-  gst_buffer_fill (inbuffer, i, streamstart_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, streamstart_payload,
-      gst_dp_header_payload_length (streamstart_header));
-  i += gst_dp_header_payload_length (streamstart_header);
-
-  gst_buffer_fill (inbuffer, i, caps_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, caps_payload,
-      gst_dp_header_payload_length (caps_header));
-  i += gst_dp_header_payload_length (caps_header);
-
-  gst_buffer_fill (inbuffer, i, segment_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, segment_payload,
-      gst_dp_header_payload_length (segment_header));
-  i += gst_dp_header_payload_length (segment_header);
-
-  gst_buffer_fill (inbuffer, i, buf_header, GST_DP_HEADER_LENGTH);
-  i += GST_DP_HEADER_LENGTH;
-  gst_buffer_fill (inbuffer, i, map.data, map.size);
-  gst_buffer_unmap (buffer, &map);
-
+  caps_buf = gst_dp_payload_caps (caps, 0);
   gst_caps_unref (caps);
+
+  data_buf = gst_dp_payload_buffer (buffer, 0);
   gst_buffer_unref (buffer);
 
-  g_free (streamstart_header);
-  g_free (streamstart_payload);
-  g_free (caps_header);
-  g_free (caps_payload);
-  g_free (segment_header);
-  g_free (segment_payload);
-  g_free (buf_header);
-
+  inbuffer = gst_buffer_append (ss_buf, caps_buf);
+  inbuffer = gst_buffer_append (inbuffer, segment_buf);
+  inbuffer = gst_buffer_append (inbuffer, data_buf);
 
   /* now push it */
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@@ -501,8 +397,6 @@
   buffers = NULL;
   ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
   cleanup_gdpdepay (gdpdepay);
-
-  gst_dp_packetizer_free (pk);
 }
 
 GST_END_TEST;
diff --git a/tests/check/elements/gdppay.c b/tests/check/elements/gdppay.c
index 704c54f..9db5a7d 100644
--- a/tests/check/elements/gdppay.c
+++ b/tests/check/elements/gdppay.c
@@ -110,7 +110,7 @@
 
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   buffers = g_list_remove (buffers, outbuffer);
-  ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
+  ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", refcount);
   length = GST_DP_HEADER_LENGTH + (strlen (caps_string) + 1);
   fail_unless_equals_int (gst_buffer_get_size (outbuffer), length);
   gst_buffer_unref (outbuffer);
@@ -147,6 +147,7 @@
 
   GST_DEBUG ("first buffer");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, 0x00, 4);
   caps = gst_caps_from_string (AUDIO_CAPS_STRING);
   gst_check_setup_events (mysrcpad, gdppay, caps, GST_FORMAT_TIME);
 
@@ -159,14 +160,13 @@
   fail_unless_equals_int (g_list_length (buffers), 4);
 
   /* first buffer is the stream-start event */
-  check_stream_start_buffer (2);
+  check_stream_start_buffer (1);
 
-  /* second buffer is the serialized caps;
-   * the element also holds a ref to it */
-  check_caps_buffer (2, caps);
+  /* second buffer is the serialized caps */
+  check_caps_buffer (1, caps);
 
   /* third buffer is the serialized new_segment event */
-  check_segment_buffer (2);
+  check_segment_buffer (1);
 
   /* the fourth buffer is the GDP buffer for our pushed buffer */
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
@@ -179,6 +179,7 @@
   /* second buffer */
   GST_DEBUG ("second buffer");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, 0x00, 4);
 
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -198,6 +199,7 @@
   /* a third buffer without caps set explicitly; should work */
   GST_DEBUG ("Creating third buffer, no caps set");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, 0x00, 4);
 
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -319,15 +321,15 @@
   gst_caps_unref (sinkcaps);
 
   /* first buffer is the stream-start event */
-  check_stream_start_buffer (2);
+  check_stream_start_buffer (1);
 
   /* second buffer is the serialized caps;
    * the element also holds a ref to it */
-  check_caps_buffer (2, caps);
+  check_caps_buffer (1, caps);
 
   /* third buffer is the serialized new_segment event;
    * the element also holds a ref to it */
-  check_segment_buffer (2);
+  check_segment_buffer (1);
 
   /* the fourth buffer is the GDP buffer for our pushed buffer */
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
@@ -340,6 +342,7 @@
   /* second buffer */
   GST_DEBUG ("second buffer");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, 0x02, 4);
 
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -359,6 +362,7 @@
   /* a third buffer without caps set explicitly; should work */
   GST_DEBUG ("Creating third buffer, no caps set");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, 0x03, 4);
 
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
@@ -406,6 +410,7 @@
 
   GST_DEBUG ("first buffer");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, 0x01, 4);
   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 
   /* pushing should trigger an error */
@@ -441,6 +446,7 @@
 
   GST_DEBUG ("first buffer");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, 0x01, 4);
   caps = gst_caps_from_string (AUDIO_CAPS_STRING);
   gst_check_setup_events (mysrcpad, gdppay, caps, GST_FORMAT_TIME);
   gst_caps_unref (caps);
@@ -488,6 +494,7 @@
 
   GST_DEBUG ("first buffer");
   inbuffer = gst_buffer_new_and_alloc (4);
+  gst_buffer_memset (inbuffer, 0, g_random_int () & 0xff, 4);
   caps = gst_caps_from_string (AUDIO_CAPS_STRING);
   gst_check_setup_events (mysrcpad, gdppay, caps, GST_FORMAT_TIME);
 
@@ -500,16 +507,16 @@
   fail_unless_equals_int (g_list_length (buffers), 4);
 
   /* first buffer is the stream-start event */
-  check_stream_start_buffer (2);
+  check_stream_start_buffer (1);
 
   /* second buffer is the serialized caps;
    * the element also holds a ref to it */
-  check_caps_buffer (2, caps);
+  check_caps_buffer (1, caps);
 
   /* third buffer is the serialized new_segment event */
   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
   buffers = g_list_remove (buffers, outbuffer);
-  ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
+  ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
 
   /* verify the header checksum */
   /* CRC's start at 58 in the header */
diff --git a/tests/check/elements/glimagesink.c b/tests/check/elements/glimagesink.c
new file mode 100644
index 0000000..3c6bb8d
--- /dev/null
+++ b/tests/check/elements/glimagesink.c
@@ -0,0 +1,236 @@
+/* GStreamer
+ *
+ * Unit tests for glimagesink
+ *
+ * Copyright (C) 2014 Julien Isorce <j.isorce@samsung.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/check/gstcheck.h>
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGBA"))
+    );
+
+static GMainLoop *loop = NULL;
+static GstElement *sinkelement = NULL;
+static GstPad *srcpad = NULL;
+
+/* On OSX it's required to have a main loop running in the
+ * main thread while using the display connection.
+ * So the call that use this display connection needs to be
+ * done in another thread.
+ * On other platforms a direct call can be done. */
+
+#ifdef __APPLE__
+#define DO_CALL(func, data) G_STMT_START { \
+  GThread *thread = g_thread_new (NULL, \
+  (GThreadFunc) func, data); \
+  g_main_loop_run (loop); \
+  g_thread_join (thread); \
+  thread = NULL; \
+} G_STMT_END
+#else
+#define DO_CALL(func, data) func (data)
+#endif
+
+#define PAD_FUNC(name, type, param, check) \
+  static gpointer do_##name##_func (type * param) { \
+  fail_unless (gst_pad_##name (srcpad, param) == check); \
+  if (loop) \
+    g_main_loop_quit (loop); \
+  return NULL; \
+}
+
+/* *INDENT-OFF* */
+PAD_FUNC (peer_query, GstQuery, query, TRUE)
+PAD_FUNC (push, GstBuffer, buf, GST_FLOW_OK)
+/* *INDENT-ON* */
+
+static void
+setup_glimagesink (void)
+{
+  GstCaps *caps = NULL;
+
+  sinkelement = gst_check_setup_element ("glimagesink");
+  srcpad = gst_check_setup_src_pad (sinkelement, &srctemplate);
+  gst_pad_set_active (srcpad, TRUE);
+
+  caps =
+      gst_caps_from_string
+      ("video/x-raw, width=320, height=240, format=RGBA, framerate=30/1");
+  gst_check_setup_events (srcpad, sinkelement, caps, GST_FORMAT_TIME);
+  gst_caps_unref (caps);
+}
+
+static void
+cleanup_glimagesink (void)
+{
+  gst_element_set_state (sinkelement, GST_STATE_NULL);
+  gst_element_get_state (sinkelement, NULL, NULL, GST_CLOCK_TIME_NONE);
+  gst_pad_set_active (srcpad, FALSE);
+  gst_check_teardown_src_pad (sinkelement);
+  gst_check_teardown_element (sinkelement);
+}
+
+/* Verify that glimagesink releases the buffers it currently
+ * owns, upon a drain query. */
+GST_START_TEST (test_query_drain)
+{
+  GstBuffer *buf = NULL;
+  GstBufferPool *originpool = NULL;
+  GstBufferPool *pool = NULL;
+  GstCaps *caps = NULL;
+  GstQuery *query = NULL;
+  GstStructure *config = NULL;
+  gint i = 0;
+  guint min = 0;
+  guint max = 0;
+  guint size = 0;
+  const gint maxbuffers = 4;
+
+#ifdef __APPLE__
+  loop = g_main_loop_new (NULL, FALSE);
+#endif
+
+  setup_glimagesink ();
+
+  /* GstBaseSink handles the drain query as well. */
+  g_object_set (sinkelement, "enable-last-sample", TRUE, NULL);
+
+  ASSERT_SET_STATE (sinkelement, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
+
+  caps = gst_pad_get_current_caps (srcpad);
+  fail_unless (gst_caps_is_fixed (caps));
+
+  /* Let's retreive the GstGLBufferPool to change its min
+   * and max nb buffers. For that just send an allocation
+   * query and change the pool config. */
+  query = gst_query_new_allocation (caps, TRUE);
+  DO_CALL (do_peer_query_func, query);
+
+  fail_unless (gst_query_get_n_allocation_pools (query) == 1);
+
+  gst_query_parse_nth_allocation_pool (query, 0, &originpool, &size, &min,
+      &max);
+  fail_unless (originpool != NULL);
+  gst_query_unref (query);
+
+  config = gst_buffer_pool_get_config (originpool);
+  gst_buffer_pool_config_set_params (config, caps, size, maxbuffers,
+      maxbuffers);
+  fail_unless (gst_buffer_pool_set_config (originpool, config));
+
+  /* The gl pool is setup and ready to be activated. */
+  fail_unless (gst_buffer_pool_set_active (originpool, TRUE));
+
+  /* Let's build an upstream pool that will be feed with
+   * gl buffers. */
+  pool = gst_buffer_pool_new ();
+  config = gst_buffer_pool_get_config (pool);
+  gst_buffer_pool_config_set_params (config, caps, size, maxbuffers,
+      maxbuffers);
+  fail_unless (gst_buffer_pool_set_config (pool, config));
+  gst_caps_unref (caps);
+
+  fail_unless (gst_buffer_pool_set_active (pool, TRUE));
+
+  /* Unpopulate the pool and forget about its initial buffers 
+   * It is necessary because the pool has to know there are 
+   * N outstanding buffers. */
+  for (i = 0; i < maxbuffers; ++i) {
+    fail_unless (gst_buffer_pool_acquire_buffer (pool, &buf,
+            NULL) == GST_FLOW_OK);
+    gst_object_replace ((GstObject **) & buf->pool, NULL);
+    gst_buffer_unref (buf);
+  }
+
+  /* Transfer buffers from the gl pool to the upstream pool. */
+  for (i = 0; i < maxbuffers; ++i) {
+    fail_unless (gst_buffer_pool_acquire_buffer (originpool, &buf,
+            NULL) == GST_FLOW_OK);
+    gst_object_replace ((GstObject **) & buf->pool, (GstObject *) pool);
+    gst_buffer_unref (buf);
+  }
+
+  /* Push a lot of buffers like if a real pipeline was running. */
+  for (i = 0; i < 10 * maxbuffers; ++i) {
+    fail_unless (gst_buffer_pool_acquire_buffer (pool, &buf,
+            NULL) == GST_FLOW_OK);
+    DO_CALL (do_push_func, buf);
+  }
+
+  /* Claim back buffers to the upstream pool. This is the point
+   * of this unit test, i.e. this test checks that glimagesink
+   * releases the buffers it currently owns, upon drain query. */
+  query = gst_query_new_drain ();
+  DO_CALL (do_peer_query_func, query);
+
+  /* Transfer buffers back to the downstream pool to be release
+   * properly. This also make sure that all buffers are returned.
+   * Indeed gst_buffer_pool_acquire_buffer is blocking here and
+   * we have set a maximum. */
+  for (i = 0; i < maxbuffers; ++i) {
+    fail_unless (gst_buffer_pool_acquire_buffer (pool, &buf,
+            NULL) == GST_FLOW_OK);
+    gst_object_replace ((GstObject **) & buf->pool, (GstObject *) originpool);
+    gst_buffer_unref (buf);
+  }
+
+  fail_unless (gst_buffer_pool_set_active (originpool, FALSE));
+  gst_object_unref (originpool);
+
+  /* At this point the gl pool contains all its buffers. We can
+   * inactivate it to release the textures. Note that only the gl
+   * pool can release the textures properly because it has a
+   * reference on the gl context. */
+  fail_unless (gst_buffer_pool_set_active (pool, FALSE));
+  gst_object_unref (pool);
+
+  cleanup_glimagesink ();
+
+  if (loop)
+    g_main_loop_unref (loop);
+}
+
+GST_END_TEST;
+
+static Suite *
+glimagesink_suite (void)
+{
+  Suite *s = suite_create ("glimagesink");
+  TCase *tc = tcase_create ("general");
+
+  tcase_set_timeout (tc, 5);
+
+  tcase_add_checked_fixture (tc, setup_glimagesink, NULL);
+  tcase_add_test (tc, test_query_drain);
+  suite_add_tcase (s, tc);
+
+  return s;
+}
+
+GST_CHECK_MAIN (glimagesink)
diff --git a/tests/check/elements/h264parse.c b/tests/check/elements/h264parse.c
index 6ee6e75..d2515e8 100644
--- a/tests/check/elements/h264parse.c
+++ b/tests/check/elements/h264parse.c
@@ -381,7 +381,8 @@
   cdata =
       gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, h264_codec_data,
       h264_codec_data_size, 0, h264_codec_data_size, NULL, NULL);
-  gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, cdata, NULL);
+  gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, cdata,
+      "stream-format", G_TYPE_STRING, "avc", NULL);
   gst_buffer_unref (cdata);
   desc = gst_caps_to_string (caps);
   gst_caps_unref (caps);
diff --git a/tests/check/elements/hlsdemux_m3u8.c b/tests/check/elements/hlsdemux_m3u8.c
new file mode 100644
index 0000000..4ca9840
--- /dev/null
+++ b/tests/check/elements/hlsdemux_m3u8.c
@@ -0,0 +1,1363 @@
+/* GStreamer
+ *
+ * unit test for hlsdemux
+ *
+ * Copyright (C) <2012> Fluendo S.A <support@fluendo.com>
+ *  Authors: Andoni Morales Alastruey <amorales@fluendo.com>
+ * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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 <unistd.h>
+
+#include <gst/check/gstcheck.h>
+
+#undef GST_CAT_DEFAULT
+#include "m3u8.h"
+#include "m3u8.c"
+
+GST_DEBUG_CATEGORY (fragmented_debug);
+
+static const gchar *INVALID_PLAYLIST = "#EXTM3 UINVALID";
+
+static const gchar *ON_DEMAND_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10,Test\n\
+http://media.example.com/001.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/002.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/003.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/004.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *DOUBLES_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10.321,Test\n\
+http://media.example.com/001.ts\n\
+#EXTINF:9.6789,Test\n\
+http://media.example.com/002.ts\n\
+#EXTINF:10.2344,Test\n\
+http://media.example.com/003.ts\n\
+#EXTINF:9.92,Test\n\
+http://media.example.com/004.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *LIVE_PLAYLIST = "#EXTM3U\n\
+#EXT-X-TARGETDURATION:8\n\
+#EXT-X-MEDIA-SEQUENCE:2680\n\
+\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence2680.ts\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence2681.ts\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence2682.ts\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence2683.ts";
+
+static const gchar *LIVE_ROTATED_PLAYLIST = "#EXTM3U\n\
+#EXT-X-TARGETDURATION:8\n\
+#EXT-X-MEDIA-SEQUENCE:3001\n\
+\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence3001.ts\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence3002.ts\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence3003.ts\n\
+#EXTINF:8,\n\
+https://priv.example.com/fileSequence3004.ts";
+
+static const gchar *VARIANT_PLAYLIST = "#EXTM3U \n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=128000\n\
+http://example.com/low.m3u8\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000\n\
+http://example.com/mid.m3u8\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768000\n\
+http://example.com/hi.m3u8\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS=\"mp4a.40.5\"\n\
+http://example.com/audio-only.m3u8";
+
+static const gchar *EMPTY_LINES_VARIANT_PLAYLIST = "#EXTM3U \n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=128000\n\n\
+http://example.com/low.m3u8\n\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000\n\n\
+http://example.com/mid.m3u8\n\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768000\n\n\
+http://example.com/hi.m3u8\n\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS=\"mp4a.40.5\"\n\n\
+http://example.com/audio-only.m3u8";
+
+static const gchar *WINDOWS_EMPTY_LINES_VARIANT_PLAYLIST = "#EXTM3U \r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=128000\r\n\r\n\
+http://example.com/low.m3u8\r\n\r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000\r\n\r\n\
+http://example.com/mid.m3u8\r\n\r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768000\r\n\r\n\
+http://example.com/hi.m3u8\r\n\r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS=\"mp4a.40.5\"\r\n\r\n\
+http://example.com/audio-only.m3u8";
+
+static const gchar *EMPTY_LINES_PLAYLIST = "#EXTM3U \n\n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10,Testr\n\n\
+http://media.example.com/001.ts\n\n\
+#EXTINF:10,Test\n\n\
+http://media.example.com/002.ts\n\n\
+#EXTINF:10,Test\n\n\
+http://media.example.com/003.ts\n\n\
+#EXTINF:10,Test\n\n\
+http://media.example.com/004.ts\n\n\
+#EXT-X-ENDLIST";
+
+static const gchar *WINDOWS_EMPTY_LINES_PLAYLIST = "#EXTM3U \r\n\
+#EXT-X-TARGETDURATION:10\r\n\r\n\
+#EXTINF:10,Test\r\n\r\n\
+http://media.example.com/001.ts\r\n\r\n\
+#EXTINF:10,Test\r\n\r\n\
+http://media.example.com/002.ts\r\n\r\n\
+#EXTINF:10,Test\r\n\r\n\
+http://media.example.com/003.ts\r\n\r\n\
+#EXTINF:10,Test\r\n\r\n\
+http://media.example.com/004.ts\r\n\r\n\
+#EXT-X-ENDLIST";
+
+static const gchar *BYTE_RANGES_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:40\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000@100\n\
+http://media.example.com/all.ts\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000@1000\n\
+http://media.example.com/all.ts\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000@2000\n\
+http://media.example.com/all.ts\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000@3000\n\
+http://media.example.com/all.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *BYTE_RANGES_ACC_OFFSET_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:40\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000\n\
+http://media.example.com/all.ts\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000\n\
+http://media.example.com/all.ts\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000\n\
+http://media.example.com/all.ts\n\
+#EXTINF:10,Test\n\
+#EXT-X-BYTERANGE:1000\n\
+http://media.example.com/all.ts\n\
+#EXT-X-ENDLIST";
+
+#if 0
+static const gchar *ALTERNATE_AUDIO_PLAYLIST = "#EXTM3U\n\
+#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"aac\",NAME=\"English\",\
+  DEFAULT=YES,AUTOSELECT=YES,LANGUAGE=\"en\" \n\
+#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"aac\",NAME=\"Deutsche\",\
+  DEFAULT=NO,AUTOSELECT=YES,LANGUAGE=\"de\",\
+  URI=\"http://localhost/main/german-audio.m3u8\"\n\
+#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"aac\",NAME=\"Commentary\",\
+  DEFAULT=NO,AUTOSELECT=NO,\
+  URI=\"http://localhost/commentary/audio-only.m3u8\"\n\
+#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS=\"avc1.42001f\",AUDIO=\"aac\"\n\
+low/video-only.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=256000,CODECS=\"avc1.42001f\",AUDIO=\"aac\"\n\
+mid/video-only.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=768000,CODECS=\"avc1.42001f\",AUDIO=\"aac\"\n\
+hi/video-only.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS=\"mp4a.40.5\",AUDIO=\"aac\"\n\
+main/english-audio.m3u8";
+
+static const gchar *ALT_AUDIO_PLAYLIST_WITH_VIDEO_AUDIO = "#EXTM3U\n\
+#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"aac\",NAME=\"English\",\
+  DEFAULT=YES,AUTOSELECT=YES,LANGUAGE=\"en\" \n\
+#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"aac\",NAME=\"Deutsche\",\
+  DEFAULT=NO,AUTOSELECT=YES,LANGUAGE=\"de\",\
+  URI=\"http://localhost/main/german-audio.m3u8\"\n\
+#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"aac\",NAME=\"Commentary\",\
+  DEFAULT=NO,AUTOSELECT=NO,\
+  URI=\"http://localhost/commentary/audio-only.m3u8\"\n\
+#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS=\"avc1.42001f, mp4a.40.5\",AUDIO=\"aac\"\n\
+low/video-audio.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=256000,CODECS=\"avc1.42001f, mp4a.40.5\",AUDIO=\"aac\"\n\
+mid/video-audio.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=768000,CODECS=\"avc1.42001f, mp4a.40.5\",AUDIO=\"aac\"\n\
+hi/video-audio.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS=\"mp4a.40.5\",AUDIO=\"aac\"\n\
+main/english-audio.m3u8";
+
+static const gchar *ON_DEMAND_LOW_VIDEO_ONLY_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10,Test\n\
+http://media.example.com/low/video-only-001.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/low/video-only-002.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/low/video-only-003.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/low/video-only-004.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *ON_DEMAND_MID_VIDEO_ONLY_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-001.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-002.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-003.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-004.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *ON_DEMAND_ENGLISH_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/english-001.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/english-002.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/english-003.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/english-004.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *ON_DEMAND_GERMAN_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/german-001.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/german-002.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/german-003.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/audio/german-004.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *SUBTITLES_PLAYLIST = "#EXTM3U\n\
+#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"English\",\
+  DEFAULT=YES,LANGUAGE=\"en\",\
+  URI=\"http://localhost/main/subs-en.m3u8\"\n\
+#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Deutsche\",\
+  DEFAULT=NO,LANGUAGE=\"de\",\
+  URI=\"http://localhost/main/subs-de.m3u8\"\n\
+#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"Spanish\",\
+  DEFAULT=NO,LANGUAGE=\"es\",\
+  URI=\"http://localhost/main/subs-es.m3u8\"\n\
+#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS=\"avc1.42001f, mp4a.40.5\",SUBTITLES=\"subs\"\n\
+low/video-audio.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=256000,CODECS=\"avc1.42001f, mp4a.40.5\",SUBTITLES=\"subs\"\n\
+mid/video-audio.m3u8\n\
+#EXT-X-STREAM-INF:BANDWIDTH=768000,CODECS=\"avc1.42001f, mp4a.40.5\",SUBTITLES=\"subs\"\n\
+hi/video-audio.m3u8";
+#endif
+
+static const gchar *AES_128_ENCRYPTED_PLAYLIST = "#EXTM3U \n\
+#EXT-X-TARGETDURATION:10\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-001.ts\n\
+#EXT-X-KEY:METHOD=NONE\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-002.ts\n\
+#EXT-X-KEY:METHOD=AES-128,URI=\"https://priv.example.com/key.bin\"\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-003.ts\n\
+#EXT-X-KEY:METHOD=AES-128,URI=\"https://priv.example.com/key2.bin\",IV=0x00000000000000000000000000000001\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-004.ts\n\
+#EXTINF:10,Test\n\
+http://media.example.com/mid/video-only-005.ts\n\
+#EXT-X-ENDLIST";
+
+static const gchar *WINDOWS_LINE_ENDINGS_PLAYLIST = "#EXTM3U \r\n\
+#EXT-X-TARGETDURATION:10\r\n\
+#EXTINF:10,Test\r\n\
+http://media.example.com/001.ts\r\n\
+#EXTINF:10,Test\r\n\
+http://media.example.com/002.ts\r\n\
+#EXTINF:10,Test\r\n\
+http://media.example.com/003.ts\r\n\
+#EXTINF:10,Test\r\n\
+http://media.example.com/004.ts\r\n\
+#EXT-X-ENDLIST";
+
+static const gchar *WINDOWS_LINE_ENDINGS_VARIANT_PLAYLIST = "#EXTM3U \r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=128000\r\n\
+http://example.com/low.m3u8\r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000\r\n\
+http://example.com/mid.m3u8\r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768000\r\n\
+http://example.com/hi.m3u8\r\n\
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS=\"mp4a.40.5\"\r\n\
+http://example.com/audio-only.m3u8";
+
+static GstM3U8Client *
+load_playlist (const gchar * data)
+{
+  gboolean ret;
+  GstM3U8Client *client;
+
+  client = gst_m3u8_client_new ("http://localhost/test.m3u8", NULL);
+  ret = gst_m3u8_client_update (client, g_strdup (data));
+  assert_equals_int (ret, TRUE);
+
+  return client;
+}
+
+GST_START_TEST (test_load_main_playlist_invalid)
+{
+  gboolean ret;
+  GstM3U8Client *client =
+      gst_m3u8_client_new ("http://localhost/test.m3u8", NULL);
+
+  ret = gst_m3u8_client_update (client, g_strdup (INVALID_PLAYLIST));
+  assert_equals_int (ret, FALSE);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_load_main_playlist_rendition)
+{
+  GstM3U8Client *client;
+
+  client = load_playlist (ON_DEMAND_PLAYLIST);
+
+  assert_equals_int (g_list_length (client->main->files), 4);
+  assert_equals_int (g_list_length (client->current->files), 4);
+  assert_equals_int (client->sequence, 0);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+static void
+do_test_load_main_playlist_variant (const gchar * playlist)
+{
+  GstM3U8Client *client;
+  GstM3U8 *stream;
+  GList *tmp;
+
+  client = load_playlist (playlist);
+
+  assert_equals_int (g_list_length (client->main->lists), 4);
+
+  /* Audio-Only */
+  tmp = g_list_first (client->main->lists);
+  stream = GST_M3U8 (tmp->data);
+  assert_equals_int (stream->bandwidth, 65000);
+  assert_equals_int (stream->program_id, 1);
+  assert_equals_string (stream->uri, "http://example.com/audio-only.m3u8");
+  assert_equals_string (stream->codecs, "\"mp4a.40.5\"");
+
+  /* Low */
+  tmp = g_list_next (tmp);
+  stream = GST_M3U8 (tmp->data);
+  assert_equals_int (stream->bandwidth, 128000);
+  assert_equals_int (stream->program_id, 1);
+  assert_equals_string (stream->uri, "http://example.com/low.m3u8");
+
+  /* Mid */
+  tmp = g_list_next (tmp);
+  stream = GST_M3U8 (tmp->data);
+  assert_equals_int (stream->bandwidth, 256000);
+  assert_equals_int (stream->program_id, 1);
+  assert_equals_string (stream->uri, "http://example.com/mid.m3u8");
+
+  /* High */
+  tmp = g_list_next (tmp);
+  stream = GST_M3U8 (tmp->data);
+  assert_equals_int (stream->bandwidth, 768000);
+  assert_equals_int (stream->program_id, 1);
+  assert_equals_string (stream->uri, "http://example.com/hi.m3u8");
+
+  /* Check the first playlist is selected */
+  assert_equals_int (client->current != NULL, TRUE);
+  assert_equals_int (client->current->bandwidth, 128000);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_START_TEST (test_load_main_playlist_variant)
+{
+  do_test_load_main_playlist_variant (VARIANT_PLAYLIST);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_load_windows_line_endings_variant_playlist)
+{
+  do_test_load_main_playlist_variant (WINDOWS_LINE_ENDINGS_VARIANT_PLAYLIST);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_load_main_playlist_with_empty_lines)
+{
+  do_test_load_main_playlist_variant (EMPTY_LINES_VARIANT_PLAYLIST);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_load_windows_main_playlist_with_empty_lines)
+{
+  do_test_load_main_playlist_variant (WINDOWS_EMPTY_LINES_VARIANT_PLAYLIST);
+}
+
+GST_END_TEST;
+
+static void
+check_on_demand_playlist (const gchar * data)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  GstM3U8MediaFile *file;
+
+  client = load_playlist (data);
+  pl = client->current;
+
+  /* Sequence should be 0 as it's an ondemand playlist */
+  assert_equals_int (client->sequence, 0);
+  /* Check that we are not live */
+  assert_equals_int (gst_m3u8_client_is_live (client), FALSE);
+  /* Check number of entries */
+  assert_equals_int (g_list_length (pl->files), 4);
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_first (pl->files)->data);
+  assert_equals_string (file->uri, "http://media.example.com/001.ts");
+  assert_equals_int (file->sequence, 0);
+  /* Check last media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_last (pl->files)->data);
+  assert_equals_string (file->uri, "http://media.example.com/004.ts");
+  assert_equals_int (file->sequence, 3);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_START_TEST (test_on_demand_playlist)
+{
+  check_on_demand_playlist (ON_DEMAND_PLAYLIST);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_windows_line_endings_playlist)
+{
+  check_on_demand_playlist (WINDOWS_LINE_ENDINGS_PLAYLIST);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_empty_lines_playlist)
+{
+  check_on_demand_playlist (EMPTY_LINES_PLAYLIST);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_windows_empty_lines_playlist)
+{
+  check_on_demand_playlist (WINDOWS_EMPTY_LINES_PLAYLIST);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_live_playlist)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  GstM3U8MediaFile *file;
+
+  client = load_playlist (LIVE_PLAYLIST);
+
+  pl = client->current;
+  /* Check that we are live */
+  assert_equals_int (gst_m3u8_client_is_live (client), TRUE);
+  assert_equals_int (client->sequence, 2681);
+  /* Check number of entries */
+  assert_equals_int (g_list_length (pl->files), 4);
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_first (pl->files)->data);
+  assert_equals_string (file->uri,
+      "https://priv.example.com/fileSequence2680.ts");
+  assert_equals_int (file->sequence, 2680);
+  /* Check last media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_last (pl->files)->data);
+  assert_equals_string (file->uri,
+      "https://priv.example.com/fileSequence2683.ts");
+  assert_equals_int (file->sequence, 2683);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+/* This test is for live sreams in which we pause the stream for more than the
+ * DVR window and we resume playback. The playlist has rotated completely and
+ * there is a jump in the media sequence that must be handled correctly. */
+GST_START_TEST (test_live_playlist_rotated)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  GstM3U8MediaFile *file;
+  gboolean ret;
+
+  client = load_playlist (LIVE_PLAYLIST);
+  pl = client->current;
+  assert_equals_int (client->sequence, 2681);
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_first (pl->files)->data);
+  assert_equals_int (file->sequence, 2680);
+
+  ret = gst_m3u8_client_update (client, g_strdup (LIVE_ROTATED_PLAYLIST));
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_next_fragment (client, NULL, NULL, NULL, NULL, NULL, NULL,
+      NULL, NULL, TRUE);
+  /* FIXME: Sequence should last - 3. Should it? */
+  assert_equals_int (client->sequence, 3001);
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_first (pl->files)->data);
+  assert_equals_int (file->sequence, 3001);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_playlist_with_doubles_duration)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  GstM3U8MediaFile *file;
+
+  client = load_playlist (DOUBLES_PLAYLIST);
+
+  pl = client->current;
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 0));
+  assert_equals_uint64 (file->duration, 10.321 * GST_SECOND);
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 1));
+  assert_equals_uint64 (file->duration, 9.6789 * GST_SECOND);
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 2));
+  assert_equals_uint64 (file->duration, 10.2344 * GST_SECOND);
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 3));
+  assert_equals_uint64 (file->duration, 9.92 * GST_SECOND);
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_playlist_with_encryption)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  GstM3U8MediaFile *file;
+  guint8 iv1[16] = { 0, };
+  guint8 iv2[16] = { 0, };
+
+  iv1[15] = 1;
+  iv2[15] = 2;
+
+  client = load_playlist (AES_128_ENCRYPTED_PLAYLIST);
+
+  pl = client->current;
+  assert_equals_int (g_list_length (pl->files), 5);
+
+  /* Check all media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 0));
+  fail_unless (file->key == NULL);
+
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 1));
+  fail_unless (file->key == NULL);
+
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 2));
+  fail_unless (file->key != NULL);
+  assert_equals_string (file->key, "https://priv.example.com/key.bin");
+  fail_unless (memcmp (&file->iv, iv2, 16) == 0);
+
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 3));
+  fail_unless (file->key != NULL);
+  assert_equals_string (file->key, "https://priv.example.com/key2.bin");
+  fail_unless (memcmp (&file->iv, iv1, 16) == 0);
+
+  file = GST_M3U8_MEDIA_FILE (g_list_nth_data (pl->files, 4));
+  fail_unless (file->key != NULL);
+  assert_equals_string (file->key, "https://priv.example.com/key2.bin");
+  fail_unless (memcmp (&file->iv, iv1, 16) == 0);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_update_invalid_playlist)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  gboolean ret;
+
+  /* Test updates in on-demand playlists */
+  client = load_playlist (ON_DEMAND_PLAYLIST);
+  pl = client->current;
+  assert_equals_int (g_list_length (pl->files), 4);
+  ret = gst_m3u8_client_update (client, g_strdup ("#INVALID"));
+  assert_equals_int (ret, FALSE);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_update_playlist)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  gchar *live_pl;
+  gboolean ret;
+
+  /* Test updates in on-demand playlists */
+  client = load_playlist (ON_DEMAND_PLAYLIST);
+  pl = client->current;
+  assert_equals_int (g_list_length (pl->files), 4);
+  ret = gst_m3u8_client_update (client, g_strdup (ON_DEMAND_PLAYLIST));
+  assert_equals_int (ret, TRUE);
+  assert_equals_int (g_list_length (pl->files), 4);
+  gst_m3u8_client_free (client);
+
+  /* Test updates in live playlists */
+  client = load_playlist (LIVE_PLAYLIST);
+  pl = client->current;
+  assert_equals_int (g_list_length (pl->files), 4);
+  /* Add a new entry to the playlist and check the update */
+  live_pl = g_strdup_printf ("%s\n%s\n%s", LIVE_PLAYLIST, "#EXTINF:8",
+      "https://priv.example.com/fileSequence2683.ts");
+  ret = gst_m3u8_client_update (client, live_pl);
+  assert_equals_int (ret, TRUE);
+  assert_equals_int (g_list_length (pl->files), 5);
+  /* Test sliding window */
+  ret = gst_m3u8_client_update (client, g_strdup (LIVE_PLAYLIST));
+  assert_equals_int (ret, TRUE);
+  assert_equals_int (g_list_length (pl->files), 4);
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_playlist_media_files)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  GstM3U8MediaFile *file;
+
+  client = load_playlist (ON_DEMAND_PLAYLIST);
+  pl = client->current;
+
+  /* Check number of entries */
+  assert_equals_int (g_list_length (pl->files), 4);
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_first (pl->files)->data);
+  assert_equals_string (file->uri, "http://media.example.com/001.ts");
+  assert_equals_int (file->sequence, 0);
+  assert_equals_float (file->duration, 10 * (double) GST_SECOND);
+  assert_equals_int (file->offset, 0);
+  assert_equals_int (file->size, -1);
+  assert_equals_string (file->title, "Test");
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_playlist_byte_range_media_files)
+{
+  GstM3U8Client *client;
+  GstM3U8 *pl;
+  GstM3U8MediaFile *file;
+
+  client = load_playlist (BYTE_RANGES_PLAYLIST);
+  pl = client->current;
+
+  /* Check number of entries */
+  assert_equals_int (g_list_length (pl->files), 4);
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_first (pl->files)->data);
+  assert_equals_string (file->uri, "http://media.example.com/all.ts");
+  assert_equals_int (file->sequence, 0);
+  assert_equals_float (file->duration, 10 * (double) GST_SECOND);
+  assert_equals_int (file->offset, 100);
+  assert_equals_int (file->size, 1000);
+  /* Check last media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_last (pl->files)->data);
+  assert_equals_string (file->uri, "http://media.example.com/all.ts");
+  assert_equals_int (file->sequence, 3);
+  assert_equals_float (file->duration, 10 * (double) GST_SECOND);
+  assert_equals_int (file->offset, 3000);
+  assert_equals_int (file->size, 1000);
+
+  gst_m3u8_client_free (client);
+
+
+  client = load_playlist (BYTE_RANGES_ACC_OFFSET_PLAYLIST);
+  pl = client->current;
+
+  /* Check number of entries */
+  assert_equals_int (g_list_length (pl->files), 4);
+  /* Check first media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_first (pl->files)->data);
+  assert_equals_string (file->uri, "http://media.example.com/all.ts");
+  assert_equals_int (file->sequence, 0);
+  assert_equals_float (file->duration, 10 * (double) GST_SECOND);
+  assert_equals_int (file->offset, 0);
+  assert_equals_int (file->size, 1000);
+  /* Check last media segments */
+  file = GST_M3U8_MEDIA_FILE (g_list_last (pl->files)->data);
+  assert_equals_string (file->uri, "http://media.example.com/all.ts");
+  assert_equals_int (file->sequence, 3);
+  assert_equals_float (file->duration, 10 * (double) GST_SECOND);
+  assert_equals_int (file->offset, 3000);
+  assert_equals_int (file->size, 1000);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_get_next_fragment)
+{
+  GstM3U8Client *client;
+  gboolean discontinous;
+  gchar *uri;
+  GstClockTime duration, timestamp;
+  gint64 range_start, range_end;
+
+  client = load_playlist (BYTE_RANGES_PLAYLIST);
+
+  /* Check the next fragment */
+  gst_m3u8_client_get_next_fragment (client, &discontinous, &uri, &duration,
+      &timestamp, &range_start, &range_end, NULL, NULL, TRUE);
+  assert_equals_int (discontinous, FALSE);
+  assert_equals_string (uri, "http://media.example.com/all.ts");
+  assert_equals_uint64 (timestamp, 0);
+  assert_equals_uint64 (duration, 10 * GST_SECOND);
+  assert_equals_uint64 (range_start, 100);
+  assert_equals_uint64 (range_end, 1099);
+  g_free (uri);
+
+  gst_m3u8_client_advance_fragment (client, TRUE);
+
+  /* Check next media segments */
+  gst_m3u8_client_get_next_fragment (client, &discontinous, &uri, &duration,
+      &timestamp, &range_start, &range_end, NULL, NULL, TRUE);
+  assert_equals_int (discontinous, FALSE);
+  assert_equals_string (uri, "http://media.example.com/all.ts");
+  assert_equals_uint64 (timestamp, 10 * GST_SECOND);
+  assert_equals_uint64 (duration, 10 * GST_SECOND);
+  assert_equals_uint64 (range_start, 1000);
+  assert_equals_uint64 (range_end, 1999);
+  g_free (uri);
+
+  gst_m3u8_client_advance_fragment (client, TRUE);
+
+  /* Check next media segments */
+  gst_m3u8_client_get_next_fragment (client, &discontinous, &uri, &duration,
+      &timestamp, &range_start, &range_end, NULL, NULL, TRUE);
+  assert_equals_int (discontinous, FALSE);
+  assert_equals_string (uri, "http://media.example.com/all.ts");
+  assert_equals_uint64 (timestamp, 20 * GST_SECOND);
+  assert_equals_uint64 (duration, 10 * GST_SECOND);
+  assert_equals_uint64 (range_start, 2000);
+  assert_equals_uint64 (range_end, 2999);
+  g_free (uri);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_get_duration)
+{
+  GstM3U8Client *client;
+
+  /* Test duration for on-demand playlists */
+  client = load_playlist (ON_DEMAND_PLAYLIST);
+  assert_equals_uint64 (gst_m3u8_client_get_duration (client), 40 * GST_SECOND);
+  gst_m3u8_client_free (client);
+
+  /* Test duration for live playlists */
+  client = load_playlist (LIVE_PLAYLIST);
+  assert_equals_uint64 (gst_m3u8_client_get_duration (client),
+      GST_CLOCK_TIME_NONE);
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_get_target_duration)
+{
+  GstM3U8Client *client;
+
+  client = load_playlist (ON_DEMAND_PLAYLIST);
+  assert_equals_uint64 (gst_m3u8_client_get_target_duration (client),
+      10 * GST_SECOND);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+
+GST_START_TEST (test_get_stream_for_bitrate)
+{
+  GstM3U8Client *client;
+  GstM3U8 *stream;
+
+  client = load_playlist (VARIANT_PLAYLIST);
+  stream = gst_m3u8_client_get_playlist_for_bitrate (client, 0)->data;
+  assert_equals_int (stream->bandwidth, 65000);
+  stream = gst_m3u8_client_get_playlist_for_bitrate (client, G_MAXINT32)->data;
+  assert_equals_int (stream->bandwidth, 768000);
+  stream = gst_m3u8_client_get_playlist_for_bitrate (client, 300000)->data;
+  assert_equals_int (stream->bandwidth, 256000);
+  stream = gst_m3u8_client_get_playlist_for_bitrate (client, 500000)->data;
+  assert_equals_int (stream->bandwidth, 256000);
+  stream = gst_m3u8_client_get_playlist_for_bitrate (client, 255000)->data;
+  assert_equals_int (stream->bandwidth, 128000);
+
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+#if 0
+static void
+do_test_seek (GstM3U8Client * client, guint seek_pos, gint pos)
+{
+  GstClockTime cur_pos;
+  gboolean ret;
+
+  ret = gst_m3u8_client_seek (client, seek_pos * GST_SECOND);
+  if (pos == -1) {
+    assert_equals_int (ret, FALSE);
+    return;
+  }
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_current_position (client, &cur_pos, NULL);
+  assert_equals_uint64 (cur_pos, pos * GST_SECOND);
+}
+
+GST_START_TEST (test_seek)
+{
+  GstM3U8Client *client;
+
+  client = load_playlist (ON_DEMAND_PLAYLIST);
+
+  /* Test seek in the middle of a fragment */
+  do_test_seek (client, 1, 0);
+  do_test_seek (client, 11, 10);
+  do_test_seek (client, 22, 20);
+  do_test_seek (client, 39, 30);
+
+  /* Test exact seeks */
+  do_test_seek (client, 0, 0);
+  do_test_seek (client, 10, 10);
+  do_test_seek (client, 20, 20);
+  do_test_seek (client, 30, 30);
+
+  /* Test invalid seeks (end if list should be 30 + 10) */
+  do_test_seek (client, 39, 30);
+  do_test_seek (client, 40, -1);
+  gst_m3u8_client_free (client);
+
+  /* Test seeks on a live playlist */
+  client = load_playlist (LIVE_PLAYLIST);
+  do_test_seek (client, 0, 0);
+
+  do_test_seek (client, 8, 8);
+  do_test_seek (client, 20, 16);
+  do_test_seek (client, 30, 24);
+
+  do_test_seek (client, 3000, -1);
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_alternate_audio_playlist)
+{
+  GstM3U8Client *client;
+  GstM3U8Media *media;
+  GList *alternates;
+
+  client = load_playlist (ALTERNATE_AUDIO_PLAYLIST);
+
+  assert_equals_int (g_list_length (client->main->streams), 4);
+  assert_equals_int (g_hash_table_size (client->main->video_rendition_groups),
+      0);
+  assert_equals_int (g_hash_table_size (client->main->audio_rendition_groups),
+      1);
+  assert_equals_int (g_hash_table_size (client->
+          selected_stream->audio_alternates), 3);
+  assert_equals_int (g_hash_table_size (client->
+          selected_stream->video_alternates), 0);
+
+  alternates =
+      g_hash_table_lookup (client->main->audio_rendition_groups, "aac");
+  assert_equals_int (alternates != NULL, TRUE);
+  media = GST_M3U8_MEDIA (g_list_nth_data (alternates, 0));
+  assert_equals_int (media->media_type, GST_M3U8_MEDIA_TYPE_AUDIO);
+  assert_equals_string (media->group_id, "aac");
+  assert_equals_string (media->name, "English");
+  assert_equals_string (media->language, "en");
+  assert_equals_string (media->uri, "http://localhost/main/english-audio.m3u8");
+  assert_equals_string (media->uri, GST_M3U8 (media->playlist)->uri);
+  assert_equals_int (media->is_default, TRUE);
+  assert_equals_int (media->autoselect, TRUE);
+
+  assert_equals_int (g_hash_table_size (client->
+          selected_stream->audio_alternates), 3);
+  /* Check the list of audio alternates */
+  alternates = gst_m3u8_client_get_alternates (client,
+      GST_M3U8_MEDIA_TYPE_AUDIO);
+  assert_equals_int (g_list_length (alternates), 3);
+  /* Default comes always first */
+  assert_equals_string (g_list_nth_data (alternates, 0), "English");
+  assert_equals_string (g_list_nth_data (alternates, 1), "Commentary");
+  assert_equals_string (g_list_nth_data (alternates, 2), "Deutsche");
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_subtitles_playlist)
+{
+  GstM3U8Client *client;
+  GstM3U8Media *media;
+  GList *alternates;
+
+  client = load_playlist (SUBTITLES_PLAYLIST);
+
+  assert_equals_int (g_list_length (client->main->streams), 3);
+  assert_equals_int (g_hash_table_size (client->main->video_rendition_groups),
+      0);
+  assert_equals_int (g_hash_table_size (client->main->audio_rendition_groups),
+      0);
+  assert_equals_int (g_hash_table_size (client->main->subtt_rendition_groups),
+      1);
+  assert_equals_int (g_hash_table_size (client->
+          selected_stream->audio_alternates), 0);
+  assert_equals_int (g_hash_table_size (client->
+          selected_stream->video_alternates), 0);
+  assert_equals_int (g_hash_table_size (client->
+          selected_stream->subtt_alternates), 3);
+
+  alternates =
+      g_hash_table_lookup (client->main->subtt_rendition_groups, "subs");
+  assert_equals_int (alternates != NULL, TRUE);
+  media = GST_M3U8_MEDIA (g_list_nth_data (alternates, 0));
+  assert_equals_int (media->media_type, GST_M3U8_MEDIA_TYPE_SUBTITLES);
+  assert_equals_string (media->group_id, "subs");
+  assert_equals_string (media->name, "English");
+  assert_equals_string (media->language, "en");
+  assert_equals_string (media->uri, "http://localhost/main/subs-en.m3u8");
+  assert_equals_string (media->uri, GST_M3U8 (media->playlist)->uri);
+  assert_equals_int (media->is_default, TRUE);
+  assert_equals_int (media->autoselect, FALSE);
+
+  /* Check the list of subtitles */
+  alternates = gst_m3u8_client_get_alternates (client,
+      GST_M3U8_MEDIA_TYPE_SUBTITLES);
+  assert_equals_int (g_list_length (alternates), 3);
+  assert_equals_string (g_list_nth_data (alternates, 0), "Deutsche");
+  assert_equals_string (g_list_nth_data (alternates, 1), "Spanish");
+  assert_equals_string (g_list_nth_data (alternates, 2), "English");
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+GST_START_TEST (test_select_subs_alternate)
+{
+  GstM3U8Client *client;
+  const gchar *a_uri, *v_uri, *s_uri;
+  gboolean ret;
+
+  /* Check with a playlist with alternative audio renditions where the video
+   * stream is video-only and therefor we always have 2 playlists, one for
+   * video and another one for audio */
+  client = load_playlist (SUBTITLES_PLAYLIST);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri == NULL, TRUE);
+  assert_equals_int (s_uri != NULL, TRUE);
+  assert_equals_string (s_uri, "http://localhost/main/subs-de.m3u8");
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-audio.m3u8");
+
+  ret =
+      gst_m3u8_client_set_alternate (client, GST_M3U8_MEDIA_TYPE_SUBTITLES,
+      "English");
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri == NULL, TRUE);
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-audio.m3u8");
+  assert_equals_int (s_uri != NULL, TRUE);
+  assert_equals_string (s_uri, "http://localhost/main/subs-en.m3u8");
+
+  ret =
+      gst_m3u8_client_set_alternate (client, GST_M3U8_MEDIA_TYPE_SUBTITLES,
+      "Spanish");
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri == NULL, TRUE);
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-audio.m3u8");
+  assert_equals_int (s_uri != NULL, TRUE);
+  assert_equals_string (s_uri, "http://localhost/main/subs-es.m3u8");
+
+  ret =
+      gst_m3u8_client_set_alternate (client, GST_M3U8_MEDIA_TYPE_SUBTITLES,
+      NULL);
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri == NULL, TRUE);
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-audio.m3u8");
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+GST_START_TEST (test_select_alternate)
+{
+  GstM3U8Client *client;
+  const gchar *a_uri, *v_uri, *s_uri;
+  gboolean ret;
+
+  /* Check with a playlist with alternative audio renditions where the video
+   * stream is video-only and therefor we always have 2 playlists, one for
+   * video and another one for audio */
+  client = load_playlist (ALTERNATE_AUDIO_PLAYLIST);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/english-audio.m3u8");
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-only.m3u8");
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  ret =
+      gst_m3u8_client_set_alternate (client, GST_M3U8_MEDIA_TYPE_AUDIO,
+      "Deutsche");
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/german-audio.m3u8");
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-only.m3u8");
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  /* Check that selecting the audio-only fallback stream we only have the audio
+   * uri */
+  gst_m3u8_client_set_current (client,
+      GST_M3U8_STREAM (client->main->streams->data));
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/german-audio.m3u8");
+  assert_equals_int (v_uri == NULL, TRUE);
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  gst_m3u8_client_free (client);
+
+  /* Now check with a playlist with alternative audio renditions where the
+   * video * stream has the default audio rendition muxed and therefore we
+   * only have 2 playlists when the audio alternative rendition is not the
+   * default one */
+  client = load_playlist (ALT_AUDIO_PLAYLIST_WITH_VIDEO_AUDIO);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri == NULL, TRUE);
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-audio.m3u8");
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  /* Check that selecting the audio-only fallback stream we only have the audio
+   * uri */
+  gst_m3u8_client_set_current (client,
+      GST_M3U8_STREAM (client->main->streams->data));
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/english-audio.m3u8");
+  assert_equals_int (v_uri == NULL, TRUE);
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  /* Get back to the audio-video stream */
+  gst_m3u8_client_set_current (client,
+      GST_M3U8_STREAM (client->main->streams->next->data));
+  /* Now set a different audio and check that we have 2 playlists */
+  ret =
+      gst_m3u8_client_set_alternate (client, GST_M3U8_MEDIA_TYPE_AUDIO,
+      "Deutsche");
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/german-audio.m3u8");
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-audio.m3u8");
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_simulation)
+{
+  GstM3U8Client *client;
+  const gchar *a_uri, *v_uri, *s_uri;
+  GstFragment *a_frag, *v_frag, *s_frag;
+  gboolean ret;
+
+  client = load_playlist (ALTERNATE_AUDIO_PLAYLIST);
+  /* The default selection should be audio-only, which only has audio and not
+   * video */
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/english-audio.m3u8");
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/low/video-only.m3u8");
+  assert_equals_int (s_uri == NULL, TRUE);
+
+  /* Update the playlists */
+  ret = gst_m3u8_client_update (client,
+      g_strdup (ON_DEMAND_LOW_VIDEO_ONLY_PLAYLIST),
+      g_strdup (ON_DEMAND_ENGLISH_PLAYLIST), NULL);
+  assert_equals_int (ret, TRUE);
+  assert_equals_int (g_list_length (client->selected_stream->selected_video->
+          files), 4);
+  assert_equals_int (g_list_length (client->selected_stream->selected_audio->
+          files), 4);
+
+  /* Get the first fragment */
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (v_frag != NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_string (v_frag->name,
+      "http://media.example.com/low/video-only-001.ts");
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/english-001.ts");
+  g_object_unref (v_frag);
+  g_object_unref (a_frag);
+
+  /* Get the next fragment */
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (v_frag != NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_string (v_frag->name,
+      "http://media.example.com/low/video-only-002.ts");
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/english-002.ts");
+  g_object_unref (v_frag);
+  g_object_unref (a_frag);
+
+  /* Switch to German audio */
+  ret =
+      gst_m3u8_client_set_alternate (client, GST_M3U8_MEDIA_TYPE_AUDIO,
+      "Deutsche");
+  assert_equals_int (ret, TRUE);
+  /* Get the new uri's */
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/german-audio.m3u8");
+  /* On demand  so the uri does not need to be downloaded again */
+  assert_equals_int (v_uri == NULL, TRUE);
+  assert_equals_int (s_uri == NULL, TRUE);
+  /* Update the new uri's */
+  ret =
+      gst_m3u8_client_update (client,
+      g_strdup (ON_DEMAND_LOW_VIDEO_ONLY_PLAYLIST),
+      g_strdup (ON_DEMAND_GERMAN_PLAYLIST), NULL);
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (s_frag == NULL, TRUE);
+  assert_equals_int (v_frag != NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/german-003.ts");
+  assert_equals_string (v_frag->name,
+      "http://media.example.com/low/video-only-003.ts");
+  g_object_unref (v_frag);
+  g_object_unref (a_frag);
+
+  /* Switch to a higher bitrate */
+  gst_m3u8_client_set_current (client,
+      gst_m3u8_client_get_stream_for_bitrate (client, 260000));
+  gst_m3u8_client_get_current_uri (client, &v_uri, &a_uri, &s_uri);
+  assert_equals_int (a_uri != NULL, TRUE);
+  assert_equals_string (a_uri, "http://localhost/main/german-audio.m3u8");
+  assert_equals_int (v_uri != NULL, TRUE);
+  assert_equals_string (v_uri, "http://localhost/mid/video-only.m3u8");
+  assert_equals_int (s_uri == NULL, TRUE);
+  ret =
+      gst_m3u8_client_update (client,
+      g_strdup (ON_DEMAND_MID_VIDEO_ONLY_PLAYLIST),
+      g_strdup (ON_DEMAND_GERMAN_PLAYLIST), NULL);
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (s_frag == NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_int (v_frag != NULL, TRUE);
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/german-004.ts");
+  assert_equals_string (v_frag->name,
+      "http://media.example.com/mid/video-only-004.ts");
+  g_object_unref (v_frag);
+  g_object_unref (a_frag);
+
+  /* Seek to the beginning */
+  gst_m3u8_client_seek (client, 0);
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (s_frag == NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_int (v_frag != NULL, TRUE);
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/german-001.ts");
+  assert_equals_string (v_frag->name,
+      "http://media.example.com/mid/video-only-001.ts");
+  g_object_unref (v_frag);
+  g_object_unref (a_frag);
+
+  /* Select English audio again */
+  ret =
+      gst_m3u8_client_set_alternate (client, GST_M3U8_MEDIA_TYPE_AUDIO,
+      "English");
+  assert_equals_int (ret, TRUE);
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (s_frag == NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_int (v_frag != NULL, TRUE);
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/english-002.ts");
+  assert_equals_string (v_frag->name,
+      "http://media.example.com/mid/video-only-002.ts");
+  g_object_unref (v_frag);
+  g_object_unref (a_frag);
+
+  /* Go to the audio-only fallback */
+  gst_m3u8_client_set_current (client,
+      gst_m3u8_client_get_stream_for_bitrate (client, 20000));
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (s_frag == NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_int (v_frag == NULL, TRUE);
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/english-003.ts");
+  g_object_unref (a_frag);
+
+  /* Go to mid again */
+  gst_m3u8_client_set_current (client,
+      gst_m3u8_client_get_stream_for_bitrate (client, 260000));
+  gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (s_frag == NULL, TRUE);
+  assert_equals_int (a_frag != NULL, TRUE);
+  assert_equals_int (v_frag != NULL, TRUE);
+  assert_equals_string (a_frag->name,
+      "http://media.example.com/audio/english-004.ts");
+  assert_equals_string (v_frag->name,
+      "http://media.example.com/mid/video-only-004.ts");
+  g_object_unref (a_frag);
+  g_object_unref (v_frag);
+
+  /* End of stream */
+  ret = gst_m3u8_client_get_next_fragment (client, &v_frag, &a_frag, &s_frag);
+  assert_equals_int (ret, FALSE);
+
+  gst_m3u8_client_free (client);
+}
+
+GST_END_TEST;
+#endif
+
+static Suite *
+hlsdemux_suite (void)
+{
+  Suite *s = suite_create ("hlsdemux_m3u8");
+  TCase *tc_m3u8 = tcase_create ("m3u8client");
+
+  suite_add_tcase (s, tc_m3u8);
+  tcase_add_test (tc_m3u8, test_load_main_playlist_invalid);
+  tcase_add_test (tc_m3u8, test_load_main_playlist_rendition);
+  tcase_add_test (tc_m3u8, test_load_main_playlist_variant);
+  tcase_add_test (tc_m3u8, test_load_windows_line_endings_variant_playlist);
+  tcase_add_test (tc_m3u8, test_load_main_playlist_with_empty_lines);
+  tcase_add_test (tc_m3u8, test_load_windows_main_playlist_with_empty_lines);
+  tcase_add_test (tc_m3u8, test_on_demand_playlist);
+  tcase_add_test (tc_m3u8, test_windows_line_endings_playlist);
+  tcase_add_test (tc_m3u8, test_windows_empty_lines_playlist);
+  tcase_add_test (tc_m3u8, test_empty_lines_playlist);
+  tcase_add_test (tc_m3u8, test_live_playlist);
+  tcase_add_test (tc_m3u8, test_live_playlist_rotated);
+  tcase_add_test (tc_m3u8, test_update_invalid_playlist);
+  tcase_add_test (tc_m3u8, test_update_playlist);
+  tcase_add_test (tc_m3u8, test_playlist_media_files);
+  tcase_add_test (tc_m3u8, test_playlist_byte_range_media_files);
+  tcase_add_test (tc_m3u8, test_get_next_fragment);
+  tcase_add_test (tc_m3u8, test_get_duration);
+  tcase_add_test (tc_m3u8, test_get_target_duration);
+  tcase_add_test (tc_m3u8, test_get_stream_for_bitrate);
+#if 0
+  tcase_add_test (tc_m3u8, test_seek);
+  tcase_add_test (tc_m3u8, test_alternate_audio_playlist);
+  tcase_add_test (tc_m3u8, test_subtitles_playlist);
+  tcase_add_test (tc_m3u8, test_select_alternate);
+  tcase_add_test (tc_m3u8, test_select_subs_alternate);
+  tcase_add_test (tc_m3u8, test_simulation);
+#endif
+  tcase_add_test (tc_m3u8, test_playlist_with_doubles_duration);
+  tcase_add_test (tc_m3u8, test_playlist_with_encryption);
+
+  return s;
+}
+
+int
+main (int argc, char **argv)
+{
+  int nf;
+
+  Suite *s = hlsdemux_suite ();
+  SRunner *sr = srunner_create (s);
+
+  gst_check_init (&argc, &argv);
+
+  GST_DEBUG_CATEGORY_INIT (fragmented_debug, "hlsdemux_m3u", 0,
+      "hlsdemux m3u test");
+
+  srunner_run_all (sr, CK_NORMAL);
+  nf = srunner_ntests_failed (sr);
+  srunner_free (sr);
+
+  return nf;
+}
diff --git a/tests/check/elements/jpegparse.c b/tests/check/elements/jpegparse.c
index 392f529..80c26e8 100644
--- a/tests/check/elements/jpegparse.c
+++ b/tests/check/elements/jpegparse.c
@@ -137,7 +137,7 @@
 };
 
 guint8 test_data_sof0[] = {
-  0xff, 0xc0,
+  0xff, 0xc0,                   /* baseline dct-based */
   0x00, 0x11,                   /* size */
   0x08,                         /* precision */
   0x00, 0x3c,                   /* width */
@@ -327,8 +327,7 @@
 
   caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
       "framerate", GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING,
-      "I420", "interlaced", G_TYPE_BOOLEAN, FALSE,
-      "width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
+      "I420", "width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
 
   buffer_in = make_my_input_buffer (test_data_app1_exif,
       sizeof (test_data_app1_exif));
@@ -353,8 +352,7 @@
 
   caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
       "framerate", GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING,
-      "I420", "interlaced", G_TYPE_BOOLEAN, FALSE,
-      "width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
+      "I420", "width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
 
   buffer_in = make_my_input_buffer (test_data_comment,
       sizeof (test_data_comment));
diff --git a/tests/check/elements/mpegtsmux.c b/tests/check/elements/mpegtsmux.c
index 903c4d5..8d53de7 100644
--- a/tests/check/elements/mpegtsmux.c
+++ b/tests/check/elements/mpegtsmux.c
@@ -54,6 +54,10 @@
                           "alignment = (string) nal, " \
                           "parsed = (boolean) true "
 
+#define KEYFRAME_DISTANCE 10
+
+typedef void (CheckOutputBuffersFunc) (GList * buffers);
+
 /* setup and teardown needs some special handling for muxer */
 static GstPad *
 setup_src_pad (GstElement * element,
@@ -146,8 +150,10 @@
 static void
 check_tsmux_pad (GstStaticPadTemplate * srctemplate,
     const gchar * src_caps_string, gint pes_id, gint pmt_id,
-    const gchar * sinkname)
+    const gchar * sinkname, CheckOutputBuffersFunc check_func, guint n_bufs,
+    gssize input_buf_size, guint alignment)
 {
+  GstClockTime ts;
   GstElement *mux;
   GstBuffer *inbuffer, *outbuffer;
   GstCaps *caps;
@@ -157,17 +163,46 @@
   gchar *padname;
 
   mux = setup_tsmux (srctemplate, sinkname, &padname);
+
+  if (alignment != 0)
+    g_object_set (mux, "alignment", alignment, NULL);
+
   fail_unless (gst_element_set_state (mux,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
       "could not set to playing");
 
-  inbuffer = gst_buffer_new_and_alloc (1);
   caps = gst_caps_from_string (src_caps_string);
   gst_check_setup_events (mysrcpad, mux, caps, GST_FORMAT_TIME);
   gst_caps_unref (caps);
-  GST_BUFFER_TIMESTAMP (inbuffer) = 0;
-  ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-  fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+
+  ts = 0;
+  for (i = 0; i < n_bufs; ++i) {
+    GstFlowReturn flow;
+
+    if (input_buf_size >= 0)
+      inbuffer = gst_buffer_new_and_alloc (input_buf_size);
+    else
+      inbuffer = gst_buffer_new_and_alloc (g_random_int_range (0, 49141));
+
+    GST_BUFFER_TIMESTAMP (inbuffer) = ts;
+    ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+
+    if (i % KEYFRAME_DISTANCE == 0 && pes_id == 0xe0) {
+      GST_TRACE ("input keyframe");
+      GST_BUFFER_FLAG_UNSET (inbuffer, GST_BUFFER_FLAG_DELTA_UNIT);
+    } else {
+      GST_TRACE ("input delta");
+      GST_BUFFER_FLAG_SET (inbuffer, GST_BUFFER_FLAG_DELTA_UNIT);
+    }
+    flow = gst_pad_push (mysrcpad, inbuffer);
+    if (flow != GST_FLOW_OK)
+      fail ("Got %s flow instead of OK", gst_flow_get_name (flow));
+    ts += 40 * GST_MSECOND;
+  }
+
+  if (check_func)
+    check_func (buffers);
+
   num_buffers = g_list_length (buffers);
   /* all output might get aggregated */
   fail_unless (num_buffers >= 1);
@@ -199,12 +234,12 @@
       y = GST_READ_UINT16_BE (data);
       pid = y & (0x1FFF);
       data += 2;
-      GST_DEBUG ("pid: %d", pid);
+      GST_TRACE ("pid: %d", pid);
 
       y = (y >> 14) & 0x1;
       /* only check packets with payload_start_indicator == 1 */
       if (!y) {
-        GST_DEBUG ("not at start");
+        GST_TRACE ("not at start");
         continue;
       }
 
@@ -216,7 +251,7 @@
         y = *data;
         data++;
         data += y;
-        GST_DEBUG ("adaptation %d", y);
+        GST_TRACE ("adaptation %d", y);
       }
 
       if (pid == 0) {
@@ -317,7 +352,7 @@
 GST_START_TEST (test_video)
 {
   check_tsmux_pad (&video_src_template, VIDEO_CAPS_STRING, 0xE0, 0x1b,
-      "sink_%d");
+      "sink_%d", NULL, 1, 1, 0);
 }
 
 GST_END_TEST;
@@ -326,7 +361,7 @@
 GST_START_TEST (test_audio)
 {
   check_tsmux_pad (&audio_src_template, AUDIO_CAPS_STRING, 0xC0, 0x03,
-      "sink_%d");
+      "sink_%d", NULL, 1, 1, 0);
 }
 
 GST_END_TEST;
@@ -716,6 +751,58 @@
 
 GST_END_TEST;
 
+static void
+test_align_check_output (GList * bufs)
+{
+  GST_LOG ("%u buffers", g_list_length (bufs));
+  while (bufs != NULL) {
+    GstBuffer *buf = bufs->data;
+    gsize size;
+
+    size = gst_buffer_get_size (buf);
+    GST_LOG ("buffer, size = %5u", (guint) size);
+    fail_unless_equals_int (size, 7 * 188);
+    bufs = bufs->next;
+  }
+}
+
+GST_START_TEST (test_align)
+{
+  check_tsmux_pad (&video_src_template, VIDEO_CAPS_STRING, 0xE0, 0x1b,
+      "sink_%d", test_align_check_output, 817, -1, 7);
+}
+
+GST_END_TEST;
+
+static void
+test_keyframe_propagation_check_output (GList * bufs)
+{
+  guint keyframe_count = 0;
+
+  GST_LOG ("%u buffers", g_list_length (bufs));
+  while (bufs != NULL) {
+    GstBuffer *buf = bufs->data;
+    gboolean keyunit;
+
+    keyunit = !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
+
+    if (keyunit)
+      ++keyframe_count;
+
+    GST_LOG ("buffer, keyframe=%d", keyunit);
+    bufs = bufs->next;
+  }
+  fail_unless_equals_int (keyframe_count, 50 / KEYFRAME_DISTANCE);
+}
+
+GST_START_TEST (test_keyframe_flag_propagation)
+{
+  check_tsmux_pad (&video_src_template, VIDEO_CAPS_STRING, 0xE0, 0x1b,
+      "sink_%d", test_keyframe_propagation_check_output, 50, -1, 0);
+}
+
+GST_END_TEST;
+
 static Suite *
 mpegtsmux_suite (void)
 {
@@ -730,6 +817,8 @@
   tcase_add_test (tc_chain, test_force_key_unit_event_upstream);
   tcase_add_test (tc_chain, test_propagate_flow_status);
   tcase_add_test (tc_chain, test_multiple_state_change);
+  tcase_add_test (tc_chain, test_align);
+  tcase_add_test (tc_chain, test_keyframe_flag_propagation);
 
   return s;
 }
diff --git a/tests/check/elements/rtponvif.c b/tests/check/elements/rtponvif.c
new file mode 100644
index 0000000..d5eaf46
--- /dev/null
+++ b/tests/check/elements/rtponvif.c
@@ -0,0 +1,453 @@
+/*
+ * onviftimestamp.c
+ *
+ * Copyright (C) 2014 Axis Communications AB
+ *  Author: Guillaume Desmottes <guillaume.desmottes@collabora.com>
+ *
+ * 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.1 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gst/check/gstcheck.h>
+#include <gst/rtp/gstrtpbuffer.h>
+
+/* For ease of programming we use globals to keep refs for our floating
+ * src and sink pads we create; otherwise we always have to do get_pad,
+ * get_peer, and then remove references in every test function */
+static GstPad *mysrcpad, *mysinkpad;
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp")
+    );
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtp")
+    );
+
+#define NTP_OFFSET (guint64) 1245
+#define TIMESTAMP 42
+
+static void
+setup_element (GstElement * element)
+{
+  mysrcpad = gst_check_setup_src_pad (element, &srctemplate);
+  mysinkpad = gst_check_setup_sink_pad (element, &sinktemplate);
+  gst_pad_set_active (mysrcpad, TRUE);
+  gst_pad_set_active (mysinkpad, TRUE);
+
+  fail_unless (gst_element_set_state (element,
+          GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+      "could not set to playing");
+}
+
+static GstElement *
+setup_rtponviftimestamp (gboolean set_e_bit)
+{
+  GstElement *timestamp;
+
+  GST_DEBUG ("setup_rtponviftimestamp");
+  timestamp = gst_check_setup_element ("rtponviftimestamp");
+
+  g_object_set (timestamp, "ntp-offset", NTP_OFFSET, "cseq", 0x12345678,
+      "set-e-bit", set_e_bit, NULL);
+
+  setup_element (timestamp);
+
+  return timestamp;
+}
+
+static void
+cleanup_element (GstElement * element)
+{
+  fail_unless (gst_element_set_state (element,
+          GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
+
+  gst_pad_set_active (mysrcpad, FALSE);
+  if (mysinkpad)
+    gst_pad_set_active (mysinkpad, FALSE);
+  gst_check_teardown_src_pad (element);
+  gst_check_teardown_sink_pad (element);
+  gst_check_teardown_element (element);
+  mysrcpad = NULL;
+  mysinkpad = NULL;
+}
+
+static void
+cleanup_rtponviftimestamp (GstElement * timestamp)
+{
+  GST_DEBUG ("cleanup_rtponviftimestamp");
+
+  cleanup_element (timestamp);
+}
+
+static void
+check_buffer_equal (GstBuffer * buf, GstBuffer * expected)
+{
+  GstMapInfo info_buf, info_expected;
+
+  fail_if (buf == NULL);
+  fail_if (expected == NULL);
+
+  gst_buffer_map (buf, &info_buf, GST_MAP_READ);
+  gst_buffer_map (expected, &info_expected, GST_MAP_READ);
+
+  GST_LOG ("buffer: size %" G_GSIZE_FORMAT, info_buf.size);
+  GST_LOG ("expected: size %" G_GSIZE_FORMAT, info_expected.size);
+  GST_MEMDUMP ("buffer", info_buf.data, info_buf.size);
+  GST_MEMDUMP ("expected", info_expected.data, info_expected.size);
+
+  fail_unless (info_buf.size == info_expected.size,
+      "size of the buffers are not the same");
+  fail_unless (memcmp (info_buf.data, info_expected.data, info_buf.size) == 0,
+      "data is not the same");
+
+  gst_buffer_unmap (buf, &info_buf);
+  gst_buffer_unmap (expected, &info_expected);
+}
+
+/* Create a RTP buffer without the extension */
+static GstBuffer *
+create_rtp_buffer (guint64 timestamp, gboolean clean_point, gboolean discont)
+{
+  GstBuffer *buffer_in;
+  GstRTPBuffer rtpbuffer_in = GST_RTP_BUFFER_INIT;
+
+  buffer_in = gst_rtp_buffer_new_allocate (4, 0, 0);
+  buffer_in->pts = timestamp;
+
+  if (!clean_point)
+    GST_BUFFER_FLAG_SET (buffer_in, GST_BUFFER_FLAG_DELTA_UNIT);
+  if (discont)
+    GST_BUFFER_FLAG_SET (buffer_in, GST_BUFFER_FLAG_DISCONT);
+
+  fail_unless (gst_rtp_buffer_map (buffer_in, GST_MAP_READ, &rtpbuffer_in));
+  fail_if (gst_rtp_buffer_get_extension (&rtpbuffer_in));
+  gst_rtp_buffer_unmap (&rtpbuffer_in);
+
+  return buffer_in;
+}
+
+static guint64
+convert_to_ntp (guint64 t)
+{
+  guint64 ntptime;
+
+  /* convert to NTP time. upper 32 bits should contain the seconds
+   * and the lower 32 bits, the fractions of a second. */
+  ntptime = gst_util_uint64_scale (t, (G_GINT64_CONSTANT (1) << 32),
+      GST_SECOND);
+
+  return ntptime;
+}
+
+/* Create a copy of @buffer_in having the RTP extension */
+static GstBuffer *
+create_extension_buffer (GstBuffer * buffer_in, gboolean clean_point,
+    gboolean end_contiguous, gboolean discont)
+{
+  GstBuffer *buffer_out;
+  GstRTPBuffer rtpbuffer_out = GST_RTP_BUFFER_INIT;
+  guint8 *data;
+  guint8 flags = 0;
+
+  buffer_out = gst_buffer_copy (buffer_in);
+
+  fail_unless (gst_rtp_buffer_map (buffer_out, GST_MAP_READWRITE,
+          &rtpbuffer_out));
+
+  /* extension */
+  gst_rtp_buffer_set_extension_data (&rtpbuffer_out, 0xABAC, 3);
+  fail_unless (gst_rtp_buffer_get_extension (&rtpbuffer_out));
+  gst_rtp_buffer_get_extension_data (&rtpbuffer_out, NULL, (gpointer) & data,
+      NULL);
+
+  /* NTP timestamp */
+  GST_WRITE_UINT64_BE (data, convert_to_ntp (buffer_in->pts + NTP_OFFSET));
+
+  /* C E D mbz */
+  if (clean_point)
+    flags |= (1 << 7);
+  if (end_contiguous)
+    flags |= (1 << 6);
+  if (discont)
+    flags |= (1 << 5);
+
+  GST_WRITE_UINT8 (data + 8, flags);
+
+  /* CSeq */
+  GST_WRITE_UINT8 (data + 9, 0x78);
+
+  memset (data + 10, 0, 4);
+
+  gst_rtp_buffer_unmap (&rtpbuffer_out);
+
+  return buffer_out;
+}
+
+static void
+do_one_buffer_test_apply (gboolean clean_point, gboolean discont)
+{
+  GstElement *apply;
+  GstBuffer *buffer_in, *buffer_out;
+  GstSegment segment;
+
+  apply = setup_rtponviftimestamp (FALSE);
+
+  buffer_in = create_rtp_buffer (TIMESTAMP, clean_point, discont);
+  buffer_out = create_extension_buffer (buffer_in, clean_point, FALSE, discont);
+
+  /* stream start */
+  fail_unless (gst_pad_push_event (mysrcpad,
+          gst_event_new_stream_start ("test")));
+
+  /* Push a segment */
+  gst_segment_init (&segment, GST_FORMAT_TIME);
+  fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
+
+  /* Push buffer */
+  fail_unless (gst_pad_push (mysrcpad, buffer_in) == GST_FLOW_OK,
+      "failed pushing buffer");
+
+  check_buffer_equal (buffers->data, buffer_out);
+
+  g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
+  g_list_free (buffers);
+  buffers = NULL;
+
+  ASSERT_OBJECT_REFCOUNT (apply, "rtponviftimestamp", 1);
+  cleanup_rtponviftimestamp (apply);
+}
+
+static void
+do_two_buffers_test_apply (gboolean end_contiguous)
+{
+  GstElement *apply;
+  GstBuffer *buffer_in, *buffer_out;
+  GstSegment segment;
+
+  apply = setup_rtponviftimestamp (TRUE);
+
+  buffer_in = create_rtp_buffer (TIMESTAMP, FALSE, FALSE);
+  buffer_out = create_extension_buffer (buffer_in, FALSE, end_contiguous,
+      FALSE);
+
+  /* stream start */
+  fail_unless (gst_pad_push_event (mysrcpad,
+          gst_event_new_stream_start ("test")));
+
+  /* Push a segment */
+  gst_segment_init (&segment, GST_FORMAT_TIME);
+  fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
+
+  /* Push buffer */
+  fail_unless (gst_pad_push (mysrcpad, buffer_in) == GST_FLOW_OK,
+      "failed pushing buffer");
+
+  /* The buffer hasn't been pushed it as the element is waiting for the next
+   * buffer. */
+  g_assert_cmpuint (g_list_length (buffers), ==, 0);
+
+  /* A second buffer is pushed, it has the DISCONT flag if we want that the
+   * first one has the 'E' bit set. */
+  buffer_in = create_rtp_buffer (TIMESTAMP + 1, FALSE, end_contiguous);
+
+  fail_unless (gst_pad_push (mysrcpad, buffer_in) == GST_FLOW_OK,
+      "failed pushing buffer");
+
+  /* The first buffer has now been pushed out */
+  g_assert_cmpuint (g_list_length (buffers), ==, 1);
+
+  check_buffer_equal (buffers->data, buffer_out);
+
+  g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
+  g_list_free (buffers);
+  buffers = NULL;
+
+  /* Push EOS */
+  fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
+
+  /* The second buffer has been pushed out */
+  g_assert_cmpuint (g_list_length (buffers), ==, 1);
+
+  /* Latest buffer always has the 'E' flag */
+  buffer_out = create_extension_buffer (buffer_in, FALSE, TRUE, end_contiguous);
+  check_buffer_equal (buffers->data, buffer_out);
+
+  ASSERT_OBJECT_REFCOUNT (apply, "rtponviftimestamp", 1);
+  cleanup_rtponviftimestamp (apply);
+}
+
+GST_START_TEST (test_apply_discont)
+{
+  do_one_buffer_test_apply (FALSE, TRUE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_apply_not_discont)
+{
+  do_one_buffer_test_apply (FALSE, FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_apply_clean_point)
+{
+  do_one_buffer_test_apply (TRUE, FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_apply_no_e_bit)
+{
+  do_two_buffers_test_apply (FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_apply_e_bit)
+{
+  do_two_buffers_test_apply (TRUE);
+}
+
+GST_END_TEST;
+
+static GstElement *
+setup_rtponvifparse (gboolean set_e_bit)
+{
+  GstElement *parse;
+
+  GST_DEBUG ("setup_rtponvifparse");
+  parse = gst_check_setup_element ("rtponvifparse");
+
+  setup_element (parse);
+
+  return parse;
+}
+
+static void
+cleanup_rtponvifparse (GstElement * parse)
+{
+  GST_DEBUG ("cleanup_rtponvifparse");
+
+  cleanup_element (parse);
+}
+
+static void
+test_parse (gboolean clean_point, gboolean discont)
+{
+  GstElement *parse;
+  GstBuffer *rtp, *buf;
+  GstSegment segment;
+
+  parse = setup_rtponvifparse (FALSE);
+
+  rtp = gst_rtp_buffer_new_allocate (4, 0, 0);
+  buf = create_extension_buffer (rtp, clean_point, FALSE, discont);
+  gst_buffer_unref (rtp);
+
+  /* stream start */
+  fail_unless (gst_pad_push_event (mysrcpad,
+          gst_event_new_stream_start ("test")));
+
+  /* Push a segment */
+  gst_segment_init (&segment, GST_FORMAT_TIME);
+  fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
+
+  /* Push buffer */
+  fail_unless (gst_pad_push (mysrcpad, buf) == GST_FLOW_OK,
+      "failed pushing buffer");
+
+  g_assert_cmpuint (g_list_length (buffers), ==, 1);
+  buf = buffers->data;
+
+  if (clean_point)
+    g_assert (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT));
+  else
+    g_assert (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT));
+
+  if (discont)
+    g_assert (GST_BUFFER_IS_DISCONT (buf));
+  else
+    g_assert (!GST_BUFFER_IS_DISCONT (buf));
+
+  g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
+  g_list_free (buffers);
+  buffers = NULL;
+
+  ASSERT_OBJECT_REFCOUNT (parse, "rtponvifparse", 1);
+  cleanup_rtponvifparse (parse);
+}
+
+GST_START_TEST (test_parse_no_flag)
+{
+  test_parse (FALSE, FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_parse_clean_point)
+{
+  test_parse (TRUE, FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_parse_discont)
+{
+  test_parse (FALSE, TRUE);
+}
+
+GST_END_TEST;
+
+static Suite *
+onviftimestamp_suite (void)
+{
+  Suite *s = suite_create ("onviftimestamp");
+  TCase *tc_chain;
+
+  tc_chain = tcase_create ("apply");
+  suite_add_tcase (s, tc_chain);
+  tcase_add_test (tc_chain, test_apply_discont);
+  tcase_add_test (tc_chain, test_apply_not_discont);
+  tcase_add_test (tc_chain, test_apply_clean_point);
+  tcase_add_test (tc_chain, test_apply_no_e_bit);
+  tcase_add_test (tc_chain, test_apply_e_bit);
+
+  tc_chain = tcase_create ("parse");
+  suite_add_tcase (s, tc_chain);
+  tcase_add_test (tc_chain, test_parse_no_flag);
+  tcase_add_test (tc_chain, test_parse_clean_point);
+  tcase_add_test (tc_chain, test_parse_discont);
+
+  return s;
+}
+
+int
+main (int argc, char **argv)
+{
+  int nf;
+  Suite *s = onviftimestamp_suite ();
+  SRunner *sr = srunner_create (s);
+
+  gst_check_init (&argc, &argv);
+
+  srunner_run_all (sr, CK_NORMAL);
+  nf = srunner_ntests_failed (sr);
+  srunner_free (sr);
+
+  return nf;
+}
diff --git a/tests/check/elements/templatematch.c b/tests/check/elements/templatematch.c
new file mode 100644
index 0000000..5b56718
--- /dev/null
+++ b/tests/check/elements/templatematch.c
@@ -0,0 +1,169 @@
+/*
+ * GStreamer
+ *
+ * unit test for templatematch
+ *
+ * Copyright (C) 2014 Samsung Electronics. All rights reserved.
+ *   Author: Thiago Santos <ts.santos@sisa.samsung.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/check/gstcheck.h>
+
+#define CAPS_TMPL   "video/x-raw, format=(string)BGR"
+
+GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (CAPS_TMPL)
+    );
+GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS (CAPS_TMPL)
+    );
+
+/* Create a 16x16 buffer split in 4 equal squares
+ * BG
+ * Rb
+ *
+ * B=Blue, G=Green, R=Red, b=black
+ */
+static GstBuffer *
+create_input_buffer (void)
+{
+  guint8 *data;
+  gsize size;
+  gint i, j, base;
+
+  size = 3 * 16 * 16;           /* BGR 16x16 */
+  data = g_malloc0 (size);
+
+  /* blue and green */
+  for (j = 0; j < 8; j++) {
+    for (i = 0; i < 8; i++) {
+      base = j * 16;
+      data[base + i] = 255;
+      data[base + i + 1] = 0;
+      data[base + i + 2] = 0;
+
+      data[base + 8 + i] = 0;
+      data[base + 8 + i + 1] = 255;
+      data[base + 8 + i + 2] = 0;
+    }
+  }
+  /* red */
+  for (j = 0; j < 8; j++) {
+    for (i = 0; i < 8; i++) {
+      base = 8 * 8 + j * 16;
+      data[base + i] = 0;
+      data[base + i + 1] = 0;
+      data[base + i + 2] = 255;
+    }
+  }
+
+  return gst_buffer_new_wrapped (data, size);
+}
+
+/* Test to make sure that we are using the same rgb format as opencv expects for
+ * template matching (BGR).
+ * Will use a blue 8x8 square as the template and as input a 16x16 frame divided
+ * evenly in 4 squares: Blue (top-left), Green (top-right), Red (bottom-left) and
+ * Black (bottom-right)
+ *
+ * https://bugzilla.gnome.org/show_bug.cgi?id=678485
+ */
+GST_START_TEST (test_match_blue_square)
+{
+  GstElement *element;
+  GstPad *sinkpad, *srcpad;
+  GstCaps *caps =
+      gst_caps_from_string (CAPS_TMPL ", width=(int)16, height=(int)16");
+  GstBus *bus;
+  GstMessage *msg;
+  const GstStructure *structure;
+  gchar *path;
+  GstBuffer *buf;
+  guint x, y, width, height;
+
+  element = gst_check_setup_element ("templatematch");
+  srcpad = gst_check_setup_src_pad (element, &srctemplate);
+  sinkpad = gst_check_setup_sink_pad (element, &sinktemplate);
+  gst_pad_set_active (srcpad, TRUE);
+  gst_check_setup_events (srcpad, element, caps, GST_FORMAT_TIME);
+  gst_pad_set_active (sinkpad, TRUE);
+
+  bus = gst_bus_new ();
+  gst_element_set_bus (element, bus);
+
+  path = g_build_filename (GST_TEST_FILES_PATH, "blue-square.png", NULL);
+  g_object_set (element, "template", path, NULL);
+  g_free (path);
+
+  fail_unless (gst_element_set_state (element,
+          GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE,
+      "could not set to playing");
+
+  buf = create_input_buffer ();
+  fail_unless (gst_pad_push (srcpad, buf) == GST_FLOW_OK);
+
+  /* make sure that the template match message was posted, detecting the
+   * blue area in the top left corner */
+  msg = gst_bus_pop_filtered (bus, GST_MESSAGE_ELEMENT);
+  fail_unless (msg != NULL);
+  fail_unless (GST_MESSAGE_SRC (msg) == GST_OBJECT_CAST (element));
+  structure = gst_message_get_structure (msg);
+  fail_unless (gst_structure_has_name (structure, "template_match"));
+  fail_unless (gst_structure_get_uint (structure, "x", &x));
+  fail_unless (gst_structure_get_uint (structure, "y", &y));
+  fail_unless (gst_structure_get_uint (structure, "width", &width));
+  fail_unless (gst_structure_get_uint (structure, "height", &height));
+  fail_unless (x == 0);
+  fail_unless (y == 0);
+  fail_unless (width == 8);
+  fail_unless (height == 8);
+
+  gst_message_unref (msg);
+
+  gst_element_set_state (element, GST_STATE_NULL);
+  gst_bus_set_flushing (bus, TRUE);
+  gst_object_unref (bus);
+  gst_caps_unref (caps);
+  gst_pad_set_active (srcpad, FALSE);
+  gst_pad_set_active (sinkpad, FALSE);
+  gst_object_unref (srcpad);
+  gst_object_unref (sinkpad);
+  gst_check_teardown_src_pad (element);
+  gst_check_teardown_sink_pad (element);
+  gst_check_teardown_element (element);
+}
+
+GST_END_TEST;
+
+static Suite *
+templatematch_suite (void)
+{
+  Suite *s = suite_create ("templatematch");
+  TCase *tc_chain = tcase_create ("general");
+
+  suite_add_tcase (s, tc_chain);
+  tcase_add_test (tc_chain, test_match_blue_square);
+
+  return s;
+}
+
+GST_CHECK_MAIN (templatematch);
diff --git a/tests/check/elements/x265enc.c b/tests/check/elements/x265enc.c
new file mode 100644
index 0000000..38186f1
--- /dev/null
+++ b/tests/check/elements/x265enc.c
@@ -0,0 +1,165 @@
+/* GStreamer
+ *
+ * Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (c) 2010 David Schleef <ds@schleef.org>
+ * Copyright (c) 2014 Thijs Vermeir <thijs.vermeir@barco.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/check/gstcheck.h>
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-h265, "
+        "width = (int) [1, MAX], "
+        "height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw, "
+        "format = (string) I420, "
+        "width = (int) [1, MAX], "
+        "height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
+
+static GstPad *sinkpad, *srcpad;
+
+static GstElement *
+setup_x265enc (const gchar * src_caps_str)
+{
+  GstElement *x265enc;
+  GstCaps *srccaps = NULL;
+  GstBus *bus;
+
+  if (src_caps_str) {
+    srccaps = gst_caps_from_string (src_caps_str);
+    fail_unless (srccaps != NULL);
+  }
+
+  x265enc = gst_check_setup_element ("x265enc");
+  fail_unless (x265enc != NULL);
+  srcpad = gst_check_setup_src_pad (x265enc, &srctemplate);
+  sinkpad = gst_check_setup_sink_pad (x265enc, &sinktemplate);
+  gst_pad_set_active (srcpad, TRUE);
+  gst_pad_set_active (sinkpad, TRUE);
+
+  gst_check_setup_events (srcpad, x265enc, srccaps, GST_FORMAT_TIME);
+
+  bus = gst_bus_new ();
+  gst_element_set_bus (x265enc, bus);
+
+  fail_unless (gst_element_set_state (x265enc,
+          GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE,
+      "could not set to playing");
+
+  if (srccaps)
+    gst_caps_unref (srccaps);
+
+  buffers = NULL;
+  return x265enc;
+}
+
+static void
+cleanup_x265enc (GstElement * x265enc)
+{
+  GstBus *bus;
+
+  /* Free parsed buffers */
+  gst_check_drop_buffers ();
+
+  bus = GST_ELEMENT_BUS (x265enc);
+  gst_bus_set_flushing (bus, TRUE);
+  gst_object_unref (bus);
+
+  gst_pad_set_active (srcpad, FALSE);
+  gst_pad_set_active (sinkpad, FALSE);
+  gst_check_teardown_src_pad (x265enc);
+  gst_check_teardown_sink_pad (x265enc);
+  gst_check_teardown_element (x265enc);
+}
+
+GST_START_TEST (test_encode_simple)
+{
+  GstElement *x265enc;
+  GstBuffer *buffer;
+  gint i;
+  GList *l;
+  GstCaps *outcaps, *sinkcaps;
+  GstSegment seg;
+
+  x265enc =
+      setup_x265enc
+      ("video/x-raw,format=(string)I420,width=(int)320,height=(int)240,framerate=(fraction)25/1");
+
+  gst_segment_init (&seg, GST_FORMAT_TIME);
+  seg.stop = gst_util_uint64_scale (10, GST_SECOND, 25);
+
+  fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&seg)));
+
+  buffer = gst_buffer_new_allocate (NULL, 320 * 240 + 2 * 160 * 120, NULL);
+  gst_buffer_memset (buffer, 0, 0, -1);
+
+  for (i = 0; i < 10; i++) {
+    GST_BUFFER_TIMESTAMP (buffer) = gst_util_uint64_scale (i, GST_SECOND, 25);
+    GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale (1, GST_SECOND, 25);
+    fail_unless (gst_pad_push (srcpad, gst_buffer_ref (buffer)) == GST_FLOW_OK);
+  }
+
+  gst_buffer_unref (buffer);
+
+  fail_unless (gst_pad_push_event (srcpad, gst_event_new_eos ()));
+
+  /* All buffers must be there now */
+  fail_unless_equals_int (g_list_length (buffers), 10);
+
+  outcaps =
+      gst_caps_from_string
+      ("video/x-h265,width=(int)320,height=(int)240,framerate=(fraction)25/1");
+
+  for (l = buffers, i = 0; l; l = l->next, i++) {
+    buffer = l->data;
+
+    fail_unless_equals_uint64 (GST_BUFFER_DURATION (buffer),
+        gst_util_uint64_scale (1, GST_SECOND, 25));
+
+    sinkcaps = gst_pad_get_current_caps (sinkpad);
+    fail_unless (gst_caps_can_intersect (sinkcaps, outcaps));
+    gst_caps_unref (sinkcaps);
+  }
+
+  gst_caps_unref (outcaps);
+
+  cleanup_x265enc (x265enc);
+}
+
+GST_END_TEST;
+
+static Suite *
+x265enc_suite (void)
+{
+  Suite *s = suite_create ("x265enc");
+  TCase *tc_chain = tcase_create ("general");
+
+  suite_add_tcase (s, tc_chain);
+
+  tcase_add_test (tc_chain, test_encode_simple);
+
+  return s;
+}
+
+GST_CHECK_MAIN (x265enc);
diff --git a/tests/check/libs/aggregator.c b/tests/check/libs/aggregator.c
index 1b9c978..62be4ee 100644
--- a/tests/check/libs/aggregator.c
+++ b/tests/check/libs/aggregator.c
@@ -63,7 +63,7 @@
 };
 
 static GstFlowReturn
-gst_test_aggregator_aggregate (GstAggregator * aggregator)
+gst_test_aggregator_aggregate (GstAggregator * aggregator, gboolean timeout)
 {
   GstIterator *iter;
   gboolean all_eos = TRUE;
@@ -76,7 +76,6 @@
 
   iter = gst_element_iterate_sink_pads (GST_ELEMENT (testagg));
   while (!done_iterating) {
-    GstBuffer *buffer;
     GValue value = { 0, };
     GstAggregatorPad *pad;
 
@@ -84,10 +83,9 @@
       case GST_ITERATOR_OK:
         pad = g_value_get_object (&value);
 
-        if (pad->eos == FALSE)
+        if (gst_aggregator_pad_is_eos (pad) == FALSE)
           all_eos = FALSE;
-        buffer = gst_aggregator_pad_steal_buffer (pad);
-        gst_buffer_replace (&buffer, NULL);
+        gst_aggregator_pad_drop_buffer (pad);
 
         g_value_reset (&value);
         break;
@@ -549,6 +547,95 @@
 
 GST_END_TEST;
 
+static GstPadProbeReturn
+_drop_buffer_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
+{
+  gint wait;
+
+  if (GST_IS_BUFFER (info->data)) {
+    wait = GPOINTER_TO_INT (user_data);
+    if (wait > 0)
+      g_usleep (wait / 1000);
+    return GST_PAD_PROBE_DROP;
+  }
+
+  return GST_PAD_PROBE_PASS;
+}
+
+#define TIMEOUT_NUM_BUFFERS 20
+static void
+_test_timeout (gint buffer_wait)
+{
+  GstBus *bus;
+  GstMessage *msg;
+  GstElement *pipeline, *src, *src1, *agg, *sink;
+  GstPad *src1pad;
+
+  gint count = 0;
+
+  pipeline = gst_pipeline_new ("pipeline");
+  src = gst_element_factory_make ("fakesrc", NULL);
+  g_object_set (src, "num-buffers", TIMEOUT_NUM_BUFFERS, "sizetype", 2,
+      "sizemax", 4, NULL);
+
+  src1 = gst_element_factory_make ("fakesrc", NULL);
+  g_object_set (src1, "num-buffers", TIMEOUT_NUM_BUFFERS, "sizetype", 2,
+      "sizemax", 4, NULL);
+
+  agg = gst_check_setup_element ("testaggregator");
+  g_object_set (agg, "latency", G_GINT64_CONSTANT (1000) /* 1 us */ , NULL);
+  sink = gst_check_setup_element ("fakesink");
+  g_object_set (sink, "signal-handoffs", TRUE, NULL);
+  g_signal_connect (sink, "handoff", (GCallback) handoff, &count);
+
+  fail_unless (gst_bin_add (GST_BIN (pipeline), src));
+  fail_unless (gst_bin_add (GST_BIN (pipeline), src1));
+  fail_unless (gst_bin_add (GST_BIN (pipeline), agg));
+  fail_unless (gst_bin_add (GST_BIN (pipeline), sink));
+
+  src1pad = gst_element_get_static_pad (src1, "src");
+  fail_if (src1pad == NULL);
+  gst_pad_add_probe (src1pad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
+      (GstPadProbeCallback) _drop_buffer_probe_cb,
+      GINT_TO_POINTER (buffer_wait), NULL);
+
+  fail_unless (gst_element_link (src, agg));
+  fail_unless (gst_element_link (src1, agg));
+  fail_unless (gst_element_link (agg, sink));
+
+  bus = gst_element_get_bus (pipeline);
+  fail_if (bus == NULL);
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  msg = gst_bus_poll (bus, GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
+  fail_if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_EOS);
+  gst_message_unref (msg);
+
+  /* cannot rely on the exact number of buffers as the timeout may produce
+   * more buffers with the unsynchronized _aggregate() implementation in
+   * testaggregator */
+  fail_if (count < TIMEOUT_NUM_BUFFERS);
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  gst_object_unref (src1pad);
+  gst_object_unref (bus);
+  gst_object_unref (pipeline);
+}
+
+GST_START_TEST (test_timeout_pipeline)
+{
+  _test_timeout (0);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_timeout_pipeline_with_wait)
+{
+  _test_timeout (1000000 /* 1 ms */ );
+}
+
+GST_END_TEST;
+
 GST_START_TEST (test_flushing_seek)
 {
   GstEvent *event;
@@ -1017,6 +1104,8 @@
   tcase_add_test (general, test_infinite_seek_50_src);
   tcase_add_test (general, test_linear_pipeline);
   tcase_add_test (general, test_two_src_pipeline);
+  tcase_add_test (general, test_timeout_pipeline);
+  tcase_add_test (general, test_timeout_pipeline_with_wait);
   tcase_add_test (general, test_add_remove);
   tcase_add_test (general, test_change_state_intensive);
 
diff --git a/tests/check/libs/gstglcolorconvert.c b/tests/check/libs/gstglcolorconvert.c
new file mode 100644
index 0000000..0a0b59b
--- /dev/null
+++ b/tests/check/libs/gstglcolorconvert.c
@@ -0,0 +1,234 @@
+/* GStreamer
+ *
+ * Copyright (C) 2014 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <gst/check/gstcheck.h>
+
+#include <gst/gl/gl.h>
+
+#include <stdio.h>
+
+static GstGLDisplay *display;
+static GstGLContext *context;
+static GstGLWindow *window;
+static GstGLColorConvert *convert;
+
+typedef struct _TestFrame
+{
+  gint width;
+  gint height;
+  GstVideoFormat v_format;
+  gchar *data[GST_VIDEO_MAX_PLANES];
+} TestFrame;
+
+#define IGNORE_MAGIC 0x05
+
+static const gchar rgba_reorder_data[] = { 0x49, 0x24, 0x72, 0xff };
+static const gchar rgbx_reorder_data[] = { 0x49, 0x24, 0x72, IGNORE_MAGIC };
+static const gchar argb_reorder_data[] = { 0xff, 0x49, 0x24, 0x72 };
+static const gchar xrgb_reorder_data[] = { IGNORE_MAGIC, 0x49, 0x24, 0x72 };
+static const gchar rgb_reorder_data[] = { 0x49, 0x24, 0x72, IGNORE_MAGIC };
+static const gchar bgr_reorder_data[] = { 0x72, 0x24, 0x49, IGNORE_MAGIC };
+static const gchar bgra_reorder_data[] = { 0x72, 0x24, 0x49, 0xff };
+static const gchar bgrx_reorder_data[] = { 0x72, 0x24, 0x49, IGNORE_MAGIC };
+static const gchar abgr_reorder_data[] = { 0xff, 0x72, 0x24, 0x49 };
+static const gchar xbgr_reorder_data[] = { IGNORE_MAGIC, 0x72, 0x24, 0x49 };
+
+static TestFrame test_rgba_reorder[] = {
+  {1, 1, GST_VIDEO_FORMAT_RGBA, {(gchar *) & rgba_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_RGBx, {(gchar *) & rgbx_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_ARGB, {(gchar *) & argb_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_xRGB, {(gchar *) & xrgb_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_BGRA, {(gchar *) & bgra_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_BGRx, {(gchar *) & bgrx_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_ABGR, {(gchar *) & abgr_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_xBGR, {(gchar *) & xbgr_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_RGB, {(gchar *) & rgb_reorder_data}},
+  {1, 1, GST_VIDEO_FORMAT_BGR, {(gchar *) & bgr_reorder_data}},
+};
+
+static void
+setup (void)
+{
+  GError *error = NULL;
+
+  display = gst_gl_display_new ();
+  context = gst_gl_context_new (display);
+
+  gst_gl_context_create (context, 0, &error);
+  window = gst_gl_context_get_window (context);
+
+  fail_if (error != NULL, "Error creating context: %s\n",
+      error ? error->message : "Unknown Error");
+
+  convert = gst_gl_color_convert_new (context);
+}
+
+static void
+teardown (void)
+{
+  GLuint error = context->gl_vtable->GetError ();
+  fail_if (error != GL_NONE, "GL error 0x%x encountered during processing\n",
+      error);
+
+  gst_object_unref (convert);
+  gst_object_unref (window);
+  gst_object_unref (context);
+  gst_object_unref (display);
+}
+
+static gsize
+_video_info_plane_size (GstVideoInfo * info, guint plane)
+{
+  if (GST_VIDEO_INFO_N_PLANES (info) == plane + 1)
+    return info->offset[0] + info->size - info->offset[plane];
+
+  return info->offset[plane + 1] - info->offset[plane];
+}
+
+static void
+check_conversion (TestFrame * frames, guint size)
+{
+  gint i, j, k, l;
+
+  for (i = 0; i < size; i++) {
+    GstBuffer *inbuf;
+    GstVideoInfo in_info;
+    gint in_width = frames[i].width;
+    gint in_height = frames[i].height;
+    GstVideoFormat in_v_format = frames[i].v_format;
+    gchar *in_data[GST_VIDEO_MAX_PLANES] = { 0 };
+    GstGLMemory *in_mem[GST_VIDEO_MAX_PLANES] = { 0 };
+    GstVideoFrame in_frame;
+    GstCaps *in_caps;
+
+    gst_video_info_set_format (&in_info, in_v_format, in_width, in_height);
+    in_caps = gst_video_info_to_caps (&in_info);
+    gst_caps_set_features (in_caps, 0,
+        gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
+
+    for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
+      in_data[j] = frames[i].data[j];
+    }
+
+    /* create GL buffer */
+    inbuf = gst_buffer_new ();
+    fail_unless (gst_gl_memory_setup_wrapped (context, &in_info, NULL,
+            (gpointer *) in_data, in_mem));
+
+    for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
+      gst_buffer_append_memory (inbuf, (GstMemory *) in_mem[j]);
+    }
+
+    fail_unless (gst_video_frame_map (&in_frame, &in_info, inbuf,
+            GST_MAP_READ));
+
+    /* sanity check that the correct values were wrapped */
+    for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
+      for (k = 0; k < _video_info_plane_size (&in_info, j); k++) {
+        if (in_data[j][k] != IGNORE_MAGIC)
+          fail_unless (((gchar *) in_frame.data[j])[k] == in_data[j][k]);
+      }
+    }
+
+    for (j = 0; j < size; j++) {
+      GstBuffer *outbuf;
+      GstVideoInfo out_info;
+      gint out_width = frames[j].width;
+      gint out_height = frames[j].height;
+      GstVideoFormat out_v_format = frames[j].v_format;
+      gchar *out_data[GST_VIDEO_MAX_PLANES] = { 0 };
+      GstVideoFrame out_frame;
+      GstCaps *out_caps;
+
+      gst_video_info_set_format (&out_info, out_v_format, out_width,
+          out_height);
+      out_caps = gst_video_info_to_caps (&out_info);
+      gst_caps_set_features (out_caps, 0,
+          gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
+
+      for (k = 0; k < GST_VIDEO_INFO_N_PLANES (&out_info); k++) {
+        out_data[k] = frames[j].data[k];
+      }
+
+      gst_gl_color_convert_set_caps (convert, in_caps, out_caps);
+
+      /* convert the data */
+      outbuf = gst_gl_color_convert_perform (convert, inbuf);
+      if (outbuf == NULL) {
+        const gchar *in_str = gst_video_format_to_string (in_v_format);
+        const gchar *out_str = gst_video_format_to_string (out_v_format);
+        GST_WARNING ("failed to convert from %s to %s", in_str, out_str);
+      }
+
+      fail_unless (gst_video_frame_map (&out_frame, &out_info, outbuf,
+              GST_MAP_READ));
+
+      /* check that the converted values are correct */
+      for (k = 0; k < GST_VIDEO_INFO_N_PLANES (&out_info); k++) {
+        for (l = 0; l < _video_info_plane_size (&out_info, k); l++) {
+          gchar out_pixel = ((gchar *) out_frame.data[k])[l];
+          if (out_data[k][l] != IGNORE_MAGIC && out_pixel != IGNORE_MAGIC)
+            fail_unless (out_pixel == out_data[k][l]);
+          /* FIXME: check alpha clobbering */
+        }
+      }
+
+      gst_video_frame_unmap (&out_frame);
+      gst_buffer_unref (outbuf);
+    }
+
+    gst_caps_unref (in_caps);
+    gst_video_frame_unmap (&in_frame);
+    gst_buffer_unref (inbuf);
+  }
+}
+
+GST_START_TEST (test_reorder_buffer)
+{
+  guint size = G_N_ELEMENTS (test_rgba_reorder);
+
+  /* gles can't download rgb24 textures */
+  if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
+    size -= 2;
+
+  check_conversion (test_rgba_reorder, size);
+}
+
+GST_END_TEST;
+
+static Suite *
+gst_gl_color_convert_suite (void)
+{
+  Suite *s = suite_create ("GstGLUpload");
+  TCase *tc_chain = tcase_create ("upload");
+
+  suite_add_tcase (s, tc_chain);
+  tcase_add_checked_fixture (tc_chain, setup, teardown);
+  tcase_add_test (tc_chain, test_reorder_buffer);
+  /* FIXME add YUV <--> RGB conversion tests */
+
+  return s;
+}
+
+GST_CHECK_MAIN (gst_gl_color_convert);
diff --git a/tests/check/libs/gstglcontext.c b/tests/check/libs/gstglcontext.c
index bb7e295..901db50 100644
--- a/tests/check/libs/gstglcontext.c
+++ b/tests/check/libs/gstglcontext.c
@@ -114,7 +114,7 @@
 {
   GstGLContext *context = data;
   GstGLFuncs *gl = context->gl_vtable;
-  gl->DeleteTextures (1, &tex);;
+  gl->DeleteTextures (1, &tex);
   gst_object_unref (fbo);
 #if GST_GL_HAVE_GLES2
   if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
@@ -259,7 +259,8 @@
       error ? error->message : "Unknown Error");
 
   /* make the window visible */
-  gst_gl_window_draw (window, 320, 240);
+  gst_gl_window_set_preferred_size (window, 320, 240);
+  gst_gl_window_draw (window);
 
   gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (init), context);
 
@@ -281,15 +282,49 @@
 
 GST_END_TEST;
 
+static void
+accum_true (GstGLContext * context, gpointer data)
+{
+  gint *i = data;
+  *i = 1;
+}
+
+static void
+check_wrapped (gpointer data)
+{
+  GstGLContext *wrapped_context = data;
+  GError *error = NULL;
+  gint i = 0;
+  gboolean ret;
+
+  /* check that scheduling on an unactivated wrapped context asserts */
+  ASSERT_CRITICAL (gst_gl_context_thread_add (wrapped_context,
+          (GstGLContextThreadFunc) accum_true, &i));
+  fail_if (i != 0);
+
+  /* check that scheduling on an activated context succeeds */
+  gst_gl_context_activate (wrapped_context, TRUE);
+  gst_gl_context_thread_add (wrapped_context,
+      (GstGLContextThreadFunc) accum_true, &i);
+  fail_if (i != 1);
+
+  /* check filling out the wrapped context's info */
+  fail_if (wrapped_context->gl_vtable->TexImage2D != NULL);
+  ret = gst_gl_context_fill_info (wrapped_context, &error);
+  fail_if (!ret, "error received %s\n",
+      error ? error->message : "Unknown error");
+  fail_if (wrapped_context->gl_vtable->TexImage2D == NULL);
+}
+
 GST_START_TEST (test_wrapped_context)
 {
   GstGLContext *context, *other_context, *wrapped_context;
   GstGLWindow *window, *other_window;
   GError *error = NULL;
   gint i = 0;
-  guintptr handle;
-  GstGLPlatform platform;
-  GstGLAPI apis;
+  guintptr handle, handle2;
+  GstGLPlatform platform, platform2;
+  GstGLAPI apis, apis2;
 
   context = gst_gl_context_new (display);
 
@@ -308,6 +343,14 @@
   wrapped_context =
       gst_gl_context_new_wrapped (display, handle, platform, apis);
 
+  handle2 = gst_gl_context_get_gl_context (wrapped_context);
+  platform2 = gst_gl_context_get_gl_platform (wrapped_context);
+  apis2 = gst_gl_context_get_gl_api (wrapped_context);
+
+  fail_if (handle != handle2);
+  fail_if (platform != platform2);
+  fail_if (apis != apis2);
+
   other_context = gst_gl_context_new (display);
   other_window = gst_gl_window_new (display);
   gst_gl_context_set_window (other_context, other_window);
@@ -318,7 +361,8 @@
       error ? error->message : "Unknown Error");
 
   /* make the window visible */
-  gst_gl_window_draw (window, 320, 240);
+  gst_gl_window_set_preferred_size (window, 320, 240);
+  gst_gl_window_draw (window);
 
   gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (init), context);
 
@@ -330,17 +374,74 @@
     i++;
   }
 
+  gst_gl_window_send_message (window, GST_GL_WINDOW_CB (check_wrapped),
+      wrapped_context);
+
   gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (deinit), context);
 
-  gst_object_unref (window);
-  gst_object_unref (other_window);
   gst_object_unref (other_context);
+  gst_object_unref (other_window);
+  gst_object_unref (window);
   gst_object_unref (context);
   gst_object_unref (wrapped_context);
 }
 
 GST_END_TEST;
 
+struct context_info
+{
+  GstGLAPI api;
+  guint major;
+  guint minor;
+  GstGLPlatform platform;
+  guintptr handle;
+};
+
+static void
+_fill_context_info (GstGLContext * context, struct context_info *info)
+{
+  info->handle = gst_gl_context_get_current_gl_context (info->platform);
+  info->api = gst_gl_context_get_current_gl_api (&info->major, &info->minor);
+}
+
+GST_START_TEST (test_current_context)
+{
+  GstGLContext *context;
+  GError *error = NULL;
+  guintptr handle;
+  GstGLPlatform platform;
+  GstGLAPI api;
+  gint major, minor;
+  struct context_info info;
+
+  context = gst_gl_context_new (display);
+
+  gst_gl_context_create (context, 0, &error);
+
+  fail_if (error != NULL, "Error creating master context %s\n",
+      error ? error->message : "Unknown Error");
+
+  handle = gst_gl_context_get_gl_context (context);
+  platform = gst_gl_context_get_gl_platform (context);
+  api = gst_gl_context_get_gl_api (context);
+  gst_gl_context_get_gl_version (context, &major, &minor);
+
+  info.platform = platform;
+
+  gst_gl_context_thread_add (context,
+      (GstGLContextThreadFunc) _fill_context_info, &info);
+
+  fail_if (info.platform != platform);
+  fail_if (info.api != api);
+  fail_if (info.major != major);
+  fail_if (info.minor != minor);
+  fail_if (info.handle != handle);
+
+  gst_object_unref (context);
+}
+
+GST_END_TEST;
+
 
 static Suite *
 gst_gl_context_suite (void)
@@ -352,6 +453,7 @@
   tcase_add_checked_fixture (tc_chain, setup, teardown);
   tcase_add_test (tc_chain, test_share);
   tcase_add_test (tc_chain, test_wrapped_context);
+  tcase_add_test (tc_chain, test_current_context);
 
   return s;
 }
diff --git a/tests/check/libs/gstglmemory.c b/tests/check/libs/gstglmemory.c
index 6aaffdd..74ab15b 100644
--- a/tests/check/libs/gstglmemory.c
+++ b/tests/check/libs/gstglmemory.c
@@ -54,57 +54,200 @@
   GstMemory *mem, *mem2;
   GstGLMemory *gl_mem, *gl_mem2;
   GstAllocator *gl_allocator;
-  gint i;
-  static GstVideoGLTextureType formats[] = {
-    GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_GL_TEXTURE_TYPE_RGB,
-    GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA,
-    GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
+  gint i, j;
+  static GstVideoFormat formats[] = {
+    GST_VIDEO_FORMAT_RGBA, GST_VIDEO_FORMAT_RGB,
+    GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_I420
   };
 
+  gl_allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
+  fail_if (gl_allocator == NULL);
+
+  /* test allocator creation */
+  ASSERT_WARNING (mem = gst_allocator_alloc (gl_allocator, 0, NULL));
+
   for (i = 0; i < G_N_ELEMENTS (formats); i++) {
-    gsize width = 320, height = 240, stride = 324;
+    GstVideoInfo v_info;
+    gsize width = 320, height = 240;
 
-    gl_allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
-    fail_if (gl_allocator == NULL);
+    gst_video_info_set_format (&v_info, formats[i], width, height);
 
-    /* test allocator creation */
-    ASSERT_WARNING (mem = gst_allocator_alloc (gl_allocator, 0, NULL););
-    mem = gst_gl_memory_alloc (context, formats[i], width, height, stride);
-    fail_if (mem == NULL);
-    gl_mem = (GstGLMemory *) mem;
+    for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&v_info); j++) {
+      mem = gst_gl_memory_alloc (context, NULL, &v_info, j, NULL);
+      fail_if (mem == NULL);
+      gl_mem = (GstGLMemory *) mem;
 
-    /* test init params */
-    fail_if (gl_mem->width != width);
-    fail_if (gl_mem->height != height);
-    fail_if (gl_mem->stride != stride);
-    fail_if (gl_mem->context != context);
-    fail_if (gl_mem->tex_id == 0);
+      /* test init params */
+      fail_if (gst_video_info_is_equal (&v_info, &gl_mem->info) == FALSE);
+      fail_if (gl_mem->context != context);
+      fail_if (gl_mem->tex_id == 0);
 
-    /* copy the memory */
-    mem2 = gst_memory_copy (mem, 0, -1);
-    fail_if (mem2 == NULL);
-    gl_mem2 = (GstGLMemory *) mem2;
+      /* copy the memory */
+      mem2 = gst_memory_copy (mem, 0, -1);
+      fail_if (mem2 == NULL);
+      gl_mem2 = (GstGLMemory *) mem2;
 
-    /* test params */
-    fail_if (gl_mem->tex_id == gl_mem2->tex_id);
-    fail_if (gl_mem->tex_type != gl_mem2->tex_type);
-    fail_if (gl_mem->width != gl_mem2->width);
-    fail_if (gl_mem->stride != gl_mem2->stride);
-    fail_if (gl_mem->context != gl_mem2->context);
+      /* test params */
+      fail_if (gst_video_info_is_equal (&gl_mem2->info,
+              &gl_mem->info) == FALSE);
+      fail_if (gl_mem->context != gl_mem2->context);
 
-    if (gst_gl_context_get_error ())
-      printf ("%s\n", gst_gl_context_get_error ());
-    fail_if (gst_gl_context_get_error () != NULL);
+      if (gst_gl_context_get_error ())
+        printf ("%s\n", gst_gl_context_get_error ());
+      fail_if (gst_gl_context_get_error () != NULL);
 
-    gst_memory_unref (mem);
-    gst_memory_unref (mem2);
-
-    gst_object_unref (gl_allocator);
+      gst_memory_unref (mem);
+      gst_memory_unref (mem2);
+    }
   }
+
+  gst_object_unref (gl_allocator);
 }
 
 GST_END_TEST;
 
+/* one red rgba pixel */
+static gchar rgba_pixel[] = {
+  0xff, 0x00, 0x00, 0xff,
+};
+
+GST_START_TEST (test_transfer)
+{
+  GstAllocator *gl_allocator;
+  GstVideoInfo v_info;
+  GstMemory *mem, *mem2, *mem3;
+  GstMapInfo map_info;
+
+  gl_allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
+  fail_if (gl_allocator == NULL);
+
+  gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 1, 1);
+
+  /* texture creation */
+  mem = (GstMemory *) gst_gl_memory_alloc (context, NULL, &v_info, 0, NULL);
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  /* test wrapping raw data */
+  mem2 =
+      (GstMemory *) gst_gl_memory_wrapped (context, &v_info, 0, NULL,
+      rgba_pixel, NULL, NULL);
+  fail_if (mem == NULL);
+
+  fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  /* wrapped texture creation */
+  mem3 = (GstMemory *) gst_gl_memory_wrapped_texture (context,
+      ((GstGLMemory *) mem)->tex_id, GL_TEXTURE_2D, &v_info, 0, NULL, NULL,
+      NULL);
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem3,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem3,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  /* check data/flags are correct */
+  fail_unless (gst_memory_map (mem2, &map_info, GST_MAP_READ));
+
+  fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  fail_unless (((gchar *) map_info.data)[0] == rgba_pixel[0]);
+  fail_unless (((gchar *) map_info.data)[1] == rgba_pixel[1]);
+  fail_unless (((gchar *) map_info.data)[2] == rgba_pixel[2]);
+  fail_unless (((gchar *) map_info.data)[3] == rgba_pixel[3]);
+
+  gst_memory_unmap (mem2, &map_info);
+
+  fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  fail_unless (gst_memory_map (mem2, &map_info, GST_MAP_READ | GST_MAP_GL));
+
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  /* test texture copy */
+  fail_unless (gst_gl_memory_copy_into_texture ((GstGLMemory *) mem2,
+          ((GstGLMemory *) mem)->tex_id, GST_VIDEO_GL_TEXTURE_TYPE_RGBA, 1, 1,
+          4, FALSE));
+  GST_GL_MEMORY_FLAG_SET (mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
+
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem2,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  gst_memory_unmap (mem2, &map_info);
+
+  /* test download of copied texture */
+  fail_unless (gst_memory_map (mem, &map_info, GST_MAP_READ));
+
+  fail_unless (((gchar *) map_info.data)[0] == rgba_pixel[0]);
+  fail_unless (((gchar *) map_info.data)[1] == rgba_pixel[1]);
+  fail_unless (((gchar *) map_info.data)[2] == rgba_pixel[2]);
+  fail_unless (((gchar *) map_info.data)[3] == rgba_pixel[3]);
+
+  gst_memory_unmap (mem, &map_info);
+
+  /* test download of wrapped copied texture */
+  fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_READ));
+
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  fail_unless (((gchar *) map_info.data)[0] == rgba_pixel[0]);
+  fail_unless (((gchar *) map_info.data)[1] == rgba_pixel[1]);
+  fail_unless (((gchar *) map_info.data)[2] == rgba_pixel[2]);
+  fail_unless (((gchar *) map_info.data)[3] == rgba_pixel[3]);
+
+  gst_memory_unmap (mem3, &map_info);
+
+  /* test upload flag */
+  fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_WRITE));
+  gst_memory_unmap (mem3, &map_info);
+
+  fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem3,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem3,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  /* test download flag */
+  fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_WRITE | GST_MAP_GL));
+  gst_memory_unmap (mem3, &map_info);
+
+  fail_unless (!GST_GL_MEMORY_FLAG_IS_SET (mem3,
+          GST_GL_MEMORY_FLAG_NEED_UPLOAD));
+  fail_unless (GST_GL_MEMORY_FLAG_IS_SET (mem3,
+          GST_GL_MEMORY_FLAG_NEED_DOWNLOAD));
+
+  if (gst_gl_context_get_error ())
+    printf ("%s\n", gst_gl_context_get_error ());
+  fail_if (gst_gl_context_get_error () != NULL);
+
+  gst_memory_unref (mem);
+  gst_memory_unref (mem2);
+  gst_memory_unref (mem3);
+  gst_object_unref (gl_allocator);
+}
+
+GST_END_TEST;
 
 static Suite *
 gst_gl_memory_suite (void)
@@ -115,6 +258,7 @@
   suite_add_tcase (s, tc_chain);
   tcase_add_checked_fixture (tc_chain, setup, teardown);
   tcase_add_test (tc_chain, test_basic);
+  tcase_add_test (tc_chain, test_transfer);
 
   return s;
 }
diff --git a/tests/check/libs/gstglupload.c b/tests/check/libs/gstglupload.c
index 1960b1e..214d36a 100644
--- a/tests/check/libs/gstglupload.c
+++ b/tests/check/libs/gstglupload.c
@@ -226,20 +226,36 @@
 
 GST_START_TEST (test_upload_data)
 {
-  gpointer data[GST_VIDEO_MAX_PLANES] = { rgba_data, NULL, NULL, NULL };
-  GstVideoInfo in_info;
+  GstCaps *in_caps, *out_caps;
+  GstBuffer *inbuf, *outbuf;
+  GstMapInfo map_info;
   gboolean res;
   gint i = 0;
 
-  gst_video_info_set_format (&in_info, GST_VIDEO_FORMAT_RGBA, WIDTH, HEIGHT);
+  in_caps = gst_caps_from_string ("video/x-raw,format=RGBA,"
+      "width=10,height=10");
+  out_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),"
+      "format=RGBA,width=10,height=10");
 
-  gst_gl_upload_set_format (upload, &in_info);
+  gst_gl_upload_set_caps (upload, in_caps, out_caps);
 
-  res = gst_gl_upload_perform_with_data (upload, &tex_id, data);
+  inbuf = gst_buffer_new_wrapped_full (0, rgba_data, WIDTH * HEIGHT * 4,
+      0, WIDTH * HEIGHT * 4, NULL, NULL);
+
+  res = gst_gl_upload_perform_with_buffer (upload, inbuf, &outbuf);
   fail_if (res == FALSE, "Failed to upload buffer: %s\n",
       gst_gl_context_get_error ());
+  fail_unless (GST_IS_BUFFER (outbuf));
 
-  gst_gl_window_draw (window, WIDTH, HEIGHT);
+  res = gst_buffer_map (outbuf, &map_info, GST_MAP_READ | GST_MAP_GL);
+  fail_if (res == FALSE, "Failed to map gl memory");
+
+  tex_id = *(guint *) map_info.data;
+
+  gst_buffer_unmap (outbuf, &map_info);
+
+  gst_gl_window_set_preferred_size (window, WIDTH, HEIGHT);
+  gst_gl_window_draw (window);
 
   gst_gl_window_send_message (window, GST_GL_WINDOW_CB (init), context);
 
@@ -248,33 +264,52 @@
         context);
     i++;
   }
+
+  gst_buffer_unref (inbuf);
+  gst_buffer_unref (outbuf);
 }
 
 GST_END_TEST;
 
 GST_START_TEST (test_upload_buffer)
 {
-  GstBuffer *buffer;
+  GstBuffer *buffer, *outbuf;
   GstGLMemory *gl_mem;
+  GstCaps *in_caps, *out_caps;
   GstVideoInfo in_info;
+  GstMapInfo map_info;
   gint i = 0;
   gboolean res;
 
-  gst_video_info_set_format (&in_info, GST_VIDEO_FORMAT_RGBA, WIDTH, HEIGHT);
+  in_caps = gst_caps_from_string ("video/x-raw,format=RGBA,width=10,height=10");
+  gst_video_info_from_caps (&in_info, in_caps);
 
   /* create GL buffer */
   buffer = gst_buffer_new ();
-  gl_mem = gst_gl_memory_wrapped (context, FORMAT, WIDTH, HEIGHT, WIDTH * 4,
-      rgba_data, NULL, NULL);
+  gl_mem =
+      gst_gl_memory_wrapped (context, &in_info, 0, NULL, rgba_data, NULL, NULL);
+
+  res =
+      gst_memory_map ((GstMemory *) gl_mem, &map_info,
+      GST_MAP_READ | GST_MAP_GL);
+  fail_if (res == FALSE, "Failed to map gl memory\n");
+  tex_id = *(guint *) map_info.data;
+  gst_memory_unmap ((GstMemory *) gl_mem, &map_info);
+
   gst_buffer_append_memory (buffer, (GstMemory *) gl_mem);
 
-  gst_gl_upload_set_format (upload, &in_info);
+  out_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),"
+      "format=RGBA,width=10,height=10");
 
-  res = gst_gl_upload_perform_with_buffer (upload, buffer, &tex_id);
+  gst_gl_upload_set_caps (upload, in_caps, out_caps);
+
+  res = gst_gl_upload_perform_with_buffer (upload, buffer, &outbuf);
   fail_if (res == FALSE, "Failed to upload buffer: %s\n",
       gst_gl_context_get_error ());
+  fail_unless (GST_IS_BUFFER (outbuf));
 
-  gst_gl_window_draw (window, WIDTH, HEIGHT);
+  gst_gl_window_set_preferred_size (window, WIDTH, HEIGHT);
+  gst_gl_window_draw (window);
   gst_gl_window_send_message (window, GST_GL_WINDOW_CB (init), context);
 
   while (i < 2) {
@@ -285,6 +320,7 @@
 
   gst_gl_upload_release_buffer (upload);
   gst_buffer_unref (buffer);
+  gst_buffer_unref (outbuf);
 }
 
 GST_END_TEST;
@@ -304,8 +340,8 @@
 
   /* create GL buffer */
   buffer = gst_buffer_new ();
-  gl_mem = gst_gl_memory_wrapped (context, FORMAT, WIDTH, HEIGHT, WIDTH * 4,
-      rgba_data, NULL, NULL);
+  gl_mem =
+      gst_gl_memory_wrapped (context, &in_info, 0, NULL, rgba_data, NULL, NULL);
   gst_buffer_append_memory (buffer, (GstMemory *) gl_mem);
 
   gst_gl_context_gen_texture (context, &tex_ids[0], GST_VIDEO_FORMAT_RGBA,
@@ -314,7 +350,6 @@
   upload_meta = gst_gl_upload_meta_new (context);
   gst_gl_upload_meta_set_format (upload_meta, &in_info);
 
-  gst_gl_upload_set_format (upload, &in_info);
   gst_buffer_add_video_meta_full (buffer, 0, GST_VIDEO_FORMAT_RGBA, WIDTH,
       HEIGHT, 1, in_info.offset, in_info.stride);
   gst_gl_upload_meta_add_to_buffer (upload_meta, buffer);
@@ -327,7 +362,9 @@
   fail_if (res == FALSE, "Failed to upload GstVideoGLTextureUploadMeta\n");
 
   tex_id = tex_ids[0];
-  gst_gl_window_draw (window, WIDTH, HEIGHT);
+
+  gst_gl_window_set_preferred_size (window, WIDTH, HEIGHT);
+  gst_gl_window_draw (window);
   gst_gl_window_send_message (window, GST_GL_WINDOW_CB (init), context);
 
   while (i < 2) {
diff --git a/tests/check/orc/audiomixer.c b/tests/check/orc/audiomixer.c
deleted file mode 100644
index d0efcb8..0000000
--- a/tests/check/orc/audiomixer.c
+++ /dev/null
@@ -1,1730 +0,0 @@
-
-/* autogenerated from gstaudiomixerorc.orc */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.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 ORC_INTERNAL
-#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
-#define ORC_INTERNAL __hidden
-#elif defined (__GNUC__)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#else
-#define ORC_INTERNAL
-#endif
-#endif
-
-#include <orc/orc.h>
-#include <orc-test/orctest.h>
-
-/* 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)&0xffU)<<8) | (((x)&0xff00U)>>8))
-#define ORC_SWAP_L(x) ((((x)&0xffU)<<24) | (((x)&0xff00U)<<8) | (((x)&0xff0000U)>>8) | (((x)&0xff000000U)>>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 */
-
-
-/* audiomixer_orc_add_s32 */
-static void
-_backup_audiomixer_orc_add_s32 (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;
-  orc_union32 var34;
-
-  ptr0 = (orc_union32 *)ex->arrays[0];
-  ptr4 = (orc_union32 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadl */
-    var32 = ptr0[i];
-    /* 1: loadl */
-    var33 = ptr4[i];
-    /* 2: addssl */
-    var34.i = ORC_CLAMP_SL((orc_int64)var32.i + (orc_int64)var33.i);
-    /* 3: storel */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_add_s16 */
-static void
-_backup_audiomixer_orc_add_s16 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union16 * ORC_RESTRICT ptr0;
-  const orc_union16 * ORC_RESTRICT ptr4;
-  orc_union16 var32;
-  orc_union16 var33;
-  orc_union16 var34;
-
-  ptr0 = (orc_union16 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var32 = ptr0[i];
-    /* 1: loadw */
-    var33 = ptr4[i];
-    /* 2: addssw */
-    var34.i = ORC_CLAMP_SW(var32.i + var33.i);
-    /* 3: storew */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_add_s8 */
-static void
-_backup_audiomixer_orc_add_s8 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_int8 * ORC_RESTRICT ptr0;
-  const orc_int8 * ORC_RESTRICT ptr4;
-  orc_int8 var32;
-  orc_int8 var33;
-  orc_int8 var34;
-
-  ptr0 = (orc_int8 *)ex->arrays[0];
-  ptr4 = (orc_int8 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadb */
-    var32 = ptr0[i];
-    /* 1: loadb */
-    var33 = ptr4[i];
-    /* 2: addssb */
-    var34 = ORC_CLAMP_SB(var32 + var33);
-    /* 3: storeb */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_add_u32 */
-static void
-_backup_audiomixer_orc_add_u32 (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;
-  orc_union32 var34;
-
-  ptr0 = (orc_union32 *)ex->arrays[0];
-  ptr4 = (orc_union32 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadl */
-    var32 = ptr0[i];
-    /* 1: loadl */
-    var33 = ptr4[i];
-    /* 2: addusl */
-    var34.i = ORC_CLAMP_UL((orc_int64)(orc_uint32)var32.i + (orc_int64)(orc_uint32)var33.i);
-    /* 3: storel */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_add_u16 */
-static void
-_backup_audiomixer_orc_add_u16 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union16 * ORC_RESTRICT ptr0;
-  const orc_union16 * ORC_RESTRICT ptr4;
-  orc_union16 var32;
-  orc_union16 var33;
-  orc_union16 var34;
-
-  ptr0 = (orc_union16 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var32 = ptr0[i];
-    /* 1: loadw */
-    var33 = ptr4[i];
-    /* 2: addusw */
-    var34.i = ORC_CLAMP_UW((orc_uint16)var32.i + (orc_uint16)var33.i);
-    /* 3: storew */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_add_u8 */
-static void
-_backup_audiomixer_orc_add_u8 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_int8 * ORC_RESTRICT ptr0;
-  const orc_int8 * ORC_RESTRICT ptr4;
-  orc_int8 var32;
-  orc_int8 var33;
-  orc_int8 var34;
-
-  ptr0 = (orc_int8 *)ex->arrays[0];
-  ptr4 = (orc_int8 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadb */
-    var32 = ptr0[i];
-    /* 1: loadb */
-    var33 = ptr4[i];
-    /* 2: addusb */
-    var34 = ORC_CLAMP_UB((orc_uint8)var32 + (orc_uint8)var33);
-    /* 3: storeb */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_add_f32 */
-static void
-_backup_audiomixer_orc_add_f32 (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;
-  orc_union32 var34;
-
-  ptr0 = (orc_union32 *)ex->arrays[0];
-  ptr4 = (orc_union32 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadl */
-    var32 = ptr0[i];
-    /* 1: loadl */
-    var33 = ptr4[i];
-    /* 2: addf */
-    {
-       orc_union32 _src1;
-       orc_union32 _src2;
-       orc_union32 _dest1;
-       _src1.i = ORC_DENORMAL(var32.i);
-       _src2.i = ORC_DENORMAL(var33.i);
-       _dest1.f = _src1.f + _src2.f;
-       var34.i = ORC_DENORMAL(_dest1.i);
-    }
-    /* 3: storel */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_add_f64 */
-static void
-_backup_audiomixer_orc_add_f64 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union64 * ORC_RESTRICT ptr0;
-  const orc_union64 * ORC_RESTRICT ptr4;
-  orc_union64 var32;
-  orc_union64 var33;
-  orc_union64 var34;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union64 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadq */
-    var32 = ptr0[i];
-    /* 1: loadq */
-    var33 = ptr4[i];
-    /* 2: addd */
-    {
-       orc_union64 _src1;
-       orc_union64 _src2;
-       orc_union64 _dest1;
-       _src1.i = ORC_DENORMAL_DOUBLE(var32.i);
-       _src2.i = ORC_DENORMAL_DOUBLE(var33.i);
-       _dest1.f = _src1.f + _src2.f;
-       var34.i = ORC_DENORMAL_DOUBLE(_dest1.i);
-    }
-    /* 3: storeq */
-    ptr0[i] = var34;
-  }
-
-}
-
-/* audiomixer_orc_volume_u8 */
-static void
-_backup_audiomixer_orc_volume_u8 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_int8 * ORC_RESTRICT ptr0;
-  orc_int8 var34;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_int8 var35;
-#else
-  orc_int8 var35;
-#endif
-  orc_int8 var36;
-  orc_int8 var37;
-  orc_int8 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_int8 var41;
-
-  ptr0 = (orc_int8 *)ex->arrays[0];
-
-    /* 1: loadpb */
-    var35 = (int)0x00000080; /* 128 or 6.32404e-322f */
-    /* 3: loadpb */
-    var36 = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadb */
-    var34 = ptr0[i];
-    /* 2: xorb */
-    var38 = var34 ^ var35;
-    /* 4: mulsbw */
-    var39.i = var38 * var36;
-    /* 5: shrsw */
-    var40.i = var39.i >> 3;
-    /* 6: convssswb */
-    var41 = ORC_CLAMP_SB(var40.i);
-    /* 7: xorb */
-    var37 = var41 ^ var35;
-    /* 8: storeb */
-    ptr0[i] = var37;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_u8 */
-static void
-_backup_audiomixer_orc_add_volume_u8 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_int8 * ORC_RESTRICT ptr0;
-  const orc_int8 * ORC_RESTRICT ptr4;
-  orc_int8 var34;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_int8 var35;
-#else
-  orc_int8 var35;
-#endif
-  orc_int8 var36;
-  orc_int8 var37;
-  orc_int8 var38;
-  orc_int8 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-  orc_int8 var42;
-  orc_int8 var43;
-
-  ptr0 = (orc_int8 *)ex->arrays[0];
-  ptr4 = (orc_int8 *)ex->arrays[4];
-
-    /* 1: loadpb */
-    var35 = (int)0x00000080; /* 128 or 6.32404e-322f */
-    /* 3: loadpb */
-    var36 = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadb */
-    var34 = ptr4[i];
-    /* 2: xorb */
-    var39 = var34 ^ var35;
-    /* 4: mulsbw */
-    var40.i = var39 * var36;
-    /* 5: shrsw */
-    var41.i = var40.i >> 3;
-    /* 6: convssswb */
-    var42 = ORC_CLAMP_SB(var41.i);
-    /* 7: xorb */
-    var43 = var42 ^ var35;
-    /* 8: loadb */
-    var37 = ptr0[i];
-    /* 9: addusb */
-    var38 = ORC_CLAMP_UB((orc_uint8)var37 + (orc_uint8)var43);
-    /* 10: storeb */
-    ptr0[i] = var38;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_s8 */
-static void
-_backup_audiomixer_orc_add_volume_s8 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_int8 * ORC_RESTRICT ptr0;
-  const orc_int8 * ORC_RESTRICT ptr4;
-  orc_int8 var34;
-  orc_int8 var35;
-  orc_int8 var36;
-  orc_int8 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_int8 var40;
-
-  ptr0 = (orc_int8 *)ex->arrays[0];
-  ptr4 = (orc_int8 *)ex->arrays[4];
-
-    /* 1: loadpb */
-    var35 = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadb */
-    var34 = ptr4[i];
-    /* 2: mulsbw */
-    var38.i = var34 * var35;
-    /* 3: shrsw */
-    var39.i = var38.i >> 3;
-    /* 4: convssswb */
-    var40 = ORC_CLAMP_SB(var39.i);
-    /* 5: loadb */
-    var36 = ptr0[i];
-    /* 6: addssb */
-    var37 = ORC_CLAMP_SB(var36 + var40);
-    /* 7: storeb */
-    ptr0[i] = var37;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_u16 */
-static void
-_backup_audiomixer_orc_add_volume_u16 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union16 * ORC_RESTRICT ptr0;
-  const orc_union16 * ORC_RESTRICT ptr4;
-  orc_union16 var34;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var35;
-#else
-  orc_union16 var35;
-#endif
-  orc_union16 var36;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union32 var40;
-  orc_union32 var41;
-  orc_union16 var42;
-  orc_union16 var43;
-
-  ptr0 = (orc_union16 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-
-    /* 1: loadpw */
-    var35.i = (int)0x00008000; /* 32768 or 1.61895e-319f */
-    /* 3: loadpw */
-    var36.i = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var34 = ptr4[i];
-    /* 2: xorw */
-    var39.i = var34.i ^ var35.i;
-    /* 4: mulswl */
-    var40.i = var39.i * var36.i;
-    /* 5: shrsl */
-    var41.i = var40.i >> 11;
-    /* 6: convssslw */
-    var42.i = ORC_CLAMP_SW(var41.i);
-    /* 7: xorw */
-    var43.i = var42.i ^ var35.i;
-    /* 8: loadw */
-    var37 = ptr0[i];
-    /* 9: addusw */
-    var38.i = ORC_CLAMP_UW((orc_uint16)var37.i + (orc_uint16)var43.i);
-    /* 10: storew */
-    ptr0[i] = var38;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_s16 */
-static void
-_backup_audiomixer_orc_add_volume_s16 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union16 * ORC_RESTRICT ptr0;
-  const orc_union16 * ORC_RESTRICT ptr4;
-  orc_union16 var34;
-  orc_union16 var35;
-  orc_union16 var36;
-  orc_union16 var37;
-  orc_union32 var38;
-  orc_union32 var39;
-  orc_union16 var40;
-
-  ptr0 = (orc_union16 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-
-    /* 1: loadpw */
-    var35.i = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var34 = ptr4[i];
-    /* 2: mulswl */
-    var38.i = var34.i * var35.i;
-    /* 3: shrsl */
-    var39.i = var38.i >> 11;
-    /* 4: convssslw */
-    var40.i = ORC_CLAMP_SW(var39.i);
-    /* 5: loadw */
-    var36 = ptr0[i];
-    /* 6: addssw */
-    var37.i = ORC_CLAMP_SW(var36.i + var40.i);
-    /* 7: storew */
-    ptr0[i] = var37;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_u32 */
-static void
-_backup_audiomixer_orc_add_volume_u32 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union32 * ORC_RESTRICT ptr0;
-  const orc_union32 * ORC_RESTRICT ptr4;
-  orc_union32 var34;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union32 var35;
-#else
-  orc_union32 var35;
-#endif
-  orc_union32 var36;
-  orc_union32 var37;
-  orc_union32 var38;
-  orc_union32 var39;
-  orc_union64 var40;
-  orc_union64 var41;
-  orc_union32 var42;
-  orc_union32 var43;
-
-  ptr0 = (orc_union32 *)ex->arrays[0];
-  ptr4 = (orc_union32 *)ex->arrays[4];
-
-    /* 1: loadpl */
-    var35.i = (int)0x80000000; /* -2147483648 or 1.061e-314f */
-    /* 3: loadpl */
-    var36.i = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadl */
-    var34 = ptr4[i];
-    /* 2: xorl */
-    var39.i = var34.i ^ var35.i;
-    /* 4: mulslq */
-    var40.i = ((orc_int64)var39.i) * ((orc_int64)var36.i);
-    /* 5: shrsq */
-    var41.i = var40.i >> 27;
-    /* 6: convsssql */
-    var42.i = ORC_CLAMP_SL(var41.i);
-    /* 7: xorl */
-    var43.i = var42.i ^ var35.i;
-    /* 8: loadl */
-    var37 = ptr0[i];
-    /* 9: addusl */
-    var38.i = ORC_CLAMP_UL((orc_int64)(orc_uint32)var37.i + (orc_int64)(orc_uint32)var43.i);
-    /* 10: storel */
-    ptr0[i] = var38;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_s32 */
-static void
-_backup_audiomixer_orc_add_volume_s32 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union32 * ORC_RESTRICT ptr0;
-  const orc_union32 * ORC_RESTRICT ptr4;
-  orc_union32 var34;
-  orc_union32 var35;
-  orc_union32 var36;
-  orc_union32 var37;
-  orc_union64 var38;
-  orc_union64 var39;
-  orc_union32 var40;
-
-  ptr0 = (orc_union32 *)ex->arrays[0];
-  ptr4 = (orc_union32 *)ex->arrays[4];
-
-    /* 1: loadpl */
-    var35.i = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadl */
-    var34 = ptr4[i];
-    /* 2: mulslq */
-    var38.i = ((orc_int64)var34.i) * ((orc_int64)var35.i);
-    /* 3: shrsq */
-    var39.i = var38.i >> 27;
-    /* 4: convsssql */
-    var40.i = ORC_CLAMP_SL(var39.i);
-    /* 5: loadl */
-    var36 = ptr0[i];
-    /* 6: addssl */
-    var37.i = ORC_CLAMP_SL((orc_int64)var36.i + (orc_int64)var40.i);
-    /* 7: storel */
-    ptr0[i] = var37;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_f32 */
-static void
-_backup_audiomixer_orc_add_volume_f32 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union32 * ORC_RESTRICT ptr0;
-  const orc_union32 * ORC_RESTRICT ptr4;
-  orc_union32 var33;
-  orc_union32 var34;
-  orc_union32 var35;
-  orc_union32 var36;
-  orc_union32 var37;
-
-  ptr0 = (orc_union32 *)ex->arrays[0];
-  ptr4 = (orc_union32 *)ex->arrays[4];
-
-    /* 1: loadpl */
-    var34.i = ex->params[24];
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadl */
-    var33 = ptr4[i];
-    /* 2: mulf */
-    {
-       orc_union32 _src1;
-       orc_union32 _src2;
-       orc_union32 _dest1;
-       _src1.i = ORC_DENORMAL(var33.i);
-       _src2.i = ORC_DENORMAL(var34.i);
-       _dest1.f = _src1.f * _src2.f;
-       var37.i = ORC_DENORMAL(_dest1.i);
-    }
-    /* 3: loadl */
-    var35 = ptr0[i];
-    /* 4: addf */
-    {
-       orc_union32 _src1;
-       orc_union32 _src2;
-       orc_union32 _dest1;
-       _src1.i = ORC_DENORMAL(var35.i);
-       _src2.i = ORC_DENORMAL(var37.i);
-       _dest1.f = _src1.f + _src2.f;
-       var36.i = ORC_DENORMAL(_dest1.i);
-    }
-    /* 5: storel */
-    ptr0[i] = var36;
-  }
-
-}
-
-/* audiomixer_orc_add_volume_f64 */
-static void
-_backup_audiomixer_orc_add_volume_f64 (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union64 * ORC_RESTRICT ptr0;
-  const orc_union64 * ORC_RESTRICT ptr4;
-  orc_union64 var33;
-  orc_union64 var34;
-  orc_union64 var35;
-  orc_union64 var36;
-  orc_union64 var37;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union64 *)ex->arrays[4];
-
-    /* 1: loadpq */
-    var34.i = (ex->params[24] & 0xffffffff) | ((orc_uint64)(ex->params[24 + (ORC_VAR_T1 - ORC_VAR_P1)]) << 32);
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadq */
-    var33 = ptr4[i];
-    /* 2: muld */
-    {
-       orc_union64 _src1;
-       orc_union64 _src2;
-       orc_union64 _dest1;
-       _src1.i = ORC_DENORMAL_DOUBLE(var33.i);
-       _src2.i = ORC_DENORMAL_DOUBLE(var34.i);
-       _dest1.f = _src1.f * _src2.f;
-       var37.i = ORC_DENORMAL_DOUBLE(_dest1.i);
-    }
-    /* 3: loadq */
-    var35 = ptr0[i];
-    /* 4: addd */
-    {
-       orc_union64 _src1;
-       orc_union64 _src2;
-       orc_union64 _dest1;
-       _src1.i = ORC_DENORMAL_DOUBLE(var35.i);
-       _src2.i = ORC_DENORMAL_DOUBLE(var37.i);
-       _dest1.f = _src1.f + _src2.f;
-       var36.i = ORC_DENORMAL_DOUBLE(_dest1.i);
-    }
-    /* 5: storeq */
-    ptr0[i] = var36;
-  }
-
-}
-
-
-static int quiet = 0;
-static int benchmark = 0;
-
-static void help (const char *argv0)
-{
-  printf("Usage:\n");
-  printf("  %s [OPTION]\n", argv0);
-  printf("Help Options:\n");
-  printf("  -h, --help          Show help options\n");
-  printf("Application Options:\n");
-  printf("  -b, --benchmark     Run benchmark and show results\n");
-  printf("  -q, --quiet         Don't output anything except on failures\n");
-
-  exit(0);
-}
-
-int
-main (int argc, char *argv[])
-{
-  int error = FALSE;
-  int i;
-
-  orc_test_init ();
-
-  for(i=1;i<argc;i++) {
-    if (strcmp(argv[i], "--help") == 0 ||
-      strcmp(argv[i], "-h") == 0) {
-      help(argv[0]);
-    } else if (strcmp(argv[i], "--quiet") == 0 ||
-      strcmp(argv[i], "-q") == 0) {
-      quiet = 1;
-      benchmark = 0;
-    } else if (strcmp(argv[i], "--benchmark") == 0 ||
-      strcmp(argv[i], "-b") == 0) {
-      benchmark = 1;
-      quiet = 0;
-    }
-  }
-
-  /* audiomixer_orc_add_s32 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_s32:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_s32");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_s32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-
-      orc_program_append_2 (p, "addssl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_s16 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_s16:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_s16");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_s16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 2, "s1");
-
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_s8 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_s8:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_s8");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_s8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 1, "s1");
-
-      orc_program_append_2 (p, "addssb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_u32 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_u32:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_u32");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_u32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-
-      orc_program_append_2 (p, "addusl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_u16 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_u16:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_u16");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_u16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 2, "s1");
-
-      orc_program_append_2 (p, "addusw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_u8 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_u8:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_u8");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_u8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 1, "s1");
-
-      orc_program_append_2 (p, "addusb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_f32 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_f32:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_f32");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_f32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-
-      orc_program_append_2 (p, "addf", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_f64 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_f64:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_f64");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_f64);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 8, "s1");
-
-      orc_program_append_2 (p, "addd", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_volume_u8 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_volume_u8:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_volume_u8");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_volume_u8);
-    orc_program_add_destination (p, 1, "d1");
-      orc_program_add_constant (p, 1, 0x00000080, "c1");
-      orc_program_add_constant (p, 2, 0x00000003, "c2");
-    orc_program_add_parameter (p, 1, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 1, "t2");
-
-      orc_program_append_2 (p, "xorb", 0, ORC_VAR_T2, ORC_VAR_D1, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulsbw", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "xorb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_u8 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_u8:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_u8");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_u8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 1, "s1");
-      orc_program_add_constant (p, 1, 0x00000080, "c1");
-      orc_program_add_constant (p, 2, 0x00000003, "c2");
-    orc_program_add_parameter (p, 1, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 1, "t2");
-
-      orc_program_append_2 (p, "xorb", 0, ORC_VAR_T2, ORC_VAR_S1, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulsbw", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "xorb", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "addusb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_s8 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_s8:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_s8");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_s8);
-    orc_program_add_destination (p, 1, "d1");
-    orc_program_add_source (p, 1, "s1");
-      orc_program_add_constant (p, 2, 0x00000003, "c1");
-    orc_program_add_parameter (p, 1, "p1");
-    orc_program_add_temporary (p, 2, "t1");
-    orc_program_add_temporary (p, 1, "t2");
-
-      orc_program_append_2 (p, "mulsbw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1, 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, "convssswb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "addssb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_u16 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_u16:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_u16");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_u16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 2, "s1");
-      orc_program_add_constant (p, 2, 0x00008000, "c1");
-      orc_program_add_constant (p, 4, 0x0000000b, "c2");
-    orc_program_add_parameter (p, 2, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-      orc_program_append_2 (p, "xorw", 0, ORC_VAR_T2, ORC_VAR_S1, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulswl", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "convssslw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "xorw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "addusw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_s16 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_s16:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_s16");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_s16);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_source (p, 2, "s1");
-      orc_program_add_constant (p, 4, 0x0000000b, "c1");
-    orc_program_add_parameter (p, 2, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-    orc_program_add_temporary (p, 2, "t2");
-
-      orc_program_append_2 (p, "mulswl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "shrsl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "convssslw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "addssw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_u32 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_u32:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_u32");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_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_constant_int64 (p, 8, 0x000000000000001bULL, "c2");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 8, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-      orc_program_append_2 (p, "xorl", 0, ORC_VAR_T2, ORC_VAR_S1, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mulslq", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "shrsq", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "convsssql", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1, 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, "addusl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_s32 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_s32:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_s32");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_s32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-      orc_program_add_constant_int64 (p, 8, 0x000000000000001bULL, "c1");
-    orc_program_add_parameter (p, 4, "p1");
-    orc_program_add_temporary (p, 8, "t1");
-    orc_program_add_temporary (p, 4, "t2");
-
-      orc_program_append_2 (p, "mulslq", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "shrsq", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "convsssql", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "addssl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_f32 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_f32:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_f32");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_f32);
-    orc_program_add_destination (p, 4, "d1");
-    orc_program_add_source (p, 4, "s1");
-    orc_program_add_parameter_float (p, 4, "p1");
-    orc_program_add_temporary (p, 4, "t1");
-
-      orc_program_append_2 (p, "mulf", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "addf", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* audiomixer_orc_add_volume_f64 */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("audiomixer_orc_add_volume_f64:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "audiomixer_orc_add_volume_f64");
-    orc_program_set_backup_function (p, _backup_audiomixer_orc_add_volume_f64);
-    orc_program_add_destination (p, 8, "d1");
-    orc_program_add_source (p, 8, "s1");
-    orc_program_add_parameter_double (p, 8, "p1");
-    orc_program_add_temporary (p, 8, "t1");
-
-      orc_program_append_2 (p, "muld", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_P1, ORC_VAR_D1);
-      orc_program_append_2 (p, "addd", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-
-  if (error) {
-    return 1;
-  };
-  return 0;
-}
diff --git a/tests/check/orc/bayer.c b/tests/check/orc/bayer.c
deleted file mode 100644
index ee54899..0000000
--- a/tests/check/orc/bayer.c
+++ /dev/null
@@ -1,2017 +0,0 @@
-
-/* autogenerated from gstbayerorc.orc */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.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 ORC_INTERNAL
-#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
-#define ORC_INTERNAL __hidden
-#elif defined (__GNUC__)
-#define ORC_INTERNAL __attribute__((visibility("hidden")))
-#else
-#define ORC_INTERNAL
-#endif
-#endif
-
-#include <orc/orc.h>
-#include <orc-test/orctest.h>
-
-/* 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)&0xffU)<<8) | (((x)&0xff00U)>>8))
-#define ORC_SWAP_L(x) ((((x)&0xffU)<<24) | (((x)&0xff00U)<<8) | (((x)&0xff0000U)>>8) | (((x)&0xff000000U)>>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 */
-
-
-/* bayer_orc_horiz_upsample_unaligned */
-static void
-_backup_bayer_orc_horiz_upsample_unaligned (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union16 * ORC_RESTRICT ptr0;
-  orc_union16 * ORC_RESTRICT ptr1;
-  const orc_union16 * ORC_RESTRICT ptr4;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_int8 var40;
-  orc_int8 var41;
-  orc_union16 var42;
-  orc_int8 var43;
-  orc_int8 var44;
-  orc_int8 var45;
-  orc_int8 var46;
-
-  ptr0 = (orc_union16 *)ex->arrays[0];
-  ptr1 = (orc_union16 *)ex->arrays[1];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr4[i];
-    /* 1: splitwb */
-    {
-       orc_union16 _src;
-       _src.i = var37.i;
-       var40 = _src.x2[1];
-       var41 = _src.x2[0];
-    }
-    /* 2: loadoffw */
-    var42 = ptr4[i + 1];
-    /* 3: splitwb */
-    {
-       orc_union16 _src;
-       _src.i = var42.i;
-       var43 = _src.x2[1];
-       var44 = _src.x2[0];
-    }
-    /* 4: avgub */
-    var45 = ((orc_uint8)var40 + (orc_uint8)var43 + 1)>>1;
-    /* 5: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var40;
-       _dest.x2[1] = var45;
-       var38.i = _dest.i;
-    }
-    /* 6: storew */
-    ptr0[i] = var38;
-    /* 7: avgub */
-    var46 = ((orc_uint8)var41 + (orc_uint8)var44 + 1)>>1;
-    /* 8: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46;
-       _dest.x2[1] = var44;
-       var39.i = _dest.i;
-    }
-    /* 9: storew */
-    ptr1[i] = var39;
-  }
-
-}
-
-/* bayer_orc_horiz_upsample */
-static void
-_backup_bayer_orc_horiz_upsample (OrcExecutor * ORC_RESTRICT ex)
-{
-  int i;
-  int n = ex->n;
-  orc_union16 * ORC_RESTRICT ptr0;
-  orc_union16 * ORC_RESTRICT ptr1;
-  const orc_union16 * ORC_RESTRICT ptr4;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 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_union16 *)ex->arrays[0];
-  ptr1 = (orc_union16 *)ex->arrays[1];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadoffw */
-    var40 = ptr4[i + -1];
-    /* 1: select1wb */
-    {
-       orc_union16 _src;
-       _src.i = var40.i;
-       var41 = _src.x2[1];
-    }
-    /* 2: loadw */
-    var37 = ptr4[i];
-    /* 3: splitwb */
-    {
-       orc_union16 _src;
-       _src.i = var37.i;
-       var42 = _src.x2[1];
-       var43 = _src.x2[0];
-    }
-    /* 4: loadoffw */
-    var44 = ptr4[i + 1];
-    /* 5: select0wb */
-    {
-       orc_union16 _src;
-       _src.i = var44.i;
-       var45 = _src.x2[0];
-    }
-    /* 6: avgub */
-    var46 = ((orc_uint8)var43 + (orc_uint8)var45 + 1)>>1;
-    /* 7: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var43;
-       _dest.x2[1] = var46;
-       var38.i = _dest.i;
-    }
-    /* 8: storew */
-    ptr0[i] = var38;
-    /* 9: avgub */
-    var47 = ((orc_uint8)var41 + (orc_uint8)var42 + 1)>>1;
-    /* 10: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var47;
-       _dest.x2[1] = var42;
-       var39.i = _dest.i;
-    }
-    /* 11: storew */
-    ptr1[i] = var39;
-  }
-
-}
-
-/* bayer_orc_merge_bg_bgra */
-static void
-_backup_bayer_orc_merge_bg_bgra (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-    /* 11: loadpw */
-    var43.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr5[i];
-    /* 1: loadw */
-    var38 = ptr9[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr4[i];
-    /* 4: loadw */
-    var40 = ptr8[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr7[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: loadw */
-    var44 = ptr6[i];
-    /* 15: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[0];
-       _dest.x2[1] = var52.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[1];
-       _dest.x2[1] = var52.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[0];
-       _dest.x2[1] = var42.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[1];
-       _dest.x2[1] = var42.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-/* bayer_orc_merge_gr_bgra */
-static void
-_backup_bayer_orc_merge_gr_bgra (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-    /* 11: loadpw */
-    var43.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr4[i];
-    /* 1: loadw */
-    var38 = ptr8[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr5[i];
-    /* 4: loadw */
-    var40 = ptr9[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr6[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[0];
-       _dest.x2[1] = var52.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[1];
-       _dest.x2[1] = var52.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 15: loadw */
-    var44 = ptr7[i];
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[0];
-       _dest.x2[1] = var43.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[1];
-       _dest.x2[1] = var43.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-/* bayer_orc_merge_bg_abgr */
-static void
-_backup_bayer_orc_merge_bg_abgr (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-    /* 11: loadpw */
-    var43.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr5[i];
-    /* 1: loadw */
-    var38 = ptr9[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr4[i];
-    /* 4: loadw */
-    var40 = ptr8[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr7[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: loadw */
-    var44 = ptr6[i];
-    /* 15: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var42.x2[0];
-       _dest.x2[1] = var44.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var42.x2[1];
-       _dest.x2[1] = var44.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[0];
-       _dest.x2[1] = var46.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[1];
-       _dest.x2[1] = var46.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-/* bayer_orc_merge_gr_abgr */
-static void
-_backup_bayer_orc_merge_gr_abgr (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-    /* 11: loadpw */
-    var43.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr4[i];
-    /* 1: loadw */
-    var38 = ptr8[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr5[i];
-    /* 4: loadw */
-    var40 = ptr9[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr6[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var43.x2[0];
-       _dest.x2[1] = var46.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var43.x2[1];
-       _dest.x2[1] = var46.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 15: loadw */
-    var44 = ptr7[i];
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[0];
-       _dest.x2[1] = var44.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[1];
-       _dest.x2[1] = var44.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-/* bayer_orc_merge_bg_rgba */
-static void
-_backup_bayer_orc_merge_bg_rgba (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-    /* 11: loadpw */
-    var43.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr5[i];
-    /* 1: loadw */
-    var38 = ptr9[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr4[i];
-    /* 4: loadw */
-    var40 = ptr8[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr7[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[0];
-       _dest.x2[1] = var52.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[1];
-       _dest.x2[1] = var52.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 15: loadw */
-    var44 = ptr6[i];
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[0];
-       _dest.x2[1] = var42.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[1];
-       _dest.x2[1] = var42.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-/* bayer_orc_merge_gr_rgba */
-static void
-_backup_bayer_orc_merge_gr_rgba (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-    /* 11: loadpw */
-    var43.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr4[i];
-    /* 1: loadw */
-    var38 = ptr8[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr5[i];
-    /* 4: loadw */
-    var40 = ptr9[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr6[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: loadw */
-    var44 = ptr7[i];
-    /* 15: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[0];
-       _dest.x2[1] = var52.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var44.x2[1];
-       _dest.x2[1] = var52.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[0];
-       _dest.x2[1] = var43.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var46.x2[1];
-       _dest.x2[1] = var43.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-/* bayer_orc_merge_bg_argb */
-static void
-_backup_bayer_orc_merge_bg_argb (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-    /* 11: loadpw */
-    var43.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr5[i];
-    /* 1: loadw */
-    var38 = ptr9[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr4[i];
-    /* 4: loadw */
-    var40 = ptr8[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr7[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var42.x2[0];
-       _dest.x2[1] = var46.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var42.x2[1];
-       _dest.x2[1] = var46.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 15: loadw */
-    var44 = ptr6[i];
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[0];
-       _dest.x2[1] = var44.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[1];
-       _dest.x2[1] = var44.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-/* bayer_orc_merge_gr_argb */
-static void
-_backup_bayer_orc_merge_gr_argb (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;
-  const orc_union16 * ORC_RESTRICT ptr6;
-  const orc_union16 * ORC_RESTRICT ptr7;
-  const orc_union16 * ORC_RESTRICT ptr8;
-  const orc_union16 * ORC_RESTRICT ptr9;
-  orc_union16 var37;
-  orc_union16 var38;
-  orc_union16 var39;
-  orc_union16 var40;
-  orc_union16 var41;
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var42;
-#else
-  orc_union16 var42;
-#endif
-#if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__) 
-  volatile orc_union16 var43;
-#else
-  orc_union16 var43;
-#endif
-  orc_union16 var44;
-  orc_union64 var45;
-  orc_union16 var46;
-  orc_union16 var47;
-  orc_union16 var48;
-  orc_union16 var49;
-  orc_union16 var50;
-  orc_union16 var51;
-  orc_union16 var52;
-  orc_union32 var53;
-  orc_union32 var54;
-
-  ptr0 = (orc_union64 *)ex->arrays[0];
-  ptr4 = (orc_union16 *)ex->arrays[4];
-  ptr5 = (orc_union16 *)ex->arrays[5];
-  ptr6 = (orc_union16 *)ex->arrays[6];
-  ptr7 = (orc_union16 *)ex->arrays[7];
-  ptr8 = (orc_union16 *)ex->arrays[8];
-  ptr9 = (orc_union16 *)ex->arrays[9];
-
-    /* 9: loadpw */
-    var42.i = (int)0x0000ff00; /* 65280 or 3.22526e-319f */
-    /* 11: loadpw */
-    var43.i = (int)0x000000ff; /* 255 or 1.25987e-321f */
-
-  for (i = 0; i < n; i++) {
-    /* 0: loadw */
-    var37 = ptr4[i];
-    /* 1: loadw */
-    var38 = ptr8[i];
-    /* 2: avgub */
-    var46.x2[0] = ((orc_uint8)var37.x2[0] + (orc_uint8)var38.x2[0] + 1)>>1;
-    var46.x2[1] = ((orc_uint8)var37.x2[1] + (orc_uint8)var38.x2[1] + 1)>>1;
-    /* 3: loadw */
-    var39 = ptr5[i];
-    /* 4: loadw */
-    var40 = ptr9[i];
-    /* 5: avgub */
-    var47.x2[0] = ((orc_uint8)var39.x2[0] + (orc_uint8)var40.x2[0] + 1)>>1;
-    var47.x2[1] = ((orc_uint8)var39.x2[1] + (orc_uint8)var40.x2[1] + 1)>>1;
-    /* 6: loadw */
-    var41 = ptr6[i];
-    /* 7: copyw */
-    var48.i = var41.i;
-    /* 8: avgub */
-    var49.x2[0] = ((orc_uint8)var47.x2[0] + (orc_uint8)var48.x2[0] + 1)>>1;
-    var49.x2[1] = ((orc_uint8)var47.x2[1] + (orc_uint8)var48.x2[1] + 1)>>1;
-    /* 10: andw */
-    var50.i = var49.i & var42.i;
-    /* 12: andw */
-    var51.i = var48.i & var43.i;
-    /* 13: orw */
-    var52.i = var51.i | var50.i;
-    /* 14: loadw */
-    var44 = ptr7[i];
-    /* 15: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var43.x2[0];
-       _dest.x2[1] = var44.x2[0];
-       var53.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var43.x2[1];
-       _dest.x2[1] = var44.x2[1];
-       var53.x2[1] = _dest.i;
-    }
-    /* 16: mergebw */
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[0];
-       _dest.x2[1] = var46.x2[0];
-       var54.x2[0] = _dest.i;
-    }
-    {
-       orc_union16 _dest;
-       _dest.x2[0] = var52.x2[1];
-       _dest.x2[1] = var46.x2[1];
-       var54.x2[1] = _dest.i;
-    }
-    /* 17: mergewl */
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[0];
-       _dest.x2[1] = var54.x2[0];
-       var45.x2[0] = _dest.i;
-    }
-    {
-       orc_union32 _dest;
-       _dest.x2[0] = var53.x2[1];
-       _dest.x2[1] = var54.x2[1];
-       var45.x2[1] = _dest.i;
-    }
-    /* 18: storeq */
-    ptr0[i] = var45;
-  }
-
-}
-
-
-static int quiet = 0;
-static int benchmark = 0;
-
-static void help (const char *argv0)
-{
-  printf("Usage:\n");
-  printf("  %s [OPTION]\n", argv0);
-  printf("Help Options:\n");
-  printf("  -h, --help          Show help options\n");
-  printf("Application Options:\n");
-  printf("  -b, --benchmark     Run benchmark and show results\n");
-  printf("  -q, --quiet         Don't output anything except on failures\n");
-
-  exit(0);
-}
-
-int
-main (int argc, char *argv[])
-{
-  int error = FALSE;
-  int i;
-
-  orc_test_init ();
-
-  for(i=1;i<argc;i++) {
-    if (strcmp(argv[i], "--help") == 0 ||
-      strcmp(argv[i], "-h") == 0) {
-      help(argv[0]);
-    } else if (strcmp(argv[i], "--quiet") == 0 ||
-      strcmp(argv[i], "-q") == 0) {
-      quiet = 1;
-      benchmark = 0;
-    } else if (strcmp(argv[i], "--benchmark") == 0 ||
-      strcmp(argv[i], "-b") == 0) {
-      benchmark = 1;
-      quiet = 0;
-    }
-  }
-
-  /* bayer_orc_horiz_upsample_unaligned */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_horiz_upsample_unaligned:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_horiz_upsample_unaligned");
-    orc_program_set_backup_function (p, _backup_bayer_orc_horiz_upsample_unaligned);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_destination (p, 2, "d2");
-    orc_program_add_source (p, 2, "s1");
-      orc_program_add_constant (p, 4, 0x00000001, "c1");
-    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, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_S1, ORC_VAR_D1);
-      orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_T1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_horiz_upsample */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_horiz_upsample:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_horiz_upsample");
-    orc_program_set_backup_function (p, _backup_bayer_orc_horiz_upsample);
-    orc_program_add_destination (p, 2, "d1");
-    orc_program_add_destination (p, 2, "d2");
-    orc_program_add_source (p, 2, "s1");
-      orc_program_add_constant (p, 4, 0xffffffff, "c1");
-      orc_program_add_constant (p, 4, 0x00000001, "c2");
-    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, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C1, 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, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_D1);
-      orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T5, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_bg_bgra */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_bg_bgra:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_bg_bgra");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_bgra);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x000000ff, "c1");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_gr_bgra */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_gr_bgra:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_gr_bgra");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_bgra);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c1");
-      orc_program_add_constant (p, 2, 0x000000ff, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_S4, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_bg_abgr */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_bg_abgr:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_bg_abgr");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_abgr);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x000000ff, "c1");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_S3, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_gr_abgr */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_gr_abgr:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_gr_abgr");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_abgr);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c1");
-      orc_program_add_constant (p, 2, 0x000000ff, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_T3, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_S4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_bg_rgba */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_bg_rgba:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_bg_rgba");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_rgba);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x000000ff, "c1");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_gr_rgba */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_gr_rgba:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_gr_rgba");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_rgba);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c1");
-      orc_program_add_constant (p, 2, 0x000000ff, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_S4, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_bg_argb */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_bg_argb:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_bg_argb");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_argb);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x000000ff, "c1");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_T3, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_S3, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-  /* bayer_orc_merge_gr_argb */
-  {
-    OrcProgram *p = NULL;
-    int ret;
-
-    if (!quiet)      printf ("bayer_orc_merge_gr_argb:\n");
-    p = orc_program_new ();
-    orc_program_set_name (p, "bayer_orc_merge_gr_argb");
-    orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_argb);
-    orc_program_add_destination (p, 8, "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_source (p, 2, "s4");
-    orc_program_add_source (p, 2, "s5");
-    orc_program_add_source (p, 2, "s6");
-      orc_program_add_constant (p, 2, 0x0000ff00, "c1");
-      orc_program_add_constant (p, 2, 0x000000ff, "c2");
-    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, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, ORC_VAR_D1);
-      orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, ORC_VAR_D1);
-      orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_D1);
-      orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, ORC_VAR_D1);
-      orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_S4, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1);
-      orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1);
-
-    if (benchmark) {
-      printf ("    cycles (emulate) :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_EMULATE, NULL));
-    }
-
-    ret = orc_test_compare_output_backup (p);
-    if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    backup function  :   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (backup)  :   %g\n",
-          orc_test_performance_full (p, ORC_TEST_FLAGS_BACKUP, NULL));
-    }
-
-    ret = orc_test_compare_output (p);
-    if (ret == ORC_TEST_INDETERMINATE && !quiet) {
-      printf ("    compiled function:   COMPILE FAILED\n");
-    } else if (!ret) {
-      error = TRUE;
-    } else if (!quiet) {
-      printf ("    compiled function:   PASSED\n");
-    }
-
-    if (benchmark) {
-      printf ("    cycles (compiled):   %g\n",
-          orc_test_performance_full (p, 0, NULL));
-    }
-
-    orc_program_free (p);
-  }
-
-
-  if (error) {
-    return 1;
-  };
-  return 0;
-}
diff --git a/tests/check/pipelines/colorspace.c b/tests/check/pipelines/colorspace.c
deleted file mode 100644
index 4c42e8a..0000000
--- a/tests/check/pipelines/colorspace.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/* GStreamer
- *
- * unit comparison test for colorspace
- *
- * Copyright 2011 Collabora Ltd.
- *  @author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
- * Copyright 2011 Nokia Corp.
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gst/check/gstcheck.h>
-
-static GMainLoop *loop;
-
-static void
-message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
-{
-  switch (GST_MESSAGE_TYPE (message)) {
-    case GST_MESSAGE_ERROR:
-    case GST_MESSAGE_WARNING:
-      g_assert_not_reached ();
-      break;
-    case GST_MESSAGE_EOS:
-      g_main_loop_quit (loop);
-      break;
-    case GST_MESSAGE_ELEMENT:
-    {
-      const GstStructure *s = gst_message_get_structure (message);
-      const gchar *name = gst_structure_get_name (s);
-
-      fail_unless (strcmp (name, "delta") == 0);
-      break;
-    }
-    default:
-      break;
-  }
-}
-
-/* compare output with ffmpegcolorspace */
-static void
-colorspace_compare (gint width, gint height, gboolean comp)
-{
-  GstBus *bus;
-  GstElement *pipeline, *src, *filter1, *filter2, *csp, *fcsp, *fakesink;
-  GstElement *queue1, *queue2, *tee, *compare;
-  GstCaps *caps, *tcaps, *rcaps, *fcaps;
-  GstCaps *ccaps;
-  GstPad *pad;
-
-  gint i, j;
-
-  /* create elements */
-  pipeline = gst_pipeline_new ("pipeline");
-  src = gst_element_factory_make ("videotestsrc", "videotestsrc");
-  fail_unless (src != NULL);
-  filter1 = gst_element_factory_make ("capsfilter", "capsfilter1");
-  fail_unless (filter1 != NULL);
-  csp = gst_element_factory_make ("colorspace", "colorspace");
-  fail_unless (csp != NULL);
-  filter2 = gst_element_factory_make ("capsfilter", "capsfilter2");
-  fail_unless (filter2 != NULL);
-
-  if (comp) {
-    fcsp = gst_element_factory_make ("ffmpegcolorspace", "ffmpegcolorspace");
-    fail_unless (fcsp != NULL);
-    tee = gst_element_factory_make ("tee", "tee");
-    fail_unless (tee != NULL);
-    queue1 = gst_element_factory_make ("queue", "queue1");
-    fail_unless (queue1 != NULL);
-    queue2 = gst_element_factory_make ("queue", "queue2");
-    fail_unless (queue2 != NULL);
-    compare = gst_element_factory_make ("compare", "compare");
-    fail_unless (compare != NULL);
-  } else {
-    fcsp = tee = queue1 = queue2 = compare = NULL;
-  }
-
-  fakesink = gst_element_factory_make ("fakesink", "fakesink");
-  fail_unless (fakesink != NULL);
-
-  /* add and link */
-  gst_bin_add_many (GST_BIN (pipeline), src, filter1, filter2, csp, fakesink,
-      tee, queue1, queue2, fcsp, compare, NULL);
-
-  fail_unless (gst_element_link (src, filter1));
-
-  if (comp) {
-    fail_unless (gst_element_link (filter1, tee));
-
-    fail_unless (gst_element_link (tee, queue1));
-    fail_unless (gst_element_link (queue1, fcsp));
-    fail_unless (gst_element_link_pads (fcsp, NULL, compare, "sink"));
-
-    fail_unless (gst_element_link (tee, queue2));
-    fail_unless (gst_element_link (queue2, csp));
-    fail_unless (gst_element_link_pads (csp, NULL, compare, "check"));
-
-    fail_unless (gst_element_link (compare, filter2));
-  } else {
-    fail_unless (gst_element_link (filter1, csp));
-    fail_unless (gst_element_link (csp, filter2));
-  }
-  fail_unless (gst_element_link (filter2, fakesink));
-
-  /* obtain possible caps combinations */
-  if (comp) {
-    pad = gst_element_get_static_pad (fcsp, "sink");
-    fail_unless (pad != NULL);
-    ccaps = gst_pad_get_pad_template_caps (pad);
-    fail_unless (ccaps != NULL);
-    fcaps = ccaps;
-    gst_object_unref (pad);
-  } else {
-    fcaps = gst_caps_new_any ();
-  }
-
-  pad = gst_element_get_static_pad (csp, "sink");
-  fail_unless (pad != NULL);
-  ccaps = gst_pad_get_pad_template_caps (pad);
-  fail_unless (ccaps != NULL);
-  gst_object_unref (pad);
-
-  /* handle videotestsrc limitations */
-  pad = gst_element_get_static_pad (src, "src");
-  fail_unless (pad != NULL);
-  caps = (GstCaps *) gst_pad_get_pad_template_caps (pad);
-  fail_unless (caps != NULL);
-  gst_object_unref (pad);
-
-  rcaps = gst_caps_new_simple ("video/x-raw-yuv",
-      "width", G_TYPE_INT, width, "height", G_TYPE_INT, height,
-      "framerate", GST_TYPE_FRACTION, 25, 1,
-      "color-matrix", G_TYPE_STRING, "sdtv",
-      "chroma-site", G_TYPE_STRING, "mpeg2", NULL);
-  gst_caps_append (rcaps, gst_caps_new_simple ("video/x-raw-rgb",
-          "width", G_TYPE_INT, width, "height", G_TYPE_INT, height,
-          "framerate", GST_TYPE_FRACTION, 25, 1,
-          "depth", G_TYPE_INT, 32, NULL));
-
-  /* FIXME also allow x-raw-gray if/when colorspace actually handles those */
-
-  /* limit to supported compare types */
-  if (comp) {
-    gst_caps_append (rcaps, gst_caps_new_simple ("video/x-raw-rgb",
-            "width", G_TYPE_INT, width, "height", G_TYPE_INT, height,
-            "framerate", GST_TYPE_FRACTION, 25, 1,
-            "depth", G_TYPE_INT, 24, NULL));
-  }
-
-  tcaps = gst_caps_intersect (fcaps, ccaps);
-  gst_caps_unref (fcaps);
-  gst_caps_unref (ccaps);
-  caps = gst_caps_intersect (tcaps, caps);
-  gst_caps_unref (tcaps);
-  tcaps = caps;
-  caps = gst_caps_intersect (tcaps, rcaps);
-  gst_caps_unref (tcaps);
-  gst_caps_unref (rcaps);
-
-  /* normalize to finally have a list of acceptable fixed formats */
-  caps = gst_caps_simplify (caps);
-  caps = gst_caps_normalize (caps);
-
-  /* set up for running stuff */
-  loop = g_main_loop_new (NULL, FALSE);
-  bus = gst_element_get_bus (pipeline);
-  gst_bus_add_signal_watch (bus);
-  g_signal_connect (bus, "message::eos", (GCallback) message_cb, NULL);
-  gst_object_unref (bus);
-
-  g_object_set (src, "num-buffers", 5, NULL);
-  if (comp) {
-    /* set lower bound for ssim comparison, and allow slightly different caps */
-    g_object_set (compare, "method", 2, NULL);
-    g_object_set (compare, "meta", 3, NULL);
-    g_object_set (compare, "threshold", 0.90, NULL);
-    g_object_set (compare, "upper", FALSE, NULL);
-  }
-
-  GST_INFO ("possible caps to check %d", gst_caps_get_size (caps));
-
-  /* loop over all input and output combinations */
-  for (i = 0; i < gst_caps_get_size (caps); i++) {
-    for (j = 0; j < gst_caps_get_size (caps); j++) {
-      GstCaps *in_caps, *out_caps;
-      GstStructure *s;
-      const gchar *fourcc;
-
-      in_caps = gst_caps_copy_nth (caps, i);
-      out_caps = gst_caps_copy_nth (caps, j);
-
-      /* FIXME remove if videotestsrc and video format handle these properly */
-      s = gst_caps_get_structure (in_caps, 0);
-      if ((fourcc = gst_structure_get_string (s, "format"))) {
-        if (!strcmp (fourcc, "YUV9") ||
-            !strcmp (fourcc, "YVU9") || !strcmp (fourcc, "v216")) {
-          gst_caps_unref (in_caps);
-          gst_caps_unref (out_caps);
-          continue;
-        }
-      }
-
-      GST_INFO ("checking conversion from %" GST_PTR_FORMAT " (%d)"
-          " to %" GST_PTR_FORMAT " (%d)", in_caps, i, out_caps, j);
-
-      g_object_set (filter1, "caps", in_caps, NULL);
-      g_object_set (filter2, "caps", out_caps, NULL);
-
-      fail_unless (gst_element_set_state (pipeline, GST_STATE_PLAYING)
-          != GST_STATE_CHANGE_FAILURE);
-
-      g_main_loop_run (loop);
-
-      fail_unless (gst_element_set_state (pipeline, GST_STATE_NULL)
-          == GST_STATE_CHANGE_SUCCESS);
-
-      gst_caps_unref (in_caps);
-      gst_caps_unref (out_caps);
-    }
-  }
-
-  gst_caps_unref (caps);
-  gst_object_unref (pipeline);
-  g_main_loop_unref (loop);
-}
-
-#define WIDTH  176
-#define HEIGHT 120
-
-GST_START_TEST (test_colorspace_compare)
-{
-  colorspace_compare (WIDTH, HEIGHT, TRUE);
-}
-
-GST_END_TEST;
-
-/* enable if you like stuff (ffmpegcolorspace) crashing */
-#ifdef TEST_ODD
-
-GST_START_TEST (test_colorspace_compare_odd_height)
-{
-  colorspace_compare (WIDTH, HEIGHT + 1, TRUE);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_colorspace_compare_odd_width)
-{
-  colorspace_compare (WIDTH + 1, HEIGHT, TRUE);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_colorspace_compare_odd)
-{
-  colorspace_compare (WIDTH + 1, HEIGHT + 1, TRUE);
-}
-
-GST_END_TEST;
-
-#endif
-
-/* useful for crash and valgrind check */
-
-GST_START_TEST (test_colorspace)
-{
-  colorspace_compare (WIDTH + 1, HEIGHT + 1, FALSE);
-}
-
-GST_END_TEST;
-
-static Suite *
-colorspace_suite (void)
-{
-  Suite *s = suite_create ("colorspace");
-  TCase *tc_chain;
-
-  tc_chain = tcase_create ("colorspace_compare");
-  tcase_add_test (tc_chain, test_colorspace_compare);
-#ifdef TEST_ODD
-  tcase_add_test (tc_chain, test_colorspace_compare_odd_height);
-  tcase_add_test (tc_chain, test_colorspace_compare_odd_width);
-  tcase_add_test (tc_chain, test_colorspace_compare_odd);
-#endif
-  tcase_add_test (tc_chain, test_colorspace);
-  suite_add_tcase (s, tc_chain);
-
-  /* test may take some time */
-  tcase_set_timeout (tc_chain, 600);
-
-  return s;
-}
-
-GST_CHECK_MAIN (colorspace)
diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am
index 7429f75..bc801da 100644
--- a/tests/examples/Makefile.am
+++ b/tests/examples/Makefile.am
@@ -24,7 +24,18 @@
 GL_DIR=
 endif
 
-SUBDIRS= mpegts $(DIRECTFB_DIR) $(GTK_EXAMPLES) $(OPENCV_EXAMPLES) $(GL_DIR)
-DIST_SUBDIRS= mpegts camerabin2 directfb mxf opencv uvch264 gl
+if HAVE_AVFOUNDATION
+if HAVE_IOS
+AVSAMPLE_DIR=
+else
+AVSAMPLE_DIR=avsamplesink
+endif
+else
+AVSAMPLE_DIR=
+endif
+
+SUBDIRS= mpegts $(DIRECTFB_DIR) $(GTK_EXAMPLES) $(OPENCV_EXAMPLES) $(GL_DIR) \
+	$(AVSAMPLE_DIR)
+DIST_SUBDIRS= mpegts camerabin2 directfb mxf opencv uvch264 gl avsamplesink
 
 include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/tests/examples/Makefile.in b/tests/examples/Makefile.in
index 2fe720b..689d872 100644
--- a/tests/examples/Makefile.in
+++ b/tests/examples/Makefile.in
@@ -93,6 +93,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -106,7 +107,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -223,8 +223,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -263,7 +267,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -271,6 +274,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -320,8 +325,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -400,7 +403,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -409,7 +411,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -422,7 +423,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -447,6 +447,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -520,10 +522,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -549,6 +555,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -585,6 +594,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -625,17 +635,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -652,6 +661,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -712,8 +722,13 @@
 OPENCV_EXAMPLES = opencv
 @USE_OPENGL_FALSE@GL_DIR = 
 @USE_OPENGL_TRUE@GL_DIR = gl
-SUBDIRS = mpegts $(DIRECTFB_DIR) $(GTK_EXAMPLES) $(OPENCV_EXAMPLES) $(GL_DIR)
-DIST_SUBDIRS = mpegts camerabin2 directfb mxf opencv uvch264 gl
+@HAVE_AVFOUNDATION_FALSE@AVSAMPLE_DIR = 
+@HAVE_AVFOUNDATION_TRUE@@HAVE_IOS_FALSE@AVSAMPLE_DIR = avsamplesink
+@HAVE_AVFOUNDATION_TRUE@@HAVE_IOS_TRUE@AVSAMPLE_DIR = 
+SUBDIRS = mpegts $(DIRECTFB_DIR) $(GTK_EXAMPLES) $(OPENCV_EXAMPLES) $(GL_DIR) \
+	$(AVSAMPLE_DIR)
+
+DIST_SUBDIRS = mpegts camerabin2 directfb mxf opencv uvch264 gl avsamplesink
 all: all-recursive
 
 .SUFFIXES:
diff --git a/tests/examples/avsamplesink/Makefile.am b/tests/examples/avsamplesink/Makefile.am
new file mode 100644
index 0000000..b98c721
--- /dev/null
+++ b/tests/examples/avsamplesink/Makefile.am
@@ -0,0 +1,14 @@
+noinst_PROGRAMS = avsamplesink
+
+avsamplesink_SOURCES = main.m
+
+avsamplesink_OBJCFLAGS= \
+	$(GST_CFLAGS) \
+	$(GST_PLUGINS_BASE_CFLAGS)
+avsamplesink_LDADD= \
+	$(GST_PLUGINS_BASE_LIBS) $(GST_LIBS)
+avsamplesink_LDFLAGS =			\
+	-Wl,-framework -Wl,AVFoundation \
+	-Wl,-framework -Wl,QuartzCore \
+	-Wl,-framework -Wl,Cocoa
+avsamplesink_LIBTOOLFLAGS = --tag=CC
diff --git a/ext/mythtv/Makefile.in b/tests/examples/avsamplesink/Makefile.in
similarity index 76%
copy from ext/mythtv/Makefile.in
copy to tests/examples/avsamplesink/Makefile.in
index 055754c..327e086 100644
--- a/ext/mythtv/Makefile.in
+++ b/tests/examples/avsamplesink/Makefile.in
@@ -14,7 +14,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -80,9 +79,10 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = ext/mythtv
+noinst_PROGRAMS = avsamplesink$(EXEEXT)
+subdir = tests/examples/avsamplesink
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/depcomp $(noinst_HEADERS)
+	$(top_srcdir)/depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
 	$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -124,48 +124,20 @@
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(plugindir)"
-LTLIBRARIES = $(plugin_LTLIBRARIES)
+PROGRAMS = $(noinst_PROGRAMS)
+am_avsamplesink_OBJECTS = avsamplesink-main.$(OBJEXT)
+avsamplesink_OBJECTS = $(am_avsamplesink_OBJECTS)
 am__DEPENDENCIES_1 =
-libgstmythtvsrc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+avsamplesink_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
-am_libgstmythtvsrc_la_OBJECTS = libgstmythtvsrc_la-gstmythtvsrc.lo
-libgstmythtvsrc_la_OBJECTS = $(am_libgstmythtvsrc_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-libgstmythtvsrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-	$(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) \
-	$(libgstmythtvsrc_la_LDFLAGS) $(LDFLAGS) -o $@
+avsamplesink_LINK = $(LIBTOOL) $(AM_V_lt) $(avsamplesink_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(OBJCLD) \
+	$(avsamplesink_OBJCFLAGS) $(OBJCFLAGS) $(avsamplesink_LDFLAGS) \
+	$(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -182,32 +154,31 @@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
+LTOBJCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_OBJCFLAGS) $(OBJCFLAGS)
+AM_V_OBJC = $(am__v_OBJC_@AM_V@)
+am__v_OBJC_ = $(am__v_OBJC_@AM_DEFAULT_V@)
+am__v_OBJC_0 = @echo "  OBJC    " $@;
+am__v_OBJC_1 = 
+OBJCLD = $(OBJC)
+OBJCLINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libgstmythtvsrc_la_SOURCES)
-DIST_SOURCES = $(libgstmythtvsrc_la_SOURCES)
+AM_V_OBJCLD = $(am__v_OBJCLD_@AM_V@)
+am__v_OBJCLD_ = $(am__v_OBJCLD_@AM_DEFAULT_V@)
+am__v_OBJCLD_0 = @echo "  OBJCLD  " $@;
+am__v_OBJCLD_1 = 
+SOURCES = $(avsamplesink_SOURCES)
+DIST_SOURCES = $(avsamplesink_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
-HEADERS = $(noinst_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -244,8 +215,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -284,7 +259,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -292,6 +266,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -341,8 +317,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -421,7 +395,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -430,7 +403,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -443,7 +415,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -468,6 +439,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -541,10 +514,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -570,6 +547,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -606,6 +586,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -646,17 +627,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -673,6 +653,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -724,29 +705,24 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 wayland_scanner = @wayland_scanner@
-plugin_LTLIBRARIES = libgstmythtvsrc.la
-libgstmythtvsrc_la_SOURCES = \
-		gstmythtvsrc.c
-
-libgstmythtvsrc_la_CFLAGS = \
+avsamplesink_SOURCES = main.m
+avsamplesink_OBJCFLAGS = \
 	$(GST_CFLAGS) \
-	$(GMYTH_CFLAGS)
+	$(GST_PLUGINS_BASE_CFLAGS)
 
-libgstmythtvsrc_la_LDFLAGS = \
-	$(GST_PLUGIN_LDFLAGS)
+avsamplesink_LDADD = \
+	$(GST_PLUGINS_BASE_LIBS) $(GST_LIBS)
 
-libgstmythtvsrc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-libgstmythtvsrc_la_LIBADD = \
-	$(GST_BASE_LIBS) \
-	$(GMYTH_LIBS)
+avsamplesink_LDFLAGS = \
+	-Wl,-framework -Wl,AVFoundation \
+	-Wl,-framework -Wl,QuartzCore \
+	-Wl,-framework -Wl,Cocoa
 
-noinst_HEADERS = \
-	gstmythtvsrc.h
-
+avsamplesink_LIBTOOLFLAGS = --tag=CC
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+.SUFFIXES: .lo .m .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -756,9 +732,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ext/mythtv/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/examples/avsamplesink/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu ext/mythtv/Makefile
+	  $(AUTOMAKE) --gnu tests/examples/avsamplesink/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -778,43 +754,18 @@
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
-	@$(NORMAL_INSTALL)
-	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
-	list2=; for p in $$list; do \
-	  if test -f $$p; then \
-	    list2="$$list2 $$p"; \
-	  else :; fi; \
-	done; \
-	test -z "$$list2" || { \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
-	}
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
 
-uninstall-pluginLTLIBRARIES:
-	@$(NORMAL_UNINSTALL)
-	@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
-	done
-
-clean-pluginLTLIBRARIES:
-	-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
-	@list='$(plugin_LTLIBRARIES)'; \
-	locs=`for p in $$list; do echo $$p; done | \
-	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-	      sort -u`; \
-	test -z "$$locs" || { \
-	  echo rm -f $${locs}; \
-	  rm -f $${locs}; \
-	}
-
-libgstmythtvsrc.la: $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_DEPENDENCIES) $(EXTRA_libgstmythtvsrc_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libgstmythtvsrc_la_LINK) -rpath $(plugindir) $(libgstmythtvsrc_la_OBJECTS) $(libgstmythtvsrc_la_LIBADD) $(LIBS)
+avsamplesink$(EXEEXT): $(avsamplesink_OBJECTS) $(avsamplesink_DEPENDENCIES) $(EXTRA_avsamplesink_DEPENDENCIES) 
+	@rm -f avsamplesink$(EXEEXT)
+	$(AM_V_OBJCLD)$(avsamplesink_LINK) $(avsamplesink_OBJECTS) $(avsamplesink_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -822,38 +773,45 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avsamplesink-main.Po@am__quote@
 
-.c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
-@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+.m.o:
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepOBJC_TRUE@	$(OBJCCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepOBJC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ $<
 
-.c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
-@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+.m.obj:
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepOBJC_TRUE@	$(OBJCCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepOBJC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
-.c.lo:
-@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
-@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
-@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+.m.lo:
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepOBJC_TRUE@	$(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepOBJC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(LTOBJCCOMPILE) -c -o $@ $<
 
-libgstmythtvsrc_la-gstmythtvsrc.lo: gstmythtvsrc.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -MT libgstmythtvsrc_la-gstmythtvsrc.lo -MD -MP -MF $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Tpo $(DEPDIR)/libgstmythtvsrc_la-gstmythtvsrc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='gstmythtvsrc.c' object='libgstmythtvsrc_la-gstmythtvsrc.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstmythtvsrc_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstmythtvsrc_la_CFLAGS) $(CFLAGS) -c -o libgstmythtvsrc_la-gstmythtvsrc.lo `test -f 'gstmythtvsrc.c' || echo '$(srcdir)/'`gstmythtvsrc.c
+avsamplesink-main.o: main.m
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avsamplesink_OBJCFLAGS) $(OBJCFLAGS) -MT avsamplesink-main.o -MD -MP -MF $(DEPDIR)/avsamplesink-main.Tpo -c -o avsamplesink-main.o `test -f 'main.m' || echo '$(srcdir)/'`main.m
+@am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/avsamplesink-main.Tpo $(DEPDIR)/avsamplesink-main.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='main.m' object='avsamplesink-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avsamplesink_OBJCFLAGS) $(OBJCFLAGS) -c -o avsamplesink-main.o `test -f 'main.m' || echo '$(srcdir)/'`main.m
+
+avsamplesink-main.obj: main.m
+@am__fastdepOBJC_TRUE@	$(AM_V_OBJC)$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avsamplesink_OBJCFLAGS) $(OBJCFLAGS) -MT avsamplesink-main.obj -MD -MP -MF $(DEPDIR)/avsamplesink-main.Tpo -c -o avsamplesink-main.obj `if test -f 'main.m'; then $(CYGPATH_W) 'main.m'; else $(CYGPATH_W) '$(srcdir)/main.m'; fi`
+@am__fastdepOBJC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/avsamplesink-main.Tpo $(DEPDIR)/avsamplesink-main.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	$(AM_V_OBJC)source='main.m' object='avsamplesink-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@	DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@	$(AM_V_OBJC@am__nodep@)$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avsamplesink_OBJCFLAGS) $(OBJCFLAGS) -c -o avsamplesink-main.obj `if test -f 'main.m'; then $(CYGPATH_W) 'main.m'; else $(CYGPATH_W) '$(srcdir)/main.m'; fi`
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -945,11 +903,8 @@
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
-	for dir in "$(DESTDIR)$(plugindir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -982,7 +937,7 @@
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -1003,7 +958,7 @@
 
 info-am:
 
-install-data-am: install-pluginLTLIBRARIES
+install-data-am:
 
 install-dvi: install-dvi-am
 
@@ -1049,24 +1004,23 @@
 
 ps-am:
 
-uninstall-am: uninstall-pluginLTLIBRARIES
+uninstall-am:
 
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-pluginLTLIBRARIES cscopelist-am ctags \
+	clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
 	ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
 	install-exec-am install-html install-html-am install-info \
 	install-info-am install-man install-pdf install-pdf-am \
-	install-pluginLTLIBRARIES install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
-	uninstall-pluginLTLIBRARIES
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-am uninstall uninstall-am
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/tests/examples/avsamplesink/main.m b/tests/examples/avsamplesink/main.m
new file mode 100644
index 0000000..6bce53b
--- /dev/null
+++ b/tests/examples/avsamplesink/main.m
@@ -0,0 +1,124 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Matthew Waters <matthew@centricular.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#include <Cocoa/Cocoa.h>
+#include <QuartzCore/QuartzCore.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreMedia/CoreMedia.h>
+
+static NSRunLoop *loop;
+static int quit = 0;
+
+static void
+end_stream_cb(GstBus* bus, GstMessage* message, GstElement* pipeline)
+{
+  switch (GST_MESSAGE_TYPE (message))
+  {
+    case GST_MESSAGE_EOS:
+      g_print ("End of stream\n");
+
+      g_atomic_int_set (&quit, 1);;
+      CFRunLoopStop ([loop getCFRunLoop]);
+      break;
+    case GST_MESSAGE_ERROR:
+    {
+      gchar *debug = NULL;
+      GError *err = NULL;
+
+      gst_message_parse_error (message, &err, &debug);
+
+      g_print ("Error: %s\n", err->message);
+      g_error_free (err);
+
+      if (debug)
+      {
+        g_print ("Debug details: %s\n", debug);
+        g_free (debug);
+      }
+
+      g_atomic_int_set (&quit, 1);;
+      CFRunLoopStop ([loop getCFRunLoop]);
+      break;
+    }
+    default:
+      break;
+  }
+}
+
+gint main (gint argc, gchar *argv[])
+{
+  CALayer *layer;
+  loop = [NSRunLoop currentRunLoop];
+
+  gst_init (&argc, &argv);
+
+  [NSApplication sharedApplication];
+
+  GstElement* pipeline = gst_pipeline_new ("pipeline");
+  GstElement* videosrc  = gst_element_factory_make ("videotestsrc", NULL);
+  GstElement* videosink = gst_element_factory_make ("avsamplebufferlayersink", NULL);
+  GstCaps *caps = gst_caps_from_string ("video/x-raw,format=UYVY");
+
+  gst_bin_add_many (GST_BIN (pipeline), videosrc, videosink, NULL);
+
+  gboolean link_ok = gst_element_link_filtered (videosrc, videosink, caps);
+  gst_caps_unref (caps);
+  if (!link_ok) {
+     g_critical ("Failed to link an element!\n") ;
+    return -1;
+  }
+
+  g_object_set (videosrc, "num-buffers", 500, NULL);
+
+  GstBus* bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+
+  gst_element_set_state (pipeline, GST_STATE_READY);
+  gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
+
+  g_object_get (videosink, "layer", &layer, NULL);
+
+  NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect (0, 0, 320, 240)
+      styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
+  [window setOpaque:NO];
+  [window.contentView setWantsLayer:YES];
+
+  NSView *view = [window.contentView superview];
+  [view setLayer:layer];
+
+  gst_element_set_state(pipeline, GST_STATE_PLAYING);
+
+  [window orderFront:window];
+
+  while (!g_atomic_int_get (&quit) && [loop runMode:NSDefaultRunLoopMode
+      beforeDate:[NSDate distantPast]]) {
+    GstMessage *msg;
+    while ((msg = gst_bus_timed_pop (bus, 1 * GST_MSECOND)))
+      end_stream_cb (bus, msg, pipeline);
+  }
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+  gst_object_unref (bus);
+  gst_object_unref (pipeline);
+
+  return 0;
+}
+
diff --git a/tests/examples/camerabin2/Makefile.in b/tests/examples/camerabin2/Makefile.in
index 7da4a9f..f2bf263 100644
--- a/tests/examples/camerabin2/Makefile.in
+++ b/tests/examples/camerabin2/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -233,8 +233,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -273,7 +277,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -281,6 +284,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -330,8 +335,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -410,7 +413,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -419,7 +421,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -432,7 +433,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -457,6 +457,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -530,10 +532,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -559,6 +565,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -595,6 +604,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -635,17 +645,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -662,6 +671,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/camerabin2/gst-camera2.c b/tests/examples/camerabin2/gst-camera2.c
index 45047f5..0bb9869 100644
--- a/tests/examples/camerabin2/gst-camera2.c
+++ b/tests/examples/camerabin2/gst-camera2.c
@@ -56,16 +56,21 @@
 create_ogg_profile (void)
 {
   GstEncodingContainerProfile *container;
+  GstCaps *caps = NULL;
 
-  container = gst_encoding_container_profile_new ("ogg", NULL,
-      gst_caps_new_empty_simple ("application/ogg"), NULL);
+  caps = gst_caps_new_empty_simple ("application/ogg");
+  container = gst_encoding_container_profile_new ("ogg", NULL, caps, NULL);
+  gst_caps_unref (caps);
 
+  caps = gst_caps_new_empty_simple ("video/x-theora");
   gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
-      gst_encoding_video_profile_new (gst_caps_new_empty_simple
-          ("video/x-theora"), NULL, NULL, 1));
+      gst_encoding_video_profile_new (caps, NULL, NULL, 1));
+  gst_caps_unref (caps);
+
+  caps = gst_caps_new_empty_simple ("audio/x-vorbis");
   gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
-      gst_encoding_audio_profile_new (gst_caps_new_empty_simple
-          ("audio/x-vorbis"), NULL, NULL, 1));
+      gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
+  gst_caps_unref (caps);
 
   return (GstEncodingProfile *) container;
 }
@@ -74,16 +79,21 @@
 create_webm_profile (void)
 {
   GstEncodingContainerProfile *container;
+  GstCaps *caps = NULL;
 
-  container = gst_encoding_container_profile_new ("webm", NULL,
-      gst_caps_new_empty_simple ("video/webm"), NULL);
+  caps = gst_caps_new_empty_simple ("video/webm");
+  container = gst_encoding_container_profile_new ("webm", NULL, caps, NULL);
+  gst_caps_unref (caps);
 
+  caps = gst_caps_new_empty_simple ("video/x-vp8");
   gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
-      gst_encoding_video_profile_new (gst_caps_new_empty_simple ("video/x-vp8"),
-          NULL, NULL, 1));
+      gst_encoding_video_profile_new (caps, NULL, NULL, 1));
+  gst_caps_unref (caps);
+
+  caps = gst_caps_new_empty_simple ("audio/x-vorbis");
   gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
-      gst_encoding_audio_profile_new (gst_caps_new_empty_simple
-          ("audio/x-vorbis"), NULL, NULL, 1));
+      gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
+  gst_caps_unref (caps);
 
   return (GstEncodingProfile *) container;
 }
@@ -92,17 +102,23 @@
 create_mp4_profile (void)
 {
   GstEncodingContainerProfile *container;
+  GstCaps *caps = NULL;
 
-  container = gst_encoding_container_profile_new ("mp4", NULL,
+  caps =
       gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING, "iso",
-          NULL), NULL);
+      NULL);
+  container = gst_encoding_container_profile_new ("mp4", NULL, caps, NULL);
+  gst_caps_unref (caps);
 
+  caps = gst_caps_new_empty_simple ("video/x-h264");
   gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
-      gst_encoding_video_profile_new (gst_caps_new_empty_simple
-          ("video/x-h264"), NULL, NULL, 1));
+      gst_encoding_video_profile_new (caps, NULL, NULL, 1));
+  gst_caps_unref (caps);
+
+  caps = gst_caps_new_simple ("audio/mpeg", "version", G_TYPE_INT, 4, NULL);
   gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
-      gst_encoding_audio_profile_new (gst_caps_new_simple ("audio/mpeg",
-              "version", G_TYPE_INT, 4, NULL), NULL, NULL, 1));
+      gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
+  gst_caps_unref (caps);
 
   return (GstEncodingProfile *) container;
 }
@@ -284,7 +300,6 @@
 int
 main (int argc, char *argv[])
 {
-  int ret = 0;
   GError *error = NULL;
   GstBus *bus;
 
@@ -319,5 +334,5 @@
 error:
   gst_element_set_state (camera, GST_STATE_NULL);
   gst_object_unref (camera);
-  return ret;
+  return 0;
 }
diff --git a/tests/examples/camerabin2/gst-camerabin2-test.c b/tests/examples/camerabin2/gst-camerabin2-test.c
index dfbd055..b68ec51 100644
--- a/tests/examples/camerabin2/gst-camerabin2-test.c
+++ b/tests/examples/camerabin2/gst-camerabin2-test.c
@@ -595,6 +595,7 @@
     elem = gst_parse_launch (element_name, &error);
     if (elem) {
       g_object_set (element, property_name, elem, NULL);
+      g_object_unref (elem);
     } else {
       GST_WARNING ("can't create element '%s' for property '%s'", element_name,
           property_name);
@@ -695,6 +696,7 @@
 
     if (setup_pipeline_element (wrapper, "video-source", videosrc_name, NULL)) {
       g_object_set (camerabin, "camera-source", wrapper, NULL);
+      g_object_unref (wrapper);
     } else {
       GST_WARNING ("Failed to set videosrc to %s", videosrc_name);
     }
@@ -718,15 +720,19 @@
 
   if (imagepp_name) {
     ipp = create_ipp_bin ();
-    if (ipp)
+    if (ipp) {
       g_object_set (camerabin, "image-filter", ipp, NULL);
+      g_object_unref (ipp);
+    }
     else
       GST_WARNING ("Could not create ipp elements");
   }
 
   prof = load_encoding_profile ();
-  if (prof)
+  if (prof) {
     g_object_set (G_OBJECT (camerabin), "video-profile", prof, NULL);
+    gst_encoding_profile_unref (prof);
+  }
 
   GST_INFO_OBJECT (camerabin, "elements created");
 
diff --git a/tests/examples/directfb/Makefile.in b/tests/examples/directfb/Makefile.in
index 04ec565..7b6da5e 100644
--- a/tests/examples/directfb/Makefile.in
+++ b/tests/examples/directfb/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -212,8 +212,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -252,7 +256,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -260,6 +263,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -309,8 +314,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -389,7 +392,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -398,7 +400,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -411,7 +412,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -436,6 +436,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -509,10 +511,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -538,6 +544,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -574,6 +583,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -614,17 +624,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -641,6 +650,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/Makefile.in b/tests/examples/gl/Makefile.in
index d8958b5..efe3af0 100644
--- a/tests/examples/gl/Makefile.in
+++ b/tests/examples/gl/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -222,8 +222,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -262,7 +266,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -270,6 +273,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -319,8 +324,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -399,7 +402,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -408,7 +410,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -421,7 +422,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -446,6 +446,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -519,10 +521,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -548,6 +554,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -584,6 +593,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -624,17 +634,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -651,6 +660,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/clutter/Makefile.in b/tests/examples/gl/clutter/Makefile.in
index 240ef93..ef2e989 100644
--- a/tests/examples/gl/clutter/Makefile.in
+++ b/tests/examples/gl/clutter/Makefile.in
@@ -94,6 +94,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -107,7 +108,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -255,8 +255,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -295,7 +299,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -303,6 +306,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -352,8 +357,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -432,7 +435,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -441,7 +443,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -454,7 +455,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -479,6 +479,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -552,10 +554,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -581,6 +587,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -617,6 +626,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -657,17 +667,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -684,6 +693,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/clutter/clutteractor.c b/tests/examples/gl/clutter/clutteractor.c
index 1fcae0e..3bcd4b0 100644
--- a/tests/examples/gl/clutter/clutteractor.c
+++ b/tests/examples/gl/clutter/clutteractor.c
@@ -164,6 +164,7 @@
 
   gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
       NULL);
+  gst_object_unref (bus);
 
   gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
 
diff --git a/tests/examples/gl/clutter/clutteractortee.c b/tests/examples/gl/clutter/clutteractortee.c
index 73f7a60..b05020f 100644
--- a/tests/examples/gl/clutter/clutteractortee.c
+++ b/tests/examples/gl/clutter/clutteractortee.c
@@ -217,6 +217,7 @@
 
   gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
       NULL);
+  gst_object_unref (bus);
 
   gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
 
diff --git a/tests/examples/gl/cocoa/Makefile.in b/tests/examples/gl/cocoa/Makefile.in
index ffc541b..e44c9e9 100644
--- a/tests/examples/gl/cocoa/Makefile.in
+++ b/tests/examples/gl/cocoa/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -218,8 +218,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -258,7 +262,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -266,6 +269,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -315,8 +320,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -395,7 +398,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -404,7 +406,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -417,7 +418,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -442,6 +442,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -515,10 +517,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -544,6 +550,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -580,6 +589,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -620,17 +630,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -647,6 +656,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/cocoa/cocoa-videooverlay.m b/tests/examples/gl/cocoa/cocoa-videooverlay.m
index 9c5fc9a..a783c56 100755
--- a/tests/examples/gl/cocoa/cocoa-videooverlay.m
+++ b/tests/examples/gl/cocoa/cocoa-videooverlay.m
@@ -28,7 +28,7 @@
 /*                                                               */
 /* ============================================================= */
 
-@interface MainWindow: NSWindow {
+@interface MainWindow: NSWindow <NSApplicationDelegate> {
   GMainLoop *m_loop;
   GstElement *m_pipeline;
   gboolean m_isClosed;
@@ -52,7 +52,7 @@
     backing: NSBackingStoreBuffered defer: NO screen: nil];
 
   [self setReleasedWhenClosed:NO];
-  [NSApp setDelegate:self];
+  [[NSApplication sharedApplication] setDelegate:self];
 
   [self setTitle:@"gst-plugins-gl implements videooverlay interface"];
 
@@ -166,6 +166,9 @@
   NSRect rect;
   MainWindow *window=nil;
 
+  pool = [[NSAutoreleasePool alloc] init];
+  [NSApplication sharedApplication];
+
   g_print("app created\n");
 
   gst_init (&argc, &argv);
@@ -192,9 +195,6 @@
   if (!ok)
     g_warning("could not link videosrc to videosink\n");
 
-  pool = [[NSAutoreleasePool alloc] init];
-  [NSApplication sharedApplication];
-
   rect.origin.x = 0; rect.origin.y = 0;
   rect.size.width = width; rect.size.height = height;
 
diff --git a/tests/examples/gl/generic/Makefile.in b/tests/examples/gl/generic/Makefile.in
index 9146586..06097e7 100644
--- a/tests/examples/gl/generic/Makefile.in
+++ b/tests/examples/gl/generic/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -218,8 +218,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -258,7 +262,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -266,6 +269,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -315,8 +320,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -395,7 +398,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -404,7 +406,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -417,7 +418,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -442,6 +442,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -515,10 +517,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -544,6 +550,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -580,6 +589,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -620,17 +630,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -647,6 +656,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/generic/cube/Makefile.am b/tests/examples/gl/generic/cube/Makefile.am
index b6bd60b..7262533 100644
--- a/tests/examples/gl/generic/cube/Makefile.am
+++ b/tests/examples/gl/generic/cube/Makefile.am
@@ -5,5 +5,5 @@
 
 cube_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
 	$(GST_CXXFLAGS) $(GL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-cube_LDADD=$(GST_LIBS) $(GL_LIBS)
+cube_LDADD=$(GST_LIBS) -lgstvideo-$(GST_API_VERSION) $(GL_LIBS)
 
diff --git a/tests/examples/gl/generic/cube/Makefile.in b/tests/examples/gl/generic/cube/Makefile.in
index f7c398d..08d5640 100644
--- a/tests/examples/gl/generic/cube/Makefile.in
+++ b/tests/examples/gl/generic/cube/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -213,8 +213,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -253,7 +257,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -261,6 +264,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -310,8 +315,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -390,7 +393,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -399,7 +401,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -412,7 +413,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -437,6 +437,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -510,10 +512,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -539,6 +545,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -575,6 +584,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -615,17 +625,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -642,6 +651,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -697,7 +707,7 @@
 cube_CXXFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
 	$(GST_CXXFLAGS) $(GL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
 
-cube_LDADD = $(GST_LIBS) $(GL_LIBS)
+cube_LDADD = $(GST_LIBS) -lgstvideo-$(GST_API_VERSION) $(GL_LIBS)
 all: all-am
 
 .SUFFIXES:
diff --git a/tests/examples/gl/generic/cube/main.cpp b/tests/examples/gl/generic/cube/main.cpp
index 23c81ec..3a54fe6 100644
--- a/tests/examples/gl/generic/cube/main.cpp
+++ b/tests/examples/gl/generic/cube/main.cpp
@@ -18,12 +18,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <GL/gl.h>
-#include <GL/glu.h>
-#if __WIN32__ || _WIN32
-# include <GL/glext.h>
-#endif
 #include <gst/gst.h>
+#include <gst/gl/gl.h>
 
 #include <iostream>
 #include <string>
@@ -65,19 +61,18 @@
 }
 
 //client reshape callback
-static gboolean reshapeCallback (void *gl_sink, GLuint width, GLuint height, gpointer data)
+static gboolean reshapeCallback (void *gl_sink, void *context, GLuint width, GLuint height, gpointer data)
 {
     glViewport(0, 0, width, height);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
-    gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
     glMatrixMode(GL_MODELVIEW);
 
     return TRUE;
 }
 
 //client draw callback
-static gboolean drawCallback (void * gl_sink, GLuint texture, GLuint width, GLuint height, gpointer data)
+static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data)
 {
     static GLfloat	xrot = 0;
     static GLfloat	yrot = 0;
@@ -86,6 +81,21 @@
     static glong last_sec = current_time.tv_sec;
     static gint nbFrames = 0;
 
+    GstVideoFrame v_frame;
+    GstVideoInfo v_info;
+    guint texture = 0;
+    GstBuffer *buf = gst_sample_get_buffer (sample);
+    GstCaps *caps = gst_sample_get_caps (sample);
+
+    gst_video_info_from_caps (&v_info, caps);
+
+    if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
+      g_warning ("Failed to map the video buffer");
+      return TRUE;
+    }
+
+    texture = *(guint *) v_frame.data[0];
+
     g_get_current_time (&current_time);
     nbFrames++ ;
 
@@ -110,7 +120,7 @@
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
 
-    glTranslatef(0.0f,0.0f,-5.0f);
+    glScalef(0.5f,0.5f,0.5f);
 
     glRotatef(xrot,1.0f,0.0f,0.0f);
     glRotatef(yrot,0.0f,1.0f,0.0f);
@@ -149,11 +159,15 @@
 	      glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
     glEnd();
 
+    gst_video_frame_unmap (&v_frame);
+
     xrot+=0.3f;
     yrot+=0.2f;
     zrot+=0.4f;
 
-    //return TRUE causes a postRedisplay
+    glDisable (GL_DEPTH_TEST);
+    glDisable (GL_TEXTURE_2D);
+
     return TRUE;
 }
 
diff --git a/tests/examples/gl/generic/cubeyuv/Makefile.am b/tests/examples/gl/generic/cubeyuv/Makefile.am
index 289cbd3..98697f0 100644
--- a/tests/examples/gl/generic/cubeyuv/Makefile.am
+++ b/tests/examples/gl/generic/cubeyuv/Makefile.am
@@ -5,5 +5,5 @@
 
 cubeyuv_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
 	$(GST_CXXFLAGS) $(GL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-cubeyuv_LDADD=$(GST_LIBS) $(GL_LIBS)
+cubeyuv_LDADD=$(GST_LIBS) $(GL_LIBS) -lgstvideo-$(GST_API_VERSION)
 
diff --git a/tests/examples/gl/generic/cubeyuv/Makefile.in b/tests/examples/gl/generic/cubeyuv/Makefile.in
index 7b4ab16..87e2d53 100644
--- a/tests/examples/gl/generic/cubeyuv/Makefile.in
+++ b/tests/examples/gl/generic/cubeyuv/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -213,8 +213,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -253,7 +257,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -261,6 +264,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -310,8 +315,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -390,7 +393,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -399,7 +401,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -412,7 +413,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -437,6 +437,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -510,10 +512,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -539,6 +545,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -575,6 +584,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -615,17 +625,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -642,6 +651,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -697,7 +707,7 @@
 cubeyuv_CXXFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
 	$(GST_CXXFLAGS) $(GL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
 
-cubeyuv_LDADD = $(GST_LIBS) $(GL_LIBS)
+cubeyuv_LDADD = $(GST_LIBS) $(GL_LIBS) -lgstvideo-$(GST_API_VERSION)
 all: all-am
 
 .SUFFIXES:
diff --git a/tests/examples/gl/generic/cubeyuv/main.cpp b/tests/examples/gl/generic/cubeyuv/main.cpp
index 0d585a7..9c4b2cc 100644
--- a/tests/examples/gl/generic/cubeyuv/main.cpp
+++ b/tests/examples/gl/generic/cubeyuv/main.cpp
@@ -18,12 +18,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <GL/gl.h>
-#include <GL/glu.h>
-#if __WIN32__ || _WIN32
-# include <GL/glext.h>
-#endif
 #include <gst/gst.h>
+#include <gst/gl/gl.h>
 
 #include <iostream>
 #include <sstream>
@@ -87,12 +83,11 @@
 
 
 //client reshape callback
-static gboolean reshapeCallback (void * gl_sink, GLuint width, GLuint height, gpointer data)
+static gboolean reshapeCallback (void * gl_sink, void *context, GLuint width, GLuint height, gpointer data)
 {
     glViewport(0, 0, width, height);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
-    gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
     glMatrixMode(GL_MODELVIEW);
 
     return TRUE;
@@ -100,7 +95,7 @@
 
 
 //client draw callback
-static gboolean drawCallback (void * gl_sink, GLuint texture, GLuint width, GLuint height, gpointer data)
+static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data)
 {
     static GLfloat	xrot = 0;
     static GLfloat	yrot = 0;
@@ -109,6 +104,21 @@
     static glong last_sec = current_time.tv_sec;
     static gint nbFrames = 0;
 
+    GstVideoFrame v_frame;
+    GstVideoInfo v_info;
+    guint texture = 0;
+    GstBuffer *buf = gst_sample_get_buffer (sample);
+    GstCaps *caps = gst_sample_get_caps (sample);
+
+    gst_video_info_from_caps (&v_info, caps);
+
+    if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
+      g_warning ("Failed to map the video buffer");
+      return TRUE;
+    }
+
+    texture = *(guint *) v_frame.data[0];
+
     g_get_current_time (&current_time);
     nbFrames++ ;
 
@@ -172,20 +182,12 @@
 	      glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
     glEnd();
 
+    gst_video_frame_unmap (&v_frame);
+
 	xrot+=0.03f;
     yrot+=0.02f;
     zrot+=0.04f;
 
-    //return TRUE causes a postRedisplay
-    //so you have to return FALSE to synchronise to have a graphic FPS
-    //equals to the input video frame rate
-
-    //Usually, we will not always return TRUE (or FALSE)
-    //For example, if you want a fixed graphic FPS equals to 60
-    //then you have to use the timeclock to return TRUE or FALSE
-    //in order to increase or decrease the FPS in real time
-    //to reach the 60.
-
     return TRUE;
 }
 
diff --git a/tests/examples/gl/generic/doublecube/Makefile.am b/tests/examples/gl/generic/doublecube/Makefile.am
index 3f220de..a131829 100644
--- a/tests/examples/gl/generic/doublecube/Makefile.am
+++ b/tests/examples/gl/generic/doublecube/Makefile.am
@@ -5,5 +5,5 @@
 
 doublecube_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
 	$(GST_CXXFLAGS) $(GL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-doublecube_LDADD=$(GST_LIBS) $(GL_LIBS)
+doublecube_LDADD=$(GST_LIBS) $(GL_LIBS) -lgstvideo-$(GST_API_VERSION)
 
diff --git a/tests/examples/gl/generic/doublecube/Makefile.in b/tests/examples/gl/generic/doublecube/Makefile.in
index 7e6e1f9..4520e33 100644
--- a/tests/examples/gl/generic/doublecube/Makefile.in
+++ b/tests/examples/gl/generic/doublecube/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -213,8 +213,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -253,7 +257,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -261,6 +264,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -310,8 +315,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -390,7 +393,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -399,7 +401,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -412,7 +413,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -437,6 +437,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -510,10 +512,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -539,6 +545,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -575,6 +584,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -615,17 +625,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -642,6 +651,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -697,7 +707,7 @@
 doublecube_CXXFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
 	$(GST_CXXFLAGS) $(GL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
 
-doublecube_LDADD = $(GST_LIBS) $(GL_LIBS)
+doublecube_LDADD = $(GST_LIBS) $(GL_LIBS) -lgstvideo-$(GST_API_VERSION)
 all: all-am
 
 .SUFFIXES:
diff --git a/tests/examples/gl/generic/doublecube/main.cpp b/tests/examples/gl/generic/doublecube/main.cpp
index 4e0a421..98d7825 100644
--- a/tests/examples/gl/generic/doublecube/main.cpp
+++ b/tests/examples/gl/generic/doublecube/main.cpp
@@ -18,12 +18,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <GL/gl.h>
-#include <GL/glu.h>
-#if __WIN32__ || _WIN32
-# include <GL/glext.h>
-#endif
 #include <gst/gst.h>
+#include <gst/gl/gl.h>
 
 #include <iostream>
 #include <sstream>
@@ -89,12 +85,11 @@
 
 
 //client reshape callback
-static gboolean reshapeCallback (void *gl_sink, GLuint width, GLuint height)
+static gboolean reshapeCallback (void *gl_sink, void *context, GLuint width, GLuint height)
 {
     glViewport(0, 0, width, height);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
-    gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
     glMatrixMode(GL_MODELVIEW);
 
     return TRUE;
@@ -102,7 +97,7 @@
 
 
 //client draw callback
-static gboolean drawCallback (void * gl_sink, GLuint texture, GLuint width, GLuint height)
+static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data)
 {
     static GLfloat	xrot = 0;
     static GLfloat	yrot = 0;
@@ -111,6 +106,21 @@
     static glong last_sec = current_time.tv_sec;
     static gint nbFrames = 0;
 
+    GstVideoFrame v_frame;
+    GstVideoInfo v_info;
+    guint texture = 0;
+    GstBuffer *buf = gst_sample_get_buffer (sample);
+    GstCaps *caps = gst_sample_get_caps (sample);
+
+    gst_video_info_from_caps (&v_info, caps);
+
+    if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
+      g_warning ("Failed to map the video buffer");
+      return TRUE;
+    }
+
+    texture = *(guint *) v_frame.data[0];
+
     g_get_current_time (&current_time);
     nbFrames++ ;
 
@@ -174,20 +184,12 @@
 	      glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
     glEnd();
 
+    gst_video_frame_unmap (&v_frame);
+
     xrot+=0.03f;
     yrot+=0.02f;
     zrot+=0.04f;
 
-    //return TRUE causes a postRedisplay
-    //so you have to return FALSE to synchronise to have a graphic FPS
-    //equals to the input video frame rate
-
-    //Usually, we will not always return TRUE (or FALSE)
-    //For example, if you want a fixed graphic FPS equals to 60
-    //then you have to use the timeclock to return TRUE or FALSE
-    //in order to increase or decrease the FPS in real time
-    //to reach the 60.
-
     return TRUE;
 }
 
diff --git a/tests/examples/gl/generic/recordgraphic/Makefile.in b/tests/examples/gl/generic/recordgraphic/Makefile.in
index 9dd249d..3df8ff7 100644
--- a/tests/examples/gl/generic/recordgraphic/Makefile.in
+++ b/tests/examples/gl/generic/recordgraphic/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -215,8 +215,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -255,7 +259,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -263,6 +266,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -312,8 +317,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -392,7 +395,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -401,7 +403,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -414,7 +415,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -439,6 +439,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -512,10 +514,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -541,6 +547,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -577,6 +586,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -617,17 +627,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -644,6 +653,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/generic/recordgraphic/main.cpp b/tests/examples/gl/generic/recordgraphic/main.cpp
index d457a9c..9cac1e9 100644
--- a/tests/examples/gl/generic/recordgraphic/main.cpp
+++ b/tests/examples/gl/generic/recordgraphic/main.cpp
@@ -19,7 +19,6 @@
  */
 
 #include <GL/gl.h>
-#include <GL/glu.h>
 #if __WIN32__ || _WIN32
 # include <GL/glext.h>
 #endif
@@ -66,7 +65,7 @@
 }
 
 //client draw callback
-static gboolean drawCallback (void *filter, GLuint width, GLuint height, GLuint texture, gpointer data)
+static gboolean drawCallback (void *filter, void *context, GLuint texture, GLuint width, GLuint height, gpointer data)
 {
     static GLfloat	xrot = 0;
     static GLfloat	yrot = 0;
diff --git a/tests/examples/gl/gtk/Makefile.in b/tests/examples/gl/gtk/Makefile.in
index cfc35ab..e1ac27b 100644
--- a/tests/examples/gl/gtk/Makefile.in
+++ b/tests/examples/gl/gtk/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -255,8 +255,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -295,7 +299,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -303,6 +306,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -352,8 +357,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -432,7 +435,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -441,7 +443,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -454,7 +455,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -479,6 +479,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -552,10 +554,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -581,6 +587,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -617,6 +626,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -657,17 +667,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -684,6 +693,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/gtk/filternovideooverlay/Makefile.in b/tests/examples/gl/gtk/filternovideooverlay/Makefile.in
index 1e2f451..e62db3e 100644
--- a/tests/examples/gl/gtk/filternovideooverlay/Makefile.in
+++ b/tests/examples/gl/gtk/filternovideooverlay/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -216,8 +216,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -256,7 +260,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -264,6 +267,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -313,8 +318,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -393,7 +396,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -402,7 +404,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -415,7 +416,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -440,6 +440,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -513,10 +515,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -542,6 +548,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -578,6 +587,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -618,17 +628,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -645,6 +654,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/gtk/filtervideooverlay/Makefile.in b/tests/examples/gl/gtk/filtervideooverlay/Makefile.in
index 1cd52a5..8bf0345 100644
--- a/tests/examples/gl/gtk/filtervideooverlay/Makefile.in
+++ b/tests/examples/gl/gtk/filtervideooverlay/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -216,8 +216,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -256,7 +260,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -264,6 +267,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -313,8 +318,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -393,7 +396,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -402,7 +404,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -415,7 +416,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -440,6 +440,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -513,10 +515,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -542,6 +548,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -578,6 +587,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -618,17 +628,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -645,6 +654,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/gtk/fxtest/Makefile.in b/tests/examples/gl/gtk/fxtest/Makefile.in
index 4d962ed..b5d7e12 100644
--- a/tests/examples/gl/gtk/fxtest/Makefile.in
+++ b/tests/examples/gl/gtk/fxtest/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -223,8 +223,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -263,7 +267,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -271,6 +274,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -320,8 +325,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -400,7 +403,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -409,7 +411,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -422,7 +423,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -447,6 +447,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -520,10 +522,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -549,6 +555,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -585,6 +594,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -625,17 +635,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -652,6 +661,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/gtk/fxtest/fxtest.c b/tests/examples/gl/gtk/fxtest/fxtest.c
index a9b41c1..f83f189 100644
--- a/tests/examples/gl/gtk/fxtest/fxtest.c
+++ b/tests/examples/gl/gtk/fxtest/fxtest.c
@@ -33,15 +33,75 @@
 #include <gst/video/videooverlay.h>
 
 
-/* TODO: use video overlay in the proper way (like suggested in docs, see gtkvideooverlay example) */
+static GstBusSyncReply
+create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
+{
+  /* ignore anything but 'prepare-window-handle' element messages */
+  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
+    return GST_BUS_PASS;
+
+  if (!gst_is_video_overlay_prepare_window_handle_message (message))
+    return GST_BUS_PASS;
+
+  g_print ("setting window handle\n");
+
+  /* do not call gdk_window_ensure_native for the first time here because
+   * we are in a different thread than the main thread
+   * (and the main thread the one) */
+  gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
+          (message)), widget);
+
+  gst_message_unref (message);
+
+  return GST_BUS_DROP;
+}
+
+
+static void
+end_stream_cb (GstBus * bus, GstMessage * message, GstElement * pipeline)
+{
+  switch (GST_MESSAGE_TYPE (message)) {
+    case GST_MESSAGE_EOS:
+      g_print ("End of stream\n");
+
+      gst_element_set_state (pipeline, GST_STATE_NULL);
+      gst_object_unref (pipeline);
+      gtk_main_quit ();
+      break;
+    case GST_MESSAGE_ERROR:
+    {
+      gchar *debug = NULL;
+      GError *err = NULL;
+
+      gst_message_parse_error (message, &err, &debug);
+
+      g_print ("Error: %s\n", err->message);
+      g_error_free (err);
+
+      if (debug) {
+        g_print ("Debug details: %s\n", debug);
+        g_free (debug);
+      }
+
+      gst_element_set_state (pipeline, GST_STATE_NULL);
+      gst_object_unref (pipeline);
+      gtk_main_quit ();
+      break;
+    }
+    default:
+      break;
+  }
+}
+
 static gboolean
-expose_cb (GtkWidget * widget, gpointer data)
+expose_cb (GtkWidget * widget, gpointer unused, gpointer data)
 {
   GstVideoOverlay *overlay =
       GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
           GST_TYPE_VIDEO_OVERLAY));
 
-  gst_video_overlay_set_gtk_window (overlay, widget);
+  gst_video_overlay_expose (overlay);
+  gst_object_unref (overlay);
 
   return FALSE;
 }
@@ -116,6 +176,7 @@
   GstElement *pipeline;
   GstElement *filter, *sink;
   GstElement *sourcebin;
+  GstBus *bus;
   GError *error = NULL;
 
   GtkWidget *window;
@@ -187,6 +248,17 @@
       G_CALLBACK (destroy_cb), pipeline);
 
   screen = gtk_drawing_area_new ();
+  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+  gst_bus_add_signal_watch (bus);
+  g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb),
+      pipeline);
+  g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb),
+      pipeline);
+  g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), pipeline);
+
+  gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen,
+      NULL);
+  gst_object_unref (bus);
 
   gtk_widget_set_size_request (screen, 640, 480);       // 500 x 376
 
@@ -246,7 +318,10 @@
 
   gtk_container_add (GTK_CONTAINER (window), vbox);
 
-  g_signal_connect (screen, "realize", G_CALLBACK (expose_cb), pipeline);
+  g_signal_connect (screen, "draw", G_CALLBACK (expose_cb), pipeline);
+  g_signal_connect (screen, "configure-event", G_CALLBACK (expose_cb),
+      pipeline);
+  gtk_widget_realize (screen);
 
   ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
   if (ret == GST_STATE_CHANGE_FAILURE) {
diff --git a/tests/examples/gl/gtk/gtkvideooverlay/Makefile.in b/tests/examples/gl/gtk/gtkvideooverlay/Makefile.in
index 0ba1eca..a3a3db4 100644
--- a/tests/examples/gl/gtk/gtkvideooverlay/Makefile.in
+++ b/tests/examples/gl/gtk/gtkvideooverlay/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -216,8 +216,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -256,7 +260,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -264,6 +267,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -313,8 +318,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -393,7 +396,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -402,7 +404,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -415,7 +416,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -440,6 +440,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -513,10 +515,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -542,6 +548,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -578,6 +587,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -618,17 +628,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -645,6 +654,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/gtk/gtkvideooverlay/main.cpp b/tests/examples/gl/gtk/gtkvideooverlay/main.cpp
index 7024cfc..8d886b5 100644
--- a/tests/examples/gl/gtk/gtkvideooverlay/main.cpp
+++ b/tests/examples/gl/gtk/gtkvideooverlay/main.cpp
@@ -27,34 +27,60 @@
 
 static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, GtkWidget* widget)
 {
-    // ignore anything but 'prepare-window-handle' element messages
-    if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
-        return GST_BUS_PASS;
+  /* ignore anything but 'prepare-window-handle' element messages */
+  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
+      return GST_BUS_PASS;
 
-    if (!gst_is_video_overlay_prepare_window_handle_message (message))
-        return GST_BUS_PASS;
+  if (!gst_is_video_overlay_prepare_window_handle_message (message))
+      return GST_BUS_PASS;
 
-    g_print ("setting window handle\n");
+  g_print ("setting window handle\n");
 
-    //do not call gdk_window_ensure_native for the first time here because
-    //we are in a different thread than the main thread
-    //(and the main thread the onne)
-    gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget);
+  /* do not call gdk_window_ensure_native for the first time here because
+   * we are in a different thread than the main thread */
+  gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget);
 
-    gst_message_unref (message);
+  gst_message_unref (message);
 
-    return GST_BUS_DROP;
+  return GST_BUS_DROP;
 }
 
 
 static void end_stream_cb(GstBus* bus, GstMessage* message, GstElement* pipeline)
 {
-    g_print("End of stream\n");
+  switch (GST_MESSAGE_TYPE (message))
+  {
+    case GST_MESSAGE_EOS:
+      g_print ("End of stream\n");
 
-    gst_element_set_state (pipeline, GST_STATE_NULL);
-    gst_object_unref(pipeline);
+      gst_element_set_state (pipeline, GST_STATE_NULL);
+      gst_object_unref(pipeline);
+      gtk_main_quit ();
+      break;
+    case GST_MESSAGE_ERROR:
+    {
+      gchar *debug = NULL;
+      GError *err = NULL;
 
-    gtk_main_quit();
+      gst_message_parse_error (message, &err, &debug);
+
+      g_print ("Error: %s\n", err->message);
+      g_error_free (err);
+
+      if (debug)
+      {
+        g_print ("Debug details: %s\n", debug);
+        g_free (debug);
+      }
+
+      gst_element_set_state (pipeline, GST_STATE_NULL);
+      gst_object_unref(pipeline);
+      gtk_main_quit ();
+      break;
+    }
+    default:
+      break;
+  }
 }
 
 static gboolean draw_cb(GtkWidget* widget, cairo_t *cr, GstElement* videosink)
diff --git a/tests/examples/gl/gtk/switchvideooverlay/Makefile.in b/tests/examples/gl/gtk/switchvideooverlay/Makefile.in
index 71eb7ed..43f80fa 100644
--- a/tests/examples/gl/gtk/switchvideooverlay/Makefile.in
+++ b/tests/examples/gl/gtk/switchvideooverlay/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -216,8 +216,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -256,7 +260,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -264,6 +267,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -313,8 +318,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -393,7 +396,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -402,7 +404,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -415,7 +416,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -440,6 +440,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -513,10 +515,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -542,6 +548,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -578,6 +587,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -618,17 +628,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -645,6 +654,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/gtk/switchvideooverlay/main.cpp b/tests/examples/gl/gtk/switchvideooverlay/main.cpp
index 440d5ce..e8378b8 100644
--- a/tests/examples/gl/gtk/switchvideooverlay/main.cpp
+++ b/tests/examples/gl/gtk/switchvideooverlay/main.cpp
@@ -118,7 +118,6 @@
 
     //avoid flickering when resizing or obscuring the main window
     gtk_widget_set_app_paintable(widget, TRUE);
-    gtk_widget_set_double_buffered(widget, FALSE);
 }
 
 
diff --git a/tests/examples/gl/qt/Makefile.in b/tests/examples/gl/qt/Makefile.in
index a64e785..b1c8a90 100644
--- a/tests/examples/gl/qt/Makefile.in
+++ b/tests/examples/gl/qt/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -158,8 +158,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -198,7 +202,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -206,6 +209,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -255,8 +260,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -335,7 +338,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -344,7 +346,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -357,7 +358,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -382,6 +382,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -455,10 +457,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -484,6 +490,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -520,6 +529,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -560,17 +570,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -587,6 +596,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/gl/qt/README b/tests/examples/gl/qt/README
index aa843d6..a050fc2 100644
--- a/tests/examples/gl/qt/README
+++ b/tests/examples/gl/qt/README
@@ -1,22 +1,23 @@
 --- Description of the Qt examples ---
 
-- mousevideooverlay:
-Show how to use the videooverlay interface through Qt.
-The cube is rotating when moving the mouse (+ click maintained)
-
-- qglvideooverlay:
-Show how to use the videooverlay interface through Qt.
-The cube is rotating automatically into a QGLWidget
-
-- videovdieooverlay:
+- videooverlay:
 Show how to use the videooverlay interface through Qt.
 The video is displayed as normal 2D scene.
 The window is dynamically resized to have the same size as the original video.
 
+- mousevideooverlay:
+Show how to use the videooverlay interface through Qt.
+The cube is rotating when moving the mouse (+ click maintained)
+
+- qglwidgetvideooverlay:
+Show how to use the videooverlay interface through Qt.
+The cube is rotating automatically into a QGLWidget
+
+
 --- How to build the Qt examples ---
 
-sudo apt-get install g++
-sudo apt-get install libqt4-dev
+sudo apt-get install g++ libqt5-dev
+
 cd qglvideooverlay
 qmake
 make
diff --git a/tests/examples/gl/sdl/Makefile.am b/tests/examples/gl/sdl/Makefile.am
index 69ac934..dd57509 100644
--- a/tests/examples/gl/sdl/Makefile.am
+++ b/tests/examples/gl/sdl/Makefile.am
@@ -3,7 +3,7 @@
 #works on win32 and X
 if HAVE_SDL
 
-noinst_PROGRAMS += sdlshare
+noinst_PROGRAMS += sdlshare sdlshare2
 
 sdlshare_SOURCES = sdlshare.c
 
@@ -18,4 +18,17 @@
 	$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
 	-lgstvideo-$(GST_API_VERSION)
 
+sdlshare2_SOURCES = sdlshare2.c
+
+sdlshare2_CFLAGS= \
+	-I$(top_srcdir)/gst-libs \
+	-I$(top_builddir)/gst-libs \
+	$(GST_PLUGINS_BASE_CFLAGS) \
+	$(GST_CFLAGS) \
+	$(GL_CFLAGS) \
+	$(SDL_CFLAGS)
+sdlshare2_LDADD= $(GST_LIBS) $(GL_LIBS) $(SDL_LIBS) \
+	$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
+	-lgstvideo-$(GST_API_VERSION)
+
 endif
diff --git a/tests/examples/gl/sdl/Makefile.in b/tests/examples/gl/sdl/Makefile.in
index b3b8a54..ebc0fc4 100644
--- a/tests/examples/gl/sdl/Makefile.in
+++ b/tests/examples/gl/sdl/Makefile.in
@@ -82,7 +82,7 @@
 noinst_PROGRAMS = $(am__EXEEXT_1)
 
 #works on win32 and X
-@HAVE_SDL_TRUE@am__append_1 = sdlshare
+@HAVE_SDL_TRUE@am__append_1 = sdlshare sdlshare2
 subdir = tests/examples/gl/sdl
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/depcomp
@@ -93,6 +93,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -106,7 +107,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -127,7 +127,7 @@
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-@HAVE_SDL_TRUE@am__EXEEXT_1 = sdlshare$(EXEEXT)
+@HAVE_SDL_TRUE@am__EXEEXT_1 = sdlshare$(EXEEXT) sdlshare2$(EXEEXT)
 PROGRAMS = $(noinst_PROGRAMS)
 am__sdlshare_SOURCES_DIST = sdlshare.c
 @HAVE_SDL_TRUE@am_sdlshare_OBJECTS = sdlshare-sdlshare.$(OBJEXT)
@@ -143,6 +143,15 @@
 sdlshare_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(sdlshare_CFLAGS) \
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am__sdlshare2_SOURCES_DIST = sdlshare2.c
+@HAVE_SDL_TRUE@am_sdlshare2_OBJECTS = sdlshare2-sdlshare2.$(OBJEXT)
+sdlshare2_OBJECTS = $(am_sdlshare2_OBJECTS)
+@HAVE_SDL_TRUE@sdlshare2_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+@HAVE_SDL_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+@HAVE_SDL_TRUE@	$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la
+sdlshare2_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(sdlshare2_CFLAGS) \
+	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -177,8 +186,9 @@
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(sdlshare_SOURCES)
-DIST_SOURCES = $(am__sdlshare_SOURCES_DIST)
+SOURCES = $(sdlshare_SOURCES) $(sdlshare2_SOURCES)
+DIST_SOURCES = $(am__sdlshare_SOURCES_DIST) \
+	$(am__sdlshare2_SOURCES_DIST)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -220,8 +230,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -260,7 +274,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -268,6 +281,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -317,8 +332,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -397,7 +410,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -406,7 +418,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -419,7 +430,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -444,6 +454,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -517,10 +529,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -546,6 +562,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -582,6 +601,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -622,17 +642,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -649,6 +668,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -713,6 +733,19 @@
 @HAVE_SDL_TRUE@	$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
 @HAVE_SDL_TRUE@	-lgstvideo-$(GST_API_VERSION)
 
+@HAVE_SDL_TRUE@sdlshare2_SOURCES = sdlshare2.c
+@HAVE_SDL_TRUE@sdlshare2_CFLAGS = \
+@HAVE_SDL_TRUE@	-I$(top_srcdir)/gst-libs \
+@HAVE_SDL_TRUE@	-I$(top_builddir)/gst-libs \
+@HAVE_SDL_TRUE@	$(GST_PLUGINS_BASE_CFLAGS) \
+@HAVE_SDL_TRUE@	$(GST_CFLAGS) \
+@HAVE_SDL_TRUE@	$(GL_CFLAGS) \
+@HAVE_SDL_TRUE@	$(SDL_CFLAGS)
+
+@HAVE_SDL_TRUE@sdlshare2_LDADD = $(GST_LIBS) $(GL_LIBS) $(SDL_LIBS) \
+@HAVE_SDL_TRUE@	$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
+@HAVE_SDL_TRUE@	-lgstvideo-$(GST_API_VERSION)
+
 all: all-am
 
 .SUFFIXES:
@@ -761,6 +794,10 @@
 	@rm -f sdlshare$(EXEEXT)
 	$(AM_V_CCLD)$(sdlshare_LINK) $(sdlshare_OBJECTS) $(sdlshare_LDADD) $(LIBS)
 
+sdlshare2$(EXEEXT): $(sdlshare2_OBJECTS) $(sdlshare2_DEPENDENCIES) $(EXTRA_sdlshare2_DEPENDENCIES) 
+	@rm -f sdlshare2$(EXEEXT)
+	$(AM_V_CCLD)$(sdlshare2_LINK) $(sdlshare2_OBJECTS) $(sdlshare2_LDADD) $(LIBS)
+
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
 
@@ -768,6 +805,7 @@
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdlshare-sdlshare.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdlshare2-sdlshare2.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -807,6 +845,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sdlshare_CFLAGS) $(CFLAGS) -c -o sdlshare-sdlshare.obj `if test -f 'sdlshare.c'; then $(CYGPATH_W) 'sdlshare.c'; else $(CYGPATH_W) '$(srcdir)/sdlshare.c'; fi`
 
+sdlshare2-sdlshare2.o: sdlshare2.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sdlshare2_CFLAGS) $(CFLAGS) -MT sdlshare2-sdlshare2.o -MD -MP -MF $(DEPDIR)/sdlshare2-sdlshare2.Tpo -c -o sdlshare2-sdlshare2.o `test -f 'sdlshare2.c' || echo '$(srcdir)/'`sdlshare2.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/sdlshare2-sdlshare2.Tpo $(DEPDIR)/sdlshare2-sdlshare2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='sdlshare2.c' object='sdlshare2-sdlshare2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sdlshare2_CFLAGS) $(CFLAGS) -c -o sdlshare2-sdlshare2.o `test -f 'sdlshare2.c' || echo '$(srcdir)/'`sdlshare2.c
+
+sdlshare2-sdlshare2.obj: sdlshare2.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sdlshare2_CFLAGS) $(CFLAGS) -MT sdlshare2-sdlshare2.obj -MD -MP -MF $(DEPDIR)/sdlshare2-sdlshare2.Tpo -c -o sdlshare2-sdlshare2.obj `if test -f 'sdlshare2.c'; then $(CYGPATH_W) 'sdlshare2.c'; else $(CYGPATH_W) '$(srcdir)/sdlshare2.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/sdlshare2-sdlshare2.Tpo $(DEPDIR)/sdlshare2-sdlshare2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='sdlshare2.c' object='sdlshare2-sdlshare2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sdlshare2_CFLAGS) $(CFLAGS) -c -o sdlshare2-sdlshare2.obj `if test -f 'sdlshare2.c'; then $(CYGPATH_W) 'sdlshare2.c'; else $(CYGPATH_W) '$(srcdir)/sdlshare2.c'; fi`
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
diff --git a/tests/examples/gl/sdl/sdlshare.c b/tests/examples/gl/sdl/sdlshare.c
index bc54eae..40f0af6 100644
--- a/tests/examples/gl/sdl/sdlshare.c
+++ b/tests/examples/gl/sdl/sdlshare.c
@@ -26,7 +26,6 @@
 #endif
 
 #include <GL/gl.h>
-#include <GL/glu.h>
 #include "SDL/SDL.h"
 #include "SDL/SDL_opengl.h"
 
@@ -39,6 +38,9 @@
 #include <gst/gst.h>
 #include <gst/gl/gl.h>
 
+static GstGLContext *sdl_context;
+static GstGLDisplay *sdl_gl_display;
+
 /* rotation angle for the triangle. */
 float rtri = 0.0f;
 
@@ -59,8 +61,6 @@
   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();            // Reset The Projection Matrix
 
-  gluPerspective (45.0f, (GLfloat) Width / (GLfloat) Height, 0.1f, 100.0f);     // Calculate The Aspect Ratio Of The Window
-
   glMatrixMode (GL_MODELVIEW);
 }
 
@@ -84,17 +84,17 @@
   glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  // Clear The Screen And The Depth Buffer
   glLoadIdentity ();            // Reset The View
 
-  glTranslatef (-1.5f, 0.0f, -6.0f);    // Move Left 1.5 Units And Into The Screen 6.0
+  glTranslatef (-0.4f, 0.0f, 0.0f);     // Move Left 1.5 Units And Into The Screen 6.0
 
   glRotatef (rtri, 0.0f, 1.0f, 0.0f);   // Rotate The Triangle On The Y axis 
   // draw a triangle (in smooth coloring mode)
   glBegin (GL_POLYGON);         // start drawing a polygon
   glColor3f (1.0f, 0.0f, 0.0f); // Set The Color To Red
-  glVertex3f (0.0f, 1.0f, 0.0f);        // Top
+  glVertex3f (0.0f, 0.4f, 0.0f);        // Top
   glColor3f (0.0f, 1.0f, 0.0f); // Set The Color To Green
-  glVertex3f (1.0f, -1.0f, 0.0f);       // Bottom Right
+  glVertex3f (0.4f, -0.4f, 0.0f);       // Bottom Right
   glColor3f (0.0f, 0.0f, 1.0f); // Set The Color To Blue
-  glVertex3f (-1.0f, -1.0f, 0.0f);      // Bottom Left  
+  glVertex3f (-0.4f, -0.4f, 0.0f);      // Bottom Left  
   glEnd ();                     // we're done with the polygon (smooth color interpolation)
 
   glEnable (GL_TEXTURE_2D);
@@ -106,20 +106,20 @@
   glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 
   glLoadIdentity ();            // make sure we're no longer rotated.
-  glTranslatef (1.5f, 0.0f, -6.0f);     // Move Right 3 Units, and back into the screen 6.0
+  glTranslatef (0.5f, 0.0f, 0.0f);      // Move Right 3 Units, and back into the screen 6.0
 
   glRotatef (rquad, 1.0f, 0.0f, 0.0f);  // Rotate The Quad On The X axis 
   // draw a square (quadrilateral)
-  glColor3f (0.5f, 0.5f, 1.0f); // set color to a blue shade.
+  glColor3f (0.4f, 0.4f, 1.0f); // set color to a blue shade.
   glBegin (GL_QUADS);           // start drawing a polygon (4 sided)
   glTexCoord3f (0.0f, 1.0f, 0.0f);
-  glVertex3f (-1.0f, 1.0f, 0.0f);       // Top Left
+  glVertex3f (-0.4f, 0.4f, 0.0f);       // Top Left
   glTexCoord3f (1.0f, 1.0f, 0.0f);
-  glVertex3f (1.0f, 1.0f, 0.0f);        // Top Right
+  glVertex3f (0.4f, 0.4f, 0.0f);        // Top Right
   glTexCoord3f (1.0f, 0.0f, 0.0f);
-  glVertex3f (1.0f, -1.0f, 0.0f);       // Bottom Right
+  glVertex3f (0.4f, -0.4f, 0.0f);       // Bottom Right
   glTexCoord3f (0.0f, 0.0f, 0.0f);
-  glVertex3f (-1.0f, -1.0f, 0.0f);      // Bottom Left  
+  glVertex3f (-0.4f, -0.4f, 0.0f);      // Bottom Left  
   glEnd ();                     // done with the polygon
 
   glBindTexture (GL_TEXTURE_2D, 0);
@@ -129,6 +129,8 @@
 
   // swap buffers to display, since we're double buffered.
   SDL_GL_SwapBuffers ();
+
+  gst_video_frame_unmap (&v_frame);
 }
 
 static gboolean
@@ -229,6 +231,39 @@
   g_main_loop_quit (loop);
 }
 
+static gboolean
+sync_bus_call (GstBus * bus, GstMessage * msg, gpointer data)
+{
+  switch (GST_MESSAGE_TYPE (msg)) {
+    case GST_MESSAGE_NEED_CONTEXT:
+    {
+      const gchar *context_type;
+
+      gst_message_parse_context_type (msg, &context_type);
+      g_print ("got need context %s\n", context_type);
+
+      if (g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
+        GstContext *display_context =
+            gst_context_new (GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
+        gst_context_set_gl_display (display_context, sdl_gl_display);
+        gst_element_set_context (GST_ELEMENT (msg->src), display_context);
+        return TRUE;
+      } else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
+        GstContext *app_context = gst_context_new ("gst.gl.app_context", TRUE);
+        GstStructure *s = gst_context_writable_structure (app_context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, sdl_context,
+            NULL);
+        gst_element_set_context (GST_ELEMENT (msg->src), app_context);
+        return TRUE;
+      }
+      break;
+    }
+    default:
+      break;
+  }
+  return FALSE;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -246,13 +281,10 @@
   GMainLoop *loop = NULL;
   GstPipeline *pipeline = NULL;
   GstBus *bus = NULL;
-  GstElement *glfilter = NULL;
   GstElement *fakesink = NULL;
   GstState state;
   GAsyncQueue *queue_input_buf = NULL;
   GAsyncQueue *queue_output_buf = NULL;
-  GstGLDisplay *display;
-  GstGLContext *sdl_context;
   const gchar *platform;
 
   /* Initialize SDL for video output */
@@ -284,38 +316,40 @@
   sdl_dc = wglGetCurrentDC ();
   wglMakeCurrent (0, 0);
   platform = "wgl";
-  display = gst_gl_display_new ();
+  sdl_gl_display = gst_gl_display_new ();
 #else
   SDL_VERSION (&info.version);
   SDL_GetWMInfo (&info);
+  /* FIXME: This display is different to the one that SDL uses to create the
+   * GL context inside SDL_SetVideoMode() above which fails on Intel hardware
+   */
   sdl_display = info.info.x11.gfxdisplay;
   sdl_win = info.info.x11.window;
   sdl_gl_context = glXGetCurrentContext ();
   glXMakeCurrent (sdl_display, None, 0);
   platform = "glx";
-  display = (GstGLDisplay *) gst_gl_display_x11_new_with_display (sdl_display);
+  sdl_gl_display =
+      (GstGLDisplay *) gst_gl_display_x11_new_with_display (sdl_display);
 #endif
 
-  sdl_context = gst_gl_context_new_wrapped (display, (guintptr) sdl_gl_context,
+  sdl_context =
+      gst_gl_context_new_wrapped (sdl_gl_display, (guintptr) sdl_gl_context,
       gst_gl_platform_from_string (platform), GST_GL_API_OPENGL);
 
   pipeline =
       GST_PIPELINE (gst_parse_launch
       ("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
-          "gleffects effect=5 ! fakesink sync=1", NULL));
+          "glupload ! gleffects effect=5 ! fakesink sync=1", NULL));
 
   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
   gst_bus_add_signal_watch (bus);
   g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb), loop);
   g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb), loop);
   g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), loop);
+  gst_bus_enable_sync_message_emission (bus);
+  g_signal_connect (bus, "sync-message", G_CALLBACK (sync_bus_call), NULL);
   gst_object_unref (bus);
 
-  /* sdl_gl_context is an external OpenGL context with which gst-plugins-gl want to share textures */
-  glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "gleffects0");
-  g_object_set (G_OBJECT (glfilter), "other-context", sdl_context, NULL);
-  gst_object_unref (glfilter);
-
   /* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
    * shared with the sdl one */
   gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
diff --git a/tests/examples/gl/sdl/sdlshare2.c b/tests/examples/gl/sdl/sdlshare2.c
new file mode 100644
index 0000000..ce5792a
--- /dev/null
+++ b/tests/examples/gl/sdl/sdlshare2.c
@@ -0,0 +1,393 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Julien Isorce <julien.isorce@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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+#include <GL/gl.h>
+#include "SDL/SDL.h"
+#include "SDL/SDL_opengl.h"
+
+#ifndef WIN32
+#include <GL/glx.h>
+#include "SDL/SDL_syswm.h"
+#include <gst/gl/x11/gstgldisplay_x11.h>
+#endif
+
+#include <gst/gst.h>
+#include <gst/gl/gl.h>
+
+static GstGLContext *sdl_context;
+static GstGLDisplay *sdl_gl_display;
+
+/* rotation angle for the triangle. */
+float rtri = 0.0f;
+
+/* rotation angle for the quadrilateral. */
+float rquad = 0.0f;
+
+/* A general OpenGL initialization function.  Sets all of the initial parameters. */
+static void
+InitGL (int Width, int Height)  // We call this right after our OpenGL window is created.
+{
+  glViewport (0, 0, Width, Height);
+  glClearColor (0.0f, 0.0f, 0.0f, 0.0f);        // This Will Clear The Background Color To Black
+  glClearDepth (1.0);           // Enables Clearing Of The Depth Buffer
+  glDepthFunc (GL_LESS);        // The Type Of Depth Test To Do
+  glEnable (GL_DEPTH_TEST);     // Enables Depth Testing
+  glShadeModel (GL_SMOOTH);     // Enables Smooth Color Shading
+
+  glMatrixMode (GL_PROJECTION);
+  glLoadIdentity ();            // Reset The Projection Matrix
+
+  glMatrixMode (GL_MODELVIEW);
+}
+
+/* The main drawing function. */
+static void
+DrawGLScene (GstSample * sample)
+{
+  GstVideoFrame v_frame;
+  GstVideoInfo v_info;
+  guint texture = 0;
+  GstBuffer *buf = gst_sample_get_buffer (sample);
+  GstCaps *caps = gst_sample_get_caps (sample);
+
+#ifdef WIN32
+  if (!wglGetCurrentContext ())
+    return;
+#else
+  if (!glXGetCurrentContext ())
+    return;
+#endif
+
+  gst_video_info_from_caps (&v_info, caps);
+
+  if (!gst_video_frame_map (&v_frame, &v_info, buf, GST_MAP_READ | GST_MAP_GL)) {
+    g_warning ("Failed to map the video buffer");
+    return;
+  }
+
+  texture = *(guint *) v_frame.data[0];
+
+  glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  // Clear The Screen And The Depth Buffer
+  glLoadIdentity ();            // Reset The View
+
+  glTranslatef (-0.4f, 0.0f, 0.0f);     // Move Left 1.5 Units And Into The Screen 6.0
+
+  glRotatef (rtri, 0.0f, 1.0f, 0.0f);   // Rotate The Triangle On The Y axis 
+  // draw a triangle (in smooth coloring mode)
+  glBegin (GL_POLYGON);         // start drawing a polygon
+  glColor3f (1.0f, 0.0f, 0.0f); // Set The Color To Red
+  glVertex3f (0.0f, 0.4f, 0.0f);        // Top
+  glColor3f (0.0f, 1.0f, 0.0f); // Set The Color To Green
+  glVertex3f (0.4f, -0.4f, 0.0f);       // Bottom Right
+  glColor3f (0.0f, 0.0f, 1.0f); // Set The Color To Blue
+  glVertex3f (-0.4f, -0.4f, 0.0f);      // Bottom Left  
+  glEnd ();                     // we're done with the polygon (smooth color interpolation)
+
+  glEnable (GL_TEXTURE_2D);
+  glBindTexture (GL_TEXTURE_2D, texture);
+  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+  glLoadIdentity ();            // make sure we're no longer rotated.
+  glTranslatef (0.5f, 0.0f, 0.0f);      // Move Right 3 Units, and back into the screen 6.0
+
+  glRotatef (rquad, 1.0f, 0.0f, 0.0f);  // Rotate The Quad On The X axis 
+  // draw a square (quadrilateral)
+  glColor3f (0.4f, 0.4f, 1.0f); // set color to a blue shade.
+  glBegin (GL_QUADS);           // start drawing a polygon (4 sided)
+  glTexCoord3f (0.0f, 1.0f, 0.0f);
+  glVertex3f (-0.4f, 0.4f, 0.0f);       // Top Left
+  glTexCoord3f (1.0f, 1.0f, 0.0f);
+  glVertex3f (0.4f, 0.4f, 0.0f);        // Top Right
+  glTexCoord3f (1.0f, 0.0f, 0.0f);
+  glVertex3f (0.4f, -0.4f, 0.0f);       // Bottom Right
+  glTexCoord3f (0.0f, 0.0f, 0.0f);
+  glVertex3f (-0.4f, -0.4f, 0.0f);      // Bottom Left  
+  glEnd ();                     // done with the polygon
+
+  glBindTexture (GL_TEXTURE_2D, 0);
+
+  rtri += 1.0f;                 // Increase The Rotation Variable For The Triangle
+  rquad -= 1.0f;                // Decrease The Rotation Variable For The Quad 
+
+  // swap buffers to display, since we're double buffered.
+  SDL_GL_SwapBuffers ();
+
+  gst_video_frame_unmap (&v_frame);
+}
+
+static gboolean
+update_sdl_scene (gpointer data)
+{
+  GstElement *pipeline = (GstElement *) data;
+  SDL_Event event;
+
+  while (SDL_PollEvent (&event)) {
+    if (event.type == SDL_QUIT) {
+      gst_element_send_event (GST_ELEMENT (pipeline), gst_event_new_eos ());
+      return FALSE;
+    }
+    if (event.type == SDL_KEYDOWN) {
+      if (event.key.keysym.sym == SDLK_ESCAPE) {
+        gst_element_send_event (GST_ELEMENT (pipeline), gst_event_new_eos ());
+        return FALSE;
+      }
+    }
+  }
+
+  return TRUE;
+}
+
+static GMutex app_lock;
+static GCond app_cond;
+
+static gboolean
+executeCallback (gpointer data)
+{
+  GstSample *sample = (GstSample *) data;
+
+  g_mutex_lock (&app_lock);
+
+  DrawGLScene (sample);
+
+  g_cond_signal (&app_cond);
+  g_mutex_unlock (&app_lock);
+
+  return FALSE;
+}
+
+static gboolean
+on_client_draw (GstElement * glsink, GstGLContext * context, GstSample * sample,
+    gpointer data)
+{
+  g_mutex_lock (&app_lock);
+
+  g_idle_add_full (G_PRIORITY_HIGH, executeCallback, sample, NULL);
+  g_cond_wait (&app_cond, &app_lock);
+  g_mutex_unlock (&app_lock);
+
+  return TRUE;
+}
+
+/* gst bus signal watch callback */
+static void
+end_stream_cb (GstBus * bus, GstMessage * msg, GMainLoop * loop)
+{
+  switch (GST_MESSAGE_TYPE (msg)) {
+
+    case GST_MESSAGE_EOS:
+      g_print ("End-of-stream\n");
+      break;
+
+    case GST_MESSAGE_ERROR:
+    {
+      gchar *debug = NULL;
+      GError *err = NULL;
+
+      gst_message_parse_error (msg, &err, &debug);
+
+      g_print ("Error: %s\n", err->message);
+      g_error_free (err);
+
+      if (debug) {
+        g_print ("Debug deails: %s\n", debug);
+        g_free (debug);
+      }
+
+      break;
+    }
+
+    default:
+      break;
+  }
+
+  g_main_loop_quit (loop);
+}
+
+static gboolean
+sync_bus_call (GstBus * bus, GstMessage * msg, gpointer data)
+{
+  switch (GST_MESSAGE_TYPE (msg)) {
+    case GST_MESSAGE_NEED_CONTEXT:
+    {
+      const gchar *context_type;
+
+      gst_message_parse_context_type (msg, &context_type);
+      g_print ("got need context %s\n", context_type);
+
+      if (g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
+        GstContext *display_context =
+            gst_context_new (GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
+        gst_context_set_gl_display (display_context, sdl_gl_display);
+        gst_element_set_context (GST_ELEMENT (msg->src), display_context);
+        return TRUE;
+      } else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
+        GstContext *app_context = gst_context_new ("gst.gl.app_context", TRUE);
+        GstStructure *s = gst_context_writable_structure (app_context);
+        gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, sdl_context,
+            NULL);
+        gst_element_set_context (GST_ELEMENT (msg->src), app_context);
+        return TRUE;
+      }
+      break;
+    }
+    default:
+      break;
+  }
+  return FALSE;
+}
+
+int
+main (int argc, char **argv)
+{
+#ifdef WIN32
+  HGLRC sdl_gl_context = 0;
+  HDC sdl_dc = 0;
+#else
+  SDL_SysWMinfo info;
+  Display *sdl_display = NULL;
+  Window sdl_win = 0;
+  GLXContext sdl_gl_context = NULL;
+#endif
+
+  GMainLoop *loop = NULL;
+  GstPipeline *pipeline = NULL;
+  GstBus *bus = NULL;
+  GstElement *glimagesink = NULL;
+  const gchar *platform;
+
+  /* Initialize SDL for video output */
+  if (SDL_Init (SDL_INIT_VIDEO) < 0) {
+    fprintf (stderr, "Unable to initialize SDL: %s\n", SDL_GetError ());
+    return -1;
+  }
+
+  /* Create a 640x480 OpenGL screen */
+  if (SDL_SetVideoMode (640, 480, 0, SDL_OPENGL) == NULL) {
+    fprintf (stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError ());
+    SDL_Quit ();
+    return -1;
+  }
+
+  /* Set the title bar in environments that support it */
+  SDL_WM_SetCaption ("SDL and gst-plugins-gl", NULL);
+
+
+  /* Loop, drawing and checking events */
+  InitGL (640, 480);
+
+  gst_init (&argc, &argv);
+  loop = g_main_loop_new (NULL, FALSE);
+
+  /* retrieve and turn off sdl opengl context */
+#ifdef WIN32
+  sdl_gl_context = wglGetCurrentContext ();
+  sdl_dc = wglGetCurrentDC ();
+  wglMakeCurrent (0, 0);
+  platform = "wgl";
+  sdl_gl_display = gst_gl_display_new ();
+#else
+  SDL_VERSION (&info.version);
+  SDL_GetWMInfo (&info);
+  /* FIXME: This display is different to the one that SDL uses to create the
+   * GL context inside SDL_SetVideoMode() above which fails on Intel hardware
+   */
+  sdl_display = info.info.x11.gfxdisplay;
+  sdl_win = info.info.x11.window;
+  sdl_gl_context = glXGetCurrentContext ();
+  glXMakeCurrent (sdl_display, None, 0);
+  platform = "glx";
+  sdl_gl_display =
+      (GstGLDisplay *) gst_gl_display_x11_new_with_display (sdl_display);
+#endif
+
+  sdl_context =
+      gst_gl_context_new_wrapped (sdl_gl_display, (guintptr) sdl_gl_context,
+      gst_gl_platform_from_string (platform), GST_GL_API_OPENGL);
+
+  pipeline =
+      GST_PIPELINE (gst_parse_launch
+      ("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
+          "glimagesink name=glimagesink0", NULL));
+
+  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+  gst_bus_add_signal_watch (bus);
+  g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb), loop);
+  g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb), loop);
+  g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), loop);
+  gst_bus_enable_sync_message_emission (bus);
+  g_signal_connect (bus, "sync-message", G_CALLBACK (sync_bus_call), NULL);
+  gst_object_unref (bus);
+
+  glimagesink = gst_bin_get_by_name (GST_BIN (pipeline), "glimagesink0");
+  g_signal_connect (G_OBJECT (glimagesink), "client-draw",
+      G_CALLBACK (on_client_draw), NULL);
+  gst_object_unref (glimagesink);
+
+  /* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
+   * shared with the sdl one */
+  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
+
+  /* turn on back sdl opengl context */
+#ifdef WIN32
+  wglMakeCurrent (sdl_dc, sdl_gl_context);
+#else
+  glXMakeCurrent (sdl_display, sdl_win, sdl_gl_context);
+#endif
+
+  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
+
+  g_timeout_add (100, update_sdl_scene, pipeline);
+
+  g_main_loop_run (loop);
+
+  /* before to deinitialize the gst-gl-opengl context,
+   * no shared context (here the sdl one) must be current
+   */
+#ifdef WIN32
+  wglMakeCurrent (0, 0);
+#else
+  glXMakeCurrent (sdl_display, sdl_win, sdl_gl_context);
+#endif
+
+  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
+  gst_object_unref (pipeline);
+
+  /* turn on back sdl opengl context */
+#ifdef WIN32
+  wglMakeCurrent (sdl_dc, sdl_gl_context);
+#else
+  glXMakeCurrent (sdl_display, None, 0);
+#endif
+
+  SDL_Quit ();
+
+  return 0;
+}
diff --git a/tests/examples/mpegts/Makefile.in b/tests/examples/mpegts/Makefile.in
index 9e9e4d2..2177c17 100644
--- a/tests/examples/mpegts/Makefile.in
+++ b/tests/examples/mpegts/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -212,8 +212,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -252,7 +256,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -260,6 +263,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -309,8 +314,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -389,7 +392,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -398,7 +400,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -411,7 +412,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -436,6 +436,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -509,10 +511,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -538,6 +544,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -574,6 +583,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -614,17 +624,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -641,6 +650,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/mxf/Makefile.in b/tests/examples/mxf/Makefile.in
index 72ab5c1..5cab3ca 100644
--- a/tests/examples/mxf/Makefile.in
+++ b/tests/examples/mxf/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -216,8 +216,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -256,7 +260,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -264,6 +267,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -313,8 +318,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -393,7 +396,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -402,7 +404,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -415,7 +416,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -440,6 +440,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -513,10 +515,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -542,6 +548,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -578,6 +587,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -618,17 +628,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -645,6 +654,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/mxf/mxfdemux-structure.c b/tests/examples/mxf/mxfdemux-structure.c
index 6a263f7..1a802a7 100644
--- a/tests/examples/mxf/mxfdemux-structure.c
+++ b/tests/examples/mxf/mxfdemux-structure.c
@@ -29,31 +29,25 @@
 static gchar *
 g_value_to_string (const GValue * val)
 {
+  gchar *ret = NULL;
+
   if (G_VALUE_TYPE (val) == GST_TYPE_BUFFER) {
     GstBuffer *buf = gst_value_get_buffer (val);
     GstMapInfo map;
-    gchar *ret;
 
     gst_buffer_map (buf, &map, GST_MAP_READ);
     ret = g_base64_encode (map.data, map.size);
     gst_buffer_unmap (buf, &map);
-
-    return ret;
   } else {
     GValue s = { 0, };
-    gchar *ret;
 
     g_value_init (&s, G_TYPE_STRING);
-
-    if (!g_value_transform (val, &s)) {
-      return NULL;
+    if (g_value_transform (val, &s)) {
+      ret = g_value_dup_string (&s);
+      g_value_unset (&s);
     }
-
-    ret = g_value_dup_string (&s);
-    g_value_unset (&s);
-
-    return ret;
   }
+  return ret;
 }
 
 static gboolean
@@ -124,15 +118,32 @@
   gst_structure_foreach (s, insert_field, iter);
 }
 
-static void
-on_message (GstBus * bus, GstMessage * message, gpointer data)
+static gboolean
+bus_callback (GstBus * bus, GstMessage * message, gpointer data)
 {
   switch (GST_MESSAGE_TYPE (message)) {
-    case GST_MESSAGE_WARNING:
-    case GST_MESSAGE_ERROR:
-      g_error ("Got error");
+    case GST_MESSAGE_WARNING:{
+      GError *err;
+      gchar *debug;
+
+      gst_message_parse_warning (message, &err, &debug);
+      g_print ("Warning: %s\n", err->message);
+      g_error_free (err);
+      g_free (debug);
+      break;
+    }
+    case GST_MESSAGE_ERROR:{
+      GError *err;
+      gchar *debug = NULL;
+
+      gst_message_parse_error (message, &err, &debug);
+      g_print ("Error: %s : %s\n", err->message, debug);
+      g_error_free (err);
+      g_free (debug);
+
       gtk_main_quit ();
       break;
+    }
     case GST_MESSAGE_TAG:{
       GstTagList *tags;
       GValue v = { 0, };
@@ -160,6 +171,7 @@
     default:
       break;
   }
+  return TRUE;
 }
 
 static void
@@ -177,8 +189,8 @@
   gst_object_unref (bin);
 }
 
-gint
-main (gint argc, gchar ** argv)
+int
+main (int argc, char **argv)
 {
   GstElement *pipeline, *src, *mxfdemux;
   GstBus *bus;
@@ -189,8 +201,8 @@
     return -1;
   }
 
-  gst_init (NULL, NULL);
-  gtk_init (NULL, NULL);
+  gst_init (&argc, &argv);
+  gtk_init (&argc, &argv);
 
   pipeline = gst_pipeline_new ("pipeline");
 
@@ -212,8 +224,7 @@
   }
 
   bus = gst_element_get_bus (pipeline);
-  gst_bus_add_signal_watch (bus);
-  g_signal_connect (bus, "message", G_CALLBACK (on_message), NULL);
+  gst_bus_add_watch (bus, bus_callback, NULL);
   gst_object_unref (bus);
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -231,6 +242,7 @@
 
   gtk_container_add (GTK_CONTAINER (scrolled_window), treeview);
   gtk_container_add (GTK_CONTAINER (window), scrolled_window);
+  gtk_widget_show_all (window);
 
   gst_element_set_state (pipeline, GST_STATE_PLAYING);
 
diff --git a/tests/examples/opencv/Makefile.in b/tests/examples/opencv/Makefile.in
index 779ea1e..9396b67 100644
--- a/tests/examples/opencv/Makefile.in
+++ b/tests/examples/opencv/Makefile.in
@@ -92,6 +92,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -105,7 +106,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -228,8 +228,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -268,7 +272,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -276,6 +279,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -325,8 +330,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -405,7 +408,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -414,7 +416,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -427,7 +428,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -452,6 +452,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -525,10 +527,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -554,6 +560,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -590,6 +599,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -630,17 +640,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -657,6 +666,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/examples/opencv/gst_element_print_properties.c b/tests/examples/opencv/gst_element_print_properties.c
index 68ec8b8..b1b9dda 100644
--- a/tests/examples/opencv/gst_element_print_properties.c
+++ b/tests/examples/opencv/gst_element_print_properties.c
@@ -142,9 +142,10 @@
           gchar work_string[100];
 
           if (string_val == NULL)
-            sprintf (work_string, "\"%s\"", "null");
+            g_snprintf (work_string, sizeof (work_string), "\"%s\"", "null");
           else
-            sprintf (work_string, "\"%s\"", string_val);
+            g_snprintf (work_string, sizeof (work_string), "\"%s\"",
+                string_val);
           g_print ("%-*.*s", c3w, c3w, work_string);
         } else {
           g_print ("%-*s", c3w, "<not readable>");      /* alt current */
@@ -283,7 +284,8 @@
             g_print ("%-*s | %-*.*s |", c3w, "Caps (NULL)", c4w, c4w, " ");
           else {
             gchar prefix_string[100];
-            sprintf (prefix_string, "    | %-*.*s | ", c2w, c2w, " ");
+            g_snprintf (prefix_string, sizeof (prefix_string),
+                "    | %-*.*s | ", c2w, c2w, " ");
             print_caps (caps, prefix_string);
           }
         }
@@ -307,7 +309,8 @@
             j++;
           }
 
-          sprintf (work_string, "%d, \"%s\"", enum_value, cur_val_nick);
+          g_snprintf (work_string, sizeof (work_string), "%d, \"%s\"",
+              enum_value, cur_val_nick);
           g_print ("%-*.*s", c3w, c3w, work_string);
           g_print (" | Enum \"%s\" : %d, \"%s\"",
               g_type_name (G_VALUE_TYPE (&value)),
@@ -325,12 +328,12 @@
           def = flags_to_string (vals, pflags->default_value);  /* default */
 
           /* current */
-          sprintf (work_string, "0x%08x, \"%s\"",
+          g_snprintf (work_string, sizeof (work_string), "0x%08x, \"%s\"",
               g_value_get_flags (&value), cur);
           g_print ("%-*.*s", c3w, c3w, work_string);
 
           /* type */
-          sprintf (work_string, "Flags \"%s\"",
+          g_snprintf (work_string, sizeof (work_string), "Flags \"%s\"",
               g_type_name (G_VALUE_TYPE (&value)));
           g_print ("%-*.*s", c4w, c4w, work_string);
 
@@ -339,8 +342,8 @@
 
           /* values list */
           while (vals[0].value_name) {
-            sprintf (work_string, "\n    | %-*.*s |   (0x%08x): %-16s - %s",
-                c2w, c2w, "",
+            g_snprintf (work_string, sizeof (work_string),
+                "\n    | %-*.*s |   (0x%08x): %-16s - %s", c2w, c2w, "",
                 vals[0].value, vals[0].value_nick, vals[0].value_name);
             g_print ("%s", work_string);
             ++vals;
@@ -390,7 +393,7 @@
           gchar work_string[100];
 
           if (readable) {       /* current */
-            sprintf (work_string, "%d/%d",
+            g_snprintf (work_string, sizeof (work_string), "%d/%d",
                 gst_value_get_fraction_numerator (&value),
                 gst_value_get_fraction_denominator (&value));
             g_print ("%-*.*s", c3w, c3w, work_string);
@@ -450,7 +453,7 @@
   gint rlen = 0;
 
       /*--- column 1 - RWC ---*/
-  sprintf (work_string, "<-->|<");
+  g_snprintf (work_string, sizeof (work_string), "<-->|<");
 
       /*--- column 2 - property name ---*/
   llen = (c2w - 15) / 2;        /* width of " property name " = 15 */
@@ -497,13 +500,13 @@
   gchar work_string[100];
   GstElementFactory *factory = gst_element_get_factory (element);
 
-  sprintf (work_string, "ELEMENT CLASS NAME");
+  g_snprintf (work_string, sizeof (work_string), "ELEMENT CLASS NAME");
   g_print ("    | %-*s", c2w, work_string);
   g_print (" | %-*s", c3w, g_type_name (G_OBJECT_TYPE (element)));
   g_print (" | %-*s | \n", c4w, "");
 
 
-  sprintf (work_string, "ELEMENT FACTORY NAME");
+  g_snprintf (work_string, sizeof (work_string), "ELEMENT FACTORY NAME");
   g_print ("    | %-*s", c2w, work_string);
 
   g_print (" | %-*s", c3w,
diff --git a/tests/examples/opencv/gsthanddetect_test.c b/tests/examples/opencv/gsthanddetect_test.c
index 05e11ed..32463b5 100644
--- a/tests/examples/opencv/gsthanddetect_test.c
+++ b/tests/examples/opencv/gsthanddetect_test.c
@@ -4,19 +4,20 @@
  *  gsthanddetect_test: gsteramer handdetect plugin demo application,
  *  part work of GSoc 2012 project
  *
+ * 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 program 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 3 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.
  *
- *  This program 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 program.  If not, see <http://www.gnu.org/licenses/>.
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  *
  */
 
diff --git a/tests/examples/uvch264/Makefile.in b/tests/examples/uvch264/Makefile.in
index c8c5744..3913620 100644
--- a/tests/examples/uvch264/Makefile.in
+++ b/tests/examples/uvch264/Makefile.in
@@ -91,6 +91,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -104,7 +105,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -220,8 +220,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -260,7 +264,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -268,6 +271,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -317,8 +322,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -397,7 +400,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -406,7 +408,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -419,7 +420,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -444,6 +444,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -517,10 +519,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -546,6 +552,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -582,6 +591,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -622,17 +632,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -649,6 +658,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tests/files/Makefile.am b/tests/files/Makefile.am
index 710d286..2807612 100644
--- a/tests/files/Makefile.am
+++ b/tests/files/Makefile.am
@@ -1,5 +1,6 @@
 EXTRA_DIST = \
 	barcode.png \
+	blue-square.png \
 	cbr_stream.mp3 \
 	s16be-id3v2.aiff \
 	stream.mp2 \
diff --git a/tests/files/Makefile.in b/tests/files/Makefile.in
index cf88372..2f26b2b 100644
--- a/tests/files/Makefile.in
+++ b/tests/files/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -158,8 +158,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -198,7 +202,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -206,6 +209,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -255,8 +260,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -335,7 +338,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -344,7 +346,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -357,7 +358,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -382,6 +382,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -455,10 +457,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -484,6 +490,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -520,6 +529,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -560,17 +570,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -587,6 +596,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -640,6 +650,7 @@
 wayland_scanner = @wayland_scanner@
 EXTRA_DIST = \
 	barcode.png \
+	blue-square.png \
 	cbr_stream.mp3 \
 	s16be-id3v2.aiff \
 	stream.mp2 \
diff --git a/tests/files/blue-square.png b/tests/files/blue-square.png
new file mode 100644
index 0000000..40d85c2
--- /dev/null
+++ b/tests/files/blue-square.png
Binary files differ
diff --git a/tests/icles/Makefile.in b/tests/icles/Makefile.in
index aa03961..72fe1d8 100644
--- a/tests/icles/Makefile.in
+++ b/tests/icles/Makefile.in
@@ -90,6 +90,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -103,7 +104,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -227,8 +227,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -267,7 +271,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -275,6 +278,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -324,8 +329,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -404,7 +407,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -413,7 +415,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -426,7 +427,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -451,6 +451,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -524,10 +526,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -553,6 +559,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -589,6 +598,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -629,17 +639,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -656,6 +665,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/tools/Makefile.in b/tools/Makefile.in
index f8b4f56..7442e78 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -87,6 +87,7 @@
 	$(top_srcdir)/common/m4/as-libtool.m4 \
 	$(top_srcdir)/common/m4/as-version.m4 \
 	$(top_srcdir)/common/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/common/m4/ax_pthread.m4 \
 	$(top_srcdir)/common/m4/gst-arch.m4 \
 	$(top_srcdir)/common/m4/gst-args.m4 \
 	$(top_srcdir)/common/m4/gst-check.m4 \
@@ -100,7 +101,6 @@
 	$(top_srcdir)/common/m4/gst-platform.m4 \
 	$(top_srcdir)/common/m4/gst-plugin-docs.m4 \
 	$(top_srcdir)/common/m4/gst-plugindir.m4 \
-	$(top_srcdir)/common/m4/gst-x11.m4 \
 	$(top_srcdir)/common/m4/gst.m4 \
 	$(top_srcdir)/common/m4/gtk-doc.m4 \
 	$(top_srcdir)/common/m4/introspection.m4 \
@@ -158,8 +158,12 @@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
-BLUEZ_CFLAGS = @BLUEZ_CFLAGS@
-BLUEZ_LIBS = @BLUEZ_LIBS@
+BLUEZ4_CFLAGS = @BLUEZ4_CFLAGS@
+BLUEZ4_LIBS = @BLUEZ4_LIBS@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+BS2B_CFLAGS = @BS2B_CFLAGS@
+BS2B_LIBS = @BS2B_LIBS@
 BZ2_LIBS = @BZ2_LIBS@
 CC = @CC@
 CCASFLAGS = @CCASFLAGS@
@@ -198,7 +202,6 @@
 DEPDIR = @DEPDIR@
 DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
 DIRECT3D_LIBS = @DIRECT3D_LIBS@
-DIRECTDRAW_LIBS = @DIRECTDRAW_LIBS@
 DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
 DIRECTFB_LIBS = @DIRECTFB_LIBS@
 DIRECTSOUND_LIBS = @DIRECTSOUND_LIBS@
@@ -206,6 +209,8 @@
 DIRECTX_LDFLAGS = @DIRECTX_LDFLAGS@
 DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
+DTLS_CFLAGS = @DTLS_CFLAGS@
+DTLS_LIBS = @DTLS_LIBS@
 DTS_LIBS = @DTS_LIBS@
 DUMPBIN = @DUMPBIN@
 DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
@@ -255,8 +260,6 @@
 GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
-GMYTH_CFLAGS = @GMYTH_CFLAGS@
-GMYTH_LIBS = @GMYTH_LIBS@
 GRAPHENE_CFLAGS = @GRAPHENE_CFLAGS@
 GRAPHENE_LIBS = @GRAPHENE_LIBS@
 GREP = @GREP@
@@ -335,7 +338,6 @@
 HAVE_CLUTTER_X11 = @HAVE_CLUTTER_X11@
 HAVE_CXX = @HAVE_CXX@
 HAVE_DIRECT3D = @HAVE_DIRECT3D@
-HAVE_DIRECTDRAW = @HAVE_DIRECTDRAW@
 HAVE_DIRECTSOUND = @HAVE_DIRECTSOUND@
 HAVE_DTS = @HAVE_DTS@
 HAVE_EGL = @HAVE_EGL@
@@ -344,7 +346,6 @@
 HAVE_FLITE = @HAVE_FLITE@
 HAVE_GL = @HAVE_GL@
 HAVE_GLES2 = @HAVE_GLES2@
-HAVE_GLU = @HAVE_GLU@
 HAVE_GRAPHENE = @HAVE_GRAPHENE@
 HAVE_GSM = @HAVE_GSM@
 HAVE_GTK3 = @HAVE_GTK3@
@@ -357,7 +358,6 @@
 HAVE_WILDMIDI = @HAVE_WILDMIDI@
 HAVE_WINKS = @HAVE_WINKS@
 HAVE_WINSCREENCAP = @HAVE_WINSCREENCAP@
-HAVE_X = @HAVE_X@
 HAVE_X11 = @HAVE_X11@
 HTML_DIR = @HTML_DIR@
 INSTALL = @INSTALL@
@@ -382,6 +382,8 @@
 LDFLAGS = @LDFLAGS@
 LIBDC1394_CFLAGS = @LIBDC1394_CFLAGS@
 LIBDC1394_LIBS = @LIBDC1394_LIBS@
+LIBDE265_CFLAGS = @LIBDE265_CFLAGS@
+LIBDE265_LIBS = @LIBDE265_LIBS@
 LIBDIR = @LIBDIR@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
 LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
@@ -455,10 +457,14 @@
 OPENCV_PREFIX = @OPENCV_PREFIX@
 OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
 OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENH264_CFLAGS = @OPENH264_CFLAGS@
+OPENH264_LIBS = @OPENH264_LIBS@
 OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
 OPENJPEG_LIBS = @OPENJPEG_LIBS@
 OPENNI2_CFLAGS = @OPENNI2_CFLAGS@
 OPENNI2_LIBS = @OPENNI2_LIBS@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
 OPUS_CFLAGS = @OPUS_CFLAGS@
 OPUS_LIBS = @OPUS_LIBS@
 ORCC = @ORCC@
@@ -484,6 +490,9 @@
 PLUGINDIR = @PLUGINDIR@
 POSUB = @POSUB@
 PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
 PVR_CFLAGS = @PVR_CFLAGS@
 PVR_LIBS = @PVR_LIBS@
 PYTHON = @PYTHON@
@@ -520,6 +529,7 @@
 SPANDSP_CFLAGS = @SPANDSP_CFLAGS@
 SPANDSP_LIBS = @SPANDSP_LIBS@
 SPC_LIBS = @SPC_LIBS@
+SRTP_CFLAGS = @SRTP_CFLAGS@
 SRTP_LIBS = @SRTP_LIBS@
 SSH2_CFLAGS = @SSH2_CFLAGS@
 SSH2_LIBS = @SSH2_LIBS@
@@ -560,17 +570,16 @@
 WINSOCK2_LIBS = @WINSOCK2_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
 X11_LIBS = @X11_LIBS@
+X265_CFLAGS = @X265_CFLAGS@
+X265_LIBS = @X265_LIBS@
 XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
 XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-XMKMF = @XMKMF@
 XVID_LIBS = @XVID_LIBS@
 X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
 X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
 ZBAR_CFLAGS = @ZBAR_CFLAGS@
 ZBAR_LIBS = @ZBAR_LIBS@
 abs_builddir = @abs_builddir@
@@ -587,6 +596,7 @@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+ax_pthread_config = @ax_pthread_config@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
diff --git a/win32/MANIFEST b/win32/MANIFEST
index c9c97cf..cfba3b3 100644
--- a/win32/MANIFEST
+++ b/win32/MANIFEST
@@ -7,4 +7,3 @@
 win32/vs6/libgstmpegvideoparse.dsp
 win32/vs6/libgstneon.dsp
 win32/vs8/gst-plugins-bad.sln
-win32/vs8/libgstdirectdraw.vcproj
diff --git a/win32/common/config.h b/win32/common/config.h
index 3d1d3b6..b86dbb5 100644
--- a/win32/common/config.h
+++ b/win32/common/config.h
@@ -86,7 +86,7 @@
 #define GST_PACKAGE_ORIGIN "Unknown package origin"
 
 /* GStreamer package release date/time for plugins as YYYY-MM-DD */
-#define GST_PACKAGE_RELEASE_DATETIME "2014-12-18"
+#define GST_PACKAGE_RELEASE_DATETIME "2014-07-19"
 
 /* Define if static plugins should be built */
 #undef GST_PLUGIN_BUILD_STATIC
@@ -547,9 +547,6 @@
 /* Define if building with VideoToolbox */
 #undef HAVE_VIDEOTOOLBOX
 
-/* Define if building with VideoToolbox >= 10.9.6 */
-#undef HAVE_VIDEOTOOLBOX_10_9_6
-
 /* Define to enable vo-aacenc library (used by vo-aacenc). */
 #undef HAVE_VOAACENC
 
@@ -640,7 +637,7 @@
 #define PACKAGE_NAME "GStreamer Bad Plug-ins"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GStreamer Bad Plug-ins 1.4.5"
+#define PACKAGE_STRING "GStreamer Bad Plug-ins 1.4.0"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "gst-plugins-bad"
@@ -649,7 +646,7 @@
 #undef PACKAGE_URL
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.4.5"
+#define PACKAGE_VERSION "1.4.0"
 
 /* directory where plugins are located */
 #ifdef _DEBUG
@@ -689,7 +686,7 @@
 #undef USE_EGL_RPI
 
 /* Version number of package */
-#define VERSION "1.4.5"
+#define VERSION "1.4.0"
 
 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
    significant byte first (like Motorola and SPARC, unlike Intel). */
diff --git a/win32/vs8/libgstdirectdraw.vcproj b/win32/vs8/libgstdirectdraw.vcproj
deleted file mode 100644
index 0e64b45..0000000
--- a/win32/vs8/libgstdirectdraw.vcproj
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="libgstdirectdraw"
-	ProjectGUID="{1594A623-5529-4B86-BD4A-694CF0BDB5C4}"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="C:\msys\1.0\local\include;C:\msys\1.0\local\include\libxml2;&quot;C:\msys\1.0\local\include\glib-2.0&quot;;&quot;C:\msys\1.0\local\lib\glib-2.0\include&quot;;&quot;C:\msys\1.0\local\include\gstreamer-0.10&quot;;..\common;&quot;$(DXSDK_DIR)Include&quot;"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTDIRECTDRAW_EXPORTS;HAVE_CONFIG_H"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ddraw.lib libgstinterfaces-0.10.lib libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib user32.lib gdi32.lib dxguid.lib"
-				OutputFile="$(OutDir)/libgstdirectdraw.dll"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="C:\msys\1.0\local\lib;&quot;$(DXSDK_DIR)Lib\x86&quot;"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/libgstdirectdraw.pdb"
-				SubSystem="2"
-				ImportLibrary="$(OutDir)/libgstdirectdraw.lib"
-				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 Debug\libgstdirectdraw.dll c:\msys\1.0\local\lib\gstreamer-0.10"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="C:\msys\1.0\local\include;C:\msys\1.0\local\include\libxml2;&quot;C:\msys\1.0\local\include\glib-2.0&quot;;&quot;C:\msys\1.0\local\lib\glib-2.0\include&quot;;&quot;C:\msys\1.0\local\include\gstreamer-0.10&quot;;..\common;&quot;$(DXSDK_DIR)Include&quot;"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTDIRECTDRAW_EXPORTS;HAVE_CONFIG_H"
-				RuntimeLibrary="0"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ddraw.lib libgstinterfaces-0.10.lib libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib user32.lib gdi32.lib dxguid.lib"
-				OutputFile="$(OutDir)/libgstdirectdraw.dll"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="C:\msys\1.0\local\lib;&quot;$(DXSDK_DIR)Lib\x86&quot;"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				ImportLibrary="$(OutDir)/libgstdirectdraw.lib"
-				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 Release\libgstdirectdraw.dll c:\msys\1.0\local\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="..\..\sys\directdraw\gstdirectdrawplugin.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\sys\directdraw\gstdirectdrawsink.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\sys\directdraw\gstdirectdrawsink.h"
-				>
-			</File>
-		</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>